Hi,

Try this

import maya.cmds as cmds
import maya.mel as mel
mel.eval("""setCurrentRenderer "arnold" """)

Cheers


On Wed, Dec 14, 2016 at 12:18 PM, Enrico Losavio <[email protected]>
wrote:

> Hi everyone,
>
> I am struggling to optimize a batch rendering script of mine.
> Basically I've wrote a script that assigns a certain number of frames to
> each computer in the studio, and then writes a batch render (bat) file per
> pc.
> In case of big scenes, the rendering is automatically split into 'chunks'.
> So that 10000 frames are broken down into -say- 500 frames, then divided
> and assigned to the computers. By doing so, we make sure that little by
> little we complete parts of the animation without having gaps in between.
> The problem with this is that every time a line is executed, the scene and
> all the dependencies are reloaded. And this, in case of an heavy scene,
> could mean take minutes. Also, in case of small chunks / many batch lines,
> it might results in a huge loss of time.
> What I am trying to do here, is to avoid the usual batch render, and to
> use another system. I want to open the scene, *keep it open* and render
> as many frames as I want. Also one at a time.
>
> I also want to be able to catch the state/render log in real time, in
> order to monitor the render and see what's going on on all the computers.
> Using the regular batch render, I can catch the exitcode, but that is only
> when the execution of the whole batch finishes.
>
> For now I am just trying to get my script to be more flexible. But I'd say
> that the long term goal is to have the frames deployed one by one, monitor
> the render progress remotely, and as soon as one pc frees up, assign a new
> frame!
>
> I am trying with *mayapy*, but I'm not making a great deal of a progress.
> In this case, I want to render using VRay. The cmds module provides a
> *render* function, but that's only for rendering using MayaSoftware.
> In my code, I basically just open the file, set the workspace, load vray
> and render trying out a bunch of functions I've found digging deep inside
> the cmds module.
>
> import maya.standalone
> maya.standalone.initialize()
>
> import maya.cmds as cmds
>
> filepath = r"C:\test_prj\rnd_test.mb"
> cmds.file(filepath, open=True, force=True)
>
> cmds.workspace(r"C:\test_prj", openWorkspace=True)
>
> cmds.loadPlugin('vrayformaya')
>
> # the following functions were called one by one in different test files,
> here's just a recap
>
> cmds.batchRender() # Result: There is currently no render to cancel
> cmds.BatchRender() # no result
> cmds.render()      # renders just fine, but in MayaSoftware :(
> cmds.vrend()       # V-Ray error: Cannot get the object for the current
> render layer:
>
> But none of these options seem to work properly for me.
> There's little to no documentation on the vray python commands, so it's a
> bit hard to debug what's goning on with the last command.
>
> Can anyone suggest me which way to go? Do I have better options than
> MayaPy?
> Any help would be greatly appreciated :)
>
> Thanks
>
> Enrico
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/python_inside_maya/91ce3f96-692d-4761-955a-
> 6443ce185c0d%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/91ce3f96-692d-4761-955a-6443ce185c0d%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*David Moulder*
Technical Animator / Artist
[email protected]
*Professional Profile <http://uk.linkedin.com/pub/david-moulder/1/b12/b5a>*

Mobile: +44 (0)7814033242
See who we know in common
<http://www.linkedin.com/e/wwk/5748982/?hs=false&tok=3tztwkse1silw1> Want a
signature like this?
<http://www.linkedin.com/e/sig/5748982/?hs=false&tok=3pwLU9-mBsilw1>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CABD4PkSt1iafQ4k1PR6bJee0VcHoo%2Bhd3Q1TbKuuKW0QujrYzg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to