31 builder.single_input<
float3>(
"Translation");
33 builder.single_input<
float3>(
"Scale");
34 builder.single_output<
float4x4>(
"Transform");
47 const std::optional<float3> translation_single = translation.
get_if_single();
48 const std::optional<math::Quaternion> rotation_single = rotation.get_if_single();
49 const std::optional<float3> scale_single = scale.get_if_single();
51 const bool no_translation = translation_single &&
math::is_zero(*translation_single);
52 const bool no_rotation = rotation_single &&
math::angle_of(*rotation_single).radian() < 1e-7f;
55 if (no_rotation && no_scale) {
59 else if (no_translation && no_scale) {
63 else if (no_translation && no_rotation) {
68 mask.foreach_index([&](
const int64_t i) {
83 using namespace value_elem;
84 MatrixElem matrix_elem;
85 matrix_elem.translation =
params.get_input_elem<VectorElem>(
"Translation");
86 matrix_elem.rotation =
params.get_input_elem<RotationElem>(
"Rotation");
87 matrix_elem.scale =
params.get_input_elem<VectorElem>(
"Scale");
88 params.set_output_elem(
"Transform", matrix_elem);
93 using namespace value_elem;
94 const MatrixElem matrix_elem =
params.get_output_elem<MatrixElem>(
"Transform");
95 params.set_input_elem(
"Translation", matrix_elem.translation);
96 params.set_input_elem(
"Rotation", matrix_elem.rotation);
97 params.set_input_elem(
"Scale", matrix_elem.scale);
107 params.set_input(
"Translation", translation);
108 params.set_input(
"Rotation", rotation);
109 params.set_input(
"Scale", scale);
#define NODE_CLASS_CONVERTER
#define NOD_REGISTER_NODE(REGISTER_FUNC)
std::optional< T > get_if_single() const
const Signature & signature() const
void set_signature(const Signature *signature)
void set_matching_fn(const mf::MultiFunction *fn)
local_group_size(16, 16) .push_constant(Type b
void node_register_type(bNodeType *ntype)
AngleRadianBase< T > angle_of(const QuaternionBase< T > &q)
MatT from_scale(const VecBase< typename MatT::base_type, ScaleDim > &scale)
bool is_equal(const MatBase< T, NumCol, NumRow > &a, const MatBase< T, NumCol, NumRow > &b, const T epsilon=T(0))
void to_loc_rot_scale_safe(const MatBase< T, 4, 4 > &mat, VecBase< T, 3 > &r_location, RotationT &r_rotation, VecBase< T, 3 > &r_scale)
MatT from_location(const typename MatT::loc_type &location)
MatT from_rotation(const RotationT &rotation)
MatT from_loc_rot_scale(const typename MatT::loc_type &location, const RotationT &rotation, const VecBase< typename MatT::base_type, ScaleDim > &scale)
VecBase< float, 3 > float3
void fn_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
NodeInverseElemEvalFunction eval_inverse_elem
NodeInverseEvalFunction eval_inverse
NodeElemEvalFunction eval_elem
NodeMultiFunctionBuildFunction build_multi_function
NodeDeclareFunction declare