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.

Scripting – Writing the DataArray of an ICE attribute


Here’s a little Python snippet that shows how to write to the DataArray of an ICE attribute.

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

pc = si.GetPrim("PointCloud", "", "", "")
a = pc.ActivePrimitive.AddICEAttribute("MyScalarArray", C.siICENodeDataFloat, C.siICENodeStructureArray, C.siICENodeContextSingleton  )
a.DataArray = [[ 0.03, 3.33, 2.22, 3.333 ]]

a = pc.ActivePrimitive.AddICEAttribute("MyLong", C.siICENodeDataLong, C.siICENodeStructureSingle, C.siICENodeContextSingleton  )
a.DataArray = [3.1416*1000]

a = pc.ActivePrimitive.AddICEAttribute("MyScalar", C.siICENodeDataFloat, C.siICENodeStructureSingle, C.siICENodeContextSingleton  )
a.DataArray = [3.1416]

#
# Add some Attribute Display properties
# to show the attribute values
#

p = pc.AddProperty( "AttributeDisplay", False, "" )
p.Parameters( "attrname" ).Value = "MyScalar"

p = pc.AddProperty( "AttributeDisplay", False, "" )
p.Parameters( "attrname" ).Value = "MyLong"
p.Parameters( "offsety" ).Value = 16

p = pc.AddProperty( "AttributeDisplay", False, "" )
p.Parameters( "attrname" ).Value = "MyScalarArray"
p.Parameters( "offsety" ).Value = 32

I tried to do the same thing in JScript, but I couldn’t get it to work for arrays. Very frustrating.

pc = GetPrim("PointCloud", "", "", "");

a = pc.ActivePrimitive.AddICEAttribute("MyScalarArray", siICENodeDataFloat, siICENodeStructureArray, siICENodeContextSingleton  )

a.DataArray = [[ 0.03, 3.33, 2.22, 3.333 ]]
// WARNING : 3390 - This ICEAttribute doesn't refer to a 2D array: <Attribute: MyScalarArray>
//

a.DataArray = [ 0.03, 3.33, 2.22, 3.333 ]
// WARNING : 3392 - Invalid offset specified while extracting data from this attribute: <Attribute: MyScalarArray>
// <Offset: 108384008>
// 


// But this does works
a = pc.ActivePrimitive.AddICEAttribute("MyLong", siICENodeDataLong, siICENodeStructureSingle, siICENodeContextSingleton  )
a.DataArray = [3000]

PS You can find some usage of DataArray in the CrowdFX plugin (in the Softimage install dir).

Have license, will travel?


Umm…not quite. The Autodesk end-user license agreement (hereafter referred to as the “EULA”) restricts license usage to the country or territory of purchase.

Section 2.1.3 of the EULA says:

2.1.3 Territory. Except as otherwise authorized in writing by Autodesk, the licenses granted in this Agreement are granted only for the Territory. Nothing in this Agreement permits Licensee (including, without limitation, Licensee’s Personnel, if any) to Install or Access the Licensed Materials outside of the Territory.

Extra-territory usage is a subscription benefit:

Extra Territory Rights – Allows usage of a license outside of the country of purchase for up to 90 days per a year. This benefit can be used by End Users. No companion license would be needed, however if installing outside the country of purchase and requiring a manual install, explanation of benefit may be needed.

So, what’s a territory? Again, from the EULA:

From the EULA:

33. “Territory” (a) means the country, countries or jurisdiction(s) specified in the License Identification, or (b) if there is no such License Identification, or no country or jurisdiction is specified in the License Identification, means the country in which Licensee acquires a license to the Autodesk Materials. If the License Identification specifies, or Licensee acquires the Autodesk Materials in, a member country of the European Union or the European Free Trade Association, Territory means all the countries of the European Union and the European Free Trade Association.

But what if you’re not in Europe? What’s your territory? The EULA says you can find your territory in the License Identification:

14. “License Identification” means one or more designations by Autodesk that set forth the License Type (among other things) for Licensee’s license of the Licensed Materials. The License Identification may be (a) located (i) in the Licensed Materials (e.g., in an “About” box, license information dialog box, or text file of Software), (ii) on or with Autodesk packaging, or (iii) in a written confirmation or other notice issued to Licensee by Autodesk and transmitted via email, facsimile, physical delivery, or otherwise, or (b) obtained from Autodesk on request. For clarification, License Identification does not include a designation, confirmation, packaging or other document provided by a Reseller or other third party.

I couldn’t find the license identification for my Maya ECSP license, which was purchased in Canada from the North American store. However, I did find this on the store help page:

If I purchase a product from one country’s store, can I use it in another country?
No. Software products purchased on this Store must be used in accordance with the terms of the Autodesk License agreement accompanying them; such terms include a restriction that the products may not be used outside of the country of purchase. For this site, the Territory for sale of software products is the US, Canada, Puerto Rico and Guam. Please see the Digital River Terms and Conditions.

Finally, via google, I found this “Ancillary Service Description for Use Outside Territory” document.

Screenshots of the week


Wet Bunny
by Andy Moorer

Ice Topo+Kine

replacing particles instances by high res versions at render
by face

LightMap create using ColorSampler
by SI_UserNotes

Dead ICE tree after scene recovery
by druite

ICE L-Strands

Cell duplication
http://vimeo.com/52920070

Generate Strand Filled Object Node FeaturesOlder video that showed up in my RSS feed this week.

Mia_Material_Advanced
Another older video that showed up in the Vimeo ICE Tutorials feed this week.