Skip to main content

Module graph

Module graph 

Source
Expand description

The node graph editor in an application: each edit runs as a step, what the editor reports goes on the journal, and agents read and edit a graph through commands.

Experimental: may change in any release (docs/stability.md).
StepArgumentsDefault
graph.connectgraph, from, to ({node, port}), replaces ([{from, to}]), causehands the edit to the application
graph.disconnectgraph, edges ([{from, to}]), causehands the edit to the application
graph.movegraph, moves ([{node, from: [x, y], to: [x, y]}]), causehands the edit to the application
graph.deletegraph, nodes, edges, causehands the edit to the application
graph.addgraph, nodes ([{kind, at: [x, y], copy_of}]), causehands the edit to the application

A before-hook vetoes the edit (the editor drops it) or redirects it (other arguments: another place, another kind); a run-hook’s result is the edit handed back. A parameter’s slider is not a step: its changes go through as they are.

Events on the journal: graph.selection_changed (graph, nodes), graph.wire_selection_changed (graph, edges), graph.level_changed (graph, level), graph.refused (graph, from, to, reason).

Commands, for agents (graph names an editor shown with show_graph; without it, the only one): graph.read (the graph as drawn, the wires selected as selected_edges), graph.edit (an edit, done at the editor’s next frame as the user’s: type-checked, then its step; a connect whose replaces names a wire there moves that wire’s end, one edit), graph.select (nodes and wires), graph.view (fit, a level, a node to focus) and graph.export (the graph as an SVG image, from the copy the editor kept at its last frame; PNG and PDF, base64-encoded, behind the graph-png and graph-pdf features).

Structs§

Graphs
The node editors shown with an application, by name: their last snapshot and the requests waiting for their next frame.

Constants§

CMD_GRAPH_EDIT
CMD_GRAPH_EXPORT
CMD_GRAPH_READ
CMD_GRAPH_SELECT
CMD_GRAPH_VIEW
EVENT_GRAPH_LEVEL
EVENT_GRAPH_REFUSED
EVENT_GRAPH_SELECTION
Events published on the journal (not steps: nothing to veto).
EVENT_GRAPH_WIRE_SELECTION
EXPORT_FORMATS
The formats graph.export writes, as built: svg, then png and pdf with the graph-png and graph-pdf features.
GRAPHS
The registry, a service of ImagingPlugin.
STEP_GRAPH_ADD
STEP_GRAPH_CONNECT
STEP_GRAPH_DELETE
STEP_GRAPH_DISCONNECT
STEP_GRAPH_MOVE

Functions§

graph
A node editor hook (GraphEditor::on_edit) running each edit as its graph.* step, the editor named name.
show_graph
Shows a node editor as part of the application: its edits run their steps, its events go on the journal, agents’ requests reach it, and graph.read and graph.export see what it drew. name names it to steps and commands.
specs
The steps, as ImagingPlugin declares them.
step_of
The step of an edit (None: a parameter, not a step).