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!)
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!)
