Using arrays instead of loops in ICE


Here’s a simple example of using an array instead of a loop in an ICE tree.
In general, for performance, you’d like to avoid repeats and loops in ICE.
This post is in repsonse to this thread.

var u = 4;
var x = -.05;
for (i=1; i <= u-1; i++) {
	x = x + 1/u ;
	LogMessage( x );
}
// INFO : 0.2
// INFO : 0.45
// INFO : 0.7

GraphicSpeak » Luxology and Softimage add Bullet to their arsenal


GraphicSpeak » Luxology and Softimage add Bullet to their arsenal.

Bullet and Autodesk Softimage
Exocortex Technologies is distributing a plug-in for Softimage alled Momentum 2.0 for $149. It was developed by Helgee Mathee of the University of Hamburg, a prolific plug-in developer for Softimage. Momentum simulates rigid bodies and is used to simulate ropes, the behavior of plastics, soft bodies, and cloth.

Checking if an ICE node is part of a connected branch


Here’s a little recursive function that checks whether the selected ICE node is part of a branch that is connected to the terminal ICE Tree node.

I used IsConnected to check whether a node is connected to some other node, and then I traverse the output ports, getting the connected nodes, until I reach the ICE Tree node (or not).

var o = Selection(0);
//LogMessage( o.IsConnected );
LogMessage( "isBranchConnected()="+isBranchConnected(o) );


// Given an ICE node, check if the node is part
// of a branch connected to the ICE Tree node
function isBranchConnected( oNode )
{
	if ( !oNode.IsConnected )
	{
		return false;
	}
	else if ( oNode.Type == "ICETree" )
	{
		return true;
	}
	else
	{
		oEnum = new Enumerator( oNode.OutputPorts ) ;
		for (;!oEnum.atEnd();oEnum.moveNext() )
		{
			var oSelItem = oEnum.item() ;
			oEnum1 = new Enumerator( oSelItem.ConnectedNodes ) ;
			for (;!oEnum1.atEnd();oEnum1.moveNext() )
			{
				var oSelItem1 = oEnum1.item() ;
				return isBranchConnected( oSelItem1 );
			}
		}
	}
}

And here’s a Python version. With Python, I always have the nagging feeling that my code code be better.

# Given an ICE node, check if the node is part
# of a branch connected to the ICE Tree node
def isBranchConnected( oNode ):
	if not oNode.IsConnected : 
		return False
	elif oNode.Type == "ICETree" :
		return True;
	else:
		for port in oNode.OutputPorts:
			for node in port.ConnectedNodes:
				return isBranchConnected( node )



o = Application.Selection(0);
Application.LogMessage( "isBranchConnected()=" + str(isBranchConnected(o)) );

Changing the mini-dopesheet Show Keys settings


To change the type of keys shown in the mini-dopesheet in the timeline, you set the same preferences used by the full dopesheet:

// Marked Parameters
Preferences.SetPreferenceValue( "dopesheet.timeline_display_keys",2 );

//Current Character Set
Preferences.SetPreferenceValue( "dopesheet.timeline_display_keys", 11 );

So, to toggle between Show Keys > Marked Parameters and Show Keys > Current Character Set, you could do something like this:

var x = Preferences.GetPreferenceValue( "dopesheet.timeline_display_keys" );
x = ( x==2 ) ? 11 : 2;
Preferences.SetPreferenceValue( "dopesheet.timeline_display_keys", x );

Combining mental mill CgFX shaders with Softimage and ICE FX trees


This video demonstrates how to export a CgFX shader from mental mill to softimage and combine it with an Ice Effect tree.
It shows techniques to augment your exported CgFX code by hand editing the exported CgFX code and passing data that was generated by an ICE FX tree in softimage to the shader. This enables you to create a completely new type of effects.

Here’s the corresponding mentallmill.blogspot post.

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

http://vimeo.com/23877816

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 )