5

I find it difficult to understand that there are two users of that mesh data in my blend file.

How can I clearly track the user of a block of data in Blender?

enter image description here

J. SungHoon
  • 2,196
  • 11
  • 36

2 Answers2

3

Via a script.

Re-visiting https://blender.stackexchange.com/a/230425/15543 which was written to see which material data-block used which images.

An image, like a mesh, world, material ... in blender is an ID object. Given the image is our ID object of interest Run over all the ID objects in the blend and list and report any where ob.user_of_id(ID) is > 0

Copy and paste the script block below into the text editor and run it. Output is written to the system console:

import bpy
from bpy.types import bpy_prop_collection

def search(ID): def users(col): ret = tuple(repr(o) for o in col if o.user_of_id(ID)) return ret if ret else None return filter(None, ( users(getattr(bpy.data, p)) for p in dir(bpy.data) if isinstance( getattr(bpy.data, p, None), bpy_prop_collection )
) )

img = bpy.data.images[0] #img = bpy.data.images['Foo'] # an image named Foo

report

print(repr(img)) print("Users:", img.users)
for users in search(img): print(users)

Test run. Image used in material, "Material", node group "NodeGroup", reference image empty "Empty", texture "Texture" and world "World".

bpy.data.images['Screenshot from 2021-06-17 17-17-47.png']
Users: 5
("bpy.data.materials['Material']",)
("bpy.data.node_groups['NodeGroup']",)
("bpy.data.objects['Empty']",)
("bpy.data.textures['Texture']",)
("bpy.data.worlds['World']",)

Or for an Object type

.. or users of context object, edit to img = bpy.context.object

result

bpy.data.objects['Cube']
Users: 2
("bpy.data.collections['Collection 1']",)
("bpy.data.scenes['Scene']",)

How to find out what is using an image in a blend file

How to find the users of a material?

How do I find which materials are using a particular node group

batFINGER
  • 84,216
  • 10
  • 108
  • 233
3

First, deselect all.

You can then select all users of (eg) a mesh by right clicking that mesh in the outliner then clicking "select linked":

enter image description here

It should work with any linked item as materials, etc.

Then if you switch the outliner to "selected", it will list just all linked users.

enter image description here

bring now able to look at your file, it seams really weird...

you have 1 scene, and bender reports 1 object, but in the datablocks you have 188 objects... how many should it have in your goal?

enter image description here

and you "only" object has currently one of dozen other meshes...

enter image description here

could it be that this file has issues due to a "troubled" history..?

I tried appending only this object from your file (all 188 objects are still there) to a blank new file, and it works well now, and its mesh has only 1 real user, as it should have been...

enter image description here

m.ardito
  • 11,967
  • 2
  • 23
  • 36
  • Thanks for the reply. But that doesn't work for my files. Only one object in my scene is still selected. I have attached a blend file for you. Please check my file. – J. SungHoon Nov 08 '17 at 12:25
  • 1
    I updated my answer... – m.ardito Nov 08 '17 at 12:53
  • OMG...Yes I did a lot of work in this scene. But I knew that Blender would delete the data it did not use when closing the file. Why dose the blend file has leftover residue data? What habits do I have to prevent this from happening? – J. SungHoon Nov 08 '17 at 13:14
  • 1
    I tried appending objects from your file into a blank new file, it works, objects are all still there... you could do the same, either import in the new file only what you need, or as they are many, import a bunch of them and delete what should be gone. Then import others, and continue until your new file is OK. – m.ardito Nov 08 '17 at 13:33
  • updated answer again – m.ardito Nov 08 '17 at 13:38
  • Yes, thank you very much. I learned a lot. I thought it was a bug in the program, but I think I've worked too excessive. In the next work, I will parallel data cleanup. – J. SungHoon Nov 08 '17 at 14:14
  • that should not happen, imho, but I don't know the history of this file... if you delete an object, it should go away... why you had such a mess, it is a mistery to me... if you can understand how that happens, you should open a bug tracker issue, adding details on how to reproduce. – m.ardito Nov 08 '17 at 15:06
  • I'm afraid I don't know why this happened...It is a mystery to me too. Currently, Blender seems to have a hard time tracking the blocks of data. If Blender's data block tracking was convenient, you would not need to move objects to a new file. I think OOPS Schematic, which existed in Blender in the past, would be useful. – J. SungHoon Nov 08 '17 at 15:48
  • I found out that the group kept them. If I want to completely remove an object from the scene, I should also make sure it remains in the group. – J. SungHoon Nov 10 '17 at 13:00