Friday, May 2, 2014

Look at Selection

I just installed Maya 2015 and have been playing around with some of the new features. During the process of perusing through menus I stumbled across the command "Look at Selection" in the View menu of the modelling panel. I'm sure it's a very old feature (I know at least Maya 2008) but I haven't ever used it because it doesn't seem to have a hotkey assigned to it so I doubt many other people use it much and ergo I haven't seen people using it in tutorials etc.

It's a very handy command because it does basically the same thing as "frame selected" or "frame all" so it centers the camera's pivot on what you're working on, but it doesn't zoom the camera in or out so you're claustrophobically close to a selection of vertices. Does this sound familiar? Modeling - Alt+LMB orbit - [oh, I'm tumbling away from where I'm working] - f - Alt+RMB zoom out zoom out zoom out - modeling and repeat. So it's great because the camera keeps its distance, but there's no hotkey for it... yet.

I used the MEL mentioned here as a starting point and modified it so it would work with the Look at Selection command which is
viewLookAt [-position linear linear linear] [camera]
so the little MEL script I ended up with is
$currentPanel = `getPanel -withFocus`;
$panelType = `getPanel -to $currentPanel`;
if ($panelType == "modelPanel")
{
string $camera = `modelEditor -q -camera $currentPanel`;
viewLookAt $camera;

}
And then all that was needed was to assign a hotkey to it as described here.
Basically I created a new command in the hotkey editor (which I've assigned the hotkey '?' itself) and then assigned 'Ctrl+f', which wasn't already assigned anything and it's related to the frame hotkey 'f'.

I might end up just remapping 'f' to it if I find I don't use the frame command much anymore. The command is also handy because if there's nothing selected the camera just centers on the origin, instead of zooming way out into space as 'frame' will do in a large scene. Hopefully that's helpful for some people.

No comments:

Post a Comment