Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/composite/nodes/node_composite_viewer.cc
| Show All 27 Lines | |||||
| #include "UI_interface.h" | #include "UI_interface.h" | ||||
| #include "UI_resources.h" | #include "UI_resources.h" | ||||
| #include "node_composite_util.hh" | #include "node_composite_util.hh" | ||||
| /* **************** VIEWER ******************** */ | /* **************** VIEWER ******************** */ | ||||
| namespace blender::nodes { | namespace blender::nodes::node_composite_viewer_cc { | ||||
| static void cmp_node_viewer_declare(NodeDeclarationBuilder &b) | static void cmp_node_viewer_declare(NodeDeclarationBuilder &b) | ||||
| { | { | ||||
| b.add_input<decl::Color>(N_("Image")).default_value({0.0f, 0.0f, 0.0f, 1.0f}); | b.add_input<decl::Color>(N_("Image")).default_value({0.0f, 0.0f, 0.0f, 1.0f}); | ||||
| b.add_input<decl::Float>(N_("Alpha")).default_value(1.0f).min(0.0f).max(1.0f); | b.add_input<decl::Float>(N_("Alpha")).default_value(1.0f).min(0.0f).max(1.0f); | ||||
| b.add_input<decl::Float>(N_("Z")).default_value(1.0f).min(0.0f).max(1.0f); | b.add_input<decl::Float>(N_("Z")).default_value(1.0f).min(0.0f).max(1.0f); | ||||
| } | } | ||||
| } // namespace blender::nodes | |||||
| static void node_composit_init_viewer(bNodeTree *UNUSED(ntree), bNode *node) | static void node_composit_init_viewer(bNodeTree *UNUSED(ntree), bNode *node) | ||||
| { | { | ||||
| ImageUser *iuser = MEM_cnew<ImageUser>(__func__); | ImageUser *iuser = MEM_cnew<ImageUser>(__func__); | ||||
| node->storage = iuser; | node->storage = iuser; | ||||
| iuser->sfra = 1; | iuser->sfra = 1; | ||||
| node->custom3 = 0.5f; | node->custom3 = 0.5f; | ||||
| node->custom4 = 0.5f; | node->custom4 = 0.5f; | ||||
| Show All 13 Lines | static void node_composit_buts_viewer_ex(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) | ||||
| uiItemR(layout, ptr, "tile_order", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); | uiItemR(layout, ptr, "tile_order", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); | ||||
| if (RNA_enum_get(ptr, "tile_order") == 0) { | if (RNA_enum_get(ptr, "tile_order") == 0) { | ||||
| col = uiLayoutColumn(layout, true); | col = uiLayoutColumn(layout, true); | ||||
| uiItemR(col, ptr, "center_x", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); | uiItemR(col, ptr, "center_x", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); | ||||
| uiItemR(col, ptr, "center_y", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); | uiItemR(col, ptr, "center_y", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); | ||||
| } | } | ||||
| } | } | ||||
| } // namespace blender::nodes::node_composite_viewer_cc | |||||
| void register_node_type_cmp_viewer() | void register_node_type_cmp_viewer() | ||||
| { | { | ||||
| namespace file_ns = blender::nodes::node_composite_viewer_cc; | |||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| cmp_node_type_base(&ntype, CMP_NODE_VIEWER, "Viewer", NODE_CLASS_OUTPUT); | cmp_node_type_base(&ntype, CMP_NODE_VIEWER, "Viewer", NODE_CLASS_OUTPUT); | ||||
| ntype.declare = blender::nodes::cmp_node_viewer_declare; | ntype.declare = file_ns::cmp_node_viewer_declare; | ||||
| ntype.draw_buttons = node_composit_buts_viewer; | ntype.draw_buttons = file_ns::node_composit_buts_viewer; | ||||
| ntype.draw_buttons_ex = node_composit_buts_viewer_ex; | ntype.draw_buttons_ex = file_ns::node_composit_buts_viewer_ex; | ||||
| ntype.flag |= NODE_PREVIEW; | ntype.flag |= NODE_PREVIEW; | ||||
| node_type_init(&ntype, node_composit_init_viewer); | node_type_init(&ntype, file_ns::node_composit_init_viewer); | ||||
| node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage); | node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage); | ||||
| ntype.no_muting = true; | ntype.no_muting = true; | ||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||