string $cameras[] = `ls -cameras`;
for ($camera in $cameras) {
int $isRenderable = `getAttr ($camera+".renderable")`;
if ($isRenderable == 1){
//Do whatever you want here
print $camera;
}
}
Damn rusty as hell in MEL now haha. Basically each camera has a renderable flag.
Yeah that's pretty much the only way I know and annoying too :P Maybe you can see if you can query the hudnames.
ah your talking about where it says the camera name in the bottom middle of hte hud?
ya guess i could figure out what section of the hud that is in and query for the contents.
Thanks
EDIT:
@haiddasalami that may not be possible the maya.cmds.headsUpDisplay() command requires the hud objects name as a argument, and i don't know anyways to figure out what the default hud object is named.
global proc string findNewCurrentModelView() {
global string $gMainPane;
string $mainPaneCtls[];
string $visPanels[];
string $panelName;
string $panelCtl, $edCtl;
string $modelEd;
int $nArr;
int $i;
string $newViewFound;
string $newView;
//
// First try to find something in the main pane.
//
if ($gMainPane != "") {
$mainPaneCtls = `paneLayout -q -ca $gMainPane`;
$nArr = size($mainPaneCtls);
for ($i = 0; $i < $nArr; $i++) {
$panelName = `getPanel -containing $mainPaneCtls[$i]`;
if ("" != $panelName) {
if ("modelPanel" == `getPanel -to $panelName`) {
if (!`control -q -io $mainPaneCtls[$i]`) {
$modelEd = `modelPanel -q -modelEditor $panelName`;
if ("" != $modelEd) {
//
// If this view is already active, let's
// continue to use it.
//
if (`modelEditor -q -activeView $modelEd`)
{
$newView = $modelEd;
string $camera = `modelPanel -q -camera $newView`;
print $camera;
break;
}
}
}
}
}
}
}
return $newView;
}
findNewCurrentModelView();
Did some hunting and found the findCurrentView script. This doesnt require the mouse to be under as its using the active View flag. May be of some use. Sorry for the hijack Toast ! Also changed it from returning an int to a string(the model editor) Sorry didnt bother converting it to Python though should be simple. Only thing might be getting the mainPanel.
ya think i will stick to my method when i know the user will have the viewport as the active pane.
since to accomplish that via python mel.eval() needs to be used to get the global variable that is needed.
my script that im using this with is a zbrush style viewport snap, so it actually is a safe assumption that it is being activated while the cursor is on the viewport.
Replies
edit: will have to post later for you appeenty my phone can't copy and paste python and have it formatted correctly.
it is still a big hack job to do since you are actually quwrory the viewport ui element.
Damn rusty as hell in MEL now haha. Basically each camera has a renderable flag.
currently i have to do this hack job
which only works if the mouse is above the viewport
ah your talking about where it says the camera name in the bottom middle of hte hud?
ya guess i could figure out what section of the hud that is in and query for the contents.
Thanks
EDIT:
@haiddasalami that may not be possible the maya.cmds.headsUpDisplay() command requires the hud objects name as a argument, and i don't know anyways to figure out what the default hud object is named.
Did some hunting and found the findCurrentView script. This doesnt require the mouse to be under as its using the active View flag. May be of some use. Sorry for the hijack Toast ! Also changed it from returning an int to a string(the model editor) Sorry didnt bother converting it to Python though should be simple. Only thing might be getting the mainPanel.
since to accomplish that via python mel.eval() needs to be used to get the global variable that is needed.
my script that im using this with is a zbrush style viewport snap, so it actually is a safe assumption that it is being activated while the cursor is on the viewport.
Really appreciate the help!