Skip to content

Instantly share code, notes, and snippets.

@mclavan
Created July 3, 2022 13:50
Show Gist options
  • Save mclavan/9f479a09df29e69952e367955a947fc2 to your computer and use it in GitHub Desktop.
Save mclavan/9f479a09df29e69952e367955a947fc2 to your computer and use it in GitHub Desktop.
'''
# Joint Naming
# - This one is a bit harder because the last name will change from 'bind' to 'waste'
# Naming Convention
# orientation, name, count, suffix
# ct_back_01_bind -> ct_back_02_waste
Gist Link:
'''
import pymel.core as pm
ori = 'ct'
joint_name = 'head'
count = 1
suffix = 'bind'
selected = pm.ls(sl=True)
# [nt.Transform('cluster'), nt.Transform('cluster1'), nt.Transform('cluster2'), nt.Transform('cluster3')]
for current in selected:
new_name = '{0}_{1}_{2:02d}_{3}'.format(ori, joint_name, count, suffix)
print(new_name)
count = count + 1
current.rename(new_name)
new_name = '{0}_{1}_{2:02d}_{3}'.format(ori, joint_name, count-1, 'waste')
print(new_name)
selected[-1].rename(new_name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment