GraphNode
GraphEdit element with UI rows and separate input/output ports.
Add GraphNode as a direct GraphEdit child, then add Control rows and configure them through SetSlot. GraphNode provides graph UI rather than execution of game actions. The application implements data, evaluation, domain-specific connection validation and persistence. Title is a caption; Name is the GraphEdit identifier. Keep them separate.
Distinguish a row slotIndex from a portIdx. Input and output ports have separate dense zero-based indices covering only enabled ports on that side. For example, if only row 2 has an input, its portIdx is 0 and GetInputPortSlot(0) is 2. GraphEdit connections use port indices; SetSlot* uses row indices. Disabling an earlier port shifts later portIdx values.
Create rows first and allow layout to settle before measuring positions. A nested form inside one HBoxContainer/VBoxContainer remains one GraphNode row. Hiding, reordering, adding or removing direct rows can change row/port mappings. Rebuild configuration from your model and update connections after such changes; do not persist portIdx as a permanent ID. Keep stable keys in your model or metadata.
SetSlot replaces the entire row record, including resetting metadata and omitted icons. Use SetSlotColor*, SetSlotType* or other partial setters to change one property. Create the record through SetSlot/SetSlotEnabled* before setting its type, color, icon or metadata. ClearSlot and ClearAllSlots remove port configuration while retaining child Control rows.
Installed Runtime 1.0.0 has a reset defect: SetSlot with both ports disabled, types 0, white colors and empty icons removes the record but can retain an old port cache. Use ClearSlot to remove configuration instead of that SetSlot call. SlotUpdated does not cover all changes: ClearSlot/ClearAllSlots and metadata setters do not emit it.
A port type is an integer application category; its color is presentation. GraphEdit uses types and allowed pairs to find UI connection candidates; color alone does not determine compatibility. IgnoreInvalidConnectionType relaxes that filter rather than making a connection safe for your model or implementing computation. Validate connection requests before committing them to your model.
GetInputPortPosition/GetOutputPortPosition return GraphNode-local coordinates rather than graph or screen coordinates. Account for CanvasItem transforms when converting spaces. _DrawPort receives the row slotIndex; overriding it replaces default port drawing rather than defining connection rules.
GetTitlebarHBox returns a GraphNode-owned internal container. Add your close button without freeing the container itself. Handle your model and GraphEdit connections before deleting an element; the presence of CloseRequest in the SDK does not guarantee a ready-made close button.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
GraphNodeConstructor
public GraphNode();Creates a graph element with no enabled ports. Add Control rows and SetSlot configuration separately; internal titlebar controls are not rows.
Properties3
IgnoreInvalidConnectionTypeProperty
public bool IgnoreInvalidConnectionType { get; set; }Relaxes the GraphEdit UI connection-candidate type filter, default false. Does not replace model validation or match ports by color.
SlotsFocusModeProperty
public Control.FocusModeEnum SlotsFocusMode { get; set; }Row focus policy, default Accessibility. Accepts Click, All and Accessibility; None is rejected. Not the general FocusMode of all nested fields.
TitleProperty
public string Title { get; set; }Visible GraphNode caption, independent of Name used by connections.
Methods43
ClearAllSlotsvoid
public void ClearAllSlots();Removes all row settings and invalidates the port cache. Child Controls remain; no per-row SlotUpdated is emitted. Layout can recreate default style records without enabling ports.
ClearSlotvoid
public void ClearSlot(int slotIndex);Removes the row record and invalidates the port cache. Does not delete its child Control, renumber records or emit SlotUpdated.
| Name | Type | Default |
|---|---|---|
slotIndex | int | — |
slotIndexNonnegative Control row index, separate from dense port index. Recalculate mappings after row changes.
GetInputPortColorColor
public Color GetInputPortColor(int portIdx);Returns the color by dense input port index 0…GetInputPortCount()-1. Do not pass slotIndex as portIdx.
| Name | Type | Default |
|---|---|---|
portIdx | int | — |
portIdxDense index on the relevant side: 0…GetInputPortCount()-1 or 0…GetOutputPortCount()-1. Not a row index.
ColorReturns the color by dense input port index 0…GetInputPortCount()-1. Do not pass slotIndex as portIdx.
GetInputPortCountint
public int GetInputPortCount();Number of active input ports in the current row cache, not all children or SetSlot records.
intNumber of active input ports in the current row cache, not all children or SetSlot records.
GetInputPortPositionVector2
public Vector2 GetInputPortPosition(int portIdx);Returns the local center position by dense input port index 0…GetInputPortCount()-1. Do not pass slotIndex as portIdx. Coordinates are GraphNode-local, before its CanvasItem transform.
| Name | Type | Default |
|---|---|---|
portIdx | int | — |
portIdxDense index on the relevant side: 0…GetInputPortCount()-1 or 0…GetOutputPortCount()-1. Not a row index.
Vector2Returns the local center position by dense input port index 0…GetInputPortCount()-1. Do not pass slotIndex as portIdx. Coordinates are GraphNode-local, before its CanvasItem transform.
GetInputPortSlotint
public int GetInputPortSlot(int portIdx);Returns the row index by dense input port index 0…GetInputPortCount()-1. Do not pass slotIndex as portIdx.
| Name | Type | Default |
|---|---|---|
portIdx | int | — |
portIdxDense index on the relevant side: 0…GetInputPortCount()-1 or 0…GetOutputPortCount()-1. Not a row index.
intReturns the row index by dense input port index 0…GetInputPortCount()-1. Do not pass slotIndex as portIdx.
GetInputPortTypeint
public int GetInputPortType(int portIdx);Returns the type by dense input port index 0…GetInputPortCount()-1. Do not pass slotIndex as portIdx.
| Name | Type | Default |
|---|---|---|
portIdx | int | — |
portIdxDense index on the relevant side: 0…GetInputPortCount()-1 or 0…GetOutputPortCount()-1. Not a row index.
intReturns the type by dense input port index 0…GetInputPortCount()-1. Do not pass slotIndex as portIdx.
GetOutputPortColorColor
public Color GetOutputPortColor(int portIdx);Returns the color by dense output port index 0…GetOutputPortCount()-1. Do not pass slotIndex as portIdx.
| Name | Type | Default |
|---|---|---|
portIdx | int | — |
portIdxDense index on the relevant side: 0…GetInputPortCount()-1 or 0…GetOutputPortCount()-1. Not a row index.
ColorReturns the color by dense output port index 0…GetOutputPortCount()-1. Do not pass slotIndex as portIdx.
GetOutputPortCountint
public int GetOutputPortCount();Number of active output ports in the current row cache, not all children or SetSlot records.
intNumber of active output ports in the current row cache, not all children or SetSlot records.
GetOutputPortPositionVector2
public Vector2 GetOutputPortPosition(int portIdx);Returns the local center position by dense output port index 0…GetOutputPortCount()-1. Do not pass slotIndex as portIdx. Coordinates are GraphNode-local, before its CanvasItem transform.
| Name | Type | Default |
|---|---|---|
portIdx | int | — |
portIdxDense index on the relevant side: 0…GetInputPortCount()-1 or 0…GetOutputPortCount()-1. Not a row index.
Vector2Returns the local center position by dense output port index 0…GetOutputPortCount()-1. Do not pass slotIndex as portIdx. Coordinates are GraphNode-local, before its CanvasItem transform.
GetOutputPortSlotint
public int GetOutputPortSlot(int portIdx);Returns the row index by dense output port index 0…GetOutputPortCount()-1. Do not pass slotIndex as portIdx.
| Name | Type | Default |
|---|---|---|
portIdx | int | — |
portIdxDense index on the relevant side: 0…GetInputPortCount()-1 or 0…GetOutputPortCount()-1. Not a row index.
intReturns the row index by dense output port index 0…GetOutputPortCount()-1. Do not pass slotIndex as portIdx.
GetOutputPortTypeint
public int GetOutputPortType(int portIdx);Returns the type by dense output port index 0…GetOutputPortCount()-1. Do not pass slotIndex as portIdx.
| Name | Type | Default |
|---|---|---|
portIdx | int | — |
portIdxDense index on the relevant side: 0…GetInputPortCount()-1 or 0…GetOutputPortCount()-1. Not a row index.
intReturns the type by dense output port index 0…GetOutputPortCount()-1. Do not pass slotIndex as portIdx.
GetSlotColorLeftColor
public Color GetSlotColorLeft(int slotIndex);Returns the stored color of the left side; white for a missing record. Row-index getter rather than portIdx.
| Name | Type | Default |
|---|---|---|
slotIndex | int | — |
slotIndexNonnegative Control row index, separate from dense port index. Recalculate mappings after row changes.
ColorReturns the stored color of the left side; white for a missing record. Row-index getter rather than portIdx.
GetSlotColorRightColor
public Color GetSlotColorRight(int slotIndex);Returns the stored color of the right side; white for a missing record. Row-index getter rather than portIdx.
| Name | Type | Default |
|---|---|---|
slotIndex | int | — |
slotIndexNonnegative Control row index, separate from dense port index. Recalculate mappings after row changes.
ColorReturns the stored color of the right side; white for a missing record. Row-index getter rather than portIdx.
GetSlotCustomIconLeftTexture2D
public Texture2D GetSlotCustomIconLeft(int slotIndex);Returns the stored shared icon Texture2D of the left side; null for a missing record. Row-index getter rather than portIdx.
| Name | Type | Default |
|---|---|---|
slotIndex | int | — |
slotIndexNonnegative Control row index, separate from dense port index. Recalculate mappings after row changes.
Texture2DReturns the stored shared icon Texture2D of the left side; null for a missing record. Row-index getter rather than portIdx.
GetSlotCustomIconRightTexture2D
public Texture2D GetSlotCustomIconRight(int slotIndex);Returns the stored shared icon Texture2D of the right side; null for a missing record. Row-index getter rather than portIdx.
| Name | Type | Default |
|---|---|---|
slotIndex | int | — |
slotIndexNonnegative Control row index, separate from dense port index. Recalculate mappings after row changes.
Texture2DReturns the stored shared icon Texture2D of the right side; null for a missing record. Row-index getter rather than portIdx.
GetSlotMetadataLeftVariant
public Variant GetSlotMetadataLeft(int slotIndex);Returns the left metadata Variant, or Nil. Dispose the returned C# Variant wrapper after reading; this does not grant separate ownership of a referenced object.
| Name | Type | Default |
|---|---|---|
slotIndex | int | — |
slotIndexNonnegative Control row index, separate from dense port index. Recalculate mappings after row changes.
VariantReturns the left metadata Variant, or Nil. Dispose the returned C# Variant wrapper after reading; this does not grant separate ownership of a referenced object.
GetSlotMetadataRightVariant
public Variant GetSlotMetadataRight(int slotIndex);Returns the right metadata Variant, or Nil. Dispose the returned C# Variant wrapper after reading; this does not grant separate ownership of a referenced object.
| Name | Type | Default |
|---|---|---|
slotIndex | int | — |
slotIndexNonnegative Control row index, separate from dense port index. Recalculate mappings after row changes.
VariantReturns the right metadata Variant, or Nil. Dispose the returned C# Variant wrapper after reading; this does not grant separate ownership of a referenced object.
GetSlotTypeLeftint
public int GetSlotTypeLeft(int slotIndex);Returns the stored integer type of the left side; 0 for a missing record. Row-index getter rather than portIdx.
| Name | Type | Default |
|---|---|---|
slotIndex | int | — |
slotIndexNonnegative Control row index, separate from dense port index. Recalculate mappings after row changes.
intReturns the stored integer type of the left side; 0 for a missing record. Row-index getter rather than portIdx.
GetSlotTypeRightint
public int GetSlotTypeRight(int slotIndex);Returns the stored integer type of the right side; 0 for a missing record. Row-index getter rather than portIdx.
| Name | Type | Default |
|---|---|---|
slotIndex | int | — |
slotIndexNonnegative Control row index, separate from dense port index. Recalculate mappings after row changes.
intReturns the stored integer type of the right side; 0 for a missing record. Row-index getter rather than portIdx.
GetSlotsFocusModeControl.FocusModeEnum
public Control.FocusModeEnum GetSlotsFocusMode();Row focus policy, default Accessibility. Accepts Click, All and Accessibility; None is rejected. Not the general FocusMode of all nested fields.
Control.FocusModeEnumRow focus policy, default Accessibility. Accepts Click, All and Accessibility; None is rejected. Not the general FocusMode of all nested fields.
GetTitlestring
public string GetTitle();Visible GraphNode caption, independent of Name used by connections.
stringVisible GraphNode caption, independent of Name used by connections.
GetTitlebarHBoxHBoxContainer
public HBoxContainer GetTitlebarHBox();Shared internal HBoxContainer owned by GraphNode. Add your buttons without freeing or reparenting the container itself.
HBoxContainerShared internal HBoxContainer owned by GraphNode. Add your buttons without freeing or reparenting the container itself.
IsIgnoringValidConnectionTypebool
public bool IsIgnoringValidConnectionType();Returns IgnoreInvalidConnectionType. SDK method name is retained: despite Valid in the name, true means the ignore-type-restrictions flag is enabled.
boolReturns IgnoreInvalidConnectionType. SDK method name is retained: despite Valid in the name, true means the ignore-type-restrictions flag is enabled.
IsSlotDrawStyleboxbool
public bool IsSlotDrawStylebox(int slotIndex);Row record style flag. false for a missing record; layout of an existing row can create a record with drawStylebox = true. Does not indicate an enabled port.
| Name | Type | Default |
|---|---|---|
slotIndex | int | — |
slotIndexNonnegative Control row index, separate from dense port index. Recalculate mappings after row changes.
boolRow record style flag. false for a missing record; layout of an existing row can create a record with drawStylebox = true. Does not indicate an enabled port.
IsSlotEnabledLeftbool
public bool IsSlotEnabledLeft(int slotIndex);Whether this row’s left port is enabled. A missing record returns false.
| Name | Type | Default |
|---|---|---|
slotIndex | int | — |
slotIndexNonnegative Control row index, separate from dense port index. Recalculate mappings after row changes.
boolWhether this row’s left port is enabled. A missing record returns false.
IsSlotEnabledRightbool
public bool IsSlotEnabledRight(int slotIndex);Whether this row’s right port is enabled. A missing record returns false.
| Name | Type | Default |
|---|---|---|
slotIndex | int | — |
slotIndexNonnegative Control row index, separate from dense port index. Recalculate mappings after row changes.
boolWhether this row’s right port is enabled. A missing record returns false.
SetIgnoreInvalidConnectionTypevoid
public void SetIgnoreInvalidConnectionType(bool ignore);Relaxes the GraphEdit UI connection-candidate type filter, default false. Does not replace model validation or match ports by color.
| Name | Type | Default |
|---|---|---|
ignore | bool | — |
ignoreRelax the UI connection-type filter.
SetSlotvoid
public void SetSlot(int slotIndex, bool enableLeftPort, int typeLeft, Color colorLeft, bool enableRightPort, int typeRight, Color colorRight, Texture2D customIconLeft = null, Texture2D customIconRight = null, bool drawStylebox = true);Replaces the entire row configuration: sides, types, colors, icons and style. Metadata resets. Use ClearSlot to remove the record: the all-default reset branch can retain an old port cache. slotIndex is a row rather than portIdx.
| Name | Type | Default |
|---|---|---|
slotIndex | int | — |
enableLeftPort | bool | — |
typeLeft | int | — |
colorLeft | Color | — |
enableRightPort | bool | — |
typeRight | int | — |
colorRight | Color | — |
customIconLeft | Texture2D | null |
customIconRight | Texture2D | null |
drawStylebox | bool | true |
slotIndexNonnegative Control row index, separate from dense port index. Recalculate mappings after row changes.
enableLeftPortEnable the row’s left input port.
typeLeftApplication-defined integer input category.
colorLeftInput port color rather than a compatibility rule.
enableRightPortEnable the row’s right output port.
typeRightApplication-defined integer output category.
colorRightOutput port color rather than a compatibility rule.
customIconLeftShared Texture2D, or null for the default icon.
customIconRightShared Texture2D, or null for the default icon.
drawStyleboxApply row styling rather than enabling a port.
SetSlotColorLeftvoid
public void SetSlotColorLeft(int slotIndex, Color color);Sets the color of an existing left slot record. Create the record with SetSlot/SetSlotEnabled* first. A change emits SlotUpdated; type and color are independent.
| Name | Type | Default |
|---|---|---|
slotIndex | int | — |
color | Color | — |
slotIndexNonnegative Control row index, separate from dense port index. Recalculate mappings after row changes.
colorPort presentation color.
SetSlotColorRightvoid
public void SetSlotColorRight(int slotIndex, Color color);Sets the color of an existing right slot record. Create the record with SetSlot/SetSlotEnabled* first. A change emits SlotUpdated; type and color are independent.
| Name | Type | Default |
|---|---|---|
slotIndex | int | — |
color | Color | — |
slotIndexNonnegative Control row index, separate from dense port index. Recalculate mappings after row changes.
colorPort presentation color.
SetSlotCustomIconLeftvoid
public void SetSlotCustomIconLeft(int slotIndex, Texture2D customIcon);Sets the shared icon Texture2D of an existing left slot record. Create the record with SetSlot/SetSlotEnabled* first. A change emits SlotUpdated; type and color are independent.
| Name | Type | Default |
|---|---|---|
slotIndex | int | — |
customIcon | Texture2D | — |
slotIndexNonnegative Control row index, separate from dense port index. Recalculate mappings after row changes.
customIconShared Texture2D, or null for the default icon.
SetSlotCustomIconRightvoid
public void SetSlotCustomIconRight(int slotIndex, Texture2D customIcon);Sets the shared icon Texture2D of an existing right slot record. Create the record with SetSlot/SetSlotEnabled* first. A change emits SlotUpdated; type and color are independent.
| Name | Type | Default |
|---|---|---|
slotIndex | int | — |
customIcon | Texture2D | — |
slotIndexNonnegative Control row index, separate from dense port index. Recalculate mappings after row changes.
customIconShared Texture2D, or null for the default icon.
SetSlotDrawStyleboxvoid
public void SetSlotDrawStylebox(int slotIndex, bool enable);Sets row-style usage without enabling ports. Can create a row record; emits SlotUpdated even for a repeated value.
| Name | Type | Default |
|---|---|---|
slotIndex | int | — |
enable | bool | — |
slotIndexNonnegative Control row index, separate from dense port index. Recalculate mappings after row changes.
enableEnable the specified row setting.
SetSlotEnabledLeftvoid
public void SetSlotEnabledLeft(int slotIndex, bool enable);Enables/disables the left port, creating a record if needed. A change emits SlotUpdated and changes dense port numbering.
| Name | Type | Default |
|---|---|---|
slotIndex | int | — |
enable | bool | — |
slotIndexNonnegative Control row index, separate from dense port index. Recalculate mappings after row changes.
enableEnable the specified row setting.
SetSlotEnabledRightvoid
public void SetSlotEnabledRight(int slotIndex, bool enable);Enables/disables the right port, creating a record if needed. A change emits SlotUpdated and changes dense port numbering.
| Name | Type | Default |
|---|---|---|
slotIndex | int | — |
enable | bool | — |
slotIndexNonnegative Control row index, separate from dense port index. Recalculate mappings after row changes.
enableEnable the specified row setting.
SetSlotMetadataLeftvoid
public void SetSlotMetadataLeft(int slotIndex, Variant value);Stores a Variant on the left side of an existing record. Emits no SlotUpdated. Resource/container values can remain shared rather than being deeply copied.
| Name | Type | Default |
|---|---|---|
slotIndex | int | — |
value | Variant | — |
slotIndexNonnegative Control row index, separate from dense port index. Recalculate mappings after row changes.
valueMetadata Variant; optionally store a stable model key here.
SetSlotMetadataRightvoid
public void SetSlotMetadataRight(int slotIndex, Variant value);Stores a Variant on the right side of an existing record. Emits no SlotUpdated. Resource/container values can remain shared rather than being deeply copied.
| Name | Type | Default |
|---|---|---|
slotIndex | int | — |
value | Variant | — |
slotIndexNonnegative Control row index, separate from dense port index. Recalculate mappings after row changes.
valueMetadata Variant; optionally store a stable model key here.
SetSlotTypeLeftvoid
public void SetSlotTypeLeft(int slotIndex, int type);Sets the integer type of an existing left slot record. Create the record with SetSlot/SetSlotEnabled* first. A change emits SlotUpdated; type and color are independent.
| Name | Type | Default |
|---|---|---|
slotIndex | int | — |
type | int | — |
slotIndexNonnegative Control row index, separate from dense port index. Recalculate mappings after row changes.
typeInteger port category rather than color or a C# Type.
SetSlotTypeRightvoid
public void SetSlotTypeRight(int slotIndex, int type);Sets the integer type of an existing right slot record. Create the record with SetSlot/SetSlotEnabled* first. A change emits SlotUpdated; type and color are independent.
| Name | Type | Default |
|---|---|---|
slotIndex | int | — |
type | int | — |
slotIndexNonnegative Control row index, separate from dense port index. Recalculate mappings after row changes.
typeInteger port category rather than color or a C# Type.
SetSlotsFocusModevoid
public void SetSlotsFocusMode(Control.FocusModeEnum focusMode);Row focus policy, default Accessibility. Accepts Click, All and Accessibility; None is rejected. Not the general FocusMode of all nested fields.
| Name | Type | Default |
|---|---|---|
focusMode | Control.FocusModeEnum | — |
focusModeClick, All or Accessibility; None is unsupported.
SetTitlevoid
public void SetTitle(string title);Visible GraphNode caption, independent of Name used by connections.
| Name | Type | Default |
|---|---|---|
title | string | — |
titleVisible caption separate from Name.
_DrawPortvoid
public virtual void _DrawPort(int slotIndex, Vector2I position, bool left, Color color);Virtual port drawing by row slotIndex rather than input/output index. position is the local center; left identifies the side. An override replaces default drawing; issue drawing calls in this callback. Does not change type or connections.
| Name | Type | Default |
|---|---|---|
slotIndex | int | — |
position | Vector2I | — |
left | bool | — |
color | Color | — |
slotIndexNonnegative Control row index, separate from dense port index. Recalculate mappings after row changes.
positionLocal port drawing center.
lefttrue for a left input, false for a right output.
colorPort presentation color.
Signals and events3
CloseRequestEvent
public event Action CloseRequest;SDK-retained close request rather than automatic deletion. Do not assume a built-in close button: add your own to GetTitlebarHBox and handle connections/model before Free.
SlotSizesChangedEvent
public event Action SlotSizesChanged;Row layout was recalculated. No arguments; reread port positions. Does not execute the graph or imply every slot setting changed.
SlotUpdatedEvent
public event GraphNode.SlotUpdatedEventHandler SlotUpdated;Configuration of the specified row changed rather than a port being activated. Not a universal observer: clearing and metadata setters do not emit it. Track your own model mutations explicitly.
| Name | Type | Default |
|---|---|---|
slotIndex | long | — |
slotIndexNonnegative Control row index, separate from dense port index. Recalculate mappings after row changes.
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 |
|---|---|
resizer_colorColor | The color modulation applied to the resizer icon. Default:Color(0.875, 0.875, 0.875, 1) |
port_h_offsetint | Horizontal offset for the ports. Default:0 |
separationint | The vertical distance between ports. Default:2 |
portTexture2D | The icon used for representing ports. |
panelStyleBox | The default background for the slot area of the |
panel_focusStyleBox |
|
panel_selectedStyleBox | The |
slotStyleBox | |
slot_selectedStyleBox |
|
titlebarStyleBox | |
titlebar_selectedStyleBox | The |