PDA

View Full Version : Customizing the Attribute Editor


q2on
11-10-2007, 01:29 AM
I'm trying to change what gets displayed in the Attribute Editor window based on the state of the node that is being viewed. For example, if I have a custom node TestNode, I want to display Attr1 in the AE window if TestNode.MyAttr is TRUE, otherwise I want to only display Attr2 in the AE window. Ideally, the code would look like this:


global proc AETestNodeTemplate( string $nodeName )
{
editorTemplate -beginLayout "TestNode Attributes";
if( `getAttr ($nodeName + ".MyAttr")` == true )
{
editorTemplate -addControl "Attr1";
}
else
{
editorTemplate -addControl "Attr2";
}
editorTemplate -endLayout;
}


However, this doesn't work as AETestNodeTemplate() is called only once, thus the Attribute Editor window does not change based on the state of the TestNode being viewed.

Is there a way to solve this problem?

(I cannot simply enumate all attributes and then change their visibility via -dimControl false -- the attributes I want displayed are dynamic and I don't know what they will be called when the script is written!)

ashishdantu
11-12-2007, 03:22 AM
hi q20n,

if refreshAE command is fired when your TestNode.MyAttr changes, will it not do what you want ? I'm guessing it might ?

kjaft
11-12-2007, 08:06 AM
EDIT: D'oh, too eraly here, did not read carefully enough... So maybe a scriptjob in conjunction with the below is your friend.

I think you need two extra procs in the AETemplate, one like "XYZAttributeControlNew" and one like "XYZAttributeControlReplace", and probably create the concerning UI element yourself. Then implement it the follwing way: editorTemplate -callCustom "XYZAttributeControlNew" "XYZAttributeControlReplace" "";
Just take a look into the docs and some of the AETemplate files of mayas native nodes on how to do that.

CGTalk Moderation
11-12-2007, 08:06 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.