TachyonUI 1.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
tachyon::NodeGraph Struct Reference

What a node view's graph is: its nodes, frames and wires (or a state machine's states and transitions), the edits made to it, and how it's laid out on the grid. More...

#include <gui_controls/gui_node_view_types.h>

Inheritance diagram for tachyon::NodeGraph:

Public Attributes

std::vector< NodeModel > nodes
 the graph; endpoints and edits refer to nodes by index
NodeViewKind kind = NodeViewKind::Graph
 A graph of fields and wires, or a state machine.
std::vector< NodeFrame > frames
 Frames, drawn behind the nodes and wires, the first at the back.
std::vector< int > ordering
 Z-order, last == front (a clicked node moves there).
bool snapToGrid = true
 Keeps node positions on the grid: dragged nodes land on it, and positions set in code are moved onto it.
NodeWireShape wireShape = NodeWireShape::Orthogonal
 Orthogonal: wires run along the grid, round the nodes, their lanes dragged by hand.
std::unordered_map< uint32_t, WireRouteOverrides > wireOverrides
 Pinned wire lanes, keyed by WireKey() of the wire's target endpoint.
std::function< void(const NodeViewEdit &)> onEdit
 Called once per finished user edit (a whole drag is one), after it is applied.
std::function< bool(const NodeGraph &graph, PropertyEndpoint output, PropertyEndpoint input)> canConnect
 Whether an output -> input wire is allowed; null allows any.
uint32_t revision = 0
 Goes up by one with each edit applied (ApplyNodeViewEdit).

State machine (NodeViewKind::StateMachine)

std::vector< StateTransition > transitions
tachyon::ID initialState = tachyon::ID::Invalid()
 where the machine starts: marked with an arrow in
tachyon::ID activeState = tachyon::ID::Invalid()
 The state the machine is in, as the app runs it: ringed. Invalid: none.
float activeStateTime = -1.0f
 How long the machine has been in activeState, in seconds, shown under it ("1.24 s"); negative shows nothing.

Detailed Description

What a node view's graph is: its nodes, frames and wires (or a state machine's states and transitions), the edits made to it, and how it's laid out on the grid.

Several views can show one graph, each with a NodeViewState of its own (pan, zoom, selection):

NodeGraph      graph;              // the document's
NodeViewState  left, right;        // a panel's each
RenderNodeView({ graph, left });   // in one panel
RenderNodeView({ graph, right });  // in the other

NodeView is both in one, for a graph shown in one place.

Member Data Documentation

◆ nodes

std::vector<NodeModel> tachyon::NodeGraph::nodes

the graph; endpoints and edits refer to nodes by index

◆ kind

NodeViewKind tachyon::NodeGraph::kind = NodeViewKind::Graph

A graph of fields and wires, or a state machine.

In a state machine the nodes are states: their properties aren't shown, and transitions join them instead of wires.

◆ transitions

std::vector<StateTransition> tachyon::NodeGraph::transitions

The arrows between the states. A press on a state's edge and a drag to another state (or back onto itself) adds one; each can be selected, relabelled and deleted.

◆ initialState

tachyon::ID tachyon::NodeGraph::initialState = tachyon::ID::Invalid()

where the machine starts: marked with an arrow in

◆ activeState

tachyon::ID tachyon::NodeGraph::activeState = tachyon::ID::Invalid()

The state the machine is in, as the app runs it: ringed. Invalid: none.

◆ activeStateTime

float tachyon::NodeGraph::activeStateTime = -1.0f

How long the machine has been in activeState, in seconds, shown under it ("1.24 s"); negative shows nothing.

The app keeps it, and redraws while it counts.

◆ frames

std::vector<NodeFrame> tachyon::NodeGraph::frames

Frames, drawn behind the nodes and wires, the first at the back.

◆ ordering

std::vector<int> tachyon::NodeGraph::ordering

Z-order, last == front (a clicked node moves there).

◆ snapToGrid

bool tachyon::NodeGraph::snapToGrid = true

Keeps node positions on the grid: dragged nodes land on it, and positions set in code are moved onto it.

Off: nodes go where they're dropped or put.

◆ wireShape

NodeWireShape tachyon::NodeGraph::wireShape = NodeWireShape::Orthogonal

Orthogonal: wires run along the grid, round the nodes, their lanes dragged by hand.

Curved: each wire is one curve, leaving the output and entering the input level, with no lanes to drag.

◆ wireOverrides

std::unordered_map<uint32_t, WireRouteOverrides> tachyon::NodeGraph::wireOverrides

Pinned wire lanes, keyed by WireKey() of the wire's target endpoint.

◆ onEdit

std::function<void(const NodeViewEdit&)> tachyon::NodeGraph::onEdit

Called once per finished user edit (a whole drag is one), after it is applied.

◆ canConnect

std::function<bool(const NodeGraph& graph, PropertyEndpoint output, PropertyEndpoint input)> tachyon::NodeGraph::canConnect

Whether an output -> input wire is allowed; null allows any.

Called only for bounds-checked, cross-node endpoints, so it may index graph.nodes directly.

◆ revision

uint32_t tachyon::NodeGraph::revision = 0

Goes up by one with each edit applied (ApplyNodeViewEdit).

A view that last saw another drops what it kept by node index.


The documentation for this struct was generated from the following file: