The Autodesk privacy policy is 5000+ words long.
Screenshots of the week
Friday Flashback #156
Getting all shaders under a light
Given something like this:

Here’s how you get all shaders under a light, even the disconnected ones:
from sipyutils import si # win32com.client.Dispatch('XSI.Application')
from sipyutils import log # LogMessage
from sipyutils import C # win32com.client.constants
from sipyutils import disp # win32com.client.Dispatch
si = si()
def dispFix( badDispatch ):
import win32com.client.dynamic
# Re-Wraps a bad dispatch into a working one:
return win32com.client.dynamic.Dispatch(badDispatch)
oLight = si.Selection(0)
#import win32com.client
oDisconnected = disp( "XSI.Collection" )
if oLight.IsClassOf( C.siLightID ):
for oShader in oLight.GetAllShaders():
oOut = dispFix( oShader.Parameters( "out" ) )
if oOut.Targets.Count == 0:
oDisconnected.Add( oShader )
log( oDisconnected.GetAsText() )
Hat tip: Matt Lind, who provided the GetAllShaders answer to the question “how to get all shaders in a light, even the disconnected ones”
Using ICE attributes to control point light instances
Integer division in ICE
Dividing an integer N by itself doesn’t always give you 1.

I think it’s a problem in the Divide by Scalar node (the division is probably returning a scalar like 0.99999999, and then that is truncated to zero when it is converted to an integer).
A workaround is to do all your division with scalars, and then use modulo to determine whether you Round or Floor the result. Here’s an example compound by Guillaume Laforge:

Screenshots of the week
Follow surface compound
by Mochio

ICE Modeling Tutorial: Generating a Forest
Friday Flashback #155
The future of 3d animation began 14 years ago on this day, Jan 17th. Was it worth the wait?

Teaser from http://www.3dwillneverbethesame.com
Getting the texture support created by CreateProjection
Here’s the question: How do you get the texture support created by CreateProjection?
You’re supposed to be able to get the support name from an output argument, but that doesn’t work.
from sipyutils import si # win32com.client.Dispatch('XSI.Application')
from sipyutils import log # LogMessage
from sipyutils import C # win32com.client.constants
si = si()
x = si.CreateProjection("sphere", C.siTxtSpherical, "", "SupportName", "Texture_Projection", "", "", "")
log( x.Value("SupportName") == None )
log( x.Count );
log( x(0) == "" );
log( x(1) );
So instead, I get the PropertyName and from CreateProjection and work my way over to the texture support, via the TextureOp.
import win32com.client
from sipyutils import si # win32com.client.Dispatch('XSI.Application')
from sipyutils import log # LogMessage
from sipyutils import C # win32com.client.constants
si = si()
def dispFix( badDispatch ):
import win32com.client.dynamic
# Re-Wraps a bad dispatch into a working one:
return win32com.client.dynamic.Dispatch(badDispatch)
o = si.Selection(0)
x = si.CreateProjection(o, C.siTxtSpherical, "", "Texture_Support", "Texture_Projection", "", "", "")
#CreateProjection( [InputObjs], [Type], [UVDefaultType], [SupportName], [PropertyName], [Parenting], [Fitting], [Camera] );
y = win32com.client.Dispatch( "XSI.Collection" )
y.Items = "%s.polymsh.cls.*.%s" % (o.FullName, x.Value("PropertyName") )
log( y.Items )
txtprop = si.Dictionary.GetObject( y(0).FullName )
op = txtprop.NestedObjects( "TextureOp" )
# re-dispatch it to avoid "object has no attribute 'InputPorts'" error
op = dispFix(op)
txtsupp = op.InputPorts(2).Target2.Parent3DObject
log( si.ClassName(txtsupp) )
si.SelectObj( txtsupp )
The SDK Explorer is good for finding these kinds of port connections:

PS: Here’s a JScript version.
x = CreateProjection("cylinder", siTxtPlanarXY, siTxtDefaultSpherical, "Texture_Support", "Texture_Projection", null, siRelDefault, null);
var y = new ActiveXObject( "XSI.Collection" );
y.Items = "cylinder.polymsh.cls.*." + x.Value("PropertyName")
txtprop = Dictionary.GetObject( y(0).FullName );
op = txtprop.NestedObjects( "TextureOp" );
txtsupp = op.InputPorts(2).Target2.Parent3DObject
LogMessage( ClassName(txtsupp) );
SelectObj( txtsupp )
Getting the selected FxTree nodes
You can use the undocumented selectednodes attribute, which was added in Softimage 2014.
views = Application.Desktop.ActiveLayout.Views
v = views.Find("Fx Tree") or views.Find("View Manager").Views.Find("Fx Tree")
if v:
print v.GetAttributeValue("selectednodes") # None
The FxTree view also has a targetcontent attribute, which is documented.
* hat tips to csaez (code) and luceric (attribute)





