Integer division in ICE


Dividing an integer N by itself doesn’t always give you 1.
IntegerDivision1
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:
IntegerDivisionCompound

IntegerDivision3

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:
texture_support_sdk_explorer

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)

Friday Flashback #154


What was happening on the XSI list 13 years ago?

In the past few weeks, I’ve compiled annual summaries for five different lists, so here’s one more, this time for Jan 2001 on the XSI mailing list.

I pulled a listing of the Jan 2001 posts out of the wayback machine, and stuffed them into a word cloud. There were a lot of names I recognized; many of them still posting on the list. Do you see yours? 🙂
xsi-list-jan-2013

There were almost a thousand posts. Here’s the top topics of discussion:

  • Hmmm – Back at work NO LICENSES!!!!! 44
  • import export? 19
  • lic problems 16
  • Is it just me…? 16
  • Walk cycle in the animation mixer 14
  • Scripting book 14
  • refresh problem …. 13
  • Home Studio 12
  • XSI 1.5 available for download 11
  • FW: making walls? 10
  • bump map problem 9
  • Camera preset .. 9
  • symmetry – modelling 9
  • No Subject 8
  • colored shadows? how? 8
  • Doing character stuff… 8
  • Disappearing Particles. 7
  • Chortle 7
  • import export? 7
  • WISHLIST for 2.0 7
  • key 7
  • Pentium4 6
  • colored shadows!!! Works great! 6
  • Bump Map 6
  • BONNE ANNEES 6
  • XSI SDK again!! 6
  • shapes and adding deformers AFTER en 6
  • SOFTIMAGE should buy Rhino: NURBs Bo 6
  • desperately seeking FUR 6
  • shrinking at joint 6
  • TRIMS and others 6
  • LAST ONE::: Hmmm – Back at work NO LICENSES!!!! 6

XSI 1.5 inspired a lot of discussion, there were many small threads about that update:

  • XSI 1.5 available for download
  • Measuring length of a curve in 1.5?
  • installing 1.5
  • [1.5 does it really exist?] Dahhhhh
  • 1.5 Anyone? YES ITS COMMING :-))
  • 1.5
  • 1.5 CRASHES
  • 1.5 Anyone?
  • XSI 1.5 available for download
  • XSI 1.5 is here at last!!
  • 1.5 CRASHES
  • 1.5 Anyone?
  • Fix in 1.5?
  • installing 1.5
  • Status : 1.5 ???
  • [Fix in 1.5?]
  • #28 on page 146 of 1.5 Tutorial Book! –
  • 1.5 Anyone? YES ITS COMMING :-))
  • #28 on page 146 of 1.5 Tutorial Book!
  • Status : 1.5 ???
  • Fix in 1.5?
  • 1.5 does it really exist?

Top posters

  • Kim Aldis (124)
  • André Adam (42)
  • Stefan Andersson (37)
  • Meg Ward (30)
  • Arvid Björn (28)
  • Pierre Duranleau (21)
  • Chet Kenisell (19)
  • Thomas Groppi (17)
  • Thierry Baret (15)
  • Chris Marshall (15)

Missing ICE nodes in the preset manager


I’ve noticed this a handful of times, where a node like Get Data isn’t found in the preset manager. Clicking the Update button always fixes it for me.
get_data_missing
The last time this happened, instead of clicking Update, I started Process Monitor and did a few more searches in the preset manager. In my case, Softimage searching only the compounds, not the presets in %XSI_HOME%\Data\DSPresets\ICENodes. That’s why nodes like Get Data weren’t found.

Clicking Update forced Softimage to search both the compounds and presets.

Context matters: Using weightmaps with point clouds


A weightmap is per-point, but it’s per-point on the emitting geometry, not the point cloud. So you can’t just do a plain “get weights” if you want to use the weightmap to control particle values like Velocity or Speed.
weightmap_context_mismatch

Instead, you use get a location, like the particle emit location, and then get the weightmap value at that location. Then you’ll have a particle per-point context to work with.
weightmap_at_location
When you get the weight at a location, you get an interpolated weight value.