How to get the output image name in Maya?

2,619 views
Skip to first unread message

yaoyansi

unread,
Sep 16, 2014, 4:56:35 AM9/16/14
to maya_he3d
Hi all,
Is there any simple way to get the output image name in maya? mel, python and MayaAPI  are all acceptable.

For example, in RenderGlobal settings panel, I set "File name prefix" to "<Scene>.<RenderLayer>", and Maya shows the "File name" as "untitled.masterlayer_01.jpg"
I wanna to get the value of File name, that is "untitled.masterlayer_01.jpg".

I have several ways, but I'm wondering is there any better way.
1. text -q -l exampleText1
This command can get the right answer in maya script editor, but it may not work in bath rendering mode.
2. replace the tokens(e.g.<Scene> and<RenderLayer>) with the right values, just like the script in mtoa.
But I have to write many codes for this solution. Is there any simpler way?

Could you give me any clue? Thank you in advance.
Cheers

Andrew Hazelden

unread,
Sep 18, 2014, 2:37:02 PM9/18/14
to maya...@googlegroups.com, yaoy...@aliyun.com
Hi yys.

I think the MEL command you are looking for is "renderSettings".

renderSettings Help Topic
http://download.autodesk.com/global/docs/maya2014/en_us/Commands/renderSettings.html

MEL Example
//Get the name of the first image in the sequence and process any file name prefix tokens.
string $firstImageName[] = `renderSettings -firstImageName -leaveUnmatchedTokens`;


Regards,
Andrew Hazelden

Fredrik Averpil

unread,
Sep 19, 2014, 2:22:41 AM9/19/14
to maya...@googlegroups.com, yaoy...@aliyun.com

These can sometimes be renderer-dependent. I believe this depends on whether the renderer overrides the render globals AETemplate (not sure though).

I do it like this:

current_renderer = cmds.getAttr('defaultRenderGlobals.currentRenderer')

if current_renderer == 'vray':
    cmds.setAttr('vraySettings.fileNamePrefix', '<Scene>_<Camera>_<Layer>.', type='string')
elif current_renderer == 'mentalRay':
    cmds.setAttr('defaultRenderGlobals.imageFilePrefix', '<Scene>_<Camera>_<RenderLayer>.', type='string')
elif current_renderer == 'mayaSoftware':
cmds.setAttr('defaultRenderGlobals.imageFilePrefix', '<Scene>_<Camera>_<RenderLayer>.', type='string')

I know that Arnold and RMS18 also uses the standard defaultRenderGlobals.imageFilePrefix.


Cheers,Fredrik


--
You received this message because you are subscribed to the Google Groups "maya_he3d" group.
To unsubscribe from this group and stop receiving emails from it, send an email to maya_he3d+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages