Files
AnyImage/tests/tools/nodes/test_saved_layout.py
nan 5b2dc59f79 Implement arrangement framework for node groups
- Introduced `frames.py` to manage field complex calculations and their arrangement within node groups.
- Added functionality to create and remove field frames based on node arrangements.
- Developed `passages.py` to find unobstructed paths for connections around calculation frames.
- Implemented `references.py` to route shared results on peripheral tracks, ensuring efficient distribution of outputs.
- Created `sections.py` to reserve space for field calculations adjacent to geometry consumers.
- Added `sources.py` to position shared calculation sources effectively beside their distribution channels.
- Enhanced outline smoothing with `outline_smoothing.py` to adapt camera depth along original outlines.
2026-09-12 12:19:07 +08:00

38 lines
1.3 KiB
Python

from tests.support.paths import PROJECT_ROOT
import unittest
SOURCE_ROOT = PROJECT_ROOT / "src" / "anyimage"
class NodeAssetsTest(unittest.TestCase):
def test_geometry_assets_preserve_node_structure(self):
import bpy
from tests.support.nodes import validate_node_structure
from tools.nodes.arrangement.arrange import arrange_nodes
bpy.ops.wm.read_factory_settings(use_empty=True)
with bpy.data.libraries.load(
str(SOURCE_ROOT / "assets" / "O_AnyImage.blend")
) as (source, target):
target.node_groups = list(source.node_groups)
groups = [
group
for group in target.node_groups
if group.bl_idname == "GeometryNodeTree"
]
self.assertEqual(len(groups), 7)
for group in groups:
validate_node_structure(group)
positions = {node.name: tuple(node.location_absolute) for node in group.nodes
if node.bl_idname not in {"NodeReroute", "NodeGroupInput"}}
arrange_nodes(group)
for name, position in positions.items():
for actual, expected in zip(group.nodes[name].location_absolute, position):
self.assertAlmostEqual(actual, expected, delta=0.01, msg=f"{group.name}: {name}")
if __name__ == "__main__":
unittest.main()