Docs: Add comments to node tree runtime struct clarifying design

Currently we have some old code from shader/compositor/texture nodes
that stores runtime data during and after evaluation on the node tree
itself. This is meant to be avoided, since the node tree is just meant
to be evaluation _instructions_.

Pull Request: https://projects.blender.org/blender/blender/pulls/118056
This commit is contained in:
Hans Goudey
2024-02-12 17:44:12 +01:00
committed by Hans Goudey
parent b0b6bc86ab
commit d434ef6566
+11 -9
View File
@@ -75,6 +75,12 @@ namespace blender::bke {
using NodeIDVectorSet = VectorSet<bNode *, DefaultProbingStrategy, NodeIDHash, NodeIDEquality>;
/**
* Runtime data for #bNodeTree from the perspective of execution instructions (rather than runtime
* data from evaluation of the node tree). Evaluation data is not the responsibility of the node
* tree and should be stored elsewhere. Evaluating a node tree should be possible without changing
* it.
*/
class bNodeTreeRuntime : NonCopyable, NonMovable {
public:
/**
@@ -109,18 +115,12 @@ class bNodeTreeRuntime : NonCopyable, NonMovable {
NodeIDVectorSet nodes_by_id;
/**
* Execution data.
* Legacy execution data.
*
* XXX It would be preferable to completely move this data out of the underlying node tree,
* so node tree execution could finally run independent of the tree itself.
* This would allow node trees to be merely linked by other data (materials, textures, etc.),
* as ID data is supposed to.
* Execution data is generated from the tree once at execution start and can then be used
* as long as necessary, even while the tree is being modified.
* \todo Move this out of the node tree to improve semantic/physical separation between the node
* tree execution instructions and its evaluation.
*/
bNodeTreeExec *execdata = nullptr;
/* Callbacks. */
void (*progress)(void *, float progress) = nullptr;
/** \warning may be called by different threads */
void (*stats_draw)(void *, const char *str) = nullptr;
@@ -128,6 +128,8 @@ class bNodeTreeRuntime : NonCopyable, NonMovable {
void (*update_draw)(void *) = nullptr;
void *tbh = nullptr, *prh = nullptr, *sdh = nullptr, *udh = nullptr;
/* End legacy execution data. */
/** Information about how inputs and outputs of the node group interact with fields. */
std::unique_ptr<nodes::FieldInferencingInterface> field_inferencing_interface;
/** Information about usage of anonymous attributes within the group. */