View Full Version : 'ModelPanel' A Specific Camera Name

06 June 2012, 06:31 PM
Hey World,

Is it possible to call on a certain Modelpanel that has the camera name "cam_main" in it? Currently I have a command that turns off "show->cameras", but it is only specified for modelPanel4.

modelEditor -e -cameras false modelPanel4;

I want this script to work company-wide so that other artist who have a different layout will still be able to run the command on the panel that has the "cam_main" camera.

Is this possible? :)


06 June 2012, 09:01 PM
more than one viewport could be set to cam_main. Bearing this in mind gives you half the solution. Simply get a list of all modelPanels (`getPanel -type "modelPanel"`), then iterate through the list and check the camera used (`modelPanel -q -camera $panel`), if it's "cam_main" do what you have to do.

06 June 2012, 09:31 PM
Hey thanks Nathan!

I believe I understand the jist of your answer. I'll give it a try with my lack of scripting skills. =)


06 June 2012, 10:15 PM
Got it Nathan,

Thanks again!

// Get array of panels in Maya
string $selection[] = `getPanel -type "modelPanel"`;

// Run loop for individual panels
for($panel in $selection){
string $viewport = `modelPanel -q -camera $panel`;

// check if individual panel equals cam_main
if($viewport == "cam_main"){

// adjust panel of cam_main
modelEditor -e -cameras false $panel;

CGTalk Moderation
06 June 2012, 10:15 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.