Blender
V4.3
source
blender
compositor
realtime_compositor
COM_node_operation.hh
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2023 Blender Authors
2
*
3
* SPDX-License-Identifier: GPL-2.0-or-later */
4
5
#pragma once
6
7
#include "
BLI_string_ref.hh
"
8
9
#include "
DNA_node_types.h
"
10
11
#include "
NOD_derived_node_tree.hh
"
12
13
#include "
COM_context.hh
"
14
#include "
COM_operation.hh
"
15
#include "
COM_result.hh
"
16
#include "
COM_scheduler.hh
"
17
18
namespace
blender::realtime_compositor
{
19
20
using namespace
nodes::derived_node_tree_types;
21
22
/* ------------------------------------------------------------------------------------------------
23
* Node Operation
24
*
25
* A node operation is a subclass of operation that nodes should implement and instantiate in the
26
* get_compositor_operation function of bNodeType, passing the inputs given to that function to the
27
* constructor. This class essentially just implements a default constructor that populates output
28
* results for all outputs of the node as well as input descriptors for all inputs of the nodes
29
* based on their socket declaration. The class also provides some utility methods for easier
30
* implementation of nodes. */
31
class
NodeOperation
:
public
Operation
{
32
private
:
33
/* The node that this operation represents. */
34
DNode node_;
35
36
public
:
37
/* Populate the output results based on the node outputs and populate the input descriptors based
38
* on the node inputs. */
39
NodeOperation
(
Context
&context, DNode node);
40
41
/* Calls the evaluate method of the operation, but also measures the execution time and stores it
42
* in the context's profile data. */
43
void
evaluate
()
override
;
44
45
/* Compute and set the initial reference counts of all the results of the operation. The
46
* reference counts of the results are the number of operations that use those results, which is
47
* computed as the number of inputs whose node is part of the schedule and is linked to the
48
* output corresponding to each result. The node execution schedule is given as an input. */
49
void
compute_results_reference_counts
(
const
Schedule
&schedule);
50
51
protected
:
52
/* Compute a node preview using the result returned from the get_preview_result method. */
53
void
compute_preview
()
override
;
54
55
/* Returns a reference to the derived node that this operation represents. */
56
const
DNode &
node
()
const
;
57
58
/* Returns a reference to the node that this operation represents. */
59
const
bNode
&
bnode
()
const
;
60
61
/* Returns true if the output identified by the given identifier is needed and should be
62
* computed, otherwise returns false. */
63
bool
should_compute_output
(
StringRef
identifier);
64
65
private
:
66
/* Get the result which will be previewed in the node, this is chosen as the first linked output
67
* of the node, if no outputs exist, then the first allocated input will be chosen. Nullptr is
68
* guaranteed not to be returned, since the node will always either have a linked output or an
69
* allocated input. */
70
Result
*get_preview_result();
71
};
72
73
}
// namespace blender::realtime_compositor
BLI_string_ref.hh
COM_context.hh
COM_operation.hh
COM_result.hh
COM_scheduler.hh
DNA_node_types.h
NOD_derived_node_tree.hh
blender::StringRef
Definition
BLI_string_ref.hh:128
blender::VectorSet< DNode >
blender::realtime_compositor::Context
Definition
COM_context.hh:37
blender::realtime_compositor::NodeOperation
Definition
COM_node_operation.hh:31
blender::realtime_compositor::NodeOperation::NodeOperation
NodeOperation(Context &context, DNode node)
Definition
node_operation.cc:38
blender::realtime_compositor::NodeOperation::compute_results_reference_counts
void compute_results_reference_counts(const Schedule &schedule)
Definition
node_operation.cc:90
blender::realtime_compositor::NodeOperation::evaluate
void evaluate() override
Definition
node_operation.cc:51
blender::realtime_compositor::NodeOperation::should_compute_output
bool should_compute_output(StringRef identifier)
Definition
node_operation.cc:112
blender::realtime_compositor::NodeOperation::compute_preview
void compute_preview() override
Definition
node_operation.cc:61
blender::realtime_compositor::NodeOperation::bnode
const bNode & bnode() const
Definition
node_operation.cc:107
blender::realtime_compositor::NodeOperation::node
const DNode & node() const
Definition
node_operation.cc:102
blender::realtime_compositor::Operation
Definition
COM_operation.hh:56
blender::realtime_compositor::Result
Definition
COM_result.hh:92
blender::realtime_compositor
Definition
BKE_node.hh:80
bNode
Definition
DNA_node_types.h:357
Generated on Thu Feb 6 2025 07:36:39 for Blender by
doxygen
1.11.0