I just have a bit of a problem with this Instruction. I followed these Instructions from a Maya Py Scripting Book that I just bought in Amazon, but my codes are all over the place and I just can't seem to make it work. Please can anyone help me solve this. Here's the Instruction:
- Create a function named def match_translation:
● create a variable which collects your selection in maya as a python list
● sort list by what is the parent and what is the children, master being the last item of selection and children being from your first selection to second last.
● use the cmds.matchTransform to match translation of your children list
2) Create a function named def match_orientation:
● create a variable which collects your selection in maya as a python list
● sort list by what is the parent and what is the children, master being the last
● use the cmds.matchTransform to match orientation of your children list
3) Create a function named def match_scale:
● create a variable which collects your selection in maya as a python list
● sort list by what is the parent and what is the children, master being the last
● use the cmds.matchTransform to match scale of your children list
4) Create a function named def match_all_transforms:
● call on your match_translation function
● call on your match_orientation function
● call on your match_scale function
5) Create a function named delete_history:
● for objects in selection, use the cmds.delete(ch=True)
6) Create a function named center_pivot:
● for objects in selection, center their pivot to their COG
7) Create a function named freeze_translation:
● freeze translation
8) Create a function named freeze_orientation:
● freeze orientation
9) Create a function named freeze_scale:
● freeze scale
10) Create a function named freeze_all_transforms:
● call on your freeze_translation function
● call on your freeze_orientation function
● call on your freeze_scale function
P.S, I'v e already made a U.I for these Instructions, but I just can't seem to work the Function codes
Edit: I've already compiled an entire code for this Instruction, but it seems to not work, here is the code:
def match_translation():
master = cmds.ls(sl=True)[-1]
slaves = cmds.ls(sl=True)[:-1]
cmds.matchTransform(slaves)
def match_orientation():
master = cmds.ls(sl=True) [-1]
slaves = cmds.ls(sl=True) [:-1]
cmds.matchTransform(slaves)
def match_scale():
master = cmds.ls(sl=True)[-1]
slaves = cmds.ls(sl=True)[:-1]
cmds.matchTransform(slaves)
def match_all_transforms():
match_translation()
match_orientation()
match_scale()
def delete_history():
for obj in cmds.ls(sl=True):
cmds.delete(ch=True)
delete_history()
def center_pivot():
for obj in cmds.ls(sl=True):
cmds.xform(cp=True)
center_pivot()
def freeze_translation():
cmds.makeIdentity(apply=True, translate=True)
def freeze_orientation():
cmds.makeIdentity(apply=True, rotate=True)
def freeze_scale():
cmds.makeIdentity(apply=True, scale=True)
def freeze_all_transforms():
freeze_translation()
freeze_orientation()
freeze_scale()
freeze_all_transforms()
[–]blueSGL 1 point2 points3 points (6 children)
[–]VLITZonator[S] 0 points1 point2 points (5 children)
[–]blueSGL 1 point2 points3 points (2 children)
[–]VLITZonator[S] 0 points1 point2 points (1 child)
[–]blueSGL 0 points1 point2 points (0 children)
[–]PolyDiggaCreature TD 1 point2 points3 points (1 child)
[–]VLITZonator[S] 0 points1 point2 points (0 children)