Undocumented environment variables #2



This undocumented env var was mentioned on the XSI mailing list back in 2008 (ice tree background), but I found out about it another, more brute force, way.

* undocumented env var #1 was XSI_DISABLE_NEW_PICK (see also here, where XSI_DISABLE_NEW_PICK is a workaround for failed component selection in a virtual environment like Parallels)

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

Preset Manager and custom material presets

Just in case you were wondering how to add new material presets to the Preset Manager, because I was and I spent a bunch of time trying…

The Preset Manager won’t pick up presets from anywhere else but the factory location (%XSI_HOME%\Data\DSPresets\Materials).

At first I thought I was doing something wrong. Then I used Process Manager to confirm that Softimage wasn’t loading presets from my User location. Then I checked for old bug reports/feature requests, and I double-checked the actual code for the preset manager.

There’s an environment variable XSI_DSPRESETS that specifies the location of the material presets, but you cannot use it to override the factory location. Even if you change that environment variable, Softimage reads only the factory Data\DSPresets\Materials folder.

Changing the default startup layout

To have Softimage start up with a certain layout, you don’t really have to do anything. When you exit Softimage, it writes the current layout to your preferences file, so that the next time you start Softimage it starts up with that same layout.

For example, if I change to the Tools Development Environment layout and exit Softimage, then my %XSI_USERHOME%\Data\Preferences\default.xsipref file will include this line:

xsiprivate.UI_LAYOUT_DEFAULT	= Tools Development Environment

So when I start Softimage again, it will start up in the Tools Development Environment.

Here’s how to access that preference in scripting:

# Python
from win32com.client import Dispatch as disp
from win32com.client import constants as C
si = disp('XSI.Application' )
log = si.LogMessage

log( C.siUILayoutDefault )
log( si.GetUserPref( C.siUILayoutDefault ) )
log( si.Preferences.GetPreferenceValue( "xsiprivate.UI_LAYOUT_DEFAULT" ) )

# INFO : Compositing
# INFO : Compositing

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.