Geometry Nodes: Input Rotation node #120345

Merged
Jacques Lucke merged 9 commits from mod_moder/blender:input_rotation_node into main 2024-05-06 19:04:44 +02:00
1 changed files with 8 additions and 4 deletions
Showing only changes of commit 21071b52b8 - Show all commits

View File

@ -2,8 +2,8 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "BLI_math_quaternion.hh"
#include "BLI_math_euler.hh"
#include "BLI_math_quaternion.hh"
#include "NOD_socket_search_link.hh"
@ -26,8 +26,11 @@ static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
{
const bNode &bnode = builder.node();
const NodeInputRotation &node_storage = *static_cast<const NodeInputRotation *>(bnode.storage);
const math::EulerXYZ euler_rotation(node_storage.rotation_euler[0], node_storage.rotation_euler[1], node_storage.rotation_euler[2]);
builder.construct_and_set_matching_fn<mf::CustomMF_Constant<math::Quaternion>>(math::to_quaternion(euler_rotation));
const math::EulerXYZ euler_rotation(node_storage.rotation_euler[0],
node_storage.rotation_euler[1],
node_storage.rotation_euler[2]);
builder.construct_and_set_matching_fn<mf::CustomMF_Constant<math::Quaternion>>(
math::to_quaternion(euler_rotation));
}
static void node_init(bNodeTree * /*tree*/, bNode *node)
mod_moder marked this conversation as resolved
Review

why tree is in comment ?

why `tree` is in comment ?
https://developer.blender.org/docs/handbook/guidelines/best_practice_c_cpp/#comment-unused-arguments-in-c-code
@ -43,7 +46,8 @@ static void node_register()
fn_node_type_base(&ntype, GEO_NODE_INPUT_ROTATION, "Rotation", 0);
ntype.declare = node_declare;
ntype.initfunc = node_init;
node_type_storage(&ntype, "NodeInputRotation", node_free_standard_storage, node_copy_standard_storage);
node_type_storage(
&ntype, "NodeInputRotation", node_free_standard_storage, node_copy_standard_storage);
ntype.build_multi_function = node_build_multi_function;
ntype.draw_buttons = node_layout;
nodeRegisterType(&ntype);