0
$\begingroup$

I was basically wondering how you can shorten your object names automatically instead of going in and do it manually on countless of objects.

I know there is a object renaming add-on, but this only renames all the objects.

So, if anybody knows how I can just shorten the object names, I'd be very grateful!

$\endgroup$
  • $\begingroup$ @Mr Zak My mistake, I've corrected the question to object names. It's for exporting a *.3ds file, which doesn't allow more than a certain amount of characters in object names. $\endgroup$ – Skull Kid Apr 23 '19 at 17:36
  • 1
    $\begingroup$ Please edit this detail into question. Do you know how many is a certain amount? $\endgroup$ – batFINGER Apr 23 '19 at 17:44
  • $\begingroup$ It's ten characters. It can all be read on the Wikipedia article $\endgroup$ – Skull Kid Apr 23 '19 at 17:52
  • $\begingroup$ I basically have to shorten all objects name's in my scene, to be able to export in *.3ds properly, the batch renamer doesn't support this currently. $\endgroup$ – Skull Kid May 15 '19 at 5:19
0
$\begingroup$

This script renames all the objects and assigns a number.

import bpy

objects = bpy.context.scene.objects

for i in range(0, len(objects)):
    print(objects[i].name)
    objects[i].name = "object" + str(i)
    objects[i].data.name = "object" + str(i)
$\endgroup$
0
$\begingroup$

You can do this by using Python:

import bpy

objects = bpy.context.selected_objects

# number of chars you want to remove
n = 1

for obj in objects:
    new_name = obj.name[:-n]
    obj.name = new_name

Just copy this script to a Text Editor panel, select your objects and click Run Script (on the bottom bar).

P.S.: Keep in mind that Blender automatically adds a numeric suffix to the names if you have more than 1 object with the same name.

$\endgroup$
  • $\begingroup$ more on the PS, will have opposite effect re shortening names if run on for example (a not unlikely list of 3 objects): "Cube.001, Cube.002, Cube.003" result "Cube.00, Cube.00.001, Cube.00.002" and again "Cube.0, Cube.00.00, Cube.00.00.001". $\endgroup$ – batFINGER Apr 23 '19 at 17:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.