This implements the proposal from #124512. For that it contains the following changes: * Remove the global override of `new`/`delete` when `WITH_CXX_GUARDEDALLOC` was enabled. * Always use `MEM_CXX_CLASS_ALLOC_FUNCS` where it is currently used. This used to be guarded by `WITH_CXX_GUARDEDALLOC` in some but not all cases. This means that a few classes which didn't use our guarded allocator by default before, are now using it. Pull Request: https://projects.blender.org/blender/blender/pulls/130181
101 lines
2.8 KiB
C++
101 lines
2.8 KiB
C++
/* SPDX-FileCopyrightText: 2013 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
#pragma once
|
|
|
|
#include "DNA_node_types.h"
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
namespace blender::compositor {
|
|
|
|
class CompositorContext;
|
|
class Node;
|
|
class NodeInput;
|
|
class NodeOutput;
|
|
|
|
/**
|
|
* Internal representation of DNA node data.
|
|
* This structure is converted into operations by \a NodeCompiler.
|
|
*/
|
|
class NodeGraph {
|
|
public:
|
|
struct Link {
|
|
NodeOutput *from;
|
|
NodeInput *to;
|
|
|
|
Link(NodeOutput *from, NodeInput *to) : from(from), to(to) {}
|
|
};
|
|
|
|
private:
|
|
Vector<Node *> nodes_;
|
|
Vector<Link> links_;
|
|
|
|
public:
|
|
~NodeGraph();
|
|
|
|
Span<Node *> nodes() const
|
|
{
|
|
return nodes_;
|
|
}
|
|
Span<Link> links() const
|
|
{
|
|
return links_;
|
|
}
|
|
|
|
void from_bNodeTree(const CompositorContext &context, bNodeTree *tree);
|
|
|
|
protected:
|
|
typedef std::pair<Vector<Node *>::iterator, Vector<Node *>::iterator> NodeRange;
|
|
|
|
static bNodeSocket *find_b_node_input(bNode *b_node, const char *identifier);
|
|
static bNodeSocket *find_b_node_output(bNode *b_node, const char *identifier);
|
|
|
|
void add_node(Node *node, bNodeTree *b_ntree, bNodeInstanceKey key, bool is_active_group);
|
|
void add_link(NodeOutput *from_socket, NodeInput *to_socket);
|
|
|
|
void add_bNodeTree(const CompositorContext &context,
|
|
int nodes_start,
|
|
bNodeTree *tree,
|
|
bNodeInstanceKey parent_key);
|
|
|
|
void add_bNode(const CompositorContext &context,
|
|
bNodeTree *b_ntree,
|
|
bNode *b_node,
|
|
bNodeInstanceKey key,
|
|
bool is_active_group);
|
|
|
|
NodeOutput *find_output(const NodeRange &node_range, bNodeSocket *b_socket);
|
|
void add_bNodeLink(const NodeRange &node_range, bNodeLink *b_nodelink);
|
|
|
|
/* **** Special proxy node type conversions **** */
|
|
/* These nodes are not represented in the node graph themselves,
|
|
* but converted into a number of proxy links
|
|
*/
|
|
|
|
void add_proxies_mute(bNodeTree *b_ntree,
|
|
bNode *b_node,
|
|
bNodeInstanceKey key,
|
|
bool is_active_group);
|
|
void add_proxies_skip(bNodeTree *b_ntree,
|
|
bNode *b_node,
|
|
bNodeInstanceKey key,
|
|
bool is_active_group);
|
|
|
|
void add_proxies_group_inputs(bNode *b_node, bNode *b_node_io);
|
|
void add_proxies_group_outputs(const CompositorContext &context,
|
|
bNode *b_node,
|
|
bNode *b_node_io);
|
|
void add_proxies_group(const CompositorContext &context, bNode *b_node, bNodeInstanceKey key);
|
|
|
|
void add_proxies_reroute(bNodeTree *b_ntree,
|
|
bNode *b_node,
|
|
bNodeInstanceKey key,
|
|
bool is_active_group);
|
|
|
|
MEM_CXX_CLASS_ALLOC_FUNCS("COM:NodeGraph")
|
|
};
|
|
|
|
} // namespace blender::compositor
|