Class GraphEdit
- Namespace
- Forma
- Assembly
- Forma.dll
Editor graph canvas with selection, node movement, zoom state and explicit connection management.
[TemplatePart("PART_GraphCanvas", typeof(Container), true)]
public sealed class GraphEdit : TemplatedControl, IAddChild<Control>, IAddChild, INotifyPropertyChanged, IDisposable
- Inheritance
-
GraphEdit
- Implements
- Inherited Members
Constructors
GraphEdit()
public GraphEdit()
Fields
GraphCanvasPartName
public const string GraphCanvasPartName = "PART_GraphCanvas"
Field Value
Properties
AccessibilityRole
public override AccessibilityRole AccessibilityRole { get; }
Property Value
ArrangeButton
public Button ArrangeButton { get; }
Property Value
Arranger
public GraphEditArranger Arranger { get; }
Property Value
BoxSelectionEnabled
Enables Godot-style background drag selection over graph elements.
public bool BoxSelectionEnabled { get; set; }
Property Value
BoxSelectionRect
The current retained box-selection rectangle in screen coordinates.
public Rectangle BoxSelectionRect { get; }
Property Value
- Rectangle
ConnectionDragTarget
The compatible target currently under the pointer during a connection drag, if any.
public GraphConnection? ConnectionDragTarget { get; }
Property Value
ConnectionLinesAntialiased
public bool ConnectionLinesAntialiased { get; set; }
Property Value
ConnectionLinesCurvature
public float ConnectionLinesCurvature { get; set; }
Property Value
ConnectionLinesThickness
public float ConnectionLinesThickness { get; set; }
Property Value
Connections
public IReadOnlyList<GraphConnection> Connections { get; }
Property Value
GridPattern
public GraphEditGridPattern GridPattern { get; set; }
Property Value
GridToggleButton
public Button GridToggleButton { get; }
Property Value
IsBoxSelecting
Whether a background drag selection rectangle is currently active.
public bool IsBoxSelecting { get; }
Property Value
IsConnectionDragging
Whether a graph-port connection is presently being dragged.
public bool IsConnectionDragging { get; }
Property Value
IsKeyboardConnecting
public bool IsKeyboardConnecting { get; }
Property Value
Minimap
Built-in minimap overlay, equivalent to Godot's get_minimap().
public GraphEditMinimap Minimap { get; }
Property Value
MinimapEnabled
public bool MinimapEnabled { get; set; }
Property Value
MinimapOpacity
public float MinimapOpacity { get; set; }
Property Value
MinimapSize
public Vector2 MinimapSize { get; set; }
Property Value
- Vector2
MinimapToggleButton
public Button MinimapToggleButton { get; }
Property Value
Panner
public ViewPanner Panner { get; }
Property Value
PanningScheme
public GraphEditPanningScheme PanningScheme { get; set; }
Property Value
RightDisconnectsEnabled
public bool RightDisconnectsEnabled { get; set; }
Property Value
ScrollOffset
public Vector2 ScrollOffset { get; set; }
Property Value
- Vector2
ShowArrangeButton
public bool ShowArrangeButton { get; set; }
Property Value
ShowGrid
public bool ShowGrid { get; set; }
Property Value
ShowGridButtons
public bool ShowGridButtons { get; set; }
Property Value
ShowMenu
public bool ShowMenu { get; set; }
Property Value
ShowMinimapButton
public bool ShowMinimapButton { get; set; }
Property Value
ShowZoomButtons
public bool ShowZoomButtons { get; set; }
Property Value
ShowZoomLabel
public bool ShowZoomLabel { get; set; }
Property Value
SnappingDistance
public int SnappingDistance { get; set; }
Property Value
SnappingDistanceScale
public float SnappingDistanceScale { get; set; }
Property Value
SnappingDistanceSpinBox
Built-in snapping distance editor shown with Godot's grid controls.
public SpinBox SnappingDistanceSpinBox { get; }
Property Value
SnappingEnabled
public bool SnappingEnabled { get; set; }
Property Value
SnappingToggleButton
public Button SnappingToggleButton { get; }
Property Value
Toolbar
In-canvas GraphEdit toolbar, corresponding to Godot's toolbar menu panel.
public PanelContainer Toolbar { get; }
Property Value
ToolbarButtons
public HBoxContainer ToolbarButtons { get; }
Property Value
TypeNames
public IReadOnlyDictionary<int, string> TypeNames { get; }
Property Value
Zoom
public float Zoom { get; set; }
Property Value
ZoomInButton
public Button ZoomInButton { get; }
Property Value
ZoomLabel
public Label ZoomLabel { get; }
Property Value
ZoomMax
public float ZoomMax { get; set; }
Property Value
ZoomMin
public float ZoomMin { get; set; }
Property Value
ZoomOutButton
public Button ZoomOutButton { get; }
Property Value
ZoomResetButton
public Button ZoomResetButton { get; }
Property Value
ZoomStep
public float ZoomStep { get; set; }
Property Value
Methods
AddValidConnectionType(int, int)
Registers a directional pair of port types as a valid interactive connection target.
public void AddValidConnectionType(int fromType, int toType)
Parameters
AddValidLeftDisconnectType(int)
public void AddValidLeftDisconnectType(int type)
Parameters
typeint
AddValidRightDisconnectType(int)
public void AddValidRightDisconnectType(int type)
Parameters
typeint
ArrangeChildren()
protected override void ArrangeChildren()
ArrangeNodes()
public void ArrangeNodes()
AttachGraphElementToFrame(string, string)
public void AttachGraphElementToFrame(string graphElement, string parentFrame)
Parameters
ClearConnections()
public void ClearConnections()
ConnectNode(string, int, string, int)
public bool ConnectNode(string fromNode, int fromPort, string toNode, int toPort)
Parameters
Returns
DeselectAll()
public void DeselectAll()
DetachGraphElementFromFrame(string)
public void DetachGraphElementFromFrame(string graphElement)
Parameters
graphElementstring
DisconnectNode(string, int, string, int)
public bool DisconnectNode(string fromNode, int fromPort, string toNode, int toPort)
Parameters
Returns
EndKeyboardConnecting(GraphNode, int, int)
public void EndKeyboardConnecting(GraphNode node, int inputPort, int outputPort)
Parameters
ForceConnectionDragEnd()
public void ForceConnectionDragEnd()
GetAttachedNodesOfFrame(string)
public IReadOnlyList<string> GetAttachedNodesOfFrame(string graphFrame)
Parameters
graphFramestring
Returns
GetClosestConnectionAtPoint(Vector2, float)
Returns the closest retained connection to a screen-space point, matching Godot's hit query shape.
public GraphConnection? GetClosestConnectionAtPoint(Vector2 point, float maxDistance = 4)
Parameters
pointVector2maxDistancefloat
Returns
GetConnectionActivity(string, int, string, int)
public float GetConnectionActivity(string fromNode, int fromPort, string toNode, int toPort)
Parameters
Returns
GetConnectionCount(string, int)
public int GetConnectionCount(string fromNode, int fromPort)
Parameters
Returns
GetConnectionLine(Vector2, Vector2)
Returns the retained screen-space connection curve points for the supplied endpoints.
public IReadOnlyList<Vector2> GetConnectionLine(Vector2 from, Vector2 to)
Parameters
fromVector2toVector2
Returns
- IReadOnlyList<Vector2>
GetConnectionLinesCurvature()
public float GetConnectionLinesCurvature()
Returns
GetConnectionLinesThickness()
public float GetConnectionLinesThickness()
Returns
GetConnectionList()
public IReadOnlyList<GraphConnection> GetConnectionList()
Returns
GetConnectionListFromNode(string)
public IReadOnlyList<GraphConnection> GetConnectionListFromNode(string node)
Parameters
nodestring
Returns
GetConnectionsIntersectingWithRect(RectangleF)
Returns retained connections whose screen-space line segments intersect the supplied rectangle.
public IReadOnlyList<GraphConnection> GetConnectionsIntersectingWithRect(RectangleF rect)
Parameters
rectRectangleF
Returns
GetElementFrame(string)
public GraphFrame GetElementFrame(string attachedGraphElement)
Parameters
attachedGraphElementstring
Returns
GetGridPattern()
public GraphEditGridPattern GetGridPattern()
Returns
GetMenuHBox()
public HBoxContainer GetMenuHBox()
Returns
GetMinimapOpacity()
public float GetMinimapOpacity()
Returns
GetMinimapSize()
public Vector2 GetMinimapSize()
Returns
- Vector2
GetPanningScheme()
public GraphEditPanningScheme GetPanningScheme()
Returns
GetScrollOffset()
public Vector2 GetScrollOffset()
Returns
- Vector2
GetSelectedNodes()
public IReadOnlyList<GraphNode> GetSelectedNodes()
Returns
GetSnappingDistance()
public int GetSnappingDistance()
Returns
GetTypeNames()
public IReadOnlyDictionary<int, string> GetTypeNames()
Returns
GetZoom()
public float GetZoom()
Returns
GetZoomMax()
public float GetZoomMax()
Returns
GetZoomMin()
public float GetZoomMin()
Returns
GetZoomStep()
public float GetZoomStep()
Returns
GraphToScreen(Vector2)
public Vector2 GraphToScreen(Vector2 graphPosition)
Parameters
graphPositionVector2
Returns
- Vector2
IsBoxSelectionEnabled()
public bool IsBoxSelectionEnabled()
Returns
IsConnectionLinesAntialiased()
public bool IsConnectionLinesAntialiased()
Returns
IsConnectionTargetValid(string, int, string, int)
Returns whether an output port may be used as an interactive connection source for an input port. Like Godot, equal types always match, the destination node can opt out of checking, and registered directional type pairs also match. This does not constrain ConnectNode(string, int, string, int), which is an explicit programmatic connection API in Godot as well.
public bool IsConnectionTargetValid(string fromNode, int fromPort, string toNode, int toPort)
Parameters
Returns
IsKeyboardConnectingMode()
public bool IsKeyboardConnectingMode()
Returns
IsMinimapEnabled()
public bool IsMinimapEnabled()
Returns
IsNodeConnected(string, int, string, int)
public bool IsNodeConnected(string fromNode, int fromPort, string toNode, int toPort)
Parameters
Returns
IsRightDisconnectsEnabled()
public bool IsRightDisconnectsEnabled()
Returns
IsShowingArrangeButton()
public bool IsShowingArrangeButton()
Returns
IsShowingGrid()
public bool IsShowingGrid()
Returns
IsShowingGridButtons()
public bool IsShowingGridButtons()
Returns
IsShowingMenu()
public bool IsShowingMenu()
Returns
IsShowingMinimapButton()
public bool IsShowingMinimapButton()
Returns
IsShowingZoomButtons()
public bool IsShowingZoomButtons()
Returns
IsShowingZoomLabel()
public bool IsShowingZoomLabel()
Returns
IsSnappingEnabled()
public bool IsSnappingEnabled()
Returns
IsValidConnectionType(int, int)
Returns whether an explicit directional type pair is registered.
public bool IsValidConnectionType(int fromType, int toType)
Parameters
Returns
IsValidLeftDisconnectType(int)
public bool IsValidLeftDisconnectType(int type)
Parameters
typeint
Returns
IsValidRightDisconnectType(int)
public bool IsValidRightDisconnectType(int type)
Parameters
typeint
Returns
RaiseElement(GraphElement)
public void RaiseElement(GraphElement element)
Parameters
elementGraphElement
RemoveValidConnectionType(int, int)
Removes a directional pair of port types from the interactive connection registry.
public void RemoveValidConnectionType(int fromType, int toType)
Parameters
RemoveValidLeftDisconnectType(int)
public void RemoveValidLeftDisconnectType(int type)
Parameters
typeint
RemoveValidRightDisconnectType(int)
public void RemoveValidRightDisconnectType(int type)
Parameters
typeint
ScreenToGraph(Vector2)
public Vector2 ScreenToGraph(Vector2 screenPosition)
Parameters
screenPositionVector2
Returns
- Vector2
SelectNode(GraphNode)
public void SelectNode(GraphNode node)
Parameters
nodeGraphNode
SetBoxSelectionEnabled(bool)
public void SetBoxSelectionEnabled(bool enable)
Parameters
enablebool
SetConnectionActivity(string, int, string, int, float)
public void SetConnectionActivity(string fromNode, int fromPort, string toNode, int toPort, float amount)
Parameters
SetConnectionLinesAntialiased(bool)
public void SetConnectionLinesAntialiased(bool antialiased)
Parameters
antialiasedbool
SetConnectionLinesCurvature(float)
public void SetConnectionLinesCurvature(float curvature)
Parameters
curvaturefloat
SetConnectionLinesThickness(float)
public void SetConnectionLinesThickness(float pixels)
Parameters
pixelsfloat
SetConnections(IEnumerable<GraphConnection>)
public void SetConnections(IEnumerable<GraphConnection> connections)
Parameters
connectionsIEnumerable<GraphConnection>
SetGridPattern(GraphEditGridPattern)
public void SetGridPattern(GraphEditGridPattern pattern)
Parameters
patternGraphEditGridPattern
SetMinimapEnabled(bool)
public void SetMinimapEnabled(bool enable)
Parameters
enablebool
SetMinimapOpacity(float)
public void SetMinimapOpacity(float opacity)
Parameters
opacityfloat
SetMinimapSize(Vector2)
public void SetMinimapSize(Vector2 size)
Parameters
sizeVector2
SetPanningScheme(GraphEditPanningScheme)
public void SetPanningScheme(GraphEditPanningScheme scheme)
Parameters
schemeGraphEditPanningScheme
SetRightDisconnects(bool)
public void SetRightDisconnects(bool enable)
Parameters
enablebool
SetScrollOffset(Vector2)
public void SetScrollOffset(Vector2 offset)
Parameters
offsetVector2
SetShowArrangeButton(bool)
public void SetShowArrangeButton(bool show)
Parameters
showbool
SetShowGrid(bool)
public void SetShowGrid(bool enable)
Parameters
enablebool
SetShowGridButtons(bool)
public void SetShowGridButtons(bool show)
Parameters
showbool
SetShowMenu(bool)
public void SetShowMenu(bool show)
Parameters
showbool
SetShowMinimapButton(bool)
public void SetShowMinimapButton(bool show)
Parameters
showbool
SetShowZoomButtons(bool)
public void SetShowZoomButtons(bool show)
Parameters
showbool
SetShowZoomLabel(bool)
public void SetShowZoomLabel(bool show)
Parameters
showbool
SetSnappingDistance(int)
public void SetSnappingDistance(int pixels)
Parameters
pixelsint
SetSnappingEnabled(bool)
public void SetSnappingEnabled(bool enable)
Parameters
enablebool
SetTypeNames(IDictionary<int, string>)
public void SetTypeNames(IDictionary<int, string> typeNames)
Parameters
typeNamesIDictionary<int, string>
SetZoom(float)
Sets zoom while keeping the graph coordinate under the viewport center fixed.
public void SetZoom(float zoom)
Parameters
zoomfloat
SetZoomCustom(float, Vector2)
Sets zoom while preserving the graph point under a local viewport coordinate.
public void SetZoomCustom(float zoom, Vector2 center)
Parameters
zoomfloatcenterVector2
SetZoomMax(float)
public void SetZoomMax(float zoomMax)
Parameters
zoomMaxfloat
SetZoomMin(float)
public void SetZoomMin(float zoomMin)
Parameters
zoomMinfloat
SetZoomStep(float)
public void SetZoomStep(float zoomStep)
Parameters
zoomStepfloat
SnapPosition(Vector2)
Rounds a graph coordinate to the active Godot grid spacing.
public Vector2 SnapPosition(Vector2 graphPosition)
Parameters
graphPositionVector2
Returns
- Vector2
StartKeyboardConnecting(GraphNode, int, int)
public void StartKeyboardConnecting(GraphNode node, int inputPort, int outputPort)
Parameters
TryBeginConnectionDrag(GraphNode, Point)
Begins an interactive connection drag when position is over one of node's ports.
public bool TryBeginConnectionDrag(GraphNode node, Point position)
Parameters
nodeGraphNodepositionPoint
Returns
UpdateGraphFrame(GraphFrame)
Recomputes an autoshrink frame around its attached elements.
public void UpdateGraphFrame(GraphFrame frame)
Parameters
frameGraphFrame
ZoomIn()
public void ZoomIn()
ZoomOut()
public void ZoomOut()
ZoomReset()
public void ZoomReset()
Events
ConnectionDragEnded
public event Action<GraphEdit> ConnectionDragEnded
Event Type
ConnectionDragStarted
public event Action<GraphEdit, string, int, bool> ConnectionDragStarted
Event Type
ConnectionFromEmpty
public event Action<GraphEdit, string, int, Vector2> ConnectionFromEmpty
Event Type
ConnectionRequest
public event Action<GraphEdit, GraphConnection> ConnectionRequest
Event Type
ConnectionToEmpty
public event Action<GraphEdit, string, int, Vector2> ConnectionToEmpty
Event Type
CopyNodesRequest
public event Action<GraphEdit> CopyNodesRequest
Event Type
CutNodesRequest
public event Action<GraphEdit> CutNodesRequest
Event Type
DeleteNodesRequest
public event Action<GraphEdit, IReadOnlyList<string>> DeleteNodesRequest
Event Type
DisconnectionRequest
public event Action<GraphEdit, GraphConnection> DisconnectionRequest
Event Type
DuplicateNodesRequest
public event Action<GraphEdit> DuplicateNodesRequest
Event Type
GraphElementsLinkedToFrameRequest
Requests application-owned attachment of dropped graph elements to a frame.
public event Action<GraphEdit, IReadOnlyList<string>, string> GraphElementsLinkedToFrameRequest
Event Type
NodeSelected
public event Action<GraphEdit, GraphNode> NodeSelected
Event Type
NodesArranged
public event Action<GraphEdit> NodesArranged
Event Type
PasteNodesRequest
public event Action<GraphEdit> PasteNodesRequest
Event Type
ScrollOffsetChanged
public event Action<GraphEdit, Vector2> ScrollOffsetChanged
Event Type
ZoomChanged
public event Action<GraphEdit, float> ZoomChanged