PDA

View Full Version : knowing the object type in selection


DEVILSAN
04-19-2009, 09:50 PM
Hi,

i was trying to select a render layer using mel to perform an operation if new render layer is created it should be selected, now i learnt how to create a render layer using

createRenderLayer -name "DiffuseLayer" -number 1 -noRecurse `ls -selection`;

and to make it as selected i did this optionVar -intValue renderLayerCurrent 1;
before creating a new layer which makes the newly created layer as selected.

But i want to know (Ques1)how i can perform the operation of selection the newly created layer without optionVar -intValue renderLayerCurrent 1;
or i want to (Ques2)check whether the option of Make new layer selected is true or false
i.e. whether optionVar -intValue renderLayerCurrent 1; or 0;

so that if its 0 i can make it 1 perform my operation and agian set it back to 0 so that user settings remains as they were before....

claydough
04-20-2009, 05:17 AM
like this?

// set with query
int $value;
if ( `optionVar -exists cly_renderLayerCurrent ` )
$value = `optionVar -q cly_renderLayerCurrent `;

// explicitly set
optionVar -intValue renderLayerCurrent 1;

// set toggle with query
optionVar -intValue renderLayerCurrent (!`optionVar -q renderLayerCurrent`)

DEVILSAN
04-22-2009, 06:10 PM
well a little bit diff though i made it work..

new layer is made using
createRenderLayer -name "DiffuseLayer"

how should i query the existence of the DiffuseLayer?

as i dont want to create a duplicate layer..

claydough
04-22-2009, 08:33 PM
`objExists`

{

if (` objExists "DiffuseLayer"` && `nodeType "DiffuseLayer"` == "renderLayer" )

print " the render layer DiffuseLayer exists\n";

}

DEVILSAN
04-22-2009, 11:37 PM
`objExists` very imp to remember...

CGTalk Moderation
04-22-2009, 11:37 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.