# Is there a quick way to copy the Object Name to the Mesh Data Name?

I like to keep my scenes clean. Much of my Blender life is spent naming an object, copying the name and pasting the same object name into the mesh data name. Is there a quick way of doing this (or an add-on out there) where I can name a single-user mesh and the mesh data will be replaced with the same name?

• There's addon which probaly does something similar. – Mr Zak Feb 12 '16 at 19:13
• I already have Name Panel by Proxe, which should do the same thing, but without documentation, I just haven't take the time to figure out how to do that yet. – Bryson Jack Feb 12 '16 at 19:16
• As I tried it you select objects, Space > Mesh To Object name (unfortunately script doesn't have explanation where to find it in UI but I think Space menu was intended). The downside is that you should remember which command to type. – Mr Zak Feb 12 '16 at 19:18

My answer is a tip rather than a true solution, but it may save your time a bit. Instead of copying and pasting you may just click on the object's icon and drag it to the mesh datablock window.

• That is slightly faster than hover Ctrl+V then hover Ctrl+P, thanks...I will use that as my new workflow if it is the best answer that comes up. I had no idea you could do that. – Bryson Jack Feb 12 '16 at 19:12
• Wow that is fantastic, I've been using blender for a few years and never knew about that one, great tip! – Duarte Farrajota Ramos Feb 12 '16 at 23:33

Well I've had the same problem for quite a while, I like keeping my scenes clean and objects well named and always spend considerable amount of time doing so. There are quite a few addons around that make the task easier though.

1. Name Panel addon is my favorite and combines a name panel on the properties shelf of the 3D view with a fantastic batch renaming tool for renaming and name copying en mass
2. There is also Batch Rename Datablocks which also works quite well albeit a little simpler.
3. And also Batch Naming which doesn't copy names but also does batch renaming

And if you want to change the name through Blender's Python API you can run the following:

bpy.ops.object.select_all(action='DESELECT') # Deselect everything in the scene
bpy.context.scene.objects['oldMeshName'] # Select the mesh whose name is going to change
bpy.context.scene.objects.active.name = 'newMeshName'
bpy.context.scene.objects.active.data.name = 'newMeshName'

• One liner: bpy.context.active_object.data.name = bpy.context.active_object.name – brockmann Feb 21 '18 at 11:01

This script renames all data instances with one user object to the object's name. Just paste it into the Python console in Blender.

objects = bpy.data.objects
for obj in objects:
if obj.data and obj.data.users == 1:
obj.data.name = obj.name

• For the simplest of cases this will work fine, for others May or may not work as expected. As mentioned in question needs to be a single user mesh. If any mesh is shared only one mesh will end up with name of object using it, but will be renamed for each. If an empty is selected it will throw an error. Need to narrow down selection accordingly. – batFINGER Mar 26 at 11:16
• I overread the single-user part. I updated the script to only affect meshes that have a single object. – janispritzkau Mar 27 at 7:26
• Would go for if obj.data and obj.data.users == 1: since same applies for curves, armatures etc. – batFINGER Mar 27 at 11:00