@@ -82,7 +82,6 @@ func _draw() -> void:
8282 inactive_link_color , inactive_color )
8383 draw_style_box (frame , source .get_rect ())
8484
85-
8685func _input (event : InputEvent ) -> void :
8786 if event .is_action_pressed ("ui_cancel" ):
8887 end_link (true )
@@ -111,17 +110,17 @@ func _input(event: InputEvent) -> void:
111110 set_link ([from_point , get_local_mouse_position ()])
112111 show_node (LazyNode .FROM )
113112
114- func _set_colors (frame_color : Color , linked_frame_color : Color ,
115- link_color : Color , node_color : Color ) -> void :
113+ func _set_colors (frame_color : Color , linked_frame_color : Color ,
114+ link_color : Color , node_color : Color ) -> void :
116115 frame .border_color = frame_color
117116 linked_frame .border_color = linked_frame_color
118117 $ Link .gradient .colors [LazyNode .FROM ] = link_color
119118 $ NodeA .material .set_shader_parameter ("node_color" , node_color )
120119
121- func set_link (pts : PackedVector2Array ) -> void :
120+ func set_link (pts : PackedVector2Array ) -> void :
122121 $ Link .points = pts
123122
124- func end_link (is_cancel : bool = false ) -> void :
123+ func end_link (is_cancel : bool = false ) -> void :
125124 $ NodeA .hide ()
126125 $ NodeB .hide ()
127126 $ Link .points = PackedVector2Array ()
@@ -144,31 +143,31 @@ func invalidate_link() -> void:
144143 is_context_linking = false
145144 has_context = false
146145
147- func show_node (node : LazyNode ) -> void :
146+ func show_node (node : LazyNode ) -> void :
148147 var color_rect := $ NodeA if node else $ NodeB
149148 color_rect .show ()
150149 color_rect .position = get_local_mouse_position () - Vector2 (16 , 16 )
151150 move_to_front ()
152151 queue_redraw ()
153152
154- func port_attr (node : GraphNode , port_idx : int ,
155- is_output : bool , key : String ) -> String :
153+ func port_attr (node : GraphNode , port_idx : int ,
154+ is_output : bool , key : String ) -> String :
156155 if node :
157156 var defs : Array = (node .generator .get_output_defs ()
158157 if is_output else node .generator .get_input_defs ())
159158 if defs [port_idx ].has (key ):
160159 return defs [port_idx ][key ]
161160 return ""
162161
163- func has_input_link (node : GraphNode , port_idx : int ) -> bool :
162+ func has_input_link (node : GraphNode , port_idx : int ) -> bool :
164163 var graph : GraphEdit = get_parent ()
165164 if graph :
166165 for c : Dictionary in graph .connections :
167166 if c .to_port == port_idx and c .to_node == node .name :
168167 return true
169168 return false
170169
171- func connect_port_type (types : Array , allow_any : bool = false ) -> bool :
170+ func connect_port_type (types : Array , allow_any : bool = false ) -> bool :
172171 var graph : GraphEdit = get_parent ()
173172 if not graph :
174173 return false
@@ -183,15 +182,15 @@ func connect_port_type(types: Array, allow_any: bool = false) -> bool:
183182 return true
184183 return false
185184
186- func create_context_menu (is_output : bool , source_output : int = - 1 ) -> void :
185+ func create_context_menu (is_output : bool , source_output : int = - 1 ) -> void :
187186 var context_node : GraphNode = source if is_output else target
188187
189188 # skip context menu if target node only has one input
190189 if not is_output and context_node .get_input_port_count () == 1 :
191190 do_context_link (0 , source_output )
192191 return
193192
194- var popup : PopupMenu = PopupMenu .new ()
193+ var popup := PopupMenu .new ()
195194 popup .add_theme_constant_override (
196195 "item_%s _padding" % [ "end" if is_output else "start" ], 16 )
197196
@@ -220,7 +219,7 @@ func create_context_menu(is_output: bool, source_output: int = -1) -> void:
220219
221220 var slot_icon : Image = Image .new ()
222221 slot_icon .load_svg_from_buffer (SLOT_SVG .replace ("#FFF" ,
223- "#" + context_port_color .to_html (false )).to_utf8_buffer ())
222+ "#" + context_port_color .to_html (false )).to_utf8_buffer ())
224223 popup .add_icon_item (ImageTexture .create_from_image (slot_icon ), port_name )
225224
226225 popup .content_scale_factor = csf
@@ -247,7 +246,7 @@ func popup_window_input(event : InputEvent) -> void:
247246 if event .is_action ("ui_cancel" ):
248247 invalidate_link ()
249248
250- func popup_hidden (popup : PopupMenu ) -> void :
249+ func popup_hidden (popup : PopupMenu ) -> void :
251250 if not has_context :
252251 invalidate_link ()
253252 popup .queue_free ()
@@ -259,7 +258,7 @@ func create_context_connection() -> void:
259258 and target .get_input_port_count ()):
260259 create_context_menu (source .get_output_port_count () != 1 )
261260
262- func do_context_link (to : int , from : int ) -> void :
261+ func do_context_link (to : int , from : int ) -> void :
263262 if from != - 1 :
264263 if (source .get_output_port_type (from ) == target .get_input_port_type (to )
265264 or source .get_output_port_type (from ) == 42
@@ -274,8 +273,7 @@ func do_lazy_connection() -> void:
274273 var graph : GraphEdit = get_parent ()
275274 if (not (source and target and graph ) or
276275 not (source .get_output_port_count ()
277- and target .get_input_port_count ())
278- ):
276+ and target .get_input_port_count ())):
279277 return
280278
281279 # connect by exact port name (short description, case-sensitive)
0 commit comments