I need to write a new name to replace the word Character that already contains each of the objects in my scene with a new name that I can write.
My objects are called: Character_Nametest_001///Character_Othername_001///Character_Test_001
Ideally, you should use a menu like the one in this exercise:
macroScript RenameThem category: "HowTo"
(
rollout rename_rollout "Enter New Base Name"
(
edittext base_name ""
button rename_them "RENAME SELECTED OBJECTS..."
on rename_them pressed do
(
if base_name.text != "" do
for i in selection do i.name = uniquename base_name.text
)--end on
)--end rollout
createDialog rename_rollout 250 50
)
Solved! Go to Solution.
Solved by denisT.MaxDoctor. Go to Solution.
macroScript NameChange
category: "MXS with denisT"
buttonText:"NAME CHANGE"
toolTip:"Name Change with denisT"
autoUndoEnabled:off
silentErrors:off
(
local d
global NameChangeRol =
(
rollout NameChangeRol "Object Name Change" width:191
(
local opened = if opened != undefined do opened
local dialog_pos = if dialog_pos != undefined then dialog_pos else unsupplied
local source_text = if source_text != undefined then source_text else ""
local target_text = if target_text != undefined then target_text else ""
edittext source_name_ed "Source:" text:source_text fieldwidth:130 align:#right offset:[8,4]
edittext target_name_ed "Target:" text:target_text fieldwidth:130 align:#right offset:[8,0]
on source_name_ed changed text do source_text = text
on target_name_ed changed text do target_text = text
button name_replace_bt "Replace" width:180 align:#right offset:[8,0] \
tooltip:"Replace Source part of object name with Target"
button name_casechange_bt "Change Case" width:180 align:#right offset:[8,2] \
tooltip:"Change object name case\n Default\t - To Lower\n +SHIFT\t\t - To Upper"
on name_replace_bt pressed do undo "Name Change" on if source_name_ed.text.count > 0 do
(
for obj in selection do obj.name = substitutestring obj.name source_name_ed.text target_name_ed.text
)
on name_casechange_bt pressed do undo "Name Change" on
(
for obj in selection do obj.name = (if keyboard.shiftPressed then toupper else tolower) obj.name
)
on NameChangeRol close do
(
dialog_pos = getdialogpos NameChangeRol
opened = off
updateToolbarButtons()
)
on NameChangeRol open do
(
opened = on
updateToolbarButtons()
)
)
)
fn destroy =
(
try(destroydialog d) catch()
)
fn create =
(
createdialog d pos:d.dialog_pos
)
fn enabled =
(
iskindof (d = try(globalvars.get #NameChangeRol) catch()) RolloutClass
)
on isChecked do enabled() and (d.opened == true)
on execute do if enabled() do
(
if (d.opened != true) then create() else destroy()
updateToolbarButtons()
)
)
I hope you know how to add Macroscript to the system
Can't find what you're looking for? Ask the community or share your knowledge.