|
TachyonUI 1.1.0
High-performance UI for building tools.
|
Nodes, pins and links for the node graph editor. More...
Classes | |
| struct | tachyon::TransitionPath |
| A transition's arrow, in node.pos space, between the states as last laid out. More... | |
| struct | tachyon::PropertyEndpoint |
| A property on a node. Default-constructed is invalid: in a socket it means "present, unwired". More... | |
| struct | tachyon::NodeProperty |
| One row of a node: an optional input socket, a body, and an optional output socket. More... | |
| struct | tachyon::NodeModel |
| One node of a node view. More... | |
| struct | tachyon::StateTransition |
| A transition of a state machine: from one state to another, or to itself. More... | |
| struct | tachyon::NodeFrame |
| A frame (a comment box): a titled, colored box behind a group of nodes. More... | |
| struct | tachyon::PendingConnection |
| A wire being dragged. Committed wires are the reciprocal endpoints on NodeProperty. More... | |
| struct | tachyon::WireLane |
| A wire's place among the wires between the same two nodes, so their default lanes nest instead of coinciding or crossing (ComputeWireLaneOffsets). More... | |
| struct | tachyon::WireRouteOverrides |
| User-pinned lanes of one wire (unset = default), in the route's space. More... | |
| struct | tachyon::WireSegmentHandle |
| Draggable interior segment; vertical segments drag horizontally and vice versa. More... | |
| struct | tachyon::WireRoute |
| Polyline plus its draggable interior segments (never the end stubs). More... | |
| struct | tachyon::CachedWireHandle |
| Last frame's draggable segment (node.pos space), for laying out its grab element. More... | |
| struct | tachyon::NodeViewEdit |
| One thing the user did in a node view, as values before and after, so a host can keep the undo history (NodeGraph::onEdit) and undo or redo it (ApplyNodeViewEdit). More... | |
| struct | tachyon::DrawnWire |
| A wire as drawn this frame, for hit-testing; points in node.pos space. More... | |
| struct | tachyon::WireSegmentDrag |
| Segment drag via mouse capture rather than DnD, so the resize cursor sticks. More... | |
| struct | tachyon::FrameDrag |
| A press on a frame's title or one of its edges, and what it moves. More... | |
| struct | tachyon::NodeLists< T > |
| Internal: a list per node, all in one array, refilled each frame in the storage it has. More... | |
| struct | tachyon::NodeHiddenPort |
| Internal: a socket of a node hidden in a collapsed frame, on that frame's box edge. More... | |
| struct | tachyon::NodeGraph |
| 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... | |
| struct | tachyon::NodeViewState |
| How one view shows a NodeGraph: its pan and zoom, what's selected in it, what the user is doing in it, what it shows over the canvas and the callbacks that act on what it shows. More... | |
| struct | tachyon::NodeView |
| A graph shown in one place: the graph and the one view of it together. More... | |
| struct | tachyon::BasicNodeViewRef< Graph, State > |
| A graph and one view of it, as RenderNodeView and the helpers take them: a NodeView passes as one, or { graph, state } for one of several views of a graph. More... | |
Typedefs | |
| using | tachyon::NodeViewRef = BasicNodeViewRef<NodeGraph, NodeViewState> |
| using | tachyon::ConstNodeViewRef = BasicNodeViewRef<const NodeGraph, const NodeViewState> |
Enumerations | |
| enum class | tachyon::NodeViewKind : uint8_t { tachyon::NodeViewKind::Graph , tachyon::NodeViewKind::StateMachine } |
| What a node view edits: a graph of nodes with fields wired output to input, or a state machine, where nodes are states joined by transitions and cycles are the point. More... | |
| enum class | tachyon::WireHandle : uint8_t { tachyon::WireHandle::None , tachyon::WireHandle::LaneX , tachyon::WireHandle::ExitX , tachyon::WireHandle::EntryX , tachyon::WireHandle::LaneY } |
| Interior lane a drag handle adjusts: the corridor route's vertical lane (LaneX), or the detour route's verticals (ExitX, EntryX) and horizontal return lane (LaneY). More... | |
| enum class | tachyon::NodeWireShape : uint8_t { tachyon::NodeWireShape::Orthogonal , tachyon::NodeWireShape::Curved } |
| How a node view draws its wires (NodeGraph::wireShape). More... | |
| enum class | tachyon::FrameEdges : uint8_t { tachyon::FrameEdges::None = 0 , tachyon::FrameEdges::Right = 1 , tachyon::FrameEdges::Bottom = 2 , tachyon::FrameEdges::Corner = Right | Bottom } |
| Which edges of a frame a resize moves. More... | |
Functions | |
| ID | tachyon::NodeElementID (const NodeViewState &view, ID stableID) |
| The element a view last built for the node, frame or transition stableID names: its stable ID scoped to the view's canvas, so another view of the graph has its own. | |
| float | tachyon::NodeViewZoom (ConstNodeViewRef view) |
| The node view's zoom (1 = 100%). | |
| void | tachyon::ZoomNodeView (NodeViewRef view, float factor, int2 pivot={}) |
| Zooms by factor around pivot (pixels from the canvas centre), within the view's minZoom..maxZoom. | |
| void | tachyon::SetNodeViewCenter (NodeViewRef view, float2 center, float zoom) |
| Centres the view on canvas point center at zoom (clamped to minZoom..maxZoom). | |
| void | tachyon::FrameAllNodes (NodeViewRef view) |
| Centres and zooms the view on all nodes. | |
| void | tachyon::FrameNodes (NodeViewRef view, std::span< const int > indices) |
| Centres and zooms the view on the nodes at indices (ones out of range skipped); none leaves the view as it is. | |
| void | tachyon::FrameSelectedNodes (NodeViewRef view) |
| Centres and zooms the view on the selected nodes, and in a state machine the states a selected transition joins; on all of them when none is selected (Home, the Fit button). | |
| void | tachyon::ScrollNodeIntoView (NodeViewRef view, int nodeIdx, int32_t margin) |
| Pans the view, at the same zoom, by as little as brings node nodeIdx inside it with margin pixels to spare; a node larger than the view shows its top-left. | |
| void | tachyon::RenderCanvasGrid (CustomDrawContext &ctx, int32_t baseGridSize, color4f dotColor, float dotSize, int2 originOffset={}, IntRect clipCurrent={}) |
| Infinite background dot grid for a pan/zoom canvas, drawn from a CustomDrawContext callback in the canvas's layout space (node.pos space): a dot on every grid point. | |
| constexpr int32_t | tachyon::FloorDiv (int32_t a, int32_t b) |
| a / b rounded toward negative infinity. | |
| constexpr int32_t | tachyon::GridLineLE (int32_t v, int32_t origin, int32_t grid) |
| The grid line (origin + k x grid) at or below v; grid must be > 0. | |
| constexpr int32_t | tachyon::GridLineGE (int32_t v, int32_t origin, int32_t grid) |
| The grid line (origin + k x grid) at or above v; grid must be > 0. | |
| constexpr int32_t | tachyon::GridLineNearest (int32_t v, int32_t origin, int32_t grid) |
| The grid line (origin + k x grid) nearest v, ties going down; grid must be > 0. | |
| WireRoute | tachyon::BuildWireRoute (int2 outPt, int2 inPt, IntRect srcRect, IntRect tgtRect, int32_t grid, int2 gridOrigin, const WireRouteOverrides &overrides={}) |
| Orthogonal route for a wire from an output socket (outPt, on srcRect's right edge) to an input socket (inPt, on tgtRect's left edge), with bends on the grid and clear of both bodies: | |
| WireRoute | tachyon::BuildCurvedWireRoute (int2 outPt, int2 inPt, int32_t reach) |
| A curved wire from outPt to inPt, leaving the output to the right and entering the input from the left. | |
| float2 | tachyon::WireCurvePoint (int2 p0, int2 p1, int2 p2, int2 p3, float t) |
| The point at t (0 to 1) along the curve the renderer draws for a line with points p0, p1, p2, p3: two quadratic Beziers, p0-p1-m and m-p2-p3, where m is halfway between p1 and p2. | |
| constexpr uint32_t | tachyon::WireKey (int targetNode, int targetProp) |
| Stable key for a wire, identified by its target (input) endpoint - each input carries at most one incoming wire. | |
| constexpr PropertyEndpoint | tachyon::WireInput (uint32_t wireKey) |
| The input a WireKey names. | |
| std::optional< uint32_t > | tachyon::WireAt (std::span< const DrawnWire > wires, int2 p, float tolerance) |
| The wire within tolerance of point p (the closest when several are); none when no wire is. | |
| void | tachyon::ApplyNodeViewEdit (NodeViewRef view, const NodeViewEdit &edit, bool undo=false) |
| Redoes edit (its to values), or with undo restores its from values. | |
| void | tachyon::CommitNodeViewEdit (NodeViewRef view, const NodeViewEdit &edit) |
| Applies edit and reports it to view.graph.onEdit. | |
| void | tachyon::ReleaseNodeViewEditIDs (IDManager &ids, const NodeViewEdit &edit, bool undone) |
| Releases the static IDs of the nodes, frames and transitions only the side of edit not in effect holds: done, what its undo would bring back; undone, what its redo would add. | |
| NodeViewEdit | tachyon::ConnectEdit (ConstNodeViewRef view, PropertyEndpoint output, PropertyEndpoint input) |
| An edit that wires output into Input; the input's old wire goes, the output keeps its others. | |
| NodeViewEdit | tachyon::DisconnectEdit (ConstNodeViewRef view, PropertyEndpoint input) |
| An edit that removes the wire into Input, with its lane overrides. | |
| NodeViewEdit | tachyon::AddNodeEdit (ConstNodeViewRef view, NodeModel node, int index=-1) |
| An edit that adds node at index (-1, or past the end: last), drawn in front of the others. | |
| NodeViewEdit | tachyon::RemoveNodesEdit (ConstNodeViewRef view, std::span< const int > indices) |
| An edit that removes the nodes at indices (in any order; ones out of range and repeats are skipped), with every wire into or out of them and those wires' lanes. | |
| NodeViewEdit | tachyon::RerouteWireEdit (ConstNodeViewRef view, uint32_t wireKey, ID stableID, int2 pos) |
| An edit that puts a reroute (NodeModel::reroute) on the wire wireKey (the WireKey of its input): the wire then runs from its output into the new reroute, and on from it into the input. | |
| NodeViewEdit | tachyon::RemoveRerouteEdit (ConstNodeViewRef view, int node) |
| An edit that takes the reroute at node out, with its wire running on as it did through it: every input it fed then takes from the output that fed it (or nothing, when nothing did). | |
| NodeViewEdit | tachyon::AddFrameEdit (ConstNodeViewRef view, NodeFrame frame, int index=-1) |
| An edit that adds frame at index (-1, or past the end: last, in front of the other frames, still behind every node). | |
| NodeViewEdit | tachyon::RemoveFramesEdit (ConstNodeViewRef view, std::span< const int > indices) |
| An edit that removes the frames at indices (in any order; ones out of range and repeats are skipped). | |
| NodeFrame | tachyon::FrameAroundNodes (ConstNodeViewRef view, std::span< const int > indices) |
| A frame round the nodes at indices, as the view last laid them out: a grid cell of room on each side, and the title bar above them. | |
| NodeViewEdit | tachyon::GroupSelectionEdit (ConstNodeViewRef view, NodeFrame frame) |
| An edit that puts the selected nodes and frames in frame: its place and size are set round them as FrameAroundNodes sets them (a collapsed frame counts at its open size), and it goes behind the selected frames so they stay in front of it. | |
| std::vector< int > | tachyon::NodesInFrame (ConstNodeViewRef view, int frame) |
| The nodes (indices) frame frame holds, which move with it: those lying wholly inside it as the view last laid them out, or, collapsed, those it held when it collapsed. | |
| NodeViewEdit | tachyon::CollapseFrameEdit (ConstNodeViewRef view, int frame, bool collapse) |
| An edit that collapses frame frame (or expands it), noting what it holds as it collapses (NodeFrame::members). | |
| int | tachyon::FrameTitleAtCanvasPos (ConstNodeViewRef view, float2 canvasPos) |
| The frame whose title bar holds canvasPos (node.pos space), the frontmost when several do; -1 when none does. | |
| void | tachyon::RenameFrame (NodeViewRef view, int frame) |
| Starts renaming frame frame as a double-click on its title does: a field over the title bar, with the focus in it, from the next RenderNodeView. | |
| std::unordered_map< uint32_t, WireLane > | tachyon::ComputeWireLaneOffsets (ConstNodeViewRef view, PropertyEndpoint pendingOut={}, PropertyEndpoint pendingIn={}) |
| Default lane offsets (grid steps) for wires between the same two nodes, so their lanes don't coincide: k wires, in input order, get (k-1)/2 counting down by one (one wire: 0; two: 0,-1; three: 1,0,-1; four: 1,0,-1,-2), so wires running down nest instead of crossing. | |
| WireRoute | tachyon::BuildPendingWireRoute (int2 outPt, IntRect srcRect, int2 cursor, std::optional< int2 > inPt, IntRect tgtRect, int32_t grid, int2 gridOrigin, WireLane lane={}) |
| A wire being dragged from an output: routed as the connection it would make when it is over an input that accepts it (inPt on tgtRect), else to cursor as if an input sat there. | |
| WireRoute | tachyon::BuildPendingWireRouteToInput (int2 inPt, IntRect tgtRect, int2 cursor, std::optional< int2 > outPt, IntRect srcRect, int32_t grid, int2 gridOrigin, WireLane lane={}) |
| A wire being dragged from an input: routed as the connection it would make when it is over an output that accepts it (outPt on srcRect), else from cursor as if an output sat there. | |
| bool | tachyon::ConnectionAllowed (ConstNodeViewRef view, PropertyEndpoint out, PropertyEndpoint in) |
| Whether a wire from output out to input in is allowed: never a same-node loop, otherwise the view's canConnect delegate decides (none: allowed). | |
| PropertyEndpoint | tachyon::FirstInputAccepting (ConstNodeViewRef view, PropertyEndpoint output, int nodeIdx) |
| The first input of node nodeIdx, top to bottom, that a wire from output may connect to; invalid when there is none. | |
| PropertyEndpoint | tachyon::FirstOutputAccepting (ConstNodeViewRef view, PropertyEndpoint input, int nodeIdx) |
| The first output of node nodeIdx, top to bottom, that may feed Input; invalid when there is none. | |
| int | tachyon::NodeAtCanvasPos (ConstNodeViewRef view, float2 canvasPos) |
| The node whose {pos, lastSize} rect holds canvasPos (node.pos space), the frontmost in view.graph.ordering when several do; -1 when none does. | |
| void | tachyon::ConnectSockets (NodeViewRef view, PropertyEndpoint output, PropertyEndpoint input) |
| Wires output into Input without reporting to view.graph.onEdit. | |
| void | tachyon::BringNodeToFront (std::vector< int > &ordering, int n) |
| Moves n to the front (last) of a z-order list, keeping the others' order. | |
| float2 | tachyon::NodeViewScreenToCanvas (const float3x2 &viewTransform, IntRect canvasInnerRectScreen, int2 screen) |
| A screen point in node.pos space, for a canvas whose padding box is canvasInnerRectScreen (screen pixels) and whose pan/zoom is viewTransform (view.state.transform). | |
| float2 | tachyon::NodeViewScreenToCanvas (ConstNodeViewRef view, int2 screen) |
| A screen point (as events have them) in node.pos space, through the pan/zoom and place the view was last drawn with. | |
| float2 | tachyon::NodeViewCanvasToScreen (ConstNodeViewRef view, float2 canvasPos) |
| A point in node.pos space on the screen, where the view last drew it: the other way round from NodeViewScreenToCanvas. | |
| float2 | tachyon::NodeViewScreenToNodePos (ConstNodeViewRef view, int2 screen) |
| A screen point in node.pos space, where the nodes' boxes are (NodeViewScreenToCanvas less the canvas's border and padding, as last laid out). | |
| std::unordered_set< ID > | tachyon::ComputeNodesInMarquee (std::span< const NodeModel > nodes, IntRect canvasInnerRectScreen, const float3x2 &viewTransform, int2 marqueeStartScreen, int2 marqueeCurrentScreen) |
| Stable IDs of nodes whose {pos, lastSize} rect lies fully inside the marquee, compared in node.pos space (canvas inner-rect relative, before the content transform). | |
State machines (NodeViewKind::StateMachine) | |
| NodeViewEdit | tachyon::AddTransitionEdit (ConstNodeViewRef view, StateTransition transition, int index=-1) |
| NodeViewEdit | tachyon::RemoveTransitionsEdit (ConstNodeViewRef view, std::span< const ID > transitions) |
| An edit that removes the transitions with these stableIDs (unknown ones are skipped). | |
| NodeViewEdit | tachyon::SetInitialStateEdit (ConstNodeViewRef view, ID state) |
| An edit that makes state (a stableID; Invalid: none) the initial state. | |
| int | tachyon::TransitionIndex (ConstNodeViewRef view, ID stableID) |
| Index of the transition with stableID in view.graph.transitions; -1 when there's none. | |
| int | tachyon::NodeIndex (ConstNodeViewRef view, ID stableID) |
| Index of the node with stableID in view.graph.nodes; -1 when there's none. | |
| void | tachyon::RenameTransition (NodeViewRef view, int transition) |
| Starts relabelling transition transition as a double-click on it does: a field on its arrow, with the focus in it, from the next RenderNodeView. | |
| void | tachyon::StartTransition (NodeViewRef view, int node) |
| Starts a transition from state node without a drag: it follows the pointer until a click on a state (the same one too) adds it; a click elsewhere or Escape drops it. | |
| TransitionPath | tachyon::StateTransitionPath (ConstNodeViewRef view, const StateTransition &transition, int32_t gap, int32_t loopSize) |
| The arrow of transition: a straight line between the two states' edges, aimed from centre to centre; when the states are joined both ways, each arrow runs gap pixels to its own side, so the pair sits side by side. | |
| int2 | tachyon::TransitionLabelCentre (const TransitionPath &path, int2 size, int32_t margin) |
| Where the middle of a label size big goes on path: half way along it and beside it, margin clear of the line, on the arrow's right as it runs, so the two of a pair both ways sit on opposite sides; over the top of a loop. | |
| std::optional< ID > | tachyon::TransitionAt (ConstNodeViewRef view, float2 canvasPos, float tolerance, int32_t gap, int32_t loopSize) |
| The transition whose arrow passes within tolerance of canvasPos (node.pos space), the closest when several do, or whose label (view.state.transitionLabelBoxes) holds it; none when there's no such transition. | |
Nodes, pins and links for the node graph editor.
Calls (members of tachyon::GUIApplication): RenderNodeView, NodeText. Guide: Node view.
#include <gui_controls/gui_node_view_types.h>
| using tachyon::ConstNodeViewRef = BasicNodeViewRef<const NodeGraph, const NodeViewState> |
#include <gui_controls/gui_node_view_types.h>
|
strong |
#include <gui_controls/gui_node_view_types.h>
What a node view edits: a graph of nodes with fields wired output to input, or a state machine, where nodes are states joined by transitions and cycles are the point.
| Enumerator | |
|---|---|
| Graph | nodes with properties and sockets, wired output to input |
| StateMachine | states (nodes without properties) and transitions between them |
|
strong |
#include <gui_controls/gui_node_view_types.h>
Interior lane a drag handle adjusts: the corridor route's vertical lane (LaneX), or the detour route's verticals (ExitX, EntryX) and horizontal return lane (LaneY).
| Enumerator | |
|---|---|
| None | |
| LaneX | |
| ExitX | |
| EntryX | |
| LaneY | |
|
strong |
#include <gui_controls/gui_node_view_types.h>
How a node view draws its wires (NodeGraph::wireShape).
| Enumerator | |
|---|---|
| Orthogonal | along the grid, round the nodes, with lanes that drag |
| Curved | one smooth curve from output to input |
|
strong |
#include <gui_controls/gui_node_view_types.h>
Which edges of a frame a resize moves.
| Enumerator | |
|---|---|
| None | |
| Right | |
| Bottom | |
| Corner | |
|
inline |
#include <gui_controls/gui_node_view_helpers.h>
The element a view last built for the node, frame or transition stableID names: its stable ID scoped to the view's canvas, so another view of the graph has its own.
| float tachyon::NodeViewZoom | ( | ConstNodeViewRef | view | ) |
#include <gui_controls/gui_node_view_helpers.h>
The node view's zoom (1 = 100%).
| void tachyon::ZoomNodeView | ( | NodeViewRef | view, |
| float | factor, | ||
| int2 | pivot = {} ) |
#include <gui_controls/gui_node_view_helpers.h>
Zooms by factor around pivot (pixels from the canvas centre), within the view's minZoom..maxZoom.
| void tachyon::SetNodeViewCenter | ( | NodeViewRef | view, |
| float2 | center, | ||
| float | zoom ) |
#include <gui_controls/gui_node_view_helpers.h>
Centres the view on canvas point center at zoom (clamped to minZoom..maxZoom).
| void tachyon::FrameAllNodes | ( | NodeViewRef | view | ) |
#include <gui_controls/gui_node_view_helpers.h>
Centres and zooms the view on all nodes.
| void tachyon::FrameNodes | ( | NodeViewRef | view, |
| std::span< const int > | indices ) |
#include <gui_controls/gui_node_view_helpers.h>
Centres and zooms the view on the nodes at indices (ones out of range skipped); none leaves the view as it is.
Never past 100%, so a small group shows at its own size.
| void tachyon::FrameSelectedNodes | ( | NodeViewRef | view | ) |
#include <gui_controls/gui_node_view_helpers.h>
Centres and zooms the view on the selected nodes, and in a state machine the states a selected transition joins; on all of them when none is selected (Home, the Fit button).
| void tachyon::ScrollNodeIntoView | ( | NodeViewRef | view, |
| int | nodeIdx, | ||
| int32_t | margin ) |
#include <gui_controls/gui_node_view_helpers.h>
Pans the view, at the same zoom, by as little as brings node nodeIdx inside it with margin pixels to spare; a node larger than the view shows its top-left.
| void tachyon::RenderCanvasGrid | ( | CustomDrawContext & | ctx, |
| int32_t | baseGridSize, | ||
| color4f | dotColor, | ||
| float | dotSize, | ||
| int2 | originOffset = {}, | ||
| IntRect | clipCurrent = {} ) |
#include <gui_controls/gui_node_view_helpers.h>
Infinite background dot grid for a pan/zoom canvas, drawn from a CustomDrawContext callback in the canvas's layout space (node.pos space): a dot on every grid point.
dotSize is the dot's diameter; 2 gives one crisp pixel. The pitch doubles per zoom-out octave, so on-screen density stays roughly constant.
baseGridSize : pitch in layout pixels at 1:1 zoom. <= 0 draws nothing. originOffset : a point the lattice passes through. Pass ElementRect().position - ElementInnerRect().position to align with children positioned relative to the border box. clipCurrent : optional extra clip in the CURRENT space. The scissor is the border box, so pass ElementInnerRect() to keep out of the padding.
|
constexpr |
#include <gui_controls/gui_node_view_helpers.h>
a / b rounded toward negative infinity.
|
constexpr |
#include <gui_controls/gui_node_view_helpers.h>
The grid line (origin + k x grid) at or below v; grid must be > 0.
|
constexpr |
#include <gui_controls/gui_node_view_helpers.h>
The grid line (origin + k x grid) at or above v; grid must be > 0.
|
constexpr |
#include <gui_controls/gui_node_view_helpers.h>
The grid line (origin + k x grid) nearest v, ties going down; grid must be > 0.
| WireRoute tachyon::BuildWireRoute | ( | int2 | outPt, |
| int2 | inPt, | ||
| IntRect | srcRect, | ||
| IntRect | tgtRect, | ||
| int32_t | grid, | ||
| int2 | gridOrigin, | ||
| const WireRouteOverrides & | overrides = {} ) |
#include <gui_controls/gui_node_view_helpers.h>
Orthogonal route for a wire from an output socket (outPt, on srcRect's right edge) to an input socket (inPt, on tgtRect's left edge), with bends on the grid and clear of both bodies:
#include <gui_controls/gui_node_view_helpers.h>
A curved wire from outPt to inPt, leaving the output to the right and entering the input from the left.
Its control points are half the horizontal distance out (at least reach), so a wire running backwards loops round. The route's points are the four a curved line is drawn from (WireCurvePoint), and it has no handles.
#include <gui_controls/gui_node_view_helpers.h>
The point at t (0 to 1) along the curve the renderer draws for a line with points p0, p1, p2, p3: two quadratic Beziers, p0-p1-m and m-p2-p3, where m is halfway between p1 and p2.
|
constexpr |
#include <gui_controls/gui_node_view_helpers.h>
Stable key for a wire, identified by its target (input) endpoint - each input carries at most one incoming wire.
Keys the per-wire lane overrides and drag handles.
|
constexpr |
#include <gui_controls/gui_node_view_helpers.h>
The input a WireKey names.
| std::optional< uint32_t > tachyon::WireAt | ( | std::span< const DrawnWire > | wires, |
| int2 | p, | ||
| float | tolerance ) |
#include <gui_controls/gui_node_view_helpers.h>
The wire within tolerance of point p (the closest when several are); none when no wire is.
Points and tolerance share the wires' space.
| void tachyon::ApplyNodeViewEdit | ( | NodeViewRef | view, |
| const NodeViewEdit & | edit, | ||
| bool | undo = false ) |
#include <gui_controls/gui_node_view_helpers.h>
Redoes edit (its to values), or with undo restores its from values.
| void tachyon::CommitNodeViewEdit | ( | NodeViewRef | view, |
| const NodeViewEdit & | edit ) |
#include <gui_controls/gui_node_view_helpers.h>
Applies edit and reports it to view.graph.onEdit.
| void tachyon::ReleaseNodeViewEditIDs | ( | IDManager & | ids, |
| const NodeViewEdit & | edit, | ||
| bool | undone ) |
#include <gui_controls/gui_node_view_helpers.h>
Releases the static IDs of the nodes, frames and transitions only the side of edit not in effect holds: done, what its undo would bring back; undone, what its redo would add.
For the edit's step leaving the undo history (UndoHistory::Step::drop).
| NodeViewEdit tachyon::ConnectEdit | ( | ConstNodeViewRef | view, |
| PropertyEndpoint | output, | ||
| PropertyEndpoint | input ) |
#include <gui_controls/gui_node_view_helpers.h>
An edit that wires output into Input; the input's old wire goes, the output keeps its others.
| NodeViewEdit tachyon::DisconnectEdit | ( | ConstNodeViewRef | view, |
| PropertyEndpoint | input ) |
#include <gui_controls/gui_node_view_helpers.h>
An edit that removes the wire into Input, with its lane overrides.
| NodeViewEdit tachyon::AddNodeEdit | ( | ConstNodeViewRef | view, |
| NodeModel | node, | ||
| int | index = -1 ) |
#include <gui_controls/gui_node_view_helpers.h>
An edit that adds node at index (-1, or past the end: last), drawn in front of the others.
The nodes from index on move up one, and the wires, lanes and z-order with them. Its own inputs name nodes as they're numbered once it's in. To wire it to another node in the same step, add that Rewire to the edit (the node is added first):
NodeViewEdit edit = AddNodeEdit(view, std::move(node));
edit.rewires.push_back({ .input = { added, 0 }, .from = {}, .to = output });
| NodeViewEdit tachyon::RemoveNodesEdit | ( | ConstNodeViewRef | view, |
| std::span< const int > | indices ) |
#include <gui_controls/gui_node_view_helpers.h>
An edit that removes the nodes at indices (in any order; ones out of range and repeats are skipped), with every wire into or out of them and those wires' lanes.
The nodes after each move down, and the wires, lanes and z-order with them; undone, all of it comes back. A removed node's stableID is the host's to keep while the edit can be undone.
| NodeViewEdit tachyon::RerouteWireEdit | ( | ConstNodeViewRef | view, |
| uint32_t | wireKey, | ||
| ID | stableID, | ||
| int2 | pos ) |
#include <gui_controls/gui_node_view_helpers.h>
An edit that puts a reroute (NodeModel::reroute) on the wire wireKey (the WireKey of its input): the wire then runs from its output into the new reroute, and on from it into the input.
The reroute takes stableID, which the host keeps as for its other nodes, and pos (its square's top-left; a multiple of the grid puts the dot on a grid point). The wire's lane overrides go. Empty when there's no such wire.
| NodeViewEdit tachyon::RemoveRerouteEdit | ( | ConstNodeViewRef | view, |
| int | node ) |
#include <gui_controls/gui_node_view_helpers.h>
An edit that takes the reroute at node out, with its wire running on as it did through it: every input it fed then takes from the output that fed it (or nothing, when nothing did).
The lanes of its wires go. Empty when node isn't a reroute.
| NodeViewEdit tachyon::AddFrameEdit | ( | ConstNodeViewRef | view, |
| NodeFrame | frame, | ||
| int | index = -1 ) |
#include <gui_controls/gui_node_view_helpers.h>
An edit that adds frame at index (-1, or past the end: last, in front of the other frames, still behind every node).
The frames from index on move up one.
| NodeViewEdit tachyon::RemoveFramesEdit | ( | ConstNodeViewRef | view, |
| std::span< const int > | indices ) |
#include <gui_controls/gui_node_view_helpers.h>
An edit that removes the frames at indices (in any order; ones out of range and repeats are skipped).
The nodes in them stay. A removed frame's stableID is the host's to keep while the edit can be undone.
| NodeFrame tachyon::FrameAroundNodes | ( | ConstNodeViewRef | view, |
| std::span< const int > | indices ) |
#include <gui_controls/gui_node_view_helpers.h>
A frame round the nodes at indices, as the view last laid them out: a grid cell of room on each side, and the title bar above them.
On the grid when snapToGrid is. Its stableID, title and color are the caller's to set. Empty (zero size) without nodes.
NodeFrame frame = FrameAroundNodes(view, selected); frame.stableID = idManager.CreateStaticID(); frame.title = "Lighting"; CommitNodeViewEdit(view, AddFrameEdit(view, std::move(frame)));
| NodeViewEdit tachyon::GroupSelectionEdit | ( | ConstNodeViewRef | view, |
| NodeFrame | frame ) |
#include <gui_controls/gui_node_view_helpers.h>
An edit that puts the selected nodes and frames in frame: its place and size are set round them as FrameAroundNodes sets them (a collapsed frame counts at its open size), and it goes behind the selected frames so they stay in front of it.
Its stableID, title and color are the caller's. Empty when nothing is selected.
CommitNodeViewEdit(view, GroupSelectionEdit(view, NodeFrame{
.stableID = idManager.CreateStaticID(), .title = "Group" }));
| std::vector< int > tachyon::NodesInFrame | ( | ConstNodeViewRef | view, |
| int | frame ) |
#include <gui_controls/gui_node_view_helpers.h>
The nodes (indices) frame frame holds, which move with it: those lying wholly inside it as the view last laid them out, or, collapsed, those it held when it collapsed.
| NodeViewEdit tachyon::CollapseFrameEdit | ( | ConstNodeViewRef | view, |
| int | frame, | ||
| bool | collapse ) |
#include <gui_controls/gui_node_view_helpers.h>
An edit that collapses frame frame (or expands it), noting what it holds as it collapses (NodeFrame::members).
Empty when it's that already, or there's no such frame.
| int tachyon::FrameTitleAtCanvasPos | ( | ConstNodeViewRef | view, |
| float2 | canvasPos ) |
#include <gui_controls/gui_node_view_helpers.h>
The frame whose title bar holds canvasPos (node.pos space), the frontmost when several do; -1 when none does.
| void tachyon::RenameFrame | ( | NodeViewRef | view, |
| int | frame ) |
#include <gui_controls/gui_node_view_helpers.h>
Starts renaming frame frame as a double-click on its title does: a field over the title bar, with the focus in it, from the next RenderNodeView.
For a "Rename" menu item.
| NodeViewEdit tachyon::AddTransitionEdit | ( | ConstNodeViewRef | view, |
| StateTransition | transition, | ||
| int | index = -1 ) |
#include <gui_controls/gui_node_view_helpers.h>
An edit that adds transition at index (-1, or past the end: last). Its stableID is the caller's, kept as a node's.
CommitNodeViewEdit(view, AddTransitionEdit(view, StateTransition{
.stableID = idManager.CreateStaticID(), .from = patrol, .to = chase, .label = "sees player" }));
| NodeViewEdit tachyon::RemoveTransitionsEdit | ( | ConstNodeViewRef | view, |
| std::span< const ID > | transitions ) |
#include <gui_controls/gui_node_view_helpers.h>
An edit that removes the transitions with these stableIDs (unknown ones are skipped).
| NodeViewEdit tachyon::SetInitialStateEdit | ( | ConstNodeViewRef | view, |
| ID | state ) |
#include <gui_controls/gui_node_view_helpers.h>
An edit that makes state (a stableID; Invalid: none) the initial state.
Empty when it is already.
| int tachyon::TransitionIndex | ( | ConstNodeViewRef | view, |
| ID | stableID ) |
#include <gui_controls/gui_node_view_helpers.h>
Index of the transition with stableID in view.graph.transitions; -1 when there's none.
| int tachyon::NodeIndex | ( | ConstNodeViewRef | view, |
| ID | stableID ) |
#include <gui_controls/gui_node_view_helpers.h>
Index of the node with stableID in view.graph.nodes; -1 when there's none.
| void tachyon::RenameTransition | ( | NodeViewRef | view, |
| int | transition ) |
#include <gui_controls/gui_node_view_helpers.h>
Starts relabelling transition transition as a double-click on it does: a field on its arrow, with the focus in it, from the next RenderNodeView.
For a "Rename" menu item.
| void tachyon::StartTransition | ( | NodeViewRef | view, |
| int | node ) |
#include <gui_controls/gui_node_view_helpers.h>
Starts a transition from state node without a drag: it follows the pointer until a click on a state (the same one too) adds it; a click elsewhere or Escape drops it.
The state's menu offers it ("Add transition"); for a key or a menu of the app's.
| TransitionPath tachyon::StateTransitionPath | ( | ConstNodeViewRef | view, |
| const StateTransition & | transition, | ||
| int32_t | gap, | ||
| int32_t | loopSize ) |
#include <gui_controls/gui_node_view_helpers.h>
The arrow of transition: a straight line between the two states' edges, aimed from centre to centre; when the states are joined both ways, each arrow runs gap pixels to its own side, so the pair sits side by side.
A loop rises loopSize above its state.
| int2 tachyon::TransitionLabelCentre | ( | const TransitionPath & | path, |
| int2 | size, | ||
| int32_t | margin ) |
#include <gui_controls/gui_node_view_helpers.h>
Where the middle of a label size big goes on path: half way along it and beside it, margin clear of the line, on the arrow's right as it runs, so the two of a pair both ways sit on opposite sides; over the top of a loop.
| std::optional< ID > tachyon::TransitionAt | ( | ConstNodeViewRef | view, |
| float2 | canvasPos, | ||
| float | tolerance, | ||
| int32_t | gap, | ||
| int32_t | loopSize ) |
#include <gui_controls/gui_node_view_helpers.h>
The transition whose arrow passes within tolerance of canvasPos (node.pos space), the closest when several do, or whose label (view.state.transitionLabelBoxes) holds it; none when there's no such transition.
| std::unordered_map< uint32_t, WireLane > tachyon::ComputeWireLaneOffsets | ( | ConstNodeViewRef | view, |
| PropertyEndpoint | pendingOut = {}, | ||
| PropertyEndpoint | pendingIn = {} ) |
#include <gui_controls/gui_node_view_helpers.h>
Default lane offsets (grid steps) for wires between the same two nodes, so their lanes don't coincide: k wires, in input order, get (k-1)/2 counting down by one (one wire: 0; two: 0,-1; three: 1,0,-1; four: 1,0,-1,-2), so wires running down nest instead of crossing.
Wires running up (target node above the source) get them in reverse, for the same reason. Also each wire's index in its group and the group's size, for the detour routes. Keyed by WireKey. A dragged wire (pendingOut -> pendingIn, both valid) counts as connected, under pendingIn's key, replacing that input's wire.
| WireRoute tachyon::BuildPendingWireRoute | ( | int2 | outPt, |
| IntRect | srcRect, | ||
| int2 | cursor, | ||
| std::optional< int2 > | inPt, | ||
| IntRect | tgtRect, | ||
| int32_t | grid, | ||
| int2 | gridOrigin, | ||
| WireLane | lane = {} ) |
#include <gui_controls/gui_node_view_helpers.h>
A wire being dragged from an output: routed as the connection it would make when it is over an input that accepts it (inPt on tgtRect), else to cursor as if an input sat there.
| WireRoute tachyon::BuildPendingWireRouteToInput | ( | int2 | inPt, |
| IntRect | tgtRect, | ||
| int2 | cursor, | ||
| std::optional< int2 > | outPt, | ||
| IntRect | srcRect, | ||
| int32_t | grid, | ||
| int2 | gridOrigin, | ||
| WireLane | lane = {} ) |
#include <gui_controls/gui_node_view_helpers.h>
A wire being dragged from an input: routed as the connection it would make when it is over an output that accepts it (outPt on srcRect), else from cursor as if an output sat there.
Points run output to input, as BuildWireRoute's.
| bool tachyon::ConnectionAllowed | ( | ConstNodeViewRef | view, |
| PropertyEndpoint | out, | ||
| PropertyEndpoint | in ) |
#include <gui_controls/gui_node_view_helpers.h>
Whether a wire from output out to input in is allowed: never a same-node loop, otherwise the view's canConnect delegate decides (none: allowed).
Endpoints are bounds-checked first, so the delegate can index view.graph.nodes directly.
| PropertyEndpoint tachyon::FirstInputAccepting | ( | ConstNodeViewRef | view, |
| PropertyEndpoint | output, | ||
| int | nodeIdx ) |
#include <gui_controls/gui_node_view_helpers.h>
The first input of node nodeIdx, top to bottom, that a wire from output may connect to; invalid when there is none.
| PropertyEndpoint tachyon::FirstOutputAccepting | ( | ConstNodeViewRef | view, |
| PropertyEndpoint | input, | ||
| int | nodeIdx ) |
#include <gui_controls/gui_node_view_helpers.h>
The first output of node nodeIdx, top to bottom, that may feed Input; invalid when there is none.
| int tachyon::NodeAtCanvasPos | ( | ConstNodeViewRef | view, |
| float2 | canvasPos ) |
#include <gui_controls/gui_node_view_helpers.h>
The node whose {pos, lastSize} rect holds canvasPos (node.pos space), the frontmost in view.graph.ordering when several do; -1 when none does.
Only nodes in view.graph.ordering count, as the view keeps it after each frame.
| void tachyon::ConnectSockets | ( | NodeViewRef | view, |
| PropertyEndpoint | output, | ||
| PropertyEndpoint | input ) |
#include <gui_controls/gui_node_view_helpers.h>
Wires output into Input without reporting to view.graph.onEdit.
An input has one source, so its previous wire is replaced; the output keeps its others.
| void tachyon::BringNodeToFront | ( | std::vector< int > & | ordering, |
| int | n ) |
#include <gui_controls/gui_node_view_helpers.h>
Moves n to the front (last) of a z-order list, keeping the others' order.
| float2 tachyon::NodeViewScreenToCanvas | ( | const float3x2 & | viewTransform, |
| IntRect | canvasInnerRectScreen, | ||
| int2 | screen ) |
#include <gui_controls/gui_node_view_helpers.h>
A screen point in node.pos space, for a canvas whose padding box is canvasInnerRectScreen (screen pixels) and whose pan/zoom is viewTransform (view.state.transform).
| float2 tachyon::NodeViewScreenToCanvas | ( | ConstNodeViewRef | view, |
| int2 | screen ) |
#include <gui_controls/gui_node_view_helpers.h>
A screen point (as events have them) in node.pos space, through the pan/zoom and place the view was last drawn with.
| float2 tachyon::NodeViewCanvasToScreen | ( | ConstNodeViewRef | view, |
| float2 | canvasPos ) |
#include <gui_controls/gui_node_view_helpers.h>
A point in node.pos space on the screen, where the view last drew it: the other way round from NodeViewScreenToCanvas.
| float2 tachyon::NodeViewScreenToNodePos | ( | ConstNodeViewRef | view, |
| int2 | screen ) |
#include <gui_controls/gui_node_view_helpers.h>
A screen point in node.pos space, where the nodes' boxes are (NodeViewScreenToCanvas less the canvas's border and padding, as last laid out).
| std::unordered_set< ID > tachyon::ComputeNodesInMarquee | ( | std::span< const NodeModel > | nodes, |
| IntRect | canvasInnerRectScreen, | ||
| const float3x2 & | viewTransform, | ||
| int2 | marqueeStartScreen, | ||
| int2 | marqueeCurrentScreen ) |
#include <gui_controls/gui_node_view_helpers.h>
Stable IDs of nodes whose {pos, lastSize} rect lies fully inside the marquee, compared in node.pos space (canvas inner-rect relative, before the content transform).
Nodes not laid out yet (zero lastSize) are skipped.
canvasInnerRectScreen : canvas padding box, SCREEN pixels. viewTransform : the pan/zoom part of the canvas's contentTransform (after T(innerSize/2)). marqueeStartScreen, marqueeCurrentScreen : marquee corners, SCREEN pixels.