View Full Version : array attr question

05 May 2003, 04:05 AM
before I write anything else I want to thank the people that have replied to my posts. Hell, I want to thank everybody :) I've learned a lot and I wouldn't be anywhere without you people. :applause::love:


I've created a node that I want to hold a series of attributes that contain arrays, like "obj.attr1" = [3, 23, 233]. I can set the array and apparently fill it with values, and reset it, but I can't get my information.

as usual, here's code illustrating the problem:
createNode "network" -n "uv";

addAttr -longName "somename" -dt Int32Array;

print(listAttr( "-ud"));

setAttr uv.somename -type Int32Array 2 124 21;
// hey look I can reset the values.
setAttr uv.somename -type Int32Array 3 124 21 32;

// it has something in it
int $s = `getAttr -size uv.somename`;
print ($s);

// and I can't see to get at it.
int $a[] = `getAttr uv.somename`;
getAttr uv.somename[0];

if this way is a dead end what way would there be using nodes and attributes to have a variable sized atrribute, something like this:

"foo" <-- dynamic attribute
454 <-- value # 1
12 <-- value # 2
45 <-- value # 7

45 <-- value # 1
122 <-- value # 2
5 <-- value # 4

.... and so forth

where I could access by node_name.value1[x].

thanks for your time

05 May 2003, 07:03 AM
it's pretty clear to me that getAttr doesn't properly support these attribute types.

The API does, though!! :D

-- Mark

05 May 2003, 03:51 PM
Okay. I get it now. I'm trying to do stuff that requires a real langauge. If I write any more scripts after this one I'm going to get the learning edition of VC++ provided it works with Maya 4.5
I guess for now I'll use the string type and keep on adding to the string.


06 June 2003, 04:12 AM

Take a look at Compound List Tools on Highend3D.


06 June 2003, 05:41 AM
in `cListItemNth $cList "three"`;
for ($x=0; $x<size($cListArray); $x++){
if ($cListArray[$x] == $item) ...

in cListItemNth is way to slow for referencing something, for my needs. I would want instant access, like in hash tables and other data structures. But it does look interesting. Better than anything I've written ;)


CGTalk Moderation
01 January 2006, 07:00 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.