Optimized Textures Location with Python

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
  07 July 2012
Optimized Textures Location with Python


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
There is a mel script for changing texture directories thats pretty awesome :
It might be of help.
  07 July 2012
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
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
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) )

Last edited by sonicstrawbery : 07 July 2012 at 03:06 PM.
  07 July 2012
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.
  07 July 2012
Thread automatically closed

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.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 07:31 PM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.