Control* BaseLimitCtrl::GetDefaultControlForDataType() 
{
	switch(SuperClassID()) {
		case CTRL_FLOAT_CLASS_ID:
		case CTRL_SHORT_CLASS_ID:
		case CTRL_INTEGER_CLASS_ID:
			return NewDefaultFloatController();
		case CTRL_POINT3_CLASS_ID:
			return NewDefaultPoint3Controller();
		case CTRL_POSITION_CLASS_ID:
			return NewDefaultPositionController();
		case CTRL_ROTATION_CLASS_ID:
			return NewDefaultRotationController();
		case CTRL_SCALE_CLASS_ID:
			return NewDefaultScaleController();
		case CTRL_MATRIX3_CLASS_ID:
			return NewDefaultMatrix3Controller();
		case CTRL_MASTERPOINT_CLASS_ID:
			return NewDefaultMasterPointController();
		case CTRL_POINT4_CLASS_ID:
			return NewDefaultPoint4Controller();
		case CTRL_COLOR24_CLASS_ID:
			return NewDefaultColorController();
		case CTRL_FRGBA_CLASS_ID:
			return NewDefaultFRGBAController();
		case CTRL_MORPH_CLASS_ID:
		default:
			return NULL;
	}
}
Exemple #2
0
void ClustMod::Move(
		TimeValue t, Matrix3& partm, Matrix3& tmAxis, 
		Point3& val, BOOL localOrigin) 
	{
#ifdef DESIGN_VER
	t=0;
#endif
	if (tmControl==NULL) {
		ReplaceReference(0,NewDefaultMatrix3Controller()); 
		NotifyDependents(FOREVER,0,REFMSG_CONTROLREF_CHANGE);
		}

	if (ip && ip->GetSubObjectLevel()==1) {				
		SetXFormPacket pckt(val,partm,tmAxis);
		tmControl->SetValue(t,&pckt,TRUE,CTRL_RELATIVE);		
	} else {		
		if (posControl==NULL) {
			ReplaceReference(1,NewDefaultPositionController()); 
			NotifyDependents(FOREVER,0,REFMSG_CONTROLREF_CHANGE);
			}
		Matrix3 ptm = partm;
		Interval valid;
		if (tmControl)
			tmControl->GetValue(t,&ptm,valid,CTRL_RELATIVE);
		posControl->SetValue(t,-VectorTransform(tmAxis*Inverse(ptm),val),TRUE,CTRL_RELATIVE);
		
		SetXFormPacket pckt(val,partm,tmAxis);
		tmControl->SetValue(t,&pckt,TRUE,CTRL_RELATIVE);
		}
	}
Exemple #3
0
// REAPPLYANIMATION
// Now that we've reparented a node within the hierarchy, re-apply all its animation.
void ReapplyAnimation(INode *node, plSampleVec *samples)
{
    Control *controller = node->GetTMController();

    Control *rotControl = NewDefaultRotationController();   // we set the default rotation controller type above in RemoveBiped()
    Control *posControl = NewDefaultPositionController();   // '' ''
    Control *scaleControl = NewDefaultScaleController();    // '' ''
    
    controller->SetRotationController(rotControl);
    controller->SetPositionController(posControl);
    controller->SetScaleController(scaleControl);

    for(int i = 0; i < samples->size(); i++)
    {
        nodeTMInfo *info = (*samples)[i];
        Matrix3 m = info->fMat3;
        TimeValue t = info->fTime;

#if 1
        node->SetNodeTM(t, m);
#else
        AffineParts parts;

        INode *parent = node->GetParentNode();
        Matrix3 parentTM = parent->GetNodeTM(t);
        Matrix3 invParentTM = Inverse(parentTM);
        m *= invParentTM;

        decomp_affine(m, &parts);

        Quat q(parts.q.x, parts.q.y, parts.q.z, parts.q.w);
        Point3 p(parts.t.x, parts.t.y, parts.t.z);

        rotControl->SetValue(t, q);
        posControl->SetValue(t, p);
#endif
    }

    IKeyControl *posKeyCont = GetKeyControlInterface(posControl);
    IKeyControl *scaleKeyCont = GetKeyControlInterface(scaleControl);

    ReduceKeys<ILinPoint3Key>(node, posKeyCont);
    EliminateScaleKeys(node, scaleKeyCont);
    // grrrr ReduceKeys<ILinScaleKey>(node, scaleKeyCont);
}