View Full Version : Saving changes to render settings

10 October 2010, 03:54 PM
Hi everyone,

I was wondering if someone could possibly help me with a slight issue I'm having.

I've made a few changes to the render settings window and added in a load of custom buttons and check boxes. I've written this into the createMayaRenderPassTab.mel file and all is working well. However, if I switch a check box on and save the scene, Maya does not remember that I have turned the check box on.

I'm assuming that this is due to the fact that I have written a load of code that will adapt the UI of the render settings window but have not yet established how this is written out when the file is saved.

Firstly I was wondering how to write this information into a saved file, and secondly how I would go about reading it back in when the file is opened.

Any help would be greatly appreciated.

Thanks a lot,


10 October 2010, 04:25 PM
if your controls and checkboxes pertain to internal Maya's settings (e.g. render globals output format type) you need to ensure that they set/unset/modify maya's settings appropriately. ascertaining what these are may be tricky but they could be optionVars, global variables, mel scripts, etc... If the controls you have added are all brand new settings that you have created yourself you can either save their values using optionVar command (if you want them to persist between Maya sessions) or add them as attributes to a node in your scene (if you want them per-scene). If they are related to rendering you could maybe just add them as custom attrs on Maya's defaultRenderGlobals node, or else create some random DG node in the scene yourself.

I hope this is basically what you were asking...


10 October 2010, 04:35 PM
Thanks a lot Nathan.

That sounds really helpful. I am trying to save it on a per scene basis so I'm assuming that adding custom attributes to the defaultRenderGlobals node would be the way to go.

If I'm honest I'm fairly new to this as I have come from a Houdini background. Not too sure how I would go about creating those attributes but I'll have a hunt around and hopefully will find something.

Thanks again.

10 October 2010, 07:08 PM
Hi Nathan,

Was wondering if you may be able to help out again.
I've set up a load of extra attributes on the defaultRenderGlobals and can get these to switch on and off from my check boxes in the render settings window. However, what I really want to do is have the render settings check boxes change according to the defaultRenderGlobals attributes. This way, when I open a scene I can switch the correct check boxes on, and when I save a scene I can switch the correct attributes on in the defaultRenderGlobals. I hope that kind of makes sense????

I can get the attribute by using the checkBox command and querying the value. However I cannot set it. I would have thought that I could have used a setAttr() or even the checkBox command again but neither seem to work.

I don't suppose you have any ideas?

Thanks a lot.

10 October 2010, 09:24 PM
try using attrControlGrp in your UI to connect to the relevant attributes you have added. This creates a UI control that is "best fit" to the attribute and has a 2-way connection. Change the control and the attr changes, change the attr and the control updates.


window attrTest;
columnLayout -adj 1;
attrControlGrp -attribute "defaultRenderGlobals.imageFormat";
attrControlGrp -attribute "defaultRenderGlobals.enableDefaultLight";
attrControlGrp -attribute "defaultRenderGlobals.topRegion";
attrControlGrp -attribute "defaultRenderGlobals.useRenderRegion";

10 October 2010, 09:16 AM
Thanks a lot Nathan.

I've given that a go but unfortunately if I use an attrControlGrp instead of a check box I don't get any form of button or control in my render settings view. I've got a feeling that this is because I try to create the attrControlGrp before the custom attribute has been created in defaultRenderGlobals. I've tried assigning it to an attribute that's already in the defaultRenderGlobals but the same thing happens.

I don't suppose you have any other ideas?

10 October 2010, 09:27 AM
Not to worry mate, all is fixed!

I can just use:

p, li { white-space: pre-wrap; } checkBox(name, edit=True, value=False)

I did this last night but wasn't getting the right results. I think a few late evenings at work may have taken their toll.

Thanks a lot for all your help. Really is much appreciated.

10 October 2010, 09:43 AM
weird.. I have no idea why you're not getting anything... I assume the MEL code I posted on it's own works fine for you..? attrControlGrp is generally the easiest way to handle attribute UI, but if you have it working fine anyway it's all good.


CGTalk Moderation
10 October 2010, 09:43 AM
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.