From d434ef65662ec5bdd9fa467ae94417e6d1533fc6 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Mon, 12 Feb 2024 17:44:12 +0100 Subject: [PATCH] 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 --- source/blender/blenkernel/BKE_node_runtime.hh | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/source/blender/blenkernel/BKE_node_runtime.hh b/source/blender/blenkernel/BKE_node_runtime.hh index 08f4ced5ab1..7a475cb4254 100644 --- a/source/blender/blenkernel/BKE_node_runtime.hh +++ b/source/blender/blenkernel/BKE_node_runtime.hh @@ -75,6 +75,12 @@ namespace blender::bke { using NodeIDVectorSet = VectorSet; +/** + * 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 field_inferencing_interface; /** Information about usage of anonymous attributes within the group. */