Пример #1
0
void EditPatchMod::SetSelDlgEnables() 
{
	if (!hSelectPanel)
		return;
	ICustButton *but = GetICustButton(GetDlgItem(hSelectPanel, IDC_NS_PASTE));
	but->Disable();
	switch (GetSubobjectLevel())
	{
		case PO_VERTEX:
			if (GetPatchNamedSelClip(CLIP_P_VERT))
				but->Enable();
			break;
		case PO_EDGE:
			if (GetPatchNamedSelClip(CLIP_P_EDGE))
				but->Enable();
			break;
		case PO_PATCH:
			if (GetPatchNamedSelClip(CLIP_P_PATCH))
				but->Enable();
			break;
		case PO_TILE:
			break;
		}
	ReleaseICustButton(but);
	}
Пример #2
0
void ParticleMesherObject::UpdateUI()
{
   Point3 min,max;
   pblock2->GetValue(particlemesher_customboundsa,0,min,FOREVER);
   pblock2->GetValue(particlemesher_customboundsb,0,max,FOREVER);


   Box3 box;
   box.Init();
   box += min;
   box += max;

   
   TSTR text;
   BOOL useBounds;
   pblock2->GetValue(particlemesher_usecustombounds, 0, useBounds, FOREVER);

   if (useBounds)
      {
      if (box.IsEmpty())
         text.printf(_T("%s"),GetString(IDS_EMPTY));
      else 
         {
         text.printf(_T("(%0.0f,%0.0f,%0.0f)"),min.x,min.y,min.z);
         SetWindowText(GetDlgItem(hParams,IDC_BOUNDSTEXT),
            text);
         text.printf(_T("(%0.0f,%0.0f,%0.0f)"),max.x,max.y,max.z);
         SetWindowText(GetDlgItem(hParams,IDC_BOUNDSTEXT2),
            text);
         }

//make sure we only enable the button in the modify panel
// bug 257747 1/30/01 watje
      if (ip)
         {
         ICustButton *iBut = GetICustButton(GetDlgItem(hParams,IDC_PICKBB));
         if (ip->GetCommandPanelTaskMode()==TASK_MODE_MODIFY)
            {
            if (iBut) iBut->Enable(TRUE);
            }
         ReleaseICustButton(iBut);
         }

      }
   else
      {
      text.printf(_T(" "));
      SetWindowText(GetDlgItem(hParams,IDC_BOUNDSTEXT),
         text);
      text.printf(_T(" "));
      SetWindowText(GetDlgItem(hParams,IDC_BOUNDSTEXT2),
         text);
      ICustButton *iBut = GetICustButton(GetDlgItem(hParams,IDC_PICKBB));
      if (iBut) iBut->Enable(FALSE);
      ReleaseICustButton(iBut);

      }
   
}
Пример #3
0
void
BlobMesh::DisableButtons(HWND hWnd)
{
	if (GetCOREInterface()->GetCommandPanelTaskMode() == TASK_MODE_CREATE)
		{
		ICustButton *iBut = GetICustButton(GetDlgItem(hWnd, IDC_ADD));
		if (iBut)
			{
			iBut->Enable(FALSE);
			ReleaseICustButton(iBut);
			}

		iBut = NULL;
		iBut = GetICustButton(GetDlgItem(hWnd, IDC_PICK));
		if (iBut)
			{
			iBut->Enable(FALSE);
			ReleaseICustButton(iBut);
			}
			
		iBut = NULL;
		iBut = GetICustButton(GetDlgItem(hWnd, IDC_REMOVE));
		if (iBut)
			{
			iBut->Enable(FALSE);
			ReleaseICustButton(iBut);
			}
			

		}
	else
		{
		ICustButton *iBut = GetICustButton(GetDlgItem(hWnd, IDC_ADD));
		if (iBut)
			{
			iBut->Enable(TRUE);
			iBut->SetHighlightColor(GREEN_WASH);
			
			ReleaseICustButton(iBut);
			}

		iBut = NULL;
		iBut = GetICustButton(GetDlgItem(hWnd, IDC_PICK));
		if (iBut)
			{
			iBut->Enable(TRUE);
			iBut->SetType(CBT_CHECK);
			iBut->SetHighlightColor(GREEN_WASH);
			ReleaseICustButton(iBut);
			}

		}
}
Пример #4
0
void TurnButton(HWND hWnd,int SpinNum,BOOL ison)
{	ICustButton *iBut;
	iBut=GetICustButton(GetDlgItem(hWnd,SpinNum));
	if (iBut) 
	{	if (ison) iBut->Enable(); else iBut->Disable();}
	ReleaseICustButton(iBut);
}
void TestSplitByAmountDlgProc::UpdateTypeDlg( HWND hWnd, int type )
{
	bool enable = (type == kSplitByAmount_testType_fraction);
	bool bRandom = enable;
	EnableWindow( GetDlgItem( hWnd, IDC_RATIOTEXT ), enable );
	ISpinnerControl* spin = GetISpinner( GetDlgItem( hWnd, IDC_RATIO2SPIN ) );
	spin->Enable( enable );
	ReleaseISpinner( spin );

	enable = (type == kSplitByAmount_testType_everyN);
	EnableWindow( GetDlgItem( hWnd, IDC_EVERYNTEXT ), enable );
	spin = GetISpinner( GetDlgItem( hWnd, IDC_EVERYNSPIN ) );
	spin->Enable( enable );
	ReleaseISpinner( spin );

	enable = (type >= kSplitByAmount_testType_firstN);
	EnableWindow( GetDlgItem( hWnd, IDC_FIRSTNTEXT ), enable );
	EnableWindow( GetDlgItem( hWnd, IDC_PERSOURCE ), enable );
	spin = GetISpinner( GetDlgItem( hWnd, IDC_FIRSTNSPIN ) );
	spin->Enable( enable );
	ReleaseISpinner( spin );

	EnableWindow( GetDlgItem( hWnd, IDC_UNIQUENESSBOX ), bRandom );
	EnableWindow( GetDlgItem( hWnd, IDC_SEEDTEXT ), bRandom );
	spin = GetISpinner( GetDlgItem( hWnd, IDC_SEEDSPIN ) );
	spin->Enable( bRandom );
	ReleaseISpinner( spin );
	ICustButton* button = GetICustButton( GetDlgItem( hWnd, IDC_NEW ) );
	button->Enable( bRandom );
	ReleaseICustButton( button );
}
Пример #6
0
void SWrapObjectDlgProc::Update(TimeValue t)
{ float size;
	po->pblock->GetValue(PB_ICONSIZE,0,size,FOREVER);
	ICustButton *iBut = GetICustButton(GetDlgItem(po->hParams,IDC_AP_WRAPBUTTON));
	if (size<0.01f) iBut->Disable(); else iBut->Enable();
	ReleaseICustButton(iBut);
	po->ShowName();
}
void PFOperatorSimpleOrientationDlgProc::SetCtlByDir(IParamMap2* map, HWND hWnd)
{
	BOOL bEulerSpinOn = false;
	if(map && hWnd) {
		IParamBlock2* ppb = map->GetParamBlock();
		if(ppb) {
			int iDir = ppb->GetInt(kSimpleOrientation_direction, 0);
			if((iDir == kSO_World) || (iDir == kSO_Speed) || (iDir == kSO_SpeedFollow))
				bEulerSpinOn = true;

			EnableWindow(GetDlgItem(hWnd, IDC_XTEXT), bEulerSpinOn);
			ISpinnerControl* psc = GetISpinner(GetDlgItem(hWnd, IDC_XSPIN));
			psc->Enable(bEulerSpinOn);
			ReleaseISpinner(psc);
			EnableWindow(GetDlgItem(hWnd, IDC_YTEXT), bEulerSpinOn);
			psc = GetISpinner(GetDlgItem(hWnd, IDC_YSPIN));
			psc->Enable(bEulerSpinOn);
			ReleaseISpinner(psc);
			EnableWindow(GetDlgItem(hWnd, IDC_ZTEXT), bEulerSpinOn);
			psc = GetISpinner(GetDlgItem(hWnd, IDC_ZSPIN));
			psc->Enable(bEulerSpinOn);
			ReleaseISpinner(psc);
			bool bDivergenceAvailable = ((iDir != kSO_Rand_3D) && (iDir != kSO_SpeedFollow));
			EnableWindow(GetDlgItem(hWnd, IDC_DIVERGENCETEXT), bDivergenceAvailable);
			psc = GetISpinner(GetDlgItem(hWnd, IDC_DIVERGENCESPIN));
			psc->Enable(bDivergenceAvailable);
			ReleaseISpinner(psc);
			
			EnableWindow(GetDlgItem(hWnd, IDC_RESTRICTTOAXIS), bDivergenceAvailable);
			bool bRestrictToAxis = (ppb->GetInt(kSimpleOrientation_restrictToAxis, 0) != 0) && bDivergenceAvailable;
			EnableWindow(GetDlgItem(hWnd, IDC_DIVERGENCEAXISBOX), bRestrictToAxis);
			EnableWindow(GetDlgItem(hWnd, IDC_AXISXTEXT), bRestrictToAxis);
			psc = GetISpinner(GetDlgItem(hWnd, IDC_AXISXSPIN));
			psc->Enable(bRestrictToAxis);
			ReleaseISpinner(psc);
			EnableWindow(GetDlgItem(hWnd, IDC_AXISYTEXT), bRestrictToAxis);
			psc = GetISpinner(GetDlgItem(hWnd, IDC_AXISYSPIN));
			psc->Enable(bRestrictToAxis);
			ReleaseISpinner(psc);
			EnableWindow(GetDlgItem(hWnd, IDC_AXISZTEXT), bRestrictToAxis);
			psc = GetISpinner(GetDlgItem(hWnd, IDC_AXISZSPIN));
			psc->Enable(bRestrictToAxis);
			ReleaseISpinner(psc);

			bool bChaosAvailable = (iDir != kSO_SpeedFollow);
			EnableWindow(GetDlgItem(hWnd, IDC_UNIQUENESSBOX), bChaosAvailable);
			EnableWindow(GetDlgItem(hWnd, IDC_SEEDTEXT), bChaosAvailable);
			psc = GetISpinner(GetDlgItem(hWnd, IDC_SEEDSPIN));
			psc->Enable(bChaosAvailable);
			ReleaseISpinner(psc);
			ICustButton* but = GetICustButton(GetDlgItem(hWnd, IDC_NEW));
			but->Enable(bChaosAvailable);
			ReleaseICustButton(but);
		}
	}
}
Пример #8
0
int CreateSWrapObjectProc::createmethod(
		ViewExp *vpt,int msg, int point, int flags, IPoint2 m, Matrix3& mat)
	{	Point3 d;

#ifdef _3D_CREATE
	DWORD snapdim = SNAP_IN_3D;
#else
	DWORD snapdim = SNAP_IN_PLANE;
#endif

#ifdef _OSNAP
	if (msg == MOUSE_FREEMOVE)
	{ vpt->SnapPreview(m,m,NULL, snapdim);
	}
#endif
	if (msg==MOUSE_POINT||msg==MOUSE_MOVE) {
		switch(point) {
			case 0:
				sp0 = m;
				p0  = vpt->SnapPoint(m,m,NULL,snapdim);
				mat.SetTrans(p0);
				SWrapObj->pblock->SetValue(PB_ICONSIZE,0,0.01f);
				SWrapObj->pmapParam->Invalidate();
				break;

			case 1: {
				mat.IdentityMatrix();
				sp1 = m;
				p1  = vpt->SnapPoint(m,m,NULL,snapdim);
				Point3 center = (p0+p1)/float(2);
				mat.SetTrans(center);
				SWrapObj->pblock->SetValue(PB_ICONSIZE,0,Length(p1-p0));
				SWrapObj->pmapParam->Invalidate();

				if (msg==MOUSE_POINT) {
					if (Length(m-sp0)<3) {						
						return CREATE_ABORT;
					} else {
					ICustButton *iBut = GetICustButton(GetDlgItem(SWrapObj->hParams,IDC_AP_WRAPBUTTON));
					iBut->Enable();
					ReleaseICustButton(iBut);
						return CREATE_STOP;
						}
					}
				break;
				}

			}
	} else {
		if (msg == MOUSE_ABORT)
			return CREATE_ABORT;
		}	
	return TRUE;
	}
Пример #9
0
void EditFaceDataMod::UpdateDialog () {	
	TSTR buf;
	int numFaces=0, whichFace=0;
	float value = 1.0f;
	bool valueDetermined = true;

	if (!hParams) return;

	ModContextList mcList;
	INodeTab nodes;
	ip->GetModContexts(mcList,nodes);

	if (selLevel) {
		for (int i = 0; i < mcList.Count(); i++) {
			EditFaceDataModData *meshData = (EditFaceDataModData*)mcList[i]->localData;
			if (!meshData) continue;
			int numSelectedHere;
			meshData->DescribeSelection (numSelectedHere, whichFace, value, valueDetermined);
			numFaces += numSelectedHere;
		}
	}

	ISpinnerControl *spin = GetISpinner (GetDlgItem (hParams, IDC_VALUE_SPIN));
	ICustButton *but = GetICustButton (GetDlgItem (hParams, IDC_RESET_SELECTION));

	switch (selLevel) {
	case SEL_FACE:
		if (numFaces==1) {
			buf.printf (GetString(IDS_FACE_SELECTED), whichFace+1);
		} else {
			if (numFaces) buf.printf (GetString (IDS_FACES_SELECTED), numFaces);
			else buf = GetString (IDS_NO_FACE_SELECTED);
		}
		but->Enable (numFaces);
		spin->Enable (numFaces);
		if (numFaces && valueDetermined) {
			spin->SetIndeterminate (false);
			spin->SetValue (value, FALSE);
		} else {
			spin->SetIndeterminate (true);
		}
		break;

	case SEL_OBJECT:
		buf = GetString (IDS_OBJECT_SELECTED);
		spin->Disable();
		but->Disable ();
		break;
	}

	SetDlgItemText(hParams,IDC_FACE_SELECTED,buf);
	ReleaseISpinner (spin);
	ReleaseICustButton (but);
}
void TestGoToRotationDlgProc::UpdateVariationDlg( HWND hWnd, TimeValue timeVar, float spinVar )
{
	bool enable = ((timeVar != 0) || (spinVar != 0.0f));
	EnableWindow( GetDlgItem(hWnd, IDC_UNIQUENESSBOX), enable );
	EnableWindow( GetDlgItem(hWnd, IDC_SEEDTEXT), enable );
	ISpinnerControl* spin = GetISpinner( GetDlgItem( hWnd, IDC_SEEDSPIN ) );
	spin->Enable(enable);
	ReleaseISpinner(spin);
	ICustButton* but = GetICustButton( GetDlgItem( hWnd, IDC_NEW ) );
	but->Enable(enable);
	ReleaseICustButton(but);
}
void TestSpawnOnCollisionDlgProc::UpdateRandomSeedDlg( HWND hWnd, float affects, float multVar, float speedVar, float divergence, float scaleVar )
{
	bool hasChaos = !(((affects==0.0f) || (affects==1.0f)) && (multVar==0.0f) && (speedVar==0.0f) && (divergence==0.0f) && (scaleVar==0.0f));
	EnableWindow( GetDlgItem(hWnd, IDC_UNIQUENESSBOX), hasChaos );
	EnableWindow( GetDlgItem(hWnd, IDC_SEEDTEXT), hasChaos );
	ISpinnerControl* spin = GetISpinner( GetDlgItem( hWnd, IDC_SEEDSPIN ) );
	spin->Enable(hasChaos);
	ReleaseISpinner(spin);
	ICustButton* but = GetICustButton( GetDlgItem( hWnd, IDC_NEW ) );
	but->Enable(hasChaos);
	ReleaseICustButton(but);
}
void PFOperatorForceSpaceWarpDlgProc::UpdateOverlappingDlg( HWND hWnd, IParamBlock2* pblock )
{
	if (pblock == NULL) return;

	int numNodes = pblock->Count(kForceSpaceWarp_ForceNodeList);
	EnableWindow( GetDlgItem( hWnd, IDC_OVERLAPPINGFRAME), numNodes > 1 );
	EnableWindow( GetDlgItem( hWnd, IDC_ADDITIVE), numNodes > 1 );
	EnableWindow( GetDlgItem( hWnd, IDC_MAXIMUM), numNodes > 1 );

	ICustButton* button = GetICustButton( GetDlgItem( hWnd, IDC_REMOVE_FORCESW ) );
	button->Enable( numNodes > 0 );
	ReleaseICustButton( button );
}
void TestDurationDlgProc::UpdateVariationDlg( HWND hWnd, TimeValue variation )
{
	bool useRandom = (variation != 0);
	ISpinnerControl* spin;

	EnableWindow( GetDlgItem( hWnd, IDC_UNIQUENESSBOX ), useRandom );
	EnableWindow( GetDlgItem( hWnd, IDC_SEEDTEXT ), useRandom );
	spin = GetISpinner( GetDlgItem( hWnd, IDC_SEEDSPIN ) );
	spin->Enable( useRandom );
	ReleaseISpinner( spin );
	ICustButton* button = GetICustButton( GetDlgItem( hWnd, IDC_NEW ) );
	button->Enable( useRandom );
	ReleaseICustButton( button );
}
Пример #14
0
void mrShaderButtonHandler::Enable(bool enable) {

	DbgAssert(m_dialogHWnd != NULL);

	HWND ctrlHWnd = GetDlgItem(m_dialogHWnd, m_ctrlID);
	ICustButton* custButton = GetICustButton(ctrlHWnd);
	if(custButton != NULL) {
		custButton->Enable(enable);
		ReleaseICustButton(custButton);
	}
	else {
		DbgAssert(false);
	}
}
void PFOperatorMaterialFrequencyDlgProc::UpdateAssignMaterialDlg( HWND hWnd, int assign, int assignID, Mtl *mtl )
{
	ICustButton* but = GetICustButton(GetDlgItem(hWnd, IDC_MATERIAL));
	but->Enable( assign != 0);
	ReleaseICustButton(but);
	
	BOOL enable = (assign != 0) || (assignID != 0);
	EnableWindow( GetDlgItem( hWnd, IDC_TEXT_MTLIDOFFSET), enable);

	ISpinnerControl* spin = GetISpinner(GetDlgItem(hWnd, IDC_MTLIDOFFSETSPIN));
	spin->Enable( enable );
	ReleaseISpinner( spin );

	int numSubs = (mtl != NULL) ? mtl->NumSubMtls() : 0;
	TCHAR buf[32];
	_stprintf_s(buf, 32, _T("%d"), numSubs);
	SetWindowText( GetDlgItem( hWnd, IDC_NUMSUBS ), buf );
}
Пример #16
0
// NOTE: This depends on the IDC_SMOOTH indices being sequential!
void SmoothDlgProc::Update (HWND hWnd, TimeValue t) {
   if (!mod || !mod->pblock || !hWnd) return;

   int autoSmooth;
   mod->pblock->GetValue (sm_autosmooth, t, autoSmooth, FOREVER);

#ifndef USE_SIMPLIFIED_SMOOTH_MODIFIER_UI
   int bits;
   mod->pblock->GetValue (sm_smoothbits, t, bits, FOREVER);
   for (int i=IDC_SMOOTH_GRP1; i<IDC_SMOOTH_GRP1+32; i++) {
      ICustButton *iBut = GetICustButton(GetDlgItem(hWnd,i));
      iBut->SetCheck ((bits & (1<<(i-IDC_SMOOTH_GRP1))) ? true : false);
      iBut->Enable (!autoSmooth);
      ReleaseICustButton (iBut);
   }

   EnableWindow (GetDlgItem (hWnd, IDC_SMOOTH_GROUP_BOX), !autoSmooth);
#endif

   EnableWindow (GetDlgItem (hWnd, IDC_SMOOTH_THRESH_LABEL), autoSmooth);
   uiValid = true;
}
		INT_PTR DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
		{	

			OrientConstRotation* p = (OrientConstRotation*)map->GetParamBlock()->GetOwner();
			UpdateOrientName(p);
			p->hWnd = hWnd;
			int ct = p->pblock->Count(orientation_target_list);
//			int ctf = p->pblock->Count(orientation_target_weight);

			switch (msg) 
			{
				case WM_INITDIALOG:
				{
					int selection = p->last_selection;

					ICustButton *iBut = GetICustButton(GetDlgItem(hWnd,IDC_ORIENT_TARG_PICKNODE));
					iBut->SetType(CBT_CHECK);
					iBut->SetHighlightColor(GREEN_WASH);
					ReleaseICustButton(iBut);
					
					ISpinnerControl* spin = SetupFloatSpinner(hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER, IDC_ORIENT_CONS_WEIGHT_EDIT, 0.0f, 100.0f, 50.0f, 1.0f);
					spin = GetISpinner(GetDlgItem(hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER));
					
					// CAL-09/10/02: automatically set last_selection to 0 when there're targets
					if (p->pblock->Count(orientation_target_list) < 1) { 
						// nothing is selected OR there are no targets
						// all buttons - target_delete, weight_edit, weight_spinner -- are disabled
						EnableWindow(GetDlgItem(p->hWnd, IDC_ORIENT_CONS_WEIGHT_EDIT), FALSE);
						EnableWindow(GetDlgItem(p->hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER), FALSE);
						ICustButton *iPickOb1;
						iPickOb1	= GetICustButton(GetDlgItem(p->hWnd, IDC_REMOVE_ORIENT_TARG));
						if (iPickOb1 != NULL){
							iPickOb1->Enable(FALSE);		
							ReleaseICustButton(iPickOb1);
						}
						spin->SetValue(0.0f, FALSE);		
					} else {
						if (selection < 0)
							p->last_selection = selection = 0;

						// there is a valid selection 
						// automatically means there is AT LEAST one target
						Control *cont = p->pblock->GetControllerByID(orientation_target_weight, selection); 
						// until it is animated, paramblock doesn't have a controller assigned in it yet.
						if (spin) {
							if ((cont != NULL) && cont->IsKeyAtTime(t,KEYAT_ROTATION))
								spin->SetKeyBrackets(TRUE);
							else
								spin->SetKeyBrackets(FALSE);
						}

						if(p->pickWorldFlag){
							ICustButton *iPickOb;
							iPickOb	= GetICustButton(GetDlgItem(p->hWnd, IDC_ORIENT_PICK_WORLD));
							if (iPickOb != NULL){
								iPickOb->Enable(FALSE);
								ReleaseICustButton(iPickOb);
							}

						}

						if (p->pblock->Count(orientation_target_list) == 1){// there is only one target
							// the "delete" button should be enabled
							ICustButton *iPickOb1;
							iPickOb1 = GetICustButton(GetDlgItem(p->hWnd, IDC_REMOVE_ORIENT_TARG));
							if (iPickOb1 != NULL){
								iPickOb1->Enable(TRUE);		
								ReleaseICustButton(iPickOb1);
							}
							// the rest are disabled
//							EnableWindow(GetDlgItem(p->hWnd, IDC_ORIENT_CONS_WEIGHT_EDIT), FALSE);
//							EnableWindow(GetDlgItem(p->hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER), FALSE);
						}
						else if (p->pblock->Count(orientation_target_list) > 1){ 
							// there are more than one targets
							// all buttons - delete, weight_edit, weight_spinner -- are enabled
							EnableWindow(GetDlgItem(p->hWnd, IDC_ORIENT_CONS_WEIGHT_EDIT), TRUE);
							EnableWindow(GetDlgItem(p->hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER), TRUE);
							ICustButton *iPickOb1;
							iPickOb1 = GetICustButton(GetDlgItem(p->hWnd, IDC_REMOVE_ORIENT_TARG));
							if (iPickOb1 != NULL){
								iPickOb1->Enable(TRUE);		
								ReleaseICustButton(iPickOb1);
							}
						}
					}
					ReleaseISpinner(spin);
					p->RedrawListbox(GetCOREInterface()->GetTime(), selection);
					return TRUE;	
				}
				break;


				case WM_COMMAND:
				{
					
					int selection;
					
					if (LOWORD(wParam) == IDC_ORIENT_TARG_LIST && HIWORD(wParam) == LBN_SELCHANGE)
					{
						selection = SendDlgItemMessage(p->hWnd, IDC_ORIENT_TARG_LIST, LB_GETCURSEL, 0, 0);
						p->last_selection = selection;
						if (selection >= 0){
						// there is a valid selection 
							// automatically means there is AT LEAST one target
							if (p->pblock->Count(orientation_target_list) == 1){ // there is only one target
								// the "delete" button should be enabled
								ICustButton *iPickOb1;
								iPickOb1 = GetICustButton(GetDlgItem(p->hWnd, IDC_REMOVE_ORIENT_TARG));
								if (iPickOb1 != NULL){
									iPickOb1->Enable(TRUE);		
									ReleaseICustButton(iPickOb1);
								}
//								// the rest are disabled
//								EnableWindow(GetDlgItem(p->hWnd, IDC_ORIENT_CONS_WEIGHT_EDIT), FALSE);
//								EnableWindow(GetDlgItem(p->hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER), FALSE);
							}

							else  if (p->pblock->Count(orientation_target_list) > 1){ 
							// there are more than one targets
								// all buttons - delete, weight_edit, weight_spinner -- are enabled
								EnableWindow(GetDlgItem(p->hWnd, IDC_ORIENT_CONS_WEIGHT_EDIT), TRUE);
								EnableWindow(GetDlgItem(p->hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER), TRUE);
								ICustButton *iPickOb1;
								iPickOb1 = GetICustButton(GetDlgItem(p->hWnd, IDC_REMOVE_ORIENT_TARG));
								if (iPickOb1 != NULL){
									iPickOb1->Enable(TRUE);		
									ReleaseICustButton(iPickOb1);
								}

								ISpinnerControl* spin = GetISpinner(GetDlgItem(hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER));
								float value = map->GetParamBlock()->GetFloat(orientation_target_weight, t, selection);
								spin->SetValue(value, FALSE);

								Control *cont = p->pblock->GetControllerByID(orientation_target_weight, selection); // until it is animated, paramblock doesn't have a controller assigned in it yet.
								if (spin && (cont != NULL)) {
									if (cont->IsKeyAtTime(t,KEYAT_ROTATION)){
										spin->SetKeyBrackets(TRUE);
									} 
								}
								else {
									spin->SetKeyBrackets(FALSE);
								}
								ReleaseISpinner(spin);
							}
							p->RedrawListbox(GetCOREInterface()->GetTime(), selection);							
						}
						
						else if (selection < 0 || p->pblock->Count(orientation_target_list) < 1){ 
						// nothing is selected OR there are no targets
							// all buttons - target_delete, weight_edit, weight_spinner -- are disabled
							EnableWindow(GetDlgItem(p->hWnd, IDC_ORIENT_CONS_WEIGHT_EDIT), FALSE);
							EnableWindow(GetDlgItem(p->hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER), FALSE);
							ICustButton *iPickOb1;
							iPickOb1	= GetICustButton(GetDlgItem(p->hWnd, IDC_REMOVE_ORIENT_TARG));
							if (iPickOb1 != NULL){
								iPickOb1->Enable(FALSE);		
								ReleaseICustButton(iPickOb1);
							}
						}
					}

					else if (LOWORD(wParam) == IDC_ORIENT_TARG_PICKNODE){
						thePickMode.p  = p;					
						p->ip->SetPickMode(&thePickMode);
					}

					else if (LOWORD(wParam) == IDC_REMOVE_ORIENT_TARG){
						selection = SendDlgItemMessage(p->hWnd, IDC_ORIENT_TARG_LIST, LB_GETCURSEL, 0, 0);
						p->last_selection = selection;
						if (selection >= 0){
							theHold.Begin();
							p->DeleteTarget(selection);
							theHold.Accept(GetString(IDS_AG_ORIENTATION_LIST));
						}
//						p->RedrawListbox(GetCOREInterface()->GetTime(), selection-1);
					}

					else if (LOWORD(wParam) == IDC_ORIENT_PICK_WORLD){
						INode *nullNode = NULL;
						p->AppendTarget(nullNode);
						
						p->pickWorldFlag = 1;

						p->NotifyDependents(FOREVER,PART_ALL,REFMSG_CHANGE); // so that the change is updated
						ICustButton *iPickOb;
						iPickOb	= GetICustButton(GetDlgItem(p->hWnd, IDC_ORIENT_PICK_WORLD));
						if (iPickOb != NULL){
							iPickOb->Enable(FALSE);
							ReleaseICustButton(iPickOb);
						}
						p->RedrawListbox(GetCOREInterface()->GetTime());
					}

				
				}
				break;


				case CC_SPINNER_CHANGE:
				{
					if (LOWORD(wParam) == IDC_ORIENT_CONS_WEIGHT_SPINNER) {
						int selection = SendDlgItemMessage(p->hWnd, IDC_ORIENT_TARG_LIST, LB_GETCURSEL, 0, 0);

						// CAL-09/10/02: need to start a hold if it's not holding to handle type-in values
						BOOL isHold = theHold.Holding();
						if (!isHold) theHold.Begin();

						ISpinnerControl* spin = GetISpinner(GetDlgItem(hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER));

						if (selection >= 0) {
							float value = ((ISpinnerControl *)lParam)->GetFVal();
							map->GetParamBlock()->SetValue(orientation_target_weight, t, value, selection);

							Control *cont = p->pblock->GetControllerByID(orientation_target_weight, selection); // until it is animated, paramblock doesn't have a controller assigned in it yet.
							if (spin)
								spin->SetKeyBrackets(((cont != NULL) && cont->IsKeyAtTime(t,KEYAT_ROTATION)) ? TRUE : FALSE);

							p->RedrawListbox(GetCOREInterface()->GetTime(), selection);
						} else {
							if (spin) spin->SetValue(0.0f, FALSE);
						}

						if (spin) ReleaseISpinner(spin);

						if (!isHold) theHold.Accept(GetString(IDS_RB_PARAMETERCHANGE));
					}
				}			
				break;

			}
			return FALSE;
		}
void TestSpawnOnCollisionDlgProc::UpdateDeflectorsDlg( HWND hWnd, int numDeflectors )
{
	ICustButton* button = GetICustButton( GetDlgItem( hWnd, IDC_REMOVE_COLLISION ) );
	button->Enable( numDeflectors > 0 );
	ReleaseICustButton( button );
}
void PFOperatorMaterialDynamicDlgProc::UpdateDlg( HWND hWnd, IParamBlock2* pblock, TimeValue t)
{
	int assign = pblock->GetInt(kMaterialDynamic_assignMaterial, t);
	int assignID  = pblock->GetInt(kMaterialDynamic_assignID, t);
	int type = pblock->GetInt(kMaterialDynamic_type, t);
	int randAge = pblock->GetInt(kMaterialDynamic_randomizeAge, t);
	int randOffset = pblock->GetInt(kMaterialDynamic_randomizeRotoscoping, t);

	ICustButton* but = GetICustButton(GetDlgItem(hWnd, IDC_MATERIAL));
	but->Enable( assign != 0);
	ReleaseICustButton(but);

	BOOL enable = ((assign != 0) && (assignID == 0)) 
				|| ((assignID != 0) && (type != kMaterialDynamic_type_particleID));
	EnableWindow( GetDlgItem( hWnd, IDC_TEXT_MTLIDOFFSET), enable);
	ISpinnerControl* spin = GetISpinner(GetDlgItem(hWnd, IDC_MTLIDOFFSETSPIN));
	spin->Enable( enable );
	ReleaseISpinner( spin );

	bool enableAssign = (assignID != 0);
	EnableWindow( GetDlgItem( hWnd, IDC_SHOWINVIEWPORT), enableAssign);
	EnableWindow( GetDlgItem( hWnd, IDC_ANIMATEDFRAME), enableAssign);
	EnableWindow( GetDlgItem( hWnd, IDC_TYPE_PARTID), enableAssign);
	EnableWindow( GetDlgItem( hWnd, IDC_SUBMTLSFRAME), enableAssign);
	EnableWindow( GetDlgItem( hWnd, IDC_TYPE_MTLID), enableAssign);
	EnableWindow( GetDlgItem( hWnd, IDC_TYPE_CYCLE), enableAssign);
	EnableWindow( GetDlgItem( hWnd, IDC_TYPE_RANDOM), enableAssign);

	bool enableAnimated = (enableAssign && (type == kMaterialDynamic_type_particleID));
	bool enableMaxOffset = (enableAnimated && (randAge != 0));
	EnableWindow( GetDlgItem( hWnd, IDC_RESETAGE), enableAnimated);
	EnableWindow( GetDlgItem( hWnd, IDC_RANDOMIZEAGE), enableAnimated);
	EnableWindow( GetDlgItem( hWnd, IDC_MAXOFFSETTEXT), enableMaxOffset);
	spin = GetISpinner(GetDlgItem(hWnd, IDC_MAXOFFSETSPIN));
	spin->Enable( enableMaxOffset );
	ReleaseISpinner( spin );

	bool enableMtlID = (enableAssign && (type == kMaterialDynamic_type_materialID));
	spin = GetISpinner(GetDlgItem(hWnd, IDC_MATERIALIDSPIN));
	spin->Enable( enableMtlID );
	ReleaseISpinner( spin );
	
	bool enableRoto = (enableAssign && (type >= kMaterialDynamic_type_cycle));
	EnableWindow( GetDlgItem( hWnd, IDC_NUMSUBSTEXT), enableRoto);
	EnableWindow( GetDlgItem( hWnd, IDC_RATETEXT), enableRoto);
	spin = GetISpinner(GetDlgItem(hWnd, IDC_NUMSUBSSPIN));
	spin->Enable( enableRoto );
	ReleaseISpinner( spin );
	spin = GetISpinner(GetDlgItem(hWnd, IDC_RATESPIN));
	spin->Enable( enableRoto );
	ReleaseISpinner( spin );
	EnableWindow( GetDlgItem( hWnd, IDC_LOOP), enableAssign && (type == kMaterialDynamic_type_cycle));

	bool enableSync = (enableAssign && ((type == kMaterialDynamic_type_materialID)
									|| ( type == kMaterialDynamic_type_cycle)) );
	EnableWindow( GetDlgItem( hWnd, IDC_SYNCBYTEXT), enableSync);
	EnableWindow( GetDlgItem( hWnd, IDC_SYNC), enableSync);
	EnableWindow( GetDlgItem( hWnd, IDC_SYNCRANDOM), enableSync);
	spin = GetISpinner(GetDlgItem(hWnd, IDC_SYNCOFFSETSPIN));
	spin->Enable( enableSync && (randOffset != 0) );
	ReleaseISpinner( spin );
}
Пример #20
0
void EditPolyPaintDeformDlgProc::SetEnables (HWND hWnd) {
	PaintModeID paintMode = mpEPoly->GetPaintMode();

	bool isModelingMode = (mpEPoly->getParamBlock()->GetInt(epm_animation_mode) == 0);
	BOOL isPaintPushPull =	(paintMode==PAINTMODE_PAINTPUSHPULL? TRUE:FALSE);
	BOOL isPaintRelax =		(paintMode==PAINTMODE_PAINTRELAX? TRUE:FALSE);
	BOOL isErasing  =		(paintMode==PAINTMODE_ERASEDEFORM? TRUE:FALSE);
	BOOL isActive =			(mpEPoly->IsPaintDataActive(PAINTMODE_DEFORM)? TRUE:FALSE);

	ICustButton* but = GetICustButton (GetDlgItem (hWnd, IDC_PAINTDEFORM_PUSHPULL));
	but->Enable (isModelingMode);
	but->SetCheck( isPaintPushPull );
	ReleaseICustButton (but);

	but = GetICustButton (GetDlgItem (hWnd, IDC_PAINTDEFORM_RELAX));
	but->Enable (isModelingMode);
	but->SetCheck( isPaintRelax );
	ReleaseICustButton (but);

	but = GetICustButton (GetDlgItem (hWnd, IDC_PAINTDEFORM_REVERT));
	but->Enable( isActive && isModelingMode );
	but->SetCheck( isErasing );
	ReleaseICustButton (but);

	ISpinnerControl *spin = GetISpinner (GetDlgItem (hWnd, IDC_PAINTDEFORM_VALUE_SPIN));
	spin->Enable ((!isPaintRelax) && (!isErasing) && isModelingMode);
	ReleaseISpinner (spin);
	BOOL enablePushPull = (((!isPaintRelax) && (!isErasing) && isModelingMode)? TRUE:FALSE);
	HWND hDlgItem = GetDlgItem (hWnd, IDC_PAINTDEFORM_VALUE_LABEL);
	EnableWindow( hDlgItem, enablePushPull );
	hDlgItem = GetDlgItem (hWnd, IDC_PAINTAXIS_BORDER);
	EnableWindow( hDlgItem, enablePushPull );
	hDlgItem = GetDlgItem (hWnd, IDC_PAINTAXIS_ORIGNORMS);
	EnableWindow( hDlgItem, enablePushPull );
	hDlgItem = GetDlgItem (hWnd, IDC_PAINTAXIS_DEFORMEDNORMS);
	EnableWindow( hDlgItem, enablePushPull );
	hDlgItem = GetDlgItem (hWnd, IDC_PAINTAXIS_XFORM);
	EnableWindow( hDlgItem, enablePushPull );
	hDlgItem = GetDlgItem (hWnd, IDC_PAINTAXIS_XFORM_X);
	EnableWindow( hDlgItem, enablePushPull );
	hDlgItem = GetDlgItem (hWnd, IDC_PAINTAXIS_XFORM_Y);
	EnableWindow( hDlgItem, enablePushPull );
	hDlgItem = GetDlgItem (hWnd, IDC_PAINTAXIS_XFORM_Z);
	EnableWindow( hDlgItem, enablePushPull );

	EnableWindow (GetDlgItem (hWnd, IDC_PAINTDEFORM_SIZE_LABEL), isModelingMode);
	EnableWindow (GetDlgItem (hWnd, IDC_PAINTDEFORM_STRENGTH_LABEL), isModelingMode);

	spin = GetISpinner (GetDlgItem (hWnd, IDC_PAINTDEFORM_SIZE_SPIN));
	spin->Enable (isModelingMode);
	ReleaseISpinner (spin);

	spin = GetISpinner (GetDlgItem (hWnd, IDC_PAINTDEFORM_STRENGTH_SPIN));
	spin->Enable (isModelingMode);
	ReleaseISpinner (spin);

	but = GetICustButton (GetDlgItem (hWnd, IDC_PAINTDEFORM_OPTIONS));
	but->Enable (isModelingMode);
	ReleaseICustButton (but);

	but = GetICustButton (GetDlgItem (hWnd, IDC_PAINTDEFORM_APPLY));
	but->Enable( isActive && isModelingMode );
	ReleaseICustButton (but);

	but = GetICustButton (GetDlgItem (hWnd, IDC_PAINTDEFORM_CANCEL));
	but->Enable( isActive && isModelingMode );
	ReleaseICustButton (but);
}
	void OrientConstRotation::RedrawListbox(TimeValue t,  int sel)
	{
		if (hWnd == NULL) return;
		if (!ip || editCont != this) return;
		int isWorldinListboxFlag = 0;
		if(!orientCD.NumParamMaps()) return;
		int selection = SendDlgItemMessage(hWnd, IDC_ORIENT_TARG_LIST, LB_GETCURSEL, 0, 0);
//		IParamBlock2* pb = orientCD.GetParamMap(0)->GetParamBlock();
		SendDlgItemMessage(hWnd, IDC_ORIENT_TARG_LIST, LB_RESETCONTENT, 0, 0);
		int ts = 64;  // appears smaller than necessary since for a large no of targets the vertical scroll bar needs space
		SendDlgItemMessage(hWnd, IDC_ORIENT_TARG_LIST, LB_SETTABSTOPS, 1, (LPARAM)&ts);
		int ct = pblock->Count(orientation_target_list);
		int ctf = pblock->Count(orientation_target_weight);
		if (ct != ctf) return;		// CAL-09/10/02: In the middle of changing table size.

		for (int i = 0; i < ct; i++){				
			TSTR str;
			INode *testNode;
			testNode = pblock->GetINode(orientation_target_list, t, i);
			if (testNode == NULL){
				str.printf( _T("%-s\t%-d"), // NOTE: for tab "\t" to use, check "use tabstops" in the resource listbox properties
										_T("World"), (int)pblock->GetFloat(orientation_target_weight, t, i));
				isWorldinListboxFlag = 1;
				ICustButton *iPickOb;
				iPickOb	= GetICustButton(GetDlgItem(hWnd, IDC_ORIENT_PICK_WORLD));
				if (iPickOb != NULL){
					iPickOb->Enable(FALSE);
					ReleaseICustButton(iPickOb);
				}
			}
			else{
				float wwt = pblock->GetFloat(orientation_target_weight, t, i);
				const TCHAR * nname = testNode->GetName();
				str.printf(_T("%-s\t%-d"), 
				testNode->GetName(),
				(int)pblock->GetFloat(orientation_target_weight, t, i));
			}
			SendDlgItemMessage(hWnd, IDC_ORIENT_TARG_LIST, LB_ADDSTRING, 0, (LPARAM)(LPCTSTR) str.data());			
		}

		if(!isWorldinListboxFlag){
				ICustButton *iPickOb;
				iPickOb	= GetICustButton(GetDlgItem(hWnd, IDC_ORIENT_PICK_WORLD));
				if (iPickOb != NULL){
					iPickOb->Enable(TRUE);
					ReleaseICustButton(iPickOb);
				}
		}

		if (ct > 0){
			if (sel >= 0){
				SendDlgItemMessage(hWnd, IDC_ORIENT_TARG_LIST, LB_SETCURSEL, sel, 0);
			}
			else{
//		int selection = SendDlgItemMessage(hWnd, IDC_POS_TARG_LIST, LB_GETCURSEL, 0, 0);
				if (selection >= 0){
					SendDlgItemMessage(hWnd, IDC_ORIENT_TARG_LIST, LB_SETCURSEL, selection, 0);
					last_selection = selection;
				}
				else if (ct == 1){
					SendDlgItemMessage(hWnd, IDC_ORIENT_TARG_LIST, LB_SETCURSEL, 0, 0);
					last_selection = 0;
				}
			}
			
			ISpinnerControl* spin = GetISpinner(GetDlgItem(hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER));
			if (last_selection >= 0 && spin != NULL){
				float value = pblock->GetFloat(orientation_target_weight, GetCOREInterface()->GetTime(), last_selection);
				spin->SetValue(value, FALSE);
			}
			ReleaseISpinner(spin);
		}
		HWND hListBox = GetDlgItem(hWnd, IDC_ORIENT_TARG_LIST);
		int extent = computeHorizontalExtent(hListBox, TRUE, 1, &ts);
		SendMessage(hListBox, LB_SETHORIZONTALEXTENT, extent, 0);
		UpdateWindow(hWnd);
	}
Пример #22
0
INT_PTR ParticleMesherParamsMapDlgProc::DlgProc(
      TimeValue t,IParamMap2 *map,HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
         
   {


   switch (msg) {
      case WM_INITDIALOG:
         {
         mod->hParams = hWnd;

         ICustButton *iBut = GetICustButton(GetDlgItem(hWnd,IDC_PICKBB));
         iBut->SetType(CBT_CHECK);
         iBut->SetHighlightColor(GREEN_WASH);

         if (mod->ip)
            {
            if (mod->ip->GetCommandPanelTaskMode() == TASK_MODE_CREATE)
               {
               iBut->Enable(FALSE);
               }

            }

         ReleaseICustButton(iBut);
         mod->UpdateUI();


         break;
         }
      case WM_COMMAND:
         {
         switch (LOWORD(wParam)) 
            {
            case IDC_ADDPF_EVENT_BUTTON:
               mod->PickPFEvents(hWnd);
               break;
            case IDC_BBOX:
               {
               mod->UpdateUI();
               break;
               }
            case IDC_UPDATE:
               {
               mod->lastTime = -999999;
               mod->ivalid.SetEmpty();
               mod->NotifyDependents(FOREVER,PART_ALL,REFMSG_CHANGE);
               break;
               }
            case  IDC_PICKBB:
               {
               if (mod->ip->GetCommandMode() == (CommandMode *) &thePickMode) {
                  mod->ip->SetStdCommandMode(CID_OBJMOVE);
                  }
               else                 
                  {
                  thePickMode.mod  = mod;             
                  mod->ip->SetPickMode(&thePickMode);
                  }

               }

            }
         break;
         }



      }
   return FALSE;
   }