/*===========================================================================*\ | This swaps the position of 2 morphs in the channel list | \*===========================================================================*/ Value* wm3_MoveMorph_cf(Value** arg_list, int count) { check_arg_count(wm3_MoveMorph_cf, 3, count); type_check(arg_list[0], MAXModifier, _T("WM3_MoveMorph [Morpher Modifier] [Morph Source Index] [Morph Destination Index]")); type_check(arg_list[1], Integer, _T("WM3_MoveMorph [Morpher Modifier] [Morph Source Index] [Morph Destination Index]")); type_check(arg_list[2], Integer, _T("WM3_MoveMorph [Morpher Modifier] [Morph Source Index] [Morph Destination Index]")); ReferenceTarget* obj = arg_list[0]->to_modifier(); if( !check_ValidMorpher(obj,arg_list) ) return &false_value; MorphR3 *mp = (MorphR3*)arg_list[0]->to_modifier(); int morphIndexA = arg_list[2]->to_int(); morphIndexA--; if(morphIndexA>=100) morphIndexA = 99; if(morphIndexA<0) morphIndexA = 0; int morphIndexB = arg_list[1]->to_int(); morphIndexB--; if(morphIndexB>=100) morphIndexB = 99; if(morphIndexB<0) morphIndexB = 0; MaxMorphModifier maxMorpher(mp); bool res = maxMorpher.MoveMorphChannel(morphIndexA, morphIndexB); maxMorpher.RefreshChannelsUI(); return (res ? &true_value : &false_value); }
Value* wm3_DeleteMarker_cf(Value** arg_list, int count) { check_arg_count(wm3_DeleteMarker_cf, 2, count); type_check(arg_list[0], MAXModifier, _T("wm3_DeletMarker [Morpher Modifier] [Morph Index]")); type_check(arg_list[1], Integer, _T("wm3_DeletMarker [Morpher Modifier] [Morph Index]")); ReferenceTarget* obj = arg_list[0]->to_modifier(); if( !check_ValidMorpher(obj,arg_list) ) return &false_value; MorphR3 *mp = (MorphR3*)arg_list[0]->to_modifier(); int sel = arg_list[1]->to_int(); sel -= 1; if ( (sel >= 0) && (sel < mp->markerName.Count())) { #pragma warning (push) #pragma warning (disable: 4996) IMorphClass imp; imp.HoldMarkers(mp); #pragma warning (pop) mp->markerName.Delete(sel,1); mp->markerIndex.Delete(sel,1); mp->Update_channelMarkers(); return &true_value; } return &false_value; }
/*===========================================================================*\ | Sets the the progressive morph tension | \*===========================================================================*/ Value* wm3_SetProgressiveMorphTension_cf(Value** arg_list, int count) { check_arg_count(wm3_SetProgressiveMorphTension_cf, 3, count); type_check(arg_list[0], MAXModifier, _T("WM3_SetProgressiveMorphTension [Morpher Modifier] [Morph Index] [Tension]")); type_check(arg_list[1], Integer, _T("WM3_SetProgressiveMorphTension [Morpher Modifier] [Morph Index] [Tension]")); type_check(arg_list[2], Float, _T("WM3_SetProgressiveMorphTension [Morpher Modifier] [Morph Index] [Tension]")); ReferenceTarget* obj = arg_list[0]->to_modifier(); if( !check_ValidMorpher(obj,arg_list) ) return &false_value; MorphR3 *mp = (MorphR3*)arg_list[0]->to_modifier(); int morphIndex = arg_list[1]->to_int(); morphIndex--; if(morphIndex>=100) morphIndex = 99; if(morphIndex<0) morphIndex = 0; float tension = arg_list[2]->to_float(); INode *node = NULL; MaxMorphModifier maxMorpher(mp); bool res = maxMorpher.GetMorphChannel(morphIndex).SetProgressiveMorphTension(tension); mp->Update_channelParams(); return (res ? &true_value : &false_value); }
/*===========================================================================*\ | Deletes a progressives Morph | \*===========================================================================*/ Value* wm3_DeleteProgressiveMorphNode_cf(Value** arg_list, int count) { check_arg_count(wm3_DeleteProgressiveMorphNode, 3, count); type_check(arg_list[0], MAXModifier, _T("WM3_DeleteProgressiveMorphNode [Morpher Modifier] [Morph Index] [Progressive Morph Index]")); type_check(arg_list[1], Integer, _T("WM3_DeleteProgressiveMorphNode [Morpher Modifier] [Morph Index] [Progressive Morph Index]")) type_check(arg_list[2], Integer, _T("WM3_DeleteProgressiveMorphNode [Morpher Modifier] [Morph Index] [Progressive Morph Index]")); ReferenceTarget* obj = arg_list[0]->to_modifier(); if( !check_ValidMorpher(obj,arg_list) ) return &false_value; MorphR3 *mp = (MorphR3*)arg_list[0]->to_modifier(); int morphIndex = arg_list[1]->to_int(); morphIndex--; if(morphIndex>=100) morphIndex = 99; if(morphIndex<0) morphIndex = 0; int pMorphIndex = arg_list[2]->to_int(); pMorphIndex--; MaxMorphModifier maxMorpher(mp); bool res = maxMorpher.GetMorphChannel(morphIndex).DeleteProgressiveMorphTarget(pMorphIndex); return (res ? &true_value : &false_value); }
Value* wm3_CreateMarker_cf(Value** arg_list, int count) { check_arg_count(wm3_CreateMarker_cf, 3, count); type_check(arg_list[0], MAXModifier, _T("wm3_CreateMarker [Morpher Modifier] [Morph Index] [Marker Name]")); type_check(arg_list[1], Integer, _T("wm3_CreateMarker [Morpher Modifier] [Morph Index] [Marker Name]")); type_check(arg_list[2], String, _T("wm3_CreateMarker [Morpher Modifier] [Morph Index] [Marker Name]")); ReferenceTarget* obj = arg_list[0]->to_modifier(); if( !check_ValidMorpher(obj,arg_list) ) return &false_value; MorphR3 *mp = (MorphR3*)arg_list[0]->to_modifier(); int sel = arg_list[1]->to_int(); sel -= 1; const TCHAR *name = arg_list[2]->to_string(); if (sel >= 0) { #pragma warning (push) #pragma warning (disable: 4996) IMorphClass imp; imp.HoldMarkers(mp); #pragma warning (pop) mp->markerName.AddName(name); mp->markerIndex.Append(1,&sel,0); mp->Update_channelMarkers(); return &true_value; } return &false_value; }
Value* wm3_mc_settarget_cf(Value** arg_list, int count) { check_arg_count(wm3_mc_settarget, 3, count); type_check(arg_list[0], MAXModifier, _T("WM3_MC_SetTarget [Morpher Modifier] [Channel Index] [Node]")); type_check(arg_list[1], Integer, _T("WM3_MC_SetTarget [Morpher Modifier] [Channel Index] [Node]")); type_check(arg_list[2], MAXNode, _T("WM3_MC_SetTarget [Morpher Modifier] [Channel Index] [Node]")); ReferenceTarget* obj = arg_list[0]->to_modifier(); if( !check_ValidMorpher(obj,arg_list) ) return &false_value; int sel = arg_list[1]->to_int(); sel -= 1; if(sel>=100) sel = 99; if(sel<0) sel = 0; MorphR3 *mp = (MorphR3*)arg_list[0]->to_modifier(); INode *node = NULL; node = arg_list[2]->to_node(); if (node == NULL) return &false_value; MaxMorphModifier maxMorpher(mp); MaxMorphChannel maxMorphChannel = maxMorpher.GetMorphChannel(sel); if (NULL != maxMorphChannel.GetMorphTarget()) return &false_value; if (maxMorphChannel.SetMorphTarget(node, MAXScript_time())) { return &true_value; } return &false_value; }
/*===========================================================================*\ | Returns the the progressive morph Node | \*===========================================================================*/ Value* wm3_GetProgressiveMorphNode_cf(Value** arg_list, int count) { check_arg_count(wm3_GetProgressiveMorphNode_cf, 3, count); type_check(arg_list[0], MAXModifier, _T("WM3_GetProgressiveMorphNode [Morpher Modifier] [Morph Index] [Progressive Morph Index]")); type_check(arg_list[1], Integer, _T("WM3_GetProgressiveMorphNode [Morpher Modifier] [Morph Index] [Progressive Morph Index]")); type_check(arg_list[2], Integer, _T("WM3_GetProgressiveMorphNode [Morpher Modifier] [Morph Index] [Progressive Morph Index]")); ReferenceTarget* obj = arg_list[0]->to_modifier(); if( !check_ValidMorpher(obj,arg_list) ) return &false_value; MorphR3 *mp = (MorphR3*)arg_list[0]->to_modifier(); int morphIndex = arg_list[1]->to_int(); morphIndex--; if(morphIndex>=100) morphIndex = 99; if(morphIndex<0) morphIndex = 0; int pMorphIndex = arg_list[2]->to_int(); pMorphIndex--; MaxMorphModifier maxMorpher(mp); INode *node = maxMorpher.GetMorphChannel(morphIndex).GetProgressiveMorphTarget(pMorphIndex); if (node != NULL) { return MAXNode::intern(node); } return &undefined; }
/*===========================================================================*\ | Returns the the progressive morph weight | \*===========================================================================*/ Value* wm3_SetProgressiveMorphWeight_cf(Value** arg_list, int count) { check_arg_count(WM3_SetProgressiveMorphWeight_cf, 4, count); type_check(arg_list[0], MAXModifier, _T("WM3_SetProgressiveMorphWeight [Morpher Modifier] [Morph Index] [Progressive Node] [Weight]")); type_check(arg_list[1], Integer, _T("WM3_SetProgressiveMorphWeight [Morpher Modifier] [Morph Index] [Progressive Node] [Weight]")); type_check(arg_list[2], MAXNode, _T("WM3_SetProgressiveMorphWeight [Morpher Modifier] [Morph Index] [Progressive Node] [Weight]")); type_check(arg_list[3], Float, _T("WM3_SetProgressiveMorphWeight [Morpher Modifier] [Morph Index] [Progressive Node] [Weight]")); ReferenceTarget* obj = arg_list[0]->to_modifier(); if( !check_ValidMorpher(obj,arg_list) ) return &false_value; MorphR3 *mp = (MorphR3*)arg_list[0]->to_modifier(); int morphIndex = arg_list[1]->to_int(); morphIndex--; if(morphIndex>=100) morphIndex = 99; if(morphIndex<0) morphIndex = 0; INode *node = NULL; node = arg_list[2]->to_node(); float weight = arg_list[3]->to_float(); if (node == NULL) return &false_value; MaxMorphModifier maxMorpher(mp); int pMorphCount = maxMorpher.GetMorphChannel(morphIndex).NumProgressiveMorphTargets(); int pMorphIndex = -1; if (node == (INode*)mp->GetReference(101+morphIndex)) { pMorphIndex = 0; } else { for (int i = 1; i < (pMorphCount); i++) { int refnum = 200+i+morphIndex*MAX_PROGRESSIVE_TARGETS; if (node == (INode*)mp->GetReference(refnum)) { pMorphIndex = i ; break; } } } bool res = maxMorpher.GetMorphChannel(morphIndex).SetProgressiveMorphWeight(pMorphIndex, weight); if (res) { mp->Update_channelFULL(); mp->Update_channelParams(); } return (res ? &true_value : &false_value); }
Value* is_morpher_cf(Value** arg_list, int count) { check_arg_count(is_morpher, 1, count); type_check(arg_list[0], MAXModifier, "IsValidMorpherMod [Morpher Modifier]"); ReferenceTarget* obj = arg_list[0]->to_modifier(); if( !check_ValidMorpher(obj,arg_list) ) return &false_value; return &true_value; }
Value* wm3_refeshmcpUI_cf(Value** arg_list, int count) { check_arg_count(wm3_refeshmcpUI, 1, count); type_check(arg_list[0], MAXModifier, "WM3_RefreshChannelParamsUI [Morpher Modifier]"); ReferenceTarget* obj = arg_list[0]->to_modifier(); if( !check_ValidMorpher(obj,arg_list) ) return &false_value; MorphR3 *mp = (MorphR3*)arg_list[0]->to_modifier(); mp->Update_channelParams(); return &true_value; }
/*===========================================================================*\ | Returns the the progressive morph weight | \*===========================================================================*/ Value* wm3_GetProgressiveMorphWeight_cf(Value** arg_list, int count) { check_arg_count(wm3_GetProgressiveMorphWeight_cf, 3, count); type_check(arg_list[0], MAXModifier, _T("WM3_GetProgressiveMorphWeight [Morpher Modifier] [Morph Index] [Progressive Node]")); type_check(arg_list[1], Integer, _T("WM3_GetProgressiveMorphWeight [Morpher Modifier] [Morph Index] [Progressive Node]")); type_check(arg_list[2], MAXNode, _T("WM3_GetProgressiveMorphWeight [Morpher Modifier] [Morph Index] [Progressive Node]")); ReferenceTarget* obj = arg_list[0]->to_modifier(); if( !check_ValidMorpher(obj,arg_list) ) return &false_value; MorphR3 *mp = (MorphR3*)arg_list[0]->to_modifier(); int morphIndex = arg_list[1]->to_int(); morphIndex--; if(morphIndex>=100) morphIndex = 99; if(morphIndex<0) morphIndex = 0; INode *node = NULL; node = arg_list[2]->to_node(); float weight = 0.0f; if (node == NULL) return Float::intern(weight); MaxMorphModifier maxMorpher(mp); int pMorphCount = maxMorpher.GetMorphChannel(morphIndex).NumMaxProgressiveTargets(); int pMorphIndex = -1; if (node == (INode*)mp->GetReference(101+morphIndex)) { pMorphIndex = 0; } else { for (int i = 1; i < (pMorphCount); i++) { int refnum = 200+i+morphIndex*MAX_PROGRESSIVE_TARGETS; if (node == (INode*)mp->GetReference(refnum)) { pMorphIndex = i ; break; } } } weight = maxMorpher.GetMorphChannel(morphIndex).GetProgressiveMorphWeight(pMorphIndex); return Float::intern(weight); }
Value* wm3_setscrollpos_cf(Value** arg_list, int count) { check_arg_count(wm3_setscrollpos, 2, count); type_check(arg_list[0], MAXModifier, "WM3_SetChannelPos [Morpher Modifier] [NewPos]"); type_check(arg_list[1], Integer, "WM3_SetChannelPos [Morpher Modifier] [NewPos]"); ReferenceTarget* obj = arg_list[0]->to_modifier(); if( !check_ValidMorpher(obj,arg_list) ) return &false_value; MorphR3 *mp = (MorphR3*)arg_list[0]->to_modifier(); mp->VScroll(SB_THUMBPOSITION,(arg_list[1]->to_int()-1)); return &true_value; }
/*===========================================================================*\ | Returns the number of markers for the modifier \*===========================================================================*/ Value* wm3_NumberOfMarkers_cf(Value** arg_list, int count) { check_arg_count(wm3_NumberOfMarkers_cf, 1, count); type_check(arg_list[0], MAXModifier, _T("WM3_NumberOfMarkers [Morpher Modifier]")); ReferenceTarget* obj = arg_list[0]->to_modifier(); if( !check_ValidMorpher(obj,arg_list) ) return &false_value; MorphR3 *mp = (MorphR3*)arg_list[0]->to_modifier(); int ct = mp->markerName.Count(); return Integer::intern(ct); }
/*===========================================================================*\ | Returns the number of channels \*===========================================================================*/ Value* wm3_NumberOfChannels_cf(Value** arg_list, int count) { check_arg_count(wm3_NumberOfChannels_cf, 1, count); type_check(arg_list[0], MAXModifier, _T("WM3_NumberOfChannels [Morpher Modifier]")); ReferenceTarget* obj = arg_list[0]->to_modifier(); if( !check_ValidMorpher(obj,arg_list) ) return &false_value; MorphR3 *mp = (MorphR3*)arg_list[0]->to_modifier(); MaxMorphModifier maxMorpher(mp); int ct = maxMorpher.NumMorphChannels(); return Integer::intern(ct); }
Value* wm3_rebuildIMC_cf(Value** arg_list, int count) { check_arg_count(wm3_rebuildIMC, 1, count); type_check(arg_list[0], MAXModifier, _T("WM3_RebuildInternalCache [Morpher Modifier]")); ReferenceTarget* obj = arg_list[0]->to_modifier(); if( !check_ValidMorpher(obj,arg_list) ) return &false_value; MorphR3 *mp = (MorphR3*)arg_list[0]->to_modifier(); mp->MC_Local.NukeCache(); mp->NotifyDependents(FOREVER,PART_ALL,REFMSG_CHANGE); needs_redraw_set(); return &true_value; }
/*===========================================================================*\ | Returns the current active marker. This returns -1 if none are active \*===========================================================================*/ Value* wm3_GetCurrentMarker_cf(Value** arg_list, int count) { check_arg_count(wm3_GetCurrentMarker_cf, 1, count); type_check(arg_list[0], MAXModifier, _T("wm3_GetCurrentMarker [Morpher Modifier]")); ReferenceTarget* obj = arg_list[0]->to_modifier(); if( !check_ValidMorpher(obj,arg_list) ) return &false_value; MorphR3 *mp = (MorphR3*)arg_list[0]->to_modifier(); int index = mp->markerSel; if (index >= 0) index++; return Integer::intern(index); }
Value* wm3_mc_getnummpts_cf(Value** arg_list, int count) { check_arg_count(wm3_mc_getnummpts, 2, count); type_check(arg_list[0], MAXModifier, _T("WM3_MC_NumMPts [Morpher Modifier] [Channel Index]")); type_check(arg_list[1], Integer, _T("WM3_MC_NumMPts [Morpher Modifier] [Channel Index]")); ReferenceTarget* obj = arg_list[0]->to_modifier(); if( !check_ValidMorpher(obj,arg_list) ) return &false_value; int sel = arg_list[1]->to_int(); sel -= 1; if(sel>=100) sel = 99; if(sel<0) sel = 0; MorphR3 *mp = (MorphR3*)arg_list[0]->to_modifier(); return Integer::intern(static_cast<int>(mp->chanBank[sel].mPoints.size())); // SR DCAST64: Downcast to 2G limit. }
Value* wm3_mc_getlimitmin_cf(Value** arg_list, int count) { check_arg_count(wm3_mc_getlimitmin, 2, count); type_check(arg_list[0], MAXModifier, _T("WM3_MC_GetLimitMIN [Morpher Modifier] [Channel Index]")); type_check(arg_list[1], Integer, _T("WM3_MC_GetLimitMIN [Morpher Modifier] [Channel Index]")); ReferenceTarget* obj = arg_list[0]->to_modifier(); if( !check_ValidMorpher(obj,arg_list) ) return &false_value; int sel = arg_list[1]->to_int(); sel -= 1; if(sel>=100) sel = 99; if(sel<0) sel = 0; MorphR3 *mp = (MorphR3*)arg_list[0]->to_modifier(); return Float::intern(mp->chanBank[sel].mSpinmin); }
Value* wm3_mc_getname_cf(Value** arg_list, int count) { check_arg_count(wm3_mc_getname, 2, count); type_check(arg_list[0], MAXModifier, _T("WM3_MC_GetName [Morpher Modifier] [Channel Index]")); type_check(arg_list[1], Integer, _T("WM3_MC_GetName [Morpher Modifier] [Channel Index]")); ReferenceTarget* obj = arg_list[0]->to_modifier(); if( !check_ValidMorpher(obj,arg_list) ) return &false_value; int sel = arg_list[1]->to_int(); sel -= 1; if(sel>=100) sel = 99; if(sel<0) sel = 0; MorphR3 *mp = (MorphR3*)arg_list[0]->to_modifier(); MaxMorphModifier maxMorpher(mp); return new String(maxMorpher.GetMorphChannel(sel).GetName()); }
Value* wm3_mc_getmorphweight_cf(Value** arg_list, int count) { check_arg_count(wm3_mc_getmorphweight, 3, count); type_check(arg_list[0], MAXModifier, _T("WM3_MC_GetMorphWeight [Morpher Modifier] [Channel Index] [Index]")); type_check(arg_list[1], Integer, _T("WM3_MC_GetMorphWeight [Morpher Modifier] [Channel Index] [Index]")); type_check(arg_list[2], Integer, _T("WM3_MC_GetMorphWeight [Morpher Modifier] [Channel Index] [Index]")); ReferenceTarget* obj = arg_list[0]->to_modifier(); if( !check_ValidMorpher(obj,arg_list) ) return &false_value; int sel = arg_list[1]->to_int(); sel -= 1; if(sel>=100) sel = 99; if(sel<0) sel = 0; MorphR3 *mp = (MorphR3*)arg_list[0]->to_modifier(); MaxMorphModifier maxMorpher(mp); return Float::intern((float)maxMorpher.GetMorphChannel(sel).GetMorphPointWeight(arg_list[2]->to_int())); }
Value* wm3_mc_rebuild_cf(Value** arg_list, int count) { check_arg_count(wm3_mc_rebuild, 2, count); type_check(arg_list[0], MAXModifier, _T("WM3_MC_Rebuild [Morpher Modifier] [Channel Index]")); type_check(arg_list[1], Integer, _T("WM3_MC_Rebuild [Morpher Modifier] [Channel Index]")); ReferenceTarget* obj = arg_list[0]->to_modifier(); if( !check_ValidMorpher(obj,arg_list) ) return &false_value; int sel = arg_list[1]->to_int(); sel -= 1; if(sel>=100) sel = 99; if(sel<0) sel = 0; MorphR3 *mp = (MorphR3*)arg_list[0]->to_modifier(); mp->chanBank[sel].rebuildChannel(); return &true_value; }
Value* wm3_setscrollsel_cf(Value** arg_list, int count) { check_arg_count(wm3_setscrollsel, 2, count); type_check(arg_list[0], MAXModifier, "WM3_SetChannelSel [Morpher Modifier] [NewSel]"); type_check(arg_list[1], Integer, "WM3_SetChannelSel [Morpher Modifier] [NewSel]"); ReferenceTarget* obj = arg_list[0]->to_modifier(); if( !check_ValidMorpher(obj,arg_list) ) return &false_value; int sel = arg_list[1]->to_int(); sel -= 1; if(sel>9) sel = 9; if(sel<0) sel = 0; MorphR3 *mp = (MorphR3*)arg_list[0]->to_modifier(); mp->chanSel = sel; mp->Update_channelFULL(); return &true_value; }
Value* wm3_mc_hastarget_cf(Value** arg_list, int count) { check_arg_count(wm3_mc_hastarget, 2, count); type_check(arg_list[0], MAXModifier, _T("WM3_MC_HasTarget [Morpher Modifier] [Channel Index]")); type_check(arg_list[1], Integer, _T("WM3_MC_HasTarget [Morpher Modifier] [Channel Index]")); ReferenceTarget* obj = arg_list[0]->to_modifier(); if( !check_ValidMorpher(obj,arg_list) ) return &false_value; int sel = arg_list[1]->to_int(); sel -= 1; if(sel>=100) sel = 99; if(sel<0) sel = 0; MorphR3 *mp = (MorphR3*)arg_list[0]->to_modifier(); MaxMorphModifier maxMorpher(mp); if(maxMorpher.GetMorphChannel(sel).GetMorphTarget() != NULL) return &true_value; else return &false_value; }
Value* wm3_mc_getmemuse_cf(Value** arg_list, int count) { check_arg_count(wm3_mc_getmemuse, 2, count); type_check(arg_list[0], MAXModifier, _T("WM3_MC_GetMemUse [Morpher Modifier] [Channel Index]")); type_check(arg_list[1], Integer, _T("WM3_MC_GetMemUse [Morpher Modifier] [Channel Index]")); ReferenceTarget* obj = arg_list[0]->to_modifier(); if( !check_ValidMorpher(obj,arg_list) ) return &false_value; int sel = arg_list[1]->to_int(); sel -= 1; if(sel>=100) sel = 99; if(sel<0) sel = 0; MorphR3 *mp = (MorphR3*)arg_list[0]->to_modifier(); float tmSize = 0.0f; tmSize += mp->chanBank[sel].getMemSize(); return Float::intern(tmSize); }
Value* wm3_mc_getamount_cf(Value** arg_list, int count) { check_arg_count(wm3_mc_getamount, 2, count); type_check(arg_list[0], MAXModifier, _T("WM3_MC_GetValue [Morpher Modifier] [Channel Index]")); type_check(arg_list[1], Integer, _T("WM3_MC_GetValue [Morpher Modifier] [Channel Index]")); ReferenceTarget* obj = arg_list[0]->to_modifier(); if( !check_ValidMorpher(obj,arg_list) ) return &false_value; int sel = arg_list[1]->to_int(); sel -= 1; if(sel>=100) sel = 99; if(sel<0) sel = 0; MorphR3 *mp = (MorphR3*)arg_list[0]->to_modifier(); MaxMorphModifier maxMorpher(mp); // The value of the channel - ie, its weighted percentage float tmpVal = maxMorpher.GetMorphChannel(sel).GetMorphWeight(MAXScript_time()); return Float::intern(tmpVal); }
/*===========================================================================*\ | Returns the number of progressive morphs for a particular morph | this includes the initial morph \*===========================================================================*/ Value* wm3_NumberOfProgressiveMorphs_cf(Value** arg_list, int count) { check_arg_count(wm3_NumberOfProgressiveMorphs_cf, 2, count); type_check(arg_list[0], MAXModifier, _T("wm3_NumberOfProgressiveMorphs [Morpher Modifier] [Morph Index]")); type_check(arg_list[1], Integer, _T("wm3_NumberOfProgressiveMorphs [Morpher Modifier] [Morph Index]")); ReferenceTarget* obj = arg_list[0]->to_modifier(); if( !check_ValidMorpher(obj,arg_list) ) return &false_value; MorphR3 *mp = (MorphR3*)arg_list[0]->to_modifier(); int morphIndex = arg_list[1]->to_int(); morphIndex--; if(morphIndex>=100) morphIndex = 99; if(morphIndex<0) morphIndex = 0; MaxMorphModifier maxMorpher(mp); return Integer::intern(maxMorpher.GetMorphChannel(morphIndex).NumProgressiveMorphTargets()); }
Value* wm3_GetMarkerName_cf(Value** arg_list, int count) { check_arg_count(wm3_GetMarkerName_cf, 2, count); type_check(arg_list[0], MAXModifier, _T("WM3_GetMarkerName [Morpher Modifier] [Marker Index]")); type_check(arg_list[1], Integer, _T("WM3_GetMarkerName [Morpher Modifier] [Marker Index]")); ReferenceTarget* obj = arg_list[0]->to_modifier(); if( !check_ValidMorpher(obj,arg_list) ) return &false_value; MorphR3 *mp = (MorphR3*)arg_list[0]->to_modifier(); int index = arg_list[1]->to_int(); index--; if ((index < 0) || (index >= mp->markerName.Count())) return &false_value; return new String(mp->markerName[index]); }
/*===========================================================================*\ | Returns the the progressive morph tension | \*===========================================================================*/ Value* wm3_GetProgressiveMorphTension_cf(Value** arg_list, int count) { check_arg_count(wm3_GetProgressiveMorphTension_cf, 2, count); type_check(arg_list[0], MAXModifier, _T("WM3_GetProgressiveMorphTension [Morpher Modifier] [Morph Index]")); type_check(arg_list[1], Integer, _T("WM3_GetProgressiveMorphTension [Morpher Modifier] [Morph Index]")); ReferenceTarget* obj = arg_list[0]->to_modifier(); if( !check_ValidMorpher(obj,arg_list) ) return &false_value; MorphR3 *mp = (MorphR3*)arg_list[0]->to_modifier(); int morphIndex = arg_list[1]->to_int(); morphIndex--; if(morphIndex>=100) morphIndex = 99; if(morphIndex<0) morphIndex = 0; MaxMorphModifier maxMorpher(mp); float tension = maxMorpher.GetMorphChannel(morphIndex).GetProgressiveMorphTension(); return Float::intern(tension); }
Value* wm3_mc_setamount_cf(Value** arg_list, int count) { check_arg_count(wm3_mc_setamount, 3, count); type_check(arg_list[0], MAXModifier, _T("WM3_MC_SetValue [Morpher Modifier] [Channel Index] [Value]")); type_check(arg_list[1], Integer, _T("WM3_MC_SetValue [Morpher Modifier] [Channel Index] [Value]")); type_check(arg_list[2], Float, _T("WM3_MC_SetValue [Morpher Modifier] [Channel Index] [Value]")); ReferenceTarget* obj = arg_list[0]->to_modifier(); if( !check_ValidMorpher(obj,arg_list) ) return &false_value; int sel = arg_list[1]->to_int(); sel -= 1; if(sel>=100) sel = 99; if(sel<0) sel = 0; MorphR3 *mp = (MorphR3*)arg_list[0]->to_modifier(); MaxMorphModifier maxMorpher(mp); bool res = maxMorpher.GetMorphChannel(sel).SetMorphWeight(MAXScript_time(), arg_list[2]->to_float()); needs_redraw_set(); return (res ? &true_value : &false_value); }
Value* wm3_mc_delete_cf(Value** arg_list, int count) { check_arg_count(wm3_mc_delete, 2, count); type_check(arg_list[0], MAXModifier, _T("WM3_MC_Delete [Morpher Modifier] [Channel Index]")); type_check(arg_list[1], Integer, _T("WM3_MC_Delete [Morpher Modifier] [Channel Index]")); ReferenceTarget* obj = arg_list[0]->to_modifier(); if( !check_ValidMorpher(obj,arg_list) ) return &false_value; int sel = arg_list[1]->to_int(); sel -= 1; if(sel>=100) sel = 99; if(sel<0) sel = 0; MorphR3 *mp = (MorphR3*)arg_list[0]->to_modifier(); MaxMorphModifier maxMorpher(mp); bool res = maxMorpher.GetMorphChannel(sel).DeleteChannel(); maxMorpher.RefreshChannelsUI(); needs_redraw_set(); return (res ? &true_value : &false_value); }