Listing the "Blender Foundation" as copyright holder implied the Blender Foundation holds copyright to files which may include work from many developers. While keeping copyright on headers makes sense for isolated libraries, Blender's own code may be refactored or moved between files in a way that makes the per file copyright holders less meaningful. Copyright references to the "Blender Foundation" have been replaced with "Blender Authors", with the exception of `./extern/` since these this contains libraries which are more isolated, any changed to license headers there can be handled on a case-by-case basis. Some directories in `./intern/` have also been excluded: - `./intern/cycles/` it's own `AUTHORS` file is planned. - `./intern/opensubdiv/`. An "AUTHORS" file has been added, using the chromium projects authors file as a template. Design task: #110784 Ref !110783.
50 lines
1.6 KiB
C++
50 lines
1.6 KiB
C++
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
#include "BKE_node.hh"
|
|
|
|
#include "BLT_translation.h"
|
|
|
|
#include "NOD_add_node_search.hh"
|
|
#include "NOD_node_declaration.hh"
|
|
|
|
namespace blender::nodes {
|
|
|
|
void GatherAddNodeSearchParams::add_single_node_item(std::string ui_name,
|
|
std::string description,
|
|
AfterAddFn after_add_fn,
|
|
int weight)
|
|
{
|
|
AddNodeItem item;
|
|
item.ui_name = std::move(ui_name);
|
|
item.description = std::move(description);
|
|
item.weight = weight;
|
|
item.add_fn = [after_add_fn = std::move(after_add_fn), node_type = node_type_](
|
|
const bContext &C, bNodeTree &node_tree, const float2 cursor) {
|
|
bNode *new_node = nodeAddNode(&C, &node_tree, node_type.idname);
|
|
new_node->locx = cursor.x / UI_SCALE_FAC;
|
|
new_node->locy = cursor.y / UI_SCALE_FAC + 20;
|
|
nodeSetSelected(new_node, true);
|
|
nodeSetActive(&node_tree, new_node);
|
|
if (after_add_fn) {
|
|
after_add_fn(C, node_tree, *new_node);
|
|
}
|
|
return Vector<bNode *>{new_node};
|
|
};
|
|
r_items.append(std::move(item));
|
|
}
|
|
|
|
void GatherAddNodeSearchParams::add_item(AddNodeItem item)
|
|
{
|
|
r_items.append(std::move(item));
|
|
}
|
|
|
|
void search_node_add_ops_for_basic_node(GatherAddNodeSearchParams ¶ms)
|
|
{
|
|
params.add_single_node_item(IFACE_(params.node_type().ui_name),
|
|
TIP_(params.node_type().ui_description));
|
|
}
|
|
|
|
} // namespace blender::nodes
|