GraphNode

package
v0.0.0-...-5fa07e4 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2025 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

Package GraphNode provides methods for working with GraphNode object instances.

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 Implementation

type Implementation = implementation

Implementation implements Interface with empty methods.

type Instance

type Instance [1]gdclass.GraphNode

[GraphNode] allows to create nodes for a [GraphEdit] graph with customizable content based on its child controls. [GraphNode] is derived from [Container] and it is responsible for placing its children on screen. This works similar to [VBoxContainer]. Children, in turn, provide [GraphNode] with so-called slots, each of which can have a connection port on either side. Each [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 [b]input port[/b] and the right port is referred to as the [b]output port[/b]. 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 [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 [Control]. The properties are grouped by each slot's index in the "Slot" section. [b]Note:[/b] While GraphNode is set up using slots and slot indices, connections are made between the ports which are enabled. Because of that [GraphEdit] uses the port's index and not the slot's index. You can use [method get_input_port_slot] and [method get_output_port_slot] to get the slot index from the port index.

See [Interface] for methods that can be overridden by a [Class] that extends it.

%!(EXTRA string=GraphNode)

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 [param 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] of the input port with the given [param 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 [param 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 [param port_idx].

func (Instance) GetInputPortType

func (self Instance) GetInputPortType(port_idx int) int

Returns the type of the input port with the given [param port_idx].

func (Instance) GetOutputPortColor

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

Returns the [Color] of the output port with the given [param 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 [param 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 [param port_idx].

func (Instance) GetOutputPortType

func (self Instance) GetOutputPortType(port_idx int) int

Returns the type of the output port with the given [param port_idx].

func (Instance) GetSlotColorLeft

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

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

func (Instance) GetSlotColorRight

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

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

func (Instance) GetSlotCustomIconLeft

func (self Instance) GetSlotCustomIconLeft(slot_index int) [1]gdclass.Texture2D

Returns the left (input) custom [Texture2D] of the slot with the given [param slot_index].

func (Instance) GetSlotCustomIconRight

func (self Instance) GetSlotCustomIconRight(slot_index int) [1]gdclass.Texture2D

Returns the right (output) custom [Texture2D] of the slot with the given [param slot_index].

func (Instance) GetSlotTypeLeft

func (self Instance) GetSlotTypeLeft(slot_index int) int

Returns the left (input) type of the slot with the given [param slot_index].

func (Instance) GetSlotTypeRight

func (self Instance) GetSlotTypeRight(slot_index int) int

Returns the right (output) type of the slot with the given [param slot_index].

func (Instance) GetTitlebarHbox

func (self Instance) GetTitlebarHbox() [1]gdclass.HBoxContainer

Returns the [HBoxContainer] used for the title bar, only containing a [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 (self Instance) IgnoreInvalidConnectionType() bool

func (Instance) IsSlotDrawStylebox

func (self Instance) IsSlotDrawStylebox(slot_index int) bool

Returns true if the background [StyleBox] of the slot with the given [param slot_index] is drawn.

func (Instance) IsSlotEnabledLeft

func (self Instance) IsSlotEnabledLeft(slot_index int) bool

Returns [code]true[/code] if left (input) side of the slot with the given [param slot_index] is enabled.

func (Instance) IsSlotEnabledRight

func (self Instance) IsSlotEnabledRight(slot_index int) bool

Returns [code]true[/code] if right (output) side of the slot with the given [param slot_index] is enabled.

func (Instance) OnSlotUpdated

func (self Instance) OnSlotUpdated(cb func(slot_index int))

func (Instance) SetIgnoreInvalidConnectionType

func (self Instance) SetIgnoreInvalidConnectionType(value 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 [param slot_index]. If [param enable_left_port]/[param enable_right_port] is [code]true[/code], a port will appear and the slot will be able to be connected from this side. With [param type_left]/[param 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 [GraphEdit] (see [method GraphEdit.add_valid_connection_type]). Keep in mind that the [GraphEdit] has the final say in accepting the connection. Type compatibility simply allows the [signal GraphEdit.connection_request] signal to be emitted. Ports can be further customized using [param color_left]/[param color_right] and [param custom_icon_left]/[param 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, [param draw_stylebox] can be used to enable or disable drawing of the background stylebox for each slot. See [theme_item slot]. Individual properties can also be set using one of the [code]set_slot_*[/code] methods. [b]Note:[/b] This method only sets properties of the slot. To create the slot itself, add a [Control]-derived child to the GraphNode.

func (Instance) SetSlotColorLeft

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

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

func (Instance) SetSlotColorRight

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

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

func (Instance) SetSlotCustomIconLeft

func (self Instance) SetSlotCustomIconLeft(slot_index int, custom_icon [1]gdclass.Texture2D)

Sets the custom [Texture2D] of the left (input) side of the slot with the given [param slot_index] to [param custom_icon].

func (Instance) SetSlotCustomIconRight

func (self Instance) SetSlotCustomIconRight(slot_index int, custom_icon [1]gdclass.Texture2D)

Sets the custom [Texture2D] of the right (output) side of the slot with the given [param slot_index] to [param custom_icon].

func (Instance) SetSlotDrawStylebox

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

Toggles the background [StyleBox] of the slot with the given [param 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 [param slot_index]. If [param enable] is [code]true[/code], 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 [param slot_index]. If [param enable] is [code]true[/code], 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 [param slot_index] to [param 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 [param slot_index] to [param type]. If the value is negative, all connections will be disallowed to be created via user inputs.

func (Instance) SetTitle

func (self Instance) SetTitle(value string)

func (Instance) Title

func (self Instance) Title() string

func (*Instance) UnsafePointer

func (self *Instance) UnsafePointer() unsafe.Pointer

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