feat: Add new Geometry Nodes groups for image relief and shadeless shader
- Implemented the "O Image Relief Plane" Geometry Nodes group to create a fixed-base image relief using depth images and various parameters. - Created the "O Shadeless" shader node group to display color without scene lighting while preserving shadows and reflections. - Introduced a preview feature for node groups, allowing for interactive visualization of node arrangements in an HTML format. - Added a template HTML file for rendering node previews with customizable views and controls.
This commit is contained in:
28
tools/nodes/arrangement/zones.py
Normal file
28
tools/nodes/arrangement/zones.py
Normal file
@@ -0,0 +1,28 @@
|
||||
"""Identify paired execution zones and their exclusive input calculations."""
|
||||
|
||||
from graphlib import TopologicalSorter
|
||||
|
||||
|
||||
def node_zones(node_group):
|
||||
"""Return each paired entry, exit, and its data-dependent node membership."""
|
||||
parents = {node: set() for node in node_group.nodes}
|
||||
children = {node: set() for node in node_group.nodes}
|
||||
for link in node_group.links:
|
||||
parents[link.to_node].add(link.from_node)
|
||||
children[link.from_node].add(link.to_node)
|
||||
order = list(TopologicalSorter(parents).static_order())
|
||||
ancestors = {}
|
||||
for node in order:
|
||||
ancestors[node] = parents[node] | set().union(*(ancestors[parent] for parent in parents[node]))
|
||||
zones = []
|
||||
for entry in order:
|
||||
end = getattr(entry, "paired_output", None)
|
||||
if end is None:
|
||||
continue
|
||||
members = {node for node in ancestors[end] if entry in ancestors[node]} | {entry, end}
|
||||
for node in reversed(order):
|
||||
if (node not in members and node in ancestors[end] and children[node]
|
||||
and children[node] <= members and entry not in children[node]):
|
||||
members.add(node)
|
||||
zones.append((entry, end, members))
|
||||
return zones
|
||||
Reference in New Issue
Block a user