Hi all,
I encounter a problem when I update UI in AETemplate dynamically.
Here is the code:
If $rnd is set to "A", when I switch to UI AESurfaceTemplate, I want to show test_plug0 in AETemplate,
and if $rnd is set to "B", when I switch to UI AESurfaceTemplate, I want to show test_plug1 in AETemplate.
//===========================================================
global proc AESurfaceTemplate( string $nodeName )
{
layout -e -vis false "AEcontrolFormLayout";
editorTemplate -beginScrollLayout;
//------ try to call special callback functions -----------
editorTemplate -beginLayout "XXX" -collapse 0;
editorTemplate -ccu ("ShaderNodesCBNew "+$nodeName) ("ShaderNodesCBReplace "+$nodeName) "rmanShaderLong";
editorTemplate -endLayout;
//----------------------------------------------------------------------------------
editorTemplate -addExtraControls;
editorTemplate -endScrollLayout;
layout -e -vis true "AEcontrolFormLayout";
}
//===========================================================
global proc ShaderNodesCBNew(string $attributeName1, string $attributeName2)
{
global string $rnd ;
string $fn;
$fn = "AEShaderTemplate_"+$rnd+"(\""+$attributeName1+"\")";
eval($fn);
}
//===========================================================
global proc ShaderNodesCBReplace(string $attributeName1, string $attributeName2)
{
global string $rnd ;
string $fn;
$fn = "AEShaderTemplate_"+$rnd+"(\""+$attributeName1+"\")";
eval($fn);
}
//===========================================================
global proc AEShaderTemplate_A( string $nodeName )
{
editorTemplate -beginLayout "AAA";
editorTemplate -addControl "test_plug0";
editorTemplate -endLayout;
}
//===========================================================
global proc AEShaderTemplate_B( string $nodeName )
{
editorTemplate -beginLayout "BBB";
editorTemplate -addControl "test_plug1";
editorTemplate -endLayout;
}
When I set $rnd to "A", and switch to AESurfaceTemplate, the function ShaderNodesCBNew() is called, but the problem is the UI is not updated at all,
"test_plug0" is not displayed in AESurfaceTemplate panel.
So, my question is:
1.Is it possible to do this in Maya?
2.If it is possible, how to do it? Could you give any clue?
Any suggestion is appreciated, and thank you in advance.
Best Regards
yaoyansi