- Unified the canonical local frame for generated geometries (Plane, Depth Plane, Relief Plane, Cutout, Depth Cutout) to align with Blender's object coordinate system, setting X as horizontal, Z as up, and +Y as depth. - Removed the `Depth Axis` parameter from `O Image Cutout` and `O Image Depth Cutout`, simplifying the geometry generation process. - Updated the depth direction defaults to use +Y instead of -Z for `O Image Relief Plane` and Depth Symmetry. - Adjusted the geometry nodes to ensure thickness, projection, and shell displacements operate along the Y-axis. - Implemented new capabilities for handling object space normals to align with the new canonical frame. - Enhanced the Depth Symmetry functionality to mirror across the canonical Y-axis and perform a final rotation to maintain the correct orientation. - Added tests to validate the new coordinate system and ensure compatibility with existing assets.
34 lines
1.3 KiB
Python
34 lines
1.3 KiB
Python
"""Build nodes that decode legacy Direction parameters into canonical space."""
|
|
|
|
|
|
def legacy_direction_to_canonical(group, legacy):
|
|
nodes = group.nodes
|
|
links = group.links
|
|
axes = nodes.new("ShaderNodeSeparateXYZ")
|
|
links.new(legacy, axes.inputs[0])
|
|
negative_x = nodes.new("ShaderNodeMath")
|
|
negative_x.operation = "MULTIPLY"
|
|
negative_x.inputs[1].default_value = -1.0
|
|
links.new(axes.outputs["X"], negative_x.inputs[0])
|
|
negative_y = nodes.new("ShaderNodeMath")
|
|
negative_y.operation = "MULTIPLY"
|
|
negative_y.inputs[1].default_value = -1.0
|
|
links.new(axes.outputs["Y"], negative_y.inputs[0])
|
|
direction = nodes.new("ShaderNodeCombineXYZ")
|
|
links.new(negative_x.outputs[0], direction.inputs["X"])
|
|
links.new(axes.outputs["Z"], direction.inputs["Y"])
|
|
links.new(negative_y.outputs[0], direction.inputs["Z"])
|
|
return direction.outputs["Vector"]
|
|
|
|
|
|
def symmetry_legacy_direction_to_canonical(group, legacy):
|
|
nodes = group.nodes
|
|
links = group.links
|
|
axes = nodes.new("ShaderNodeSeparateXYZ")
|
|
links.new(legacy, axes.inputs[0])
|
|
direction = nodes.new("ShaderNodeCombineXYZ")
|
|
links.new(axes.outputs["X"], direction.inputs["X"])
|
|
links.new(axes.outputs["Z"], direction.inputs["Y"])
|
|
links.new(axes.outputs["Y"], direction.inputs["Z"])
|
|
return direction.outputs["Vector"]
|