PDA

View Full Version : Custom Attributes? How to store my array?


Gibbz
06-13-2006, 12:45 PM
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

fabman
06-13-2006, 02:51 PM
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.

antonv
06-13-2006, 03:01 PM
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.

Gibbz
06-13-2006, 11:18 PM
cheers guys, ill try this tonight.

PEN
06-14-2006, 01:12 PM
I have a tutorial that shows building a custom attribute definition that will store weak references. That might help you out.

djlane
06-14-2006, 03:16 PM
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

PEN
06-14-2006, 03:23 PM
Down Load PEN Attribute Holder from my site and have a look at that. It is designed for storing poses for custom attributes.

Gibbz
06-15-2006, 09:44 AM
Is there a tab array? for example i may want to store an array of an array?

Gibbz
06-15-2006, 11:57 AM
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?

CGTalk Moderation
06-15-2006, 11:57 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.