- Updated the depth plane node group to load from an asset and simplified the interface. - Created a new build script for depth plane geometry nodes. - Introduced material layer groups for image and depth materials with appropriate sockets. - Added functionality to connect balloon normal scale to the image material. - Enhanced tests to validate the new node groups and their connections. - Ensured that production code does not create node groups directly.
52 lines
1.3 KiB
Python
52 lines
1.3 KiB
Python
from pathlib import Path
|
|
import sys
|
|
|
|
import bpy
|
|
|
|
|
|
PROJECT_ROOT = Path(__file__).parents[2]
|
|
sys.path.insert(0, str(Path(__file__).parent))
|
|
sys.path.insert(0, str(PROJECT_ROOT / "src"))
|
|
sys.path.insert(
|
|
0,
|
|
str(next((PROJECT_ROOT / "src" / "anyimage" / "wheels").glob("blendjob-*.whl"))),
|
|
)
|
|
|
|
from build_cutout import (
|
|
CUTOUT_NODE_GROUP_NAMES,
|
|
build_cutout_modifier_group,
|
|
build_node_group,
|
|
)
|
|
from build_depth_plane import build_depth_plane_group
|
|
from build_material_layers import build_material_layer_group
|
|
from build_mesh_plane import build_mesh_plane_group
|
|
from build_shadeless import build_shadeless_group
|
|
OUTPUT_PATH = (
|
|
PROJECT_ROOT
|
|
/ "src"
|
|
/ "anyimage"
|
|
/ "assets"
|
|
/ "O_AnyImage.blend"
|
|
)
|
|
|
|
|
|
def main():
|
|
bpy.ops.wm.read_factory_settings(use_empty=True)
|
|
bpy.context.preferences.filepaths.save_version = 0
|
|
mesh_plane = build_mesh_plane_group()
|
|
build_depth_plane_group(mesh_plane)
|
|
build_material_layer_group()
|
|
build_material_layer_group(depth_plane=True)
|
|
build_shadeless_group()
|
|
shape_groups = {
|
|
shape: build_node_group(shape)
|
|
for shape in CUTOUT_NODE_GROUP_NAMES
|
|
}
|
|
build_cutout_modifier_group(shape_groups)
|
|
OUTPUT_PATH.parent.mkdir(parents=True, exist_ok=True)
|
|
bpy.ops.wm.save_as_mainfile(filepath=str(OUTPUT_PATH), check_existing=False)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|