Ejemplo n.º 1
0
void ObjNameList::MakeUnique(TSTR &n)
{
    // First make it less than 10 chars.
    if( n.Length() > 10 )
        n.Resize(10);

    if( Contains(n) < 0 )
    {
        Append(n);
        return;
    }
    // Make it unique and keep it 10 chars or less
    for(int i = 0; i < 100000; ++i)
    {
        char buf[12];
        sprintf(buf,"%d",i);
        TSTR num(buf);
        TSTR work = n;
        int totlen = num.Length() + work.Length();
        if(totlen > 10)
            work.Resize(10 - (totlen - 10));
        work = work + num;
        if(Contains(work) < 0)
        {
            Append(work);
            n = work;
            return;
        }
    }
    // Forget it!
}
Ejemplo n.º 2
0
void AppDataTest::PutAppData()
	{
	Animatable *anim = PickAnim();
	if (!anim) return;

	// XRef stuff 020416  --prs.
	if (s_through_xref) {
		RefTargetHandle rth = (RefTargetHandle)anim;
		IXRefItem* xi = NULL;
		while (rth != NULL && (xi = IXRefItem::GetInterface(*rth)) != NULL)
			rth = xi->GetSrcItem();
		if (rth != NULL)
			anim = rth;
	}

	// Load the text out of the edit field into a buffer
	int text_len = GetWindowTextLength(GetDlgItem(hPanel,IDC_APPDATA_EDIT))+1;
	TSTR theText;
	theText.Resize(text_len);
	GetWindowText(
		GetDlgItem(hPanel,IDC_APPDATA_EDIT),
		theText.dataForWrite(), text_len);

	MaxSDK::Util::MaxString m_string;
	theText.ToMaxString(m_string);
	const char* a_string = m_string.ToUTF8();
	size_t len = strlen(a_string)+4; // 3 for UTF8 BOM, one for null
	char* buf = (char*)MAX_malloc(len);
	strcpy(buf, "\xef\xbb\xbf"); // UTF8 BOM
	strcat(buf, a_string);

	// Remove the chunk if it exists
	anim->RemoveAppDataChunk(
		APPDATA_TEST_CLASS_ID, 
		UTILITY_CLASS_ID, 
		spin->GetIVal());

	// Add a chunk
	anim->AddAppDataChunk(
		APPDATA_TEST_CLASS_ID, 
		UTILITY_CLASS_ID, 
		spin->GetIVal(),
		(DWORD)len, buf);
	}
Ejemplo n.º 3
0
	/**
	* 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;
	}
Ejemplo n.º 4
0
BOOL CALLBACK
    RollupDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam,
                     Cal3DObject *th)
{
    if (!th && message != WM_INITDIALOG)
        return FALSE;

    switch (message)
    {
    case WM_INITDIALOG:
    {
        TimeValue t = 0;

        SendMessage(GetDlgItem(hDlg, IDC_CAL_CFG_URL), WM_SETTEXT, 0, (LPARAM)th->cal3d_cfg.data());
        EnableWindow(GetDlgItem(hDlg, IDC_CAL_CFG_URL), TRUE);

        th->hRollup = hDlg;

        if (pickMode)
            SetPickMode(th);

        return TRUE;
    }
    case WM_DESTROY:
        if (pickMode)
            SetPickMode(th);
        // th->iObjParams->ClearPickMode();
        // th->previousMode = NULL;
        RELEASE_SPIN(animationIDSpin);
        RELEASE_SPIN(actionIDSpin);

        RELEASE_BUT(Cal3DPickButton);
        return FALSE;

    case CC_SPINNER_BUTTONDOWN:
    {
        int id = LOWORD(wParam);
        switch (id)
        {
        case IDC_ANIMATION_SPIN:
        case IDC_ACTION_SPIN2:
            theHold.Begin();
            return TRUE;
        default:
            return FALSE;
        }
    }
    break;

    case CC_SPINNER_BUTTONUP:
    {
        if (!HIWORD(wParam))
        {
            theHold.Cancel();
            break;
        }
        int id = LOWORD(wParam);
        switch (id)
        {
        case IDC_ANIMATION_SPIN:
        case IDC_ACTION_SPIN2:

            if (th->getCoreHelper())
                th->getCoreHelper()->setState(th->animationIDSpin->GetIVal(), 0.0);
            theHold.Accept(GetString(IDS_DS_PARAMCHG));
            return TRUE;
        default:
            return FALSE;
        }
    }

    case CC_SPINNER_CHANGE:
    {
        int animID;
        int id = LOWORD(wParam);
        TimeValue t = 0; // not really needed...yet

        switch (id)
        {
        case IDC_ANIMATION_SPIN:
        case IDC_ACTION_SPIN2:
            if (!HIWORD(wParam))
                theHold.Begin();

            //actionID = th->actionIDSpin->GetIVal();

            //th->animationIDSpin->SetValue(animID, FALSE);
            //th->actionIDSpin->SetValue(actionID, FALSE);
            animID = th->animationIDSpin->GetIVal();
            if (th->getCoreHelper())
                th->getCoreHelper()->setState(animID, 0.0);

            if (!HIWORD(wParam))
                theHold.Accept(GetString(IDS_DS_PARAMCHG));
            return TRUE;
        default:
            return FALSE;
        }
    }

    case WM_COMMAND:
        switch (LOWORD(wParam))
        {
        case IDC_CAL_CFG_URL:
            switch (HIWORD(wParam))
            {
            case EN_SETFOCUS:
                DisableAccelerators();
                break;
            case EN_KILLFOCUS:
                EnableAccelerators();
                break;
            case EN_CHANGE:
                int len = (int)SendDlgItemMessage(hDlg, IDC_CAL_CFG_URL, WM_GETTEXTLENGTH, 0, 0);
                TSTR temp;
                temp.Resize(len + 1);
                SendDlgItemMessage(hDlg, IDC_CAL_CFG_URL, WM_GETTEXT, len + 1, (LPARAM)temp.data());

#if MAX_PRODUCT_VERSION_MAJOR > 14
                th->setURL(temp.ToUTF8().data());
#else
                th->setURL((char *)temp);
#endif
                break;
            }
            break;
        }
        return FALSE;
    default:
        return FALSE;
    }

    return FALSE;
}