I have hundreds of objects within a collection (Blender 2.8) and would like to avoid manually renaming each object via the UI. I'm new to Blender and noticed there is scripting support. Could anyone help me produce a script to rename my objects?

For example, I would like to rename the objects in my "Water" collection. The current names do not follow a well defined pattern (even though the screenshot may make it look that way). When renaming is done, I do not care about retaining any semblance of the current name. My only requirement is adding a custom prefix. I'm envisioning the renaming to result in object names like: Water1, Water2, etc.

enter image description here

  • $\begingroup$ This might help blender.stackexchange.com/questions/71993/…. Also, googling 'Blender Bulk Rename' seems to give some good results. $\endgroup$
    – AshKB
    Commented Feb 20, 2019 at 2:31
  • $\begingroup$ Yes, I read some of the related questions and answers, and although they do give hints to part of my question, the main missing aspect is how to target a specific collection in script. I cannot find a Blender 2.8 specific answer surrounding collections. $\endgroup$
    – Scott Lin
    Commented Feb 20, 2019 at 5:53
  • $\begingroup$ If you can select the objects within the viewort, you can try this addon. Recently updated for 2.8x. $\endgroup$
    – p2or
    Commented Feb 20, 2019 at 11:01
  • $\begingroup$ Otra versión de tipo función, agregándole la opción de prefijo para los objetos de la colección: def renombrar(coleccion_nombre=None, prefijo=None): if coleccion_nombre is None or prefijo is None: print('No definió coleccion existente o prefijo') return else: coleccion_objetos = bpy.data.collections.get(coleccion_nombre) if coleccion_objetos: for i, objeto in enumerate(coleccion_objetos.objects): nombre = prefijo + '_' + '{0:03d}'.format(i) objeto.name = nombre print('Renombrado satisfactorimente...') $\endgroup$ Commented Mar 10, 2020 at 23:42

1 Answer 1


Iterate over collection objects.

This example is a reasonably simple introduction into scripting blender's python API.

import bpy

wcol = bpy.data.collections.get("Water")
if wcol:
    for i, o in enumerate(wcol.objects):
        o.name = "Water%d" % i

To ensure they keep their previous name order, and to have "Water1" first rather than "Water0"

import bpy

wcol = bpy.data.collections.get("Water")
if wcol:
    for i, o in enumerate(sorted(wcol.objects[:], key=lambda o: o.name)):
        o.name = "Water%d" % (i + 1) # to start from 1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .