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 ¶
- type Advanced
- type Any
- type Expanded
- type Extension
- func (self *Extension[T]) AsCanvasItem() CanvasItem.Instance
- func (self *Extension[T]) AsContainer() Container.Instance
- func (self *Extension[T]) AsControl() Control.Instance
- func (self *Extension[T]) AsGraphElement() GraphElement.Instance
- func (self *Extension[T]) AsGraphNode() Instance
- func (self *Extension[T]) AsNode() Node.Instance
- func (self *Extension[T]) AsObject() [1]gd.Object
- type ID
- type Implementation
- type Instance
- func (self Instance) AsCanvasItem() CanvasItem.Instance
- func (self Instance) AsContainer() Container.Instance
- func (self Instance) AsControl() Control.Instance
- func (self Instance) AsGraphElement() GraphElement.Instance
- func (self Instance) AsGraphNode() Instance
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) ClearAllSlots()
- func (self Instance) ClearSlot(slot_index int)
- func (self Instance) GetInputPortColor(port_idx int) Color.RGBA
- func (self Instance) GetInputPortCount() int
- func (self Instance) GetInputPortPosition(port_idx int) Vector2.XY
- func (self Instance) GetInputPortSlot(port_idx int) int
- func (self Instance) GetInputPortType(port_idx int) int
- func (self Instance) GetOutputPortColor(port_idx int) Color.RGBA
- func (self Instance) GetOutputPortCount() int
- func (self Instance) GetOutputPortPosition(port_idx int) Vector2.XY
- func (self Instance) GetOutputPortSlot(port_idx int) int
- func (self Instance) GetOutputPortType(port_idx int) int
- func (self Instance) GetSlotColorLeft(slot_index int) Color.RGBA
- func (self Instance) GetSlotColorRight(slot_index int) Color.RGBA
- func (self Instance) GetSlotCustomIconLeft(slot_index int) Texture2D.Instance
- func (self Instance) GetSlotCustomIconRight(slot_index int) Texture2D.Instance
- func (self Instance) GetSlotTypeLeft(slot_index int) int
- func (self Instance) GetSlotTypeRight(slot_index int) int
- func (self Instance) GetTitlebarHbox() HBoxContainer.Instance
- func (self Instance) ID() ID
- func (self Instance) IgnoreInvalidConnectionType() bool
- func (self Instance) IsSlotDrawStylebox(slot_index int) bool
- func (self Instance) IsSlotEnabledLeft(slot_index int) bool
- func (self Instance) IsSlotEnabledRight(slot_index int) bool
- func (self Instance) OnSlotSizesChanged(cb func(), flags ...Signal.Flags)
- func (self Instance) OnSlotUpdated(cb func(slot_index int), flags ...Signal.Flags)
- func (self Instance) SetIgnoreInvalidConnectionType(value bool)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetSlot(slot_index int, enable_left_port bool, type_left int, color_left Color.RGBA, ...)
- func (self Instance) SetSlotColorLeft(slot_index int, color Color.RGBA)
- func (self Instance) SetSlotColorRight(slot_index int, color Color.RGBA)
- func (self Instance) SetSlotCustomIconLeft(slot_index int, custom_icon Texture2D.Instance)
- func (self Instance) SetSlotCustomIconRight(slot_index int, custom_icon Texture2D.Instance)
- func (self Instance) SetSlotDrawStylebox(slot_index int, enable bool)
- func (self Instance) SetSlotEnabledLeft(slot_index int, enable bool)
- func (self Instance) SetSlotEnabledRight(slot_index int, enable bool)
- func (self Instance) SetSlotTypeLeft(slot_index int, atype int)
- func (self Instance) SetSlotTypeRight(slot_index int, atype int)
- func (self Instance) SetSlotsFocusMode(value Control.FocusMode)
- func (self Instance) SetTitle(value string)
- func (self Instance) SlotsFocusMode() Control.FocusMode
- func (self Instance) Title() string
- func (self Instance) Virtual(name string) reflect.Value
- type Interface
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 Expanded ¶
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 ¶
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 (*Extension[T]) AsGraphElement ¶
func (self *Extension[T]) AsGraphElement() GraphElement.Instance
func (*Extension[T]) AsGraphNode ¶
type 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.
type Implementation ¶
type Implementation = implementation
Implementation implements Interface with empty methods.
type Instance ¶
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 (Instance) AsCanvasItem ¶
func (self Instance) AsCanvasItem() CanvasItem.Instance
func (Instance) AsContainer ¶
func (Instance) AsGraphElement ¶
func (self Instance) AsGraphElement() GraphElement.Instance
func (Instance) AsGraphNode ¶
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 ¶
Disables the slot with the given 'slot_index'. This will remove the corresponding input and output port from the GraphNode.
func (Instance) GetInputPortColor ¶
Returns the [Color.RGBA] of the input port with the given 'port_idx'.
func (Instance) GetInputPortCount ¶
Returns the number of slots with an enabled input port.
func (Instance) GetInputPortPosition ¶
Returns the position of the input port with the given 'port_idx'.
func (Instance) GetInputPortSlot ¶
Returns the corresponding slot index of the input port with the given 'port_idx'.
func (Instance) GetInputPortType ¶
Returns the type of the input port with the given 'port_idx'.
func (Instance) GetOutputPortColor ¶
Returns the [Color.RGBA] of the output port with the given 'port_idx'.
func (Instance) GetOutputPortCount ¶
Returns the number of slots with an enabled output port.
func (Instance) GetOutputPortPosition ¶
Returns the position of the output port with the given 'port_idx'.
func (Instance) GetOutputPortSlot ¶
Returns the corresponding slot index of the output port with the given 'port_idx'.
func (Instance) GetOutputPortType ¶
Returns the type of the output port with the given 'port_idx'.
func (Instance) GetSlotColorLeft ¶
Returns the left (input) [Color.RGBA] of the slot with the given 'slot_index'.
func (Instance) GetSlotColorRight ¶
Returns the right (output) [Color.RGBA] of the slot with the given 'slot_index'.
func (Instance) GetSlotCustomIconLeft ¶
Returns the left (input) custom graphics.gd/classdb/Texture2D of the slot with the given 'slot_index'.
func (Instance) GetSlotCustomIconRight ¶
Returns the right (output) custom graphics.gd/classdb/Texture2D of the slot with the given 'slot_index'.
func (Instance) GetSlotTypeLeft ¶
Returns the left (input) type of the slot with the given 'slot_index'.
func (Instance) GetSlotTypeRight ¶
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) IgnoreInvalidConnectionType ¶
func (Instance) IsSlotDrawStylebox ¶
Returns true if the background graphics.gd/classdb/StyleBox of the slot with the given 'slot_index' is drawn.
func (Instance) IsSlotEnabledLeft ¶
Returns true if left (input) side of the slot with the given 'slot_index' is enabled.
func (Instance) IsSlotEnabledRight ¶
Returns true if right (output) side of the slot with the given 'slot_index' is enabled.
func (Instance) OnSlotSizesChanged ¶
func (Instance) OnSlotUpdated ¶
func (Instance) SetIgnoreInvalidConnectionType ¶
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 ¶
Sets the [Color.RGBA] of the left (input) side of the slot with the given 'slot_index' to 'color'.
func (Instance) SetSlotColorRight ¶
Sets the [Color.RGBA] of the right (output) side of the slot with the given 'slot_index' to 'color'.
func (Instance) SetSlotCustomIconLeft ¶
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 ¶
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 ¶
Toggles the background graphics.gd/classdb/StyleBox of the slot with the given 'slot_index'.
func (Instance) SetSlotEnabledLeft ¶
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 ¶
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 ¶
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 ¶
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.