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

**URL:** <https://forums.chaos.com/t/vrend-ignoring-the-camera-im-giving-it/47897>\
**Category:** General\
**Created:** [November 26, 2013, 6:45pm UTC](https://forums.chaos.com/t/vrend-ignoring-the-camera-im-giving-it/47897 "2013-11-26T18:45:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Julien\_BOLBACH](https://avatars.discourse-cdn.com/v4/letter/j/59ef9b/32.png) [@Julien\_BOLBACH](https://forums.chaos.com/u/Julien_BOLBACH)\
**Post date:** [November 26, 2013, 6:45pm UTC](https://forums.chaos.com/t/vrend-ignoring-the-camera-im-giving-it/47897/1 "2013-11-26T18:45:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![t.petrov](https://avatars.discourse-cdn.com/v4/letter/t/c68b51/32.png) [@t.petrov](https://forums.chaos.com/u/t.petrov)\
**Post date:** [November 27, 2013, 10:25am UTC](https://forums.chaos.com/t/vrend-ignoring-the-camera-im-giving-it/47897/2 "2013-11-27T10:25:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Julien\_BOLBACH](https://avatars.discourse-cdn.com/v4/letter/j/59ef9b/32.png) [@Julien\_BOLBACH](https://forums.chaos.com/u/Julien_BOLBACH)\
**Post date:** [November 27, 2013, 5:18pm UTC](https://forums.chaos.com/t/vrend-ignoring-the-camera-im-giving-it/47897/3 "2013-11-27T17:18:44Z")

</div>

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

cmds.vrend(camera=“%s” %renderCamera)

But it gives the same result …

---

<div class="post-metadata">

**Author:** ![Julien\_BOLBACH](https://avatars.discourse-cdn.com/v4/letter/j/59ef9b/32.png) [@Julien\_BOLBACH](https://forums.chaos.com/u/Julien_BOLBACH)\
**Post date:** [November 28, 2013, 8:20am UTC](https://forums.chaos.com/t/vrend-ignoring-the-camera-im-giving-it/47897/4 "2013-11-28T08:20:38Z")

</div>

Hi,

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

And it worked fine …

---

<div class="post-metadata">

**Author:** ![vlado](https://avatars.discourse-cdn.com/v4/letter/v/779978/32.png) [@vlado](https://forums.chaos.com/u/vlado)\
**Post date:** [November 28, 2013, 5:47pm UTC](https://forums.chaos.com/t/vrend-ignoring-the-camera-im-giving-it/47897/5 "2013-11-28T17:47:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Fredrik\_Averpil](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/fredrik_averpil/32/35925_2.png) [@Fredrik\_Averpil](https://forums.chaos.com/u/Fredrik_Averpil)\
**Post date:** [December 2, 2013, 1:24pm UTC](https://forums.chaos.com/t/vrend-ignoring-the-camera-im-giving-it/47897/6 "2013-12-02T13:24:06Z")

</div>

This is how I do it in Python:

```auto

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.
