Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/composite/nodes/node_composite_map_value.cc
| Show All 24 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" | ||||
| /* **************** MAP VALUE ******************** */ | /* **************** MAP VALUE ******************** */ | ||||
| namespace blender::nodes { | namespace blender::nodes::node_composite_map_value_cc { | ||||
| static void cmp_node_map_value_declare(NodeDeclarationBuilder &b) | static void cmp_node_map_value_declare(NodeDeclarationBuilder &b) | ||||
| { | { | ||||
| b.add_input<decl::Float>(N_("Value")).default_value(1.0f).min(0.0f).max(1.0f); | b.add_input<decl::Float>(N_("Value")).default_value(1.0f).min(0.0f).max(1.0f); | ||||
| b.add_output<decl::Float>(N_("Value")); | b.add_output<decl::Float>(N_("Value")); | ||||
| } | } | ||||
| } // namespace blender::nodes | |||||
| static void node_composit_init_map_value(bNodeTree *UNUSED(ntree), bNode *node) | static void node_composit_init_map_value(bNodeTree *UNUSED(ntree), bNode *node) | ||||
| { | { | ||||
| node->storage = BKE_texture_mapping_add(TEXMAP_TYPE_POINT); | node->storage = BKE_texture_mapping_add(TEXMAP_TYPE_POINT); | ||||
| } | } | ||||
| static void node_composit_buts_map_value(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) | static void node_composit_buts_map_value(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) | ||||
| { | { | ||||
| uiLayout *sub, *col; | uiLayout *sub, *col; | ||||
| Show All 10 Lines | static void node_composit_buts_map_value(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) | ||||
| col = uiLayoutColumn(layout, true); | col = uiLayoutColumn(layout, true); | ||||
| uiItemR(col, ptr, "use_max", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); | uiItemR(col, ptr, "use_max", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); | ||||
| sub = uiLayoutColumn(col, false); | sub = uiLayoutColumn(col, false); | ||||
| uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_max")); | uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_max")); | ||||
| uiItemR(sub, ptr, "max", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); | uiItemR(sub, ptr, "max", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); | ||||
| } | } | ||||
| } // namespace blender::nodes::node_composite_map_value_cc | |||||
| void register_node_type_cmp_map_value() | void register_node_type_cmp_map_value() | ||||
| { | { | ||||
| namespace file_ns = blender::nodes::node_composite_map_value_cc; | |||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| cmp_node_type_base(&ntype, CMP_NODE_MAP_VALUE, "Map Value", NODE_CLASS_OP_VECTOR); | cmp_node_type_base(&ntype, CMP_NODE_MAP_VALUE, "Map Value", NODE_CLASS_OP_VECTOR); | ||||
| ntype.declare = blender::nodes::cmp_node_map_value_declare; | ntype.declare = file_ns::cmp_node_map_value_declare; | ||||
| ntype.draw_buttons = node_composit_buts_map_value; | ntype.draw_buttons = file_ns::node_composit_buts_map_value; | ||||
| node_type_init(&ntype, node_composit_init_map_value); | node_type_init(&ntype, file_ns::node_composit_init_map_value); | ||||
| node_type_storage(&ntype, "TexMapping", node_free_standard_storage, node_copy_standard_storage); | node_type_storage(&ntype, "TexMapping", node_free_standard_storage, node_copy_standard_storage); | ||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||