Renaming Tool


#1

Hello, I am trying to build a renaming tool using MAXSCRIPT.

Any help would be wonderful.

Currently I am trying to select something from my scene that I had populate via the geometry in the scene with a multilistbox and replace the name with something from another multilistbox. But before I try to attach two separate chunks together, I’d figure I would test it with “Fred”.

TLDR: I want to replace this with that using a button between multilistboxes.


local theobjs = for g in geometry
collect g
local theobjs_Name_show = for g in theobjs collect g.name
theListBoxitems = theobjs_Name_show



multilistbox theSceneNamesBox “Scene Object List:” items: (theListBoxitems)
height:3 width:160
group “Editor” (
listbox theRenamingBox “Names to choose from:” items:#(“Screw”,“Nut”,“Bolt”)
across:4 height:3 width:160 align:#left
button theRenameButton “Rename” width:80 align:#center offset:[30,25]
on theRenameButton pressed do
(
–format (“Fred”) items.selection in theSceneNamesBox
if theSceneNamesBox.selection = 1 do
(
temparray = theSceneNamesBox.selection
theSceneNamesBox.items = (“Fred”)
theSceneNamesBox.selection = temparray
)
)



#2

first of all… what not can you do with the built-in Rename Objects tool in MAX?
could you give a list of possible features that the Rename Objects tool missed?


#3

I am trying to make a Batch Rename.

Basically you can by doing what I said above, or you can do a batch rename.

What Batch Rename will do is the “Z” function on the viewport, go to the object in the scene, let you look at it, and you can pull from a list of names to click rename. You can then go to the next object automatically rather quickly and it makes this a fast interaction.

Context" I had a task to rename 4000+ objects and found myself using the scene explorer and Rename Objects Tool in Max, but it didnt help when there were nothing but Box001’s or whatever. with a specific naming convention that a programmer told me to put certain objects based on what they were. A screw, nut bolt, etc. So he could assign scripts to them as long as they were named perfectly. I am trying to make a tool to quickly do that, use my eye to double check everything, but go quickly in renaming if that makes sense.

This task seemed automate able so, that is what I am trying to do. Reducing 5-6 button clicks between two windows to 1-2 button clicks on 1 window. I could also post the full code if you would like.


#4

OK. all makes sense.
now … do you most care about UI solutions or ‘rename’ methods?
i would do it first starting with ‘rename’ methods library (or struct). just design, collect and put together all methods you need:
-> replace substring
-> find by pattern
-> make unique
-> name with increment
-> split ‘camelcase’
etc.

also i believe you need “find by class” methods, hierarchy parsing…


#5

Okay forgive me if I say something that sounds silly, because MAXscript is now my first scripting language basically.

I understand what you mean by make a methods library outside. To add ontop:

•Write to .txt file outside of max to populate one of the multi-task lists

I will just “call” to them inside of my actual buttons?

I would basically say:

fn NameReplace
(
code code code
code code code
code code code
)

on theRenameButton pressed do
(
for s in selection do NameReplace = uniquename theRenamingbox.selected
)

Correct?