@@ -218,8 +218,8 @@ func set_unique_portal_link() -> void:
218218 next_available_id += 1
219219 generator .set_parameter ("link" , "aperture_%s " % next_available_id )
220220
221- func link_collision_warning_color (link : String = get_link () ) -> Color :
222- return Color .WHITE if is_link_unique ( link ) else Color .RED .lightened (0.4 )
221+ func link_collision_warning_color (is_unique : bool ) -> Color :
222+ return Color .WHITE if is_unique else Color .RED .lightened (0.4 )
223223
224224func set_link_from_selection () -> void :
225225 # Copy selected input portal's link for newly added output portal nodes
@@ -285,32 +285,29 @@ func setup_portal_edit() -> void:
285285 position_offset_changed .connect (edit_box_set_position .bind (edit ))
286286 graph .draw .connect (edit_box_set_position .bind (edit ))
287287
288- edit .modulate = link_collision_warning_color (get_link ())
288+ edit .modulate = link_collision_warning_color (is_link_unique ())
289+
289290 edit .text_submitted .connect (
290291 func (new_text : String ) -> void :
291292 if not is_editing :
292293 return
293294 var new_link := new_text .strip_edges ()
294- if not new_link .is_empty ():
295- if is_link_unique (new_link ):
296- graph .undoredo .start_group ()
297- on_parameter_changed ("link" , new_link )
298- add_link_undoredo (old_link , new_link )
299- if Input .is_key_pressed (KEY_CTRL ) or Input .is_key_pressed (KEY_META ):
300- replace_links (new_link , old_link )
301- graph .undoredo .end_group ()
302- else :
303- on_parameter_changed ("link" , old_link )
295+ if not new_link .is_empty () and is_link_unique (new_link ):
296+ graph .undoredo .start_group ()
297+ on_parameter_changed ("link" , new_link )
298+ add_link_undoredo (old_link , new_link )
299+ if Input .is_key_pressed (KEY_CTRL ) or Input .is_key_pressed (KEY_META ):
300+ replace_links (new_link , old_link )
301+ graph .undoredo .end_group ()
304302 is_editing = false
305303 generator .editable = false
306304 edit .reset_size ()
307305 edit .queue_free ())
308306 edit .text_changed .connect (
309307 func (new_text : String ) -> void :
310- var new_link := new_text .strip_edges ()
308+ var new_link : String = new_text .strip_edges ()
311309 if not new_link .is_empty ():
312- on_parameter_changed ("link" , new_link )
313- edit .modulate = link_collision_warning_color (new_link )
310+ edit .modulate = link_collision_warning_color (is_link_unique (new_link ))
314311 edit_box_set_position (edit ))
315312 edit .focus_exited .connect (func (): edit .text_submitted .emit (edit .text ))
316313 edit .tree_exiting .connect (
0 commit comments