GraphEdit¶
Inherits: Control < CanvasItem < Node < Object
类别: 核心
简要说明¶
图形它是一个能够显示各种图形节点的区域。它管理它们之间的连接事件。
属性¶
假 |
||
矢量2(0,0) |
||
20 |
||
真 |
||
1.0 |
方法¶
无效 |
add_valid_connection_type ( int from_type, int to_type ) |
无效 |
add_valid_left_disconnect_type ( int type ) |
无效 |
add_valid_right_disconnect_type ( int type ) |
无效 |
|
connect_node ( String from, int from_port, String to, int to_port ) |
|
无效 |
disconnect_node ( String from, int from_port, String to, int to_port ) |
get_connection_list ( ) const |
|
get_zoom_hbox ( ) |
|
is_node_connected ( String from, int from_port, String to, int to_port ) |
|
is_valid_connection_type ( int from_type, int to_type ) const |
|
无效 |
remove_valid_connection_type ( int from_type, int to_type ) |
无效 |
remove_valid_left_disconnect_type ( int type ) |
无效 |
remove_valid_right_disconnect_type ( int type ) |
无效 |
set_connection_activity ( String from, int from_port, String to, int to_port, float amount ) |
无效 |
set_selected ( Node node ) |
主题属性¶
活动 |
颜色(1,1,1,1) |
|
bezier_len_neg |
160 |
|
bezier_len_pos |
80 |
|
BG |
||
grid_major |
颜色(1,1,1,0.2) |
|
grid_minor |
颜色(1,1,1,0.05) |
|
减 |
||
更多 |
||
port_grab_distance_horizontal |
48 |
|
port_grab_distance_vertical |
6 |
|
重置 |
||
按扣 |
信号¶
_begin_node_move ( )
在一个笔迹运动开始时发出的信号。
_end_node_move ( )
在一个笔节移动结束时发送的信号。
当用户将连接从输入端口拖到图的空白区域时发送的信号。
当连接到 from_slot
的槽 from
石墨烯和 to_slot
的槽 to
试图创建graphnode。
当用户将连接从输出端口拖到图的空白区域时发送的信号。
delete_nodes_request ( )
尝试从图形节点中删除图形节点时发送的信号。
当连接到 from_slot
槽 from
石墨烯和 to_slot
槽 to
试图删除graphnode。
duplicate_nodes_request ( )
尝试在graphedit中复制graphnode时发出。
node_selected ( Node node )
在选定图形模式时发出。
popup_request ( Vector2 position )
请求弹出时发出。在图中单击鼠标右键时发生。 position
是发送信号时鼠标指针的位置。
scroll_offset_changed ( Vector2 ofs )
描述¶
它管理所包含的图形节点的显示,以及它们之间的连接和断开。这两个事件中的每一个都会发送信号。默认情况下,禁用图形节点插槽之间的断开连接。
强烈建议启用低处理器使用模式(请参见 OS.low_processor_usage_mode )使用graphedits时。
属性描述¶
bool right_disconnects
违约 |
假 |
设定器 |
设置“右断开”(值) |
吸气剂 |
_right_disconnects_enabled()是否已断开连接? |
如果 true
,通过拖动右端可以断开图形中现有连接的连接。
Vector2 scroll_offset
违约 |
矢量2(0,0) |
设定器 |
设置滚动值 |
吸气剂 |
获取滚动页 |
滚动偏移量。
int snap_distance
违约 |
20 |
设定器 |
设置捕捉(值) |
吸气剂 |
获取快照() |
以像素为单位的捕捉距离。
bool use_snap
违约 |
真 |
设定器 |
设置使用快照(值) |
吸气剂 |
正在使用快照()。 |
如果 true
,启用捕捉。
float zoom
违约 |
1.0 |
设定器 |
设置缩放(值) |
吸气剂 |
获取“缩放”() |
当前缩放值。
方法说明¶
使两种不同插槽类型之间的连接成为可能。类型定义为 GraphNode.set_slot 方法。
void add_valid_left_disconnect_type ( int type )
如果节点具有指定类型,则可以在从左侧插槽拖动时断开节点连接。
void add_valid_right_disconnect_type ( int type )
如果节点具有指定类型,则可以在从右侧插槽拖动时断开节点连接。
void clear_connections ( )
删除节点之间的所有连接。
在 from_port
的槽 from
石墨烯和 to_port
的槽 to
石墨烯。如果连接已经存在,则不会创建任何连接。
删除 from_port
的槽 from
石墨烯和 to_port
的槽 to
石墨烯。如果连接不存在,则不会删除任何连接。
Array get_connection_list ( ) const
返回包含连接列表的数组。连接包含在窗体的结构中 {{ from_port: 0, from: "GraphNode name 0", to_port: 1, to: "GraphNode name 1" }}
.
HBoxContainer get_zoom_hbox ( )
返回 true
如果 from_port
的槽 from
graphnode连接到 to_port
的槽 to
石墨烯。
返回是否可以连接指定类型的插槽。
使两种不同的插槽类型之间无法连接。类型定义为 GraphNode.set_slot 方法。
void remove_valid_left_disconnect_type ( int type )
如果节点具有指定的类型,则从左侧的槽中拖动时,可以删除断开节点的可能性。
void remove_valid_right_disconnect_type ( int type )
如果节点具有指定的类型,则从右侧的槽中拖动时,可以删除断开节点的可能性。
void set_selected ( Node node )
设置指定的 node
作为选定的。