From 46e0efb462cb92e9ade39588b51391820491aed8 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Fri, 5 Feb 2021 16:10:54 +0100 Subject: Geometry Nodes: support fixed pivot axis in Align Rotation to Vector node When the pivot axis is not set to auto, the node will try to align the rotation to vector as best as possible, given the selected rotation axis. Ref T85211. Differential Revision: https://developer.blender.org/D10292 --- source/blender/makesrna/intern/rna_nodetree.c | 29 +++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 7f66d5ff70f..77334f10cd0 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -8793,6 +8793,30 @@ static void def_geo_align_rotation_to_vector(StructRNA *srna) {0, NULL, 0, NULL, NULL}, }; + static const EnumPropertyItem pivot_axis_items[] = { + {GEO_NODE_ALIGN_ROTATION_TO_VECTOR_PIVOT_AXIS_AUTO, + "AUTO", + ICON_NONE, + "Auto", + "Automatically detect the best rotation axis to rotate towards the vector"}, + {GEO_NODE_ALIGN_ROTATION_TO_VECTOR_PIVOT_AXIS_X, + "X", + ICON_NONE, + "X", + "Rotate around the local X axis"}, + {GEO_NODE_ALIGN_ROTATION_TO_VECTOR_PIVOT_AXIS_Y, + "Y", + ICON_NONE, + "Y", + "Rotate around the local Y axis"}, + {GEO_NODE_ALIGN_ROTATION_TO_VECTOR_PIVOT_AXIS_Z, + "Z", + ICON_NONE, + "Z", + "Rotate around the local Z axis"}, + {0, NULL, 0, NULL, NULL}, + }; + PropertyRNA *prop; RNA_def_struct_sdna_from(srna, "NodeGeometryAlignRotationToVector", "storage"); @@ -8802,6 +8826,11 @@ static void def_geo_align_rotation_to_vector(StructRNA *srna) RNA_def_property_ui_text(prop, "Axis", "Axis to align to the vector"); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + prop = RNA_def_property(srna, "pivot_axis", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, pivot_axis_items); + RNA_def_property_ui_text(prop, "Pivot Axis", "Axis to rotate around"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + prop = RNA_def_property(srna, "input_type_factor", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_type_items_float); RNA_def_property_ui_text(prop, "Input Type Factor", ""); -- cgit v1.2.3