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); }
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; }
void M3Mat::SetSubMtl(int i, Mtl *m) { if(m && morphp ) { if( m->ClassID() == M3MatClassID ) { M3Mat *m3m = static_cast<M3Mat *> (m); MorphR3 *mp = m3m->morphp; if(mp){ for(int j=101; j<=200; j++){ for(int k=101; k<=200; k++){ if( morphp->GetReference(j) && morphp->GetReference(j) == mp->GetReference(k) ) { if(morphp->hMaxWnd) { TSTR cyclic; cyclic = GetString(IDS_CYCLIC_MATERIAL); MessageBox(morphp->hMaxWnd,cyclic,GetString(IDS_CLASS_NAME),MB_OK); } return; } } } } } } ReplaceReference(i,m); if (matDlg) matDlg->UpdateSubMtlNames(); }
/*===========================================================================*\ | 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* 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; }
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; }
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_bfn_cf(Value** arg_list, int count) { check_arg_count(wm3_mc_bfn, 3, count); type_check(arg_list[0], MAXModifier, _T("WM3_MC_BuildFromNode [Morpher Modifier] [Channel Index] [Target]")); type_check(arg_list[1], Integer, _T("WM3_MC_BuildFromNode [Morpher Modifier] [Channel Index] [Target]")); type_check(arg_list[2], MAXNode, _T("WM3_MC_BuildFromNode [Morpher Modifier] [Channel Index] [Target]")); 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 = arg_list[2]->to_node(); mp->ReplaceReference(101+sel,node); mp->chanBank[sel].buildFromNode( node ); return &true_value; }
Value* wm3_SetMarkerData_cf(Value** arg_list, int count) { check_arg_count(wm3_CreateMarker_cf, 4, count); type_check(arg_list[0], MAXModifier, _T("wm3_SetMarkerData [Morpher Modifier] [Marker Index] [Morph Index] [Marker Name]")); type_check(arg_list[1], Integer, _T("wm3_SetMarkerData [Morpher Modifier] [Marker Index] [Morph Index] [Marker Name]")); type_check(arg_list[2], Integer, _T("wm3_SetMarkerData [Morpher Modifier] [Marker Index] [Morph Index] [Marker Name]")); type_check(arg_list[3], String, _T("wm3_SetMarkerData [Morpher Modifier] [Marker Index] [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 markerIndex = arg_list[1]->to_int(); markerIndex -= 1; int morphIndex = arg_list[2]->to_int(); morphIndex -= 1; const TCHAR *name = arg_list[3]->to_string(); if ((markerIndex >= 0) && (markerIndex < mp->markerIndex.Count())) { mp->markerName.SetName(markerIndex,name); mp->markerIndex[markerIndex] = morphIndex; mp->Update_channelMarkers(); mp->Update_channelFULL(); mp->Update_channelParams(); return &true_value; } return &false_value; }
Value* wm3_mc_setvertsel_cf(Value** arg_list, int count) { check_arg_count(wm3_mc_setvertsel, 3, count); type_check(arg_list[0], MAXModifier, _T("WM3_MC_SetUseVertexSel [Morpher Modifier] [Channel Index] [true/false]")); type_check(arg_list[1], Integer, _T("WM3_MC_SetUseVertexSel [Morpher Modifier] [Channel Index] [true/false]")); type_check(arg_list[2], Boolean, _T("WM3_MC_SetUseVertexSel [Morpher Modifier] [Channel Index] [true/false]")); 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].mUseSel = arg_list[2]->to_bool(); mp->NotifyDependents(FOREVER,PART_ALL,REFMSG_CHANGE); needs_redraw_set(); return &true_value; }
Value* wm3_mc_setlimitmin_cf(Value** arg_list, int count) { check_arg_count(wm3_mc_setlimitmin, 3, count); type_check(arg_list[0], MAXModifier, _T("WM3_MC_SetLimitMIN [Morpher Modifier] [Channel Index] [Float Value]")); type_check(arg_list[1], Integer, _T("WM3_MC_SetLimitMIN [Morpher Modifier] [Channel Index] [Float Value]")); type_check(arg_list[2], Float, _T("WM3_MC_SetLimitMIN [Morpher Modifier] [Channel Index] [Float 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(); mp->chanBank[sel].mSpinmin = arg_list[2]->to_float(); mp->NotifyDependents(FOREVER,PART_ALL,REFMSG_CHANGE); needs_redraw_set(); return &true_value; }
INT_PTR CALLBACK BindProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { M3Mat *mp = (M3Mat*)GetWindowLongPtr(hWnd,GWLP_USERDATA); if (!mp && msg!=WM_INITDIALOG) return FALSE; int id = LOWORD(wParam); int notify = HIWORD(wParam); switch (msg) { case WM_INITDIALOG:{ mp = (M3Mat*)lParam; SetWindowLongPtr(hWnd,GWLP_USERDATA,(LONG_PTR)mp); HWND modList = GetDlgItem(hWnd,IDC_MODLIST); SendMessage(modList,LB_RESETCONTENT,0,0); POINT lpPt; GetCursorPos(&lpPt); SetWindowPos(hWnd, NULL, lpPt.x, lpPt.y, 0, 0, SWP_NOSIZE | SWP_NOZORDER); Object *pObj = mp->Wnode->GetObjectRef(); IDerivedObject *pDerObj = NULL; Modifier *pMod = NULL; if( pObj->SuperClassID() == GEN_DERIVOB_CLASS_ID) { pDerObj = (IDerivedObject *) pObj; for(int i = 0 ; i < pDerObj->NumModifiers() ; i++ ) { pMod = pDerObj->GetModifier(i); SendMessage(modList,LB_ADDSTRING,0,(LPARAM) (LPCTSTR) pMod->GetName()); } } SendMessage(modList,LB_SETCURSEL ,(WPARAM)-1,0); break;} case WM_COMMAND: if (notify==LBN_SELCHANGE){ if(id==IDC_MODLIST){ int mkSel = SendMessage(GetDlgItem(hWnd, IDC_MODLIST), LB_GETCURSEL, 0, 0); if(mkSel>=0){ Object *pObj = mp->Wnode->GetObjectRef(); IDerivedObject *pDerObj = NULL; Modifier *pMod = NULL; if( pObj->SuperClassID() == GEN_DERIVOB_CLASS_ID) { pDerObj = (IDerivedObject *) pObj; pMod = pDerObj->GetModifier(mkSel); if(pMod->ClassID() == MR3_CLASS_ID) EnableWindow(GetDlgItem(hWnd,IDOK),TRUE); else EnableWindow(GetDlgItem(hWnd,IDOK),FALSE); } } } } switch (id) { case IDOK: { int mkSel = SendMessage(GetDlgItem(hWnd, IDC_MODLIST), LB_GETCURSEL, 0, 0); if(mkSel>=0){ Object *pObj = mp->Wnode->GetObjectRef(); IDerivedObject *pDerObj = NULL; Modifier *pMod = NULL; if( pObj->SuperClassID() == GEN_DERIVOB_CLASS_ID) { pDerObj = (IDerivedObject *) pObj; pMod = pDerObj->GetModifier(mkSel); MorphR3 *mod = (MorphR3*)pMod; if(mod->CheckMaterialDependency() ) { EndDialog(hWnd,1);return TRUE; } // Make sure the node does not depend on us mod->BeginDependencyTest(); mp->NotifyDependents(FOREVER,0,REFMSG_TEST_DEPENDENCY); if (mod->EndDependencyTest()) { // display cyclic warning // if (GetCOREInterface()->GetQuietMode()) { TSTR cyclic; cyclic = GetString(IDS_CANNOT_BIND); GetCOREInterface()->Log()->LogEntry(SYSLOG_WARN,NO_DIALOG,GetString(IDS_CLASS_NAME),cyclic); } else { TSTR cyclic; cyclic = GetString(IDS_CANNOT_BIND); MessageBox(hWnd,cyclic,GetString(IDS_CLASS_NAME),MB_OK); } EndDialog(hWnd,1); return TRUE; } if(mod) mod->morphmaterial = mp; mp->ReplaceReference(102, mod); mp->obName = mp->Wnode->GetName(); mp->morphp = mod; if (mp->matDlg ){ mp->matDlg->UpdateMorphInfo(UD_LINK); mp->matDlg->ReloadDialog(); } } } } case IDCANCEL: EndDialog(hWnd,1); break; } break; default: return FALSE; } return TRUE; }