How to find the users of a node goup (material)?

I have duplicated node groups and I would like to find the ‘user’ materials?
Is there a way for it? Thanks

That a good question. I don’t think there’s a built in way. You might could do it with python. I messed around a little yersterday ,but couldn’t get anything working. My guess is get active node group, check to see if has multiple users, and then get material(the tricky part). Prolly pretty simple ,but I couldn’t figure it out for ya. After doing to thinking you might have to get all materials and then check if it has that same node group. It’s prolly reversed of what I was thinking at first.

OK, I think this is working. I done more complicated things with python ,but haven’t messed with nodes.

import bpy

act_mat = bpy.context.object.active_material
node_tree = act_mat.node_tree
act_node = node_tree.nodes.active


for groups in bpy.data.node_groups:
    # NodeGroup is the name of the node group    
    if bpy.data.node_groups[groups.name].users > 1:
        for material in bpy.data.materials:
        # Group is the name of the node
            if act_node.name in material.node_tree.nodes:
                print(material.name)

OK, I spent a little time add got this addon put together. See if it does what you want. I was trying to get it to work with just node groups ,but it kinda works with nodes and node groups. It’s under properties > node panel. Toggle Node Users to see what material uses that node / node group.

There is a material named ‘sphere’ on the sphere, it’s not the object name.


Hello AFWS,

thanks for your time; I haven’t checked this post for a while; i will test the addon today. I found it very problematic to identify users of data block; yesterday I was haunting for the user of a texture (no joy), a few days ago to fing a linked group what cause error message, does not exist in the scene, but present in the source lib…

nice work… thank you AFWS
was always missing some info/description in Outliner > Data-Blocks…
since there’s no real easy to find data about relations/associations/connections/dependencies

@AlmaTalp
Hint: Have you tried to Purge Orphans? Usually it clears & cleans the file of all left overs.

Seems not to work to me, error during the install both on 2.78 and 2.79 on Win7 64.
https://ufile.io/mlw88

Yeah, I noticed it gives error the next day. Had a couple versions and copied code back and forth. This should work node_users.zip (857 Bytes) Doesn’t look like you can really ‘detect’ a node group on a material. The only way to really detect a node is through the nodes name. If you change the nodes name you will get false reading. I’ll play around with it some more ,but I don’t think it will get any better.

Hello burnin; I use purge orphans regularly, but it has its serious flaws and I work with many linked stuff from node groups, to materials and groups. I completely miss the management of datasets; if I choose the datablock view I could see that - as an example - a texture called whatever.001.png (another thing what drives me crazy) has only 1 user, but I have no option to find that user (same for meshes, node goups, etc.). With a scene contains over 80K object it is a real challenge… @AFWS: I will give it a try. Theoretically there should be a way to find the users easily, but yeah, it seems to be a little bit abandoned area in Blender. Thanks anyway, I will give you a feedback after I tested. PS: I spent a whole day with hunting the users of some duplicates and replacing them with the originals; with a proper tool it were be 5 minutes.

I have to point out a warning about the Purge Orphans command: it simply and quietly saves and reloads the file, so, if you are not aimed to save at that stage of the work, don’t use it.

EDIT: and it is a shameful behavior, if you ask me, it could at least warn!.

paolo

OK, I’ve played a little more and I got this. It’s doesn’t matter what the name of node group is now. The only thing I don’t like is it display all node groups and not just the active. Displays the material, the node group. and the label of node(I changed after screenshot).


Thanks, Paolo, that seems to be a big mistake.

Thanks, AFWS.

Thank you for your work, I tried it. It seems to work on Nodes, not on Node Properties (Names). Somehow it seems to be allowed to to have different nodes to use the same name in different nodes/node grops. If the nodes are properly named, it fulfills the needs.
What do you think, is it possible to make it work on the Node names (properties)? That would be awesome; maybe we should ask to put it in the branch, I have some ideas for increasing usability, I have to think about the workflow.

So thanks again; I’m really curious if it could be implemented in Node Property level.

I read this and the more I read it the more I get confused on what your saying. Before it worked off of the nodes name. The last screenshot I posted, shows it working off the name of the node group(which is the name under properties), so now the name of the node can be anything.

Green node name, red is the name of node group.
Is the red what your talking as node properties?

Ah, sorry; I tested the one you uploaded, not the latest. Maybe that works differently.

Here’s the latest tweak. Getting a little fancy with the material icons, lol. Now displays material, node group, label, and if the node group is being used or not(linked). There’s one thing I’m trying to figure out. I’ll upload if I do or don’t figure it out.


Looks better and better.
If I could have a tip: think about having hundreds of materials (like I have), so the visual approach has to be able to handle that, also showing additional info could be an option (checkbox?). What do you think? When you will have a working version, please upload it and will take a look. Thanks.

I got checkboxes for the options, lol. I got it working pretty good now. You can display all nodes groups on all materials or just the selected node group. It took me a bit to get the selected group working ,but I figured it out. I’ll upload file tomorrow sometime. I just seen in your reply about having it in properties panel. That might be more of a appropriate place to put it. I’ll change that tomorrow.

nodegroup_users_nameless2 (2).zip (1.43 KB)

I haven’t tried it yet, but sometimes 100s of .nnn references to try to fix manually has thrown me off. Linked materials work (no dupes created) fine at home but fails at work due to paths. Appended materials will add dupes to everything but I can bring the project with me.

So, is there a way to not only find the .nnn reference but alo remap it to the original (no postfix) reference? If I append 10 materials that uses a custom math function, the math function will get duplicated. I want all materials to reference “MyMathFunction” instead of “MyMathFunction.nnn”. Is this at all possible? Only talking about the material users here, not meshes and the like (which I don’t always rename).

Agree, that is behind the problem I had!