Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/function/nodes/node_fn_rotate_euler.cc
| Show All 9 Lines | |||||
| #include "UI_resources.h" | #include "UI_resources.h" | ||||
| #include "node_function_util.hh" | #include "node_function_util.hh" | ||||
| namespace blender::nodes::node_fn_rotate_euler_cc { | namespace blender::nodes::node_fn_rotate_euler_cc { | ||||
| static void fn_node_rotate_euler_declare(NodeDeclarationBuilder &b) | static void fn_node_rotate_euler_declare(NodeDeclarationBuilder &b) | ||||
| { | { | ||||
| auto is_mode_axis_angle = [](bNode &node) { | |||||
HooglyBoogly: I like making a lambda here, good idea. Think I'd tweak the naming a bit though, this sounds… | |||||
lone_noelAuthorUnsubmitted Done Inline ActionsTo be fair, I got the idea from Jaques' patch D12709 :) I agree that enable_... is more clear. lone_noel: To be fair, I got the idea from Jaques' patch D12709 :)
I agree that `enable_...` is more… | |||||
| node.custom1 = FN_NODE_ROTATE_EULER_TYPE_AXIS_ANGLE; | |||||
| }; | |||||
| b.is_function_node(); | b.is_function_node(); | ||||
| b.add_input<decl::Vector>(N_("Rotation")).subtype(PROP_EULER).hide_value(); | b.add_input<decl::Vector>(N_("Rotation")).subtype(PROP_EULER).hide_value(); | ||||
| b.add_input<decl::Vector>(N_("Rotate By")).subtype(PROP_EULER); | b.add_input<decl::Vector>(N_("Rotate By")).subtype(PROP_EULER).make_available([](bNode &node) { | ||||
| b.add_input<decl::Vector>(N_("Axis")).default_value({0.0, 0.0, 1.0}).subtype(PROP_XYZ); | node.custom1 = FN_NODE_ROTATE_EULER_TYPE_EULER; | ||||
| b.add_input<decl::Float>(N_("Angle")).subtype(PROP_ANGLE); | }); | ||||
| b.add_input<decl::Vector>(N_("Axis")) | |||||
| .default_value({0.0, 0.0, 1.0}) | |||||
| .subtype(PROP_XYZ) | |||||
| .make_available(is_mode_axis_angle); | |||||
| b.add_input<decl::Float>(N_("Angle")).subtype(PROP_ANGLE).make_available(is_mode_axis_angle); | |||||
| b.add_output<decl::Vector>(N_("Rotation")); | b.add_output<decl::Vector>(N_("Rotation")); | ||||
| } | } | ||||
| static void fn_node_rotate_euler_update(bNodeTree *ntree, bNode *node) | static void fn_node_rotate_euler_update(bNodeTree *ntree, bNode *node) | ||||
| { | { | ||||
| bNodeSocket *rotate_by_socket = static_cast<bNodeSocket *>(BLI_findlink(&node->inputs, 1)); | bNodeSocket *rotate_by_socket = static_cast<bNodeSocket *>(BLI_findlink(&node->inputs, 1)); | ||||
| bNodeSocket *axis_socket = static_cast<bNodeSocket *>(BLI_findlink(&node->inputs, 2)); | bNodeSocket *axis_socket = static_cast<bNodeSocket *>(BLI_findlink(&node->inputs, 2)); | ||||
| bNodeSocket *angle_socket = static_cast<bNodeSocket *>(BLI_findlink(&node->inputs, 3)); | bNodeSocket *angle_socket = static_cast<bNodeSocket *>(BLI_findlink(&node->inputs, 3)); | ||||
| ▲ Show 20 Lines • Show All 99 Lines • Show Last 20 Lines | |||||
I like making a lambda here, good idea. Think I'd tweak the naming a bit though, this sounds like a boolean variable name. How about enable_axis_angle.
Same for the other files.