GraphNode

package
v0.0.0-...-0d6c339 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2025 License: MIT Imports: 32 Imported by: 0

Documentation

Overview

graphics.gd/classdb/GraphNode allows to create nodes for a graphics.gd/classdb/GraphEdit graph with customizable content based on its child controls. graphics.gd/classdb/GraphNode is derived from graphics.gd/classdb/Container and it is responsible for placing its children on screen. This works similar to graphics.gd/classdb/VBoxContainer. Children, in turn, provide graphics.gd/classdb/GraphNode with so-called slots, each of which can have a connection port on either side.

Each graphics.gd/classdb/GraphNode slot is defined by its index and can provide the node with up to two ports: one on the left, and one on the right. By convention the left port is also referred to as the input port and the right port is referred to as the output port. Each port can be enabled and configured individually, using different type and color. The type is an arbitrary value that you can define using your own considerations. The parent graphics.gd/classdb/GraphEdit will receive this information on each connect and disconnect request.

Slots can be configured in the Inspector dock once you add at least one child graphics.gd/classdb/Control. The properties are grouped by each slot's index in the "Slot" section.

Note: While GraphNode is set up using slots and slot indices, connections are made between the ports which are enabled. Because of that graphics.gd/classdb/GraphEdit uses the port's index and not the slot's index. You can use Instance.GetInputPortSlot and Instance.GetOutputPortSlot to get the slot index from the port index.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsGraphNode() Instance
}

type Expanded

type Expanded [1]gdclass.GraphNode

func (Expanded) SetSlot

func (self Expanded) SetSlot(slot_index int, enable_left_port bool, type_left int, color_left Color.RGBA, enable_right_port bool, type_right int, color_right Color.RGBA, custom_icon_left Texture2D.Instance, custom_icon_right Texture2D.Instance, draw_stylebox bool)

Sets properties of the slot with the given 'slot_index'.

If 'enable_left_port'/'enable_right_port' is true, a port will appear and the slot will be able to be connected from this side.

With 'type_left'/'type_right' an arbitrary type can be assigned to each port. Two ports can be connected if they share the same type, or if the connection between their types is allowed in the parent graphics.gd/classdb/GraphEdit (see graphics.gd/classdb/GraphEdit.Instance.AddValidConnectionType). Keep in mind that the graphics.gd/classdb/GraphEdit has the final say in accepting the connection. Type compatibility simply allows the [Instance.OnGraphedit.ConnectionRequest] signal to be emitted.

Ports can be further customized using 'color_left'/'color_right' and 'custom_icon_left'/'custom_icon_right'. The color parameter adds a tint to the icon. The custom icon can be used to override the default port dot.

Additionally, 'draw_stylebox' can be used to enable or disable drawing of the background stylebox for each slot. See theme's 'slot'.

Individual properties can also be set using one of the set_slot_* methods.

Note: This method only sets properties of the slot. To create the slot itself, add a graphics.gd/classdb/Control-derived child to the GraphNode.

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this [Extension]See Interface for methods that can be overridden by T.

func (*Extension[T]) AsCanvasItem

func (self *Extension[T]) AsCanvasItem() CanvasItem.Instance

func (*Extension[T]) AsContainer

func (self *Extension[T]) AsContainer() Container.Instance

func (*Extension[T]) AsControl

func (self *Extension[T]) AsControl() Control.Instance

func (*Extension[T]) AsGraphElement

func (self *Extension[T]) AsGraphElement() GraphElement.Instance

func (*Extension[T]) AsGraphNode

func (self *Extension[T]) AsGraphNode() Instance

func (*Extension[T]) AsNode

func (self *Extension[T]) AsNode() Node.Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

type ID

type ID Object.ID

ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Implementation

type Implementation = implementation

Implementation implements Interface with empty methods.

type Instance

type Instance [1]gdclass.GraphNode

Instance of the class with convieniently typed arguments and results.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AsCanvasItem

func (self Instance) AsCanvasItem() CanvasItem.Instance

func (Instance) AsContainer

func (self Instance) AsContainer() Container.Instance

func (Instance) AsControl

func (self Instance) AsControl() Control.Instance

func (Instance) AsGraphElement

func (self Instance) AsGraphElement() GraphElement.Instance

func (Instance) AsGraphNode

func (self Instance) AsGraphNode() Instance

func (Instance) AsNode

func (self Instance) AsNode() Node.Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) ClearAllSlots

func (self Instance) ClearAllSlots()

Disables all slots of the GraphNode. This will remove all input/output ports from the GraphNode.

func (Instance) ClearSlot

func (self Instance) ClearSlot(slot_index int)

Disables the slot with the given 'slot_index'. This will remove the corresponding input and output port from the GraphNode.

func (Instance) GetInputPortColor

func (self Instance) GetInputPortColor(port_idx int) Color.RGBA

Returns the [Color.RGBA] of the input port with the given 'port_idx'.

func (Instance) GetInputPortCount

func (self Instance) GetInputPortCount() int

Returns the number of slots with an enabled input port.

func (Instance) GetInputPortPosition

func (self Instance) GetInputPortPosition(port_idx int) Vector2.XY

Returns the position of the input port with the given 'port_idx'.

func (Instance) GetInputPortSlot

func (self Instance) GetInputPortSlot(port_idx int) int

Returns the corresponding slot index of the input port with the given 'port_idx'.

func (Instance) GetInputPortType

func (self Instance) GetInputPortType(port_idx int) int

Returns the type of the input port with the given 'port_idx'.

func (Instance) GetOutputPortColor

func (self Instance) GetOutputPortColor(port_idx int) Color.RGBA

Returns the [Color.RGBA] of the output port with the given 'port_idx'.

func (Instance) GetOutputPortCount

func (self Instance) GetOutputPortCount() int

Returns the number of slots with an enabled output port.

func (Instance) GetOutputPortPosition

func (self Instance) GetOutputPortPosition(port_idx int) Vector2.XY

Returns the position of the output port with the given 'port_idx'.

func (Instance) GetOutputPortSlot

func (self Instance) GetOutputPortSlot(port_idx int) int

Returns the corresponding slot index of the output port with the given 'port_idx'.

func (Instance) GetOutputPortType

func (self Instance) GetOutputPortType(port_idx int) int

Returns the type of the output port with the given 'port_idx'.

func (Instance) GetSlotColorLeft

func (self Instance) GetSlotColorLeft(slot_index int) Color.RGBA

Returns the left (input) [Color.RGBA] of the slot with the given 'slot_index'.

func (Instance) GetSlotColorRight

func (self Instance) GetSlotColorRight(slot_index int) Color.RGBA

Returns the right (output) [Color.RGBA] of the slot with the given 'slot_index'.

func (Instance) GetSlotCustomIconLeft

func (self Instance) GetSlotCustomIconLeft(slot_index int) Texture2D.Instance

Returns the left (input) custom graphics.gd/classdb/Texture2D of the slot with the given 'slot_index'.

func (Instance) GetSlotCustomIconRight

func (self Instance) GetSlotCustomIconRight(slot_index int) Texture2D.Instance

Returns the right (output) custom graphics.gd/classdb/Texture2D of the slot with the given 'slot_index'.

func (Instance) GetSlotTypeLeft

func (self Instance) GetSlotTypeLeft(slot_index int) int

Returns the left (input) type of the slot with the given 'slot_index'.

func (Instance) GetSlotTypeRight

func (self Instance) GetSlotTypeRight(slot_index int) int

Returns the right (output) type of the slot with the given 'slot_index'.

func (Instance) GetTitlebarHbox

func (self Instance) GetTitlebarHbox() HBoxContainer.Instance

Returns the graphics.gd/classdb/HBoxContainer used for the title bar, only containing a graphics.gd/classdb/Label for displaying the title by default. This can be used to add custom controls to the title bar such as option or close buttons.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) IgnoreInvalidConnectionType

func (self Instance) IgnoreInvalidConnectionType() bool

func (Instance) IsSlotDrawStylebox

func (self Instance) IsSlotDrawStylebox(slot_index int) bool

Returns true if the background graphics.gd/classdb/StyleBox of the slot with the given 'slot_index' is drawn.

func (Instance) IsSlotEnabledLeft

func (self Instance) IsSlotEnabledLeft(slot_index int) bool

Returns true if left (input) side of the slot with the given 'slot_index' is enabled.

func (Instance) IsSlotEnabledRight

func (self Instance) IsSlotEnabledRight(slot_index int) bool

Returns true if right (output) side of the slot with the given 'slot_index' is enabled.

func (Instance) OnSlotSizesChanged

func (self Instance) OnSlotSizesChanged(cb func(), flags ...Signal.Flags)

func (Instance) OnSlotUpdated

func (self Instance) OnSlotUpdated(cb func(slot_index int), flags ...Signal.Flags)

func (Instance) SetIgnoreInvalidConnectionType

func (self Instance) SetIgnoreInvalidConnectionType(value bool)

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) SetSlot

func (self Instance) SetSlot(slot_index int, enable_left_port bool, type_left int, color_left Color.RGBA, enable_right_port bool, type_right int, color_right Color.RGBA)

Sets properties of the slot with the given 'slot_index'.

If 'enable_left_port'/'enable_right_port' is true, a port will appear and the slot will be able to be connected from this side.

With 'type_left'/'type_right' an arbitrary type can be assigned to each port. Two ports can be connected if they share the same type, or if the connection between their types is allowed in the parent graphics.gd/classdb/GraphEdit (see graphics.gd/classdb/GraphEdit.Instance.AddValidConnectionType). Keep in mind that the graphics.gd/classdb/GraphEdit has the final say in accepting the connection. Type compatibility simply allows the [Instance.OnGraphedit.ConnectionRequest] signal to be emitted.

Ports can be further customized using 'color_left'/'color_right' and 'custom_icon_left'/'custom_icon_right'. The color parameter adds a tint to the icon. The custom icon can be used to override the default port dot.

Additionally, 'draw_stylebox' can be used to enable or disable drawing of the background stylebox for each slot. See theme's 'slot'.

Individual properties can also be set using one of the set_slot_* methods.

Note: This method only sets properties of the slot. To create the slot itself, add a graphics.gd/classdb/Control-derived child to the GraphNode.

func (Instance) SetSlotColorLeft

func (self Instance) SetSlotColorLeft(slot_index int, color Color.RGBA)

Sets the [Color.RGBA] of the left (input) side of the slot with the given 'slot_index' to 'color'.

func (Instance) SetSlotColorRight

func (self Instance) SetSlotColorRight(slot_index int, color Color.RGBA)

Sets the [Color.RGBA] of the right (output) side of the slot with the given 'slot_index' to 'color'.

func (Instance) SetSlotCustomIconLeft

func (self Instance) SetSlotCustomIconLeft(slot_index int, custom_icon Texture2D.Instance)

Sets the custom graphics.gd/classdb/Texture2D of the left (input) side of the slot with the given 'slot_index' to 'custom_icon'.

func (Instance) SetSlotCustomIconRight

func (self Instance) SetSlotCustomIconRight(slot_index int, custom_icon Texture2D.Instance)

Sets the custom graphics.gd/classdb/Texture2D of the right (output) side of the slot with the given 'slot_index' to 'custom_icon'.

func (Instance) SetSlotDrawStylebox

func (self Instance) SetSlotDrawStylebox(slot_index int, enable bool)

Toggles the background graphics.gd/classdb/StyleBox of the slot with the given 'slot_index'.

func (Instance) SetSlotEnabledLeft

func (self Instance) SetSlotEnabledLeft(slot_index int, enable bool)

Toggles the left (input) side of the slot with the given 'slot_index'. If 'enable' is true, a port will appear on the left side and the slot will be able to be connected from this side.

func (Instance) SetSlotEnabledRight

func (self Instance) SetSlotEnabledRight(slot_index int, enable bool)

Toggles the right (output) side of the slot with the given 'slot_index'. If 'enable' is true, a port will appear on the right side and the slot will be able to be connected from this side.

func (Instance) SetSlotTypeLeft

func (self Instance) SetSlotTypeLeft(slot_index int, atype int)

Sets the left (input) type of the slot with the given 'slot_index' to 'type'. If the value is negative, all connections will be disallowed to be created via user inputs.

func (Instance) SetSlotTypeRight

func (self Instance) SetSlotTypeRight(slot_index int, atype int)

Sets the right (output) type of the slot with the given 'slot_index' to 'type'. If the value is negative, all connections will be disallowed to be created via user inputs.

func (Instance) SetSlotsFocusMode

func (self Instance) SetSlotsFocusMode(value Control.FocusMode)

func (Instance) SetTitle

func (self Instance) SetTitle(value string)

func (Instance) SlotsFocusMode

func (self Instance) SlotsFocusMode() Control.FocusMode

func (Instance) Title

func (self Instance) Title() string

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

type Interface

type Interface interface {
	DrawPort(slot_index int, position Vector2i.XY, left bool, color Color.RGBA)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL