2
$\begingroup$

The importer I do uses suffix names for import certain stuff; ie: object named "land-col" is an object with collider and "invisible_wall-colonly" is imported an invisible collider); now, my problem is when I do duplicate object blender rename them in land-col.001 and invisible_wall-colonly.001. and that .nnn broke the import feature.

So, I was wondering if I can force blender to name duplicate objects in a different way... ie; 001.wall-col or something alike?

$\endgroup$
  • $\begingroup$ can you describe a little bit more how you import stuff? are you importing in a loop from various sources with the opportunity to rename stuff inbetween sequential imports? $\endgroup$ – zeffii Sep 4 '15 at 15:42
  • $\begingroup$ I do export from Blender to Collada format. Then I use the importer in a game engine called Godot. Godot uses object's suffix names to pick the correct way the object has to be imported from collada (ie: an object with -noimport will be simply ignored... so I don't need to erase some stuff, usually lamps, everytime I export from blender). $\endgroup$ – Alexwbc Sep 4 '15 at 20:42
2
$\begingroup$

When duplicating Cube, it will create Cube.001, there is no feature that i'm aware of to allow you to specify the desired duplicate name or convention.

It is possible to rename using the reference to the object after duplication, because the duplicate becomes the active_object

# with one object selected.
bpy.ops.object.duplicate(linked=False, mode='DUMMY')
obj = bpy.context.scene.active_object
obj.name = desired_name

or a mass rename if that makes sense

for obj in bpy.data.objects:
    if obj.type == 'MESH':
       if '.' in obj.name:
          # assuming it only has one period in the name.
          basename, postfix = obj.name.split('.')
          obj.name = postfix + '.' + basename
$\endgroup$
  • $\begingroup$ Well, since Blender don't offer this feature, this script is definitely a lot of time saver. $\endgroup$ – Alexwbc Sep 6 '15 at 12:17

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.