The case of the missing protocol file


So, a customer called to report another no interactive network license available problem. We quickly narrowed it down to a problem with the license server: it wouldn’t start. Start Server said “Server started successfully”, but Perform Status Enquiry said FLEXnet Licensing error:-15,570. Everything about the license file checked out ok: it had the right MAC address, it had the right computer name, it had the right license features. But still the server wouldn’t start.

I was already WebEx’d into the customer’s computer, so I downloaded Process Monitor and used it to track what LMTOOLS was doing when I clicked Start Server.

When you click Start Server, lmtools.exe starts the service lmgrd.exe, so I filtered for all Processes that started with “lm”.

Scrolling down through the log, I soon saw a possible problem: repeated NAME NOT FOUND entries for the same file:

To check whether LMTOOLS eventually did find the protocol file, I right-clicked “C:\windows\system32\drivers\etc\protocol” and clicked Include, to include only the log entries for the protocol file.

And sure enough, the protocol file was never found. So I copied over the protocol file from my system, and then I was able to start the license server.

Without Process Monitor, the only clue I had was this one line in the LMTOOLS debug log file:

(lmgrd) Failed to open any default TCP port.

Deleting reference material libraries


How do you get rid of a reference material library when you don’t need it anymore in a scene? If you try to delete it, you just get this message “ERROR : Invalid procedure call or argument: ‘DeleteObj’ “.

To delete a reference material library, you have to unlock it first:

– Open the explorer.
– Change the scope to Materials.
– Right-click the reference material library, click Locks, and then click Unlock all levels.
– Now you can delete the reference material library.

Getting Python to show up in Softimage


Notes

  • Softimage does not support Python 3, so install Python 2.6.x or earlier.
  • We recommend using pywin32 212 (there’s a problem with 214 can cause a crash on exit).

Three easy steps:

  1. Install Python.
  2. Install the corresponding version of pywin32.
    For example, if you installed Python 2.5 on 32-bit Windows, then install pywin32-212.win32-py2.5.exe.
  3. Check that the Python path is included in your PATH system environment variable.
    If your PATH doesn’t include the Python install folder, then Python won’t show up in Softimage.

You can get the 64-bit versions (Linux and Windows) of Python for Softimage here.

The most recent install of pywin32 determines which version of Python is available in Softimage. If your version of pywin32 doesn’t match up to an installed version of Python, then Python won’t show up in Softimage.

Sprite sequences on ICE particles


You can display sprites (an image sequence) on ICE particles.

Just set up a render tree on the point cloud that uses an image sequence, and then use an ICE attribute to drive the Time Source of the image sequence.

First, here’s a basic render tree for the point cloud:

In the ICE Tree for the point cloud, you can set up an attribute that will be used as the Time Source for the image sequence. For example, suppose you wanted to randomly display a sprite from a sequence. In the ICE Tree, you could put a random number in an attribute for each particle.

Then you could use that attribute to drive the Time Source of the image sequence:

Scripting: Replacing nodes in the render tree


To get this script to work in 2011 and later, you need to do this to find the Blinn shaders:

// Get a collection of all Blinn nodes
var sProgID = "Softimage.material-blinn.1.0" 
var oShaderDef = Application.GetShaderDef( sProgID ) ;  

var oBlinnCollection =  oShaderDef.ShaderInstances ;  
if (debug) LogMessage( "Found " + oBlinnCollection.Count + " Blinn shaders" );


The rest of the script can stay the same.
Note: I split the script into two parts below, for the purposes of this blog post. Just combine them to get the full script.

Here’s a script that shows how to replace every Blinn shader in a scene with a Phong shader.
There’s other ways to do it, but I used the connection stack.

var debug = 0;

// Class ID of the Blinn shader in XSI
var sClassID = "{8FAC63AC-E392-11D1-804C-00A0C906835D}";
SetValue("preferences.scripting.cmdlog", false, null);

// Get a collection of all Blinn nodes
var oBlinnCollection = FindObjects( null, sClassID );
if (debug) LogMessage( "Found " + oBlinnCollection.Count + " Blinn shaders" );

// Loop over the Blinn collection and replace all Blinn nodes with Phongs
var s = new Date();
oEnum = new Enumerator( oBlinnCollection ) ;
for (;!oEnum.atEnd();oEnum.moveNext() )
{
	var oBlinn = oEnum.item() ;

	// try catch will skip over any TransientObjectContainer.Blinn shaders we find
	try
	{
		var oMaterial = oBlinn.Owners(0);
	}
	catch(e)
	{
		LogMessage( "Skipping " + oBlinn );
		continue;
	}
	LogMessage( "Replacing " + oBlinn );
	blinn2phong( oMaterial, oBlinn );
}
var e = new Date();
LogMessage( "Finished replacing Blinn shaders. Elapsed time: " + (e-s)/1000 + "s" );



function blinn2phong( oMaterial, oBlinn )
{
	// Create a new Phong node
	var oPhong = CreateShaderFromPreset("$XSI_DSPRESETS\\Shaders\\Material\\Phong.Preset", oMaterial, null);

	// Get the node connections from the ConnectionStack
	// And then insert the Phong node

	var oDR = XSIUtils.DataRepository ;
	var strOpInfo = oDR.GetConnectionStackInfo( oBlinn );

	var oTopNode = ParseXML( strOpInfo ) ;
	var oConnections = oTopNode.childNodes ;

	if ( oConnections.length == 0 )
	{
		LogMessage( "Cannot replace the Blinn node " + oBlinn + " .It has no connections." );
	}
	else
	{

		for ( var i = 0 ; i < oConnections.length ; i++ )
		{
			var oConnection = oConnections(i) ;
							
			strtype = SafeGetNodeValue( oConnection, "type", "Unknown" ) ;
			strobj = SafeGetNodeValue( oConnection, "object", "Not Connected" ) ; 
			localparam = SafeGetNodeValue( oConnection, "localparameter", "&nbsp;" ) ;  
			destparam = SafeGetNodeValue( oConnection, "remoteparameter", "&nbsp;" ) ;  				
			
			if ( strtype == "in" )
			{
				var oParam = oPhong.Parameters( localparam );
				if ( oParam == null )
				{
					LogMessage( "Cannot connect " + strobj + " to Phong." + localparam + ". That parameter does not exist.", siWarning );
				}
				else
				{
					//SIConnectShaderToCnxPoint("Sources.Materials.Proteus_Body_MatLib_Proteus.MAT_Brass11.Image5", oPhong + ".ambient", false);
					SIConnectShaderToCnxPoint( strobj, oParam );
					if( debug ) LogMessage( "IN: " + strobj + ", " + oParam );
				}
			}
			if ( strtype == "out" )
			{
				var oTarget = Dictionary.GetObject( strobj );
				var oParam = oTarget.Parameters( destparam );
				//SIConnectShaderToCnxPoint("Sources.Materials.Proteus_Body_MatLib_Proteus.MAT_Brass11.Phong1", "Sources.Materials.Proteus_Body_MatLib_Proteus.MAT_Brass11.Mix_2colors.base_color", false);
				SIConnectShaderToCnxPoint( oPhong, oParam );
				if( debug ) LogMessage( "OUT: " + oPhong + ", " + oParam );
			}
		}	
	}
}

The bling2phong() function is based on the code that builds this HTML page in the SDK Explorer:

Notice how the Connection Stack Details give you everything you need to replace a Blinn node with some other node in the render tree:

See below the cut for the code for the helper functions ParseXML() and SafeGetNodeValue().
Continue reading

Saving the size and position of the render tree


If you use a custom layout, you can save the size and position of floating views such as the Render Tree.
In the online User’s Guide, look up windows:setting default size and position.

You could also use a toolbar button to run a script that opens the render tree with the desired size and position. For example:

var layout = Application.Desktop.ActiveLayout;
var v = layout.CreateView( "Render Tree", "Render Tree" );
v.Move( 10, 10 );
v.Resize( 1000,1000 );

Crosswalk not available in Maya


You installed the latest Crosswalk, but you don’t see it anywhere in Maya when you try to export.

Usually, this is all you have to do to make Crosswalk available in Maya:

  1. In Maya, click Window > Settings/Preferences > Plug-in Manager.
  2. Find the dotXSISceneConverter plug-in and select the Loaded and Auto load check boxes.
  3. Now when you export, you will see the Autodesk Crosswalk Exporter (.xsi) option in the Files of Type list.