GraphNode

Inherits: Container < Control < CanvasItem < Node < Object

Un GraphNode es un contenedor con potencialmente varias ranuras de entrada y salida que permiten conexiones entre los GraphNodes. Las ranuras pueden tener tipos diferentes e incompatibles.

Descripción

A GraphNode is a container. Each GraphNode can have several input and output slots, sometimes referred to as ports, allowing connections between GraphNodes. To add a slot to GraphNode, add any Control-derived child node to it.

After adding at least one child to GraphNode new sections will be automatically created in the Inspector called 'Slot'. When 'Slot' is expanded you will see list with index number for each slot. You can click on each of them to expand further.

In the Inspector you can enable (show) or disable (hide) slots. By default, all slots are disabled so you may not see any slots on your GraphNode initially. You can assign a type to each slot. Only slots of the same type will be able to connect to each other. You can also assign colors to slots. A tuple of input and output slots is defined for each GUI element included in the GraphNode. Input connections are on the left and output connections are on the right side of GraphNode. Only enabled slots are counted as connections.

Propiedades

bool

comment

false

Vector2

offset

Vector2( 0, 0 )

Overlay

overlay

0

bool

resizable

false

bool

selected

false

bool

show_close

false

String

title

""

Métodos

void

clear_all_slots ( )

void

clear_slot ( int idx )

Color

get_connection_input_color ( int idx )

int

get_connection_input_count ( )

Vector2

get_connection_input_position ( int idx )

int

get_connection_input_type ( int idx )

Color

get_connection_output_color ( int idx )

int

get_connection_output_count ( )

Vector2

get_connection_output_position ( int idx )

int

get_connection_output_type ( int idx )

Color

get_slot_color_left ( int idx ) const

Color

get_slot_color_right ( int idx ) const

int

get_slot_type_left ( int idx ) const

int

get_slot_type_right ( int idx ) const

bool

is_slot_enabled_left ( int idx ) const

bool

is_slot_enabled_right ( int idx ) const

void

set_slot ( int idx, bool enable_left, int type_left, Color color_left, bool enable_right, int type_right, Color color_right, Texture custom_left=null, Texture custom_right=null )

void

set_slot_color_left ( int idx, Color color_left )

void

set_slot_color_right ( int idx, Color color_right )

void

set_slot_enabled_left ( int idx, bool enable_left )

void

set_slot_enabled_right ( int idx, bool enable_right )

void

set_slot_type_left ( int idx, int type_left )

void

set_slot_type_right ( int idx, int type_right )

Propiedades del Theme

Color

close_color

Color( 0, 0, 0, 1 )

Color

resizer_color

Color( 0, 0, 0, 1 )

Color

title_color

Color( 0, 0, 0, 1 )

int

close_offset

18

int

port_offset

3

int

separation

1

int

title_offset

20

Font

title_font

Texture

close

Texture

port

Texture

resizer

StyleBox

breakpoint

StyleBox

comment

StyleBox

commentfocus

StyleBox

defaultfocus

StyleBox

defaultframe

StyleBox

frame

StyleBox

position

StyleBox

selectedframe

Señales

  • close_request ( )

Emitido cuando se solicita el cierre del GraphNode. Ocurre al hacer clic en el botón de cierre (ver show_close).


Se emite cuando se arrastra el GraphNode.


  • offset_changed ( )

Emitido cuando se mueve el GraphNode.


  • raise_request ( )

Emitido cuando se solicita que el GraphNode se muestre sobre otros. Ocurre al enfocar (hacer clic en) el GraphNode.


  • resize_request ( Vector2 new_minsize )

Emitido cuando se pide que el GraphNode sea redimensionado. Ocurre al arrastrar el mango de redimensionamiento (ver resizable).


  • slot_updated ( int idx )

Emitted when any GraphNode's slot is updated.

Enumeraciones

enum Overlay:

  • OVERLAY_DISABLED = 0 --- No se muestra ninguna capa superpuesta.

  • OVERLAY_BREAKPOINT = 1 --- Muestra la capa superpuesta establecida en la propiedad del tema breakpoint.

  • OVERLAY_POSITION = 2 --- Muestra la capa superpuesta establecida en la propiedad del tema position.

Descripciones de Propiedades

Default

false

Setter

set_comment(value)

Getter

is_comment()

Si true, el GraphNode es un nodo de comentario.


Default

Vector2( 0, 0 )

Setter

set_offset(value)

Getter

get_offset()

El desplazamiento del GraphNode, relativo al desplazamiento del GraphEdit.

Nota: No puedes usar la posición directamente, ya que GraphEdit es un Container.


Default

0

Setter

set_overlay(value)

Getter

get_overlay()

Establece la superposición que se muestra sobre el GraphNode. Ver Overlay.


Default

false

Setter

set_resizable(value)

Getter

is_resizable()

Si true, el usuario puede cambiar el tamaño del GraphNode.

Nota: Arrastrando el manejador sólo se emitirá la señal resize_request, el GraphNode necesita ser redimensionado manualmente.


Default

false

Setter

set_selected(value)

Getter

is_selected()

Si true, se selecciona el GraphNode.


Default

false

Setter

set_show_close_button(value)

Getter

is_close_button_visible()

Si true, el botón de cerrado será visible.

Nota: Al pulsarlo sólo se emitirá la señal close_request, el GraphNode debe ser eliminado manualmente.


Default

""

Setter

set_title(value)

Getter

get_title()

El texto que se muestra en la barra de título del GraphNode.

Descripciones de Métodos

  • void clear_all_slots ( )

Deshabilita todas las ranuras de entrada y salida del GraphNode.


  • void clear_slot ( int idx )

Desactiva la ranura de entrada y salida cuyo índice es idx.


  • Color get_connection_input_color ( int idx )

Returns the Color of the input connection idx.


  • int get_connection_input_count ( )

Devuelve el número de ranuras de entrada (conexiones) habilitadas al GraphNode.


  • Vector2 get_connection_input_position ( int idx )

Devuelve la posición de la conexión de entrada idx.


  • int get_connection_input_type ( int idx )

Devuelve el tipo de la conexión de entrada idx.


  • Color get_connection_output_color ( int idx )

Returns the Color of the output connection idx.


  • int get_connection_output_count ( )

Devuelve el número de ranuras de salida (conexiones) habilitadas del GraphNode.


  • Vector2 get_connection_output_position ( int idx )

Devuelve la posición de la conexión de salida idx.


  • int get_connection_output_type ( int idx )

Devuelve el tipo de la conexión de salida idx.


  • Color get_slot_color_left ( int idx ) const

Returns the left (input) Color of the slot idx.


  • Color get_slot_color_right ( int idx ) const

Returns the right (output) Color of the slot idx.


  • int get_slot_type_left ( int idx ) const

Returns the left (input) type of the slot idx.


  • int get_slot_type_right ( int idx ) const

Returns the right (output) type of the slot idx.


  • bool is_slot_enabled_left ( int idx ) const

Returns true if left (input) side of the slot idx is enabled.


  • bool is_slot_enabled_right ( int idx ) const

Returns true if right (output) side of the slot idx is enabled.


Sets properties of the slot with ID idx.

If enable_left/right, a port will appear and the slot will be able to be connected from this side.

type_left/right is an arbitrary type of the port. Only ports with the same type values can be connected.

color_left/right is the tint of the port's icon on this side.

custom_left/right is a custom texture for this side's port.

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

Individual properties can be set using one of the set_slot_* methods. You must enable at least one side of the slot to do so.


  • void set_slot_color_left ( int idx, Color color_left )

Sets the Color of the left (input) side of the slot idx to color_left.


  • void set_slot_color_right ( int idx, Color color_right )

Sets the Color of the right (output) side of the slot idx to color_right.


  • void set_slot_enabled_left ( int idx, bool enable_left )

Toggles the left (input) side of the slot idx. If enable_left is true, a port will appear on the left side and the slot will be able to be connected from this side.


  • void set_slot_enabled_right ( int idx, bool enable_right )

Toggles the right (output) side of the slot idx. If enable_right is true, a port will appear on the right side and the slot will be able to be connected from this side.


  • void set_slot_type_left ( int idx, int type_left )

Sets the left (input) type of the slot idx to type_left.


  • void set_slot_type_right ( int idx, int type_right )

Sets the right (output) type of the slot idx to type_right.

Theme Property Descriptions

Default

Color( 0, 0, 0, 1 )

La modulación de color aplicada al icono del botón de cierre.


Default

Color( 0, 0, 0, 1 )

La modulación de color aplicada al icono de redimensionamiento.


Default

Color( 0, 0, 0, 1 )

El color del texto del título.


  • int close_offset

Default

18

El desplazamiento vertical del botón de cierre.


  • int port_offset

Default

3

Desplazamiento horizontal de los puertos.


  • int separation

Default

1

La distancia vertical entre los puertos.


  • int title_offset

Default

20

Desplazamiento vertical del texto del título.


Fuente usada para el texto del título.


El icono del botón de cierre, visible cuando show_close está activado.


El icono utilizado para representar los puertos.


El icono utilizado para el redimensionamiento, visible cuando está activado el resizable.


El fondo utilizado cuando overlay se establece en OVERLAY_BREAKPOINT.


El StyleBox utilizado cuando el comment está activado.


El StyleBox utilizado cuando el comment está habilitado y el GraphNode está enfocado.




El fondo por defecto para GraphNode.


El fondo utilizado cuando overlay se establece en OVERLAY_POSITION.


El fondo utilizado cuando se selecciona el GraphNode.