Skip to content

Commit 4db65bd

Browse files
committed
Main panel: Print generated script through button
Repurpose the test button to print the generated script, instead of doing it each time the f key is pressed.
1 parent 8db625c commit 4db65bd

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

addons/block_code/ui/main_panel.gd

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func _ready():
2929

3030

3131
func _on_button_pressed():
32-
pass
32+
_print_generated_script()
3333

3434

3535
func switch_script(block_code_node: BlockCode):
@@ -74,11 +74,10 @@ func _input(event):
7474
else:
7575
_drag_manager.drag_ended()
7676

77-
# HACK: play the topmost block
78-
if event is InputEventKey:
79-
if event.keycode == KEY_F and event.pressed:
80-
if _current_bsd:
81-
var script: String = _block_canvas.generate_script_from_current_window(_current_bsd.script_inherits)
8277

83-
print(script)
84-
print("Debug script! (not saved)")
78+
func _print_generated_script():
79+
if _current_bsd == null:
80+
return
81+
var script: String = _block_canvas.generate_script_from_current_window(_current_bsd.script_inherits)
82+
print(script)
83+
print("Debug script! (not saved)")

0 commit comments

Comments
 (0)