@@ -111,19 +111,16 @@ func _input(event: InputEvent) -> void:
111111 set_link ([from_point , get_local_mouse_position ()])
112112 show_node (LazyNode .FROM )
113113
114-
115114func _set_colors (frame_color : Color , linked_frame_color : Color ,
116115 link_color : Color , node_color : Color ) -> void :
117116 frame .border_color = frame_color
118117 linked_frame .border_color = linked_frame_color
119118 $ Link .gradient .colors [LazyNode .FROM ] = link_color
120119 $ NodeA .material .set_shader_parameter ("node_color" , node_color )
121120
122-
123121func set_link (pts : PackedVector2Array ) -> void :
124122 $ Link .points = pts
125123
126-
127124func end_link (is_cancel : bool = false ) -> void :
128125 $ NodeA .hide ()
129126 $ NodeB .hide ()
@@ -139,7 +136,6 @@ func end_link(is_cancel: bool = false) -> void:
139136 invalidate_link ()
140137 queue_redraw ()
141138
142-
143139func invalidate_link () -> void :
144140 source = null
145141 target = null
@@ -148,15 +144,13 @@ func invalidate_link() -> void:
148144 is_context_linking = false
149145 has_context = false
150146
151-
152147func show_node (node : LazyNode ) -> void :
153148 var color_rect := $ NodeA if node else $ NodeB
154149 color_rect .show ()
155150 color_rect .position = get_local_mouse_position () - Vector2 (16 , 16 )
156151 move_to_front ()
157152 queue_redraw ()
158153
159-
160154func port_attr (node : GraphNode , port_idx : int ,
161155 is_output : bool , key : String ) -> String :
162156 if node :
@@ -166,7 +160,6 @@ func port_attr(node: GraphNode, port_idx: int,
166160 return defs [port_idx ][key ]
167161 return ""
168162
169-
170163func has_input_link (node : GraphNode , port_idx : int ) -> bool :
171164 var graph : GraphEdit = get_parent ()
172165 if graph :
@@ -175,7 +168,6 @@ func has_input_link(node: GraphNode, port_idx: int) -> bool:
175168 return true
176169 return false
177170
178-
179171func connect_port_type (types : Array , allow_any : bool = false ) -> bool :
180172 var graph : GraphEdit = get_parent ()
181173 if not graph :
@@ -191,7 +183,6 @@ func connect_port_type(types: Array, allow_any: bool = false) -> bool:
191183 return true
192184 return false
193185
194-
195186func create_context_menu (is_output : bool , source_output : int = - 1 ) -> void :
196187 var context_node : GraphNode = source if is_output else target
197188
@@ -252,26 +243,22 @@ func create_context_menu(is_output: bool, source_output: int = -1) -> void:
252243 popup .max_size .y = MAX_POPUP_HEIGHT * int (csf )
253244 popup .show ()
254245
255-
256246func popup_window_input (event : InputEvent ) -> void :
257247 if event .is_action ("ui_cancel" ):
258248 invalidate_link ()
259249
260-
261250func popup_hidden (popup : PopupMenu ) -> void :
262251 if not has_context :
263252 invalidate_link ()
264253 popup .queue_free ()
265254
266-
267255func create_context_connection () -> void :
268256 var graph : GraphEdit = get_parent ()
269257 if (source and target and graph
270258 and source .get_output_port_count ()
271259 and target .get_input_port_count ()):
272260 create_context_menu (source .get_output_port_count () != 1 )
273261
274-
275262func do_context_link (to : int , from : int ) -> void :
276263 if from != - 1 :
277264 if (source .get_output_port_type (from ) == target .get_input_port_type (to )
@@ -282,7 +269,6 @@ func do_context_link(to: int, from: int) -> void:
282269 else :
283270 create_context_menu (Port .INPUT , to )
284271
285-
286272# handle lazy connection (alt + rmb)
287273func do_lazy_connection () -> void :
288274 var graph : GraphEdit = get_parent ()
@@ -328,7 +314,7 @@ func do_lazy_connection() -> void:
328314 graph .on_connect_node (source .name , out_port , target .name , in_port )
329315 return
330316
331- # force at least one connection(compatible slot type) even when all slots are used
317+ # force at least one connection(compatible slot type) even if all slots are used
332318 for in_port : int in target .get_input_port_count ():
333319 if (source .get_output_port_type (0 ) == target .get_input_port_type (in_port )
334320 or source .get_output_port_type (0 ) == 42
0 commit comments