跳转至

GraphNode

继承

Container

简要描述

GraphNode是具有潜在多个输入和输出插槽的容器,允许GraphNode之间进行连接。插槽可以具有不同的不兼容类型。

描述

GraphNode是一个容器。每个GraphNode可以具有多个输入和输出插槽,有时也称为端口,以允许GraphNode之间进行连接。要将插槽添加到GraphNode,请向其添加任何Control派生的子节点。

在向GraphNode添加至少一个子级后,将在检查器中自动创建名为“ Slot”的新节。展开“插槽”后,您将看到每个插槽带有索引号的列表。您可以单击它们中的每个以进一步扩展。

在检查器中,您可以启用(显示)或禁用(隐藏)插槽。默认情况下,所有插槽都是禁用的,因此您最初可能看不到GraphNode上的任何插槽。您可以为每个插槽分配一种类型。只有相同类型的插槽才能相互连接。您还可以为插槽分配颜色。为GraphNode中包含的每个GUI元素定义了输入和输出槽的元组。输入连接在GraphNode的左侧,输出连接在GraphNode的右侧。仅启用的插槽被计为连接。

成员

类型 属性名 默认值
bool comment false
Vector2 offset Vector2( 0, 0 )
int overlay 0
bool resizable false
bool selected false
bool show_close false
String title ""

方法

返回值类型 方法名称
void clear_all_slots()
void clear_slot(idx: int)
Color get_connection_input_color(idx: int)
int get_connection_input_count()
Vector2 get_connection_input_position(idx: int)
int get_connection_input_type(idx: int)
Color get_connection_output_color(idx: int)
int get_connection_output_count()
Vector2 get_connection_output_position(idx: int)
int get_connection_output_type(idx: int)
Color get_slot_color_left(idx: int) const
Color get_slot_color_right(idx: int) const
int get_slot_type_left(idx: int) const
int get_slot_type_right(idx: int) const
bool is_slot_enabled_left(idx: int) const
bool is_slot_enabled_right(idx: int) const
void set_slot(idx: int, enable_left: bool, type_left: int, color_left: Color, enable_right: bool, type_right: int, color_right: Color, custom_left: Texture = null, custom_right: Texture = null)

信号

  • close_request

在要求关闭GraphNode时发出。发生在单击关闭按钮时(请参阅show_close)。


  • dragged

拖动GraphNode时发射。


  • offset_changed

当GraphNode移动时发出。


  • raise_request

当GraphNode被要求在其他节点上显示时发出。发生在聚焦(单击)GraphNode上。


  • resize_request

在要求调整GraphNode的大小时发出。发生在拖动调整大小手柄的过程中(请参阅resizable)。


枚举

enum Overlay: - OVERLAY_DISABLED = 0

没有显示叠加层。

  • OVERLAY_BREAKPOINT = 1

显示在breakpoint主题属性中设置的叠加层。

  • OVERLAY_POSITION = 2

显示在position主题属性中设置的叠加层。


常量

成员说明

  • bool comment
Default false
setter set_comment(value)
getter is_comment
  • Vector2 offset
Default Vector2( 0, 0 )
setter set_offset(value)
getter get_offset
  • int overlay
Default 0
setter set_overlay(value)
getter get_overlay
  • bool resizable
Default false
setter set_resizable(value)
getter is_resizable
  • bool selected
Default false
setter set_selected(value)
getter is_selected
  • bool show_close
Default false
setter set_show_close_button(value)
getter is_close_button_visible
  • String title
Default ""
setter set_title(value)
getter get_title

方法说明

  • clear_all_slots clear_all_slots()

禁用GraphNode的所有输入和输出插槽。


  • clear_slot clear_slot(idx: int)

禁用索引为idx的输入和输出插槽。


  • get_connection_input_color get_connection_input_color(idx: int)

返回输入连接idx的颜色。


  • get_connection_input_count get_connection_input_count()

返回启用到GraphNode的输入插槽(连接)的数量。


  • get_connection_input_position get_connection_input_position(idx: int)

返回输入连接idx的位置。


  • get_connection_input_type get_connection_input_type(idx: int)

返回输入连接的类型idx


  • get_connection_output_color get_connection_output_color(idx: int)

返回输出连接idx的颜色。


  • get_connection_output_count get_connection_output_count()

返回GraphNode启用的输出插槽(连接)的数量。


  • get_connection_output_position get_connection_output_position(idx: int)

返回输出连接idx的位置。


  • get_connection_output_type get_connection_output_type(idx: int)

返回输出连接的类型idx


  • get_slot_color_left get_slot_color_left(idx: int) const

返回设置到idx左侧(输入)插槽的颜色。


  • get_slot_color_right get_slot_color_right(idx: int) const

返回设置为idx右侧(输出)插槽的颜色。


  • get_slot_type_left get_slot_type_left(idx: int) const

返回左侧(输入)idx插槽的(整数)类型。


  • get_slot_type_right get_slot_type_right(idx: int) const

返回右侧(输出)idx插槽的(整数)类型。


  • is_slot_enabled_left is_slot_enabled_left(idx: int) const

如果启用了左(输入)插槽idx,则返回true,否则返回false


  • is_slot_enabled_right is_slot_enabled_right(idx: int) const

如果启用了正确的(输出)插槽idx,则返回true,否则返回false


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

设置ID为idx的插槽的属性。

如果enable_left/right,将出现一个端口,并且可以从此侧连接插槽。

type_left/right是端口的任意类型。只能连接具有相同类型值的端口。

color_left/right是此侧端口图标的色度。

custom_left/right是此端口的自定义纹理。

**注意:**此方法仅设置插槽的属性。要创建插槽,请将Control派生的子代添加到GraphNode。