Announcement

Collapse
No announcement yet.

vrend ignoring the camera I'm giving it ...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • vrend ignoring the camera I'm giving it ...

    Hi,

    I'm using cmds.vrend to save out vrscenes from maya, but it seems to ignore the camera I'm feeding in the parameters, and uses instead the active camera in maya.

    Here is my code :

    cmds.vrend(camera=renderCamera)

    I tried using the camera shape or the transform, but it keeps on ignoring it.

    Am I doing something wrong here ?

    Thanks a lot,

    Julien
    ---------------------------------------
    Julien BOLBACH - Lead Environment TD
    The Moving Picture Company London

  • #2
    It seems that the camera parameter expects a string value, not an object.
    I've tried passing the name/dag path of the camera and it seems to work as expected.
    V-Ray developer

    Comment


    • #3
      That was the case, but to be sure, I did this :

      cmds.vrend(camera="%s" %renderCamera)

      But it gives the same result ...
      ---------------------------------------
      Julien BOLBACH - Lead Environment TD
      The Moving Picture Company London

      Comment


      • #4
        Hi,

        I just tried using the mel command instead of the python command :
        vrendCommand = 'vrend -camera %s %s' % (renderCamera, 'masterLayer')
        mel.eval (vrendCommand)

        And it worked fine ...
        ---------------------------------------
        Julien BOLBACH - Lead Environment TD
        The Moving Picture Company London

        Comment


        • #5
          I think the -camera flag for the MEL command is passed differently to the MEL function compared to camera=<string> in Python and the command probably does not recognize it.

          Best regards,
          Vlado
          I only act like I know everything, Rogers.

          Comment


          • #6
            This is how I do it in Python:

            Code:
            import maya.cmds as cmds
            import maya.mel as mel
            
            cameras = cmds.ls(type='camera')
            renderlayers = cmds.ls(type='renderLayer')
            
            for renderlayer in renderlayers :
            	cmds.editRenderLayerGlobals(currentRenderLayer=renderlayer)	# Actually step to the current render layer in scene
            	for camera in cameras:
            		mel.eval('vrend -camera ' + camera + ' -layer ' + renderlayer + ' ;') # MEL code for exporting of the .vrscene file
            You probably want to also check that the layers and cameras are actually renderable. The code above will just give you everything. Also, this code returns the camera shape. This works, but for nicer presentation you may want to grab the parent with cmds.listRelatives(cmds.ls(type='camera'), parent=True) so that you get persp rather than perspShape.
            Last edited by Fredrik Averpil; 02-12-2013, 06:26 AM.
            Best Regards,
            Fredrik

            Comment

            Working...
            X