Hey folks-

I have a python script that works fine when run from Maya's script
editor (i.e., UI mode). I'm trying to get this script to work in
standalone mode for batch processing.

The script uses Maya's samplerinfo node, which seems to be only able
to sample with respect the active camera (i.e., there seems to be no
way to hook the node's input to an arbitrary camera matrix). So to get
the sampleinfo node to work with respect to a particular camera in the
scene I have tried the following:

1. Using the command: maya.cmds.lookthru(myCam)
This command works fine in UI mode but fails in standalone mode with
the exception:
'RuntimeError: There is no active view.'

2. I have also tried the following commands to set the active camera:
maya.cmds.viewSet(myCam, persp=True)
maya.cmds.renderSettings(camera = myCam)
These commands don't throw an exception in standalone mode. However,
the rendered image does not sample information from the specified
camera (i.e., no matter what camera I set the active camera to, the
same image is generated in standalone mode). However, in the UI mode
these commands works fine.

3. I have also tried setting the perspective camera's attributes to
match the desired camera:
for attr in maya.cmds.listAttr(myCamShape, k=1):
  mc.setAttr("perspShape." + attr, mc.getAttr(myCamShape + "." +
attr))

for attr in maya.cmds.listAttr(myCam, k=1):
  mc.setAttr("persp." + attr, mc.getAttr(myCam + "." +
attr))

None of these solutions work in standalone mode. Any suggestions would
be greatly appreciated.
Thanks,
-pro

-- 
http://groups.google.com/group/python_inside_maya

Reply via email to