Installing PyQtForSoftimage in Softimage 2015


I use the Python 2.7.3 that comes with Softimage 2015 SP1, but I do also have Python 2.7 installed on my system.

  1. Download and install PyQt.
  2. Set the PYTHONPATH environment variable to point to the location of PyQt4. You could do this in setenv.bat, or in the System environment variables. In my case, I set it in setenv.bat to point to C:\Python27\Lib\site-packages, which is where I installed PyQt.
  3. Download and install the PyQtForSoftimage addon.
  4. Check that everything is working. Open the Plug-in Manager, find PyQtForSoftimage, and run some of the examples.

[ICE] Converting integers to strings


Thanks to Mootzoid emTools, it’s easy to convert an integer to a string:
int2str_emtools
Note that you get padding too, so it’s easy to do things like generating replacements for the [Frame] token.
int2str_emtools_ntoa
The emTools string compounds are convenience compounds:
int2str_emtools_ntoa

For fun, I tried to create my own integer-to-string converter using the stock nodes. I did by dividing by 10 until the quotient (the result) was zero; with each division, I take the remainder and stick it at the front of the string. And by setting Max Repeat to 4, I get padding on my strings (so for integer 45 I get “0045”).
int2str_intdiv
Note the use of Delay Set Data. The integer division compound uses Modulo and Division by Scalar. The 2char compound simply uses a Select Case to map a single digit to a string:
int2str_2char

It did occur to me that I could do it all with a single Select Case :)
int2str_selectcase
The catch is that the Select Case node has ten thousand cases.
int2str_selectcase_ppg
That’s really slow when you create that node in an ICE tree (for example, by importing a compound that uses it). It also takes a long time to create ten thousand cases, even with a script.

case_node = Application.AddICENode("$XSI_DSPRESETS\\ICENodes\\SelectCaseNode.Preset", "pointcloud1.pointcloud.ICETree")
string_node = Application.AddICENode("$XSI_DSPRESETS\\ICENodes\\StringNode.Preset", "pointcloud1.pointcloud.ICETree")

Application.ConnectICENodes("{0}.case0".format( case_node.FullName ), "{0}.result".format( string_node.FullName ) )
Application.DeleteObj( string_node.FullName )
Application.SetValue("{0}.case{1}_string".format( case_node.FullName, 0), "{0:0>4}".format(0), "")
Application.SetValue("{0}.default_string".format( case_node.FullName, "9999", "")

for i in range(1,10000):
	Application.AddPortToICENode("{0}.case{1}".format( case_node.FullName, i-1), "siNodePortDataInsertionLocationAfter")
	Application.SetValue("{0}.case{1}_string".format( case_node.FullName, i), "{0:0>4}".format(i), "")

Friday Flashback #207


‘Theocracy of Hackers’ Rules Autodesk Inc., A Strangely Run Firm
Can the Latest CEO Survive A Cabal of Programmers Who Send ‘Flame Mail’?

May 28, 1992
Just as Microsoft Corp., the world’s largest software supplier, is an extension of the personality of William Gates III, Autodesk is largely a creature of Mr. Walker. Like Mr. Gates, Mr. Walker is superb at identifying computer trends and spreading his vision to the troops. But unlike Mr. Gates, Mr. Walker, 42, never really wanted to run his company. “I’m an engineer, I’m a programmer, I’m a technologist,” he says. “I have no interest in running a large U.S. public company, and I never have. It was a means to an end to accomplish the technological work I wished to achieve.”

He relinquished the top spot in 1986 to Alvar Green, formerly Autodesk’s chief financial officer, to return to programming. But the real power still rested with Mr. Walker, Autodesk’s biggest shareholder, and an elite group of programmers called “Core,” who had either helped Mr. Walker found the company in 1982 or led its most important projects.

Core members are contentious, eccentric free-thinkers who have had a way of devouring professional managers. They have often attacked each other and company executives, usually by sending “flame mail” — biting electronic letters. The outbursts sometimes have led to changes, and sometimes brought work to a halt. “The whole company is a theocracy of hackers,” says Charles M. Foundyller, president of Daratech Inc., a market research firm in Cambridge, Mass.

— from a 1992 article in the Wall Street Journal

Continue reading

[Scripting] Opening a page in a web browser


Here’s a couple of ways to open a URL in a web browser from inside Softimage. Unfortunately, these worked on Windows only. On Linux, the JScript can’t create that ActiveX object, and the Python didn’t do anything.

JScript:

// Open a web page in the default browser
var objShell = new ActiveXObject("shell.application");
objShell.ShellExecute("http://support.solidangle.com", "", "", "open", 1);

Python:

import webbrowser
webbrowser.open( 'http://support.solidangle.com' )