getting the correct vray.exe from maya.env

119 views
Skip to first unread message

ctjanney

unread,
Apr 7, 2014, 2:15:25 PM4/7/14
to python_in...@googlegroups.com
vray is centrally installed, as are most of our plugins, and we have a tool for supervisors to customize the maya.env for the folks are their show, so everyone on the show is using the same versions of the same plugins.  One of our in-house tools exports the current frame to a .vrscene file to be rendered on a separate thread via vray standalone.  For a number of bad reasons, the path to vray.exe was hard coded into this tool, and at 3am Saturday, I quickly updated it to get the write one from the maya.env as such:

        mayaVersion = maya.cmds.about(version=True)[0:4]
        vrayPath = os.environ.get('VRAY_FOR_MAYA%s_MAIN_x64'%mayaVersion)
        vrayPath = vrayPath.replace('/','\\')
        
        command = '%s\\bin\\vray.exe'%vrayPath

I feel this is dirty, so wondering if there's a better way to do this.

Thanks,

-ctj

Jesse Kretschmer

unread,
Apr 7, 2014, 2:44:50 PM4/7/14
to python_in...@googlegroups.com
If you are running a background process for VRay rendering, you must also be somehow handling other VRay environment variables. These variables may be coming for *free* from the maya environment that spawned the background process. If that is the case, then you can also adjust the the PATH variable in the maya.env.

I suggest that you set the PATH variable to include your vray bin directory, then simple call "vray.exe" without a full path.


Side note:
I've setup network installs of VRay on windows and bootstrapped the plugin loading with the userSetup.py. I like using python to manage the various plugin versions. In my case it also is setting the PATH variable such that I can simply call vray.exe directly from within maya using subprocess.Popen(["vray"]+args).



Marcus Ottosson

unread,
Apr 7, 2014, 3:20:39 PM4/7/14
to python_in...@googlegroups.com
+1 for modifying PATH to include the binary.

Haven't come across a scenario this wouldn't work. E.g. when you've got multiple binaries, such as Maya 2013, 2014 and 2015, you can substitute directly calling the maya.exe with calling something like maya2013.bat and maya2014.bat, each containing the full path to their respective executables.


--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CANESWi3sU-3BaHg%3DESC6Rh9EDMZPG3kSp5%3DPfg8i31tzUmkp0g%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.



--
Marcus Ottosson
konstr...@gmail.com

Justin Israel

unread,
Apr 7, 2014, 3:43:14 PM4/7/14
to python_in...@googlegroups.com

Also a side note: I've used the userSetup.py as well and actually just hade it run an environment module that was maintained in a central network location. That way the logic could easily be updated and picked up by new launches of Maya without being disted to any user preference locations.
This was for a studio that also didn't require that people launch Maya from a command line under a "set shot" type of environment management.

Marcus Ottosson

unread,
Apr 7, 2014, 3:43:54 PM4/7/14
to python_in...@googlegroups.com
Figure it's too coincidental not to mention, but once you start considering overriding such settings, say in the cascading fashion of having children add or subtract environment settings or paths to executables from their parents, I just happen to be working on such a solution at the moment; I'm calling it Open Metadata and just made a 0.3 pre-release over at Github and are focusing questions and answers in this Google Group.
--
Marcus Ottosson
konstr...@gmail.com

Fredrik Averpil

unread,
Apr 8, 2014, 6:29:20 AM4/8/14
to python_in...@googlegroups.com
Just a quick word on userSetup.py: it is called later than userSetup.mel and prohibits some things to function correctly which would work fine if loaded through userSetup.mel (an example would be dirmap). I don't know why Autodesk made it this way... but it's truly annoying.

We also have V-Ray centrally installed, and I'm using a python wrapper script to set all environment variables based on OS and then execute the standalone vray executable via subprocess. Works like a treat and offers the capability to capture stdout and stderr.

// F

Fredrik Averpil

unread,
Apr 8, 2014, 6:33:11 AM4/8/14
to python_in...@googlegroups.com
On Mon, Apr 7, 2014 at 9:43 PM, Marcus Ottosson <konstr...@gmail.com> wrote:
I'm calling it Open Metadata


That's really nice. Reminds me of Qt's QSettings!

// Fredrik


Marcus Ottosson

unread,
Apr 10, 2014, 12:32:26 PM4/10/14
to python_in...@googlegroups.com
Thanks, Fredrik. I'm glad you like it. :) Let me know if you give it a whirl and I'll give you the grand tour.
--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAD%3DwhWNuuoSLF8xwD%2Bw80EomgEv%2BEbrbFHqfgQDDpf4d_xYYhA%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.


--
Marcus Ottosson
konstr...@gmail.com


Reply all
Reply to author
Forward
0 new messages