Getting model.Mixer.CompoundContainer.mixer.normalize with the OM (or how I learned to love the SDK Explorer)


In this video, I show a few common techniques for finding your way through the Object Model (OM) hierarchy with the help of the SDK explorer.
In summary, here are some of the most common ways to navigate an object hierarchy:

  • Object Model methods/properties, like Model.Mixer or Mixer.Transitions.
  • Parameters and Properties collections
  • NestedObjects

Here’s the JScript from the video:

// I want to get this: "MocapMan.Mixer.CompoundContainer.mixer.normalize"

// One step at a time
var mdl = Dictionary.GetObject("MocapMan");

var oMixer = mdl.Mixer;
var oCompounds = oMixer.NestedObjects("Compounds");
var oAnimation = oCompounds.NestedObjects( "Animation" );
var oCompoundContainer = oAnimation.NestedObjects( "CompoundContainer" );
var oMixer = oCompoundContainer.NestedObjects( "Mixer" );
var n = oMixer.NestedObjects( "Normalize" );

LogMessage( n.Value );

// All on one line:
var n = mdl.Mixer.NestedObjects("Compounds").NestedObjects("Animation").NestedObjects("CompoundContainer").NestedObjects("Mixer").NestedObjects("Normalize");
LogMessage( n.Value );

// Or something a little less ... nested:
var n = Dictionary.GetObject( mdl.Mixer.FullName + ".CompoundContainer.mixer.normalize" );

Python snippets. Had to re-dispatch to get it to work.

import win32com.client

mdl = Application.Dictionary.GetObject("MocapMan")

n = mdl.Mixer.NestedObjects("Compounds").NestedObjects("Animation").NestedObjects("CompoundContainer").NestedObjects("Mixer").NestedObjects("Normalize")
n = win32com.client.Dispatch(n)

Application.LogMessage( Application.ClassName(n) )
Application.LogMessage( n.Value )


n = Application.Dictionary.GetObject( mdl.Mixer.FullName + ".CompoundContainer.mixer.normalize" );
n = win32com.client.Dispatch(n)
Application.LogMessage( n.Value )

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s