Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarrett Johnson <jarrett.johnson>2021-10-09 22:40:37 +0300
committerHans Goudey <h.goudey@me.com>2021-10-09 22:40:37 +0300
commit79425ed3267663ee482ee3ffcc542d86888103af (patch)
tree0992d63674d054980e0758ed933780f05c87eaff /source/blender/makesrna/intern/rna_nodetree.c
parent2561145da8d1e6db6617fa67c5a306d6e07e34e5 (diff)
Geometry Nodes: Align Euler to Vector Node
This commit introduces the Align Euler to Vector function node which rotates to a body into a given direction. The node replaces the legacy "Align Rotation to Vector" node, which only worked on an attribute named `rotation` internally. The "Euler" in the name is meant to make it clearer that the rotation isn't interchangeable with a regular vector. Addresses T91374. Differential Revision: https://developer.blender.org/D12726
Diffstat (limited to 'source/blender/makesrna/intern/rna_nodetree.c')
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 5e997f81753..cab420ba990 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -9952,6 +9952,66 @@ static void def_geo_align_rotation_to_vector(StructRNA *srna)
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
}
+static void def_fn_align_euler_to_vector(StructRNA *srna)
+{
+ static const EnumPropertyItem axis_items[] = {
+ {FN_NODE_ALIGN_EULER_TO_VECTOR_AXIS_X,
+ "X",
+ ICON_NONE,
+ "X",
+ "Align the X axis with the vector"},
+ {FN_NODE_ALIGN_EULER_TO_VECTOR_AXIS_Y,
+ "Y",
+ ICON_NONE,
+ "Y",
+ "Align the Y axis with the vector"},
+ {FN_NODE_ALIGN_EULER_TO_VECTOR_AXIS_Z,
+ "Z",
+ ICON_NONE,
+ "Z",
+ "Align the Z axis with the vector"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem pivot_axis_items[] = {
+ {FN_NODE_ALIGN_EULER_TO_VECTOR_PIVOT_AXIS_AUTO,
+ "AUTO",
+ ICON_NONE,
+ "Auto",
+ "Automatically detect the best rotation axis to rotate towards the vector"},
+ {FN_NODE_ALIGN_EULER_TO_VECTOR_PIVOT_AXIS_X,
+ "X",
+ ICON_NONE,
+ "X",
+ "Rotate around the local X axis"},
+ {FN_NODE_ALIGN_EULER_TO_VECTOR_PIVOT_AXIS_Y,
+ "Y",
+ ICON_NONE,
+ "Y",
+ "Rotate around the local Y axis"},
+ {FN_NODE_ALIGN_EULER_TO_VECTOR_PIVOT_AXIS_Z,
+ "Z",
+ ICON_NONE,
+ "Z",
+ "Rotate around the local Z axis"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, axis_items);
+ 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_sdna(prop, NULL, "custom2");
+ 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");
+}
+
static void def_geo_point_scale(StructRNA *srna)
{
PropertyRNA *prop;