Render Settings ... grabbing the image extension.

232 views
Skip to first unread message

md

unread,
Jul 11, 2014, 2:58:35 PM7/11/14
to python_in...@googlegroups.com
Hey Guys,

So I am pulling the information from RenderGlobals and I see that when I have a pass set up as an .exr Maya is returning a value of 51 from imageFormat. 51 indicates a file type of Custom (51).

Is there a way to access the constant definitions so I can return a string ? Also .. I assume Custom(51) does not indicate exr but rather its a catch bucket for any formats not currently defined in Maya's API. 

So is the best way to get the file extension to query renderSettings path and grab the extension using string manipulation ?? That just seems a bit hacky to me.

Thanks

M

Justin Israel

unread,
Jul 12, 2014, 2:56:19 AM7/12/14
to python_in...@googlegroups.com
This would give you the string name of the enum value:

cmds.getAttr("defaultRenderGlobals.imageFormat", asString=True)



--
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/4927f0c7-f770-4509-8822-b9f2bb8a49ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

md

unread,
Jul 14, 2014, 8:22:11 AM7/14/14
to python_in...@googlegroups.com
Thanks again Justin ... but as a suspected , this returns 'Custom Image Format' for EXR files. Kinda lame since EXR has become such a standard.

I guess Ill parse the renderpath for now.

M

On Saturday, July 12, 2014 2:56:19 AM UTC-4, Justin Israel wrote:
This would give you the string name of the enum value:

cmds.getAttr("defaultRenderGlobals.imageFormat", asString=True)

On Sat, Jul 12, 2014 at 6:58 AM, md <acco...@mdonovan.com> wrote:
Hey Guys,

So I am pulling the information from RenderGlobals and I see that when I have a pass set up as an .exr Maya is returning a value of 51 from imageFormat. 51 indicates a file type of Custom (51).

Is there a way to access the constant definitions so I can return a string ? Also .. I assume Custom(51) does not indicate exr but rather its a catch bucket for any formats not currently defined in Maya's API. 

So is the best way to get the file extension to query renderSettings path and grab the extension using string manipulation ?? That just seems a bit hacky to me.

Thanks

M

--
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_maya+unsub...@googlegroups.com.

Anthony Tan

unread,
Jul 14, 2014, 8:58:42 AM7/14/14
to md, python_in...@googlegroups.com

try getting the defaultRenderGlobals.imfkey attribute - it'll give you the extension as per the dropdown? This only applies for MR I suspect however..

(I'm sure there's an analogue for every other renderer out there though, I only worked this one out by reading through the Mel callback itself)

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/eae25b47-613a-42d5-956f-4c17db59a7da%40googlegroups.com.

Marcus Ottosson

unread,
Jul 14, 2014, 9:54:15 AM7/14/14
to python_in...@googlegroups.com, md

This is how I would imagine things to go down in order to avoid the issue of parsing strings along with potential pitfalls down the line.

 ____________________________      _________      _________________
|                            |    |         |    |                 |
|  1. Rendering requirements |--->| 2. Maya |--->| 3. Image format |
|____________________________|    |_________|    |_________________|

.

Currently, you’re process might look something like this:

  1. Gather requirements
  2. Load requirements into Maya
  3. Parse Maya to get requirements into your script
                                   _________ 
                                  |         |
 ____________________________    _| 2. Maya |
|                            |  | |_________|
|  1. Rendering requirements |--| 
|____________________________|  |  _________________
                                |_|                 |
                                  | 3. Image format |
                                  |_________________|

.

Alternatively, what do you think about defining and persisting requirements separate to Maya, such as in a .json or .ini configuration file? That way, you could go about it this way instead:

  1. Gather requirements
  2. Load requirements into Maya
  3. Load requirements into your script

That is, having Maya and your scripts access the same requirements, both decoupled and independent from each other.

Best,
Marcus




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



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

Reply all
Reply to author
Forward
0 new messages