# 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
```

# Friday Flashback #19 The Complete Line of Digital Media Creation

SOFTIMAGE Resource Guide Summary 1997

From the Summer 1997 Resource Guide, an ad for the complete line of digital media creation: 3D, Digital Studio, Toonz, and Eddie.

# 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.