Created
July 3, 2022 14:21
-
-
Save mclavan/166df6177a4847a878a991dc12654335 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Renaming systems with muliptle pads | |
''' | |
# Getting Selected | |
# Determin if you want to work on selected or hierarchy. | |
selected = pm.ls(sl=True, dag=True, type='transform') | |
# Determin your naming convention | |
# systemName_name_count_suffix | |
# back_fkSystem_01_local, back_fkSystem_01_icon | |
# Create the variables | |
system_name = 'ctBack' | |
name = 'fkSystem' | |
count = 1 | |
suffix_1 = 'local' | |
suffix_2 = 'icon' | |
# range loop (2 steps for local, icon) | |
for i in range(0, len(selected), 2): | |
print(i) | |
local_pad = selected[i] | |
icon = selected[i+1] | |
local_pad_name = '{}_{}_{:02d}_{}'.format(system_name, name, count, suffix_1) | |
icon_name = '{}_{}_{:02d}_{}'.format(system_name, name, count, suffix_2) | |
print('Old Name: {} {} - New Name: {} {}'.format(local_pad, icon, local_pad_name, icon_name)) | |
count = count + 1 | |
# Rename | |
local_pad.rename(local_pad_name) | |
icon.rename(icon_name) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment