feat: Implement cutout tool and depth generation features

- Added a new cutout tool for selecting regions in images, allowing users to choose mesh shapes based on selected areas.
- Introduced depth generation capabilities for rasterized images, including normal data extraction.
- Created jobs for generating depth planes and region data, enhancing the AI data generation workflow.
- Developed a selection refinement process for cutout regions, improving accuracy in generated outputs.
- Established a new region module for handling rasterized image regions and their associated AI generation tasks.
- Enhanced node graph builders for asset generation, facilitating smoother integration of new features.
This commit is contained in:
2026-08-30 23:09:13 +08:00
parent 32bcd45d7b
commit 08309f719d
88 changed files with 4145 additions and 5639 deletions

View File

@@ -4,6 +4,8 @@ import math
import bpy
from node_graph import expand_smooth
from anyimage.operators.cutout_tool.shape_types import (
BALLOON_ATTRIBUTE_NAME,
CUTOUT_NODE_GROUP_NAME,
@@ -727,7 +729,7 @@ def build_node_group(shape):
options = group.interface.new_panel(name="Options", default_closed=True)
reference_depth = _float_input(
group,
"Reference Depth",
"Base Plane Depth",
1.0,
0.0,
None,
@@ -751,7 +753,7 @@ def build_node_group(shape):
options = group.interface.new_panel(name="Options", default_closed=True)
reference_depth = _float_input(
group,
"Reference Depth",
"Base Plane Depth",
1.0,
0.0,
None,
@@ -788,7 +790,7 @@ def build_node_group(shape):
"Depth Image",
"Depth Scale",
"Uniform Scale",
"Reference Depth",
"Base Plane Depth",
"Depth Direction",
},
)
@@ -813,7 +815,7 @@ def build_node_group(shape):
controls.outputs["Uniform Scale"],
controls.outputs["Depth Direction"],
controls.outputs["Depth Image"],
controls.outputs["Reference Depth"],
controls.outputs["Base Plane Depth"],
)
output_location = (5100.0, 600.0)
else:
@@ -823,7 +825,7 @@ def build_node_group(shape):
controls.outputs["Thickness"],
controls.outputs["Depth Scale"],
controls.outputs["Uniform Scale"],
controls.outputs["Reference Depth"],
controls.outputs["Base Plane Depth"],
controls.outputs["Depth Image"],
)
output_location = (8200.0, 400.0)
@@ -844,7 +846,7 @@ def build_node_group(shape):
return group
def build_cutout_modifier_group(shape_groups, expand_smooth):
def build_cutout_modifier_group(shape_groups):
group = bpy.data.node_groups.get(CUTOUT_NODE_GROUP_NAME)
if group is not None:
return group
@@ -896,16 +898,14 @@ def build_cutout_modifier_group(shape_groups, expand_smooth):
reference_depth = _float_input(
group,
"Reference Depth",
"Base Plane Depth",
1.0,
0.0,
None,
subtype="DISTANCE",
parent=options,
)
reference_depth.description = (
"Metric reference depth shared by both Depth shapes"
)
reference_depth.description = "Depth of the flat base plane for both Depth shapes"
depth_direction = _vector_input(
group,
"Depth Direction",
@@ -936,10 +936,13 @@ def build_cutout_modifier_group(shape_groups, expand_smooth):
(-2700.0, 500.0),
{"Geometry", "Cleanup"},
)
cleanup_area = _math(group.nodes, "MULTIPLY", (-2500.0, 750.0))
cleanup_area.inputs[1].default_value = 0.01
group.links.new(base_controls.outputs["Cleanup"], cleanup_area.inputs[0])
geometry = _island_cleanup(
group,
base_controls.outputs["Geometry"],
base_controls.outputs["Cleanup"],
cleanup_area.outputs[0],
(-2350.0, 250.0),
)