Object vs Mesh link information

I have a following problem with python api.
Let’s assume that I have 3 objects, cubes (Cube, Cube.001, Cube.002), which were made by Alt+D cloning (so all 3 objects refers to the same Mesh: Cube).
The question is how to find the information that the OBJECT (for example Cube.001) refers to MESH Cube?
bpy.data.objects[‘Cube.001’] doesn’t contain this informtion :frowning:
bpy.data.meshes[‘Cube’].users (in this case value 3) indicates that 3 objects are linked to this mesh, but how to find that objects among other in the scene?
This is very important information for me, as far I am working on some OpenGL ES exporter and would like to avoid duplication MESH definitions (this could save a lot of memory if many objects in the scene are using the same mesh, but just rotated/translated/scaled).

Thanks a lot in advance for any hint!


Hi again,
I hate the situations, when after hours of research I am unable to find a solution, but after posting a question on the forum I find it almost immediately <shame>

So, just for anyone who will search such information:
bpy.data.objects[‘Cube.001’].data.name contains the information I needed.


if you just check for equality, do that by object data, not object data name - as with linked files, names can occur multiple times.

ob1 = bpy.data.objects[‘Cube.001’]
ob2 = bpy.data.objects[‘Cube.002’]
if ob1.data == ob2.data: …