Blender V5.0
node_fn_rotate_vector.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
6
8
10
12{
13 b.use_custom_socket_order();
14 b.allow_any_socket_order();
15 b.is_function_node();
16 b.add_input<decl::Vector>("Vector").is_default_link_socket();
17 b.add_output<decl::Vector>("Vector").align_with_previous();
18 b.add_input<decl::Rotation>("Rotation");
19};
20
22{
23 static auto fn = mf::build::SI2_SO<float3, math::Quaternion, float3>(
24 "Rotate Vector",
25 [](float3 vector, math::Quaternion quat) { return math::transform_point(quat, vector); });
26 builder.set_matching_fn(fn);
27}
28
29static void node_register()
30{
31 static blender::bke::bNodeType ntype;
32 fn_node_type_base(&ntype, "FunctionNodeRotateVector", FN_NODE_ROTATE_VECTOR);
33 ntype.ui_name = "Rotate Vector";
34 ntype.ui_description = "Apply a rotation to a given vector";
35 ntype.enum_name_legacy = "ROTATE_VECTOR";
37 ntype.declare = node_declare;
40}
42
43} // namespace blender::nodes::node_fn_rotate_vector_cc
#define NODE_CLASS_CONVERTER
Definition BKE_node.hh:453
#define FN_NODE_ROTATE_VECTOR
#define NOD_REGISTER_NODE(REGISTER_FUNC)
void set_matching_fn(const mf::MultiFunction *fn)
void node_register_type(bNodeType &ntype)
Definition node.cc:2416
QuaternionBase< float > Quaternion
VecBase< T, 3 > transform_point(const CartesianBasis &basis, const VecBase< T, 3 > &v)
static void node_declare(NodeDeclarationBuilder &b)
static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
VecBase< float, 3 > float3
void fn_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
Defines a node type.
Definition BKE_node.hh:238
std::string ui_description
Definition BKE_node.hh:244
NodeMultiFunctionBuildFunction build_multi_function
Definition BKE_node.hh:351
const char * enum_name_legacy
Definition BKE_node.hh:247
NodeDeclareFunction declare
Definition BKE_node.hh:362