Ejemplo n.º 1
0
void VertexPaint::PaletteButton(HWND hWnd)
	{
	IColorSwatch* iPal = GetIColorSwatch(hWnd);
	if (iPal && iColor) {
		iColor->SetColor(iPal->GetColor(), TRUE);
		}
	}
Ejemplo n.º 2
0
static void SaveColorFile(HWND hWnd,TSTR &name)
   {
    MaxSDK::Util::TextFile::Writer file;	

   	Interface14 *iface = GetCOREInterface14();
	UINT codepage  = iface-> DefaultTextSaveCodePage(true); //dll\PaintLayerMod\ColorPaletteTool.cpp :: SaveColorFile, UTF8 allowed, keep to same.

   if(!file.Open(fname, false, MaxSDK::Util::TextFile::Writer::WRITE_BOM | codepage )){
      TSTR buf2 = GetString(IDS_RB_COLORCLIPBOARD);
      TSTR buf1;
      buf1.printf(GetString(IDS_RB_CANTOPENFILE),fname);       
      MessageBox(hWnd,buf1,buf2,MB_ICONEXCLAMATION);
      return;
      }

   for (int i=0; i<12; i++) {
      int r, g, b;
      IColorSwatch *cs = GetIColorSwatch(GetDlgItem(hWnd,csIDs[i]));
      COLORREF col = cs->GetColor();
      ReleaseIColorSwatch(cs);
      r = GetRValue(col); g = GetGValue(col); b = GetBValue(col);
      file.Printf(_T("%d %d %d\n"), r, g, b);
      }  

   for (int i=0; i<12; i++) {
      IColorSwatch *cs = GetIColorSwatch(GetDlgItem(hWnd,csIDs[i]));
      AColor col = cs->GetAColor();
      ReleaseIColorSwatch(cs);
      file.Printf(_T("%f %f %f %f\n"), col.r, col.g, col.b, col.a);
   }  

   SetupTitle(hWnd,name);
   file.Close();
   }
Ejemplo n.º 3
0
void VertexPaint::InitPalettes()
	{
	IColorSwatch* c;
	for (int i=0; i<NUMPALETTES; i++) {
		c = GetIColorSwatch(hPaletteWnd[i]);
		c->SetColor(palColors[i]);
		ReleaseIColorSwatch(c);
		}
	}
Ejemplo n.º 4
0
void VertexPaint::SavePalettes()
	{
	IColorSwatch* c;
	for (int i=0; i<NUMPALETTES; i++) {
		c = GetIColorSwatch(hPaletteWnd[i]);
		palColors[i] = c->GetColor();
		ReleaseIColorSwatch(c);
		}
	// Save Gradient Palettes.
	lastGradientColor[0]= iColorGradient[0]->GetColor();
	lastGradientColor[1]= iColorGradient[1]->GetColor();
	}
Ejemplo n.º 5
0
// *****************************************************************
void	VertexPaint::setEditionType(int editMode)
{
	if(editMode<0)	editMode= 0;
	if(editMode>2)	editMode= 2;

	// backup current Color according to editMode
	backupCurrentColor();

	_EditType= editMode;

	NotifyDependents(FOREVER, PART_VERTCOLOR, REFMSG_CHANGE);
	ip->RedrawViews(ip->GetTime());

	// Change Color Swatch according to editMode.
	IColorSwatch* c;
	for (int i=0; i<NUMPALETTES; i++) 
	{
		// Change palColors[i].
		int	val;
		if(editMode==0)
			val= i*255 / (4-1);		// 0, 85, 170, 255
		else
			val= (i*256+128) / 4;		// 32, 96, 160, 224
		// Change Addditional Palette colors.
		if(i>=4)
		{
			if(editMode==0)
				val= 42 + (i-4)*255 / (4-1);	// 42, 127, 212
			else
				val= 0;		// Phase not used
		}
		// Setup Color
		palColors[i]= RGB(val, val, val);


		c = GetIColorSwatch(hPaletteWnd[i]);
		c->SetColor(palColors[i]);
		ReleaseIColorSwatch(c);
	}

	// change current Color according to editMode
	reloadBkupColor();
}
Ejemplo n.º 6
0
static INT_PTR CALLBACK VertexPaintDlgProc(
		HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
	{
	int numPoints;
	VertexPaint *mod = (VertexPaint*)GetWindowLongPtr(hWnd,GWLP_USERDATA);
	if (!mod && msg!=WM_INITDIALOG) return FALSE;
	int		comboResult;

	
	// Manages Spinners.
	if (((msg==CC_SPINNER_BUTTONUP) && HIWORD(wParam)) ||
		((msg==CC_SPINNER_CHANGE) ))
	{
		ISpinnerControl *spin;
		spin = (ISpinnerControl *) lParam;
		
		switch (LOWORD(wParam)) 
		{
		case IDC_TINT_SPIN:
			if ((msg == CC_SPINNER_CHANGE))
			{
				mod->fTint = spin->GetFVal()/100;
			}
			break;
		case IDC_BEND_SPIN:
			if ((msg == CC_SPINNER_CHANGE))
			{
				mod->fGradientBend = spin->GetFVal()/100;
			}
			break;
		}
	}

	switch (msg) {
		case WM_INITDIALOG:
			LoadImages();
			mod = (VertexPaint*)lParam;
			SetWindowLongPtr(hWnd,GWLP_USERDATA,lParam);
			mod->hParams = hWnd;
			mod->iPaintButton = GetICustButton(GetDlgItem(hWnd, IDC_PAINT));
			mod->iPaintButton->SetType(CBT_CHECK);
			mod->iPaintButton->SetHighlightColor(GREEN_WASH);
			mod->iPaintButton->SetCheck(mod->ip->GetCommandMode()->ID() == CID_PAINT && 
				!((PaintMouseProc *)mod->ip->GetCommandMode()->MouseProc(&numPoints))->GetPickMode());
			mod->iPaintButton->SetImage(hButtonImages,0,0,0,0,15,14);
			mod->iPaintButton->SetTooltip (TRUE, GetString (IDS_PAINT));

			mod->iPickButton = GetICustButton(GetDlgItem(hWnd, IDC_PICK));
			mod->iPickButton->SetType(CBT_CHECK);
			mod->iPickButton->SetHighlightColor(GREEN_WASH);
			mod->iPickButton->SetCheck(mod->ip->GetCommandMode()->ID() == CID_PAINT && 
				((PaintMouseProc *)mod->ip->GetCommandMode()->MouseProc(&numPoints))->GetPickMode());
			mod->iPickButton->SetImage(hButtonImages,1,1,1,1,15,14);
			mod->iPickButton->SetTooltip (TRUE, GetString (IDS_PICK));


			mod->iColor = GetIColorSwatch(GetDlgItem(hWnd, IDC_COLOR));
			// change current Color according to editMode
			mod->reloadBkupColor();

			// Get interface For ZGradient, reload bkuped colors
			mod->iColorGradient[0] = GetIColorSwatch(GetDlgItem(hWnd, IDC_PALETTE_GRAD0));
			mod->iColorGradient[1] = GetIColorSwatch(GetDlgItem(hWnd, IDC_PALETTE_GRAD1));
			mod->iColorGradient[0]->SetColor(mod->lastGradientColor[0]);
			mod->iColorGradient[1]->SetColor(mod->lastGradientColor[1]);

			
			// Init comboBox
			SendDlgItemMessage(hWnd, IDC_COMBO_TYPE, CB_ADDSTRING, 0, (LPARAM)"Tree Weight");
			SendDlgItemMessage(hWnd, IDC_COMBO_TYPE, CB_ADDSTRING, 0, (LPARAM)"Phase Level 1");
			SendDlgItemMessage(hWnd, IDC_COMBO_TYPE, CB_ADDSTRING, 0, (LPARAM)"Phase Level 2");
			SendDlgItemMessage(hWnd, IDC_COMBO_TYPE, CB_SETCURSEL, mod->getEditionType(), 0);

			// If paint mode at last edit.
			if(mod->_LastPaintMode)
			{
				// ActivatePaint / check button.
				mod->ActivatePaint(TRUE);
				mod->iPaintButton->SetCheck(TRUE);
			}

			break;

		case WM_POSTINIT:
			mod->InitPalettes();
			break;

		case CC_COLOR_CHANGE:
			if (LOWORD(wParam) == IDC_COLOR) 
			{
				IColorSwatch* iCol = (IColorSwatch*)lParam;
				switch(mod->getEditionType())
				{
				case 0: mod->lastWeightColor = iCol->GetColor(); break;
				case 1:
				case 2: 
					mod->lastPhaseColor = iCol->GetColor(); break;
				}
			}
			break;
		case WM_DESTROY:
			mod->SavePalettes();
			mod->iPaintButton = NULL;
			mod->iPickButton = NULL;
			mod->iColor = NULL;
			mod->iColorGradient[0] = NULL;
			mod->iColorGradient[1] = NULL;
			break;

		case WM_COMMAND:
			switch(LOWORD(wParam)) {
				case IDC_PAINT:
					mod->ActivatePaint(mod->iPaintButton->IsChecked());
					break;
				case IDC_PICK:
					mod->ActivatePaint(mod->iPickButton->IsChecked(),TRUE);
					break;

				case IDC_VC_ON:
					mod->TurnVCOn(FALSE);
					break;
				case IDC_SHADED:
					mod->TurnVCOn(TRUE);
					break;
				case IDC_COMBO_TYPE:
					// Init default type.
					comboResult= SendDlgItemMessage(hWnd, IDC_COMBO_TYPE, CB_GETCURSEL, 0, 0);
					mod->setEditionType(comboResult);
					break;
				case IDC_BUTTON_FILL:
					mod->fillSelectionColor();
					break;
				case IDC_BUTTON_GRADIENT:
					mod->fillSelectionGradientColor();
					break;
				case IDC_BUTTON_GRAD0:
					mod->iColorGradient[0]->SetColor(RGB(0,0,0));
					mod->iColorGradient[1]->SetColor(RGB(85,85,85));
					break;
				case IDC_BUTTON_GRAD1:
					mod->iColorGradient[0]->SetColor(RGB(85,85,85));
					mod->iColorGradient[1]->SetColor(RGB(170,170,170));
					break;
				case IDC_BUTTON_GRAD2:
					mod->iColorGradient[0]->SetColor(RGB(170,170,170));
					mod->iColorGradient[1]->SetColor(RGB(255,255,255));
					break;
				}
			break;

		default:
			return FALSE;
		}
	return TRUE;
	}
Ejemplo n.º 7
0
static INT_PTR CALLBACK ColorClipFloaterDlgProc(
      HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
   {
   switch (msg) {
      case WM_INITDIALOG: {
         SetWindowContextHelpId(hWnd, idh_colorclip_floater);
         CenterWindow(hWnd,GetParent(hWnd));
         Color color(0.5f,0.5f,0.5f);
         for (int i=0; i<NUM_FLOAT_COLORS; i++) {
            TSTR name;
            name.printf(GetString(IDS_RB_COLORNUM),i);
            IColorSwatch *cs = GetIColorSwatch(
               GetDlgItem(hWnd,csIDs[i]),color,name);
            cs->SetUseAlpha(TRUE);
            ReleaseIColorSwatch(cs);
            }
         break;
         }

      case WM_SYSCOMMAND:
         if ((wParam & 0xfff0) == SC_CONTEXTHELP) {
            MaxSDK::IHelpSystem::GetInstance()->ShowProductHelpForTopic(idh_colorclip_floater);          
            }
         return FALSE;
      
      case WM_DESTROY: {
         TSTR *fileName = DLGetWindowLongPtr<TSTR*>(hWnd);
         delete fileName;
         break;
         }

      case WM_COMMAND:
         switch (LOWORD(wParam)) {
            case IDC_COLOR_LOAD:
               LoadColorFile(hWnd);
               break;
            
            case IDC_COLOR_SAVE: {
               TSTR *fileName = DLGetWindowLongPtr<TSTR*>(hWnd);
               if (fileName) SaveColorFile(hWnd,*fileName);
               else SaveAsColorFile(hWnd);                  
               break;
               }

            case IDC_COLOR_SAVEAS:
               SaveAsColorFile(hWnd);
               break;

            case IDOK:
            case IDCANCEL:
               DestroyWindow(hWnd);
               break;
            }
         break;

      default:
         return FALSE;
      }

   return TRUE;
   }
Ejemplo n.º 8
0
static INT_PTR CALLBACK ExportOptionsDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch (msg) {
		case WM_INITDIALOG:
			CenterWindow(hWnd, GetParent(hWnd));
			SetupDialog(hWnd);
			break;

		case CC_COLOR_CHANGE:
			switch (LOWORD(wParam)) {
				case IDC_PICKAMBIENTCOLOR:
				{
					HWND hwnd = GetDlgItem(hWnd, IDC_PICKAMBIENTCOLOR);
					if (hwnd) {
						IColorSwatch *pColorSwatch = GetIColorSwatch(hwnd);
						if (pColorSwatch) {
							AColor cAmbientColor = pColorSwatch->GetAColor();
							g_SEOptions.fOverwrittenAmbientColor[0] = cAmbientColor.r;
							g_SEOptions.fOverwrittenAmbientColor[1] = cAmbientColor.g;
							g_SEOptions.fOverwrittenAmbientColor[2] = cAmbientColor.b;
							ReleaseIColorSwatch(pColorSwatch);
						}
					}
					break;
				}
			}
			break;

		case WM_COMMAND:
			switch (LOWORD(wParam)) {
				case IDC_PLDIRECTORIES:
					g_SEOptions.bPLDirectories = SendDlgItemMessage(hWnd, IDC_PLDIRECTORIES, BM_GETCHECK, 0, 0) != 0;
					UpdateDialog(hWnd);
					break;

				case IDC_OVERWRITEAMBIENTCOLOR:
					g_SEOptions.bOverwriteAmbientColor = SendDlgItemMessage(hWnd, IDC_OVERWRITEAMBIENTCOLOR, BM_GETCHECK, 0, 0) != 0;
					UpdateDialog(hWnd);
					break;

				case IDC_SCENECONTAINER:
				{
					int i = static_cast<int>(SendDlgItemMessage(hWnd, IDC_SCENECONTAINER, CB_GETCURSEL, 0, 0L));
					if (i >= 0 && i < static_cast<int>(g_SEOptions.m_lstSceneContainers.size())) {
						String *psString = g_SEOptions.m_lstSceneContainers[i];
						if (psString)
							g_SEOptions.sSceneContainer = *psString;
					}
					break;
				}

				case IDC_SCENERENDERER:
				{
					int i = static_cast<int>(SendDlgItemMessage(hWnd, IDC_SCENERENDERER, CB_GETCURSEL, 0, 0L));
					if (i >= 0 && i < static_cast<int>(g_SEOptions.m_lstSceneRenderers.size())) {
						String *psString = g_SEOptions.m_lstSceneRenderers[i];
						if (psString)
							g_SEOptions.sSceneRenderer = *psString;
					}
					break;
				}

				case IDC_EXPORTMATERIALS:
					g_SEOptions.bExportMaterials = SendDlgItemMessage(hWnd, IDC_EXPORTMATERIALS, BM_GETCHECK, 0, 0) != 0;
					UpdateDialog(hWnd);
					break;

				case IDC_EXPORTMESHES:
					g_SEOptions.bExportMeshes = SendDlgItemMessage(hWnd, IDC_EXPORTMESHES, BM_GETCHECK, 0, 0) != 0;
					UpdateDialog(hWnd);
					break;

				case IDC_TEXCOORDLAYER:
				{
					int i = static_cast<int>(SendDlgItemMessage(hWnd, IDC_TEXCOORDLAYER, CB_GETCURSEL, 0, 0L));
					if (i >= 0 && i < PLSceneExportOptions::MaxTexCoords)
						SendDlgItemMessage(hWnd, IDC_TEXCOORDCOMPONENTS, CB_SETCURSEL, g_SEOptions.nTexCoordComponents[i], 0L);
					break;
				}

				case IDC_TEXCOORDCOMPONENTS:
				{
					int i = static_cast<int>(SendDlgItemMessage(hWnd, IDC_TEXCOORDLAYER, CB_GETCURSEL, 0, 0L));
					if (i >= 0 && i < PLSceneExportOptions::MaxTexCoords) {
						int j = static_cast<int>(SendDlgItemMessage(hWnd, IDC_TEXCOORDCOMPONENTS, CB_GETCURSEL, 0, 0L));
						if (j >= 0 && j < 4)
							g_SEOptions.nTexCoordComponents[i] = j;
					}
					break;
				}

				case IDC_CHOOSESCENEVIEWER:
				{
					char szFilename[_MAX_PATH] = "";
					char szFilters[] = "Executable (*.exe)" "\0" "*.exe" "\0" "All files (*.*)" "\0" "*.*" "\0" "\0";
					OPENFILENAMEA of;

					memset(&of, 0, sizeof(OPENFILENAME));
					of.lStructSize  = sizeof(OPENFILENAME);
					of.hwndOwner    = hWnd;
					of.lpstrFilter  = szFilters;
					of.nFilterIndex = 1;
					of.lpstrFile    = szFilename;
					of.nMaxFile     = 256;
					of.lpstrTitle   = "Select viewer";
					of.Flags        = OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST;
					of.lpstrDefExt  = "exe";
					if (GetOpenFileNameA(&of)) {
						SetDlgItemTextA(hWnd, IDC_SCENEVIEWER, szFilename);
						g_SEOptions.sViewer = szFilename;
					}
					break;
				}

				case IDC_OK:
					GetSettings(hWnd);
					EndDialog(hWnd, 1);
					break;

				case IDC_CANCEL:
					EndDialog(hWnd, 0);
					break;

				case IDC_DEFAULT:
					g_SEOptions.SetDefaultSettings();
					SetupDialog(hWnd);
					break;

				case IDC_LOAD:
				{
					char szFilename[_MAX_PATH] = "";
					char szFilters[] = "Settings (*.ini)" "\0" "*.ini" "\0" "All files (*.*)" "\0" "*.*" "\0" "\0";
					OPENFILENAMEA of;

					memset(&of, 0, sizeof(OPENFILENAME));
					of.lStructSize  = sizeof(OPENFILENAME);
					of.hwndOwner    = hWnd;
					of.lpstrFilter  = szFilters;
					of.nFilterIndex = 1;
					of.lpstrFile    = szFilename;
					of.nMaxFile     = 256;
					of.lpstrInitialDir = String(IPathConfigMgr::GetPathConfigMgr()->GetDir(APP_PLUGCFG_DIR)).GetASCII();
					of.lpstrTitle   = "Load exporter settings";
					of.Flags        = OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST;
					of.lpstrDefExt  = "ini";
					if (GetOpenFileNameA(&of)) {
						g_SEOptions.Load(szFilename);
						UpdateDialog(hWnd);
					}
					break;
				}

				case IDC_SAVE:
				{
					char szFilename[_MAX_PATH] = "";
					char szFilters[] = "Settings (*.ini)" "\0" "*.ini" "\0" "All files (*.*)" "\0" "*.*" "\0" "\0";
					OPENFILENAMEA of;

					memset(&of, 0, sizeof(OPENFILENAME));
					of.lStructSize  = sizeof(OPENFILENAME);
					of.hwndOwner    = hWnd;
					of.lpstrFilter  = szFilters;
					of.nFilterIndex = 1;
					of.lpstrFile    = szFilename;
					of.nMaxFile     = 256;
					of.lpstrInitialDir = String(IPathConfigMgr::GetPathConfigMgr()->GetDir(APP_PLUGCFG_DIR)).GetASCII();
					of.lpstrTitle   = "Save exporter settings";
					of.Flags        = OFN_HIDEREADONLY | OFN_PATHMUSTEXIST;
					of.lpstrDefExt  = "ini";
					if (GetOpenFileNameA(&of))
						g_SEOptions.Save(szFilename);
					break;
				}

				case IDC_HELPDOCUMENT:
				{
					// Get get runtime directory
					char *pszBuffer = PLTools::GetPixelLightRuntimeDirectory();
					if (pszBuffer) {
						// Is there a '\' or '//' at the end?
						size_t nLength = strlen(pszBuffer);
						if (pszBuffer[nLength-1] == '\\' || pszBuffer[nLength-1] == '/') {
							pszBuffer[nLength-1] = '\0';
							nLength--;
						}

						// Document file
						String sDocumentFile;

						// There MUST be a 'Runtime' at the end (first, we check for the public SDK structure)
						size_t nRuntimeLength = strlen("Runtime");
							if (nLength > nRuntimeLength && !_stricmp(&pszBuffer[nLength-nRuntimeLength], "Runtime")) {
							// Remove the 'Runtime'
							nLength -= nRuntimeLength;
							pszBuffer[nLength] = '\0';

							// Construct the absolute filename
							sDocumentFile = String(pszBuffer) + "Docs\\PixelLight3dsMaxSceneExport.pdf";
						}

						// Cleanup
						delete [] pszBuffer;

						// Open the help document
						if (sDocumentFile.GetLength())
							ShellExecuteW(0, L"open", sDocumentFile.GetUnicode(), 0, 0, SW_SHOW);
					}
					break;
				}

				case IDC_ABOUT:
					DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, AboutBoxDlgProc, 0);
					break;
			}
			break;

		case WM_CLOSE:
			EndDialog(hWnd, 0);
			return true;

		default:
			return false;
	}

	return true;
}
Ejemplo n.º 9
0
void SetupDialog(HWND hWnd)
{
	// General
	SendDlgItemMessage(hWnd, IDC_REMOVESPACES,			BM_SETCHECK, g_SEOptions.bRemoveSpaces,			 0);
	SendDlgItemMessage(hWnd, IDC_CORRECTPORTALS,		BM_SETCHECK, g_SEOptions.bCorrectPortals,		 0);
	SendDlgItemMessage(hWnd, IDC_OVERWRITEAMBIENTCOLOR,	BM_SETCHECK, g_SEOptions.bOverwriteAmbientColor, 0);
	EnableWindow(GetDlgItem(hWnd, IDC_SUBDIRECTORIES),	 g_SEOptions.bPLDirectories);
	EnableWindow(GetDlgItem(hWnd, IDC_PICKAMBIENTCOLOR), g_SEOptions.bOverwriteAmbientColor);
	SendDlgItemMessage(hWnd, IDC_PLDIRECTORIES,		BM_SETCHECK, g_SEOptions.bPLDirectories,	 0);
	SendDlgItemMessage(hWnd, IDC_SUBDIRECTORIES,	BM_SETCHECK, g_SEOptions.bSubdirectories,	 0);
	SendDlgItemMessage(hWnd, IDC_ANIMATIONPLAYBACK,	BM_SETCHECK, g_SEOptions.bAnimationPlayback, 0);
	SendDlgItemMessage(hWnd, IDC_SHOWEXPORTEDSCENE, BM_SETCHECK, g_SEOptions.bShowExportedScene, 0);

	// 'Publishing' possible?
	bool bRuntimeDirectoryFound = false;
	char *pszBuffer = PLTools::GetPixelLightRuntimeDirectory();
	if (pszBuffer && strlen(pszBuffer)) {
		delete [] pszBuffer;
		bRuntimeDirectoryFound = true;
	}
	EnableWindow(GetDlgItem(hWnd, IDC_PUBLISH), bRuntimeDirectoryFound);
	SendDlgItemMessage(hWnd, IDC_PUBLISH, BM_SETCHECK, g_SEOptions.bPublish && bRuntimeDirectoryFound, 0);

	// Scene container
	SendDlgItemMessage(hWnd, IDC_SCENECONTAINER, CB_RESETCONTENT, 0, 0);
	int nSelection = 0;
	for (std::vector<String*>::size_type i=0; i<g_SEOptions.m_lstSceneContainers.size(); i++) {
		String *psString = g_SEOptions.m_lstSceneContainers[i];
		if (psString) {
			SendDlgItemMessageW(hWnd, IDC_SCENECONTAINER, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(psString->GetUnicode()));
			if (psString->CompareNoCase(g_SEOptions.sSceneContainer))
				nSelection = static_cast<int>(i);
		}
	}
	SendDlgItemMessage(hWnd, IDC_SCENECONTAINER, CB_SETCURSEL, nSelection, 0);
	// Scene renderer
	SendDlgItemMessage(hWnd, IDC_SCENERENDERER, CB_RESETCONTENT, 0, 0);
	nSelection = 0;
	for (std::vector<String*>::size_type i=0; i<g_SEOptions.m_lstSceneRenderers.size(); i++) {
		String *psString = g_SEOptions.m_lstSceneRenderers[i];
		if (psString) {
			SendDlgItemMessageW(hWnd, IDC_SCENERENDERER, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(psString->GetUnicode()));
			if (psString->CompareNoCase(g_SEOptions.sSceneRenderer))
				nSelection = static_cast<int>(i);
		}
	}
	SendDlgItemMessage(hWnd, IDC_SCENERENDERER, CB_SETCURSEL, nSelection, 0);
	// Viewer
	SetDlgItemTextA(hWnd, IDC_SCENEVIEWER, g_SEOptions.sViewer.GetASCII());

	// Log
	SendDlgItemMessage(hWnd, IDC_LOG, CB_RESETCONTENT, 0, 0);
	SendDlgItemMessage(hWnd, IDC_LOG, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(_T("1: Inactive")));
	SendDlgItemMessage(hWnd, IDC_LOG, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(_T("2: Errors")));
	SendDlgItemMessage(hWnd, IDC_LOG, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(_T("3: Warnings")));
	SendDlgItemMessage(hWnd, IDC_LOG, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(_T("4: Hits")));
	SendDlgItemMessage(hWnd, IDC_LOG, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(_T("5: Scene data")));
	int nLogSelection = 0;
	if (g_SEOptions.bLog) {
		// Scene data
		if (g_SEOptions.nLogFlags & PLLog::Scene)
			nLogSelection = 4;
		// Hints
		else if (g_SEOptions.nLogFlags & PLLog::Hint)
			nLogSelection = 3;
		// Warnings
		else if (g_SEOptions.nLogFlags & PLLog::Warning)
			nLogSelection = 2;
		// Errors
		else if (g_SEOptions.nLogFlags & PLLog::Error)
			nLogSelection = 1;
	}
	SendDlgItemMessage(hWnd, IDC_LOG, CB_SETCURSEL, nLogSelection, 0);

	// User properties
	SendDlgItemMessage(hWnd, IDC_USERPROP_VARIABLES, BM_SETCHECK,	g_SEOptions.bUserPropVariables,  0);
	SendDlgItemMessage(hWnd, IDC_USERPROP_MODIFIERS, BM_SETCHECK,	g_SEOptions.bUserPropModifiers,  0);

	// Materials
	SendDlgItemMessage(hWnd, IDC_EXPORTMATERIALS,	BM_SETCHECK,	g_SEOptions.bExportMaterials,	 0);
	EnableWindow(GetDlgItem(hWnd, IDC_MATERIALS),				g_SEOptions.bExportMaterials);
	EnableWindow(GetDlgItem(hWnd, IDC_CREATEMATERIALS),			g_SEOptions.bExportMaterials);
	EnableWindow(GetDlgItem(hWnd, IDC_SMARTMATERIALPARAMETERS),	g_SEOptions.bExportMaterials);
	EnableWindow(GetDlgItem(hWnd, IDC_COPYTEXTURES),			g_SEOptions.bExportMaterials);
	SendDlgItemMessage(hWnd, IDC_CREATEMATERIALS,		  BM_SETCHECK, g_SEOptions.bCreateMaterials,		 0);
	SendDlgItemMessage(hWnd, IDC_SMARTMATERIALPARAMETERS, BM_SETCHECK, g_SEOptions.bSmartMaterialParameters, 0);
	SendDlgItemMessage(hWnd, IDC_COPYTEXTURES,			  BM_SETCHECK, g_SEOptions.bCopyTextures,			 0);

	// Meshes
	SendDlgItemMessage(hWnd, IDC_EXPORTMESHES,     BM_SETCHECK,		g_SEOptions.bExportMeshes,	   0);
	EnableWindow(GetDlgItem(hWnd, IDC_MESH),			   g_SEOptions.bExportMeshes);
	EnableWindow(GetDlgItem(hWnd, IDC_NORMALS),			   g_SEOptions.bExportMeshes);
	EnableWindow(GetDlgItem(hWnd, IDC_TANGENTS),		   g_SEOptions.bExportMeshes);
	EnableWindow(GetDlgItem(hWnd, IDC_BINORMALS),		   g_SEOptions.bExportMeshes);
	EnableWindow(GetDlgItem(hWnd, IDC_TEXCOORDLAYERS),	   g_SEOptions.bExportMeshes);
	EnableWindow(GetDlgItem(hWnd, IDC_TEXCOORDLAYER),	   g_SEOptions.bExportMeshes);
	EnableWindow(GetDlgItem(hWnd, IDC_COMPONENTS),		   g_SEOptions.bExportMeshes);
	EnableWindow(GetDlgItem(hWnd, IDC_TEXCOORDCOMPONENTS), g_SEOptions.bExportMeshes);
	SendDlgItemMessage(hWnd, IDC_TEXCOORDLAYER, CB_RESETCONTENT, 0, 0);
	wchar_t szTemp[256];
	for (int i=0; i<PLSceneExportOptions::MaxTexCoords; i++) {
		swprintf(szTemp, L"%d", i + 1); // The artists want to see 1 instead 0 for the first texture layer :)
		SendDlgItemMessageW(hWnd, IDC_TEXCOORDLAYER, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(szTemp));
	}
	SendDlgItemMessage(hWnd, IDC_TEXCOORDLAYER, CB_SETCURSEL, 0, 0L);
	SendDlgItemMessage(hWnd, IDC_TEXCOORDCOMPONENTS, CB_RESETCONTENT, 0, 0);
	SendDlgItemMessage(hWnd, IDC_TEXCOORDCOMPONENTS, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(_T("-")));
	SendDlgItemMessage(hWnd, IDC_TEXCOORDCOMPONENTS, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(_T("u")));
	SendDlgItemMessage(hWnd, IDC_TEXCOORDCOMPONENTS, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(_T("uv")));
	SendDlgItemMessage(hWnd, IDC_TEXCOORDCOMPONENTS, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(_T("uvw")));
	SendDlgItemMessage(hWnd, IDC_TEXCOORDCOMPONENTS, CB_SETCURSEL, g_SEOptions.nTexCoordComponents[0], 0L);
	// Normals
	SendDlgItemMessage(hWnd, IDC_NORMALS,   BM_SETCHECK, g_SEOptions.bNormals,   0);
	// Tangents
	SendDlgItemMessage(hWnd, IDC_TANGENTS,  BM_SETCHECK, g_SEOptions.bTangents,  0);
	// Binormals
	SendDlgItemMessage(hWnd, IDC_BINORMALS, BM_SETCHECK, g_SEOptions.bBinormals, 0);

	{ // Setup the ambient color control
		HWND hwnd = GetDlgItem(hWnd, IDC_PICKAMBIENTCOLOR);
		if (hwnd) {
			IColorSwatch *pColorSwatch = GetIColorSwatch(hwnd,
														 RGB(g_SEOptions.fOverwrittenAmbientColor[0]*255,
															 g_SEOptions.fOverwrittenAmbientColor[1]*255,
															 g_SEOptions.fOverwrittenAmbientColor[2]*255),
														 _T("Overwrite ambient color"));
			if (pColorSwatch) {
				pColorSwatch->SetModal();
				ReleaseIColorSwatch(pColorSwatch);
			}
		}
	}
}