Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/composite/nodes/node_composite_curves.cc
| Show All 22 Lines | |||||
| #include "UI_interface.h" | #include "UI_interface.h" | ||||
| #include "UI_resources.h" | #include "UI_resources.h" | ||||
| #include "node_composite_util.hh" | #include "node_composite_util.hh" | ||||
| /* **************** CURVE Time ******************** */ | /* **************** CURVE Time ******************** */ | ||||
| namespace blender::nodes { | namespace blender::nodes::node_composite_curves_time_cc { | ||||
| static void cmp_node_time_declare(NodeDeclarationBuilder &b) | static void cmp_node_time_declare(NodeDeclarationBuilder &b) | ||||
| { | { | ||||
| b.add_output<decl::Float>(N_("Fac")); | b.add_output<decl::Float>(N_("Fac")); | ||||
| } | } | ||||
| } // namespace blender::nodes | |||||
| /* custom1 = start_frame, custom2 = end_frame */ | /* custom1 = start_frame, custom2 = end_frame */ | ||||
| static void node_composit_init_curves_time(bNodeTree *UNUSED(ntree), bNode *node) | static void node_composit_init_curves_time(bNodeTree *UNUSED(ntree), bNode *node) | ||||
| { | { | ||||
| node->custom1 = 1; | node->custom1 = 1; | ||||
| node->custom2 = 250; | node->custom2 = 250; | ||||
| node->storage = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); | node->storage = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); | ||||
| } | } | ||||
| } // namespace blender::nodes::node_composite_curves_time_cc | |||||
| void register_node_type_cmp_curve_time() | void register_node_type_cmp_curve_time() | ||||
| { | { | ||||
| namespace file_ns = blender::nodes::node_composite_curves_time_cc; | |||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| cmp_node_type_base(&ntype, CMP_NODE_TIME, "Time", NODE_CLASS_INPUT, 0); | cmp_node_type_base(&ntype, CMP_NODE_TIME, "Time", NODE_CLASS_INPUT); | ||||
| ntype.declare = blender::nodes::cmp_node_time_declare; | ntype.declare = file_ns::cmp_node_time_declare; | ||||
| node_type_size(&ntype, 140, 100, 320); | node_type_size(&ntype, 200, 140, 320); | ||||
| node_type_init(&ntype, node_composit_init_curves_time); | node_type_init(&ntype, file_ns::node_composit_init_curves_time); | ||||
| node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); | node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); | ||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||
| /* **************** CURVE VEC ******************** */ | /* **************** CURVE VEC ******************** */ | ||||
| namespace blender::nodes { | namespace blender::nodes::node_composite_curves_vec_cc { | ||||
| static void cmp_node_curve_vec_declare(NodeDeclarationBuilder &b) | static void cmp_node_curve_vec_declare(NodeDeclarationBuilder &b) | ||||
| { | { | ||||
| b.add_input<decl::Vector>(N_("Vector")).default_value({0.0f, 0.0f, 0.0f}).min(-1.0f).max(1.0f); | b.add_input<decl::Vector>(N_("Vector")).default_value({0.0f, 0.0f, 0.0f}).min(-1.0f).max(1.0f); | ||||
| b.add_output<decl::Vector>(N_("Vector")); | b.add_output<decl::Vector>(N_("Vector")); | ||||
| } | } | ||||
| } // namespace blender::nodes | |||||
| static void node_composit_init_curve_vec(bNodeTree *UNUSED(ntree), bNode *node) | static void node_composit_init_curve_vec(bNodeTree *UNUSED(ntree), bNode *node) | ||||
| { | { | ||||
| node->storage = BKE_curvemapping_add(3, -1.0f, -1.0f, 1.0f, 1.0f); | node->storage = BKE_curvemapping_add(3, -1.0f, -1.0f, 1.0f, 1.0f); | ||||
| } | } | ||||
| static void node_buts_curvevec(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) | static void node_buts_curvevec(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) | ||||
| { | { | ||||
| uiTemplateCurveMapping(layout, ptr, "mapping", 'v', false, false, false, false); | uiTemplateCurveMapping(layout, ptr, "mapping", 'v', false, false, false, false); | ||||
| } | } | ||||
| } // namespace blender::nodes::node_composite_curves_vec_cc | |||||
| void register_node_type_cmp_curve_vec() | void register_node_type_cmp_curve_vec() | ||||
| { | { | ||||
| namespace file_ns = blender::nodes::node_composite_curves_vec_cc; | |||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| cmp_node_type_base(&ntype, CMP_NODE_CURVE_VEC, "Vector Curves", NODE_CLASS_OP_VECTOR, 0); | cmp_node_type_base(&ntype, CMP_NODE_CURVE_VEC, "Vector Curves", NODE_CLASS_OP_VECTOR); | ||||
| ntype.declare = blender::nodes::cmp_node_curve_vec_declare; | ntype.declare = file_ns::cmp_node_curve_vec_declare; | ||||
| ntype.draw_buttons = node_buts_curvevec; | ntype.draw_buttons = file_ns::node_buts_curvevec; | ||||
| node_type_size(&ntype, 200, 140, 320); | node_type_size(&ntype, 200, 140, 320); | ||||
| node_type_init(&ntype, node_composit_init_curve_vec); | node_type_init(&ntype, file_ns::node_composit_init_curve_vec); | ||||
| node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); | node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); | ||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||
| /* **************** CURVE RGB ******************** */ | /* **************** CURVE RGB ******************** */ | ||||
| namespace blender::nodes { | namespace blender::nodes::node_composite_curves_rgb_cc { | ||||
| static void cmp_node_rgbcurves_declare(NodeDeclarationBuilder &b) | static void cmp_node_rgbcurves_declare(NodeDeclarationBuilder &b) | ||||
| { | { | ||||
| b.add_input<decl::Float>(N_("Fac")).default_value(1.0f).min(-1.0f).max(1.0f).subtype( | b.add_input<decl::Float>(N_("Fac")).default_value(1.0f).min(-1.0f).max(1.0f).subtype( | ||||
| PROP_FACTOR); | PROP_FACTOR); | ||||
| b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); | b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); | ||||
| b.add_input<decl::Color>(N_("Black Level")).default_value({0.0f, 0.0f, 0.0f, 1.0f}); | b.add_input<decl::Color>(N_("Black Level")).default_value({0.0f, 0.0f, 0.0f, 1.0f}); | ||||
| b.add_input<decl::Color>(N_("White Level")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); | b.add_input<decl::Color>(N_("White Level")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); | ||||
| b.add_output<decl::Color>(N_("Image")); | b.add_output<decl::Color>(N_("Image")); | ||||
| } | } | ||||
| } // namespace blender::nodes | |||||
| static void node_composit_init_curve_rgb(bNodeTree *UNUSED(ntree), bNode *node) | static void node_composit_init_curve_rgb(bNodeTree *UNUSED(ntree), bNode *node) | ||||
| { | { | ||||
| node->storage = BKE_curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f); | node->storage = BKE_curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f); | ||||
| } | } | ||||
| } // namespace blender::nodes::node_composite_curves_rgb_cc | |||||
| void register_node_type_cmp_curve_rgb() | void register_node_type_cmp_curve_rgb() | ||||
| { | { | ||||
| namespace file_ns = blender::nodes::node_composite_curves_rgb_cc; | |||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| cmp_node_type_base(&ntype, CMP_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR, 0); | cmp_node_type_base(&ntype, CMP_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR); | ||||
| ntype.declare = blender::nodes::cmp_node_rgbcurves_declare; | ntype.declare = file_ns::cmp_node_rgbcurves_declare; | ||||
| node_type_size(&ntype, 200, 140, 320); | node_type_size(&ntype, 200, 140, 320); | ||||
| node_type_init(&ntype, node_composit_init_curve_rgb); | node_type_init(&ntype, file_ns::node_composit_init_curve_rgb); | ||||
| node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); | node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); | ||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||