Scripting: Toggling the constraint compensation mode

Here’s one way, using the not operator.

si = Application

The “problem” with this approach is that you’re toggling between 0 and -1, not between 0 and 1 (when you click the CnsComp button in the UI, you set the pref to either 0 or 1). The -1 happens because not 0 is -1.

Application.LogMessage( True == 1 )
Application.LogMessage( False == 0 )
Application.LogMessage( not False == -1 )
# INFO : True
# INFO : True
# INFO : True

So here’s a couple of other ways to toggle the preference value:

si = Application
si = Application
toggle = [1,0]

The default project

The default project is the active project at startup (the project whose name appears in the Softimage title bar).

19-03-2013 4-45-51 PM

When you first install Softimage, the default project is XSI_SAMPLES.

After that, as you open scenes and exit and restart Softimage, the default project becomes the project that contained the scene you last opened. This is saved in your Default.xsipref file like this:

data_management.last_sequence_dir	= C:\Users\SOLIDANGLE\Projects\My Project\Scenes

But you can explicitly set a default project with the Project Manager, then that is saved in your Default.xsipref like this:

xsiprivate_unclassified.DS_SZ_LOAD_DEFAULT_PROJECT	= #STRI#C:\Users\SOLIDANGLE\Projects\Support

Might as well…change the default scene renderer

Goodbye for now, mental ray. Arnold is now my default scene renderer 🙂

File > Preferences > Rendering

Now everytime I start Softimage or create a new scene, Arnold will be the scene renderer. And I’ll have an Arnold light by default (Arnold doesn’t support the default Softimage lights).

And you’ll have all the Arnold render channels.

The SItoA addon includes some events for setting up new scenes when Arnold is the default renderer.

Number of Undo Levels reset to zero

If you’re having problems with your Undo Levels being reset to zer0, it could be a C++ plugin that’s doing it (or less likely, a NetView page). C++ plugins (and NetView pages) that set the Undo Levels to 0 and then don’t restore it, either by oversight or because of a crash/error, can leave you with your Undo Levels set to 0.

In constrast, we prevent scripts and script-based plugins from changing the Undo Level permanently: as soon as the script finishes execution, Softimage resets the General.undo preference to its default value.

For example, if you run this in the script editor:

Application.SetValue("preferences.General.undo", 0, "")

You’ll see this logged in the script history:

# VERBOSE : Restoring preference changed by script: General.undo

Understanding the new Licensing check interval

As of the 2013 release, you can now set up your license server and Softimage workstations so that idle licenses are reclaimed by the license server and distributed to other machines.

An instance of Softimage (xsi.exe) is considered idle when there is no mouse or keyboard interaction, no command or script running, and no active progress bar. Softimage is never idle in batch mode.

2013 includes a new Licensing check interval preference (Preferences > General). Basically, this “check interval” is how long Softimage can be idle before it will give up its license. By default, the Licensing check interval is 1 minute. That means that if Softimage is idle for a minute, then the license server could reclaim the license and give it to some other user. To disable the license time-out feature, set the check interval preference to 0.

By default, the license server does not reclaim licenses when Softimage is idle. To configure the license server to reclaim idle licenses, you need to set the TIMEOUT option. To do that, create a plain text file named adskflex.opt in the same folder where your license file is located.

To set the TIMEOUT to 60 minutes for an Entertainment Creation Suite Ultimate license:

TIMEOUT 85926ENCSU_2013_0F 36000

To set the TIMEOUT for a 2012 Softimage license:

TIMEOUT 85705SFTIM_2012_0F 36000

You will need to restart the server to read the changes to the options file.

With the TIMEOUT option set on the license server, the next time your Softimage is idle for longer than the check interval, the license server may reclaim the license to give to another user. When you start working actively with Softimage again, it will try to check out another license from the server. If it gets a license, you’ll keep working and you’ll never know your license had been “lost” while idle.

However, if no licenses are available, you’ll see this:

and then you’ll have a chance to save your work:

Adding a button to save preference changes

Softimage saves your preferences to %XSI_USERHOME%\Data\Preferences\default.xsipref when you exit Softimage.
If you want to save your current preferences, you can use the Preferences.SaveChanges() method.

Just drag this JScript to a toolbar to create a script button.

// JScript

For example, you could create a button on the Custom tab of the main shelf (View > Optional Panels > Main Shelf):

You probably want to make the button a Script Command (external file), so you can assign a keyboard shortcut to it.