void BombObject::UpdateUI(TimeValue t) { if (hParam && !waitPostLoad) { if (this == DLGetWindowLongPtr<BombObject *>(hParam)) { strengthSpin->SetValue(GetStrength(t),FALSE); gravSpin->SetValue(GetGravity(t),FALSE); chaosSpin->SetValue(GetChaos(t),FALSE); falloffSpin->SetValue(GetFalloff(t),FALSE); spinSpin->SetValue(GetSpin(t),FALSE); if (pblock->KeyFrameAtTime(PB_STRENGTH,t)) strengthSpin->SetKeyBrackets(TRUE); else strengthSpin->SetKeyBrackets(FALSE); if (pblock->KeyFrameAtTime(PB_GRAVITY,t)) gravSpin->SetKeyBrackets(TRUE); else gravSpin->SetKeyBrackets(FALSE); if (pblock->KeyFrameAtTime(PB_CHAOS,t)) chaosSpin->SetKeyBrackets(TRUE); else chaosSpin->SetKeyBrackets(FALSE); if (pblock->KeyFrameAtTime(PB_SPIN,t)) spinSpin->SetKeyBrackets(TRUE); else spinSpin->SetKeyBrackets(FALSE); if (pblock->KeyFrameAtTime(PB_FALLOFF,t)) falloffSpin->SetKeyBrackets(TRUE); else falloffSpin->SetKeyBrackets(FALSE); } } }
void StraussShaderDlg::LoadDialog(BOOL draw) { if (pShader && hRollup) { glSpin->SetValue( FracToPc( pShader->GetGlossiness() ),FALSE); glSpin->SetKeyBrackets(KeyAtCurTime(st_glossiness)); mtSpin->SetValue( FracToPc( pShader->GetMetalness() ), FALSE); mtSpin->SetKeyBrackets(KeyAtCurTime(st_metalness)); trSpin->SetValue(FracToPc(pMtl->GetOpacity(curTime)),FALSE); trSpin->SetKeyBrackets(pMtl->KeyAtTimeByID(OPACITY_PARAM, curTime)); UpdateColSwatches(); UpdateHilite(); IParamBlock2 * shaderpblock = pShader->pblock; if ( shaderpblock ) { cs[0]->UpdateEnableState( shaderpblock, shaderpblock->GetAnimNum( st_diffuse ) ); glSpin->UpdateEnableState( shaderpblock, shaderpblock->GetAnimNum( st_glossiness ) ); mtSpin->UpdateEnableState( shaderpblock, shaderpblock->GetAnimNum( st_metalness ) ); } // trSpin: opacity is accessed through the material: only handle StdMat2. EnableMtl2OpacityControl( pMtl, trSpin ); } }
void WardShaderDlg::LoadDialog(BOOL draw) { if (pShader && hRollup) { dlevSpin->SetValue(FracToPc(pShader->GetDiffuseLevel()),FALSE); dlevSpin->SetKeyBrackets(KeyAtCurTime(PB_DIFFUSE_LEV)); slevSpin->SetValue(FracToPc(pShader->GetSpecularLevel()/SPEC_MAX),FALSE); slevSpin->SetKeyBrackets(KeyAtCurTime(PB_SPECULAR_LEV)); glxSpin->SetValue( 100.0f * ((ALPHA_MAX - pShader->GetGlossiness())/ALPHA_SZ),FALSE); glxSpin->SetKeyBrackets(KeyAtCurTime(PB_GLOSSINESS_X)); glySpin->SetValue(100.0f * ((ALPHA_MAX - pShader->GetGlossinessY())/ALPHA_SZ),FALSE); glySpin->SetKeyBrackets(KeyAtCurTime(PB_GLOSSINESS_Y)); trSpin->SetValue(FracToPc(pMtl->GetOpacity( curTime )),FALSE); trSpin->SetKeyBrackets(pMtl->KeyAtTime(OPACITY_PARAM, curTime)); CheckButton(hRollup, IDC_LOCK_AD, pShader->GetLockAD() ); CheckButton(hRollup, IDC_LOCK_DS, pShader->GetLockDS() ); SetCheckBox(hRollup, IDC_NORMALIZE_CHECK, !pShader->GetNormalizeOn() ); UpdateLockADTex( FALSE ); //don't send to mtl UpdateColSwatches(); UpdateHilite(); } }
void RandKeysUtil::SetupWindow(HWND hWnd) { this->hWnd = hWnd; CheckDlgButton(hWnd,IDC_RANDKEYS_TIME,doTime); CheckDlgButton(hWnd,IDC_RANDKEYS_VAL,doVal); iPosTime = GetISpinner(GetDlgItem(hWnd,IDC_RANDKEYS_POSTIMESPIN)); iPosTime->SetLimits(0, TIME_PosInfinity, FALSE); iPosTime->SetScale(10.0f); iPosTime->LinkToEdit(GetDlgItem(hWnd,IDC_RANDKEYS_POSTIME), EDITTYPE_TIME); iPosTime->SetValue(posTime,FALSE); iNegTime = GetISpinner(GetDlgItem(hWnd,IDC_RANDKEYS_NEGTIMESPIN)); iNegTime->SetLimits(0, TIME_PosInfinity, FALSE); iNegTime->SetScale(10.0f); iNegTime->LinkToEdit(GetDlgItem(hWnd,IDC_RANDKEYS_NEGTIME), EDITTYPE_TIME); iNegTime->SetValue(negTime,FALSE); iPosVal = GetISpinner(GetDlgItem(hWnd,IDC_RANDKEYS_POSVALSPIN)); iPosVal->SetLimits(0.0f, 999999999.9f, FALSE); iPosVal->SetScale(0.1f); iPosVal->LinkToEdit(GetDlgItem(hWnd,IDC_RANDKEYS_POSVAL), EDITTYPE_FLOAT); iPosVal->SetValue(posVal,FALSE); iNegVal = GetISpinner(GetDlgItem(hWnd,IDC_RANDKEYS_NEGVALSPIN)); iNegVal->SetLimits(0.0f, 999999999.0f, FALSE); iNegVal->SetScale(0.1f); iNegVal->LinkToEdit(GetDlgItem(hWnd,IDC_RANDKEYS_NEGVAL), EDITTYPE_FLOAT); iNegVal->SetValue(negVal,FALSE); SetStates(); }
// Dialog proc static INT_PTR CALLBACK ExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { Interval animRange; ISpinnerControl *spin; AscOut *exp = (AscOut*)GetWindowLongPtr(hWnd,GWLP_USERDATA); switch (msg) { case WM_INITDIALOG: exp = (AscOut*)lParam; SetWindowLongPtr(hWnd,GWLP_USERDATA,lParam); CenterWindow(hWnd, GetParent(hWnd)); // Setup the spinner controls for the floating point precision spin = GetISpinner(GetDlgItem(hWnd, IDC_PREC_SPIN)); spin->LinkToEdit(GetDlgItem(hWnd,IDC_PREC), EDITTYPE_INT ); spin->SetLimits(1, 10, TRUE); spin->SetScale(1.0f); spin->SetValue(exp->GetPrecision() ,FALSE); ReleaseISpinner(spin); // Setup the spinner control for the static frame# // We take the frame 0 as the default value animRange = exp->GetInterface()->GetAnimRange(); spin = GetISpinner(GetDlgItem(hWnd, IDC_STATIC_FRAME_SPIN)); spin->LinkToEdit(GetDlgItem(hWnd,IDC_STATIC_FRAME), EDITTYPE_INT ); spin->SetLimits(animRange.Start() / GetTicksPerFrame(), animRange.End() / GetTicksPerFrame(), TRUE); spin->SetScale(1.0f); spin->SetValue(0, FALSE); ReleaseISpinner(spin); break; case CC_SPINNER_CHANGE: spin = (ISpinnerControl*)lParam; break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: spin = GetISpinner(GetDlgItem(hWnd, IDC_PREC_SPIN)); exp->SetPrecision(spin->GetIVal()); ReleaseISpinner(spin); spin = GetISpinner(GetDlgItem(hWnd, IDC_STATIC_FRAME_SPIN)); exp->SetStaticFrame(spin->GetIVal() * GetTicksPerFrame()); ReleaseISpinner(spin); EndDialog(hWnd, 1); break; case IDCANCEL: EndDialog(hWnd, 0); break; } break; default: return FALSE; } return TRUE; }
Value* FooControl::set_property(Value** arg_list, int count) { Value* val = arg_list[0]; Value* prop = arg_list[1]; if (prop == n_value) { value = val->to_float(); if (parent_rollout != NULL && parent_rollout->page != NULL) { ISpinnerControl* spin = GetISpinner(GetDlgItem(parent_rollout->page, control_ID)); if (spin_type == EDITTYPE_INT) spin->SetValue((int)value, FALSE); else spin->SetValue(value, FALSE); ReleaseISpinner(spin); } } else if (prop == n_range) { Point3 p; if (is_point3(val)) p = val->to_point3(); else throw TypeError (MaxSDK::GetResourceStringAsMSTR(IDS_SPINNER_RANGE_MUST_BE_A_VECTOR), val); min = p.x; max = p.y; value = p.z; if (parent_rollout != NULL && parent_rollout->page != NULL) { ISpinnerControl* spin = GetISpinner(GetDlgItem(parent_rollout->page, control_ID)); if (spin_type == EDITTYPE_INT) { spin->SetLimits((int)p.x, (int)p.y, FALSE); spin->SetScale(1.0F); spin->SetValue((int)p.z, FALSE); } else { spin->SetLimits(p.x, p.y, FALSE); spin->SetScale(0.1F); spin->SetValue(p.z, FALSE); } ReleaseISpinner(spin); } } else return RolloutControl::set_property(arg_list, count); return val; }
INT_PTR CALLBACK TrackPropDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { BlockControl *blk = (BlockControl*)GetWindowLongPtr(hWnd,GWLP_USERDATA); ISpinnerControl *spin; static TSTR zero = FormatUniverseValue(0.0f); Rect rect; switch (msg) { case WM_INITDIALOG: { blk = (BlockControl*)lParam; SetWindowLongPtr(hWnd,GWLP_USERDATA,lParam); Interval range = GetCOREInterface()->GetAnimRange(); spin = GetISpinner(GetDlgItem(hWnd,IDC_STARTSPIN)); spin->SetLimits(-999999.0f,9999999.0f, FALSE); spin->SetAutoScale(); spin->LinkToEdit(GetDlgItem(hWnd,IDC_START), EDITTYPE_INT); spin->SetValue(range.Start()/GetTicksPerFrame(),FALSE); ReleaseISpinner(spin); blk->propStart = range.Start()/GetTicksPerFrame(); CenterWindow(hWnd,GetParent(hWnd)); break; } case CC_SPINNER_CHANGE: spin = (ISpinnerControl*)lParam; switch (LOWORD(wParam)) { case IDC_STARTSPIN: blk->propStart = spin->GetIVal(); break; } break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: { EndDialog(hWnd,1); blk->NotifyDependents(FOREVER, PART_ALL, REFMSG_CHANGE); break; } case IDCANCEL: EndDialog(hWnd,0); break; } break; default: return FALSE; } return TRUE; }
void EditFaceDataMod::UpdateDialog () { TSTR buf; int numFaces=0, whichFace=0; float value = 1.0f; bool valueDetermined = true; if (!hParams) return; ModContextList mcList; INodeTab nodes; ip->GetModContexts(mcList,nodes); if (selLevel) { for (int i = 0; i < mcList.Count(); i++) { EditFaceDataModData *meshData = (EditFaceDataModData*)mcList[i]->localData; if (!meshData) continue; int numSelectedHere; meshData->DescribeSelection (numSelectedHere, whichFace, value, valueDetermined); numFaces += numSelectedHere; } } ISpinnerControl *spin = GetISpinner (GetDlgItem (hParams, IDC_VALUE_SPIN)); ICustButton *but = GetICustButton (GetDlgItem (hParams, IDC_RESET_SELECTION)); switch (selLevel) { case SEL_FACE: if (numFaces==1) { buf.printf (GetString(IDS_FACE_SELECTED), whichFace+1); } else { if (numFaces) buf.printf (GetString (IDS_FACES_SELECTED), numFaces); else buf = GetString (IDS_NO_FACE_SELECTED); } but->Enable (numFaces); spin->Enable (numFaces); if (numFaces && valueDetermined) { spin->SetIndeterminate (false); spin->SetValue (value, FALSE); } else { spin->SetIndeterminate (true); } break; case SEL_OBJECT: buf = GetString (IDS_OBJECT_SELECTED); spin->Disable(); but->Disable (); break; } SetDlgItemText(hParams,IDC_FACE_SELECTED,buf); ReleaseISpinner (spin); ReleaseICustButton (but); }
//void RendSpline::UpdateAspect(HWND hWnd, TimeValue t) //{ // // //ISpinnerControl *iSpin = GetISpinner(GetDlgItem(hWnd, IDC_ASPECTSPIN)); // // // //iSpin->SetValue(this->GetAspect((UseViewOrRenderParams(t)== rbViewport)),FALSE); // //ReleaseISpinner(iSpin); //} void RendSpline::OnSetWidthLength(HWND hWnd, ParamID lengthID, ParamID widthID, TimeValue t, BOOL widthSet) { static BOOL reenter = FALSE; if(reenter) return; reenter = TRUE; ISpinnerControl *iSpin = GetISpinner(GetDlgItem(hWnd, IDC_ASPECTSPIN)); BOOL aspectlocked; float length, width; if(UseViewOrRenderParams(t) == rbViewport) pblock->GetValue(rnd_v2_vpt_aspect_lock,t,aspectlocked,FOREVER); else pblock->GetValue(rnd_v2_aspect_lock,t,aspectlocked,FOREVER); pblock->GetValue(lengthID,t,length,FOREVER); pblock->GetValue(widthID,t,width,FOREVER); if(!aspectlocked) { CheckAspectLock(t); if(width == 0.0f) { width = EPS; //iSpin->SetValue(0.0f, FALSE); //iSpin->SetIndeterminate(TRUE); } else iSpin->SetValue(length/width, FALSE); } else { if(widthSet) { pblock->SetValue(lengthID,t,mAspect*width); } else { if(mAspect == 0.0f) mAspect = EPS; //pblock->SetValue(widthID,t,0.0f); pblock->SetValue(widthID,t,length/mAspect); } } ReleaseISpinner(iSpin); reenter = FALSE; }
void plMultipassMtlDlg::IGetSpinnerVal() { ISpinnerControl *spin = GetISpinner(GetDlgItem(fhRollup, IDC_LAYER_SPIN)); if (!spin) return; // If new number of layers is invalid, set to current num if (!ISetNumLayers(spin->GetIVal())) { int nLayers = fPBlock->GetInt(kMultCount); spin->SetValue(nLayers, FALSE); } ReleaseISpinner(spin); }
void MouseDeviceBinding::UpdateRollup(IRollupWindow *iRoll) { if (iRoll->GetNumPanels()>1) { HWND hWnd = iRoll->GetPanelDlg(1); CheckDlgButton(hWnd,IDC_MOUSE_X,which==MC_MOUSE_X); CheckDlgButton(hWnd,IDC_MOUSE_Y,which==MC_MOUSE_Y); CheckDlgButton(hWnd,IDC_MOUSE_FLIP,invert); ISpinnerControl *spin = GetISpinner(GetDlgItem(hWnd,IDC_MOUSE_SCALESPIN)); spin->SetLimits(0.0f, float(999999), FALSE); spin->SetScale(0.01f); spin->LinkToEdit(GetDlgItem(hWnd,IDC_MOUSE_SCALE), EDITTYPE_FLOAT); spin->SetValue(scale,FALSE); ReleaseISpinner(spin); } }
void BombObject::BeginEditParams(IObjParam *ip,ULONG flags,Animatable *prev) { this->ip = ip; if (!hParam) { hSot = ip->AddRollupPage( hInstance, MAKEINTRESOURCE(IDD_BOMB_SOT), DefaultSOTProc, GetString(IDS_RB_SOT), (LPARAM)ip,APPENDROLL_CLOSED); hParam = ip->AddRollupPage( hInstance, MAKEINTRESOURCE(IDD_BOMBPARAMS), BombParamProc, GetString(IDS_RB_BOMBPARAMS), (LPARAM)this ); } else { DLSetWindowLongPtr(hParam, this); // Init the dialog to our values. strengthSpin->SetValue(GetStrength(ip->GetTime()),FALSE); gravSpin->SetValue(GetGravity(ip->GetTime()),FALSE ); chaosSpin->SetValue(GetChaos(ip->GetTime()),FALSE ); detSpin->SetValue(GetDetonation(ip->GetTime()),FALSE ); spinSpin->SetValue(GetSpin(ip->GetTime()),FALSE); falloffSpin->SetValue(GetFalloff(ip->GetTime()),FALSE); minFragSpin->SetValue(GetMinFrag(ip->GetTime()),FALSE); maxFragSpin->SetValue(GetMaxFrag(ip->GetTime()),FALSE); seedSpin->SetValue(GetSeed(ip->GetTime()),FALSE); CheckDlgButton(hParam,IDC_FALLOFF_ON,GetFalloffOn(ip->GetTime())); } if (GetFalloffOn(ip->GetTime())) { NotifyDependents(FOREVER,0,REFMSG_CHANGE); ip->RedrawViews(ip->GetTime()); } }
void OrenNayarShaderDlg::LoadDialog(BOOL draw) { if (pShader && hRollup) { shSpin->SetValue(FracToPc(pShader->GetGlossiness()),FALSE); shSpin->SetKeyBrackets(KeyAtCurTime(onb_glossiness)); ssSpin->SetValue(FracToPc(pShader->GetSpecularLevel()),FALSE); ssSpin->SetKeyBrackets(KeyAtCurTime(onb_specular_level)); softSpin->SetValue(pShader->GetSoftenLevel(),FALSE); softSpin->SetKeyBrackets(KeyAtCurTime(onb_soften)); trSpin->SetValue(FracToPc(pMtl->GetOpacity( curTime )),FALSE); trSpin->SetKeyBrackets(pMtl->KeyAtTime(OPACITY_PARAM, curTime)); dlevSpin->SetValue(FracToPc(pShader->GetDiffuseLevel()),FALSE); dlevSpin->SetKeyBrackets(KeyAtCurTime(onb_diffuse_level)); roughSpin->SetValue(FracToPc(pShader->GetDiffuseRoughness()),FALSE); roughSpin->SetKeyBrackets(KeyAtCurTime(onb_roughness)); CheckButton(hRollup, IDC_LOCK_AD, pShader->GetLockAD() ); CheckButton(hRollup, IDC_LOCK_DS, pShader->GetLockDS() ); UpdateLockADTex( FALSE ); //don't send to mtl BOOL colorSelfIllum = pShader->IsSelfIllumClrOn(); SetCheckBox(hRollup,IDC_SI_COLORON, colorSelfIllum ); if( colorSelfIllum ) { // ShowWindow( siSpin->GetHwnd(), SW_HIDE ); ShowWindow( GetDlgItem(hRollup, IDC_SI_EDIT), SW_HIDE ); ShowWindow( GetDlgItem(hRollup, IDC_SI_SPIN), SW_HIDE ); ShowWindow( cs[N_SI_CLR]->GetHwnd(), SW_SHOW ); } else { // disable the color swatch ShowWindow( cs[N_SI_CLR]->GetHwnd(), SW_HIDE ); // show self-illum slider // ShowWindow( siSpin->GetHwnd(), SW_SHOW ); ShowWindow( GetDlgItem(hRollup, IDC_SI_EDIT), SW_SHOW ); ShowWindow( GetDlgItem(hRollup, IDC_SI_SPIN), SW_SHOW ); siSpin->SetValue(FracToPc(pShader->GetSelfIllum()), FALSE); siSpin->SetKeyBrackets(KeyAtCurTime(onb_self_illum_amnt)); } UpdateColSwatches(); UpdateHilite(); } }
//---------------------------------------------------------------------------- BOOL PX2SceneExport::OnStartFrameSpinnerChanged (HWND hWnd) { // start frame ISpinnerControl* spinner = GetISpinner(GetDlgItem(hWnd, IDC_SPINNER_STARTFRAME)); int startFrame = spinner->GetIVal(); ReleaseISpinner(spinner); // end frame spinner = GetISpinner(GetDlgItem(hWnd,IDC_SPINNER_ENDFRAME)); int endFrame = spinner->GetIVal(); if ( endFrame < startFrame ) spinner->SetValue(startFrame,FALSE); ReleaseISpinner(spinner); return TRUE; }
void RendSpline::OnAspectLock(HWND hWnd, TimeValue t) { BOOL aspectLock; if(UseViewOrRenderParams(t) == rbViewport) pblock->GetValue(rnd_v2_vpt_aspect_lock,t,aspectLock,FOREVER); else pblock->GetValue(rnd_v2_aspect_lock,t,aspectLock,FOREVER); ISpinnerControl *iSpin = GetISpinner(GetDlgItem(hWnd, IDC_ASPECTSPIN)); if(aspectLock) { if(!mAspectLock) mAspect = GetAspect(t,(UseViewOrRenderParams(t)== rbViewport)); iSpin->SetValue(mAspect,FALSE); iSpin->Disable(); mAspectLock = aspectLock; } ReleaseISpinner(iSpin); }
void OrientConstRotation::BeginEditParams( IObjParam *ip, ULONG flags,Animatable *prev ) { if(GetLocked()==false) { this->ip = ip; editCont = this; if (flags & BEGIN_EDIT_HIERARCHY) { InterpCtrlUI *ui; ui = new InterpCtrlUI(NULL,ip,this); DWORD f=0; SetProperty(PROPID_INTERPUI,ui); } else { orientCD.BeginEditParams(ip, this, flags, prev); } ip->RegisterTimeChangeCallback(&orientConstTimeChangeCallback); orientConstTimeChangeCallback.orient_controller = this; IParamMap2* pmap = pblock->GetMap(); if (pmap) hWnd = pmap->GetHWnd(); if (last_selection < 0){ RedrawListbox(GetCOREInterface()->GetTime()); } else { RedrawListbox(GetCOREInterface()->GetTime(), last_selection); ISpinnerControl* spin = GetISpinner(GetDlgItem(hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER)); if (spin != NULL){ float value = pblock->GetFloat(orientation_target_weight, GetCOREInterface()->GetTime(), last_selection); spin->SetValue(value, FALSE); } ReleaseISpinner(spin); } } }
//---------------------------------------------------------------------------- BOOL PX2SceneExport::OnInitDialog (HWND hWnd) { // 当对话框获得WM_INITDIALOG消息时,进行初始化。 // 设置用户定义的导出选项。如果配置文件存在,这些导出选项和用户最后一次 // 使用导出插件的选项一样。否则,使用缺省的设置。 CheckDlgButton(hWnd,IDC_CHECK_OBJECTS,mSettings.IncludeObjects); CheckDlgButton(hWnd,IDC_CHECK_LIGHTS,mSettings.IncludeLights); CheckDlgButton(hWnd,IDC_CHECK_MESHES,mSettings.IncludeMeshes); CheckDlgButton(hWnd,IDC_CHECK_VERTEXCOLORS,mSettings.IncludeVertexColors); CheckDlgButton(hWnd,IDC_CHECK_NORMALS,mSettings.IncludeNormals); CheckDlgButton(hWnd, IDC_CHECK_TANGENTBINORMAL, mSettings.IncludeTargentBiNormal); CheckDlgButton(hWnd,IDC_CHECK_TEXTURECOORDS,mSettings.IncludeTexCoords); SendMessage(GetDlgItem(hWnd,IDC_COMMBO_NUMTCS),CB_ADDSTRING,0,(LPARAM)"1"); SendMessage(GetDlgItem(hWnd,IDC_COMMBO_NUMTCS),CB_ADDSTRING,0,(LPARAM)"2"); SendMessage(GetDlgItem(hWnd,IDC_COMMBO_NUMTCS), CB_SETCURSEL, mSettings.NumTexCoords-1,0); CheckDlgButton(hWnd,IDC_CHECK_MODIFIERS,mSettings.IncludeModifiers); CheckDlgButton(hWnd,IDC_CHECK_SKINS,mSettings.IncludeSkins); CheckDlgButton(hWnd,IDC_RADIO_CURRENTFRAME,mSettings.IncludeCurrentFrame); CheckDlgButton(hWnd,IDC_RADIO_KEYFRAMES,mSettings.IncludeKeyFrames); CheckDlgButton(hWnd,IDC_RADIO_ALLFRAMES,mSettings.IncludeAllFrames); CheckDlgButton(hWnd,IDC_CHECK_USELOCALTIME,mSettings.UseLocalTime); if(!mSettings.IncludeObjects) { // 取消激活“Objects”选择框 OnObjectsChecked(hWnd, FALSE); } else if (!mSettings.IncludeMeshes) { // 取消激活“Mesh”选择框 OnMeshChecked(hWnd, FALSE); } // 取消激活"Modifiers"选择框 if (!mSettings.IncludeModifiers) OnModifiersChecked(hWnd, FALSE); // 获得max场景中的帧数 int numFrames = mMax->GetAnimRange().Duration()/GetTicksPerFrame(); // spinner controls ISpinnerControl* spinner = GetISpinner(GetDlgItem(hWnd, IDC_SPINNER_STARTFRAME)); spinner->LinkToEdit(GetDlgItem(hWnd,IDC_EDIT_STARTFRAME), EDITTYPE_INT); spinner->SetLimits(0,numFrames,TRUE); spinner->SetScale(1.0f); spinner->SetValue(0,FALSE); if ( mSettings.IncludeCurrentFrame ) { spinner->Enable(FALSE); } ReleaseISpinner(spinner); spinner = GetISpinner(GetDlgItem(hWnd,IDC_SPINNER_ENDFRAME)); spinner->LinkToEdit(GetDlgItem(hWnd,IDC_EDIT_ENDFRAME),EDITTYPE_INT); spinner->SetLimits(0,numFrames,TRUE); spinner->SetScale(1.0f); spinner->SetValue(numFrames,FALSE); if (mSettings.IncludeCurrentFrame) { spinner->Enable(FALSE); } ReleaseISpinner(spinner); SetDlgItemText(hWnd, IDC_EDIT_SRCROOTDIR, mSettings.SrcRootDir); SetDlgItemText(hWnd, IDC_EDIT_DSTROOTDIR, mSettings.DstRootDir); return TRUE; }
/** * Configuration interface **/ INT_PTR CALLBACK IGameExporterOptionsDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { ParamList* exp = DLGetWindowLongPtr<ParamList*>(hWnd); ISpinnerControl* spin; switch (message) { case WM_INITDIALOG: { exp = (ParamList*)lParam; DLSetWindowLongPtr(hWnd, lParam); CenterWindow(hWnd, GetParent(hWnd)); //fill Ogre version combo box #ifdef UNICODE SendDlgItemMessage(hWnd, IDC_OGREVERSION, CB_SETMINVISIBLE, 30, 0); SendDlgItemMessage(hWnd, IDC_OGREVERSION, CB_RESETCONTENT, 0, 0); SendDlgItemMessage(hWnd, IDC_OGREVERSION, CB_ADDSTRING, 0, (LPARAM)L"Ogre Latest"); SendDlgItemMessage(hWnd, IDC_OGREVERSION, CB_ADDSTRING, 0, (LPARAM)L"Ogre 1.8"); SendDlgItemMessage(hWnd, IDC_OGREVERSION, CB_ADDSTRING, 0, (LPARAM)L"Ogre 1.7"); SendDlgItemMessage(hWnd, IDC_OGREVERSION, CB_ADDSTRING, 0, (LPARAM)L"Ogre 1.4"); SendDlgItemMessage(hWnd, IDC_OGREVERSION, CB_ADDSTRING, 0, (LPARAM)L"Ogre 1.0"); SendDlgItemMessage(hWnd, IDC_OGREVERSION, CB_SETCURSEL, (int)exp->meshVersion, 0); //fill material prefix std::wstring resPrefix_w; resPrefix_w.assign(exp->resPrefix.begin(), exp->resPrefix.end()); SendDlgItemMessage(hWnd, IDC_RESPREFIX, WM_SETTEXT, 0, (LPARAM)resPrefix_w.data()); //fill material sub dir std::wstring materialOutputDir_w; materialOutputDir_w.assign(exp->materialOutputDir.begin(), exp->materialOutputDir.end()); SendDlgItemMessage(hWnd, IDC_MATDIR, WM_SETTEXT, 0, (LPARAM)materialOutputDir_w.data()); //fill texture sub dir std::wstring texOutputDir_w; texOutputDir_w.assign(exp->texOutputDir.begin(), exp->texOutputDir.end()); SendDlgItemMessage(hWnd, IDC_TEXDIR, WM_SETTEXT, 0, (LPARAM)texOutputDir_w.data()); //fill mesh subdir std::wstring meshOutputDir_w; meshOutputDir_w.assign(exp->meshOutputDir.begin(), exp->meshOutputDir.end()); SendDlgItemMessage(hWnd, IDC_MESHDIR, WM_SETTEXT, 0, (LPARAM)meshOutputDir_w.data()); //fill prog subdir std::wstring programOutputDir_w; programOutputDir_w.assign(exp->programOutputDir.begin(), exp->programOutputDir.end()); SendDlgItemMessage(hWnd, IDC_PROGDIR, WM_SETTEXT, 0, (LPARAM)programOutputDir_w.data()); #else SendDlgItemMessage(hWnd, IDC_OGREVERSION, CB_SETMINVISIBLE, 30, 0); SendDlgItemMessage(hWnd, IDC_OGREVERSION, CB_RESETCONTENT, 0, 0); SendDlgItemMessage(hWnd, IDC_OGREVERSION, CB_ADDSTRING, 0, (LPARAM)"Ogre Latest"); SendDlgItemMessage(hWnd, IDC_OGREVERSION, CB_ADDSTRING, 0, (LPARAM)"Ogre 1.8"); SendDlgItemMessage(hWnd, IDC_OGREVERSION, CB_ADDSTRING, 0, (LPARAM)"Ogre 1.7"); SendDlgItemMessage(hWnd, IDC_OGREVERSION, CB_ADDSTRING, 0, (LPARAM)"Ogre 1.4"); SendDlgItemMessage(hWnd, IDC_OGREVERSION, CB_ADDSTRING, 0, (LPARAM)"Ogre 1.0"); SendDlgItemMessage(hWnd, IDC_OGREVERSION, CB_SETCURSEL, (int)exp->meshVersion, 0); //fill material prefix SendDlgItemMessage(hWnd, IDC_RESPREFIX, WM_SETTEXT, 0, (LPARAM)(char*)exp->resPrefix.c_str()); //fill material sub dir SendDlgItemMessage(hWnd, IDC_MATDIR, WM_SETTEXT, 0, (LPARAM)(char*)exp->materialOutputDir.c_str()); //fill texture sub dir SendDlgItemMessage(hWnd, IDC_TEXDIR, WM_SETTEXT, 0, (LPARAM)(char*)exp->texOutputDir.c_str()); //fill mesh subdir SendDlgItemMessage(hWnd, IDC_MESHDIR, WM_SETTEXT, 0, (LPARAM)(char*)exp->meshOutputDir.c_str()); //fill prog subdir SendDlgItemMessage(hWnd, IDC_PROGDIR, WM_SETTEXT, 0, (LPARAM)(char*)exp->programOutputDir.c_str()); #endif spin = GetISpinner(GetDlgItem(hWnd, IDC_RESAMPLE_SPIN)); spin->LinkToEdit(GetDlgItem(hWnd, IDC_RESAMPLE_STEP), EDITTYPE_INT); spin->SetLimits(1, 100, TRUE); spin->SetScale(1.0f); spin->SetValue(exp->resampleStep, FALSE); ReleaseISpinner(spin); //advanced config CheckDlgButton(hWnd, IDC_YUPAXIS, exp->yUpAxis); CheckDlgButton(hWnd, IDC_SHAREDGEOM, exp->useSharedGeom); CheckDlgButton(hWnd, IDC_GENLOD, exp->generateLOD); CheckDlgButton(hWnd, IDC_EDGELIST, exp->buildEdges); CheckDlgButton(hWnd, IDC_TANGENT, exp->buildTangents); CheckDlgButton(hWnd, IDC_SPLITMIRROR, exp->tangentsSplitMirrored); CheckDlgButton(hWnd, IDC_SPLITROT, exp->tangentsSplitRotated); CheckDlgButton(hWnd, IDC_STOREPARITY, exp->tangentsUseParity); CheckDlgButton(hWnd, IDC_CONVDDS, exp->convertToDDS); CheckDlgButton(hWnd, IDC_RESAMPLE_ANIMS, exp->resampleAnims); CheckDlgButton(hWnd, IDC_LOGS, exp->enableLogs); #ifdef UNICODE //fill Shader mode combo box SendDlgItemMessage(hWnd, IDC_SHADERMODE, CB_SETMINVISIBLE, 30, 0); SendDlgItemMessage(hWnd, IDC_SHADERMODE, CB_RESETCONTENT, 0, 0); SendDlgItemMessage(hWnd, IDC_SHADERMODE, CB_ADDSTRING, 0, (LPARAM)L"None"); SendDlgItemMessage(hWnd, IDC_SHADERMODE, CB_ADDSTRING, 0, (LPARAM)L"Only for Normal/Specular"); SendDlgItemMessage(hWnd, IDC_SHADERMODE, CB_ADDSTRING, 0, (LPARAM)L"All materials (3 lights)"); SendDlgItemMessage(hWnd, IDC_SHADERMODE, CB_ADDSTRING, 0, (LPARAM)L"All materials (multi pass)"); SendDlgItemMessage(hWnd, IDC_SHADERMODE, CB_SETCURSEL, (int)exp->exportProgram, 0); //fill Max texture size combo box SendDlgItemMessage(hWnd, IDC_TEXSIZE, CB_SETMINVISIBLE, 30, 0); SendDlgItemMessage(hWnd, IDC_TEXSIZE, CB_RESETCONTENT, 0, 0); SendDlgItemMessage(hWnd, IDC_TEXSIZE, CB_ADDSTRING, 0, (LPARAM)L"64"); SendDlgItemMessage(hWnd, IDC_TEXSIZE, CB_ADDSTRING, 0, (LPARAM)L"128"); SendDlgItemMessage(hWnd, IDC_TEXSIZE, CB_ADDSTRING, 0, (LPARAM)L"256"); SendDlgItemMessage(hWnd, IDC_TEXSIZE, CB_ADDSTRING, 0, (LPARAM)L"512"); SendDlgItemMessage(hWnd, IDC_TEXSIZE, CB_ADDSTRING, 0, (LPARAM)L"1024"); SendDlgItemMessage(hWnd, IDC_TEXSIZE, CB_ADDSTRING, 0, (LPARAM)L"2048"); SendDlgItemMessage(hWnd, IDC_TEXSIZE, CB_ADDSTRING, 0, (LPARAM)L"4096"); //fill Mipmaps combo box SendDlgItemMessage(hWnd, IDC_NUMMIPS, CB_SETMINVISIBLE, 30, 0); SendDlgItemMessage(hWnd, IDC_NUMMIPS, CB_RESETCONTENT, 0, 0); SendDlgItemMessage(hWnd, IDC_NUMMIPS, CB_ADDSTRING, 0, (LPARAM)L"Max"); SendDlgItemMessage(hWnd, IDC_NUMMIPS, CB_ADDSTRING, 0, (LPARAM)L"None"); SendDlgItemMessage(hWnd, IDC_NUMMIPS, CB_ADDSTRING, 0, (LPARAM)L"2"); SendDlgItemMessage(hWnd, IDC_NUMMIPS, CB_ADDSTRING, 0, (LPARAM)L"4"); SendDlgItemMessage(hWnd, IDC_NUMMIPS, CB_ADDSTRING, 0, (LPARAM)L"8"); SendDlgItemMessage(hWnd, IDC_NUMMIPS, CB_ADDSTRING, 0, (LPARAM)L"16"); SendDlgItemMessage(hWnd, IDC_NUMMIPS, CB_ADDSTRING, 0, (LPARAM)L"32"); #else //fill Shader mode combo box SendDlgItemMessage(hWnd, IDC_SHADERMODE, CB_SETMINVISIBLE, 30, 0); SendDlgItemMessage(hWnd, IDC_SHADERMODE, CB_RESETCONTENT, 0, 0); SendDlgItemMessage(hWnd, IDC_SHADERMODE, CB_ADDSTRING, 0, (LPARAM)"None"); SendDlgItemMessage(hWnd, IDC_SHADERMODE, CB_ADDSTRING, 0, (LPARAM)"Only for Normal/Specular"); SendDlgItemMessage(hWnd, IDC_SHADERMODE, CB_ADDSTRING, 0, (LPARAM)"All materials"); SendDlgItemMessage(hWnd, IDC_SHADERMODE, CB_SETCURSEL, (int)exp->exportProgram, 0); //fill Max texture size combo box SendDlgItemMessage(hWnd, IDC_TEXSIZE, CB_SETMINVISIBLE, 30, 0); SendDlgItemMessage(hWnd, IDC_TEXSIZE, CB_RESETCONTENT, 0, 0); SendDlgItemMessage(hWnd, IDC_TEXSIZE, CB_ADDSTRING, 0, (LPARAM)"64"); SendDlgItemMessage(hWnd, IDC_TEXSIZE, CB_ADDSTRING, 0, (LPARAM)"128"); SendDlgItemMessage(hWnd, IDC_TEXSIZE, CB_ADDSTRING, 0, (LPARAM)"256"); SendDlgItemMessage(hWnd, IDC_TEXSIZE, CB_ADDSTRING, 0, (LPARAM)"512"); SendDlgItemMessage(hWnd, IDC_TEXSIZE, CB_ADDSTRING, 0, (LPARAM)"1024"); SendDlgItemMessage(hWnd, IDC_TEXSIZE, CB_ADDSTRING, 0, (LPARAM)"2048"); SendDlgItemMessage(hWnd, IDC_TEXSIZE, CB_ADDSTRING, 0, (LPARAM)"4096"); //fill Max texture size combo box SendDlgItemMessage(hWnd, IDC_NUMMIPS, CB_SETMINVISIBLE, 30, 0); SendDlgItemMessage(hWnd, IDC_NUMMIPS, CB_RESETCONTENT, 0, 0); SendDlgItemMessage(hWnd, IDC_NUMMIPS, CB_ADDSTRING, 0, (LPARAM)"Max"); SendDlgItemMessage(hWnd, IDC_NUMMIPS, CB_ADDSTRING, 0, (LPARAM)"None"); SendDlgItemMessage(hWnd, IDC_NUMMIPS, CB_ADDSTRING, 0, (LPARAM)"2"); SendDlgItemMessage(hWnd, IDC_NUMMIPS, CB_ADDSTRING, 0, (LPARAM)"4"); SendDlgItemMessage(hWnd, IDC_NUMMIPS, CB_ADDSTRING, 0, (LPARAM)"8"); SendDlgItemMessage(hWnd, IDC_NUMMIPS, CB_ADDSTRING, 0, (LPARAM)"16"); SendDlgItemMessage(hWnd, IDC_NUMMIPS, CB_ADDSTRING, 0, (LPARAM)"32"); #endif // Enable or disable the DDS options EnableWindow(GetDlgItem(hWnd, IDC_TEXSIZE), exp->convertToDDS ? TRUE : FALSE); EnableWindow(GetDlgItem(hWnd, IDC_NUMMIPS), exp->convertToDDS ? TRUE : FALSE); int texSel = 0; if (exp->maxTextureSize == 128) texSel = 1; else if (exp->maxTextureSize == 256) texSel = 2; else if (exp->maxTextureSize == 512) texSel = 3; else if (exp->maxTextureSize == 1024) texSel = 4; else if (exp->maxTextureSize == 2048) texSel = 5; else if (exp->maxTextureSize == 4096) texSel = 6; SendDlgItemMessage(hWnd, IDC_TEXSIZE, CB_SETCURSEL, texSel, 0); int mipsSel = 0; if (exp->maxMipmaps == -1) mipsSel = 0; else if (exp->maxMipmaps == 0) mipsSel = 1; else if (exp->maxMipmaps == 2) mipsSel = 2; else if (exp->maxMipmaps == 4) mipsSel = 3; else if (exp->maxMipmaps == 8) mipsSel = 4; else if (exp->maxMipmaps == 16) mipsSel = 5; else if (exp->maxMipmaps == 32) mipsSel = 6; SendDlgItemMessage(hWnd, IDC_NUMMIPS, CB_SETCURSEL, mipsSel, 0); //Versioning TCHAR Title[256]; _stprintf(Title, _T("Easy Ogre Exporter version %.2f"), EXVERSION); SetWindowText(hWnd, Title); return TRUE; } case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_CONVDDS: { // Enable or disable the DDS options exp->convertToDDS = IsDlgButtonChecked(hWnd, IDC_CONVDDS) ? true : false; EnableWindow(GetDlgItem(hWnd, IDC_TEXSIZE), exp->convertToDDS ? TRUE : FALSE); EnableWindow(GetDlgItem(hWnd, IDC_NUMMIPS), exp->convertToDDS ? TRUE : FALSE); } break; case IDOK: { // LRESULT 在 64 位机器上是 _int64 int ogreVerIdx = (int)SendDlgItemMessage(hWnd, IDC_OGREVERSION, CB_GETCURSEL, 0, 0); if (ogreVerIdx != CB_ERR) { switch (ogreVerIdx) { case 0: exp->meshVersion = TOGRE_LASTEST; break; case 1: exp->meshVersion = TOGRE_1_8; break; case 2: exp->meshVersion = TOGRE_1_7; break; case 3: exp->meshVersion = TOGRE_1_4; break; case 4: exp->meshVersion = TOGRE_1_0; break; default: exp->meshVersion = TOGRE_1_8; } } TSTR temp; int len = 0; len = (int)SendDlgItemMessage(hWnd, IDC_RESPREFIX, WM_GETTEXTLENGTH, 0, 0); temp.Resize(len + 1); SendDlgItemMessage(hWnd, IDC_RESPREFIX, WM_GETTEXT, len + 1, (LPARAM)temp.data()); #ifdef UNICODE std::wstring temp_w = temp.data(); std::string temp_s; temp_s.assign(temp_w.begin(), temp_w.end()); exp->resPrefix = temp_s; #else exp->resPrefix = temp; #endif len = (int)SendDlgItemMessage(hWnd, IDC_MATDIR, WM_GETTEXTLENGTH, 0, 0); temp.Resize(len + 1); SendDlgItemMessage(hWnd, IDC_MATDIR, WM_GETTEXT, len + 1, (LPARAM)temp.data()); #ifdef UNICODE temp_w = temp.data(); temp_s.assign(temp_w.begin(), temp_w.end()); exp->materialOutputDir = temp_s; #else exp->materialOutputDir = temp; #endif len = (int)SendDlgItemMessage(hWnd, IDC_TEXDIR, WM_GETTEXTLENGTH, 0, 0); temp.Resize(len + 1); SendDlgItemMessage(hWnd, IDC_TEXDIR, WM_GETTEXT, len + 1, (LPARAM)temp.data()); #ifdef UNICODE temp_w = temp.data(); temp_s.assign(temp_w.begin(), temp_w.end()); exp->texOutputDir = temp_s; #else exp->texOutputDir = temp; #endif len = (int)SendDlgItemMessage(hWnd, IDC_MESHDIR, WM_GETTEXTLENGTH, 0, 0); temp.Resize(len + 1); SendDlgItemMessage(hWnd, IDC_MESHDIR, WM_GETTEXT, len + 1, (LPARAM)temp.data()); #ifdef UNICODE temp_w = temp.data(); temp_s.assign(temp_w.begin(), temp_w.end()); exp->meshOutputDir = temp_s; #else exp->meshOutputDir = temp; #endif len = (int)SendDlgItemMessage(hWnd, IDC_PROGDIR, WM_GETTEXTLENGTH, 0, 0); temp.Resize(len + 1); SendDlgItemMessage(hWnd, IDC_PROGDIR, WM_GETTEXT, len + 1, (LPARAM)temp.data()); #ifdef UNICODE temp_w = temp.data(); temp_s.assign(temp_w.begin(), temp_w.end()); exp->programOutputDir = temp_s; #else exp->programOutputDir = temp; #endif spin = GetISpinner(GetDlgItem(hWnd, IDC_RESAMPLE_SPIN)); exp->resampleStep = spin->GetIVal(); ReleaseISpinner(spin); exp->yUpAxis = IsDlgButtonChecked(hWnd, IDC_YUPAXIS) ? true : false; exp->useSharedGeom = IsDlgButtonChecked(hWnd, IDC_SHAREDGEOM) ? true : false; exp->generateLOD = IsDlgButtonChecked(hWnd, IDC_GENLOD) ? true : false; exp->buildEdges = IsDlgButtonChecked(hWnd, IDC_EDGELIST) ? true : false; exp->buildTangents = IsDlgButtonChecked(hWnd, IDC_TANGENT) ? true : false; exp->tangentsSplitMirrored = IsDlgButtonChecked(hWnd, IDC_SPLITMIRROR) ? true : false; exp->tangentsSplitRotated = IsDlgButtonChecked(hWnd, IDC_SPLITROT) ? true : false; exp->tangentsUseParity = IsDlgButtonChecked(hWnd, IDC_STOREPARITY) ? true : false; exp->convertToDDS = IsDlgButtonChecked(hWnd, IDC_CONVDDS) ? true : false; exp->resampleAnims = IsDlgButtonChecked(hWnd, IDC_RESAMPLE_ANIMS) ? true : false; exp->enableLogs = IsDlgButtonChecked(hWnd, IDC_LOGS) ? true : false; int shaderIdx = (int)SendDlgItemMessage(hWnd, IDC_SHADERMODE, CB_GETCURSEL, 0, 0); if (shaderIdx != CB_ERR) { switch (shaderIdx) { case 0: exp->exportProgram = SHADER_NONE; break; case 1: exp->exportProgram = SHADER_BUMP; break; case 2: exp->exportProgram = SHADER_ALL; break; case 3: exp->exportProgram = SHADER_ALL_MULTI; break; default: exp->exportProgram = SHADER_BUMP; } } int texIdx = (int)SendDlgItemMessage(hWnd, IDC_TEXSIZE, CB_GETCURSEL, 0, 0); if (texIdx != CB_ERR) { switch (texIdx) { case 0: exp->maxTextureSize = 64; break; case 1: exp->maxTextureSize = 128; break; case 2: exp->maxTextureSize = 256; break; case 3: exp->maxTextureSize = 512; break; case 4: exp->maxTextureSize = 1024; break; case 5: exp->maxTextureSize = 2048; break; case 6: exp->maxTextureSize = 4096; break; default: exp->maxTextureSize = 2048; } } int mipsIdx = (int)SendDlgItemMessage(hWnd, IDC_NUMMIPS, CB_GETCURSEL, 0, 0); if (mipsIdx != CB_ERR) { switch (mipsIdx) { case 0: exp->maxMipmaps = -1; break; case 1: exp->maxMipmaps = 0; break; case 2: exp->maxMipmaps = 2; break; case 3: exp->maxMipmaps = 4; break; case 4: exp->maxMipmaps = 8; break; case 5: exp->maxMipmaps = 16; break; case 6: exp->maxMipmaps = 32; break; default: exp->maxMipmaps = -1; } } EndDialog(hWnd, 1); } break; case IDCANCEL: EndDialog(hWnd, 0); break; } default: return FALSE; } return TRUE; }
INT_PTR DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { OrientConstRotation* p = (OrientConstRotation*)map->GetParamBlock()->GetOwner(); UpdateOrientName(p); p->hWnd = hWnd; int ct = p->pblock->Count(orientation_target_list); // int ctf = p->pblock->Count(orientation_target_weight); switch (msg) { case WM_INITDIALOG: { int selection = p->last_selection; ICustButton *iBut = GetICustButton(GetDlgItem(hWnd,IDC_ORIENT_TARG_PICKNODE)); iBut->SetType(CBT_CHECK); iBut->SetHighlightColor(GREEN_WASH); ReleaseICustButton(iBut); ISpinnerControl* spin = SetupFloatSpinner(hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER, IDC_ORIENT_CONS_WEIGHT_EDIT, 0.0f, 100.0f, 50.0f, 1.0f); spin = GetISpinner(GetDlgItem(hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER)); // CAL-09/10/02: automatically set last_selection to 0 when there're targets if (p->pblock->Count(orientation_target_list) < 1) { // nothing is selected OR there are no targets // all buttons - target_delete, weight_edit, weight_spinner -- are disabled EnableWindow(GetDlgItem(p->hWnd, IDC_ORIENT_CONS_WEIGHT_EDIT), FALSE); EnableWindow(GetDlgItem(p->hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER), FALSE); ICustButton *iPickOb1; iPickOb1 = GetICustButton(GetDlgItem(p->hWnd, IDC_REMOVE_ORIENT_TARG)); if (iPickOb1 != NULL){ iPickOb1->Enable(FALSE); ReleaseICustButton(iPickOb1); } spin->SetValue(0.0f, FALSE); } else { if (selection < 0) p->last_selection = selection = 0; // there is a valid selection // automatically means there is AT LEAST one target Control *cont = p->pblock->GetControllerByID(orientation_target_weight, selection); // until it is animated, paramblock doesn't have a controller assigned in it yet. if (spin) { if ((cont != NULL) && cont->IsKeyAtTime(t,KEYAT_ROTATION)) spin->SetKeyBrackets(TRUE); else spin->SetKeyBrackets(FALSE); } if(p->pickWorldFlag){ ICustButton *iPickOb; iPickOb = GetICustButton(GetDlgItem(p->hWnd, IDC_ORIENT_PICK_WORLD)); if (iPickOb != NULL){ iPickOb->Enable(FALSE); ReleaseICustButton(iPickOb); } } if (p->pblock->Count(orientation_target_list) == 1){// there is only one target // the "delete" button should be enabled ICustButton *iPickOb1; iPickOb1 = GetICustButton(GetDlgItem(p->hWnd, IDC_REMOVE_ORIENT_TARG)); if (iPickOb1 != NULL){ iPickOb1->Enable(TRUE); ReleaseICustButton(iPickOb1); } // the rest are disabled // EnableWindow(GetDlgItem(p->hWnd, IDC_ORIENT_CONS_WEIGHT_EDIT), FALSE); // EnableWindow(GetDlgItem(p->hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER), FALSE); } else if (p->pblock->Count(orientation_target_list) > 1){ // there are more than one targets // all buttons - delete, weight_edit, weight_spinner -- are enabled EnableWindow(GetDlgItem(p->hWnd, IDC_ORIENT_CONS_WEIGHT_EDIT), TRUE); EnableWindow(GetDlgItem(p->hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER), TRUE); ICustButton *iPickOb1; iPickOb1 = GetICustButton(GetDlgItem(p->hWnd, IDC_REMOVE_ORIENT_TARG)); if (iPickOb1 != NULL){ iPickOb1->Enable(TRUE); ReleaseICustButton(iPickOb1); } } } ReleaseISpinner(spin); p->RedrawListbox(GetCOREInterface()->GetTime(), selection); return TRUE; } break; case WM_COMMAND: { int selection; if (LOWORD(wParam) == IDC_ORIENT_TARG_LIST && HIWORD(wParam) == LBN_SELCHANGE) { selection = SendDlgItemMessage(p->hWnd, IDC_ORIENT_TARG_LIST, LB_GETCURSEL, 0, 0); p->last_selection = selection; if (selection >= 0){ // there is a valid selection // automatically means there is AT LEAST one target if (p->pblock->Count(orientation_target_list) == 1){ // there is only one target // the "delete" button should be enabled ICustButton *iPickOb1; iPickOb1 = GetICustButton(GetDlgItem(p->hWnd, IDC_REMOVE_ORIENT_TARG)); if (iPickOb1 != NULL){ iPickOb1->Enable(TRUE); ReleaseICustButton(iPickOb1); } // // the rest are disabled // EnableWindow(GetDlgItem(p->hWnd, IDC_ORIENT_CONS_WEIGHT_EDIT), FALSE); // EnableWindow(GetDlgItem(p->hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER), FALSE); } else if (p->pblock->Count(orientation_target_list) > 1){ // there are more than one targets // all buttons - delete, weight_edit, weight_spinner -- are enabled EnableWindow(GetDlgItem(p->hWnd, IDC_ORIENT_CONS_WEIGHT_EDIT), TRUE); EnableWindow(GetDlgItem(p->hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER), TRUE); ICustButton *iPickOb1; iPickOb1 = GetICustButton(GetDlgItem(p->hWnd, IDC_REMOVE_ORIENT_TARG)); if (iPickOb1 != NULL){ iPickOb1->Enable(TRUE); ReleaseICustButton(iPickOb1); } ISpinnerControl* spin = GetISpinner(GetDlgItem(hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER)); float value = map->GetParamBlock()->GetFloat(orientation_target_weight, t, selection); spin->SetValue(value, FALSE); Control *cont = p->pblock->GetControllerByID(orientation_target_weight, selection); // until it is animated, paramblock doesn't have a controller assigned in it yet. if (spin && (cont != NULL)) { if (cont->IsKeyAtTime(t,KEYAT_ROTATION)){ spin->SetKeyBrackets(TRUE); } } else { spin->SetKeyBrackets(FALSE); } ReleaseISpinner(spin); } p->RedrawListbox(GetCOREInterface()->GetTime(), selection); } else if (selection < 0 || p->pblock->Count(orientation_target_list) < 1){ // nothing is selected OR there are no targets // all buttons - target_delete, weight_edit, weight_spinner -- are disabled EnableWindow(GetDlgItem(p->hWnd, IDC_ORIENT_CONS_WEIGHT_EDIT), FALSE); EnableWindow(GetDlgItem(p->hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER), FALSE); ICustButton *iPickOb1; iPickOb1 = GetICustButton(GetDlgItem(p->hWnd, IDC_REMOVE_ORIENT_TARG)); if (iPickOb1 != NULL){ iPickOb1->Enable(FALSE); ReleaseICustButton(iPickOb1); } } } else if (LOWORD(wParam) == IDC_ORIENT_TARG_PICKNODE){ thePickMode.p = p; p->ip->SetPickMode(&thePickMode); } else if (LOWORD(wParam) == IDC_REMOVE_ORIENT_TARG){ selection = SendDlgItemMessage(p->hWnd, IDC_ORIENT_TARG_LIST, LB_GETCURSEL, 0, 0); p->last_selection = selection; if (selection >= 0){ theHold.Begin(); p->DeleteTarget(selection); theHold.Accept(GetString(IDS_AG_ORIENTATION_LIST)); } // p->RedrawListbox(GetCOREInterface()->GetTime(), selection-1); } else if (LOWORD(wParam) == IDC_ORIENT_PICK_WORLD){ INode *nullNode = NULL; p->AppendTarget(nullNode); p->pickWorldFlag = 1; p->NotifyDependents(FOREVER,PART_ALL,REFMSG_CHANGE); // so that the change is updated ICustButton *iPickOb; iPickOb = GetICustButton(GetDlgItem(p->hWnd, IDC_ORIENT_PICK_WORLD)); if (iPickOb != NULL){ iPickOb->Enable(FALSE); ReleaseICustButton(iPickOb); } p->RedrawListbox(GetCOREInterface()->GetTime()); } } break; case CC_SPINNER_CHANGE: { if (LOWORD(wParam) == IDC_ORIENT_CONS_WEIGHT_SPINNER) { int selection = SendDlgItemMessage(p->hWnd, IDC_ORIENT_TARG_LIST, LB_GETCURSEL, 0, 0); // CAL-09/10/02: need to start a hold if it's not holding to handle type-in values BOOL isHold = theHold.Holding(); if (!isHold) theHold.Begin(); ISpinnerControl* spin = GetISpinner(GetDlgItem(hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER)); if (selection >= 0) { float value = ((ISpinnerControl *)lParam)->GetFVal(); map->GetParamBlock()->SetValue(orientation_target_weight, t, value, selection); Control *cont = p->pblock->GetControllerByID(orientation_target_weight, selection); // until it is animated, paramblock doesn't have a controller assigned in it yet. if (spin) spin->SetKeyBrackets(((cont != NULL) && cont->IsKeyAtTime(t,KEYAT_ROTATION)) ? TRUE : FALSE); p->RedrawListbox(GetCOREInterface()->GetTime(), selection); } else { if (spin) spin->SetValue(0.0f, FALSE); } if (spin) ReleaseISpinner(spin); if (!isHold) theHold.Accept(GetString(IDS_RB_PARAMETERCHANGE)); } } break; } return FALSE; }
void MaterialUIHandler::UpdateCurrentMaterial (HWND hWnd, EPolyMod *pMod, TimeValue t, Interval & validity) { MtlID mat = 0; bool determined = false; if (pMod->GetPolyOperationID() == ep_op_set_material) { int materialHolder; pMod->getParamBlock()->GetValue (epm_material, t, materialHolder, validity); mat = materialHolder; determined = true; } else { bool useStackSelection = pMod->getParamBlock()->GetInt (epm_stack_selection) != 0; bool init = false; ModContextList list; INodeTab nodes; pMod->EpModGetIP()->GetModContexts (list, nodes); int i; for (i=0; i<list.Count(); i++) { EditPolyData *pData = (EditPolyData *) list[i]->localData; if (!pData) continue; MNMesh *pMesh = pData->GetMesh(); if (!pMesh) { validity = NEVER; continue; } DWORD l_selFlag = useStackSelection ? MN_EDITPOLY_STACK_SELECT:MN_SEL; int j; for (j=0; j<pMesh->numf; j++) { if (!pMesh->f[j].GetFlag (l_selFlag)) continue; if (pMesh->f[j].GetFlag (MN_DEAD)) continue; if (!init) { mat = pMesh->f[j].material; init = true; } else if (mat != pMesh->f[j].material) break; } if (j<pMesh->numf) break; } nodes.DisposeTemporary (); determined = (i>=list.Count()) && init; } ISpinnerControl *spin = GetISpinner(GetDlgItem(hWnd,IDC_MAT_IDSPIN)); spin->SetIndeterminate(!determined); if (determined) spin->SetValue (int(mat+1), FALSE); ReleaseISpinner(spin); spin = GetISpinner(GetDlgItem(hWnd,IDC_MAT_IDSPIN_SEL)); spin->SetIndeterminate(!determined); if (determined) spin->SetValue (int(mat+1), FALSE); ReleaseISpinner(spin); if (GetDlgItem (hWnd, IDC_MTLID_NAMES_COMBO)) { ValidateUINameCombo(hWnd, pMod); } }
void OrientConstRotation::RedrawListbox(TimeValue t, int sel) { if (hWnd == NULL) return; if (!ip || editCont != this) return; int isWorldinListboxFlag = 0; if(!orientCD.NumParamMaps()) return; int selection = SendDlgItemMessage(hWnd, IDC_ORIENT_TARG_LIST, LB_GETCURSEL, 0, 0); // IParamBlock2* pb = orientCD.GetParamMap(0)->GetParamBlock(); SendDlgItemMessage(hWnd, IDC_ORIENT_TARG_LIST, LB_RESETCONTENT, 0, 0); int ts = 64; // appears smaller than necessary since for a large no of targets the vertical scroll bar needs space SendDlgItemMessage(hWnd, IDC_ORIENT_TARG_LIST, LB_SETTABSTOPS, 1, (LPARAM)&ts); int ct = pblock->Count(orientation_target_list); int ctf = pblock->Count(orientation_target_weight); if (ct != ctf) return; // CAL-09/10/02: In the middle of changing table size. for (int i = 0; i < ct; i++){ TSTR str; INode *testNode; testNode = pblock->GetINode(orientation_target_list, t, i); if (testNode == NULL){ str.printf( _T("%-s\t%-d"), // NOTE: for tab "\t" to use, check "use tabstops" in the resource listbox properties _T("World"), (int)pblock->GetFloat(orientation_target_weight, t, i)); isWorldinListboxFlag = 1; ICustButton *iPickOb; iPickOb = GetICustButton(GetDlgItem(hWnd, IDC_ORIENT_PICK_WORLD)); if (iPickOb != NULL){ iPickOb->Enable(FALSE); ReleaseICustButton(iPickOb); } } else{ float wwt = pblock->GetFloat(orientation_target_weight, t, i); const TCHAR * nname = testNode->GetName(); str.printf(_T("%-s\t%-d"), testNode->GetName(), (int)pblock->GetFloat(orientation_target_weight, t, i)); } SendDlgItemMessage(hWnd, IDC_ORIENT_TARG_LIST, LB_ADDSTRING, 0, (LPARAM)(LPCTSTR) str.data()); } if(!isWorldinListboxFlag){ ICustButton *iPickOb; iPickOb = GetICustButton(GetDlgItem(hWnd, IDC_ORIENT_PICK_WORLD)); if (iPickOb != NULL){ iPickOb->Enable(TRUE); ReleaseICustButton(iPickOb); } } if (ct > 0){ if (sel >= 0){ SendDlgItemMessage(hWnd, IDC_ORIENT_TARG_LIST, LB_SETCURSEL, sel, 0); } else{ // int selection = SendDlgItemMessage(hWnd, IDC_POS_TARG_LIST, LB_GETCURSEL, 0, 0); if (selection >= 0){ SendDlgItemMessage(hWnd, IDC_ORIENT_TARG_LIST, LB_SETCURSEL, selection, 0); last_selection = selection; } else if (ct == 1){ SendDlgItemMessage(hWnd, IDC_ORIENT_TARG_LIST, LB_SETCURSEL, 0, 0); last_selection = 0; } } ISpinnerControl* spin = GetISpinner(GetDlgItem(hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER)); if (last_selection >= 0 && spin != NULL){ float value = pblock->GetFloat(orientation_target_weight, GetCOREInterface()->GetTime(), last_selection); spin->SetValue(value, FALSE); } ReleaseISpinner(spin); } HWND hListBox = GetDlgItem(hWnd, IDC_ORIENT_TARG_LIST); int extent = computeHorizontalExtent(hListBox, TRUE, 1, &ts); SendMessage(hListBox, LB_SETHORIZONTALEXTENT, extent, 0); UpdateWindow(hWnd); }
static INT_PTR CALLBACK FaceDataDlgProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { EditFaceDataMod *em = (EditFaceDataMod *) GetWindowLongPtr (hWnd, GWLP_USERDATA); ISpinnerControl *spin; switch (msg) { case WM_INITDIALOG: em = (EditFaceDataMod*) lParam; em->SetDialogHandle (hWnd); SetWindowLongPtr (hWnd,GWLP_USERDATA,lParam); spin = GetISpinner(GetDlgItem(hWnd,IDC_VALUE_SPIN)); spin->SetLimits (0.0f, 100.0f, FALSE); spin->SetScale (0.1f); spin->LinkToEdit (GetDlgItem(hWnd, IDC_VALUE), EDITTYPE_POS_FLOAT); spin->SetValue (1.0f, FALSE); spin->Disable(); ReleaseISpinner(spin); CheckDlgButton (hWnd, IDC_COLLAPSABLE, em->GetCollapsable()); em->UpdateDialog (); break; case CC_SPINNER_BUTTONDOWN: switch (LOWORD(wParam)) { case IDC_VALUE_SPIN: em->ChangeBegin (); break; } break; case CC_SPINNER_CHANGE: spin = (ISpinnerControl*)lParam; switch (LOWORD(wParam)) { case IDC_VALUE_SPIN: em->ChangeTo (spin->GetFVal()); break; } break; case CC_SPINNER_BUTTONUP: switch (LOWORD(wParam)) { case IDC_VALUE_SPIN: em->ChangeFinish (HIWORD(wParam) ? true : false); break; } break; case WM_CUSTEDIT_ENTER: switch (LOWORD(wParam)) { case IDC_VALUE: em->ChangeFinish (true); break; } break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_RESET_SELECTION: em->ResetSelection (); break; case IDC_COLLAPSABLE: em->SetCollapsable (IsDlgButtonChecked (hWnd, IDC_COLLAPSABLE)?true:false); break; } break; case WM_PAINT: // Good place for call to UpdateDialog, if needed. return FALSE; default: return FALSE; } return TRUE; }
void StraussShaderDlg::UpdateOpacity() { trSpin->SetValue(FracToPc(pMtl->GetOpacity(curTime)),FALSE); trSpin->SetKeyBrackets(pMtl->KeyAtTimeByID(OPACITY_PARAM, curTime)); UpdateHilite(); }
static INT_PTR CALLBACK ElMaxPluginDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: { theElMaxPlugin.Init(hWnd); Interval animRange; ISpinnerControl* spin; int frameStart, frameEnd; // Setup the spinner control for the static frame# // We take the frame 0 as the default value animRange = theElMaxPlugin.GetInterface()->GetAnimRange(); frameStart = animRange.Start() / GetTicksPerFrame(); frameEnd = animRange.End() / GetTicksPerFrame(); spin = GetISpinner(GetDlgItem(hWnd, IDC_STATIC_FRAME_SPIN)); spin->LinkToEdit(GetDlgItem(hWnd,IDC_STATIC_FRAME), EDITTYPE_INT); spin->SetLimits(frameStart, frameEnd, TRUE); spin->SetScale(1.0f); spin->SetValue(theElMaxPlugin.GetStaticFrame(), FALSE); ReleaseISpinner(spin); // Setup the spinner controls for the mesh animation start frame spin = GetISpinner(GetDlgItem(hWnd, IDC_MESHANIM_START_SPIN)); spin->LinkToEdit(GetDlgItem(hWnd, IDC_MESHANIM_START), EDITTYPE_INT); spin->SetLimits(frameStart, frameEnd, TRUE); spin->SetScale(1.0f); spin->SetValue(frameStart, FALSE); ReleaseISpinner(spin); // Setup the spinner controls for the mesh animation end frame spin = GetISpinner(GetDlgItem(hWnd, IDC_MESHANIM_END_SPIN)); spin->LinkToEdit(GetDlgItem(hWnd, IDC_MESHANIM_END), EDITTYPE_INT); spin->SetLimits(frameStart, frameEnd, TRUE); spin->SetScale(1.0f); spin->SetValue(frameEnd, FALSE); ReleaseISpinner(spin); // Setup the spinner controls for the mesh animation key sample rate spin = GetISpinner(GetDlgItem(hWnd, IDC_MESHANIM_STEP_SPIN)); spin->LinkToEdit(GetDlgItem(hWnd, IDC_MESHANIM_STEP), EDITTYPE_INT); spin->SetLimits(1, 100, TRUE); spin->SetScale(1.0f); spin->SetValue(theElMaxPlugin.GetMeshAnimFrameStep(), FALSE); ReleaseISpinner(spin); // Setup the spinner controls for the skeletal animation start frame spin = GetISpinner(GetDlgItem(hWnd, IDC_SKELETALANIM_START_SPIN)); spin->LinkToEdit(GetDlgItem(hWnd, IDC_SKELETALANIM_START), EDITTYPE_INT); spin->SetLimits(frameStart, frameEnd, TRUE); spin->SetScale(1.0f); spin->SetValue(frameStart, FALSE); ReleaseISpinner(spin); // Setup the spinner controls for the skeletal animation end frame spin = GetISpinner(GetDlgItem(hWnd, IDC_SKELETALANIM_END_SPIN)); spin->LinkToEdit(GetDlgItem(hWnd, IDC_SKELETALANIM_END), EDITTYPE_INT); spin->SetLimits(frameStart, frameEnd, TRUE); spin->SetScale(1.0f); spin->SetValue(frameEnd, FALSE); ReleaseISpinner(spin); // Setup the spinner controls for the skeletal animation key sample rate spin = GetISpinner(GetDlgItem(hWnd, IDC_SKELETALANIM_STEP_SPIN)); spin->LinkToEdit(GetDlgItem(hWnd, IDC_SKELETALANIM_STEP), EDITTYPE_INT); spin->SetLimits(1, 100, TRUE); spin->SetScale(1.0f); spin->SetValue(theElMaxPlugin.GetSkeletalAnimFrameStep(), FALSE); ReleaseISpinner(spin); } break; case WM_DESTROY: theElMaxPlugin.Destroy(hWnd); break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_EXPORT_MESH: if (HIWORD(wParam) == BN_CLICKED) { char filename[MAX_PATH] = {0}; if (GetSaveFileName(hWnd, filename, sizeof(filename), _T("ElMesh(*.ELM)\0*.ELM\0All(*.*)\0*.*\0"), _T("ELM"), _T("Mesh file to save"))) { ISpinnerControl* spin = GetISpinner(GetDlgItem(hWnd, IDC_STATIC_FRAME_SPIN)); theElMaxPlugin.SetStaticFrame(spin->GetIVal()); ReleaseISpinner(spin); theElMaxPlugin.ExportMesh(filename); } } break; case IDC_EXPORT_MESHANIM: if (HIWORD(wParam) == BN_CLICKED) { char filename[MAX_PATH] = {0}; if (GetSaveFileName(hWnd, filename, sizeof(filename), _T("ElMeshAnimation(*.EMA)\0*.EMA\0All(*.*)\0*.*\0"), _T("EMA"), _T("MeshAnimation file to save"))) { ISpinnerControl* spin = GetISpinner(GetDlgItem(hWnd, IDC_STATIC_FRAME_SPIN)); theElMaxPlugin.SetStaticFrame(spin->GetIVal()); ReleaseISpinner(spin); spin = GetISpinner(GetDlgItem(hWnd, IDC_MESHANIM_START_SPIN)); theElMaxPlugin.SetMeshAnimFrameStart(spin->GetIVal()); ReleaseISpinner(spin); spin = GetISpinner(GetDlgItem(hWnd, IDC_MESHANIM_END_SPIN)); theElMaxPlugin.SetMeshAnimFrameEnd(spin->GetIVal()); ReleaseISpinner(spin); spin = GetISpinner(GetDlgItem(hWnd, IDC_MESHANIM_STEP_SPIN)); theElMaxPlugin.SetMeshAnimFrameStep(spin->GetIVal()); ReleaseISpinner(spin); theElMaxPlugin.ExportMeshAnim(filename); } } break; case IDC_EXPORT_SKELETON: if (HIWORD(wParam) == BN_CLICKED) { char filename[MAX_PATH] = {0}; if (GetSaveFileName(hWnd, filename, sizeof(filename), _T("ElSkeleton(*.ELS)\0*.ELS\0All(*.*)\0*.*\0"), _T("ELS"), _T("Skeleton file to save"))) { ISpinnerControl* spin = GetISpinner(GetDlgItem(hWnd, IDC_STATIC_FRAME_SPIN)); theElMaxPlugin.SetStaticFrame(spin->GetIVal()); ReleaseISpinner(spin); theElMaxPlugin.ExportSkeleton(filename); } } break; case IDC_EXPORT_SKELETALANIM: if (HIWORD(wParam) == BN_CLICKED) { char filename[MAX_PATH] = {0}; if (GetSaveFileName(hWnd, filename, sizeof(filename), _T("ElSkeletalAnimation(*.ESA)\0*.ESA\0All(*.*)\0*.*\0"), _T("ESA"), _T("SkeletalAnimation file to save"))) { ISpinnerControl* spin = GetISpinner(GetDlgItem(hWnd, IDC_STATIC_FRAME_SPIN)); theElMaxPlugin.SetStaticFrame(spin->GetIVal()); ReleaseISpinner(spin); spin = GetISpinner(GetDlgItem(hWnd, IDC_SKELETALANIM_START_SPIN)); theElMaxPlugin.SetSkeletalAnimFrameStart(spin->GetIVal()); ReleaseISpinner(spin); spin = GetISpinner(GetDlgItem(hWnd, IDC_SKELETALANIM_END_SPIN)); theElMaxPlugin.SetSkeletalAnimFrameEnd(spin->GetIVal()); ReleaseISpinner(spin); spin = GetISpinner(GetDlgItem(hWnd, IDC_SKELETALANIM_STEP_SPIN)); theElMaxPlugin.SetSkeletalAnimFrameStep(spin->GetIVal()); ReleaseISpinner(spin); theElMaxPlugin.ExportSkeletalAnim(filename); } } break; } break; case WM_LBUTTONDOWN: case WM_LBUTTONUP: case WM_MOUSEMOVE: theElMaxPlugin.ip->RollupMouseMessage(hWnd,msg,wParam,lParam); break; default: return 0; } return 1; }
// --[ Method ]--------------------------------------------------------------- // // - Class : CStravaganzaMaxTools // // - prototype : void ReadConfig(bool bLoadDefaults = false) // // - Purpose : Initializes the tool parameters, reading the previous // configuration from a cfg file or creating default values. // If bLoadDefaults is true, the config file won't be read and // default values will be assigned. // // ----------------------------------------------------------------------------- void CStravaganzaMaxTools::ReadConfig(bool bLoadDefaults) { if(!m_hPanel) return; ISpinnerControl* pMaxSpin; ICustEdit* pMaxEdit; CInputFile cfgFile; m_bPreprocessMesh = true; m_bUseLights = true; m_eAnimType = ANIMATION_SAMPLING; m_nAnimCheckStep = 20; m_nNumPosSamplesPerSec = 30; m_nNumSclSamplesPerSec = 30; m_nNumRotSamplesPerSec = 30; m_nNumCamSettingsPerSec = 15; m_nNumLightSettingsPerSec = 15; m_strFile = ""; m_bCopyTextures = true; m_strTexturePath = ""; m_ePreviewType = CRenderVisitor::MODE_SOLID; m_bFullscreen = false; m_bLoop = true; m_nPreviewResX = 800; m_nPreviewResY = 600; m_fViewportHeight = 1.0f; m_bShowStats = true; m_bRenderToAvi = false; m_strAviFile = ""; m_strPreviewCamera = ""; if(cfgFile.Open(m_strCfgFile, false) && !bLoadDefaults) { int nValue; // Common options cfgFile.ReadInt(&nValue); m_bPreprocessMesh = nValue ? true : false; cfgFile.ReadInt(&nValue); m_bUseLights = nValue ? true : false; m_fStartTime = TICKS_TO_SECONDS(m_pMaxInterface->GetAnimRange().Start()); m_fEndTime = TICKS_TO_SECONDS(m_pMaxInterface->GetAnimRange().End()); cfgFile.ReadInt(&m_nAnimCheckStep); cfgFile.ReadInt(&m_nNumPosSamplesPerSec); cfgFile.ReadInt(&m_nNumSclSamplesPerSec); cfgFile.ReadInt(&m_nNumRotSamplesPerSec); cfgFile.ReadInt(&m_nNumCamSettingsPerSec); cfgFile.ReadInt(&m_nNumLightSettingsPerSec); cfgFile.ReadInt(&nValue); switch(nValue) { case ANIMATION_SAMPLING: m_eAnimType = ANIMATION_SAMPLING; break; case ANIMATION_MAXKEYS: m_eAnimType = ANIMATION_MAXKEYS; break; } // Export options cfgFile.ReadStringZero(&m_strFile); cfgFile.ReadInt(&nValue); m_bCopyTextures = nValue ? true : false; cfgFile.ReadStringZero(&m_strTexturePath); // Preview options cfgFile.ReadStringZero(&m_strPreviewCamera); FillCameraCombobox(GetDlgItem(m_hPanel, IDC_COMBO_CAMERA), m_pMaxInterface->GetRootNode()); cfgFile.ReadInt(&nValue); switch(nValue) { case CRenderVisitor::MODE_WIREFRAME: m_ePreviewType = CRenderVisitor::MODE_WIREFRAME; break; case CRenderVisitor::MODE_SOLID: m_ePreviewType = CRenderVisitor::MODE_SOLID; break; case CRenderVisitor::MODE_FULLDETAIL: m_ePreviewType = CRenderVisitor::MODE_FULLDETAIL; break; } cfgFile.ReadInt(&nValue); m_bFullscreen = nValue ? true : false; cfgFile.ReadInt(&nValue); m_bLoop = nValue ? true : false; cfgFile.ReadInt (&m_nPreviewResX); cfgFile.ReadInt (&m_nPreviewResY); cfgFile.ReadFloat(&m_fViewportHeight); cfgFile.ReadInt (&nValue); m_bShowStats = nValue ? true : false; cfgFile.ReadInt (&nValue); m_bRenderToAvi = nValue ? true : false; cfgFile.ReadStringZero(&m_strAviFile); } cfgFile.Close(); // Common CheckDlgButton(m_hPanel, IDC_CHECK_PREPROCESSMESHES, m_bPreprocessMesh ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(m_hPanel, IDC_CHECK_USELIGHTS, m_bUseLights ? BST_CHECKED : BST_UNCHECKED); EnableWindow(GetDlgItem(m_hPanel, IDC_RADIO_USEMAXKEYS), FALSE); switch(m_eAnimType) { case ANIMATION_SAMPLING: CheckRadioButton(m_hPanel, IDC_RADIO_USESAMPLING, IDC_RADIO_USEMAXKEYS, IDC_RADIO_USESAMPLING); break; case ANIMATION_MAXKEYS: CheckRadioButton(m_hPanel, IDC_RADIO_USESAMPLING, IDC_RADIO_USEMAXKEYS, IDC_RADIO_USEMAXKEYS); break; } pMaxSpin = GetISpinner(GetDlgItem(m_hPanel, IDC_SPIN_STARTTIME)); pMaxSpin->LinkToEdit(GetDlgItem(m_hPanel, IDC_EDIT_STARTTIME), EDITTYPE_FLOAT); pMaxSpin->SetLimits(m_fStartTime, m_fEndTime, TRUE); pMaxSpin->SetScale(0.01f); pMaxSpin->SetValue(m_fStartTime, FALSE); ReleaseISpinner(pMaxSpin); pMaxSpin = GetISpinner(GetDlgItem(m_hPanel, IDC_SPIN_ENDTIME)); pMaxSpin->LinkToEdit(GetDlgItem(m_hPanel, IDC_EDIT_ENDTIME), EDITTYPE_FLOAT); pMaxSpin->SetLimits(m_fStartTime, m_fEndTime, TRUE); pMaxSpin->SetScale(0.01f); pMaxSpin->SetValue(m_fEndTime, FALSE); ReleaseISpinner(pMaxSpin); pMaxSpin = GetISpinner(GetDlgItem(m_hPanel, IDC_SPIN_ANIMCHECKSTEP)); pMaxSpin->LinkToEdit(GetDlgItem(m_hPanel, IDC_EDIT_ANIMCHECKSTEP), EDITTYPE_INT); pMaxSpin->SetLimits(0, 100, TRUE); pMaxSpin->SetScale(1); pMaxSpin->SetValue(m_nAnimCheckStep, FALSE); ReleaseISpinner(pMaxSpin); pMaxSpin = GetISpinner(GetDlgItem(m_hPanel, IDC_SPIN_POSSAMPLINGFREQ)); pMaxSpin->LinkToEdit(GetDlgItem(m_hPanel, IDC_EDIT_POSSAMPLINGFREQ), EDITTYPE_INT); pMaxSpin->SetLimits(0, 100, TRUE); pMaxSpin->SetScale(1); pMaxSpin->SetValue(m_nNumPosSamplesPerSec, FALSE); ReleaseISpinner(pMaxSpin); pMaxSpin = GetISpinner(GetDlgItem(m_hPanel, IDC_SPIN_SCLSAMPLINGFREQ)); pMaxSpin->LinkToEdit(GetDlgItem(m_hPanel, IDC_EDIT_SCLSAMPLINGFREQ), EDITTYPE_INT); pMaxSpin->SetLimits(0, 100, TRUE); pMaxSpin->SetScale(1); pMaxSpin->SetValue(m_nNumSclSamplesPerSec, FALSE); ReleaseISpinner(pMaxSpin); pMaxSpin = GetISpinner(GetDlgItem(m_hPanel, IDC_SPIN_ROTSAMPLINGFREQ)); pMaxSpin->LinkToEdit(GetDlgItem(m_hPanel, IDC_EDIT_ROTSAMPLINGFREQ), EDITTYPE_INT); pMaxSpin->SetLimits(0, 100, TRUE); pMaxSpin->SetScale(1); pMaxSpin->SetValue(m_nNumRotSamplesPerSec, FALSE); ReleaseISpinner(pMaxSpin); // Export pMaxEdit = GetICustEdit(GetDlgItem(m_hPanel, IDC_EDIT_DESTINATIONFILE)); pMaxEdit->SetText((char*)m_strFile.data()); pMaxEdit->SetLeading(2); ReleaseICustEdit(pMaxEdit); CheckDlgButton(m_hPanel, IDC_CHECK_COPYTEXTURES, m_bCopyTextures ? BST_CHECKED : BST_UNCHECKED); pMaxEdit = GetICustEdit(GetDlgItem(m_hPanel, IDC_EDIT_TEXTUREFOLDER)); pMaxEdit->SetText((char*)m_strTexturePath.data()); pMaxEdit->SetLeading(2); ReleaseICustEdit(pMaxEdit); EnableWindow(GetDlgItem(m_hPanel, IDC_EDIT_TEXTUREFOLDER), m_bCopyTextures ? TRUE : FALSE); EnableWindow(GetDlgItem(m_hPanel, IDC_BUTTON_TEXTUREFOLDER), m_bCopyTextures ? TRUE : FALSE); // Preview switch(m_ePreviewType) { case CRenderVisitor::MODE_WIREFRAME: CheckRadioButton(m_hPanel, IDC_RADIO_WIREFRAME, IDC_RADIO_FULLDETAIL, IDC_RADIO_WIREFRAME); break; case CRenderVisitor::MODE_SOLID: CheckRadioButton(m_hPanel, IDC_RADIO_WIREFRAME, IDC_RADIO_FULLDETAIL, IDC_RADIO_SOLID); break; case CRenderVisitor::MODE_FULLDETAIL: CheckRadioButton(m_hPanel, IDC_RADIO_WIREFRAME, IDC_RADIO_FULLDETAIL, IDC_RADIO_FULLDETAIL); break; } CheckDlgButton(m_hPanel, IDC_CHECK_FULLSCREEN, m_bFullscreen ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(m_hPanel, IDC_CHECK_LOOP, m_bLoop ? BST_CHECKED : BST_UNCHECKED); pMaxEdit = GetICustEdit(GetDlgItem(m_hPanel, IDC_EDIT_RESW)); pMaxEdit->SetText(m_nPreviewResX); ReleaseICustEdit(pMaxEdit); pMaxEdit = GetICustEdit(GetDlgItem(m_hPanel, IDC_EDIT_RESH)); pMaxEdit->SetText(m_nPreviewResY); ReleaseICustEdit(pMaxEdit); pMaxSpin = GetISpinner(GetDlgItem(m_hPanel, IDC_SPIN_VIEWPORTHEIGHT)); pMaxSpin->LinkToEdit(GetDlgItem(m_hPanel, IDC_EDIT_VIEWPORTHEIGHT), EDITTYPE_FLOAT); pMaxSpin->SetLimits(0.0f, 1.0f, TRUE); pMaxSpin->SetScale(0.01f); pMaxSpin->SetValue(m_fViewportHeight, FALSE); ReleaseISpinner(pMaxSpin); CheckDlgButton(m_hPanel, IDC_CHECK_SHOWSTATS, m_bShowStats ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(m_hPanel, IDC_CHECK_RENDERTOAVI, m_bRenderToAvi ? BST_CHECKED : BST_UNCHECKED); pMaxEdit = GetICustEdit(GetDlgItem(m_hPanel, IDC_EDIT_AVIFILE)); pMaxEdit->SetText((char*)m_strAviFile.data()); pMaxEdit->SetLeading(2); ReleaseICustEdit(pMaxEdit); EnableWindow(GetDlgItem(m_hPanel, IDC_EDIT_AVIFILE), m_bRenderToAvi ? TRUE : FALSE); EnableWindow(GetDlgItem(m_hPanel, IDC_BUTTON_AVIFILE), m_bRenderToAvi ? TRUE : FALSE); }
void FooControl::add_control(Rollout *ro, HWND parent, HINSTANCE hInstance, int& current_y) { HWND label, edit_box, spinner; int left, top, width, height; SIZE size; const TCHAR* text = caption->eval()->to_string(); /* add 3 controls for a spinner: the label static, value custeditbox, & spinner itself, * label & edit box are given IDs that are the spinner id * control_count & that + 1, to make * sure they are unique and decodable */ parent_rollout = ro; control_ID = next_id(); WORD label_id = next_id(); WORD edit_box_id = next_id(); // compute bounding box, apply layout params layout_data pos; setup_layout(ro, &pos, current_y); Value* fw = control_param(fieldwidth); int spin_width = (fw == &unsupplied) ? ro->current_width / 2 : fw->to_int() + 10; GetTextExtentPoint32(ro->rollout_dc, text, static_cast<int>(_tcslen(text)), &size); int lbl_width = size.cx; int orig_width = lbl_width + spin_width; pos.width = orig_width + 2; pos.left = pos.left + ro->current_width - pos.width; pos.height = ro->text_height + 3; process_layout_params(ro, &pos, current_y); // place spinner elements int cex = (fw == &unsupplied) ? pos.width * lbl_width / orig_width : pos.width - spin_width; cex = min(cex, pos.width); width = lbl_width; height = ro->text_height; left = pos.left + cex - width - 1; top = pos.top; label = CreateWindow(_T("STATIC"), text, WS_VISIBLE | WS_CHILD | WS_GROUP, left, top, width, height, parent, (HMENU)label_id, hInstance, NULL); width = pos.width - cex - 13; height = ro->text_height + 3; left = pos.left + cex + 1; edit_box = CreateWindowEx(0, CUSTEDITWINDOWCLASS, _T(""), WS_VISIBLE | WS_CHILD | WS_TABSTOP | WS_GROUP, left, top, width, height, parent, (HMENU)edit_box_id, hInstance, NULL); left += width; width = 10; spinner = CreateWindowEx(0, SPINNERWINDOWCLASS, _T(""), WS_VISIBLE | WS_CHILD, left, top, width, height, parent, (HMENU)control_ID, hInstance, NULL); SendDlgItemMessage(parent, label_id, WM_SETFONT, (WPARAM)ro->font, 0L); SendDlgItemMessage(parent, edit_box_id, WM_SETFONT, (WPARAM)ro->font, 0L); /* setup the spinner control */ ISpinnerControl* spin = GetISpinner(spinner); Value* range = control_param(range); Value* type = control_param(type); Value* scaleval = control_param(scale); if (type == n_integer) spin_type = EDITTYPE_INT; else if (type == n_worldUnits) spin_type = EDITTYPE_UNIVERSE; else if (type == n_float || type == &unsupplied) spin_type = EDITTYPE_FLOAT; else throw TypeError (MaxSDK::GetResourceStringAsMSTR(IDS_SPINNER_TYPE_MUST_BE_INTEGER_OR_FLOAT), type); if (ro->init_values) { if (range == &unsupplied) { min = 0.0f; max = 100.0f; value = 0.0f; } else if (is_point3(range)) { Point3 p = range->to_point3(); min = p.x; max = p.y; value = p.z; } else throw TypeError (MaxSDK::GetResourceStringAsMSTR(IDS_SPINNER_RANGE_MUST_BE_A_VECTOR), range); if (scaleval == &unsupplied) { scale = (spin_type == EDITTYPE_INT) ? 1.0f : 0.1f; } else scale = scaleval->to_float(); } spin->LinkToEdit(edit_box, spin_type); spin->SetScale(scale); if (spin_type == EDITTYPE_INT) { spin->SetLimits((int)min, (int)max, FALSE); spin->SetValue((int)value, FALSE); } else if (spin_type == EDITTYPE_UNIVERSE) { spin->SetLimits(min, max, FALSE); spin->SetValue(value, FALSE); } else { spin->SetLimits(min, max, FALSE); spin->SetValue(value, FALSE); } ReleaseISpinner(spin); }
void OrenNayarShaderDlg::UpdateOpacity() { trSpin->SetValue(FracToPc(pMtl->GetOpacity(curTime)),FALSE); trSpin->SetKeyBrackets(pMtl->KeyAtTime(OPACITY_PARAM, curTime)); }
// options dialog message handler INT_PTR Options::ExportOptionsDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM) { ISpinnerControl* spin; // int ticksPerFrame = GetTicksPerFrame(); Interval animRange = mMaxInterface->GetAnimRange(); int sceneStart = animRange.Start(); int sceneEnd = animRange.End(); switch (message) { case WM_INITDIALOG: { CenterWindow(hWnd, GetParent(hWnd)); // grab scene timing details & clip anim start & end if needed if (mAnimationStart < sceneStart) mAnimationStart = sceneStart; if (mAnimationStart > sceneEnd) mAnimationStart = sceneEnd; if (mAnimationEnd < sceneStart) mAnimationEnd = sceneStart; if (mAnimationEnd > sceneEnd) mAnimationEnd = sceneEnd; // setup checkboxes CheckDlgButton(hWnd, IDC_GEOM_NORMALS, mNormals); CheckDlgButton(hWnd, IDC_GEOM_TRIANGLES, mTriangulate); CheckDlgButton(hWnd, IDC_GEOM_XREFS, mIncludeXrefs); CheckDlgButton(hWnd, IDC_GEOM_TANGENTS, mTangents); CheckDlgButton(hWnd, IDC_ANIM_ENABLE, mAnimations); CheckDlgButton(hWnd, IDC_ANIM_SAMPLE, mSampleAnimation); CheckDlgButton(hWnd, IDC_ANIM_CLIP, mCreateClip); CheckDlgButton(hWnd, IDC_LAYERS_TO_CLIPS, mLayersAsClips); CheckDlgButton(hWnd, IDC_BAKE_MATRICES, mBakeMatrices); CheckDlgButton(hWnd, IDC_RELATIVE_PATHS, mRelativePaths); CheckDlgButton(hWnd, IDC_COPY_IMAGES, mCopyImages); CheckDlgButton(hWnd, IDC_EXPORT_USER_PROPERTIES, mExportUserDefinedProperties); // Animation checkboxes depend on the enable button. EnableDlgControl(hWnd, IDC_ANIM_SAMPLE, mAnimations); EnableDlgControl(hWnd, IDC_ANIM_CLIP, mAnimations); #if defined(MAX_RELEASE_R17) && (MAX_RELEASE >= MAX_RELEASE_R17) EnableDlgControl(hWnd, IDC_LAYERS_TO_CLIPS, mAnimations); #else EnableDlgControl(hWnd, IDC_LAYERS_TO_CLIPS, false); #endif // setup spinners spin = GetISpinner(GetDlgItem(hWnd, IDC_ANIM_START_SPIN)); spin->LinkToEdit(GetDlgItem(hWnd,IDC_ANIM_START), EDITTYPE_TIME); spin->SetLimits(sceneStart, sceneEnd, true); spin->SetScale(1.0f); spin->SetValue(mAnimationStart, true); spin->Enable(mSampleAnimation && mAnimations); EnableWindow(GetDlgItem(hWnd, IDC_START_LABEL), mSampleAnimation && mAnimations); ReleaseISpinner(spin); spin = GetISpinner(GetDlgItem(hWnd, IDC_ANIM_END_SPIN)); spin->LinkToEdit(GetDlgItem(hWnd,IDC_ANIM_END), EDITTYPE_TIME); spin->SetLimits(sceneStart, sceneEnd, true); spin->SetScale(1.0f); spin->SetValue(mAnimationEnd, false); spin->Enable(mSampleAnimation && mAnimations); EnableWindow(GetDlgItem(hWnd, IDC_END_LABEL), mSampleAnimation && mAnimations); ReleaseISpinner(spin); return true; } case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_ANIM_ENABLE: mAnimations = IsDlgButtonChecked(hWnd, IDC_ANIM_ENABLE) == BST_CHECKED; EnableDlgControl(hWnd, IDC_ANIM_SAMPLE, mAnimations); EnableDlgControl(hWnd, IDC_ANIM_CLIP, mAnimations); #if defined(MAX_RELEASE_R17) && (MAX_RELEASE >= MAX_RELEASE_R17) EnableDlgControl(hWnd, IDC_LAYERS_TO_CLIPS, mAnimations); #else EnableDlgControl(hWnd, IDC_LAYERS_TO_CLIPS, false); #endif /*spin = GetISpinner(GetDlgItem(hWnd, IDC_ANIM_START_SPIN)); //spin->LinkToEdit(GetDlgItem(hWnd,IDC_ANIM_START), EDITTYPE_INT); spin->Enable(sampleAnim && animations); EnableWindow(GetDlgItem(hWnd, IDC_START_LABEL), sampleAnim && animations); ReleaseISpinner(spin); spin = GetISpinner(GetDlgItem(hWnd, IDC_ANIM_END_SPIN)); //spin->LinkToEdit(GetDlgItem(hWnd,IDC_ANIM_END), EDITTYPE_INT); spin->Enable(sampleAnim && animations); EnableWindow(GetDlgItem(hWnd, IDC_END_LABEL), sampleAnim && animations); ReleaseISpinner(spin); break; */ case IDC_ANIM_SAMPLE: mSampleAnimation = IsDlgButtonChecked(hWnd, IDC_ANIM_SAMPLE) == BST_CHECKED; spin = GetISpinner(GetDlgItem(hWnd, IDC_ANIM_START_SPIN)); spin->Enable(mSampleAnimation && mAnimations); EnableWindow(GetDlgItem(hWnd, IDC_START_LABEL), mSampleAnimation && mAnimations); ReleaseISpinner(spin); spin = GetISpinner(GetDlgItem(hWnd, IDC_ANIM_END_SPIN)); spin->Enable(mSampleAnimation && mAnimations); EnableWindow(GetDlgItem(hWnd, IDC_END_LABEL), mSampleAnimation && mAnimations); ReleaseISpinner(spin); break; case IDOK: // hit OK, pick up control values & end dialog mBakeMatrices = IsDlgButtonChecked(hWnd, IDC_BAKE_MATRICES) == BST_CHECKED; mRelativePaths = IsDlgButtonChecked(hWnd, IDC_RELATIVE_PATHS) == BST_CHECKED; mAnimations = IsDlgButtonChecked(hWnd, IDC_ANIM_ENABLE) == BST_CHECKED; mSampleAnimation = IsDlgButtonChecked(hWnd, IDC_ANIM_SAMPLE) == BST_CHECKED; mCreateClip = IsDlgButtonChecked(hWnd, IDC_ANIM_CLIP) == BST_CHECKED; mLayersAsClips = IsDlgButtonChecked(hWnd, IDC_LAYERS_TO_CLIPS) == BST_CHECKED; mNormals = IsDlgButtonChecked(hWnd, IDC_GEOM_NORMALS) == BST_CHECKED; mTriangulate = IsDlgButtonChecked(hWnd, IDC_GEOM_TRIANGLES) == BST_CHECKED; mIncludeXrefs = IsDlgButtonChecked(hWnd, IDC_GEOM_XREFS) == BST_CHECKED; mTangents = IsDlgButtonChecked(hWnd, IDC_GEOM_TANGENTS) == BST_CHECKED; mCopyImages = IsDlgButtonChecked(hWnd, IDC_COPY_IMAGES) == BST_CHECKED; mExportUserDefinedProperties = IsDlgButtonChecked(hWnd, IDC_EXPORT_USER_PROPERTIES) == BST_CHECKED; spin = GetISpinner(GetDlgItem(hWnd, IDC_ANIM_START_SPIN)); mAnimationStart = mSampleAnimation ? spin->GetIVal() : sceneStart; ReleaseISpinner(spin); spin = GetISpinner(GetDlgItem(hWnd, IDC_ANIM_END_SPIN)); mAnimationEnd = mSampleAnimation ? spin->GetIVal() : sceneEnd; ReleaseISpinner(spin); EndDialog(hWnd, 1); break; case IDCANCEL: EndDialog(hWnd, 0); break; } default: return false; } return true; }
void RendSplineParamsMapDlgProc::Update(HWND hWnd, TimeValue t, ParamID id) { if (hWnd != NULL && mod != NULL) { Interval valid; switch (id) { case rnd_ViewportOrRender: { if(mod->UseViewOrRenderParams(t)== rbViewport) { mod->pblock->GetMap()->ReplaceParam(rnd_thickness,rnd_viewThickness); mod->pblock->GetMap()->ReplaceParam(rnd_sides,rnd_viewSides); mod->pblock->GetMap()->ReplaceParam(rnd_angle,rnd_viewAngle); mod->pblock->GetMap()->ReplaceParam(rnd_v2_width,rnd_v2_vpt_width); mod->pblock->GetMap()->ReplaceParam(rnd_v2_length,rnd_v2_vpt_length); mod->pblock->GetMap()->ReplaceParam(rnd_v2_angle2,rnd_v2_vpt_angle2); mod->pblock->GetMap()->ReplaceParam(rnd_v2_aspect_lock,rnd_v2_vpt_aspect_lock); // NS: 10/21/04 This is kind of a hack. We need to have 2 Radio Button Sets in the dialog. // One for Renderer and one for Viewport settings. Depening on which set we're editing // We need to hide the other set. Unfortunately ReplaceParam doesn't work with Radio Buttons //mod->pblock->GetMap()->ReplaceParam(rnd_v2_symm_or_rect,rnd_v2_vpt_symm_or_rect); ShowWindow(GetDlgItem(hWnd,IDC_SYMMETRICAL),SW_HIDE); ShowWindow(GetDlgItem(hWnd,IDC_RECTANGULAR),SW_HIDE); ShowWindow(GetDlgItem(hWnd,IDC_VIEW_SYMMETRICAL),SW_SHOW); ShowWindow(GetDlgItem(hWnd,IDC_VIEW_RECTANGULAR),SW_SHOW); } else { mod->pblock->GetMap()->ReplaceParam(rnd_thickness,rnd_thickness); mod->pblock->GetMap()->ReplaceParam(rnd_sides,rnd_sides); mod->pblock->GetMap()->ReplaceParam(rnd_angle,rnd_angle); mod->pblock->GetMap()->ReplaceParam(rnd_v2_width,rnd_v2_width); mod->pblock->GetMap()->ReplaceParam(rnd_v2_length,rnd_v2_length); mod->pblock->GetMap()->ReplaceParam(rnd_v2_angle2,rnd_v2_angle2); mod->pblock->GetMap()->ReplaceParam(rnd_v2_aspect_lock,rnd_v2_aspect_lock); // NS: 10/21/04 This is kind of a hack. We need to have 2 Radio Button Sets in the dialog. // One for Renderer and one for Viewport settings. Depening on which set we're editing // We need to hide the other set. Unfortunately ReplaceParam doesn't work with Radio Buttons //mod->pblock->GetMap()->ReplaceParam(rnd_v2_vpt_symm_or_rect,rnd_v2_symm_or_rect); ShowWindow(GetDlgItem(hWnd,IDC_VIEW_SYMMETRICAL),SW_HIDE); ShowWindow(GetDlgItem(hWnd,IDC_VIEW_RECTANGULAR),SW_HIDE); ShowWindow(GetDlgItem(hWnd,IDC_SYMMETRICAL),SW_SHOW); ShowWindow(GetDlgItem(hWnd,IDC_RECTANGULAR),SW_SHOW); } break; } case rnd_display: case rnd_useView: { BOOL display, useView; mod->pblock->GetValue(rnd_display,t,display, valid); // sets value mod->pblock->GetValue(rnd_useView,t,useView, valid); // sets value EnableButtons(hWnd, t, display, useView); } break; case rnd_v2_symm_or_rect: case rnd_v2_vpt_symm_or_rect: { int rectangular; BOOL aspectLock; BOOL viewport = (mod->UseViewOrRenderParams(t) == rbViewport); if(viewport) { mod->pblock->GetValue(rnd_v2_vpt_symm_or_rect,t,rectangular,valid); mod->pblock->GetValue(rnd_v2_vpt_aspect_lock,t,aspectLock,valid); } else { mod->pblock->GetValue(rnd_v2_symm_or_rect,t,rectangular,valid); mod->pblock->GetValue(rnd_v2_aspect_lock,t,aspectLock,valid); } BOOL sym = (rectangular == rbSymmetrical); mod->pblock->GetMap()->Enable(rnd_thickness,sym); mod->pblock->GetMap()->Enable(rnd_sides,sym); mod->pblock->GetMap()->Enable(rnd_angle,sym); mod->pblock->GetMap()->Enable(rnd_v2_width,!sym); mod->pblock->GetMap()->Enable(rnd_v2_length,!sym); mod->pblock->GetMap()->Enable(rnd_v2_angle2,!sym); if(!sym) mod->CheckAspectLock(t); else mod->pblock->GetMap()->Enable(rnd_v2_aspect_lock,FALSE); EnableWindow(GetDlgItem(hWnd,IDC_THICKTEXT), sym); EnableWindow(GetDlgItem(hWnd,IDC_SIDESTEXT), sym); EnableWindow(GetDlgItem(hWnd,IDC_ANGLETEXT), sym); EnableWindow(GetDlgItem(hWnd,IDC_WIDTHTEXT), !sym); EnableWindow(GetDlgItem(hWnd,IDC_LENGTHTEXT), !sym); EnableWindow(GetDlgItem(hWnd,IDC_ANGLE2TEXT), !sym); EnableWindow(GetDlgItem(hWnd,IDC_ASPECTTEXT), !sym); ISpinnerControl *iSpin = GetISpinner(GetDlgItem(hWnd, IDC_ASPECTSPIN)); iSpin->Enable(!sym); if(!aspectLock) { mod->mAspect = mod->GetAspect(t,viewport); iSpin->SetValue(mod->mAspect,FALSE); } else { if(!mod->mAspectValidity.InInterval(t)) { mod->mAspect = mod->GetAspect(t,viewport); iSpin->SetValue(mod->mAspect,FALSE); } } ReleaseISpinner(iSpin); } break; //case rnd_v2_width: // mod->OnSetWidthLength(hWnd, rnd_v2_length, rnd_v2_width, t, TRUE); // break; //case rnd_v2_vpt_width: // mod->OnSetWidthLength(hWnd, rnd_v2_vpt_length, rnd_v2_vpt_width, t, TRUE); // break; //case rnd_v2_length: // mod->OnSetWidthLength(hWnd, rnd_v2_length, rnd_v2_width, t, FALSE); // break; //case rnd_v2_vpt_length: // mod->OnSetWidthLength(hWnd, rnd_v2_vpt_length, rnd_v2_vpt_width, t, FALSE); // break; case rnd_v2_aspect_lock: case rnd_v2_vpt_aspect_lock: mod->OnAspectLock(hWnd,t); break; } } }