Skip to content

Instantly share code, notes, and snippets.

@mclavan
Created July 3, 2022 13:49
Show Gist options
  • Save mclavan/71ca49a2995c20908c38b42b0105e9db to your computer and use it in GitHub Desktop.
Save mclavan/71ca49a2995c20908c38b42b0105e9db to your computer and use it in GitHub Desktop.
'''
Renaming Part 2 - selection and loops
- Provided Scene (bloop_rename_01.ma)
'''
# Cluster Naming Convention
# SystemName_clusterName_count_suffix
# ctBack_crvClust_01_clust
import pymel.core as pm
system_name = 'ctBack'
cluster_name = 'crvClust'
count = 1
suffix = 'clust'
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(system_name, cluster_name, count, suffix)
print(new_name)
count = count + 1
current.rename(new_name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment