[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 5150: file_get_contents(https://freedomsponsors.org/api/project/294): failed to open stream: HTTP request failed! HTTP/1.1 502 Bad Gateway
Blender: batch naming while keeping LOD number - Forums | Torque 3D

Blender: batch naming while keeping LOD number

3rd party tools like asset generators, editors.
1 post Page 1 of 1
doc
Posts: 17
Joined: Thu Feb 05, 2015 9:14 am
by doc » Mon Feb 29, 2016 2:37 pm
I've always found quite annoying to name each single object while working in Blender.
Expecially when it comes to make a model for Torque.
If you are using trailing numbers for the LOD, you will quickly notice how splitting a mesh adds a .001,002 and such.

Say we want to make a huge TSStatic and we want it to be culled in parts, the result will be similar:

Image

There's a cool utility called Name Panel, and can be found here: https://github.com/trentinfrederick/name-panel
You just have to select your objects, the hit space, batch name and select "selected", the little brownish cube and done.
No. Doesn't work with our LOD, it would number our shape as shapeLOD500.1 etc.

How to solve this problem?

download the zip from github and unpack it.
go to scripts/function/batch.py
around line 2576 https://github.com/trentinfrederick/nam ... h.py#L2576

change:
# duplicates
if collection[item[1]][0] not in duplicates:

# name
if hasattr(collection[item[1]][1][1], 'name'):
collection[item[1]][1][1].name = collection[item[1]][0] + option.separator + '0'*option.padding + str(i + option.start).zfill(len(str(collection[item[1]][1][0])))
elif hasattr(collection[item[1]][1][1], 'info'):


to:

# duplicates
if collection[item[1]][0] not in duplicates:
# name
if hasattr(collection[item[1]][1][1], 'name'):
optSt = option.start-1
if(optSt < 0):
optSt = 0
trail = chr((i + optSt) + ord("A"));
collection[item[1]][1][1].name = collection[item[1]][0] + option.separator + '0'*option.padding + trail + option.suffix
elif hasattr(collection[item[1]][1][1], 'info'):


and around line 2595 https://github.com/trentinfrederick/nam ... h.py#L2595

change:
# name
if hasattr(item[1][1], 'name'):
item[1][1].name = item[0]
elif hasattr(item[1][1], 'info'):


to:

# name
if hasattr(item[1][1], 'name'):
item[1][1].name = item[0] + option.suffix
elif hasattr(item[1][1], 'info'):


at last, around line 2646 https://github.com/trentinfrederick/nam ... h.py#L2646

change:

# prefix & suffix
newName = option.prefix + newName + option.suffix


to:

# prefix & suffix
newName = option.prefix + newName


then install the script normally.
When you will run the batch name, it will append the suffix at the end of the object's name and adds a letter instead of a number. For instance:

CubeLOD300.1
CubeLOD300.2
CubeLOD300.3

will be:

Cube.ALOD300
Cube.BLOD300
Cube.CLOD300

just remove the "separator" from the field in the menu to an empty and the suffix to -LOD300 and you will have:

CubeA-LOD300
CubeB-LOD300 and so on.

the result with the previous example is now this:

Image

I hope it will be useful!
1 post Page 1 of 1

Who is online

Users browsing this forum: Bing [Bot] and 1 guest