View Full Version : Query all states of modelEditor
JellyFire 10-26-2007, 10:50 AM Hey, i'm just making a quick bake cam button and want to speed things up a bit.
Currently it checks if camera view is turned on and turns it off if so to hide the imagePlane:
int $camViewDisplay = `modelEditor -q -cameras modelPanel4`;
if ($camViewDisplay == 1){
//Turn off camera view to speed up Baking
modelEditor -e -cameras 0 modelPanel4;
}
But I want to do this for EVERYTHING :D So dynamics, polygons, NURBS, the lot.
Could be a lot of code if I do it this way...
Is there a more clever way of doing it, maybe storing into arrays. Then how do I get around having to do multiple if statements? I'm guessing some For Loop...
Any help much appreciated!
Christian
|
|
JellyFire
10-26-2007, 02:16 PM
Sorted!!!
Put my thinking cap on and had a bash (Am starting to get MEL a bit more I recon ;))
int $i,$value1[17];
string $showTypes[17] = {"-nurbsCurves","-nurbsSurfaces","-polymeshes","-subdivSurfaces","-planes","-lights","-cameras","-joints","-ikHandles","-deformers","-dynamics","-locators","-dimensions","-pivots","-handles","-textures","-strokes"};
for ($i=0; $i < 17; $i++){
$value1[$i] = `modelEditor -q $showTypes[$i] modelPanel4`;
if ($value1[$i] == 1){
modelEditor -e $showTypes[$i] 0 modelPanel4;
}
}
print ("I am doing something");
for ($i=0; $i < 17; $i++){
if ($value1[$i] == 1){
modelEditor -e $showTypes[$i] 1 modelPanel4;
}
}
Hope that helps anyone trying to do something similar...
*If anyone see's any mistakes can you give me a shout.
Thanks
Christian
nelsonteixeira
10-28-2007, 01:22 PM
I did this sometime ago:
///////////////////////////////////////////////////////////////////////////
//ntToggleCamOnCurrentPanel
string $currentPanel = `getPanel -wf`;
$wosStatus = `modelEditor -q -cameras $currentPanel`;
int $wos = $wosStatus;
if ($wos ==1)
modelEditor -e -cameras 0 $currentPanel;
else
modelEditor -e -cameras 1 $currentPanel;
//////////////////////////////////////////////////////////////////////////////
This way it will get the current panel otherwise it will fail if you´re not specifically on modelPanel14 n your example.
I intended to do something extra but never did. To break/make the link of the image plane with the camera so it won´t render if turned off. The way it is wors only on openGL preview.
Hope this helps
CGTalk Moderation
10-28-2007, 01:22 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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.