GraphElement
Base GraphEdit UI element with graph coordinates, selection and editing requests.
Add the element as a direct GraphEdit child. GraphElement is a base UI container rather than a running game-world entity or a complete visual scripting system. The application implements model storage, graph execution, domain connections and undo/redo.
Persist PositionOffset: graph coordinates before zoom/scroll. GraphEdit computes local display Position as PositionOffset × Zoom − ScrollOffset and manages Scale. Do not persist Position as model coordinates or pre-multiply PositionOffset by zoom. PositionOffsetChanged also fires for programmatic assignments; Dragged concerns drag completion rather than every setter.
Selected changes only while Selectable = true. Programmatic selection emits NodeSelected/NodeDeselected on transitions; reassigning the same value does nothing. Disabling Selectable clears selection. Draggable restricts user dragging rather than the PositionOffset setter. These flags are independent, not a general read-only mode.
Resizable enables the handle, but GraphElement itself does not apply the requested size inside its input handler. With its normal parent, GraphEdit subscribes to ResizeRequest and applies size with constraints/snapping. Avoid adding a second competing Size handler unnecessarily. ResizeEnd reports the resulting Size; persist the constrained result rather than only requested newSize.
The base container fits eligible Control children into the same rectangle, so several direct children can overlap. Add one VBoxContainer/HBoxContainer for your form. Use specialized GraphNode for ports and rows. ScalingMenus controls local child popup scaling during zoom rather than scaling the entire graph.
DeleteRequest and RaiseRequest are requests rather than model deletion or undo recording. Update your model and connections before freeing the element. Use stable model keys for dynamic graphs; child indices are not IDs.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
GraphElementConstructor
public GraphElement();Creates the base container: PositionOffset = (0,0), Draggable/Selectable = true, Selected/Resizable/ScalingMenus = false.
Properties6
DraggableProperty
public bool Draggable { get; set; }Allows user dragging in GraphEdit, default true. Does not block programmatic PositionOffset or clear selection.
PositionOffsetProperty
public Vector2 PositionOffset { get; set; }Position in graph coordinates before zoom/scroll. A change, including a programmatic setter, emits PositionOffsetChanged; equal values are skipped.
ResizableProperty
public bool Resizable { get; set; }Enables the resize handle, default false. The element emits a request; its normal GraphEdit applies it with constraints. GraphFrame manual resizing requires AutoshrinkEnabled off.
ScalingMenusProperty
public bool ScalingMenus { get; set; }Allows GraphEdit zoom to affect preparation of local child popups, default false. Does not change PositionOffset or graph zoom itself.
SelectableProperty
public bool Selectable { get; set; }Allows Selected changes, default true. Setting false first clears selection and can emit NodeDeselected.
SelectedProperty
public bool Selected { get; set; }Current selection. Setter is ignored when Selectable = false; transitions emit NodeSelected/NodeDeselected even from code, while equal assignments do not.
Methods12
GetPositionOffsetVector2
public Vector2 GetPositionOffset();Position in graph coordinates before zoom/scroll. A change, including a programmatic setter, emits PositionOffsetChanged; equal values are skipped.
Vector2Position in graph coordinates before zoom/scroll. A change, including a programmatic setter, emits PositionOffsetChanged; equal values are skipped.
IsDraggablebool
public bool IsDraggable();Allows user dragging in GraphEdit, default true. Does not block programmatic PositionOffset or clear selection.
boolAllows user dragging in GraphEdit, default true. Does not block programmatic PositionOffset or clear selection.
IsResizablebool
public bool IsResizable();Enables the resize handle, default false. The element emits a request; its normal GraphEdit applies it with constraints. GraphFrame manual resizing requires AutoshrinkEnabled off.
boolEnables the resize handle, default false. The element emits a request; its normal GraphEdit applies it with constraints. GraphFrame manual resizing requires AutoshrinkEnabled off.
IsScalingMenusbool
public bool IsScalingMenus();Allows GraphEdit zoom to affect preparation of local child popups, default false. Does not change PositionOffset or graph zoom itself.
boolAllows GraphEdit zoom to affect preparation of local child popups, default false. Does not change PositionOffset or graph zoom itself.
IsSelectablebool
public bool IsSelectable();Allows Selected changes, default true. Setting false first clears selection and can emit NodeDeselected.
boolAllows Selected changes, default true. Setting false first clears selection and can emit NodeDeselected.
IsSelectedbool
public bool IsSelected();Current selection. Setter is ignored when Selectable = false; transitions emit NodeSelected/NodeDeselected even from code, while equal assignments do not.
boolCurrent selection. Setter is ignored when Selectable = false; transitions emit NodeSelected/NodeDeselected even from code, while equal assignments do not.
SetDraggablevoid
public void SetDraggable(bool draggable);Allows user dragging in GraphEdit, default true. Does not block programmatic PositionOffset or clear selection.
| Name | Type | Default |
|---|---|---|
draggable | bool | — |
draggableAllows user dragging in GraphEdit, default true. Does not block programmatic PositionOffset or clear selection.
SetPositionOffsetvoid
public void SetPositionOffset(Vector2 offset);Position in graph coordinates before zoom/scroll. A change, including a programmatic setter, emits PositionOffsetChanged; equal values are skipped.
| Name | Type | Default |
|---|---|---|
offset | Vector2 | — |
offsetPosition in graph coordinates before zoom/scroll rather than display Position.
SetResizablevoid
public void SetResizable(bool resizable);Enables the resize handle, default false. The element emits a request; its normal GraphEdit applies it with constraints. GraphFrame manual resizing requires AutoshrinkEnabled off.
| Name | Type | Default |
|---|---|---|
resizable | bool | — |
resizableEnables the resize handle, default false. The element emits a request; its normal GraphEdit applies it with constraints. GraphFrame manual resizing requires AutoshrinkEnabled off.
SetScalingMenusvoid
public void SetScalingMenus(bool scalingMenus);Allows GraphEdit zoom to affect preparation of local child popups, default false. Does not change PositionOffset or graph zoom itself.
| Name | Type | Default |
|---|---|---|
scalingMenus | bool | — |
scalingMenusAllows GraphEdit zoom to affect preparation of local child popups, default false. Does not change PositionOffset or graph zoom itself.
SetSelectablevoid
public void SetSelectable(bool selectable);Allows Selected changes, default true. Setting false first clears selection and can emit NodeDeselected.
| Name | Type | Default |
|---|---|---|
selectable | bool | — |
selectableAllows Selected changes, default true. Setting false first clears selection and can emit NodeDeselected.
SetSelectedvoid
public void SetSelected(bool selected);Current selection. Setter is ignored when Selectable = false; transitions emit NodeSelected/NodeDeselected even from code, while equal assignments do not.
| Name | Type | Default |
|---|---|---|
selected | bool | — |
selectedCurrent selection. Setter is ignored when Selectable = false; transitions emit NodeSelected/NodeDeselected even from code, while equal assignments do not.
Signals and events8
DeleteRequestEvent
public event Action DeleteRequest;Declared deletion request rather than automatic Free. Standard GraphEdit ui_graph_delete emits GraphEdit.DeleteNodesRequest with names rather than this signal on each element. Handle the model and connections before freeing objects.
DraggedEvent
public event GraphElement.DraggedEventHandler Dragged;Drag completion with starting and ending PositionOffset, suitable for one undo record. An ordinary PositionOffset setter does not emit it.
| Name | Type | Default |
|---|---|---|
from | Vector2 | — |
to | Vector2 | — |
fromPosition in graph coordinates before zoom/scroll rather than display Position.
toPosition in graph coordinates before zoom/scroll rather than display Position.
NodeDeselectedEvent
public event Action NodeDeselected;Selection was cleared, including by Selectable = false or the Selected setter.
NodeSelectedEvent
public event Action NodeSelected;Element transitioned to Selected = true; can result from a programmatic setter. Does not execute a graph node.
PositionOffsetChangedEvent
public event Action PositionOffsetChanged;PositionOffset changed, including programmatically. No arguments: read the property. Does not imply drag completion.
RaiseRequestEvent
public event Action RaiseRequest;Request to raise the element in display order. GraphEdit handles ordering; this does not change model IDs or structure.
ResizeEndEvent
public event GraphElement.ResizeEndEventHandler ResizeEnd;Handle resize completion carrying actual current Size. Persist the constrained result; does not replace intermediate ResizeRequest notifications.
| Name | Type | Default |
|---|---|---|
newSize | Vector2 | — |
newSizeElement-local size; ResizeRequest is a request, ResizeEnd carries the current resulting Size.
ResizeRequestEvent
public event GraphElement.ResizeRequestEventHandler ResizeRequest;Requested size in element-local units. GraphEdit applies snapping/constraints, so the resulting Size can differ. The signal is not gesture completion.
| Name | Type | Default |
|---|---|---|
newSize | Vector2 | — |
newSizeElement-local size; ResizeRequest is a request, ResizeEnd carries the current resulting Size.
Theme properties
These are Theme resource keys, not C# properties. Use the matching Control GetTheme…() and AddTheme…Override() methods for each value type.
| Key and type | Description |
|---|---|
resizerTexture2D | The icon used for the resizer, visible when |