About Me

Monday, May 14, 2012

Bug: listCameras

Never noticed this bug before, you look in the Camera drop down to select a camera for a panel and some of the cameras show the shape name not the transform, so we did a bit of digging. Turns out the code that builds the Panels>Perspective menu is buggy.

From the code reference: listCameras  
Command to list all cameras. If no flags are given, both perspective and orthographic cameras will be displayed. This command returns an array of camera names. When the transform name uniquely identifies the camera it is used, otherwise the shape name will be returned.

Which is wrong as if you simply parent a cube under a camera transform all of a sudden in the camera menu you'll get perspShape not persp. So who cares right? Well in our case I'm using cmds.modelPanel(self.Panel,q=True,cam=True), which must use the same code under the hood and thus returns the CameraShape node and not the Transform depending on if you have something parented to the camera or not.