PDA

View Full Version : Scripting color management in Maya 2011


tomb
07-14-2010, 04:14 PM
I'm trying to figure out the MEL commands to enable and change the color management options in the Render Globals.

Specifically I want to turn on Color Management and set "Default Input Profile" to sRGB and "Default Output Profile" to Linear.

This is the best I could come up with. Doesn't return an error but also doesn't change anything.

changeColorProfileEnabled;
setAttr "defaultRenderGlobals.inputColorProfile" 1;
setAttr "defaultRenderGlobals.outputColorProfile" 2;



Can't seem to find anything in the docs. Also saving a preset doesn't seem to save the color profile settings.

mduvekot
07-14-2010, 08:07 PM
This is what I use:

//linear
setAttr "defaultRenderGlobals.colorProfileEnabled" 1;
setAttr "defaultRenderGlobals.inputColorProfile" 2;
setAttr "defaultRenderGlobals.outputColorProfile" 2;
updateCommonColorProfile();

//sRGB
setAttr "defaultRenderGlobals.colorProfileEnabled" 1;
setAttr "defaultRenderGlobals.inputColorProfile" 3;
setAttr "defaultRenderGlobals.outputColorProfile" 3;
updateCommonColorProfile();

tomb
07-14-2010, 08:13 PM
Thanks! Just what I was after.

tomb
07-15-2010, 06:20 PM
I'm getting an error when I run the script if the render globals window hasn't been opened at least once after launching Maya. Seems like there's some sort of initialization script that is run when the render globals window is opened? At the moment the only way around it I found was to run a command to open the window. Not a big deal but it would be nice to figure it out.




setAttr "defaultRenderGlobals.colorProfileEnabled" 1;
setAttr "defaultRenderGlobals.inputColorProfile" 3; // sRGB
setAttr "defaultRenderGlobals.outputColorProfile" 2; // Linear

// unifiedRenderGlobalsWindow;
updateCommonColorProfile();


// Error: line 41: Cannot find procedure "updateCommonColorProfile". //


You can try running the above code to replicate the error. Or un-comment out the line unifiedRenderGlobalsWindow to not get the error.

CGTalk Moderation
07-15-2010, 06:20 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.