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 CLOSED
 
Thread Tools Search this Thread Display Modes
Old 07 July 2012   #1
Optimized Textures Location with Python

Hi,

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...

Thanks
 
Old 07 July 2012   #2
There is a mel script for changing texture directories thats pretty awesome :
http://www.creativecrash.com/maya/d...etexturemanager
It might be of help.
 
Old 07 July 2012   #3
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
 
Old 07 July 2012   #4
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
 
Old 07 July 2012   #5
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.
 
Old 07 July 2012   #6
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.
 
Old 07 July 2012   #7
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
CGSociety
Society of Digital Artists
www.cgsociety.org

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

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


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