Part 2 – Finding How to Access Parameters Visually

In the last post we found the X Position value of a sphere with:

print Application.Dictionary.GetObject("sphere.kine.local.posx", False).Value

but how do you find the path to the X Position without copying it straight out of the Script Editor?

Lucky for us Xsi has a very useful tool called the “SDK Explorer”. You can find this under the View menu >> Scripting >> SDK Explorer (or Ctrl+Shift+4).

This neat little tool is like the scene explorer except for the fact that it shows you all the information of the object you have selected.

Also you can change the View in the SDK Explorer to “Use Script Names”. This changes the names of the objects in the explorer section to match their script names so you can see exactly how to access a parameter with your code.

In the above image you can see exactly where we get the “sphere.kine.local.posx” from. Each new part of the path to the parameter is sepperated by a “.” (dot). So from here we can see if we wanted the Z Scale we just need to change the path to “sphere.kine.local.sclz“.

I can also get other data from the SDK Explorer. If I click in the sphere and change the SDK Explorer’s tab from “Parameters” to “Object details” a whole bunch of useful information is presented like whether the object is animated or not (“IsNodeAnimated”) and much more. This will be handy later on when we need to find objects by their type (i.e find all the lights in the scene).

If I select a light in my scene I can see the “Type” in the SDK Explorer (Near the bottom of the “Object Details”) is just called “light”. So if I want to print all the names of the various lights in my scene I just have to run:

for light_obj in Application.ActiveSceneRoot.FindChildren("*", "light"):
    print light_obj.Name

What this code is doing is firstly navigating to the “Scene_Root” (Application.ActiveSceneRoot gets the active “Scene_Root” model). We could also do this with Application.Dictionary.GetObject("Scene_Root", False). Just like how we got the sphere, though this way is a bit less to type.

Then it’s looking for all the children under the Scene_Root that have the name “*” (remember the asterix means match everything) and are the Type “light”.

2 thoughts on “Part 2 – Finding How to Access Parameters Visually

  1. Pingback: Start Here!!! « Conquering the Code in Softimage Xsi

  2. Pingback: Start Here!!! | Conquering the Code in Softimage Xsi

Leave a comment