global string $isolate_original;
global int $remember;
// source isolate.mel; isolate;
global proc isolate(){
global string $isolate_original;
global int $remember;
string $current = `editRenderLayerGlobals -q -currentRenderLayer`;
string $default = "defaultRenderLayer";
string $visPanel[] = `getPanel -vis`;
if (size($visPanel)>0)
{
for ($panel in $visPanel)
if (`match "^modelPanel" $panel`=="modelPanel")
{
if ($current!= $default)
{
$mode=`modelEditor -q -viewSelected $panel`;
enableIsolateSelect $panel (!`isolateSelect -q -state $panel`);
editRenderLayerGlobals -currentRenderLayer $default;
$isolate_original = $current;
}
else
{
$mode=`modelEditor -q -viewSelected $panel`;
enableIsolateSelect $panel (!`isolateSelect -q -state $panel`);
if (size($isolate_original) == 0)
$isolate_original = $default;
editRenderLayerGlobals -currentRenderLayer $isolate_original;
}
}
}
}
Hi there,
I've written the above code. As you may know, Maya does not isolate an object when on a Render Layer. As someonw who uses them a lot it is very annoying.
I've attempted to write a script that will toggle back to the defaultRednerLayer, isolate an object and then toggle back to the previous render layer.
Everything is working as expected....however when going back to the defaultRenderLayer, the script still remembers the global string from previous excecution.
Is there a way to clear a global string on a 2nd excecution of a script? Or am I totally doing everything the wrong way and in fact there is possibly a better way to approach this whole thing?
This is beginning to reach the limits of my MEL capability. :((