Blender V5.0
node_fn_transpose_matrix.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
5#include "BLI_math_matrix.hh"
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::Matrix>("Matrix");
17 b.add_output<decl::Matrix>("Matrix").align_with_previous();
18}
19
21{
22 static auto fn = mf::build::SI1_SO<float4x4, float4x4>(
23 "Transpose Matrix", [](float4x4 matrix) { return math::transpose(matrix); });
24 builder.set_matching_fn(fn);
25}
26
27static void node_register()
28{
29 static blender::bke::bNodeType ntype;
30 fn_node_type_base(&ntype, "FunctionNodeTransposeMatrix", FN_NODE_TRANSPOSE_MATRIX);
31 ntype.ui_name = "Transpose Matrix";
32 ntype.ui_description =
33 "Flip a matrix over its diagonal, turning columns into rows and vice-versa";
34 ntype.enum_name_legacy = "TRANSPOSE_MATRIX";
36 ntype.declare = node_declare;
39}
41
42} // namespace blender::nodes::node_fn_transpose_matrix_cc
#define NODE_CLASS_CONVERTER
Definition BKE_node.hh:453
#define FN_NODE_TRANSPOSE_MATRIX
#define NOD_REGISTER_NODE(REGISTER_FUNC)
void set_matching_fn(const mf::MultiFunction *fn)
void node_register_type(bNodeType &ntype)
Definition node.cc:2416
MatBase< T, NumCol, NumRow > transpose(const MatBase< T, NumRow, NumCol > &mat)
static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
static void node_declare(NodeDeclarationBuilder &b)
MatBase< float, 4, 4 > float4x4
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