I want to make a simple toggle-script that switches camera view states between A and B, eg. Top and Bottom. So if I'm in Top view, then it should switch to Bottom and vice versa. I'm not great at coding but keen to learn, so would appreciate some help.
Pseudo code:
$currView = <some way of retrieving the current 'camera view'>
If currView is "top" {
viewSet -bottom;
}
else
{
viewSet -top;
}
Solved! Go to Solution.
I want to make a simple toggle-script that switches camera view states between A and B, eg. Top and Bottom. So if I'm in Top view, then it should switch to Bottom and vice versa. I'm not great at coding but keen to learn, so would appreciate some help.
Pseudo code:
$currView = <some way of retrieving the current 'camera view'>
If currView is "top" {
viewSet -bottom;
}
else
{
viewSet -top;
}
Solved! Go to Solution.
Solved by manuel.spkDKCCG. Go to Solution.
Hi Henrik
I don't know how to do It in Mel, but in python this would do the trick (also, not sure if It's the best way to accomplish It)
currentCamera = cmds.lookThru(q=True)
print (currentCamera)
if currentCamera=="top":
cmds.lookThru(currentCamera, "bottom")
elif currentCamera=="bottom":
cmds.lookThru(currentCamera, "top")
Make sure you cameras are named like this ("top" and "bottom"). If not, just change the literals in the code. Translating this to Mel, should not be a hard task.
Hi Henrik
I don't know how to do It in Mel, but in python this would do the trick (also, not sure if It's the best way to accomplish It)
currentCamera = cmds.lookThru(q=True)
print (currentCamera)
if currentCamera=="top":
cmds.lookThru(currentCamera, "bottom")
elif currentCamera=="bottom":
cmds.lookThru(currentCamera, "top")
Make sure you cameras are named like this ("top" and "bottom"). If not, just change the literals in the code. Translating this to Mel, should not be a hard task.
Can't find what you're looking for? Ask the community or share your knowledge.