Constraints have a very useful opportunity to update the position of objects in the evaluation thread. For example, I have a plug manipulator, which manages a set of objects in the scene. On the one hand could simply ask the object location like SetVector for each object. But first, it will be on thread in the drawing, and secondly, my plug-in performs the action in time.

 

Theoretically, I would create a constraint and record all objects in it, but … constraint can not just give it to something without any input, otherwise Moby thinks that there is no need for its use. In other words, do us, the way even for the species. And in the SDK found interesting the whole way out of this situation, I quote:…

// NOTE:
// Usually input animation node should be assigned to constrained object,
// but this plug-in create an animation node which assigned to “Camera Switcher” to solve this constraint
// before other types of constraints such as ‘Path constraint’
// beacuse MotionBuilder dones’t have deformer propagation system.
if ( FBFindModelByName(  “Camera Switcher” ) ){
mDummy_AnimationNode = AnimationNodeInCreate ( 0/*Curve_UserId*/, FBFindModelByName(  “Camera Switcher” ), ANIMATIONNODE_TYPE_TRANSLATION );

// NOTE:

// Usually input animation node should be assigned to constrained object,

// but this plug-in create an animation node which assigned to “Camera Switcher” to solve this constraint

// before other types of constraints such as ‘Path constraint’

// beacuse MotionBuilder dones’t have deformer propagation system.

if ( FBFindModelByName(  “Camera Switcher” ) ){

mDummy_AnimationNode = AnimationNodeInCreate ( 0/*Curve_UserId*/, FBFindModelByName(  “Camera Switcher” ), ANIMATIONNODE_TYPE_TRANSLATION );

The second note for the constraint is in their visibility.

Here are the standard creation code of a constraint of a given type

// Create Relation Constraint

int i, c = gConstraintManager.TypeGetCount();

for( i = 0; i < c; i++ )

{

if( strstr(gConstraintManager.TypeGetName(i), “Parent/Child”) )

{

gConstraintPos = gConstraintManager.TypeCreateConstraint(i);

break;

}

}

subtle point is that the constraint does not appear in the lists of constraints of the scene. Starting with the latest versions of Mobu him there need to add manually:

FBSystem (). Scene-> Constraints.Add (gConstraintPos);

The third note concerning the events of the scene with invisible constraints.

If you have not added a constraint to the list of constraints in the scene, you will not be able to handle him a message to disconnect kFBSceneChangeDetach. In other words, it is necessary in this case to track when loading the scene or renewed and other developments concerning the life of the constraint.

Some notes about constraints in ORSDK
Tagged on:             

2 thoughts on “Some notes about constraints in ORSDK

  • Friday September 9th, 2011 at 10:37 AM
    Permalink

    That’s very interesting info. Thanks.
    Concerning MB 2012, do You know how to get a default Drag and Drop behavior on constraint (I mean dropping a constraint node on an objects constraints an object and adds constraint into object hierarchy). I can’t sort it out.
    Also do you know how to constrain a cameras Field of View, apart from setting it with:

    1
    static_cast<HFBCamera>(model)->FieldOfView = value;

    Thanks,

  • Wednesday September 14th, 2011 at 07:05 AM
    Permalink

    Hi Jake, I don’t know about Drag and Drop behavior… As I remember it’s not posible to implement using ORSDK.
    If you want to constraint object properties, I have a plugin for that – http://neill3d.com/en/ogranichitel-svyazyvaniya-svojstv-obekta
    To control a property value you have to use property list and property SetData method

Leave a Reply

Your email address will not be published. Required fields are marked *