Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/composite/nodes/node_composite_scale.cc
| Show All 15 Lines | |||||
| * The Original Code is Copyright (C) 2006 Blender Foundation. | * The Original Code is Copyright (C) 2006 Blender Foundation. | ||||
| * All rights reserved. | * All rights reserved. | ||||
| */ | */ | ||||
| /** \file | /** \file | ||||
| * \ingroup cmpnodes | * \ingroup cmpnodes | ||||
| */ | */ | ||||
| #include "RNA_access.h" | |||||
| #include "UI_interface.h" | |||||
| #include "UI_resources.h" | |||||
| #include "node_composite_util.hh" | #include "node_composite_util.hh" | ||||
| /* **************** Scale ******************** */ | /* **************** Scale ******************** */ | ||||
| namespace blender::nodes { | namespace blender::nodes { | ||||
| static void cmp_node_scale_declare(NodeDeclarationBuilder &b) | static void cmp_node_scale_declare(NodeDeclarationBuilder &b) | ||||
| { | { | ||||
| Show All 13 Lines | static void node_composite_update_scale(bNodeTree *ntree, bNode *node) | ||||
| /* Only show X/Y scale factor inputs for modes using them! */ | /* Only show X/Y scale factor inputs for modes using them! */ | ||||
| for (sock = (bNodeSocket *)node->inputs.first; sock; sock = sock->next) { | for (sock = (bNodeSocket *)node->inputs.first; sock; sock = sock->next) { | ||||
| if (STR_ELEM(sock->name, "X", "Y")) { | if (STR_ELEM(sock->name, "X", "Y")) { | ||||
| nodeSetSocketAvailability(ntree, sock, use_xy_scale); | nodeSetSocketAvailability(ntree, sock, use_xy_scale); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| static void node_composit_buts_scale(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) | |||||
| { | |||||
| uiItemR(layout, ptr, "space", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); | |||||
| if (RNA_enum_get(ptr, "space") == CMP_SCALE_RENDERPERCENT) { | |||||
| uiLayout *row; | |||||
| uiItemR(layout, | |||||
| ptr, | |||||
| "frame_method", | |||||
| UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_EXPAND, | |||||
| nullptr, | |||||
| ICON_NONE); | |||||
| row = uiLayoutRow(layout, true); | |||||
| uiItemR(row, ptr, "offset_x", UI_ITEM_R_SPLIT_EMPTY_NAME, "X", ICON_NONE); | |||||
| uiItemR(row, ptr, "offset_y", UI_ITEM_R_SPLIT_EMPTY_NAME, "Y", ICON_NONE); | |||||
| } | |||||
| } | |||||
| void register_node_type_cmp_scale() | void register_node_type_cmp_scale() | ||||
| { | { | ||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| cmp_node_type_base(&ntype, CMP_NODE_SCALE, "Scale", NODE_CLASS_DISTORT, 0); | cmp_node_type_base(&ntype, CMP_NODE_SCALE, "Scale", NODE_CLASS_DISTORT, 0); | ||||
| ntype.declare = blender::nodes::cmp_node_scale_declare; | ntype.declare = blender::nodes::cmp_node_scale_declare; | ||||
| ntype.draw_buttons = node_composit_buts_scale; | |||||
| node_type_update(&ntype, node_composite_update_scale); | node_type_update(&ntype, node_composite_update_scale); | ||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||