Difference between revisions of "Maya tmp"
Jump to navigation
Jump to search
Line 63: | Line 63: | ||
setAttr -type "string" ($object+".filePrefix") ("//blabla/bla.abc"); | setAttr -type "string" ($object+".filePrefix") ("//blabla/bla.abc"); | ||
} | } | ||
+ | |||
+ | </pre> | ||
+ | |||
+ | === Maya Mel - Auto Uvs and Layout=== | ||
+ | <pre> | ||
+ | polyMultiLayoutUV -scale 1 -rotateForBestFit 0 -layout 2; | ||
</pre> | </pre> |
Revision as of 15:13, 31 August 2020
Contents
Maya tmp Scripts
Maya Python - Create object & Randomize Translate
from maya import cmds import random numObjects = 4 for n in range(numObjects): obj = cmds.polyCube() cmds.setAttr(obj[0]+'.translateX', random.randint(0, 5)) cmds.setAttr(obj[0]+'.translateY', random.randint(0, 5)) cmds.setAttr(obj[0]+'.translateZ', random.randint(0, 5))
Maya Python - Randomize translate of selection #1
from maya import cmds import random objList = cmds.ls(selection=True) print objList for obj in objList: cmds.setAttr(obj+'.translateX', random.randint(0, 5)) cmds.setAttr(obj+'.translateY', random.randint(0, 5)) cmds.setAttr(obj+'.translateZ', random.randint(0, 5))
Maya Python - Randomize translate of selection #2
#La meme chose en utilisant une fonction from maya import cmds import random objList = cmds.ls(selection=True) print objList #On definit la fonction def randomize(minValue=0, maxValue=5): for obj in objList: cmds.setAttr(obj+'.translateX', random.randint(minValue, maxValue)) cmds.setAttr(obj+'.translateY', random.randint(minValue, maxValue)) cmds.setAttr(obj+'.translateZ', random.randint(minValue, maxValue)) #On change si besoin les valeurs par defaut avant d'executer la fonction randomize(minValue=4, maxValue=20)
Maya Mel - Replace path - getAttr/setAttr
for ( $object in `ls -sl -l` ) { $path = getAttr ($object+".filePrefix"); setAttr -type "string" ($object+".filePrefix") ($path+"yo"); } for ( $object in `ls -sl -l` ) { setAttr -type "string" ($object+".filePrefix") ("//blabla/bla.abc"); }
Maya Mel - Auto Uvs and Layout
polyMultiLayoutUV -scale 1 -rotateForBestFit 0 -layout 2;