Boolean operations on ICE arrays


While it is true that non-zero values are considered True, this applies only to input values. ICE nodes that return a boolean value will always return either 1 or 0.

Based on this, you can do an element-wise logical operation on array by summing up the array elements.

If the sum is greater than zero, then you know there was at least one True value, so a logical OR would return True. And if the sum was less than the array size, then at least one boolean element is False, so a logical AND would return False.

Unable to access file. Another process is currently using it.


Originally posted here: usa.autodesk.com/getdoc/id=TS14206145

When you try to start XSI.exe or xsibatch, you get a pop-up dialog box that looks something like this:

---------------------------
XSI
---------------------------
Unable to access c:\Softimage\Softimage_2010_x64Data\Preferences\Default\OutputFormat\Cine_16.xsipref
Another process is currently using it.
Click Cancel to continue.
---------------------------
Retry   Cancel   
---------------------------

The actual file could be any file in the factory location or in a workgroup location. When you look in the specified folder, you find a .lock file for the file that could not be opened.

Typically, there are two situations when you may encounter this problem:

  • When you run multiple instances of xsibatch on a single computer
  • When multiple xsibatch jobs on multiple render nodes try to load a workgroup from a network server

The .lock files are created when a process (like xsi.exe) opens certain files (.xsitb, .xsicompound, .xsiprefs, and a few others) through the Windows API. Usually you’ll never see the .lock files. But if something happens to interrupt the file access (such as a network problem), you can get .lock files left around, which causes a sharing violation the next time a process tries to access the file.

You might want to try Process Monitor or Process Explorer to see what is going on. If you cannot delete the .lock file, try using Process Monitor to free the .lock file handle.

A possible workaround is to make the folder read-only, so xsi.exe and xsibatch cannot write a lock file. Then there can be no concurrent access to the lock file.

Here’s a few threads about lock files:
compound locks
lock files causing render problems

Saturday snippet – Wrapping an Undo


Two ways…

OneUndo decorater by Cesar Saez

from functools import wraps  
    
def OneUndo(function):  
   @wraps(function)  
   def _inner(*args, **kwargs):  
     try:  
       Application.BeginUndo()  
       f = function(*args, **kwargs)  
     finally:  
       Application.EndUndo()  
       return f  
   return _inner
#
# And a basic example...
# 
@OneUndo 
def CreateNulls(p_iCounter=100):
     lNulls = []
     for i in range(p_iCounter):
       lNulls.append( Application.ActiveSceneRoot.AddNull() )
     return lNulls

CreateNulls()

Undo with statement by ethivierge

from win32com.client import constants as c
from win32com.client.dynamic import Dispatch as d
 
xsi = Application
log = xsi.LogMessage
collSel = xsi.Selection
 
 
class xsiUndo():
    def __enter__(self):
        xsi.BeginUndo()
 
    def __exit__(self, type, value, traceback):
        xsi.EndUndo()
 
 
def testFunc():
    log("running test")
 
 
with xsiUndo():
    testFunc()

The case of the fatal missing registry key


Otherwise known as the case where composite.exe cannot determine a product license to use:

The last time I saw this error, it turned out to be a problem with the ProductInformation.pit file. However, this time it turned out to literally what the error message says: Composite couldn’t figure out what license to use. The tricky part was figuring out why.

First we tried a couple of configuration “tricks”, but those didn’t help in this case.

  • Set the ADSK_COMPOSITE_LICENSE environment variable to SOFTIMAGE (or MAYA if you have Maya, or 3DSMAX if you have Max).
  • Add these lines to toxik.ini (which doesn’t exist by default, so you may have to create the file
    %USERPROFILE%\Documents\toxik\2013\toxik.ini with your favorite text editor).

    toxik::deployment::licenseType                Standalone
    toxik::deployment::softimagelocation          C:\Program Files\Autodesk\Softimage 2013
    

    Note that alternatively, instead of setting toxik::deployment::softimagelocation in the INI file, you could set the environment variable SI_HOME.

And unfortunately, Composite wasn’t logging any license-related information or errors.

Fortunately I’m the curious type, so I’d been using Process Monitor to see what composite.exe was doing at startup, and I had a pretty good hunch what was wrong. And when I got a Process Monitor log from the customer, it only took a minute to spot the problem: a missing registry key.

When ADSK_COMPOSITE_LICENSE is set to SOFTIMAGE, composite.exe uses the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\Softimage\InstallPaths\2013 to find Softimage. The customer’s machine was missing that registry key, so composite.exe couldn’t find Softimage and therefore couldn’t figure out what license to use.

Why was the registry key missing? I don’t know.