Differential D12693 Diff 42648 source/blender/nodes/composite/nodes/node_composite_moviedistortion.cc
Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/composite/nodes/node_composite_moviedistortion.cc
- This file was moved from source/blender/nodes/composite/nodes/node_composite_moviedistortion.c.
| Show All 15 Lines | |||||
| * The Original Code is Copyright (C) 2011 Blender Foundation. | * The Original Code is Copyright (C) 2011 Blender Foundation. | ||||
| * All rights reserved. | * All rights reserved. | ||||
| */ | */ | ||||
| /** \file | /** \file | ||||
| * \ingroup cmpnodes | * \ingroup cmpnodes | ||||
| */ | */ | ||||
| #include "node_composite_util.h" | #include "node_composite_util.hh" | ||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_lib_id.h" | #include "BKE_lib_id.h" | ||||
| /* **************** Translate ******************** */ | /* **************** Translate ******************** */ | ||||
| static bNodeSocketTemplate cmp_node_moviedistortion_in[] = { | static bNodeSocketTemplate cmp_node_moviedistortion_in[] = { | ||||
| {SOCK_RGBA, N_("Image"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, | {SOCK_RGBA, N_("Image"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, | ||||
| Show All 12 Lines | static void label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int maxlen) | ||||
| } | } | ||||
| else { | else { | ||||
| BLI_strncpy(label, IFACE_("Distortion"), maxlen); | BLI_strncpy(label, IFACE_("Distortion"), maxlen); | ||||
| } | } | ||||
| } | } | ||||
| static void init(const bContext *C, PointerRNA *ptr) | static void init(const bContext *C, PointerRNA *ptr) | ||||
| { | { | ||||
| bNode *node = ptr->data; | bNode *node = (bNode *)ptr->data; | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| node->id = (ID *)scene->clip; | node->id = (ID *)scene->clip; | ||||
| id_us_plus(node->id); | id_us_plus(node->id); | ||||
| } | } | ||||
| static void storage_free(bNode *node) | static void storage_free(bNode *node) | ||||
| { | { | ||||
| if (node->storage) { | if (node->storage) { | ||||
| BKE_tracking_distortion_free(node->storage); | BKE_tracking_distortion_free((MovieDistortion *)node->storage); | ||||
| } | } | ||||
| node->storage = NULL; | node->storage = nullptr; | ||||
| } | } | ||||
| static void storage_copy(bNodeTree *UNUSED(dest_ntree), bNode *dest_node, const bNode *src_node) | static void storage_copy(bNodeTree *UNUSED(dest_ntree), bNode *dest_node, const bNode *src_node) | ||||
| { | { | ||||
| if (src_node->storage) { | if (src_node->storage) { | ||||
| dest_node->storage = BKE_tracking_distortion_copy(src_node->storage); | dest_node->storage = BKE_tracking_distortion_copy((MovieDistortion *)src_node->storage); | ||||
| } | } | ||||
| } | } | ||||
| void register_node_type_cmp_moviedistortion(void) | void register_node_type_cmp_moviedistortion(void) | ||||
| { | { | ||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| cmp_node_type_base(&ntype, CMP_NODE_MOVIEDISTORTION, "Movie Distortion", NODE_CLASS_DISTORT, 0); | cmp_node_type_base(&ntype, CMP_NODE_MOVIEDISTORTION, "Movie Distortion", NODE_CLASS_DISTORT, 0); | ||||
| node_type_socket_templates(&ntype, cmp_node_moviedistortion_in, cmp_node_moviedistortion_out); | node_type_socket_templates(&ntype, cmp_node_moviedistortion_in, cmp_node_moviedistortion_out); | ||||
| node_type_label(&ntype, label); | node_type_label(&ntype, label); | ||||
| ntype.initfunc_api = init; | ntype.initfunc_api = init; | ||||
| node_type_storage(&ntype, NULL, storage_free, storage_copy); | node_type_storage(&ntype, nullptr, storage_free, storage_copy); | ||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||