[Closed] Custom Attributes? How to store my array?
Ok i want to store an array and some values(numbers/strings) in a node so i can use it later in my script. Im trying to use custom attributes but they dont seem to allow me to use an array…
For example…
ca = attributes MyDef
(
NumMapFaces = #()
NumMapVerts = #()
)
This complains
“– Syntax error: at name, expected attributes clause: “
Is this the correct method for storing values/arrays?
Cheers
This should work…
ca = attributes MyDef
(
parameters main (
NumMapFaces type:#intTab tabSizeVariable:true
NumMapVerts type:#intTab tabSizeVariable:true
)
)
#intTab is a Array of integers… #floatTab is a Array of floats… you got all the types in the Max help under… “Scripted Plug-in Clauses” , tabSizeVariable:true let’s you modify the size of the array in dinamically at runtime.
Cheers.
Also you can try saving node data with the file for later use in two other ways:
1: appdata – this is probably the fastest with huge amounts of data. You just set it for the nodes you need and accessing it is very easy
2: setuserpropbuffer – you need a string for this one and you have the chance to mess with all the vray object properties this way but it’s still a solid way to do it.
Hope this helps.
I have a tutorial that shows building a custom attribute definition that will store weak references. That might help you out.
Hi I got a similar Issue and was wondering if you guys could tell me what my options are.
At the moment I have some finger bones and I have written a script to capture their pose as an array of matrix3 values. The script actually creates a multi dimensional array
theArrayPose_01[1]
holds the an array of matrix3 values for finger 1 etc…
so:
theArrayPose_01[1][2]
is the matrix3 value for the 2nd bone in finger 1 and so on.
if I capture another pose with my script it will create another multi dimensional array
holding all the matrix3 values for that pose
theArrayPose_02
I am thinking I might need to create an array to store all these arrays!
what I want to be able to do is store these arrays on say the Hand Bone. Then my custom attribute UI could have a drop down list of available arrays.
It seems I can not store a multi dimensinal array in a cust attribute, so would AppData be the way to go.
Thanks
Dan
Down Load PEN Attribute Holder from my site and have a look at that. It is designed for storing poses for custom attributes.
Is there a tab array? for example i may want to store an array of an array?
or what if i wanted using the following
ca = attributes MyDef
(
parameters main (
NumMapFaces type:#intTab tabSizeVariable:true
NumMapVerts type:#intTab tabSizeVariable:true
)
)
something along the lines of
$.myDef.backup1.numMapFaces
$.myDef.backup2.numMapFaces
etc?