2

The files I work with have gone through a lot of versions and are linked a lot, and aren't that organized. I am trying to set up a new palette of colors and so I stripped off all the materials in a file (this way). When I reloaded the file most of the materials were gone, but there is this list of them that stubbornly remain, including after purging orphan data as explained here.

scene with no materials and orphan data purged, showing a set of materials still present

There are two groups in the scene that may well have been appended or linked from their own files, or the scene may have been created by deleting everything except these pieces, or both. I don't remember. Nothing is linked here anymore, except that Glossy Black material and that I tracked down in another file, where it was also linked from another file, and I don't remember that, and you see where this is going.

How can I find where those materials are coming from and remove them?

Edit: Ok, the materials seem to be coming from a library that has a broken link. I moved it to a new location, and tried updating the external data links with 'find missing files', but that doesn't seem to have worked for this.

enter image description here

Edit 2: I fixed the broken link to Materials-Lalande by replacing that file, which had been moved, in the place where it was looking for it. Now it doesn't list the library in the resources. Also, I can delete the materials now, which would just reappear when I reloaded the file when I tried to do that before. This is resolving the problem. There remains no indication where blender lists the materials as being used. Each one has 2 users, but I can't find what those users are.

enter image description here

kim holder
  • 2,042
  • 3
  • 24
  • 57
  • 2
    Your materials don't have a zero in front of their name, so that means they are still used somewhere and can't be purged. Now the challenge is finding out where. Check for orphaned object data or objects on other scenes that might still be using them. – Duarte Farrajota Ramos Sep 21 '18 at 16:32
  • @DuarteFarrajotaRamos Could they be on empties? That is the only thing i can think of. How do I check what other files are linked to in this file? – kim holder Sep 21 '18 at 16:44
  • 1
    Empties can't use materials, but they can be on certain modifiers, particle systems, material overrides, they can still be assigned to object data but your materials slots are set to Object and thus not showing – Duarte Farrajota Ramos Sep 21 '18 at 16:52
  • Outliner can be set to Blend File to show linked data, but your materials are not linked otherwise they'd have an L in front of the name – Duarte Farrajota Ramos Sep 21 '18 at 16:54
  • @DuarteFarrajotaRamos Ok, i edited with a screenshot that shows a broken link to a material library. That looks very suspicious. But i just tried deleting that library, and when i reload, it comes back. – kim holder Sep 21 '18 at 17:04
  • please expand the sections for Impeller-Pump.blend and Materials-Lalande.blend. There you see what is being pulled from those files. Also, open Impeller-Pump.blend and check if it is pulling stuff from Materials-Lalande.blend. If that's the case, and the link is broken in Impeller-Pump.blend too, you should be able to remove or reroute the link from there. – aliasguru Sep 21 '18 at 17:14
  • I also went object by object to check that none of them have a material. None of them do. And none of them are linked in from another file, except one, and that case i looked after, it was only one material. – kim holder Sep 21 '18 at 17:14
  • @aliasguru Glossy Black was the material on ImpellerPump. I opened that and made its material local and then deleted it. That deleted that material from the list. But the rest of the materials are still there, even though when I check object by object, none of them have materials. There aren't any particle systems, or anything else that might support a material. – kim holder Sep 21 '18 at 17:26
  • Try this on materials https://blender.stackexchange.com/questions/58874/how-can-i-find-my-particle-system/58875#58875 – Duarte Farrajota Ramos Sep 21 '18 at 17:39
  • 1
    Have you tried the solution outlined here? – batFINGER Sep 21 '18 at 17:55
  • @batFINGER No, let me try that on the other, larger file where this remains an issue. – kim holder Sep 21 '18 at 18:02
  • @batFINGER That works. I tried that before, but I've never used the python console, and didn't understand that the command hadn't been executed because I needed to press enter twice. Not once. Okay, now I have tools. – kim holder Sep 21 '18 at 18:23
  • Nice. My MO is paste into new text block and hit run script. – batFINGER Sep 22 '18 at 07:29

1 Answers1

1

On a peer material basis.

  1. Try bpy.data.materials['nameofthematerial'].user_clear()
  2. Reload the file.
  3. If still there,

    for i in bpy.data.scenes['Scene'].objects.items():
        for j in i[1].material_slots: 
            if j.name == 'nameofthematerial':
                print(i[1].name)
    

    Will give you a list of the objects in the scene that the material is connected to. Do you have only one scene ? If no you can repeat the operation for each scene, if yes you might find an elegant solution by including another for that will loop through the scenes, but hey got to keep some handwork and this might be futile unless you have ~10 or more scenes.

Yvain
  • 722
  • 5
  • 20
  • 1
    Doing step one deletes the material temporarily until i reload the file, then it's back. When i do step 3, nothing is printed out. I have set up the situation again from an older file to test with. So we might keep playing with it. – kim holder Sep 21 '18 at 20:56
  • The issue with step 3 as I see it is: it will only print if the material is in the active (selected) material slot. IMO need to look at all slots. for name, ob in scene.objects.items(): if thematerial in [s.material for s in ob.material_slots]: Also not that bpy.data.materials.remove(thematerial) now unlinks by default. – batFINGER Sep 22 '18 at 07:27
  • That's true, here i edited to code so that it will ouput the name of any object that contains the material name entered, in any of it's slot. – Yvain Sep 22 '18 at 08:01