Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/composite/nodes/node_composite_defocus.cc
| Show All 20 Lines | |||||
| * \ingroup cmpnodes | * \ingroup cmpnodes | ||||
| */ | */ | ||||
| #include "node_composite_util.hh" | #include "node_composite_util.hh" | ||||
| #include <climits> | #include <climits> | ||||
| /* ************ Defocus Node ****************** */ | /* ************ Defocus Node ****************** */ | ||||
| static bNodeSocketTemplate cmp_node_defocus_in[] = { | |||||
| {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, | namespace blender::nodes { | ||||
| {SOCK_FLOAT, N_("Z"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, | |||||
| {-1, ""}, | static void cmp_node_defocus_declare(NodeDeclarationBuilder &b) | ||||
| }; | { | ||||
| static bNodeSocketTemplate cmp_node_defocus_out[] = { | b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); | ||||
| {SOCK_RGBA, N_("Image")}, | b.add_input<decl::Float>(N_("Z")).default_value(1.0f).min(0.0f).max(1.0f); | ||||
| {-1, ""}, | b.add_output<decl::Color>(N_("Image")); | ||||
| }; | } | ||||
| } // namespace blender::nodes | |||||
| static void node_composit_init_defocus(bNodeTree *UNUSED(ntree), bNode *node) | static void node_composit_init_defocus(bNodeTree *UNUSED(ntree), bNode *node) | ||||
| { | { | ||||
| /* defocus node */ | /* defocus node */ | ||||
| NodeDefocus *nbd = (NodeDefocus *)MEM_callocN(sizeof(NodeDefocus), "node defocus data"); | NodeDefocus *nbd = (NodeDefocus *)MEM_callocN(sizeof(NodeDefocus), "node defocus data"); | ||||
| nbd->bktype = 0; | nbd->bktype = 0; | ||||
| nbd->rotation = 0.0f; | nbd->rotation = 0.0f; | ||||
| nbd->preview = 1; | nbd->preview = 1; | ||||
| nbd->gamco = 0; | nbd->gamco = 0; | ||||
| nbd->samples = 16; | nbd->samples = 16; | ||||
| nbd->fstop = 128.0f; | nbd->fstop = 128.0f; | ||||
| nbd->maxblur = 16; | nbd->maxblur = 16; | ||||
| nbd->bthresh = 1.0f; | nbd->bthresh = 1.0f; | ||||
| nbd->scale = 1.0f; | nbd->scale = 1.0f; | ||||
| nbd->no_zbuf = 1; | nbd->no_zbuf = 1; | ||||
| node->storage = nbd; | node->storage = nbd; | ||||
| } | } | ||||
| void register_node_type_cmp_defocus(void) | void register_node_type_cmp_defocus() | ||||
| { | { | ||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| cmp_node_type_base(&ntype, CMP_NODE_DEFOCUS, "Defocus", NODE_CLASS_OP_FILTER, 0); | cmp_node_type_base(&ntype, CMP_NODE_DEFOCUS, "Defocus", NODE_CLASS_OP_FILTER, 0); | ||||
| node_type_socket_templates(&ntype, cmp_node_defocus_in, cmp_node_defocus_out); | ntype.declare = blender::nodes::cmp_node_defocus_declare; | ||||
| node_type_init(&ntype, node_composit_init_defocus); | node_type_init(&ntype, node_composit_init_defocus); | ||||
| node_type_storage(&ntype, "NodeDefocus", node_free_standard_storage, node_copy_standard_storage); | node_type_storage(&ntype, "NodeDefocus", node_free_standard_storage, node_copy_standard_storage); | ||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||