Files
AnyImage/tests/tools/nodes/test_inventory.py
nan 8ae3c1d5b7 Refactor geometry node groups for image depth processing
- Introduced new utility functions in common nodes for evaluating fields and capturing attributes.
- Simplified volume field calculations in image depth cutout and panorama groups by utilizing new utility functions.
- Enhanced readability and maintainability of the image depth cutout and panorama node groups by removing redundant code and improving function usage.
- Adjusted default values for thickness and depth scale in image relief plane group for better user experience.
- Improved handling of geometry attributes and connections in image depth plane group to streamline processing.
2026-09-10 16:46:19 +08:00

26 lines
1.5 KiB
Python

"""Check the saved library's public inventory and persistence."""
import bpy
from anyimage.common.node import load_node_group, node_asset_path
from tools.nodes.check import GEOMETRY_NAMES, SHADER_NAMES
def test_saved_asset_inventory():
bpy.ops.wm.read_factory_settings(use_empty=True)
with bpy.data.libraries.load(str(node_asset_path())) as (source, _):
assert set(source.node_groups) == GEOMETRY_NAMES | SHADER_NAMES
for name in sorted(GEOMETRY_NAMES | SHADER_NAMES):
bpy.ops.wm.read_factory_settings(use_empty=True)
node_group = load_node_group(name)
assert node_group.bl_idname == ("GeometryNodeTree" if name in GEOMETRY_NAMES else "ShaderNodeTree")
assert node_group.use_fake_user and node_group.users > 0
if name in GEOMETRY_NAMES:
assert node_group.is_modifier
stores = [node for node in node_group.nodes if node.bl_idname == "GeometryNodeStoreNamedAttribute"]
assert all(node.inputs["Name"].default_value in {"UVMap", "o_normal_scale"} for node in stores), name
if bpy.app.version >= (5, 0, 0):
assert node_group.library is not None
if name in {"O Image Depth Layer", "O Shadeless"}:
expected = ["Color", "Alpha", "Depth", "Bump Scale"] if name == "O Image Depth Layer" else ["Color", "Alpha"]
assert [item.name for item in node_group.interface.items_tree
if item.item_type == "SOCKET" and item.in_out == "INPUT"] == expected