View Full Version : Optimized Textures Location with Python

07 July 2012, 10:19 AM

Do you know how in python i can :

- Switch the "Optimized Textures location' from 'sourceimages/cache' to 'Custom Location' ?
- Toggle On/Off 'Use Optimized Textures(auto-conversion)'

All i could figure for the moment is to change the texture location :

cmds.optionVar( sv=('miFileTextureCacheLocation', '//myServer/MR_MAP_CACHE) )

If a MEL solutoin exist, i'm still interested. I don't want to go over 25 machines and set up this each time. Wanted to include it in a userSetup...


07 July 2012, 01:31 PM
There is a mel script for changing texture directories thats pretty awesome :
It might be of help.

07 July 2012, 01:54 PM
I know FileTextureManager but it's not really what i'm looking for.

I want to make couple of Maya preferences action through script...take a look at my first message

07 July 2012, 02:29 PM
You are on the right track.
Have you tried searching through the userPrefs.mel file for the specific name of the optionVar to control enabling/disabling optimized textures?

a quick search yields:

-iv "miFileTextureCacheConversionScope" 1
-sv "miFileTextureCacheLocation" ""
-iv "miFileTextureCacheStorageMode" 0

07 July 2012, 02:59 PM
Yeah thanks for the input rgkovach123

So these lines works even if it doesn't update the Maya interface...bit lame though...

Here are the lines, if someone got interested by this too, it's pretty handy to setup many machines using .map at a same location with a single shared userSetup.

#Activate the Maya-style alpha detection
cmds.optionVar( sv=('miUseMayaAlphaDetection', 1) )

#Activate the use of optimized textures
cmds.optionVar( sv=('miCacheOptimFileTextures', 1) )

#Set Optimized Textures Location to 'Custom'
cmds.optionVar( sv=('miFileTextureCacheStorageMode', 1) )

#Set the path where the .map will be generated
cmds.optionVar( sv=('miFileTextureCacheLocation', '//myServer/MR_MAP_CACHE') )

#Set conversion mode to Assigned Textures Only
cmds.optionVar( sv=('miFileTextureCacheConversionScope', 0) )

07 July 2012, 04:13 PM
updating the UI and setting the optionVars are two different operations. To keep them in sync, you would need to manually update the UI.

Maya usually modifies these types of values through MEL scripts that handle both updating the prefs and providing the UI with the new data.

CGTalk Moderation
07 July 2012, 04:13 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.