Пример #1
0
// ============================================================================
// Set the scaling of a biped bone object
void SetBipedScale(INode *pNode, BOOL bUniform)
{
	if(IsNodeBipedBone(pNode))
	{
		Control *pCont = pNode->GetTMController();
		IBipedExport *pBipExp = (IBipedExport*)pCont->GetInterface(I_BIPINTERFACE);
		pBipExp->RemoveNonUniformScale(bUniform);
		Control *pMaster = (Control*)pCont->GetInterface(I_MASTER);
		pMaster->NotifyDependents(FOREVER, PART_TM, REFMSG_CHANGE);
		pCont->ReleaseInterface(I_MASTER, pMaster);
		pCont->ReleaseInterface(I_BIPINTERFACE, pBipExp);
	}
}
Пример #2
0
void BaseLimitCtrl::SetValue(TimeValue in_t, void *in_val, int in_commit, GetSetMethod in_method)
{
	if(GetLocked()==false)
	{
		if (IsEnabled()) {
			if (in_method == CTRL_RELATIVE)
				GetTypedValueAbsolute(in_t, in_val);
			ClampTypedValue(in_t, in_val);
		}

		// Check if we have a controller assigned.  If so, SetValue on it, if it's not locked!
		Control *limitedCtrl = GetLimitedControl();
		if (limitedCtrl) {
			limitedCtrl->SetValue(in_t, in_val, in_commit, IsEnabled()? CTRL_ABSOLUTE: in_method);
		}
		else {
			// If in AutoKey or SetKey mode, ParamBlock::SetValue() and ParamBlock2::SetValue()
			// create a default controller (an fcurve) and then set key on that   
			// controller.  So if there is no limited controller, I'll do the same:
			// create one, and set key on it.
			if (GetSetKeyMode() || (Animating() && GetCOREInterface10()->GetAutoKeyDefaultKeyOn() && (in_t!=0) && (in_t!=GetCOREInterface10()->GetAutoKeyDefaultKeyTime()))) {
				// Create the proper default controller according to type
				Control *newLimitedCtrl = GetDefaultControlForDataType();
				if (newLimitedCtrl) {
					void* ptrVal = CreateTempValue();
					GetStaticValue(ptrVal, in_method);

					SetLimitedControl(newLimitedCtrl);
					if (GetSetKeyMode()) {
						ISetKey *skey = (ISetKey *)newLimitedCtrl->GetInterface(I_SETKEYCONTROL);
						if (skey)
							skey->SetCurrentValue(ptrVal);
						newLimitedCtrl->SetValue(in_t, in_val);
					}
					else {
						newLimitedCtrl->SetValue(TimeValue(GetCOREInterface10()->GetAutoKeyDefaultKeyTime()), ptrVal);
						newLimitedCtrl->SetValue(in_t, in_val);
					}
					DeleteTempValue(ptrVal);
				}
			}

			// Set the limit controller static value
			SetStaticValue(in_val, CTRL_ABSOLUTE);
		}
	}
}