Exemplo n.º 1
0
// Fill in all the data in the polygon counter dialog.
void
PolygonCounter::DrawBars()
{
    TSTR buf;
    int val;

    GetAppData(thePolyCounter.ip, MAX_POLYS_ID, _T("10000"), buf);
	if (atoi(buf, val))
		thePolyCounter.maxPolys->SetValue(val, FALSE);
    GetAppData(thePolyCounter.ip, MAX_SELECTED_ID, _T("1000"), buf);
	if (atoi(buf, val))
		thePolyCounter.maxSelected->SetValue(val, FALSE);

    HWND hName = GetDlgItem(thePolyCounter.hDlg, IDC_POLY_COUNT);
    TCHAR str[256];
    _stprintf(str, _T("%d"), faceCount);
    Static_SetText(hName, str);
    
    hName = GetDlgItem(thePolyCounter.hDlg, IDC_SEL_COUNT);
    _stprintf(str, _T("%d"), selFaceCount);
    Static_SetText(hName, str);

    HWND hPolyBar = GetDlgItem(hDlg, IDC_POLY_BAR);
    int maxFaces = maxPolys->GetIVal();
    DrawBar(hPolyBar, faceCount, maxFaces);
    HWND hSelBar = GetDlgItem(hDlg, IDC_SELECTED_BAR);
    int maxSel = maxSelected->GetIVal();
    DrawBar(hSelBar,  selFaceCount, maxSel);
}
Exemplo n.º 2
0
// 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;
}       
Exemplo n.º 3
0
void RandKeysUtil::SpinnerChange(int id) 
	{
	switch (id) {
		case IDC_RANDKEYS_POSTIMESPIN:
			posTime = iPosTime->GetIVal(); break;
		case IDC_RANDKEYS_NEGTIMESPIN:
			negTime = iNegTime->GetIVal(); break;
		case IDC_RANDKEYS_POSVALSPIN:
			posVal = iPosVal->GetFVal(); break;
		case IDC_RANDKEYS_NEGVALSPIN:
			negVal = iNegVal->GetFVal(); break;
		}
	}
Exemplo n.º 4
0
static INT_PTR CALLBACK NumMapsDlgProc(
		HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
	{
	switch (msg) {
		case WM_INITDIALOG: {
			ISpinnerControl *spin = 
				SetupIntSpinner(
					hWnd,IDC_COMP_NUMMAPSSPIN,IDC_COMP_NUMMAPS,
					2,1000,(int)lParam);
			ReleaseISpinner(spin);
			CenterWindow(hWnd,GetParent(hWnd));
			break;
			}

		case WM_COMMAND:
			switch (LOWORD(wParam)) {
				case IDOK: {
					ISpinnerControl *spin = 
						GetISpinner(GetDlgItem(hWnd,IDC_COMP_NUMMAPSSPIN));
					EndDialog(hWnd,spin->GetIVal());
					ReleaseISpinner(spin);
					break;
					}

				case IDCANCEL:
					EndDialog(hWnd,-1);
					break;
				}
			break;

		default:
			return FALSE;
		}
	return TRUE;
	}
Exemplo n.º 5
0
//----------------------------------------------------------------------------
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;
}
Exemplo n.º 6
0
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;
}
Exemplo n.º 7
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);
	}
Exemplo n.º 8
0
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);
}
Exemplo n.º 9
0
void AppDataTest::GetAppData()
	{
	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;
	}

	// Grab the app data chunk from the anim
	AppDataChunk *ad = 
		anim->GetAppDataChunk(
			APPDATA_TEST_CLASS_ID, 
			UTILITY_CLASS_ID, 
			spin->GetIVal());
	if (ad && ad->data) {
		// Fill the edit field with the text.
		TSTR data;
		const char* raw_string = (const char*)ad->data;
		if (strncmp(raw_string, "\xef\xbb\xbf", 3) == 0)
			data = TSTR::FromUTF8(raw_string+3);
		else
		{
			DbgAssert(!_T("Should always convert appdata in UpdateAppDataLoadProc"));
			Interface14 *iface = GetCOREInterface14();
			LANGID langID = iface->LanguageToUseForFileIO();
			UINT codePage = iface->CodePageForLanguage(langID);
			data = TSTR::FromCP(codePage, raw_string);
		}
		SetDlgItemText(hPanel,IDC_APPDATA_EDIT,data.data());
	} else {
		// Not found!
		MessageBox(hPanel,_T("No app data found"),_T("App Data Tester"),MB_OK);
		}
	}
Exemplo n.º 10
0
	// 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;
	}
Exemplo n.º 11
0
//----------------------------------------------------------------------------
void PX2SceneExport::OnOK (HWND hWnd)
{
	// 当用户按下对话框的OK键。获得导出插件的导出选项。

	mSettings.IncludeObjects =
		IsDlgButtonChecked(hWnd, IDC_CHECK_OBJECTS) == 1;
	mSettings.IncludeLights =
		IsDlgButtonChecked(hWnd, IDC_CHECK_LIGHTS) == 1;
	mSettings.IncludeMeshes =
		IsDlgButtonChecked(hWnd, IDC_CHECK_MESHES) == 1;
	mSettings.IncludeVertexColors =
		IsDlgButtonChecked(hWnd, IDC_CHECK_VERTEXCOLORS) == 1;
	mSettings.IncludeNormals =
		IsDlgButtonChecked(hWnd, IDC_CHECK_NORMALS) == 1;
	mSettings.IncludeTargentBiNormal =
		IsDlgButtonChecked(hWnd, IDC_CHECK_TANGENTBINORMAL) == 1;
	mSettings.IncludeTexCoords =
		IsDlgButtonChecked(hWnd, IDC_CHECK_TEXTURECOORDS) == 1;
	mSettings.NumTexCoords = 
		1+(int)SendMessage(GetDlgItem(hWnd, IDC_COMMBO_NUMTCS), CB_GETCURSEL, 0, 0);

	mSettings.IncludeModifiers =
		IsDlgButtonChecked(hWnd, IDC_CHECK_MODIFIERS) == 1;
	mSettings.IncludeSkins =
		IsDlgButtonChecked(hWnd, IDC_CHECK_SKINS) == 1;
	mSettings.IncludeAllFrames =
		IsDlgButtonChecked(hWnd, IDC_RADIO_ALLFRAMES) == 1;
	mSettings.IncludeKeyFrames =
		IsDlgButtonChecked(hWnd, IDC_RADIO_KEYFRAMES) == 1;
	mSettings.IncludeCurrentFrame =
		IsDlgButtonChecked(hWnd, IDC_RADIO_CURRENTFRAME) == 1;
	mSettings.UseLocalTime =
		IsDlgButtonChecked(hWnd, IDC_CHECK_USELOCALTIME) == 1;

	// Start and End frames
	if ( mSettings.IncludeAllFrames || mSettings.IncludeKeyFrames )
	{
		ISpinnerControl* spinner = GetISpinner(GetDlgItem(hWnd,
			IDC_SPINNER_STARTFRAME)); 
		mSettings.StartFrame = spinner->GetIVal();
		ReleaseISpinner(spinner);

		spinner = GetISpinner(GetDlgItem(hWnd,IDC_SPINNER_ENDFRAME)); 
		mSettings.EndFrame = spinner->GetIVal();
		ReleaseISpinner(spinner);
	}

	mEffectiveSettings = mSettings;
	if (!mSettings.IncludeObjects)
	{
		mEffectiveSettings.IncludeLights = false;
		mEffectiveSettings.IncludeMeshes = false;
	}
	if (!mEffectiveSettings.IncludeMeshes)
	{
		mEffectiveSettings.IncludeVertexColors = false;
		mEffectiveSettings.IncludeNormals = false;
		mEffectiveSettings.IncludeTargentBiNormal = false;
		mEffectiveSettings.IncludeTexCoords = false;
	}

	if (!mSettings.IncludeModifiers)
	{
		mSettings.IncludeSkins = false;
	}

	GetDlgItemText(hWnd, IDC_EDIT_SRCROOTDIR, mSettings.SrcRootDir, 256);
	GetDlgItemText(hWnd, IDC_EDIT_DSTROOTDIR, mSettings.DstRootDir, 256);
}
Exemplo n.º 12
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;
	}
Exemplo n.º 13
0
INT_PTR SurfaceDlgProc::DlgProc (TimeValue t, IParamMap2 *map, HWND hWnd,
							  UINT msg, WPARAM wParam, LPARAM lParam) {
	ISpinnerControl* spin = NULL;
	int buttonID(0);

	switch (msg) {
	case WM_INITDIALOG:
		{
			ISpinnerControl* temp = SetupIntSpinner (hWnd, IDC_MAT_IDSPIN, IDC_MAT_ID, 1, MAX_MATID, 0);
			ReleaseISpinner(temp);
			temp = SetupIntSpinner (hWnd, IDC_MAT_IDSPIN_SEL, IDC_MAT_ID_SEL, 1, MAX_MATID, 0);
			ReleaseISpinner(temp);
			CheckDlgButton(hWnd, IDC_CLEARSELECTION, 1);
			mMaterialUIHandler.SetupMtlSubNameCombo (hWnd, mpMod);
			// Cue an update based on the current face selection.
			uiValid.SetEmpty();
			klugeToFixWM_CUSTEDIT_ENTEROnEnterFaceLevel = true;
			mSpinningMaterial = false;
			mTimeChangeHandle = NULL;
			break;
		}

	case WM_PAINT:

		
		uiValid = FOREVER;
		// Display the correct material index:
		mMaterialUIHandler.UpdateCurrentMaterial (hWnd, mpMod, t, uiValid);

		if (!(uiValid == FOREVER) && !(uiValid == NEVER)) AddTimeChangeInvalidate (hWnd);
		else RemoveTimeChangeInvalidate ();

		klugeToFixWM_CUSTEDIT_ENTEROnEnterFaceLevel = false;
		return FALSE;

	case CC_SPINNER_BUTTONDOWN:
		switch (LOWORD(wParam)) {
		case IDC_MAT_IDSPIN:
			if (!mSpinningMaterial) {
				theHold.Begin ();
				mpMod->EpModSetOperation (ep_op_set_material);
				mSpinningMaterial = true;
			}
			break;
		}
		break;

	case WM_CUSTEDIT_ENTER:
	case CC_SPINNER_BUTTONUP:
		switch (LOWORD(wParam)) {
		case IDC_MAT_ID:
		case IDC_MAT_IDSPIN:
			if (!mSpinningMaterial) break;

			// For some reason, there's a WM_CUSTEDIT_ENTER sent on IDC_MAT_ID
			// when we start this dialog up.  Use this variable to suppress its activity.
			if (klugeToFixWM_CUSTEDIT_ENTEROnEnterFaceLevel) break;
			if (HIWORD(wParam) || msg==WM_CUSTEDIT_ENTER)
			{
				mpMod->EpModCommitUnlessAnimating (t);
				theHold.Accept(GetString(IDS_ASSIGN_MATID));
			}
			else theHold.Cancel();
			mpMod->EpModRefreshScreen ();
			mSpinningMaterial = false;
			break;
		}
		break;

	case CC_SPINNER_CHANGE:
		spin = (ISpinnerControl*)lParam;
		switch (LOWORD(wParam)) {
		case IDC_MAT_IDSPIN:
			if (!mSpinningMaterial)
			{
				theHold.Begin();
				mpMod->EpModSetOperation (ep_op_set_material);
				mSpinningMaterial = true;
			}
			mpMod->getParamBlock()->SetValue (epm_material, t, spin->GetIVal()-1);
			break;
		}
		break;

	case WM_COMMAND:
		if (HIWORD(wParam) == 1) return FALSE;	// not handling keyboard shortcuts here.
		buttonID = LOWORD(wParam);

		switch (buttonID) {
		case IDC_SELECT_BYID:
			int selBy;
			spin = GetISpinner (GetDlgItem (hWnd, IDC_MAT_IDSPIN_SEL));
			if (!spin) break;
			selBy = spin->GetIVal()-1;
			ReleaseISpinner (spin);
			mpMod->getParamBlock()->SetValue (epm_material_selby, t, selBy);
			mpMod->EpModButtonOp (ep_op_select_by_material);
			break;

		case IDC_MTLID_NAMES_COMBO:
			switch(HIWORD(wParam)){
			case CBN_SELENDOK:
				mMaterialUIHandler.SelectByName (hWnd, mpMod);
				break;                                                    
			}
			break;

		}
		break;
	case WM_CLOSE:
		{
			if (hWnd == mpMod->MatIDFloaterHWND())
			{
				EndDialog(hWnd,1);
				mpMod->CloseMatIDFloater();
				return TRUE;
			}
			return FALSE;
			break;
		}
	case WM_DESTROY:
		RemoveTimeChangeInvalidate();
		return FALSE;

	default:
		return FALSE;
	}

	return TRUE;
}
Exemplo n.º 14
0
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;
}
Exemplo n.º 15
0
BOOL OrenNayarShaderDlg::PanelProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam ) 
{
	int id = LOWORD(wParam);
	int code = HIWORD(wParam);
    switch (msg) {
		case WM_INITDIALOG:
			{
			int i;
			
			HDC theHDC = GetDC(hwndDlg);
			hOldPal = GetGPort()->PlugPalette(theHDC);
			ReleaseDC(hwndDlg,theHDC);

			for (i=0; i<NCOLBOX; i++) {
   				cs[i] = GetIColorSwatch(GetDlgItem(hwndDlg, colID[i]),
   					GetMtlColor(i, pShader), GetColorName(i));
			}

			hwHilite = GetDlgItem(hwndDlg, IDC_HIGHLIGHT);
			SetWindowLongPtr( hwHilite, GWLP_WNDPROC, (LONG_PTR)HiliteWndProc);

			shSpin = SetupIntSpinner(hwndDlg, IDC_SH_SPIN, IDC_SH_EDIT, 0,100, 0);
			ssSpin = SetupIntSpinner(hwndDlg, IDC_SS_SPIN, IDC_SS_EDIT, 0,999, 0);
			softSpin = SetupFloatSpinner(hwndDlg, IDC_SOFT_SPIN, IDC_SOFT_EDIT, 0.0f,1.0f,0.0f,.01f);
			trSpin = SetupIntSpinner(hwndDlg, IDC_TR_SPIN, IDC_TR_EDIT, 0,100, 0);
			dlevSpin = SetupIntSpinner(hwndDlg, IDC_DIFFLEV_SPIN, IDC_DIFFLEV_EDIT, 0, 400, 0);
			roughSpin = SetupIntSpinner(hwndDlg, IDC_DIFFROUGH_SPIN, IDC_DIFFROUGH_EDIT, 0, 100, 0);

			for (int j=0; j<NMBUTS; j++) {
				texMBut[j] = GetICustButton(GetDlgItem(hwndDlg,texMButtonsIDC[j]));
				assert( texMBut[j] );
				texMBut[j]->SetRightClickNotify(TRUE);
				texMBut[j]->SetDADMgr(&dadMgr);
			}

			SetupLockButton(hwndDlg,IDC_LOCK_AD,FALSE);
			SetupLockButton(hwndDlg,IDC_LOCK_DS,FALSE);
			SetupPadLockButton(hwndDlg,IDC_LOCK_ADTEX, TRUE);

/* // mjm - 5.10.99 - isn't this already created above when i == N_SI_CLR?
			// create both a self-illum color as well as a spinner
			cs[N_SI_CLR] = GetIColorSwatch(GetDlgItem(hwndDlg, colID[N_SI_CLR] ),
   											GetMtlColor(N_SI_CLR, pShader), GetColorName(N_SI_CLR));
*/
			siSpin = SetupIntSpinner(hwndDlg, IDC_SI_SPIN, IDC_SI_EDIT, 0,100, 0);
			
			if( pShader->IsSelfIllumClrOn() ) {
				// enable the color swatch, disable the spinner
				ShowWindow( GetDlgItem(hwndDlg, IDC_SI_EDIT), SW_HIDE );
				ShowWindow( GetDlgItem(hwndDlg, IDC_SI_SPIN), SW_HIDE );
			} else {
				// disable the color swatch
				ShowWindow( cs[N_SI_CLR]->GetHwnd(), SW_HIDE );
			}
			LoadDialog(TRUE);
		}
		break;

		case WM_COMMAND: 
			{
			for ( int i=0; i<NMBUTS; i++) {
				if (id == texMButtonsIDC[i]) {
					PostMessage(hwmEdit,WM_TEXMAP_BUTTON, texmapFromMBut[i],(LPARAM)pMtl );
					UpdateMapButtons();
					goto exit;
					}
				}
			}
		    switch (id) {

				case IDC_LOCK_AD:
					SetLockAD(IsButtonChecked(hwndDlg, IDC_LOCK_AD));
					UpdateMtlDisplay();
					break;
				
				case IDC_LOCK_DS:
					SetLockDS(IsButtonChecked(hwndDlg, IDC_LOCK_DS));
					UpdateMtlDisplay();
					break;
				
				case IDC_LOCK_ADTEX:{
					BOOL on = IsButtonChecked(hwndDlg, IDC_LOCK_ADTEX);
					SetLockADTex(on);
					UpdateMtlDisplay();
				} break;

				case IDC_SI_COLORON:{
					int isOn = GetCheckBox(hwndDlg, IDC_SI_COLORON );
					pShader->SetSelfIllumClrOn( isOn );			
					if ( isOn ) {
						// enable the color swatch, disable the spinner
						ShowWindow( GetDlgItem(hwndDlg, IDC_SI_EDIT), SW_HIDE );
						ShowWindow( GetDlgItem(hwndDlg, 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 );
						ShowWindow( GetDlgItem(hwndDlg, IDC_SI_EDIT), SW_SHOW );
						ShowWindow( GetDlgItem(hwndDlg, IDC_SI_SPIN), SW_SHOW );
					}
				    NotifyChanged();
//					UpdateMtlDisplay();
				}
				break;
			}
			break;
		case CC_COLOR_SEL: {
			int id = LOWORD(wParam);
			SelectEditColor(ColorIDCToIndex(id));
		}			
		break;
		case CC_COLOR_DROP:	{
			int id = LOWORD(wParam);
			SelectEditColor(ColorIDCToIndex(id));
			UpdateMtlDisplay();				
		}
		break;
		case CC_COLOR_BUTTONDOWN:
			theHold.Begin();
		 break;
		case CC_COLOR_BUTTONUP:
			if (HIWORD(wParam)) theHold.Accept(GetString(IDS_DS_PARAMCHG));
			else theHold.Cancel();
			UpdateMtlDisplay();				
			break;
		case CC_COLOR_CHANGE: {			
			int id = LOWORD(wParam);
			int buttonUp = HIWORD(wParam); 
			int n = ColorIDCToIndex(id);
			if (buttonUp) theHold.Begin();
			Color curColor(cs[n]->GetColor());
			SetMtlColor(n, curColor, pShader, cs, curTime);
			if (buttonUp) {
				theHold.Accept(GetString(IDS_DS_PARAMCHG));
				// DS: 5/11/99-  this was commented out. I put it back in, because
				// it is necessary for the Reset button in the color picker to 
				// update the viewport.				
				UpdateMtlDisplay();  
				}
		} break;
		case WM_PAINT: 
			if (!valid) {
				valid = TRUE;
				ReloadDialog();
				}
			return FALSE;
		case WM_CLOSE:
		case WM_DESTROY: 
			break;
		case CC_SPINNER_CHANGE: 
			if (!theHold.Holding()) theHold.Begin();
			switch (id) {
				case IDC_SH_SPIN: 
					pShader->SetGlossiness(PcToFrac(shSpin->GetIVal()), curTime); 
					UpdateHilite();
					break;
				case IDC_SS_SPIN: 
					pShader->SetSpecularLevel(PcToFrac(ssSpin->GetIVal()),curTime); 
					UpdateHilite();
					break;
				case IDC_SOFT_SPIN: 
					pShader->SetSoftenLevel(softSpin->GetFVal(),curTime); 
					break;
				case IDC_SI_SPIN: 
					pShader->SetSelfIllum(PcToFrac(siSpin->GetIVal()),curTime); 
					break;
				case IDC_DIFFLEV_SPIN: 
					pShader->SetDiffuseLevel(PcToFrac(dlevSpin->GetIVal()),curTime); 
					break;
				case IDC_DIFFROUGH_SPIN: 
					pShader->SetDiffuseRoughness(PcToFrac(roughSpin->GetIVal()),curTime); 
					break;
				//******** >>>><<<< required handling for opacity....must be present in all dialogs
				case IDC_TR_SPIN: 
					pMtl->SetOpacity(PcToFrac( trSpin->GetIVal()),curTime); 
					break;
			}
//			UpdateMtlDisplay();
		break;

		case CC_SPINNER_BUTTONDOWN:
			theHold.Begin();
			break;

		case WM_CUSTEDIT_ENTER:
		case CC_SPINNER_BUTTONUP: 
			if (HIWORD(wParam) || msg==WM_CUSTEDIT_ENTER) 
				theHold.Accept(GetString(IDS_DS_PARAMCHG));
			else 
				theHold.Cancel();
			UpdateMtlDisplay();
			break;

    }
	exit:
	return FALSE;
	}
Exemplo n.º 16
0
INT_PTR StraussShaderDlg::PanelProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam ) 
{
   int id = LOWORD(wParam);
   int code = HIWORD(wParam);
    switch (msg) {
      case WM_INITDIALOG:
         {
         HDC theHDC = GetDC(hwndDlg);
         hOldPal = GetGPort()->PlugPalette(theHDC);
         ReleaseDC(hwndDlg,theHDC);

         HWND hwndCS = GetDlgItem(hwndDlg, IDC_COLOR);
         cs[0] = GetIColorSwatch( hwndCS, pShader->GetDiffuseClr(), GetString(IDS_KE_COLOR) );

         hwHilite = GetDlgItem(hwndDlg, IDC_HIGHLIGHT);
         DLSetWindowLongPtr( hwHilite, HiliteWndProc);

         glSpin = SetupIntSpinner(hwndDlg, IDC_GL_SPIN, IDC_GL_EDIT, 0,100, 0);
         mtSpin = SetupIntSpinner(hwndDlg, IDC_MT_SPIN, IDC_MT_EDIT, 0,100, 0);
         trSpin = SetupIntSpinner(hwndDlg, IDC_TR_SPIN, IDC_TR_EDIT, 0,100, 0);

         for (int j=0; j<NMBUTS; j++) {
            texMBut[j] = GetICustButton(GetDlgItem(hwndDlg,texMButtonsIDC[j]));
            assert( texMBut[j] );
            texMBut[j]->SetRightClickNotify(TRUE);
            texMBut[j]->SetDADMgr(&dadMgr);
         }
         LoadDialog(TRUE);
      }
      break;

      case WM_COMMAND: 
         {
         for ( int i=0; i<NMBUTS; i++) {
            if (id == texMButtonsIDC[i]) {
               PostMessage(hwmEdit,WM_TEXMAP_BUTTON, texmapFromMBut[i],(LPARAM)pMtl );
               UpdateMapButtons();
               goto exit;
               }
            }
         }

         break; // WM_COMMAND

      case CC_COLOR_SEL: {
         int id = LOWORD(wParam);
         SelectEditColor(ColorIDCToIndex(id));
      }        
      break;
      case CC_COLOR_DROP:  {
         int id = LOWORD(wParam);
         SelectEditColor(ColorIDCToIndex(id));
         UpdateMtlDisplay();           
      }
      break;
      case CC_COLOR_BUTTONDOWN:
         theHold.Begin();
       break;
      case CC_COLOR_BUTTONUP:
         if (HIWORD(wParam)) theHold.Accept(GetString(IDS_DS_PARAMCHG));
         else theHold.Cancel();
         UpdateMtlDisplay();           
         break;
      case CC_COLOR_CHANGE: {       
         int id = LOWORD(wParam);
         int buttonUp = HIWORD(wParam); 
         int n = ColorIDCToIndex(id);
         if (buttonUp) theHold.Begin();
         Color curColor(cs[n]->GetColor());
         pShader->SetDiffuseClr(curColor, curTime); 
         if (buttonUp) {
            theHold.Accept(GetString(IDS_DS_PARAMCHG));
            // DS: 5/11/99-  this was commented out. I put it back in, because
            // it is necessary for the Reset button in the color picker to 
            // update the viewport.          
            UpdateMtlDisplay();  
            }
      } break;
      case WM_PAINT: 
         if (!valid) {
            valid = TRUE;
            ReloadDialog();
            }
         return FALSE;
      case WM_CLOSE:
      case WM_DESTROY: 
         break;
      case CC_SPINNER_CHANGE: 
         if (!theHold.Holding()) theHold.Begin();
         switch (id) {
            case IDC_GL_SPIN: 
               pShader->SetGlossiness(PcToFrac( glSpin->GetIVal() ), curTime); 
               UpdateHilite();
               break;
            case IDC_MT_SPIN: 
               pShader->SetMetalness(PcToFrac(mtSpin->GetIVal()), curTime); 
               break;
            //******** >>>><<<< required handling for opacity....must be present in all dialogs
            case IDC_TR_SPIN: 
               pMtl->SetOpacity(PcToFrac( trSpin->GetIVal()),curTime); 
               break;
         }
//       UpdateMtlDisplay();
      break;

      case CC_SPINNER_BUTTONDOWN:
         theHold.Begin();
         break;

      case WM_CUSTEDIT_ENTER:
      case CC_SPINNER_BUTTONUP: 
         if (HIWORD(wParam) || msg==WM_CUSTEDIT_ENTER) 
            theHold.Accept(GetString(IDS_DS_PARAMCHG));
         else 
            theHold.Cancel();
         UpdateMtlDisplay();
         break;

    }
   exit:
   return FALSE;
   }
Exemplo n.º 17
0
BOOL WardShaderDlg::PanelProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam ) 
{
	int id = LOWORD(wParam);
	int code = HIWORD(wParam);
    switch (msg) {
		case WM_INITDIALOG:
			{
			int i;
			
			HDC theHDC = GetDC(hwndDlg);
			hOldPal = GetGPort()->PlugPalette(theHDC);
			ReleaseDC(hwndDlg,theHDC);

			for (i=0; i<WARD_NCOLBOX; i++) {
   				cs[i] = GetIColorSwatch(GetDlgItem(hwndDlg, colID[i]),
   					GetMtlColor(i, pShader), GetColorName(i));
			}

			hwHilite = GetDlgItem(hwndDlg, IDC_HIGHLIGHT);
			SetWindowLongPtr( hwHilite, GWLP_WNDPROC, (LONG_PTR)Hilite2WndProc);

			slevSpin = SetupIntSpinner(hwndDlg, IDC_SLEV_SPIN, IDC_SLEV_EDIT, 0,400, 0);
			dlevSpin = SetupIntSpinner(hwndDlg, IDC_DLEV_SPIN, IDC_DLEV_EDIT, 0, 400, 0);
			glxSpin = SetupIntSpinner(hwndDlg, IDC_GLX_SPIN, IDC_GLX_EDIT, 0,100, 0);
			glySpin = SetupIntSpinner(hwndDlg, IDC_GLY_SPIN, IDC_GLY_EDIT, 0,100, 0);
			trSpin = SetupIntSpinner(hwndDlg, IDC_TR_SPIN, IDC_TR_EDIT, 0,100, 0);

			for (int j=0; j<NMBUTS; j++) {
				texMBut[j] = GetICustButton(GetDlgItem(hwndDlg,texMButtonsIDC[j]));
				assert( texMBut[j] );
				texMBut[j]->SetRightClickNotify(TRUE);
				texMBut[j]->SetDADMgr(&dadMgr);
			}

			SetupLockButton(hwndDlg,IDC_LOCK_AD,FALSE);
			SetupLockButton(hwndDlg,IDC_LOCK_DS,FALSE);
			SetupPadLockButton(hwndDlg,IDC_LOCK_ADTEX, TRUE);

			LoadDialog(TRUE);
		}
		break;

		case WM_COMMAND: 
			{
			for ( int i=0; i<NMBUTS; i++) {
				if (id == texMButtonsIDC[i]) {
					PostMessage(hwmEdit,WM_TEXMAP_BUTTON, texmapFromMBut[i],(LPARAM)pMtl );
					UpdateMapButtons();
					goto exit;
					}
				}
			}
		    switch (id) {

				case IDC_NORMALIZE_CHECK:
					pShader->SetNormalizeOn( ! GetCheckBox(hwndDlg, IDC_NORMALIZE_CHECK) );
					UpdateHilite();
					NotifyChanged();
					UpdateMtlDisplay();
					break;
				case IDC_LOCK_AD:
					SetLockAD(IsButtonChecked(hwndDlg, IDC_LOCK_AD));
					UpdateMtlDisplay();
					break;
				
				case IDC_LOCK_DS:
					SetLockDS(IsButtonChecked(hwndDlg, IDC_LOCK_DS));
					UpdateMtlDisplay();
					break;
				
				case IDC_LOCK_ADTEX:{
					BOOL on = IsButtonChecked(hwndDlg, IDC_LOCK_ADTEX);
					SetLockADTex(on);
					UpdateMtlDisplay();
				} break;

			}
			break;
		case CC_COLOR_SEL: {
			int id = LOWORD(wParam);
			SelectEditColor(ColorIDCToIndex(id));
		}			
		break;
		case CC_COLOR_DROP:	{
			int id = LOWORD(wParam);
			SelectEditColor(ColorIDCToIndex(id));
			UpdateMtlDisplay();				
		}
		break;
		case CC_COLOR_BUTTONDOWN:
			theHold.Begin();
		 break;
		case CC_COLOR_BUTTONUP:
			if (HIWORD(wParam)) theHold.Accept(GetString(IDS_DS_PARAMCHG));
			else theHold.Cancel();
			UpdateMtlDisplay();				
			break;
		case CC_COLOR_CHANGE: {			
			int id = LOWORD(wParam);
			int buttonUp = HIWORD(wParam); 
			int n = ColorIDCToIndex(id);
			if (buttonUp) theHold.Begin();
			Color curColor(cs[n]->GetColor());
			SetMtlColor(n, curColor, pShader, cs, curTime);
			if (buttonUp) {
				theHold.Accept(GetString(IDS_DS_PARAMCHG));
				// DS: 5/11/99-  this was commented out. I put it back in, because
				// it is necessary for the Reset button in the color picker to 
				// update the viewport.				
				UpdateMtlDisplay();  
				}
		} break;
		case WM_PAINT: 
			if (!valid) {
				valid = TRUE;
				ReloadDialog();
				}
			return FALSE;
		case WM_CLOSE:
		case WM_DESTROY: 
			break;
		case CC_SPINNER_CHANGE: 
			if (!theHold.Holding()) theHold.Begin();
			switch (id) {
				case IDC_GLX_SPIN: 
					pShader->SetGlossiness(ALPHA_MAX - PcToFrac( glxSpin->GetIVal() ) * ALPHA_SZ, curTime); 
					UpdateHilite();
					break;
				case IDC_GLY_SPIN: 
					pShader->SetGlossinessY(ALPHA_MAX - PcToFrac(glySpin->GetIVal()) * ALPHA_SZ, curTime); 
					UpdateHilite();
					break;
				case IDC_SLEV_SPIN: 
					pShader->SetSpecularLevel(SPEC_MAX * PcToFrac(slevSpin->GetIVal()),curTime); 
					UpdateHilite();
					break;
				case IDC_DLEV_SPIN: 
					pShader->SetDiffuseLevel(PcToFrac(dlevSpin->GetIVal()),curTime); 
					break;
				//******** >>>><<<< required handling for opacity....must be present in all dialogs
				case IDC_TR_SPIN: 
					pMtl->SetOpacity(PcToFrac( trSpin->GetIVal()),curTime); 
					break;
			}
//			UpdateMtlDisplay();
		break;

		case CC_SPINNER_BUTTONDOWN:
			theHold.Begin();
			break;

		case WM_CUSTEDIT_ENTER:
		case CC_SPINNER_BUTTONUP: 
			if (HIWORD(wParam) || msg==WM_CUSTEDIT_ENTER) 
				theHold.Accept(GetString(IDS_DS_PARAMCHG));
			else 
				theHold.Cancel();
			UpdateMtlDisplay();
			break;

    }
	exit:
	return FALSE;
	}
Exemplo n.º 18
0
// --[  Method  ]---------------------------------------------------------------
//
//  - Class     : CStravaganzaMaxTools
//
//  - prototype : void SaveConfig()
//
//  - Purpose   : Saves the panel parameters to a file.
//
// -----------------------------------------------------------------------------
void CStravaganzaMaxTools::SaveConfig()
{
	if(!m_hPanel) return;

	ISpinnerControl* pMaxSpin;
	ICustEdit*       pMaxEdit;

	int  nSelectedItem;
	char szAuxBuffer[MAX_PATH];
	COutputFile cfgFile;

	// GET SETTINGS FROM PANEL

	// Common

	m_bPreprocessMesh = IsDlgButtonChecked(m_hPanel, IDC_CHECK_PREPROCESSMESHES) == BST_CHECKED ? true : false;
	m_bUseLights      = IsDlgButtonChecked(m_hPanel, IDC_CHECK_USELIGHTS)        == BST_CHECKED ? true : false;

	pMaxSpin = GetISpinner(GetDlgItem(m_hPanel, IDC_SPIN_STARTTIME));
	m_fStartTime = pMaxSpin->GetFVal();
	ReleaseISpinner(pMaxSpin);

	pMaxSpin = GetISpinner(GetDlgItem(m_hPanel, IDC_SPIN_ENDTIME));
	m_fEndTime = pMaxSpin->GetFVal();
	ReleaseISpinner(pMaxSpin);

	if(IsDlgButtonChecked(m_hPanel, IDC_RADIO_USESAMPLING) == BST_CHECKED)
	{
		m_eAnimType = ANIMATION_SAMPLING;
	}
	else if(IsDlgButtonChecked(m_hPanel, IDC_RADIO_USEMAXKEYS) == BST_CHECKED)
	{
		m_eAnimType = ANIMATION_MAXKEYS;
	}

	pMaxSpin = GetISpinner(GetDlgItem(m_hPanel, IDC_SPIN_ANIMCHECKSTEP));
	m_nAnimCheckStep = pMaxSpin->GetIVal();
	ReleaseISpinner(pMaxSpin);

	pMaxSpin = GetISpinner(GetDlgItem(m_hPanel, IDC_SPIN_POSSAMPLINGFREQ));
	m_nNumPosSamplesPerSec = pMaxSpin->GetIVal();
	ReleaseISpinner(pMaxSpin);

	pMaxSpin = GetISpinner(GetDlgItem(m_hPanel, IDC_SPIN_SCLSAMPLINGFREQ));
	m_nNumSclSamplesPerSec = pMaxSpin->GetIVal();
	ReleaseISpinner(pMaxSpin);

	pMaxSpin = GetISpinner(GetDlgItem(m_hPanel, IDC_SPIN_ROTSAMPLINGFREQ));
	m_nNumRotSamplesPerSec = pMaxSpin->GetIVal();
	ReleaseISpinner(pMaxSpin);

	// Export

	pMaxEdit = GetICustEdit(GetDlgItem(m_hPanel, IDC_EDIT_DESTINATIONFILE));
	pMaxEdit->GetText(szAuxBuffer, MAX_PATH);
	ReleaseICustEdit(pMaxEdit);
	m_strFile = szAuxBuffer;

	m_bCopyTextures = IsDlgButtonChecked(m_hPanel, IDC_CHECK_COPYTEXTURES) == BST_CHECKED ? true : false;

	pMaxEdit = GetICustEdit(GetDlgItem(m_hPanel, IDC_EDIT_TEXTUREFOLDER));
	pMaxEdit->GetText(szAuxBuffer, MAX_PATH);
	ReleaseICustEdit(pMaxEdit);
	m_strTexturePath = szAuxBuffer;

	// Preview

	// Get selected combo box camera

	nSelectedItem = SendMessage(GetDlgItem(m_hPanel, IDC_COMBO_CAMERA), CB_GETCURSEL, 0, 0);

	if(nSelectedItem == CB_ERR) // Items?
	{
		m_strPreviewCamera = "";
	}
	else
	{
		// Get selected item

		memset(szAuxBuffer, 0, MAX_PATH);

		if(SendMessage(GetDlgItem(m_hPanel, IDC_COMBO_CAMERA), CB_GETLBTEXT, (WPARAM)nSelectedItem, (LPARAM)(LPCSTR)szAuxBuffer) == CB_ERR)
		{
			CLogger::ErrorWindow("Error getting camera selection");
		}
		else
		{
			m_strPreviewCamera = szAuxBuffer;
		}
	}

	if(IsDlgButtonChecked(m_hPanel, IDC_RADIO_SOLID) == BST_CHECKED)
	{
		m_ePreviewType = CRenderVisitor::MODE_SOLID;
	}
	else if(IsDlgButtonChecked(m_hPanel, IDC_RADIO_WIREFRAME) == BST_CHECKED)
	{
		m_ePreviewType = CRenderVisitor::MODE_WIREFRAME;
	}
	else if(IsDlgButtonChecked(m_hPanel, IDC_RADIO_FULLDETAIL) == BST_CHECKED)
	{
		m_ePreviewType = CRenderVisitor::MODE_FULLDETAIL;
	}

	m_bFullscreen = IsDlgButtonChecked(m_hPanel, IDC_CHECK_FULLSCREEN) == BST_CHECKED ? true : false;
	m_bLoop       = IsDlgButtonChecked(m_hPanel, IDC_CHECK_LOOP)       == BST_CHECKED ? true : false;

	int  nAux;
	BOOL valid;

	pMaxEdit = GetICustEdit(GetDlgItem(m_hPanel, IDC_EDIT_RESW));
	nAux = pMaxEdit->GetInt(&valid);
	if(valid) m_nPreviewResX = nAux; else pMaxEdit->SetText(m_nPreviewResX);
	ReleaseICustEdit(pMaxEdit);

	pMaxEdit = GetICustEdit(GetDlgItem(m_hPanel, IDC_EDIT_RESH));
	nAux = pMaxEdit->GetInt(&valid);
	if(valid) m_nPreviewResY = nAux; else pMaxEdit->SetText(m_nPreviewResY);
	ReleaseICustEdit(pMaxEdit);

	pMaxSpin = GetISpinner(GetDlgItem(m_hPanel, IDC_SPIN_VIEWPORTHEIGHT));
	m_fViewportHeight = pMaxSpin->GetFVal();
	ReleaseISpinner(pMaxSpin);

	m_bShowStats   = IsDlgButtonChecked(m_hPanel, IDC_CHECK_SHOWSTATS)   == BST_CHECKED ? true : false;
	m_bRenderToAvi = IsDlgButtonChecked(m_hPanel, IDC_CHECK_RENDERTOAVI) == BST_CHECKED ? true : false;

	pMaxEdit = GetICustEdit(GetDlgItem(m_hPanel, IDC_EDIT_AVIFILE));
	pMaxEdit->GetText(szAuxBuffer, MAX_PATH);
	ReleaseICustEdit(pMaxEdit);
	m_strAviFile = szAuxBuffer;

	// SAVE SETTINGS

	if(cfgFile.Open(m_strCfgFile, false, false) == false)
	{
		return;
	}

	cfgFile.WriteInt(m_bPreprocessMesh ? 1 : 0);
	cfgFile.WriteInt(m_bUseLights      ? 1 : 0);

	cfgFile.WriteInt(m_nAnimCheckStep);
	cfgFile.WriteInt(m_nNumPosSamplesPerSec);
	cfgFile.WriteInt(m_nNumSclSamplesPerSec);
	cfgFile.WriteInt(m_nNumRotSamplesPerSec);
	cfgFile.WriteInt(m_nNumCamSettingsPerSec);
	cfgFile.WriteInt(m_nNumLightSettingsPerSec);

	cfgFile.WriteInt(m_eAnimType);

	// Export options

	cfgFile.WriteStringZero(m_strFile);
	cfgFile.WriteInt(m_bCopyTextures ? 1 : 0);
	cfgFile.WriteStringZero(m_strTexturePath);

	// Preview options

	cfgFile.WriteStringZero(m_strPreviewCamera);
	cfgFile.WriteInt(m_ePreviewType);
	cfgFile.WriteInt(m_bFullscreen ? 1 : 0);
	cfgFile.WriteInt(m_bLoop       ? 1 : 0);
	cfgFile.WriteInt(m_nPreviewResX);
	cfgFile.WriteInt(m_nPreviewResY);
	cfgFile.WriteFloat(m_fViewportHeight);
	cfgFile.WriteInt(m_bShowStats   ? 1 : 0);
	cfgFile.WriteInt(m_bRenderToAvi ? 1 : 0);
	cfgFile.WriteStringZero(m_strAviFile);

	cfgFile.Close();
}