The dirty count


You can read more about the dirty count in the Softimage KB article Scripting – Understanding the dirty count parameter.

This example JScript uses the dirty count to determine whether or not the current scene has been saved.

function IsSceneSaved()
{
	var dirtycount = Dictionary.GetObject( "Project.dirtycount" ).Value;
	var models = FindObjects( null, "{0496EAB0-0ECF-11d1-ABF1-00A02485CECB}" )
	 
	oEnum = new Enumerator( models ) ;
	for (;!oEnum.atEnd();oEnum.moveNext() )
	{
		var model = oEnum.item() ;
		dirtycount += Dictionary.GetObject( model.FullName + ".dirty_count" ).Value
	}

	LogMessage( dirtycount );
	return( dirtycount );
}
LogMessage( IsSceneSaved() == 0 ? "Scene is clean" : "Scene is dirty" );

Yahoo pipe for aggregating Softimage RSS feeds


http://pipes.yahoo.com/softimage

I created a Yahoo pipe to aggregate the following feeds:

  • Posts on the product support blog
  • New KB articles at autodesk.com/softimage-support
  • AdskSoftimage tweets
  • New tutorials, tips, plugins, and scripts on the Area

You can go directly to the pipe here: http://pipes.yahoo.com/softimage/info. I prefer the List view myself.

You can even get an RSS feed for the pipe:
http://pipes.yahoo.com/pipes/pipe.run?_id=f262500e7930b67bb97e91f36c8dfbdc&_render=rss

Note: the pipe filters the RSS feeds from the Area looking for the keyword “Softimage” and “xsi” in the title and description. This works pretty well for tutorials, tips, and plugins, but not so well for scripts. Most of the scripts posted on the Area don’t use the words “Softimage” or “xsi” in either the title or description.

Adding a password field to a PPG


You can use the Edit styles defined in WinUser.h with siUIStyle to get a password-entry text box. The ES_PASSWORD style displays all characters typed by the user as asterisks (*).

var oCustomProperty = XSIFactory.CreateObject( "CustomProperty" );
oCustomProperty.AddParameter( "password", siString, siClassifUnknown, siSilent, "", "", "", "", 0, 1, 0, 1 );

oLayout = oCustomProperty.PPGLayout;
oLayout.Clear();

var oItem = oLayout.AddItem( "password", "Password", siControlEdit );
oItem.SetAttribute( siUIStyle, 32 ); // #define ES_PASSWORD         0x0020L

InspectObj( oCustomProperty );

On the XSI list, see the thread PPG with star password input?

Changing the default values on a PPG


A colleague wanted to use Polygon Reduction on a heavy face mesh, but he didn’t want to apply the Polygon Reduction op with the default 50% Ratio. So he asked me how to change the default values in the Polygon Reduction ppg.

PPG default values come from the preset, so we changed the ratio default, backed up the factory default preset, and then saved a new default preset from the PPG. Not recommended practice, but it worked. Another, safer, way would be to save a preset in the User location and then apply that preset:

var o = ApplyTopoOp(“MyPolygonReduction2.Preset”, “face-mesh”, siUnspecified, siPersistentOperation, null);
InspectObj(o);

HT: luceric:

Default values in spdls are never used except for shaders. In the case of shaders, these default values are used when creating a preset with spdl2preset. For all other types of objects the default value is never even looked at. Softimage developpers have often mistakenly put a “default=” in spdls even though this value is ignored.
The default values for comes from the preset file. To change them, save the preset of the property page on top of the preset file used to create that primitive. These presets are found in the DSPreset folder of the XSi installation. However be aware that this may affect the result of scripts that create these primitives. So it’s best not to change them, and instead write a script that changes the values to what you want.

Finding hidden ICE attributes


In ICE, hidden attributes have names that start with two underscores (__). Hidden attributes don’t show up in the attribute explorers, but you can use scripting to find the hidden attributes:

var pc = Dictionary.GetObject( “PointCloud” );
var oPointCloudGeometry = pc.ActivePrimitive.Geometry;

oEnum = new Enumerator( oPointCloudGeometry.ICEAttributes.Filter( “”, “”, “__*” ) ) ;
for (;!oEnum.atEnd();oEnum.moveNext() )
{
var oSelItem = oEnum.item() ;
LogMessage( oSelItem.fullname );
}

Bookmarking in the script editor


It’s documented in the SDK guide, but not in the User’s guide, so you may not know that the script editor supports bookmarks.

You can use Ctrl+F2 to set bookmarks in the script editor, and F2 and Shift+F2 to go to the next/previous bookmark. Ctrl+Shift+F2 clears all bookmarks.

By default, bookmarked lines are highlighted in the editing pane:

If the Selection Margin preference is set, then bookmarked lines are indicated by an icon in the margin:

HT: Chinny

Passing data from ICE into a scene


You can use Set Data to write ICE attribute values to custom parameters (and Get Data to go the other way).

For example, you can use ICE to get the length of a curve and then store the length in a custom parameter.

Note: This didn’t work when I used the name “curve_length” for my custom parameter. The custom parameter value never changed.