Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/composite/nodes/node_composite_huecorrect.cc
- This file was moved from source/blender/nodes/composite/nodes/node_composite_huecorrect.c.
| Show All 15 Lines | |||||
| * The Original Code is Copyright (C) 2006 Blender Foundation. | * The Original Code is Copyright (C) 2006 Blender Foundation. | ||||
| * All rights reserved. | * All rights reserved. | ||||
| */ | */ | ||||
| /** \file | /** \file | ||||
| * \ingroup cmpnodes | * \ingroup cmpnodes | ||||
| */ | */ | ||||
| #include "node_composite_util.h" | #include "node_composite_util.hh" | ||||
| static bNodeSocketTemplate cmp_node_huecorrect_in[] = { | namespace blender::nodes { | ||||
| {SOCK_FLOAT, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, | |||||
| {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, | static void cmp_node_huecorrect_declare(NodeDeclarationBuilder &b) | ||||
| {-1, ""}, | { | ||||
| }; | b.add_input<decl::Float>("Fac").default_value(1.0f).min(0.0f).max(1.0f).subtype(PROP_FACTOR); | ||||
| b.add_input<decl::Color>("Image").default_value({1.0f, 1.0f, 1.0f, 1.0f}); | |||||
| static bNodeSocketTemplate cmp_node_huecorrect_out[] = { | b.add_output<decl::Color>("Image"); | ||||
| {SOCK_RGBA, N_("Image")}, | } | ||||
| {-1, ""}, | |||||
| }; | } // namespace blender::nodes | ||||
| static void node_composit_init_huecorrect(bNodeTree *UNUSED(ntree), bNode *node) | static void node_composit_init_huecorrect(bNodeTree *UNUSED(ntree), bNode *node) | ||||
| { | { | ||||
| CurveMapping *cumapping = 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); | ||||
| int c; | |||||
| CurveMapping *cumapping = (CurveMapping *)node->storage; | |||||
| cumapping->preset = CURVE_PRESET_MID9; | cumapping->preset = CURVE_PRESET_MID9; | ||||
| for (c = 0; c < 3; c++) { | for (int c = 0; c < 3; c++) { | ||||
| CurveMap *cuma = &cumapping->cm[c]; | CurveMap *cuma = &cumapping->cm[c]; | ||||
| BKE_curvemap_reset(cuma, &cumapping->clipr, cumapping->preset, CURVEMAP_SLOPE_POSITIVE); | BKE_curvemap_reset(cuma, &cumapping->clipr, cumapping->preset, CURVEMAP_SLOPE_POSITIVE); | ||||
| } | } | ||||
| /* default to showing Saturation */ | /* default to showing Saturation */ | ||||
| cumapping->cur = 1; | cumapping->cur = 1; | ||||
| } | } | ||||
| void register_node_type_cmp_huecorrect(void) | void register_node_type_cmp_huecorrect(void) | ||||
| { | { | ||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| cmp_node_type_base(&ntype, CMP_NODE_HUECORRECT, "Hue Correct", NODE_CLASS_OP_COLOR, 0); | cmp_node_type_base(&ntype, CMP_NODE_HUECORRECT, "Hue Correct", NODE_CLASS_OP_COLOR, 0); | ||||
| node_type_socket_templates(&ntype, cmp_node_huecorrect_in, cmp_node_huecorrect_out); | ntype.declare = blender::nodes::cmp_node_huecorrect_declare; | ||||
| node_type_size(&ntype, 320, 140, 500); | node_type_size(&ntype, 320, 140, 500); | ||||
| node_type_init(&ntype, node_composit_init_huecorrect); | node_type_init(&ntype, node_composit_init_huecorrect); | ||||
| 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); | ||||
| } | } | ||||