Skip to content

Instantly share code, notes, and snippets.

@mclavan
Last active October 18, 2020 00:13
Show Gist options
  • Save mclavan/ae004335b519a962abadce7ee967fa75 to your computer and use it in GitHub Desktop.
Save mclavan/ae004335b519a962abadce7ee967fa75 to your computer and use it in GitHub Desktop.
Coding Session 10/17/2020
# Creating an world FK Control system
# Create 4 World FK Controls
# Get Target Joint(s)
#current_joint = 'joint9'
# Get Selection
# ls command
current_joint = pm.ls(sl=True)[0]
# Creating a control
#circle -c 0 0 0 -nr 0 1 0 -sw 360 -r 1 -d 3 -ut 0 -tol 0 -s 8 -ch 1;
# 0 1
# Result: [nt.Transform(u'nurbsCircle1'), nt.MakeNurbCircle(u'makeNurbCircle1')] #
icon = pm.circle(c=(0, 0, 0), ch=1, d=3, ut=0, sw=360, s=8, r=1, tol=0, nr=(0, 1, 0))[0]
# Moving it into position
# pointConstraint -offset 0 0 0 -weight 1;
kenny = pm.pointConstraint(current_joint, icon, weight=1, offset=(0, 0, 0))
# Delete the constraint
pm.delete(kenny)
# Freeze Transforms & Delete History
# makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 -pn 1;
pm.makeIdentity(icon, n=0, s=1, r=1, t=1, apply=True, pn=1)
#delete -ch;
pm.delete(icon, ch=1)
'''
# Tool Building Process
'''
# Commenting out your Code
# Researching the command
# Converting commands into Python
'''
Converting Code
import pymel.tools.mel2py as mel2py
mel_line = 'makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 -pn 1';
print mel2py.mel2pyStr(mel_line)
'''
# Catching Values
'''
icon1 = pm.circle(c=(0, 0, 0), ch=1, d=3, ut=0, sw=360, s=8, r=1, tol=0, nr=(0, 1, 0))[0]
print 'Created Icon:', icon1
icon2 = pm.circle(c=(0, 0, 0), ch=1, d=3, ut=0, sw=360, s=8, r=1, tol=0, nr=(0, 1, 0))[0]
print 'Created Icon:', icon2
icon3 = pm.circle(c=(0, 0, 0), ch=1, d=3, ut=0, sw=360, s=8, r=1, tol=0, nr=(0, 1, 0))[0]
print 'Created Icon:', icon3
pm.parent(icon3, icon2)
pm.parent(icon2, icon1)
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment