Exemple #1
0
//+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+
//|							From ReferenceMaker								 |
//+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+
RefResult PFTestSpeed::NotifyRefChanged(Interval changeInt,RefTargetHandle hTarget,PartID& partID, RefMessage message)
{
	switch (message) {
		case REFMSG_CHANGE:
			if ( hTarget == pblock() ) {
				ParamID lastUpdateID = pblock()->LastNotifyParamID();
				switch ( lastUpdateID )
				{
				case kSpeedTest_testType:
				case kSpeedTest_unitVariation:
				case kSpeedTest_angleVariation:
					RefreshUI(kSpeedTest_message_update);
					// the break is omitted on purpose (bayboro 11-18-02)
				case kSpeedTest_conditionType:
				case kSpeedTest_unitValue:
				case kSpeedTest_angleValue:
					NotifyDependents(FOREVER, 0, kPFMSG_DynamicNameChange, NOTIFY_ALL, TRUE);
					break;
				}
				UpdatePViewUI(lastUpdateID);
			}
			break;
		// Initialization of Dialog
		case kSpeedTest_RefMsg_InitDlg:
			RefreshUI(kSpeedTest_message_update, (IParamMap2*)partID);
			return REF_STOP;
		// New Random Seed
		case kSpeedTest_RefMsg_NewRand:
			theHold.Begin();
			NewRand();
			theHold.Accept(GetString(IDS_NEWRANDOMSEED));
			return REF_STOP;
	}	
	return REF_SUCCEED;
}
RefResult PFOperatorSimpleOrientation::NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget,
														PartID& partID, RefMessage message)
{
	IParamMap2* map = NULL;

	switch(message) {
		case REFMSG_CHANGE:
			if ( hTarget == pblock() ) {
				int lastUpdateID = pblock()->LastNotifyParamID();
				switch(lastUpdateID) {
				case kSimpleOrientation_direction:
					NotifyDependents(FOREVER, 0, kPFMSG_DynamicNameChange, NOTIFY_ALL, TRUE);
					// break is omitted on purpose (bayboro 6/18/2003)
				case kSimpleOrientation_restrictToAxis:
					RefreshUI(kSimpleOrientation_message_update);
					break;
				}
				UpdatePViewUI(lastUpdateID);
			}
			break;
		case kSimpleOrientation_RefMsg_Init:
			map = (IParamMap2*)partID;
			RefreshUI(kSimpleOrientation_message_update, map);
			return REF_STOP;
		case kSimpleOrientation_RefMsg_NewRand:
			theHold.Begin();
			NewRand();
			theHold.Accept(GetString(IDS_NEWRANDOMSEED));
			return REF_STOP;
	}
	return REF_SUCCEED;
}
//+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+
//|							From ReferenceMaker								 |
//+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+
RefResult PFTestSplitSelected::NotifyRefChanged(const Interval& changeInt,RefTargetHandle hTarget,PartID& partID, RefMessage message, BOOL propagate)
{
	switch (message) {
		case REFMSG_CHANGE:
			if ( hTarget == pblock() ) {
				ParamID lastUpdateID = pblock()->LastNotifyParamID();
				UpdatePViewUI(lastUpdateID);
			}
			break;
	}	
	return REF_SUCCEED;
}
RefResult PFOperatorComments::NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget,
														PartID& partID, RefMessage message)
{
	switch(message) {
		case REFMSG_CHANGE:
			if ( hTarget == pblock() ) {
				int lastUpdateID = pblock()->LastNotifyParamID();
				UpdatePViewUI(lastUpdateID);
			}
			return REF_STOP;
	}

	return REF_SUCCEED;
}
//+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+
//|							From ReferenceMaker								 |
//+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+
RefResult PFTestGoToNextEvent::NotifyRefChanged(Interval changeInt,RefTargetHandle hTarget,PartID& partID, RefMessage message)
{
	switch (message) {
		case REFMSG_CHANGE:
			if ( hTarget == pblock() ) {
				int lastUpdateID = pblock()->LastNotifyParamID();
				if (lastUpdateID == kGoToNextEvent_conditionType)
					NotifyDependents(FOREVER, 0, kPFMSG_DynamicNameChange, NOTIFY_ALL, TRUE);
				UpdatePViewUI(lastUpdateID);
			}
			break;
	}	
	return REF_SUCCEED;
}
//+--------------------------------------------------------------------------+
//|							From ReferenceMaker								 |
//+--------------------------------------------------------------------------+
RefResult PFTestGoToRotation::NotifyRefChanged(Interval changeInt,RefTargetHandle hTarget,PartID& partID, RefMessage message)
{
	IParamMap2* map;

	switch (message) {
		case REFMSG_CHANGE:
			if ( hTarget == pblock() ) 
			{
				ParamID lastUpdateID = pblock()->LastNotifyParamID();
				switch ( lastUpdateID )
				{
				case kGoToRotation_syncBy:
					RefreshUI(kGoToRotation_message_sync);
					NotifyDependents(FOREVER, 0, kPFMSG_DynamicNameChange, NOTIFY_ALL, TRUE);
					break;
				case kGoToRotation_time:
					NotifyDependents(FOREVER, 0, kPFMSG_DynamicNameChange, NOTIFY_ALL, TRUE);
					break;
				case kGoToRotation_variation:
					NotifyDependents(FOREVER, 0, kPFMSG_DynamicNameChange, NOTIFY_ALL, TRUE);
					RefreshUI(kGoToRotation_message_variation);
					break;
				case kGoToRotation_spinVariation:
					RefreshUI(kGoToRotation_message_variation);
					break;
				case kGoToRotation_matchSpin:
					RefreshUI(kGoToRotation_message_match);
					break;
				}
				UpdatePViewUI(lastUpdateID);
			}
			break;
		// Initialization of Dialog
		case kGoToRotation_RefMsg_InitDlg:
			map = (IParamMap2*)partID;
			RefreshUI(kGoToRotation_message_sync, map);
			RefreshUI(kGoToRotation_message_variation, map);
			RefreshUI(kGoToRotation_message_match);
			return REF_STOP;

		// New Random Seed
		case kGoToRotation_RefMsg_NewRand:
			theHold.Begin();
			NewRand();
			theHold.Accept(GetString(IDS_NEWRANDOMSEED));
			return REF_STOP;
	}	
	return REF_SUCCEED;
}
RefResult PFOperatorSimpleSpeed::NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget,
														PartID& partID, RefMessage message)
{
	switch(message) {
		case REFMSG_CHANGE:
			if ( hTarget == pblock() ) {
				int lastUpdateID = pblock()->LastNotifyParamID();
				if (lastUpdateID == kSimpleSpeed_direction)
					NotifyDependents(FOREVER, 0, kPFMSG_DynamicNameChange, NOTIFY_ALL, TRUE);
				UpdatePViewUI(lastUpdateID);
			}
			break;
		case kSimpleSpeed_RefMsg_NewRand:
			theHold.Begin();
			NewRand();
			theHold.Accept(GetString(IDS_NEWRANDOMSEED));
			return REF_STOP;
	}

	return REF_SUCCEED;
}
//+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+
//|							From ReferenceMaker								 |
//+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+
RefResult PFTestSplitBySource::NotifyRefChanged(Interval changeInt,RefTargetHandle hTarget,PartID& partID, RefMessage message)
{
	switch (message) {
		case REFMSG_CHANGE:
			if ( hTarget == pblock() ) {
				int lastUpdateID = pblock()->LastNotifyParamID();
				switch ( lastUpdateID )
				{
				case kSplitBySource_sources:
					RefreshUI(kSplitBySource_message_update);
					break;
				}
				UpdatePViewUI(lastUpdateID);
			}
			break;

		case REFMSG_NODE_HANDLE_CHANGED:
			if (hTarget == NULL) // direct notification
				updateNodeHandles((IMergeManager*)partID);
			return REF_STOP;

		// Initialization of Dialog
		case kSplitBySource_RefMsg_InitDlg:
			RefreshUI(kSplitBySource_message_update, (IParamMap2*)partID);
			return REF_STOP;
		// New Random Seed
		case kSplitBySource_RefMsg_NewRand:
			theHold.Begin();
			NewRand();
			theHold.Accept(GetString(IDS_NEWRANDOMSEED));
			return REF_STOP;
		case kSplitBySource_RefMsg_MacrorecSources:
			macrorecSources();
			return REF_STOP;
	}	
	return REF_SUCCEED;
}
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;
}
RefResult PFOperatorForceSpaceWarp::NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget,
														PartID& partID, RefMessage message)
{
	switch (message)
	{
		case REFMSG_CHANGE:
			if ( hTarget == pblock() ) {
				ParamID lastUpdateID = pblock()->LastNotifyParamID();
				if (lastUpdateID == kForceSpaceWarp_ForcesMaxscript) {
					if (IsIgnoringRefNodeChange()) return REF_STOP;
					updateFromMXSForces();
					return REF_STOP;
				}
				if (!(theHold.Holding() || theHold.RestoreOrRedoing())) return REF_STOP;
				switch ( lastUpdateID )
				{
				case kForceSpaceWarp_ForceNodeList:
					if (IsIgnoringRefNodeChange()) return REF_STOP;
					updateFromRealForces();
					if (updateObjectNames(kForceSpaceWarp_ForceNodeList)) {
						RefreshUI(kForceSpaceWarp_message_nodes);
						NotifyDependents(FOREVER, 0, kPFMSG_DynamicNameChange, NOTIFY_ALL, TRUE);
						UpdatePViewUI(pblock(), lastUpdateID);
					}
					return REF_SUCCEED; // to avoid unnecessary UI update
				}
				UpdatePViewUI(pblock(), lastUpdateID);
			} else if (hTarget == scriptPBlock() ) {
				ParamID lastUpdateID = scriptPBlock()->LastNotifyParamID();
				bool disable = ((scriptPBlock()->GetInt(kForceSpaceWarp_useScriptWiring, 0) != 0)
							&& (scriptPBlock()->GetInt(kForceSpaceWarp_useFloat, 0) == kForceSpaceWarp_useFloat_influence));
				if (disable) 
					RefreshUI(kForceSpaceWarp_message_disableInfluence);
				else
					RefreshUI(kForceSpaceWarp_message_enableInfluence);
				UpdatePViewUI(scriptPBlock(), lastUpdateID);
			}
			break;
		case REFMSG_NODE_NAMECHANGE:
			NotifyDependents(FOREVER, 0, kPFMSG_DynamicNameChange, NOTIFY_ALL, TRUE);
			UpdatePViewUI(pblock(), kForceSpaceWarp_ForceNodeList);
			break;
		case REFMSG_NODE_WSCACHE_UPDATED:
			updateFromRealForces();
			break;
		// Initialization of Dialog
		case kForceSpaceWarp_RefMsg_InitDlg:
			{
				if (scriptPBlock() != NULL) {
					bool disable = ((scriptPBlock()->GetInt(kForceSpaceWarp_useScriptWiring, 0) != 0)
								&& (scriptPBlock()->GetInt(kForceSpaceWarp_useFloat, 0) == kForceSpaceWarp_useFloat_influence));
					if (disable) 
						RefreshUI(kForceSpaceWarp_message_disableInfluence, (IParamMap2*)partID);
					else
						RefreshUI(kForceSpaceWarp_message_enableInfluence, (IParamMap2*)partID);
				}
				RefreshUI(kForceSpaceWarp_message_nodes, (IParamMap2*)partID);
			}
			return REF_STOP;
		case kForceSpaceWarp_RefMsg_ListSelect:
			validator.action = this;
			GetCOREInterface()->DoHitByNameDialog(this);
			return REF_STOP;
		case kForceSpaceWarp_RefMsg_ResetValidatorAction:
			validator.action = this;
			return REF_STOP;
	}
	return REF_SUCCEED;
}