Exemplo n.º 1
0
void  StraussShaderDlg::LoadDialog(BOOL draw) 
{
   if (pShader && hRollup) {
      glSpin->SetValue( FracToPc( pShader->GetGlossiness() ),FALSE);
      glSpin->SetKeyBrackets(KeyAtCurTime(st_glossiness));
      
      mtSpin->SetValue( FracToPc( pShader->GetMetalness() ), FALSE);
      mtSpin->SetKeyBrackets(KeyAtCurTime(st_metalness));

      trSpin->SetValue(FracToPc(pMtl->GetOpacity(curTime)),FALSE);
      trSpin->SetKeyBrackets(pMtl->KeyAtTimeByID(OPACITY_PARAM, curTime));

      UpdateColSwatches();
      UpdateHilite();

      IParamBlock2 * shaderpblock = pShader->pblock;
      if ( shaderpblock ) {
		  cs[0]->UpdateEnableState( shaderpblock, shaderpblock->GetAnimNum( st_diffuse ) );
		  glSpin->UpdateEnableState( shaderpblock, shaderpblock->GetAnimNum( st_glossiness ) );
		  mtSpin->UpdateEnableState( shaderpblock, shaderpblock->GetAnimNum( st_metalness ) );
	  }
	  // trSpin: opacity is accessed through the material: only handle StdMat2.
	  EnableMtl2OpacityControl( pMtl, trSpin );
   }
}
Exemplo n.º 2
0
void BombObject::UpdateUI(TimeValue t)
	{
	if (hParam && !waitPostLoad) {
      if (this == DLGetWindowLongPtr<BombObject *>(hParam)) {
			strengthSpin->SetValue(GetStrength(t),FALSE);
			gravSpin->SetValue(GetGravity(t),FALSE);
			chaosSpin->SetValue(GetChaos(t),FALSE);			
			falloffSpin->SetValue(GetFalloff(t),FALSE);
			spinSpin->SetValue(GetSpin(t),FALSE);

			if (pblock->KeyFrameAtTime(PB_STRENGTH,t))
				 strengthSpin->SetKeyBrackets(TRUE);
			else strengthSpin->SetKeyBrackets(FALSE);

			if (pblock->KeyFrameAtTime(PB_GRAVITY,t))
				 gravSpin->SetKeyBrackets(TRUE);
			else gravSpin->SetKeyBrackets(FALSE);

			if (pblock->KeyFrameAtTime(PB_CHAOS,t))
				 chaosSpin->SetKeyBrackets(TRUE);
			else chaosSpin->SetKeyBrackets(FALSE);

			if (pblock->KeyFrameAtTime(PB_SPIN,t))
				 spinSpin->SetKeyBrackets(TRUE);
			else spinSpin->SetKeyBrackets(FALSE);

			if (pblock->KeyFrameAtTime(PB_FALLOFF,t))
				 falloffSpin->SetKeyBrackets(TRUE);
			else falloffSpin->SetKeyBrackets(FALSE);
			}
		}
	}
Exemplo n.º 3
0
void  WardShaderDlg::LoadDialog(BOOL draw) 
{
	if (pShader && hRollup) {
		dlevSpin->SetValue(FracToPc(pShader->GetDiffuseLevel()),FALSE);
		dlevSpin->SetKeyBrackets(KeyAtCurTime(PB_DIFFUSE_LEV));

		slevSpin->SetValue(FracToPc(pShader->GetSpecularLevel()/SPEC_MAX),FALSE);
		slevSpin->SetKeyBrackets(KeyAtCurTime(PB_SPECULAR_LEV));

		glxSpin->SetValue( 100.0f * ((ALPHA_MAX - pShader->GetGlossiness())/ALPHA_SZ),FALSE);
		glxSpin->SetKeyBrackets(KeyAtCurTime(PB_GLOSSINESS_X));
		glySpin->SetValue(100.0f * ((ALPHA_MAX - pShader->GetGlossinessY())/ALPHA_SZ),FALSE);
		glySpin->SetKeyBrackets(KeyAtCurTime(PB_GLOSSINESS_Y));

		trSpin->SetValue(FracToPc(pMtl->GetOpacity( curTime )),FALSE);
		trSpin->SetKeyBrackets(pMtl->KeyAtTime(OPACITY_PARAM, curTime));

		CheckButton(hRollup, IDC_LOCK_AD, pShader->GetLockAD() );
		CheckButton(hRollup, IDC_LOCK_DS, pShader->GetLockDS() );
		SetCheckBox(hRollup, IDC_NORMALIZE_CHECK, !pShader->GetNormalizeOn() ); 
	 	UpdateLockADTex( FALSE ); //don't send to mtl

		UpdateColSwatches();
		UpdateHilite();
	}
}
void OrientConstTimeChangeCallback :: TimeChanged(TimeValue t){
	int selection = SendDlgItemMessage(orient_controller->hWnd, IDC_ORIENT_TARG_LIST, LB_GETCURSEL, 0, 0);
	ISpinnerControl* spin = GetISpinner(GetDlgItem(orient_controller->hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER));
	spin = GetISpinner(GetDlgItem(orient_controller->hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER));

	Control* cont = orient_controller->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);

	orient_controller->RedrawListbox(t);
}
Exemplo n.º 5
0
void  OrenNayarShaderDlg::LoadDialog(BOOL draw) 
{
	if (pShader && hRollup) {
		shSpin->SetValue(FracToPc(pShader->GetGlossiness()),FALSE);
		shSpin->SetKeyBrackets(KeyAtCurTime(onb_glossiness));

		ssSpin->SetValue(FracToPc(pShader->GetSpecularLevel()),FALSE);
		ssSpin->SetKeyBrackets(KeyAtCurTime(onb_specular_level));

		softSpin->SetValue(pShader->GetSoftenLevel(),FALSE);
		softSpin->SetKeyBrackets(KeyAtCurTime(onb_soften));

		trSpin->SetValue(FracToPc(pMtl->GetOpacity( curTime )),FALSE);
		trSpin->SetKeyBrackets(pMtl->KeyAtTime(OPACITY_PARAM, curTime));

		dlevSpin->SetValue(FracToPc(pShader->GetDiffuseLevel()),FALSE);
		dlevSpin->SetKeyBrackets(KeyAtCurTime(onb_diffuse_level));

		roughSpin->SetValue(FracToPc(pShader->GetDiffuseRoughness()),FALSE);
		roughSpin->SetKeyBrackets(KeyAtCurTime(onb_roughness));

		CheckButton(hRollup, IDC_LOCK_AD, pShader->GetLockAD() );
		CheckButton(hRollup, IDC_LOCK_DS, pShader->GetLockDS() );
	 	UpdateLockADTex( FALSE ); //don't send to mtl

		BOOL colorSelfIllum = pShader->IsSelfIllumClrOn();
		SetCheckBox(hRollup,IDC_SI_COLORON, colorSelfIllum ); 
		if( colorSelfIllum ) {
//			ShowWindow( siSpin->GetHwnd(), SW_HIDE );
			ShowWindow( GetDlgItem(hRollup, IDC_SI_EDIT), SW_HIDE );
			ShowWindow( GetDlgItem(hRollup, 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 );
			// show self-illum slider
//			ShowWindow( siSpin->GetHwnd(), SW_SHOW );
			ShowWindow( GetDlgItem(hRollup, IDC_SI_EDIT), SW_SHOW );
			ShowWindow( GetDlgItem(hRollup, IDC_SI_SPIN), SW_SHOW );

			siSpin->SetValue(FracToPc(pShader->GetSelfIllum()), FALSE);
			siSpin->SetKeyBrackets(KeyAtCurTime(onb_self_illum_amnt));
		}

		UpdateColSwatches();
		UpdateHilite();
	}
}
Exemplo n.º 6
0
void OrenNayarShaderDlg::UpdateOpacity() 
{
	trSpin->SetValue(FracToPc(pMtl->GetOpacity(curTime)),FALSE);
	trSpin->SetKeyBrackets(pMtl->KeyAtTime(OPACITY_PARAM, curTime));
}
Exemplo n.º 7
0
void StraussShaderDlg::UpdateOpacity() 
{
   trSpin->SetValue(FracToPc(pMtl->GetOpacity(curTime)),FALSE);
   trSpin->SetKeyBrackets(pMtl->KeyAtTimeByID(OPACITY_PARAM, curTime));
   UpdateHilite();
}
		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;
		}