Docs: Add comments to node tree runtime struct clarifying design #118056

Merged
Hans Goudey merged 3 commits from HooglyBoogly/blender:cleanup-node-tree-runtime-comments into main 2024-02-12 17:44:21 +01:00
1 changed files with 11 additions and 9 deletions

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.
HooglyBoogly marked this conversation as resolved Outdated

What does "ownership of the tree" mean here?

What does "ownership of the tree" mean here?

I'm referring to the way materials and scenes own bNodeTree, but trying not to be specific. I just mean that to evaluate a node tree you shouldn't have to modify it.

I'm referring to the way materials and scenes own `bNodeTree`, but trying not to be specific. I just mean that to evaluate a node tree you shouldn't have to modify it.

I just mean that to evaluate a node tree you shouldn't have to modify it.

Maybe saying that directly would be better :)

> I just mean that to evaluate a node tree you shouldn't have to modify it. Maybe saying that directly would be better :)

Heh, yeah, probably, thanks!

Heh, yeah, probably, thanks!
*/
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. */