Files
test2/source/blender/nodes/intern/node_common.h
Jacques Lucke 6176e66636 Nodes: add node group description
This allows node groups to have a description that is shown in the add menu
or when hovering over the node header.

This new description is stored in `bNodeTree.description`. Unfortunately, it
conflicts a bit with `ID.asset_data.description`. The difference is that the latter
only exists for assets. However, it makes sense for node groups to have
descriptions even if they are not assets (just like `static` functions in C++ should
also be able to have comments). In some cases, node groups are also generated
by addons for a specific purpose. Those should still have a description without
being reusable to make it easier to understand for users.

The solution here is to use the asset description if the node group is an asset,
and to use `bNodeTree.description` otherwise. The description is synced
automatically when marking or clearing assets.

A side benefit of this solution is that appended node group assets can keep their
description, which is currently always lost.

Pull Request: https://projects.blender.org/blender/blender/pulls/121334
2024-05-08 11:25:00 +02:00

41 lines
950 B
C++

/* SPDX-FileCopyrightText: 2007 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup nodes
*/
#pragma once
#include "DNA_listBase.h"
#ifdef __cplusplus
extern "C" {
#endif
struct bNodeTree;
/** Groups display their internal tree name as label. */
void node_group_label(const struct bNodeTree *ntree,
const struct bNode *node,
char *label,
int label_maxncpy);
bool node_group_poll_instance(const struct bNode *node,
const struct bNodeTree *nodetree,
const char **r_disabled_hint);
/**
* Global update function for Reroute node types.
* This depends on connected nodes, so must be done as a tree-wide update.
*/
void ntree_update_reroute_nodes(struct bNodeTree *ntree);
#ifdef __cplusplus
}
# include <string>
std::string node_group_ui_description(const bNode &node);
#endif