editing maya preferences in python

editing maya preferences in python

Craig_Lamorte
Advocate Advocate
4,853 Views
2 Replies
Message 1 of 3

editing maya preferences in python

Craig_Lamorte
Advocate
Advocate

Does anyone know the command to edit Mayas preferences?  More specifically in the UI elements i want to turn off - restoring saved layouts from file.

 

 

0 Likes
Accepted solutions (1)
4,854 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Accepted solution

Hi Craig

 

This can normally be done using the optionVar command.

 

However the two properties you want to modify also require some runtime changes to be made to ensure the current instance of Maya has the correct preferences set. This should work:

 

import maya.mel
import maya.cmds

# Set these to 1 or 0 depending on if you want it to be on or off
saveLayouts   = 1
restoreLayouts = 1

# Save layout
cmds.optionVar(iv=('useSaveScenePanelConfig', saveLayouts))
cmds.file(uc=saveLayouts)
mel.eval('$gUseSaveScenePanelConfig=' + str(saveLayouts))

# Restore layout
cmds.optionVar(iv=('useScenePanelConfig', restoreLayouts))
cmds.file(uc=restoreLayouts)
mel.eval('$gUseScenePanelConfig=' + str(restoreLayouts)) 

Hope it helps

 

Mike

Message 3 of 3

Craig_Lamorte
Advocate
Advocate

Thanks!

0 Likes