From 153caeff4db5097ff69066c19bab0939ba5970db Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Thu, 1 Feb 2024 15:20:05 +0100 Subject: [PATCH] Geometry Nodes: simplify default label in zone nodes This removes the "Input" and "Output" part of the default label in the simulation and repeat zone. The outline already makes it very obvious which one is the input and which one the output. Simplifying the label makes the zone look prettier. It might also simplify naming other zones (like for-each zone) in the future, because the name is shorter. Pull Request: https://projects.blender.org/blender/blender/pulls/117724 --- .../blender/nodes/geometry/nodes/node_geo_repeat.cc | 11 +++++++++++ .../nodes/geometry/nodes/node_geo_simulation.cc | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/source/blender/nodes/geometry/nodes/node_geo_repeat.cc b/source/blender/nodes/geometry/nodes/node_geo_repeat.cc index f228177d280..09425cde30e 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_repeat.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_repeat.cc @@ -3,6 +3,7 @@ * SPDX-License-Identifier: GPL-2.0-or-later */ #include "BLI_string.h" +#include "BLI_string_utf8.h" #include "BKE_compute_contexts.hh" #include "BKE_scene.h" @@ -64,6 +65,14 @@ static void node_init(bNodeTree * /*tree*/, bNode *node) node->storage = data; } +static void node_label(const bNodeTree * /*ntree*/, + const bNode * /*node*/, + char *label, + const int label_maxncpy) +{ + BLI_strncpy_utf8(label, IFACE_("Repeat"), label_maxncpy); +} + static bool node_insert_link(bNodeTree *ntree, bNode *node, bNodeLink *link) { bNode *output_node = ntree->node_by_id(node_storage(*node).output_node_id); @@ -80,6 +89,7 @@ static void node_register() geo_node_type_base(&ntype, GEO_NODE_REPEAT_INPUT, "Repeat Input", NODE_CLASS_INTERFACE); ntype.initfunc = node_init; ntype.declare = node_declare; + ntype.labelfunc = node_label; ntype.gather_link_search_ops = nullptr; ntype.insert_link = node_insert_link; ntype.no_muting = true; @@ -159,6 +169,7 @@ static void node_register() geo_node_type_base(&ntype, GEO_NODE_REPEAT_OUTPUT, "Repeat Output", NODE_CLASS_INTERFACE); ntype.initfunc = node_init; ntype.declare = node_declare; + ntype.labelfunc = repeat_input_node::node_label; ntype.insert_link = node_insert_link; ntype.no_muting = true; node_type_storage(&ntype, "NodeGeometryRepeatOutput", node_free_storage, node_copy_storage); diff --git a/source/blender/nodes/geometry/nodes/node_geo_simulation.cc b/source/blender/nodes/geometry/nodes/node_geo_simulation.cc index c2fafa10d7f..a97b1a97f6a 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_simulation.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_simulation.cc @@ -4,6 +4,7 @@ #include "BLI_math_matrix.hh" #include "BLI_string.h" +#include "BLI_string_utf8.h" #include "BLI_string_utils.hh" #include "BLI_task.hh" @@ -377,6 +378,14 @@ static void node_init(bNodeTree * /*tree*/, bNode *node) node->storage = data; } +static void node_label(const bNodeTree * /*ntree*/, + const bNode * /*node*/, + char *label, + const int label_maxncpy) +{ + BLI_strncpy_utf8(label, IFACE_("Simulation"), label_maxncpy); +} + static bool node_insert_link(bNodeTree *ntree, bNode *node, bNodeLink *link) { bNode *output_node = ntree->node_by_id(node_storage(*node).output_node_id); @@ -393,6 +402,7 @@ static void node_register() geo_node_type_base(&ntype, GEO_NODE_SIMULATION_INPUT, "Simulation Input", NODE_CLASS_INTERFACE); ntype.initfunc = node_init; ntype.declare = node_declare; + ntype.labelfunc = node_label; ntype.insert_link = node_insert_link; ntype.gather_link_search_ops = nullptr; ntype.no_muting = true; @@ -880,6 +890,7 @@ static void node_register() &ntype, GEO_NODE_SIMULATION_OUTPUT, "Simulation Output", NODE_CLASS_INTERFACE); ntype.initfunc = node_init; ntype.declare = node_declare; + ntype.labelfunc = sim_input_node::node_label; ntype.gather_link_search_ops = nullptr; ntype.insert_link = node_insert_link; ntype.draw_buttons_ex = node_layout_ex;