About this site
ScriptSpot is a diverse online community of artists and developers who come together to find and share scripts that empower their creativity with 3ds Max. Our users come from all parts of the world and work in everything from visual effects to gaming, architecture, students or hobbyists.
Comments
Anubis,
is it possible to rename objects by layer name without adding number at the name end?
I seem can't find a way to remove redundant part of the code.
...
Yup. By removing "uniquename" function in this line
for n in nodes do n.name = uniquename layer.name
This line need to look like this
for n in nodes do n.name = layer.name
bga
layer by layer
Could someone please add description to the end of each line to describe how this works. In particular how does the script know to go down each layer one by one.
fn renameLayerNodes considerZeroLayer:on =
(
e = if considerZeroLayer then 0 else 1
local getLay = LayerManager.getLayer, layer
for i = e to layerManager.count-1 where ((layer = getLay i).nodes &nodes ; nodes).count > 0 do
(
for n in nodes do n.name = uniquename layer.name
)
)
renameLayerNodes()
...
You need to learn the way how maxscript works ei. execute code.
Max Script Help document will help you a lot to understand this.
Anyway...
bga
re-name all objects to each objects layer name
Has anyone worked out how to re-name all object to each objects layer name?
This will help when all objects imported into the scene have the same name.
...
Try this fn.
If "considerZeroLayer" argument is off then "0" layer will be skiped (default on)
bga
Bang on, that's cool. How
Bang on, that's cool. How does it add increments on the end of multiple objects in the same layer? Thanks a bunch really saved some time here.
...
By using this
bga
Yeah its a strange request,
Yeah its a strange request, Right now I have 154 layers with 100s of objects on some layers. all requiring the same name. would take forever naming a layer than naming all the objects on that layer.
Hey Andrew
Thats sound strange to me... For example, the default layer has preserved name "0", and if you have 20 objects inside that layer, you wan to rename all of them to "0"? I never will do that, but never mind...
How to work with layers is very well explained in the mxs docs, however, I not see any way to catch which layer is selected. You can use
layer.ON
property instead of selection. If that applicable, try this very lightly modification of the code example in the help file:my recent MAXScripts RSS (archive here)