Пример #1
0
//From ReferenceMaker 
RefResult RendSpline::NotifyRefChanged(
		const Interval& changeInt, RefTargetHandle hTarget,
		PartID& partID, RefMessage message, BOOL propagate) 
{
	if(hTarget == pblock && message == REFMSG_CHANGE)
	{
		ParamID changing_param = pblock->LastNotifyParamID();
		IParamMap2 *map = pblock->GetMap();
		if(!map)
			return REF_SUCCEED;

		switch(changing_param)
		{
			case rnd_v2_width:
				OnSetWidthLength(map->GetHWnd(), rnd_v2_length, rnd_v2_width, GetCOREInterface()->GetTime(), TRUE);
				break;
			case rnd_v2_vpt_width:
				OnSetWidthLength(map->GetHWnd(), rnd_v2_vpt_length, rnd_v2_vpt_width, GetCOREInterface()->GetTime(), TRUE);
				break;
			case rnd_v2_length:
				OnSetWidthLength(map->GetHWnd(), rnd_v2_length, rnd_v2_width, GetCOREInterface()->GetTime(), FALSE);
				break;
			case rnd_v2_vpt_length:
				OnSetWidthLength(map->GetHWnd(), rnd_v2_vpt_length, rnd_v2_vpt_width, GetCOREInterface()->GetTime(), FALSE);
				break;
		}
	}

	return REF_SUCCEED;
}
Пример #2
0
RefResult SmoothMod::NotifyRefChanged (const Interval& changeInt, RefTargetHandle hTarget,
                              PartID& partID, RefMessage message, BOOL propagate) {
   switch (message) {
   case REFMSG_CHANGE:
      if (hTarget == pblock) {
         ParamID idToUpdate = pblock->LastNotifyParamID();
         smooth_param_desc.InvalidateUI (idToUpdate);
         switch (idToUpdate) {
         case -1:
         case sm_smoothbits:
         case sm_autosmooth:
            if (smoothDesc.NumParamMaps() > 0) {
               IParamMap2 *pmap = smoothDesc.GetParamMap(0);
               if (pmap) {
                  HWND hWnd = pmap->GetHWnd();
                  if (hWnd) theSmoothDlgProc.Invalidate (hWnd);
               }
            }
            break;
         }
      }
      break;
   }
   return REF_SUCCEED;
}
Пример #3
0
void RendSpline::CheckAspectLock(TimeValue t)
{
	ParamID lengthID;
	ParamID widthID;
	ParamID aspectlockID;
	float length, width, aspect = 1.0f;
	BOOL aspectlocked = FALSE;

	if(UseViewOrRenderParams(t) == rbViewport)
	{
		widthID = rnd_v2_vpt_width;
		lengthID = rnd_v2_vpt_length;
		aspectlockID = rnd_v2_vpt_aspect_lock;
	}
	else
	{
		widthID = rnd_v2_width;
		lengthID = rnd_v2_length;
		aspectlockID = rnd_v2_aspect_lock;
	}
	pblock->GetValue(lengthID,t,length,FOREVER);
	pblock->GetValue(widthID,t,width,FOREVER);
	pblock->GetValue(aspectlockID,t,aspectlocked,FOREVER);	

	IParamMap2 *map = pblock->GetMap(0);

	if(map)
	{
		ISpinnerControl *iSpin = GetISpinner(GetDlgItem(map->GetHWnd(), IDC_ASPECTSPIN));
		aspect = iSpin->GetFVal();
	}

	pblock->GetMap()->Enable(aspectlockID,((length != 0.0f && width != 0.0f && aspect != 0.0f) || aspectlocked));
}
Пример #4
0
RefResult SymmetryMod::NotifyRefChanged( const Interval& changeInt,RefTargetHandle hTarget, 
						   PartID& partID, RefMessage message, BOOL propagate) {
	ParamID pid;
	int weld;
	IParamMap2 *pPMap;
	HWND hDialog, hThreshLabel;

	switch (message) {
	case REFMSG_CHANGE:
		if (hTarget != mp_pblock)
			break;
		pid = mp_pblock->LastNotifyParamID ();
		if (pid != kSymWeld) 
			break;

		pPMap = mp_pblock->GetMap(kSymmetryParams);
		if (!pPMap)
			break;
		hDialog = pPMap->GetHWnd();
		if (!hDialog)
			break;

		mp_pblock->GetValue (kSymWeld, TimeValue(0), weld, FOREVER);
		hThreshLabel = GetDlgItem (hDialog, IDC_SYM_THRESH_LABEL);
		if (hThreshLabel) 
			EnableWindow (hThreshLabel, weld);
		break;
	}
	return REF_SUCCEED;
}
Пример #5
0
	void Set(PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t)    // set from v
	{
		UVWFrameObject* fo = (UVWFrameObject*)owner;
		switch (id)
		{
			case pb_uvwmesh:
			{
				IParamMap2* pmap = fo->pblock2->GetMap();
				if (pmap)
					if (v.r == NULL)
						SetWindowText(GetDlgItem(pmap->GetHWnd(), IDC_UVWF_PICKOBJ), 
										GetString(IDS_UVWFRAME_NONE)); 
					else
						SetWindowText(GetDlgItem(pmap->GetHWnd(), IDC_UVWF_PICKOBJ), 
										((INode*)(v.r))->GetName()); 
				break;
			}
		}
	}
Пример #6
0
void RendSpline::ParamAccessor::Set(PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t)
{
	if (owner != NULL && RendSpline::paramDlgProc != NULL)
	{
		RendSpline* mod = static_cast<RendSpline*>(owner);
		IParamBlock2* pb = owner->GetParamBlock(0);
		if (pb != NULL)
		{
			IParamMap2* pm = pb->GetMap(0);
			
			if (pm != NULL)
				RendSpline::paramDlgProc->Update(pm->GetHWnd(), t, id);
		}
	}
}
void OrientConstRotation::BeginEditParams( IObjParam *ip, ULONG flags,Animatable *prev )
{
	if(GetLocked()==false)
	{
		this->ip = ip;
		editCont = this;
		if (flags & BEGIN_EDIT_HIERARCHY) {
			InterpCtrlUI *ui;
			ui = new InterpCtrlUI(NULL,ip,this);
			DWORD f=0;			
			SetProperty(PROPID_INTERPUI,ui);		
		} 
		else {
			orientCD.BeginEditParams(ip, this, flags, prev);
		}

		ip->RegisterTimeChangeCallback(&orientConstTimeChangeCallback);
		orientConstTimeChangeCallback.orient_controller = this;
		
		IParamMap2* pmap = pblock->GetMap();
		if (pmap) hWnd = pmap->GetHWnd();

		if (last_selection < 0){
			RedrawListbox(GetCOREInterface()->GetTime());
		}
		else {
			RedrawListbox(GetCOREInterface()->GetTime(), last_selection);
			ISpinnerControl* spin = GetISpinner(GetDlgItem(hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER));
			if (spin != NULL){
				float value = pblock->GetFloat(orientation_target_weight, GetCOREInterface()->GetTime(), last_selection);
				spin->SetValue(value, FALSE);
			}
			ReleaseISpinner(spin);

		}
	}
}
RefResult PFOperatorMaterialStatic::NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget,
													 PartID& partID, RefMessage message)
{
	IParamMap2* map;
	TSTR dynamicNameSuffix;

	if ( hTarget == pblock() ) {
		int lastUpdateID;
		switch (message)
		{
		case REFMSG_CHANGE:
			lastUpdateID = pblock()->LastNotifyParamID();
			if (lastUpdateID == kMaterialStatic_material) {
				if (updateFromMXSMtl()) {
					NotifyDependents(FOREVER, PART_MTL, kPFMSG_UpdateMaterial, NOTIFY_ALL, TRUE);
					NotifyDependents(FOREVER, 0, kPFMSG_DynamicNameChange, NOTIFY_ALL, TRUE);
				}
				UpdatePViewUI(lastUpdateID);
				return REF_STOP;
			}
			if (!(theHold.Holding() || theHold.RestoreOrRedoing())) return REF_STOP;
			switch ( lastUpdateID )
			{
			case kMaterialStatic_assignMaterial:
				RefreshUI(kMaterialStatic_message_assignMaterial);
				NotifyDependents(FOREVER, PART_MTL, kPFMSG_UpdateMaterial, NOTIFY_ALL, TRUE);
				NotifyDependents(FOREVER, 0, kPFMSG_DynamicNameChange, NOTIFY_ALL, TRUE);
				break;
			case kMaterialStatic_assignID:
				RefreshUI(kMaterialStatic_message_assignID);
				break;
			case kMaterialStatic_type:
				RefreshUI(kMaterialStatic_message_type);
				break;
			case kMaterialStatic_rateType:
				RefreshUI(kMaterialStatic_message_rateType);
				break;
			}
			UpdatePViewUI(lastUpdateID);
			break;
		case REFMSG_NODE_WSCACHE_UPDATED:
			updateFromRealMtl();
			break;
		// Initialization of Dialog
		case kMaterialStatic_RefMsg_InitDlg:
			// Set ICustButton properties for MaterialStatic DAD button
			map = (IParamMap2*)partID;
			if (map != NULL) {
				HWND hWnd = map->GetHWnd();
				if (hWnd) {
					ICustButton *iBut = GetICustButton(GetDlgItem(hWnd, IDC_MATERIAL));
					iBut->SetDADMgr(_dadMgr());
					ReleaseICustButton(iBut);
				}
			}
			// Refresh UI
			RefreshUI(kMaterialStatic_message_assignMaterial);
			RefreshUI(kMaterialStatic_message_assignID);
			return REF_STOP;
		// New Random Seed
		case kMaterialStatic_RefMsg_NewRand:
			theHold.Begin();
			NewRand();
			theHold.Accept(GetString(IDS_NEWRANDOMSEED));
			return REF_STOP;
		}
	}
	if ( hTarget == const_cast <Mtl*> (material()) ) {
		switch (message)
		{
		case REFMSG_CHANGE:
			return REF_STOP;
//			if (ignoreRefMsgNotify()) return REF_STOP;
//			if (!(theHold.Holding() || theHold.RestoreOrRedoing())) return REF_STOP;
			break;
		case REFMSG_NODE_NAMECHANGE:
			if (HasDynamicName(dynamicNameSuffix)) {
				if (lastDynamicName() != dynamicNameSuffix) {
					_lastDynamicName() = dynamicNameSuffix;
					NotifyDependents(FOREVER, 0, kPFMSG_DynamicNameChange, NOTIFY_ALL, TRUE);
					UpdatePViewUI(kMaterialStatic_material);
				}
			}
			return REF_STOP;
		case REFMSG_TARGET_DELETED:
			_material() = NULL;
			if (pblock() != NULL)
				pblock()->SetValue(kMaterialStatic_material, 0, NULL);
			if (theHold.Holding()) {
				if (HasDynamicName(dynamicNameSuffix)) {
					if (lastDynamicName() != dynamicNameSuffix) {
						_lastDynamicName() = dynamicNameSuffix;
						NotifyDependents(FOREVER, 0, kPFMSG_DynamicNameChange, NOTIFY_ALL, TRUE);
						UpdatePViewUI(kMaterialStatic_material);
					}
				}
			}
			break;
		}
	}

	return REF_SUCCEED;
}