More on getting the version of Softimage used to create a scene


Whenever you open a scene, you’ll see a message like this logged to the script history:

# INFO : 4034 - Loaded scene was created with build number: 10.5.98.0 - compatibility version: 1000
Application.OpenScene("C:\\Users\\blairs\\MyProject\\Scenes\\2012SAP_Scene.scn", "", "")

# INFO : 4034 - Loaded scene was created with build number: 10.1.62.0 - compatibility version: 1000
Application.OpenScene("C:\\Users\\blairs\\MyProject\\Scenes\\2012SP1_Scene.scn", "", "")

If you want to know the version of Softimage that was used to create the scene, you need to check the specific build number (and there’s a couple of ways to do that, we’ll get to that in a second…).

The compatibility version is more a property of Softimage itself than of the scene. You can get the value of the project.CompatibilityVersion parameter, but it’s always going to be the compatibilty version of the current Softimage instance, not of the loaded scene.

p = Application.Dictionary.GetObject( "project.CompatibilityVersion" )
print Application.ClassName(p)
print p.Value

# OR

print Application.GetValue( "project.CompatibilityVersion" )

To find out the version of Softimage used to “build” a scene, you can use the printver utility, or look in the scntoc file. In this context, “build” means the version of Softimage that was last used to save the scene. I note that just opening a scene and saving it isn’t enough to bump up the build version. You need to do something to the scene, or at least do something and then undo it.

From Jeremie Passerin on the Softimage mailing list, here’s a Python snippet that reads the version from the scntoc:

# Python Code
import xml.etree.ElementTree as etree

ext = 'scntoc'
scn = 'C:\\Users\\blairs\\Project\\Scenes\\Test.%s' % ext

tree = etree.parse( scn )
root = tree.getroot()
version = root.get("xsi_version")

LogMessage(version)

Here’s a JScript snippet that reads the version from the scntoc:

var dom = new ActiveXObject("msxml2.DOMDocument.6.0");
dom.async = false;
dom.resolveExternals = false;

ext = 'scntoc';
scntoc = 'C:\\Users\\blairs\\Project\\Scenes\\Test.' + ext;

dom.load( scntoc );
var oNode = dom.selectSingleNode("xsi_file");
LogMessage( oNode.getAttribute( "xsi_version" ) );

If you don’t want to rely on the existence of a scntoc, you could use the printver.exe utility that ships with Softimage. Given a scene file, printver prints a message that looks like “This Scene was built with version: 11.0.525.0”.

Here’s a JScript snippet that runs printver and gets the version number from STDOUT:

// JScript
var WshShell = new ActiveXObject("WScript.Shell");

scn = "\\\\server\\Project\\Scenes\\Whatever.scn"

sExec = "printver " + scn

var oExec    = WshShell.Exec( sExec );

while ( !oExec.StdOut.AtEndOfStream )
{
	s = oExec.StdOut.ReadLine();
	if ( s.indexOf("This Scene was built with version") != -1 )
	{
		var version = s.split(":")[1].replace(/^\s\s*/, '').replace(/\s\s*$/, '');
	}
}

LogMessage( version )

And here’s a Python snippet:

import subprocess

scn = 'C:\\Users\\blairs\\Documents\\Support\\Project\\Scenes\\MySphere.scn'
p = subprocess.Popen( 'printver -l %s' % scn, stdout=subprocess.PIPE )
stdout = p.stdout.readlines()
print stdout
print stdout[-1].split(':')[1].lstrip().rstrip()

See the thread on the Softimage mailing list, which includes a VBScript snippet for getting the build version.

2 thoughts on “More on getting the version of Softimage used to create a scene

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s