Setting a Maya preference with optionVar command in userSetup.py doesn't work

Setting a Maya preference with optionVar command in userSetup.py doesn't work

f.fiordalice
Explorer Explorer
811 Views
2 Replies
Message 1 of 3

Setting a Maya preference with optionVar command in userSetup.py doesn't work

f.fiordalice
Explorer
Explorer

Hi there,

I'm having some problems trying to set a Maya Preferences at Maya startup through the userSetup.py file.

Basically what I would like to achieve is to set the Maya default player/application for the ImageSequence, PlaylastAvi and PlayblastQuicktime type of generated file; we are using in our studio RV and setting it as a default player will speed-up a lot our workflow.

 

So What I'm trying to do is to set the optionVar at Maya start-up with simple commands like:

rv_path = '/path/to/rv/bin'
cmds.optionVar(category='Applications', stringValue=('viewSequenceDir', rv_path))
cmds.optionVar(category='Applications', stringValue=('playblastCmdAvi', rv_path))
cmds.optionVar(category='Applications', stringValue=('playblastCmdQuicktime', rv_path))

put this commands in a function, which is going to set also other optionVars, and feed this into a, 

maya.utisl.executeDeferred(<my_function>)

 

So now seems like that those pref variables are not being set at all, neither also if I'm going to do that directly in Maya script editor, but the very funny part is... if I open up the Maya Preferences window and then press the save button without change anything (after a Maya start-up process which is using our userSetup file), Maya will save the userPrefs.mel file in the user dir with the optionVar set by my script, but those will not appear in the Applications menu of the Maya Preferences window, and of course if I'm going to make a playblast, Maya won't use the application.

 

I've also tried to set those optionVar through the

mel.eval(f'optionVar -cat "Applications" -sv "ViewSequenceDir" "{rv_path}";')
mel.eval(f'optionVar -cat "Applications" -sv "playblastCmdAvi" "{rv_path}";')
mel.eval(f'optionVar -cat "Applications" -sv "playblastCmdQuicktime" "{rv_path}";')

but seems like this will just populate the first one (ViewSequenceDir) but not the rest of them.

 

Do you guys have some thoughts about it?

If I explained myself badly, please feel free to tell me what is incomprehensible and I'll try reformulate it again.

 

Thanks in advance,

FF

0 Likes
Accepted solutions (1)
812 Views
2 Replies
Replies (2)
Message 2 of 3

brentmc
Autodesk
Autodesk
Accepted solution

Hi,

You have spelled ViewSequenceDir incorrectly. Should have a capital V at the beginning and that is why it is working in Mel but not Python.  Same with the other optionVars - they should be capitalized.

Note: You do not need to specify the category in your userSetup file as that is set when those optionVars are initialized during Maya startup.

Brent McPherson
Principle Engineer
Message 3 of 3

f.fiordalice
Explorer
Explorer

Thank you so much Brent for your reply and yes it was just an upper Case letters problem.

Now it works like a charm.

 

Cheers,

FF

0 Likes