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; }
void RendSplineParamsMapDlgProc::Initialize(HWND hWnd, TimeValue t) { if (hWnd == NULL) return; else { ISpinnerControl *iSpin = GetISpinner(GetDlgItem(hWnd, IDC_ASPECTSPIN)); iSpin->LinkToEdit(GetDlgItem(hWnd, IDC_ASPECT), EDITTYPE_FLOAT); iSpin->SetLimits(0.0f,99999999.0f); iSpin->SetAutoScale(TRUE); ReleaseISpinner(iSpin); if (RendSpline::hLockButton == NULL) { HBITMAP hBitmap, hMask; RendSpline::hLockButton = ImageList_Create(16, 15, TRUE, 2, 0); hBitmap = LoadBitmap(RendSplineDesc.HInstance(), MAKEINTRESOURCE(IDB_LOCK)); hMask = LoadBitmap(RendSplineDesc.HInstance(), MAKEINTRESOURCE(IDB_LOCKMASK)); ImageList_Add(RendSpline::hLockButton,hBitmap,hMask); DeleteObject(hBitmap); DeleteObject(hMask); } ICustButton *lockAspect = GetICustButton(GetDlgItem(hWnd,IDC_ASPECTLOCK)); lockAspect->SetImage(RendSpline::hLockButton,0,0,1,1,16,15); lockAspect->SetType(CBT_CHECK); ReleaseICustButton(lockAspect); CheckRadioButton(hWnd, IDC_VIEWPORT, IDC_RENDERER, IDC_RENDERER); BOOL usePhysUVs = mod->GetUsePhysicalScaleUVs(); CheckDlgButton(hWnd, IDC_REAL_WORLD_MAP_SIZE, usePhysUVs); } }
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 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 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); }
//---------------------------------------------------------------------------- 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; }
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; }
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; }
// 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; }
// --[ 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); }