Loading the Mayatomr plugin runs tons of mel scripts. One of the scripts
creates the mental ray globals object that has many of the render options as
attributes. It also alters the render globals window to contain the options,
registers shaders in the hypershade, etc.
I don't exactly remember the circumstances now, but for some reason I had a
case where the plug-in was being loaded but this code was not run, so I
couldn't set any render globals.I have this code (really sloppy, sorry).
It's all mm.eval because I found this stuff digging through the mel files
that Maya runs, and I just quickly wrapped it. At the time it got me what I
needed, we ended up not going with mental ray in this case.
import os
import maya.mel as mm
mm.eval('catch(`loadPlugin
"C:/Maya/Maya2008/bin/plug-ins/Mayatomr.mll"`);')
mm.eval('mentalrayInitStrings;')
pluginPath = cmds.pluginInfo("Mayatomr", q=True, path=True)
mm.eval('mentalrayForMaya "%s";' % os.path.split(pluginPath)[0])
mm.eval('mentalrayStart "%s";' % os.path.split(pluginPath)[0])
mm.eval('mentalrayFactory add;')
mm.eval('miCustomNodesLoadShaders;')
mm.eval('miCustomNodesFiles;')
mm.eval('miCustomNodesBegin;')
mm.eval('miCustomNodesFile "%s/mentalray/include/architectural.mi";'%
os.getenv("MAYA_LOCATION"))
mm.eval('miCustomNodesLibrary "%s/mentalray/include/architectural.mi";'%
os.getenv("MAYA_LOCATION"))
mm.eval('miCustomNodesIdAction;')
mm.eval('mentalrayUI "";')
Maybe it will help get you started.
On Tue, Mar 31, 2009 at 10:22 AM, Omar Agudo <[email protected]> wrote:
>
> I want to use Mental ray stand alone.
>
> The question is if I can have access to these options:
>
> * Placeholders - Reuse memory for source geometry
> * Approximation - Reuse memory with fine approximation
> * Texture cache - Resuse memory with tiled texture maps
> * BSP acceleration - Reuse memory with large BSP
>
> and how using the python maya API.
>
> Thank you!!!!
>
>
>
>
>
>
>
> 2009/3/31 Narann <[email protected]>:
> >
> > I don't really understand the question.
> >
> > You use MR Standalone and render crash?
> > You use Mayatomr and render crash?
> > You want to change render options for MR Standalone?
> > You want to change render options for Mayatomr?
> >
> > The respond will depend of that :)
> >
> > As chad said, check the plugins is loaded (if you use commande line).
> > If you use MRS, rendering option can be forced by command line.
> > If you use Mayatomr, try to diagnose your scene.
> >
> > Good luck!
> >
> > Dorian
> >
> > >
> >
>
> >
>
--
-Ben Barker
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/python_inside_maya
-~----------~----~----~----~------~----~------~--~---