I'm trying to edit the Sun position addon (that's bundled with Blender). Normally the addon work by detecting Environnement Texture nodes, and then letting you pick which one to use, but I found out it doesn't detect the node if it's a custom group. So I'm trying to change that I (think) found the line in the script that detect the Env node normally:
if context.scene.world is not None:
if context.scene.world.node_tree is not None:
col.prop_search(sp, "hdr_texture", context.scene.world.node_tree, "nodes", text="")
else:
col.label(text="Please activate Use Nodes in the World panel.",
icon="ERROR")
else:
col.label(text="Please select World in the World panel.",
icon="ERROR")
col is the UI box, and sp is the sun position info And I think I need something like this:
if context.scene.world is not None:
if context.scene.world.node_tree is not None:
col.prop_search(sp, "hdr_texture", context.scene.world.node_tree, "nodes", text="")
if code-to-get-node-groups is not None:
code-to-get-the-nodes-for-each-group
else:
col.label(text="Please activate Use Nodes in the World panel.",
icon="ERROR")
else:
col.label(text="Please select World in the World panel.",
icon="ERROR")
But the thing is I don't know how to access custom groups, or the nodes inside said groups I tried looking it up, but my knowledge of python is pretty basic, so I'm a bit stuck.
Can anyone tell me if:
the logic is sound? and if it is, how do I access those groups and their nodes?
thanks in advance!
nodes["Group"].node_tree.nodes– Gorgious Aug 27 '21 at 08:49