Part 3/3 of #109135, #110272 Switch to new node group interfaces and deprecate old DNA and API. This completes support for panels in node drawing and in node group interface declarations in particular. The new node group interface DNA and RNA code has been added in parts 1 and 2 (#110885, #110952) but has not be enabled yet. This commit completes the integration by * enabling the new RNA API * using the new API in UI * read/write new interfaces from blend files * add versioning for backward compatibility * add forward-compatible writing code to reconstruct old interfaces All places accessing node group interface declarations should now be using the new API. A runtime cache has been added that allows simple linear access to socket inputs and outputs even when a panel hierarchy is used. Old DNA has been deprecated and should only be accessed for versioning (inputs/outputs renamed to inputs_legacy/outputs_legacy to catch errors). Versioning code ensures both backward and forward compatibility of existing files. The API for old interfaces is removed. The new API is very similar but is defined on the `ntree.interface` instead of the `ntree` directly. Breaking change notifications and detailed instructions for migrating will be added. A python test has been added for the node group API functions. This includes new functionality such as creating panels and moving items between different levels. This patch does not yet contain panel representations in the modifier UI. This has been tested in a separate branch and will be added with a later PR (#108565). Pull Request: https://projects.blender.org/blender/blender/pulls/111348
72 lines
2.3 KiB
C++
72 lines
2.3 KiB
C++
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
#pragma once
|
|
|
|
#include "BLI_compute_context.hh"
|
|
#include "BLI_function_ref.hh"
|
|
#include "BLI_multi_value_map.hh"
|
|
|
|
#include "BKE_idprop.hh"
|
|
#include "BKE_node.h"
|
|
|
|
struct bNodeTree;
|
|
struct bNodeSocket;
|
|
struct bNodeTreeInterfaceSocket;
|
|
struct Depsgraph;
|
|
namespace blender::bke {
|
|
struct GeometrySet;
|
|
}
|
|
struct IDProperty;
|
|
struct Object;
|
|
namespace blender::nodes {
|
|
struct GeoNodesLFUserData;
|
|
namespace geo_eval_log {
|
|
class GeoModifierLog;
|
|
} // namespace geo_eval_log
|
|
} // namespace blender::nodes
|
|
|
|
namespace blender::nodes {
|
|
|
|
StringRef input_use_attribute_suffix();
|
|
StringRef input_attribute_name_suffix();
|
|
|
|
std::optional<StringRef> input_attribute_name_get(const IDProperty &props,
|
|
const bNodeTreeInterfaceSocket &io_input);
|
|
|
|
/**
|
|
* \return Whether using an attribute to input values of this type is supported.
|
|
*/
|
|
bool socket_type_has_attribute_toggle(eNodeSocketDatatype type);
|
|
|
|
/**
|
|
* \return Whether using an attribute to input values of this type is supported, and the node
|
|
* group's input for this socket accepts a field rather than just single values.
|
|
*/
|
|
bool input_has_attribute_toggle(const bNodeTree &node_tree, const int socket_index);
|
|
|
|
bool id_property_type_matches_socket(const bNodeTreeInterfaceSocket &socket,
|
|
const IDProperty &property);
|
|
|
|
std::unique_ptr<IDProperty, bke::idprop::IDPropertyDeleter> id_property_create_from_socket(
|
|
const bNodeTreeInterfaceSocket &socket);
|
|
|
|
bke::GeometrySet execute_geometry_nodes_on_geometry(
|
|
const bNodeTree &btree,
|
|
const IDProperty *properties,
|
|
const ComputeContext &base_compute_context,
|
|
bke::GeometrySet input_geometry,
|
|
FunctionRef<void(nodes::GeoNodesLFUserData &)> fill_user_data);
|
|
|
|
void update_input_properties_from_node_tree(const bNodeTree &tree,
|
|
const IDProperty *old_properties,
|
|
bool use_bool_for_use_attribute,
|
|
IDProperty &properties);
|
|
|
|
void update_output_properties_from_node_tree(const bNodeTree &tree,
|
|
const IDProperty *old_properties,
|
|
IDProperty &properties);
|
|
|
|
} // namespace blender::nodes
|