Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/composite/nodes/node_composite_boxmask.cc
| Show All 18 Lines | |||||
| /** \file | /** \file | ||||
| * \ingroup cmpnodes | * \ingroup cmpnodes | ||||
| */ | */ | ||||
| #include "../node_composite_util.hh" | #include "../node_composite_util.hh" | ||||
| /* **************** SCALAR MATH ******************** */ | /* **************** SCALAR MATH ******************** */ | ||||
| static bNodeSocketTemplate cmp_node_boxmask_in[] = { | |||||
| {SOCK_FLOAT, N_("Mask"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, | |||||
| {SOCK_FLOAT, N_("Value"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, | |||||
| {-1, ""}}; | |||||
| static bNodeSocketTemplate cmp_node_boxmask_out[] = { | namespace blender::nodes { | ||||
| {SOCK_FLOAT, N_("Mask"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, {-1, ""}}; | |||||
| static void cmp_node_boxmask_declare(NodeDeclarationBuilder &b) | |||||
| { | |||||
| b.add_input<decl::Float>(N_("Mask")).default_value(0.0f).min(0.0f).max(1.0f); | |||||
| b.add_input<decl::Float>(N_("Value")).default_value(1.0f).min(0.0f).max(1.0f); | |||||
| b.add_output<decl::Float>(N_("Mask")); | |||||
| } | |||||
| } // namespace blender::nodes | |||||
| static void node_composit_init_boxmask(bNodeTree *UNUSED(ntree), bNode *node) | static void node_composit_init_boxmask(bNodeTree *UNUSED(ntree), bNode *node) | ||||
| { | { | ||||
| NodeBoxMask *data = (NodeBoxMask *)MEM_callocN(sizeof(NodeBoxMask), "NodeBoxMask"); | NodeBoxMask *data = (NodeBoxMask *)MEM_callocN(sizeof(NodeBoxMask), "NodeBoxMask"); | ||||
| data->x = 0.5; | data->x = 0.5; | ||||
| data->y = 0.5; | data->y = 0.5; | ||||
| data->width = 0.2; | data->width = 0.2; | ||||
| data->height = 0.1; | data->height = 0.1; | ||||
| data->rotation = 0.0; | data->rotation = 0.0; | ||||
| node->storage = data; | node->storage = data; | ||||
| } | } | ||||
| void register_node_type_cmp_boxmask(void) | void register_node_type_cmp_boxmask() | ||||
| { | { | ||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| cmp_node_type_base(&ntype, CMP_NODE_MASK_BOX, "Box Mask", NODE_CLASS_MATTE, 0); | cmp_node_type_base(&ntype, CMP_NODE_MASK_BOX, "Box Mask", NODE_CLASS_MATTE, 0); | ||||
| node_type_socket_templates(&ntype, cmp_node_boxmask_in, cmp_node_boxmask_out); | ntype.declare = blender::nodes::cmp_node_boxmask_declare; | ||||
| node_type_init(&ntype, node_composit_init_boxmask); | node_type_init(&ntype, node_composit_init_boxmask); | ||||
| node_type_storage(&ntype, "NodeBoxMask", node_free_standard_storage, node_copy_standard_storage); | node_type_storage(&ntype, "NodeBoxMask", node_free_standard_storage, node_copy_standard_storage); | ||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||