Array32 (UserDataBlob) *
Introduced
9.0 (2011)
Description
Sets or returns binary user data on the UserDataBlob as a SafeArray of unsigned integers (32 bit). The preferred language for working with this property is Python.
This property provides better performance than the UserDataBlob.ByteArray property, especially when used with the Python scripting language and its array module. The Array32 property allows you to pack up to 4 unsigned bytes inside a single unsigned integer, so that there is less overhead when accessing or setting the data.
When setting this property, you must manually convert your unsigned byte array into an unsigned integer array using this schema: [<padding count>,<data>,<padding>], where <data> represents the byte(s) you want to store, <padding> represents any null bytes you need to add in order to make this a valid 32-bit integer, and <padding count> represents the number of null bytes you had append to the end of the data to make it a valid 32-bit integer.
When converting the return value to a byte array, you need to interpret the same schema: the first item of the array represents the number of null bytes padded to the byte array; the next item(s) represent the data plus any padding as indicated by the initial padding count. These requirements must be respected:
- the data is set and returned as a SafeArray of unsigned integers (32 bit); for Python, the recommended data structure is array.array('I') and for JScript, native arrays are accepted (Python and JScript arrays are internally converted to SafeArray objects)
- the first item in each unsigned integer array must be an integer in the range of 0-3 to describe the number of null bytes needed to pad in order to make the integer array valid
- each unsigned byte must be in the range of 0-255
- the value of each integer in the integer array should be in the 0-4294967295 range in order to preserve the data appropriately
- the returned value may appear unexpected for a given scripting language
Warning: Each element of the SafeArray is converted to four bytes internally; if such a conversion is impossible, setting the property fails and the data remains unchanged
Note: The data is copied internally and will be persisted as part of the scene. There are no limits to the size or structure of this data. Internally, the UserDataBlob.Value, UserDataBlob.ByteArray and the Array32 properties refer to the same data. However, for the sake of clarity, use only one or the other across your plug-in.
C# Syntax
// get accessor Object rtn = UserDataBlob.Array32; // set accessor UserDataBlob.Array32 = Object;
See Also
|
|
|
|
Examples
• See UserDataBlob.Array32.1.pys
• See UserDataBlob.Array32.2.js
• See UserDataBlob.Array32.3.vbs
Autodesk Softimage 2011