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
This commit is contained in:
Jacques Lucke
2024-02-01 15:20:05 +01:00
parent fd7fcb2cdc
commit 153caeff4d
2 changed files with 22 additions and 0 deletions

View File

@@ -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);

View File

@@ -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;