Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/composite/nodes/node_composite_defocus.c
| Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | static bNodeSocketTemplate cmp_node_defocus_in[] = { | ||||
| { SOCK_FLOAT, 1, N_("Z"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, | { SOCK_FLOAT, 1, N_("Z"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, | ||||
| { -1, 0, "" } | { -1, 0, "" } | ||||
| }; | }; | ||||
| static bNodeSocketTemplate cmp_node_defocus_out[] = { | static bNodeSocketTemplate cmp_node_defocus_out[] = { | ||||
| { SOCK_RGBA, 0, N_("Image")}, | { SOCK_RGBA, 0, N_("Image")}, | ||||
| { -1, 0, "" } | { -1, 0, "" } | ||||
| }; | }; | ||||
| static void node_composit_init_defocus(const bContext *C, PointerRNA *ptr) | static void node_composit_init_defocus(bNodeTree *UNUSED(ntree), bNode *node) | ||||
| { | { | ||||
| Scene *scene = CTX_data_scene(C); | |||||
| bNode *node = ptr->data; | |||||
| /* qdn: defocus node */ | /* qdn: defocus node */ | ||||
| NodeDefocus *nbd = MEM_callocN(sizeof(NodeDefocus), "node defocus data"); | NodeDefocus *nbd = 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.f; | nbd->fstop = 128.f; | ||||
| nbd->maxblur = 16; | nbd->maxblur = 16; | ||||
| nbd->bthresh = 1.f; | nbd->bthresh = 1.f; | ||||
| nbd->scale = 1.f; | nbd->scale = 1.f; | ||||
| nbd->no_zbuf = 1; | nbd->no_zbuf = 1; | ||||
| node->storage = nbd; | node->storage = nbd; | ||||
| node->id = &scene->id; | |||||
| } | } | ||||
| void register_node_type_cmp_defocus(void) | void register_node_type_cmp_defocus(void) | ||||
| { | { | ||||
| 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); | node_type_socket_templates(&ntype, cmp_node_defocus_in, cmp_node_defocus_out); | ||||
| ntype.initfunc_api = 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); | ||||
| } | } | ||||