One would think that this:
- MAYA_PRESET_PATH
But, that's for a completely different preset API, one defined purely for the attribute editor and actually implented in MEL. The nodePreset built-in command used by the render settings window to build its preset list completely ignores MAYA_PRESET_PATH. So instead of setting an environment variable, I have to copy a preset into everyone's home maya/2009-x64/presets directory.
Really appreciate for this explanation after I wasted my life trying to find out what's wrong with the MAYA_PRESET_PATH
ReplyDeleteBut I eventually found another annoying problem such that when I tried to use the command "nodePreset" to load some pre-saved preset, ex: mayasax.mel , of which the node type is nCloth
I got an error message like this:
Error: Unable to find preset file
/home/...blahblah.../2009-x64/presets/nClothPreset_mayasax.mel. #
What!? Why does maya have to put a prefix "nClothPreset_" in front of my preset name?
And tell me that file doesn't exist?
I really don't understand maya
In Python:
ReplyDeletefrom pymel.all import *
from shutil import copyfile
import os
defaultPresetPath = mel.saveAttrPreset(whateverNode.name(), presetName, 0)
# Move the preset wherever you like
copyfile(defaultPresetPath, newPresetPath))
# Remove the local maya preset
os.remove(defaultPresetPath)
# Load the preset from a custom location
mel.applyAttrPreset(matchingNodeTypeName, newPresetPath, 1)