Geometry Nodes: Add Rotate Rotation node #116106

Merged
Hans Goudey merged 6 commits from HooglyBoogly/blender:geometry-nodes-rotate-rotation into main 2024-02-01 14:29:42 +01:00
5 changed files with 40 additions and 1 deletions

View File

@ -573,7 +573,7 @@ class NODE_MT_category_GEO_UTILITIES_ROTATION(Menu):
node_add_menu.add_node_type(layout, "FunctionNodeAxisAngleToRotation")
node_add_menu.add_node_type(layout, "FunctionNodeEulerToRotation")
node_add_menu.add_node_type(layout, "FunctionNodeInvertRotation")
node_add_menu.add_node_type(layout, "FunctionNodeRotateEuler")
node_add_menu.add_node_type(layout, "FunctionNodeRotateRotation")
node_add_menu.add_node_type(layout, "FunctionNodeRotateVector")
node_add_menu.add_node_type(layout, "FunctionNodeRotationToAxisAngle")
node_add_menu.add_node_type(layout, "FunctionNodeRotationToEuler")

View File

@ -280,6 +280,7 @@ DefNode(FunctionNode, FN_NODE_INVERT_ROTATION, 0, "INVERT_ROTATION", InvertRotat
DefNode(FunctionNode, FN_NODE_RANDOM_VALUE, def_fn_random_value, "RANDOM_VALUE", RandomValue, "Random Value", "")
DefNode(FunctionNode, FN_NODE_REPLACE_STRING, 0, "REPLACE_STRING", ReplaceString, "Replace String", "")
DefNode(FunctionNode, FN_NODE_ROTATE_EULER, def_fn_rotate_euler, "ROTATE_EULER", RotateEuler, "Rotate Euler", "")
DefNode(FunctionNode, FN_NODE_ROTATE_ROTATION, 0, "ROTATE_ROTATION", RotateRotation, "Rotate Rotation", "")
DefNode(FunctionNode, FN_NODE_ROTATE_VECTOR, 0, "ROTATE_VECTOR", RotateVector, "Rotate Vector", "")
DefNode(FunctionNode, FN_NODE_ROTATION_TO_AXIS_ANGLE, 0, "ROTATION_TO_AXIS_ANGLE", RotationToAxisAngle, "Rotation to Axis Angle", "")
DefNode(FunctionNode, FN_NODE_ROTATION_TO_EULER, 0, "ROTATION_TO_EULER", RotationToEuler, "Rotation to Euler", "")

View File

@ -36,6 +36,7 @@ set(SRC
nodes/node_fn_random_value.cc
nodes/node_fn_replace_string.cc
nodes/node_fn_rotate_euler.cc
nodes/node_fn_rotate_rotation.cc
nodes/node_fn_rotate_vector.cc
nodes/node_fn_rotation_to_axis_angle.cc
nodes/node_fn_rotation_to_euler.cc

View File

@ -138,6 +138,7 @@ static void node_register()
ntype.draw_buttons = node_layout;
ntype.updatefunc = node_update;
ntype.build_multi_function = node_build_multi_function;
ntype.gather_link_search_ops = nullptr;
nodeRegisterType(&ntype);
}
NOD_REGISTER_NODE(node_register)

View File

@ -0,0 +1,36 @@
/* SPDX-FileCopyrightText: 2023 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "BLI_math_quaternion.hh"
#include "node_function_util.hh"
namespace blender::nodes::node_fn_rotate_rotation_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.is_function_node();
b.add_input<decl::Rotation>("Rotation 1");
b.add_input<decl::Rotation>("Rotation 2");

What do you think about Space Rotation * Rotation naming?

What do you think about `Space Rotation` * `Rotation` naming?
Review

I'd be fine with that too, but without discussing it more I'd rather be more conservative and go with the existing naming conventions now.

I'd be fine with that too, but without discussing it more I'd rather be more conservative and go with the existing naming conventions now.
b.add_output<decl::Rotation>("Rotation");
};
static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
{
static auto fn = mf::build::SI2_SO<math::Quaternion, math::Quaternion, math::Quaternion>(
"Rotate Rotation", [](math::Quaternion a, math::Quaternion b) { return b * a; });
builder.set_matching_fn(fn);
}
static void node_register()
{
static bNodeType ntype;
fn_node_type_base(&ntype, FN_NODE_ROTATE_ROTATION, "Rotate Rotation", NODE_CLASS_CONVERTER);
ntype.declare = node_declare;
ntype.build_multi_function = node_build_multi_function;
nodeRegisterType(&ntype);
}
NOD_REGISTER_NODE(node_register)
} // namespace blender::nodes::node_fn_rotate_rotation_cc