Skip to content

[NodeExecute] is documented as running a node's work, but nothing executes it #440

Description

@matt-edmondson

[NodeExecute] is documented as the method that performs a node's work, but nothing in either library ever calls it. Raised while investigating #437.

What the docs say

ImGui.NodeEditor/README.md presents this as the example of a node built from attributes:

[Node("Add")]
public class AddNode
{
    [InputPin("A")] public double A { get; set; }
    [InputPin("B")] public double B { get; set; }
    [OutputPin("Sum")] public double Sum { get; private set; }

    [NodeExecute]
    public void Execute() => Sum = A + B;
}

NodeGraph/README.md is more direct still: "A node is an ordinary type with attributes. Inputs and outputs are properties; the work happens in the method marked [NodeExecute]." The attribute table lists it as "The method that performs the node's work".

What is there

NodeExecuteAttribute (NodeGraph/NodeBehaviorAttributes.cs:87) is a marker carrying Order and IsAsync. Nothing reads either. AttributeBasedNodeFactory does not scan for it, and NodeDefinition has no field for it. There is no evaluator, scheduler or dispatcher anywhere in ktsu.NodeGraph or ktsu.ImGui.NodeEditor, and no call site that would reach a node's method: a search for Activator.CreateInstance and .Invoke( across both projects returns nothing.

The same applies to [NodeValidate] and to the whole of [NodeBehavior]. ExecutionMode, SupportsAsyncExecution, IsDeterministic and IsCacheable are read off the attributes into NodeDefinition and then only ever displayed.

Why it matters

Both READMEs read as though registering a type gives you a graph that runs. It gives you a graph that draws. Someone evaluating the library for real work reasonably concludes that execution is included, and finds out otherwise only after building against it. That is what happened in #437.

The metadata is genuinely useful without an evaluator, and declaring intent that a host implements is a legitimate design. The problem is that nothing says so.

Options

  1. Document the boundary. Say plainly in both READMEs that ktsu.NodeGraph is metadata and that executing a graph is the host's job, and change the AddNode example so it does not imply a call that never comes.
  2. Ship a reference evaluator, as a separate package so that ktsu.ImGui.NodeEditor keeps its current weight.

These are not exclusive. Option 1 is worth doing whatever happens to option 2.

Related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions