Get output image name with python

Hi!

Is there a way to get the resolved image name from the vraySettings with python? From Maya Software you can get it with

name = renderSettings(firstImageName = True, fullPath = True)

for example.

Thanks!

Yep, something like this:```
from vray.utils import *

p=findByType(‘SettingsOutput’)

dir=p[0].get(‘img_dir’)
fname=p[0].get(‘img_file’)

print dir+fname


Best regards,
Vlado

Very interesting, thanks !

In my test, I get this result in the logs :
O:/TEMP/TEST/images/testVray/masterLayer/testLay.tiff
O:/TEMP/TEST/images/testVray/layer1/testLay.tiff
O:/TEMP/TEST/images/testVray/layer2/testLay.tiff

So, it is executed once for each render layer.
Note that it’s not executed once for each frame, which explains why I get testLay.tiff instead of testLay.0023.tiff

Yes, the Python script is currently run only once before rendering a layer begins. We might have to add a separate callback between frames.

Best regards,
Vlado

Looks good, thank you! Ist vray.utils documented somewhere?

There is the documentation concerning the python part here: Chaos: Industry-leading design and visualization software

For information about all the different types of plugins and their parameters, you can look at .vrscene files exported from V-Ray for Maya, and you can also use the plgparams tool from the SDK.

Best regards,
Vlado

Thanks again!

I get a Fatal Error when I do this in Maya2012 HF2 with vray 2.10.01 when the funtion gets called. Any ideas?

EDIT: With Maya2011 SP1 and the Vray 2.00.04 Release I also get a Fatal Error.

I’m on windows7, btw.

There is a problem in the recent nightly builds; should be fixed for the build tomorrow.

Best regards,
Vlado

I just checked the latest nightly build. But I still get the Fatal Error.

Yes, sorry didn’t get there yesterday (we had to move to a new office); I will let you know the revision number when it’s fixed, hopefully a bit later today.

Best regards,
Vlado

Hm, on my machine the crash was caused by a wrong copy of vrayformaya.mll being loaded by the python module. The crash went away after I removed the duplicate version.

Best regards,
Vlado

Hm, okay. What was the problem last time?

It’s been the same problem for me; can you get me the crash dump from Maya? (It’s in the %temp% folder, MayaCrashLog*.dmp)

Best regards,
Vlado

Here it is:
MayaCrashLog110712.1920.log.zip (1.29 KB)

Can you get me the .dmp file, not the .log one?

Best regards,
Vlado

Of course, sorry.
MayaCrashLog110712.1920.dmp.zip (35.6 KB)

For some strange reason, I don’t see vrayformaya.mll loaded. This would explain why the python script throws an exception (will fix this)… Is V-Ray actually loaded in Maya?

Best regards,
Vlado

I just tried it again with vray loaded. BUT: I didn’t mention that we load vray from a network repository, maybe that’s the point. We set the necessary envvars before starting maya. (EDIT: Nope, tried it with a local install, same issue. /EDIT)

In maya I do something like:

#---------------------
import sys

sys.path.append(‘R:\\repo\\vray_builds\\vray21501_16029_2011x64\\maya_vray\\scripts\\vray’)

from utils import *

p=findByType(‘SettingsOutput’)

dir=p[0].get(‘img_dir’)
fname=p[0].get(‘img_file’)
#----------------------------

Strange thing is, that the module loads fine and the error occurs when I try to call a function.

Ok, it won’t work this way. You need to put the Python script in the V-Ray “Post-translate Python Script” field in the V-Ray settings. V-Ray will call the script automatically at the start of the rendering, when the scene is already translated for V-Ray and the SettingsOutput plugin is available.

Otherwise calling the script directly won’t give you anything - V-Ray has not translated the scene yet (in fact, it’s not even loaded).

Best regards,
Vlado