I have a blend file with various objects in using shader node groups, I have looked through manually and cannot find a shader group but it is listed as being avialable.
The group in question is a duplicate of an existing shader group and so I want to “tidy up” the file so only the one occurence exists. I am looking for a “fresnel.001” which isn’t showing up anywhere.
I can find lost of exampled of how to createshader groups in python, but none which allow you to locate them.
I had thought I could use a script to check all materials and list them that way, but I’m not sure if it is only listing some, or the “top most” shade group.
Is there any way to check for the existence of a specific shader group and find out it’s users?
Below is the script I’m using to list shader groups, but I’m not sure how effective it is.
Can anyone offer advice / assitance please?
– CODE ----------------------------------------------------------------------------
List use of nodegroups in materials with any luck!
import bpy
import os
os.system(“cls”)
main_path = os.path.dirname(bpy.data.filepath)
filename = “NodeList_Maybe.txt”
outputfile = os.path.join(main_path, filename)
w_file = open(outputfile, ‘w’)
tmpStr = "
List of nodes maybe:
(Shadergroup - Material)
"
print("
Writing to: " + main_path + "
")
w_file.write(main_path)
print(tmpStr)
w_file.write(tmpStr)
materials = bpy.data.materials
for mat in materials:
try:
nodes = mat.node_tree.nodes
except:
continue
for node in nodes:
try:
ntree = node.node_tree
except:
continue
tmpStr = “{0:35} - {1}”.format(node.node_tree.name, mat.name)
print(tmpStr)
w_file.write(tmpStr+"
")
w_file.close()
– END CODE -----------------------------------------------------------------------
Example output:
Writing to: G:\Blender_Resources\Colkai_Blends\Arch_Viz
List of nodes maybe:
(Shadergroup - Material)
PBR (Surface) Metallic - BrassDoorHandle
DoorHandleScrews - BrassScrew
DoorLatchWithScrews - DoorLatch
PBR (Surface) Diffuse - DoorLatchbit
PBR (Surface) Metallic - DoorLatchBitBr
DoorLatchWithScrews - DoorLatchBlk
PBR (Surface) Metallic - Hinge
PBR (Surface) Metallic - KitchenSpotBulb
PBR (Surface) Metallic - KitchenSpotChrome
PBR (Surface) Glass Shader - KitchenSpotGlassOFF
PBR (Surface) Metallic - LeftHingeUvd
PBR (Surface) Metallic - RightHingeUVd
RollerLatchGrp - RollerLatch
RollerLatchGrp - RollerLatchScrew