PDA

View Full Version : how to getAttr on a "compound with mixed type elements"???


brubin
11-24-2006, 12:08 PM
print `listConnections -plugs true -source false -destination true -type shadingEngine floorShape`;
floorSG.dagSetMembers[0]
floor2SG.dagSetMembers[0]
floorSG.dagSetMembers[1]
print `getAttr floorSG.dagSetMembers[0]` ;
// Error: line 1: The attribute is compound with mixed type elements. //


does anyone know how to GETattr on the attribute compound with mixed type elements (in general), please?
i found stuff on how to SETattr, but the GETpart remains mysterious...

TIA
s.

grantimus
11-24-2006, 08:45 PM
I can't answere your question about getAttr on compound with mixed type elements. I think in most cases it's not even possible (but I could be wrong). If you're trying to get the dagSetMembers on a shader you do it like this:

sets -q floorSG

brubin
11-25-2006, 03:15 PM
I can't answere your question about getAttr on compound with mixed type elements. I think in most cases it's not even possible (but I could be wrong). If you're trying to get the dagSetMembers on a shader you do it like this:

sets -q floorSG

oh, i knew about that one...
thanx for getting involved anyhow, i appreciate it!

and No,
i think it should be possible, to learn more about how these compound attributes work,
they're very common, since the example above has to do with shader-assignment.
i'm really determined to find out more how these "3-story"-attributes like

instObjGroups[0].objectGroups[2].objectGrpCompList
instObjGroups[0].objectGroups[2].objectGroupId
instObjGroups[0].objectGroups[2].objectGrpColor

actually work, or what they're immediate function is.
i'd also like to know how to create, control and read these.
i'm working on a project where it would be favorable to store a present shader assignment, slap on, -let's say- a maskSurfaceShader for the time being, and still be able to fall back on to the old 'real' shader that was originally on it.
i'm not a render nor texture person, but a scripter, and so the shading-network as it is displayed in hypershade is pretty mysterious and confusing to me, especially since i believe, that even with auxilliary nodes turned visible you're still allowed to see only part of the picture. let me explain:
sets -q floorSG ;

indicates that there is a connection between the shaderGroup and a set, but that i can not see, cause the set is not represented in hypergraph.
or the set-information is stored inside the shaderGroup-node, in some array-attrib., but how is that accessible?
another thing:
between a surface-mesh/nurbs and a shaderGroup is always a "groupId"-node that feeds into both, almost like a mediator, but what is it mediating?
the attributes involved are not very "talkative", that's why i'm in this misery in the first place.
once you assign a different shader for a moment, then change your mind and reassign the first (reassign, not undo!) you get a new groupId-node, and the old one is no longer part of your scene apparently. or it's bound to join the huge army of useless underground-nodes that polute any scene where a lot of creating & deleting takes place, i can't tell.

i'm still very much in the dark, so my plea is still for anyone who can shed some light on this to step forward and elaborate..

TIA!
s.

brubin
11-30-2006, 02:02 PM
[bounce]
sorry'bout that, but i'm still hopin' for more responses...

GennadiyKorol
11-30-2006, 02:33 PM
From maya 7 reference:

getAttr:
This command returns the value of the named object's attribute. UI units are used where applicable. Currently, the types of attributes that can be displayed are:



numeric attributes
string attributes
matrix attributes
numeric compound attributes (whose children are all numeric)
vector array attributes
double array attributes
int32 array attributes
point array attributes
Other data types cannot be retrieved. No result is returned if the attribute contains no data.

So currently you can read only numberic compoud attributes as it seems.
A work around maybe, in your case, instead of looking to the attribute value itself, you might try looking at the value of the plugin that goes to that attribute.



There's a connection floorShape.instObjGroups[0] ---> floorSG.dagSetMembers[0]
So doing:

getAttr floorShape.instObjGroups[0];

returned 0 for me.

Also getAttr -typ floorSG.dagSetMembers[0] returns "TdataCompound", that's the type of the attribute you're trying to read. So for getting the values in the current case I'd read the values of outgoing connections.

Hope it helps,
Henry

CGTalk Moderation
11-30-2006, 02:33 PM
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.