From db7d3a5ea6f54c2f6b3e1f2a815b7a28f70d5562 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= Date: Fri, 6 Dec 2024 15:25:49 -0300 Subject: [PATCH 01/21] Background: Disable/enable conditional properties The "is_pointy_value" property depends on the block type to be Value. And the "control_part" property depends on the block type to be Control. --- .../ui/blocks/utilities/background/background.gd | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/addons/block_code/ui/blocks/utilities/background/background.gd b/addons/block_code/ui/blocks/utilities/background/background.gd index 7fc39381..d3f228e9 100644 --- a/addons/block_code/ui/blocks/utilities/background/background.gd +++ b/addons/block_code/ui/blocks/utilities/background/background.gd @@ -37,6 +37,7 @@ func _set_color(new_color): func _set_block_type(new_block_type): block_type = new_block_type queue_redraw() + notify_property_list_changed() func _set_control_part(new_control_part): @@ -49,6 +50,13 @@ func _set_is_pointy_value(new_is_pointy_value): queue_redraw() +func _validate_property(property: Dictionary): + if property.name == "control_part" and block_type != Types.BlockType.CONTROL: + property.usage |= PROPERTY_USAGE_READ_ONLY + elif property.name == "is_pointy_value" and block_type != Types.BlockType.VALUE: + property.usage |= PROPERTY_USAGE_READ_ONLY + + func _ready(): parent_block = BlockTreeUtil.get_parent_block(self) parent_block.focus_entered.connect(queue_redraw) From 169a0dcbc172b66e5147dcc2b0ffc31b60a645c2 Mon Sep 17 00:00:00 2001 From: Jian-Hong Pan Date: Mon, 9 Dec 2024 18:04:09 +0800 Subject: [PATCH 02/21] README: Add info of drag & drop a file from Resource Filesystem Add how to drag & drop a resource file as getter block from the Resource Filesystem dock. This follows https://github.com/endlessm/godot-block-coding/pull/305. https://phabricator.endlessm.com/T35712 --- addons/block_code/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/block_code/README.md b/addons/block_code/README.md index 77003bec..7d183a34 100644 --- a/addons/block_code/README.md +++ b/addons/block_code/README.md @@ -64,6 +64,7 @@ Lean into animations! Godot's animations functionality goes beyond just simple a If you want to access the node's property, you can drag the property from the Inspector dock and drop it into the block script as a getter block. And, if you want to modify the property's value, please press & hold Ctrl key when you drop the property, then it will be a setter block of the property in the block script. +You can also drag a file from the Resource Filesystem dock and drop it into the block script as a getter block. It will become a constant value block holding the file's resource full path. ## Feedback From 3ffd23bc03b6ff583c1ab2f83d82ad4c37864f9c Mon Sep 17 00:00:00 2001 From: ShalokShalom Date: Fri, 13 Dec 2024 17:41:32 +0100 Subject: [PATCH 03/21] Update README.md This adds a Youtube video including preview --- addons/block_code/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/block_code/README.md b/addons/block_code/README.md index 7d183a34..650c0135 100644 --- a/addons/block_code/README.md +++ b/addons/block_code/README.md @@ -5,6 +5,8 @@ Experimental plugin by [Endless OS Foundation](https://endlessos.org) that intro [![Godot asset](https://img.shields.io/badge/Asset_Library-Block_Coding-blue?logo=godot-engine)](https://godotengine.org/asset-library/asset/3095) [![Latest release](https://img.shields.io/github/v/release/endlessm/godot-block-coding?label=Release&logo=github)](https://github.com/endlessm/godot-block-coding/releases) +[![Youtube video](https://i.ibb.co/B2Y11n5/Bildschirmfoto-20241213-173815.png)](https://www.youtube.com/watch?v=WlUN7Zz0Djg) + ## Background Our aim is to reduce the learning curve faced by learners who are on the early part of their journey towards becoming game developers. Learners within our target audience understand game concepts, but have never used Godot (or any other game engine) before, and do not have programming experience. Ordinarily, such learners are faced with the challenge of learning their way around Godot's powerful, complex editor UI, combined with the additional challenge of learning to code for the first time as they navigate the ins and outs of GDScript. From 6571f15053deb4bf97634a3d0ea1cf42f142094c Mon Sep 17 00:00:00 2001 From: urbit-pilled Date: Tue, 17 Dec 2024 12:51:56 +1300 Subject: [PATCH 04/21] Added advanced checkbox This adds an advanced mode to the title dock that allows the user to see advanced blocks, which will help us add advanced blocks without cluttering the block list. I implemented it by: - adding `is_advanced` boolean to the `BlockDefinition` class and set the default value to false. - adding an "advanced" checkbox to `main_panel.tscn` - modifying `picker.gd` to filter the block list to hide advanced blocks if the checkbox is unchecked. Fixes https://github.com/endlessm/godot-block-coding/issues/282 --- addons/block_code/code_generation/block_definition.gd | 4 ++++ addons/block_code/ui/main_panel.gd | 5 +++++ addons/block_code/ui/main_panel.tscn | 5 +++++ addons/block_code/ui/picker/picker.gd | 10 ++++++++++ 4 files changed, 24 insertions(+) diff --git a/addons/block_code/code_generation/block_definition.gd b/addons/block_code/code_generation/block_definition.gd index b9a72e82..5bfbc794 100644 --- a/addons/block_code/code_generation/block_definition.gd +++ b/addons/block_code/code_generation/block_definition.gd @@ -28,6 +28,8 @@ const FORMAT_STRING_PATTERN = "\\[(?[^\\]]+)\\]|\\{const (? BlockExtension: diff --git a/addons/block_code/ui/main_panel.gd b/addons/block_code/ui/main_panel.gd index e276107d..cdc8e8f7 100644 --- a/addons/block_code/ui/main_panel.gd +++ b/addons/block_code/ui/main_panel.gd @@ -86,6 +86,11 @@ func _on_delete_node_button_pressed(): dialog.connect("confirmed", _on_delete_dialog_confirmed.bind(_context.block_code_node)) +func _on_advanced_checkbox_toggled(is_advanced: bool): + _picker.set_advanced(is_advanced) + _picker.reload_blocks() + + func _on_delete_dialog_confirmed(block_code_node: BlockCode): var parent_node = block_code_node.get_parent() diff --git a/addons/block_code/ui/main_panel.tscn b/addons/block_code/ui/main_panel.tscn index 78520466..838ee3fe 100644 --- a/addons/block_code/ui/main_panel.tscn +++ b/addons/block_code/ui/main_panel.tscn @@ -60,6 +60,10 @@ unique_name_in_owner = true layout_mode = 2 size_flags_horizontal = 3 +[node name="AdvancedCheckBox" type="CheckBox" parent="MarginContainer/HBoxContainer/ScriptVBox/HBoxContainer"] +layout_mode = 2 +text = "Advanced" + [node name="ShowScriptButton" type="Button" parent="MarginContainer/HBoxContainer/ScriptVBox/HBoxContainer"] layout_mode = 2 size_flags_horizontal = 0 @@ -119,6 +123,7 @@ block_canvas_path = NodePath("../PickerSplit/MarginContainer/VBoxContainer/Block [connection signal="pressed" from="MarginContainer/HBoxContainer/ScriptVBox/HBoxContainer/ShowScriptButton" to="." method="_on_show_script_button_pressed"] [connection signal="pressed" from="MarginContainer/HBoxContainer/ScriptVBox/HBoxContainer/DeleteNodeButton" to="." method="_on_delete_node_button_pressed"] +[connection signal="toggled" from="MarginContainer/HBoxContainer/ScriptVBox/HBoxContainer/AdvancedCheckBox" to="." method="_on_advanced_checkbox_toggled"] [connection signal="add_block_code" from="MarginContainer/HBoxContainer/ScriptVBox/MarginContainer/PickerSplit/MarginContainer/VBoxContainer/BlockCanvas" to="." method="_on_block_canvas_add_block_code"] [connection signal="open_scene" from="MarginContainer/HBoxContainer/ScriptVBox/MarginContainer/PickerSplit/MarginContainer/VBoxContainer/BlockCanvas" to="." method="_on_block_canvas_open_scene"] [connection signal="replace_block_code" from="MarginContainer/HBoxContainer/ScriptVBox/MarginContainer/PickerSplit/MarginContainer/VBoxContainer/BlockCanvas" to="." method="_on_block_canvas_replace_block_code"] diff --git a/addons/block_code/ui/picker/picker.gd b/addons/block_code/ui/picker/picker.gd index 8d061d82..22783a44 100644 --- a/addons/block_code/ui/picker/picker.gd +++ b/addons/block_code/ui/picker/picker.gd @@ -38,6 +38,7 @@ var scroll_tween: Tween var _category_buttons: Dictionary # String, BlockCategoryButton var _category_displays: Dictionary # String, BlockCategoryDisplay +var _advanced_mode: bool = false func _ready() -> void: @@ -74,6 +75,10 @@ func _update_block_components(): for category in block_categories: var block_definitions := _context.block_script.get_blocks_in_category(category) + + if not _advanced_mode: + block_definitions = block_definitions.filter(func(definition): return not definition.is_advanced) + var order_override = CATEGORY_ORDER_OVERRIDE.get(category.name) if order_override: block_definitions.sort_custom(_sort_blocks_by_list_order.bind(order_override)) @@ -136,3 +141,8 @@ func _category_selected(category_name: String): func set_collapsed(collapsed: bool): _widget_container.visible = not collapsed + + +func set_advanced(advanced: bool): + _advanced_mode = advanced + reload_blocks() From 7b8f4adf5e9812cd26524c1e82fcbd844dba1cde Mon Sep 17 00:00:00 2001 From: Daze Date: Fri, 11 Oct 2024 05:06:43 +0000 Subject: [PATCH 05/21] Adds the every physics step block And set it as an advanced block. Fixes https://github.com/endlessm/godot-block-coding/issues/261 --- .../blocks/lifecycle/physics_process.tres | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 addons/block_code/blocks/lifecycle/physics_process.tres diff --git a/addons/block_code/blocks/lifecycle/physics_process.tres b/addons/block_code/blocks/lifecycle/physics_process.tres new file mode 100644 index 00000000..315c4b55 --- /dev/null +++ b/addons/block_code/blocks/lifecycle/physics_process.tres @@ -0,0 +1,18 @@ +[gd_resource type="Resource" load_steps=2 format=3 uid="uid://3l8wefwlme2v"] + +[ext_resource type="Script" path="res://addons/block_code/code_generation/block_definition.gd" id="1_pmina"] + +[resource] +script = ExtResource("1_pmina") +name = &"physics_process" +target_node_class = "" +description = "Attached blocks will be executed before each physics step" +category = "Lifecycle" +type = 1 +variant_type = 0 +display_template = "every physics step" +code_template = "func _physics_process(delta):" +defaults = {} +signal_name = "" +scope = "" +is_advanced = true From 7dcd95a35a36301a3cb5769464f2717d930c17e2 Mon Sep 17 00:00:00 2001 From: j30 <46060104+joaquin30@users.noreply.github.com> Date: Mon, 16 Dec 2024 22:58:08 -0500 Subject: [PATCH 06/21] Added collapse/expand blocks to hide advanced settings. This commit modifies the display_template parsing of .tres block definitions, adding a separator using the | character. All labels and parameters after this separator are added to a new CollapsableSettings container that has collapse/expand buttons, with the goal of hiding advanced settings from users. To do this, a new hidden key with a boolean value is added to the results of the parse_display_template method. Additionally, CollapsableSettings is implemented using an HBoxContainer and changing the visibility of child nodes when changing collapse/expand states. Fixes https://github.com/endlessm/godot-block-coding/issues/288. --- .../block_code/blocks/sounds/play_sound.tres | 2 +- .../code_generation/block_definition.gd | 38 ++++++++++++------ .../template_editor/collapsable_settings.gd | 34 ++++++++++++++++ .../template_editor/collapsable_settings.tscn | 25 ++++++++++++ .../utilities/template_editor/minus.png | Bin 0 -> 197 bytes .../template_editor/minus.png.import | 34 ++++++++++++++++ .../blocks/utilities/template_editor/plus.png | Bin 0 -> 206 bytes .../utilities/template_editor/plus.png.import | 34 ++++++++++++++++ .../template_editor/template_editor.gd | 37 +++++++++++------ 9 files changed, 177 insertions(+), 27 deletions(-) create mode 100644 addons/block_code/ui/blocks/utilities/template_editor/collapsable_settings.gd create mode 100644 addons/block_code/ui/blocks/utilities/template_editor/collapsable_settings.tscn create mode 100644 addons/block_code/ui/blocks/utilities/template_editor/minus.png create mode 100644 addons/block_code/ui/blocks/utilities/template_editor/minus.png.import create mode 100644 addons/block_code/ui/blocks/utilities/template_editor/plus.png create mode 100644 addons/block_code/ui/blocks/utilities/template_editor/plus.png.import diff --git a/addons/block_code/blocks/sounds/play_sound.tres b/addons/block_code/blocks/sounds/play_sound.tres index 72840769..06d6a34a 100644 --- a/addons/block_code/blocks/sounds/play_sound.tres +++ b/addons/block_code/blocks/sounds/play_sound.tres @@ -10,7 +10,7 @@ description = "Play the audio stream with volume and pitch" category = "Sounds" type = 2 variant_type = 0 -display_template = "play the sound {name: STRING} with volume {db: FLOAT} dB and pitch scale {pitch: FLOAT}" +display_template = "play the sound {name: STRING} | with volume {db: FLOAT} dB and pitch scale {pitch: FLOAT}" code_template = "var __sound_node = get_node({name}) __sound_node.volume_db = {db} __sound_node.pitch_scale = {pitch} diff --git a/addons/block_code/code_generation/block_definition.gd b/addons/block_code/code_generation/block_definition.gd index b9a72e82..eba8a483 100644 --- a/addons/block_code/code_generation/block_definition.gd +++ b/addons/block_code/code_generation/block_definition.gd @@ -92,19 +92,31 @@ func get_output_parameters() -> Dictionary: static func parse_display_template(template_string: String): var items: Array[Dictionary] - for regex_match in _display_template_regex.search_all(template_string): - if regex_match.names.has("label"): - var label_string := regex_match.get_string("label") - items.append({"label": label_string}) - elif regex_match.names.has("in_parameter"): - var parameter_string := regex_match.get_string("in_parameter") - items.append({"in_parameter": _parse_parameter_format(parameter_string)}) - elif regex_match.names.has("out_parameter"): - var parameter_string := regex_match.get_string("out_parameter") - items.append({"out_parameter": _parse_parameter_format(parameter_string)}) - elif regex_match.names.has("const_parameter"): - var parameter_string := regex_match.get_string("const_parameter") - items.append({"const_parameter": _parse_parameter_format(parameter_string)}) + # Parse the template string. + var parse_template_string = func(template_string: String, hidden: bool): + for regex_match in _display_template_regex.search_all(template_string): + if regex_match.names.has("label"): + var label_string := regex_match.get_string("label") + items.append({"label": label_string, "hidden": hidden}) + elif regex_match.names.has("in_parameter"): + var parameter_string := regex_match.get_string("in_parameter") + items.append({"in_parameter": _parse_parameter_format(parameter_string), "hidden": hidden}) + elif regex_match.names.has("out_parameter"): + var parameter_string := regex_match.get_string("out_parameter") + items.append({"out_parameter": _parse_parameter_format(parameter_string), "hidden": hidden}) + elif regex_match.names.has("const_parameter"): + var parameter_string := regex_match.get_string("const_parameter") + items.append({"const_parameter": _parse_parameter_format(parameter_string), "hidden": hidden}) + # This splits in two the template string in the first "|" character + # to separate normal and hidden parameters. + var sep: int = template_string.find("|") + if sep == -1: + parse_template_string.call(template_string, false) + else: + var template_string_normal := template_string.substr(0, sep).trim_suffix(" ") + var template_string_advanced := template_string.substr(sep + 1) + parse_template_string.call(template_string_normal, false) + parse_template_string.call(template_string_advanced, true) return items diff --git a/addons/block_code/ui/blocks/utilities/template_editor/collapsable_settings.gd b/addons/block_code/ui/blocks/utilities/template_editor/collapsable_settings.gd new file mode 100644 index 00000000..8ea99334 --- /dev/null +++ b/addons/block_code/ui/blocks/utilities/template_editor/collapsable_settings.gd @@ -0,0 +1,34 @@ +@tool +class_name CollapsableSettings +extends HBoxContainer + +@onready var _expand_button: Button = %ExpandSettingsButton +@onready var _collapse_button: Button = %CollapseSettingsButton +var _collapsed := false + + +func _ready() -> void: + _collapse() + move_child(_expand_button, 0) + move_child(_collapse_button, -1) + _expand_button.connect("button_up", _expand) + _collapse_button.connect("button_up", _collapse) + + +func _expand() -> void: + if not _collapsed: + return + for child in get_children(true): + child.visible = true + _expand_button.visible = false + _collapse_button.visible = true + _collapsed = false + + +func _collapse() -> void: + if _collapsed: + return + for child in get_children(true): + child.visible = false + _expand_button.visible = true + _collapsed = true diff --git a/addons/block_code/ui/blocks/utilities/template_editor/collapsable_settings.tscn b/addons/block_code/ui/blocks/utilities/template_editor/collapsable_settings.tscn new file mode 100644 index 00000000..653cc063 --- /dev/null +++ b/addons/block_code/ui/blocks/utilities/template_editor/collapsable_settings.tscn @@ -0,0 +1,25 @@ +[gd_scene load_steps=4 format=3 uid="uid://1xfpd777g8pf"] + +[ext_resource type="Script" path="res://addons/block_code/ui/blocks/utilities/template_editor/collapsable_settings.gd" id="1_f0ssn"] +[ext_resource type="Texture2D" uid="uid://br7yvjjtbuups" path="res://addons/block_code/ui/blocks/utilities/template_editor/plus.png" id="2_8s057"] +[ext_resource type="Texture2D" uid="uid://di3ona3fudjkx" path="res://addons/block_code/ui/blocks/utilities/template_editor/minus.png" id="3_6qcv3"] + +[node name="CollapsableSettings" type="HBoxContainer"] +offset_right = 36.0 +offset_bottom = 31.0 +script = ExtResource("1_f0ssn") + +[node name="ExpandSettingsButton" type="Button" parent="."] +unique_name_in_owner = true +layout_mode = 2 +icon = ExtResource("2_8s057") +flat = true +icon_alignment = 1 + +[node name="CollapseSettingsButton" type="Button" parent="."] +unique_name_in_owner = true +custom_minimum_size = Vector2(20, 20) +layout_mode = 2 +icon = ExtResource("3_6qcv3") +flat = true +icon_alignment = 1 diff --git a/addons/block_code/ui/blocks/utilities/template_editor/minus.png b/addons/block_code/ui/blocks/utilities/template_editor/minus.png new file mode 100644 index 0000000000000000000000000000000000000000..88af774e3a3fa486d8e33ef4c5e3eb913dfc6371 GIT binary patch literal 197 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE;AkEe@ch(+((5Ko~43LM!p{{27w zlG9zcdy!?5kW$YhPKQZhvJ5u8l@BD>O7OFu&JatLsW|c?O7Q<#p~`@JIXYn*nZ8c& z+U22aeo50~lj@o!o44#=`sHqzZ&gRAP2=nhR!!4Bq*(3^^P6VK%+Mwo7Box$shih# v-R$Fc&o7irU-Ieu)=Re8&!p0hU9_-MXo}EVvDq~b=q?6NS3j3^P65c!FX08ZbTnJkGg4KIjGYSw1;d!_4Hox()NSZV3Y@B}V`v>Vtv=Mn$5>xVo9kUh zRYv={f2TaeABvak`>6Eh9N)?7cGDj1PBmm(pi!aZ^@39^GF_+pLyG0TF#lGJ$mvP#qScY25&`aOmufDuD%Z*q2agL0=hd_qrk`3BSKnF5-y85}Sb4q9e E0MH9ci~s-t literal 0 HcmV?d00001 diff --git a/addons/block_code/ui/blocks/utilities/template_editor/plus.png.import b/addons/block_code/ui/blocks/utilities/template_editor/plus.png.import new file mode 100644 index 00000000..446a2f83 --- /dev/null +++ b/addons/block_code/ui/blocks/utilities/template_editor/plus.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://br7yvjjtbuups" +path="res://.godot/imported/plus.png-415014510d01c9db50069dbfc9e6ab6f.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/block_code/ui/blocks/utilities/template_editor/plus.png" +dest_files=["res://.godot/imported/plus.png-415014510d01c9db50069dbfc9e6ab6f.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/addons/block_code/ui/blocks/utilities/template_editor/template_editor.gd b/addons/block_code/ui/blocks/utilities/template_editor/template_editor.gd index 1d22c7bd..6a17ca2f 100644 --- a/addons/block_code/ui/blocks/utilities/template_editor/template_editor.gd +++ b/addons/block_code/ui/blocks/utilities/template_editor/template_editor.gd @@ -12,6 +12,7 @@ const ParameterInput = preload("res://addons/block_code/ui/blocks/utilities/para const ParameterInputScene = preload("res://addons/block_code/ui/blocks/utilities/parameter_input/parameter_input.tscn") const ParameterOutput = preload("res://addons/block_code/ui/blocks/utilities/parameter_output/parameter_output.gd") const ParameterOutputScene = preload("res://addons/block_code/ui/blocks/utilities/parameter_output/parameter_output.tscn") +const CollapsableSettingsScene = preload("res://addons/block_code/ui/blocks/utilities/template_editor/collapsable_settings.tscn") ## A string describing a block's display format. For example: ## [br] @@ -86,27 +87,37 @@ func _update_from_format_string(): _container.remove_child(child) child.queue_free() - var match_id = 0 + var match_id: int = 0 + var is_collapsable := false + var collapsable: CollapsableSettings = CollapsableSettingsScene.instantiate() for item in BlockDefinition.parse_display_template(format_string): + var hidden: bool = item.get("hidden", false) + var container: Container = collapsable if hidden else _container + if hidden: + is_collapsable = true if item.has("label"): - _append_label(item.get("label")) + _append_label(container, item.get("label")) elif item.has("in_parameter"): - _append_input_parameter(item.get("in_parameter"), match_id) + _append_input_parameter(container, item.get("in_parameter"), match_id) elif item.has("out_parameter"): - _append_output_parameter(item.get("out_parameter"), match_id) + _append_output_parameter(container, item.get("out_parameter"), match_id) elif item.has("const_parameter"): - _append_const_parameter(item.get("const_parameter"), match_id) + _append_const_parameter(container, item.get("const_parameter"), match_id) match_id += 1 + if is_collapsable: + _container.add_child(collapsable) + else: + collapsable.queue_free() -func _append_label(label_format: String): +func _append_label(container: Container, label_format: String): var label = Label.new() label.add_theme_color_override("font_color", Color.WHITE) label.text = label_format.strip_edges() - _container.add_child(label) + container.add_child(label) -func _append_input_parameter(parameter: Dictionary, id: int) -> ParameterInput: +func _append_input_parameter(container: Container, parameter: Dictionary, id: int) -> ParameterInput: var default_value = parameter_defaults.get(parameter["name"]) var parameter_input: ParameterInput = ParameterInputScene.instantiate() @@ -125,26 +136,26 @@ func _append_input_parameter(parameter: Dictionary, id: int) -> ParameterInput: parameter_input.modified.connect(func(): modified.emit()) - _container.add_child(parameter_input) + container.add_child(parameter_input) _parameter_inputs_by_name[parameter["name"]] = parameter_input return parameter_input -func _append_output_parameter(parameter: Dictionary, id: int): +func _append_output_parameter(container: Container, parameter: Dictionary, id: int): var parameter_output: ParameterOutput parameter_output = ParameterOutputScene.instantiate() parameter_output.name = "ParameterOutput%d" % id parameter_output.block = parent_block parameter_output.parameter_name = parameter["name"] - _container.add_child(parameter_output) + container.add_child(parameter_output) -func _append_const_parameter(parameter: Dictionary, id: int): +func _append_const_parameter(container: Container, parameter: Dictionary, id: int): # const_parameter is a kind of in_parameter with default value, but never # changes value. - var parameter_const := _append_input_parameter(parameter, id) + var parameter_const := _append_input_parameter(container, parameter, id) parameter_const.visible = false From 5afe404190078a14f9c9039e51c00c13d22167fb Mon Sep 17 00:00:00 2001 From: urbit-pilled Date: Wed, 18 Dec 2024 02:41:04 +1300 Subject: [PATCH 07/21] Added Vector3 Support Vector3 was previously only supported as a getter block, now it also is supported as a setter along with new math blocks and a new vector3 variable block. I made the following changes - adding vector3 to the parameter_input scene - adding vector3 to types.gd - adding vector3 to blocks_catalog.gd and blocks_ast.gd - created new math blocks: vector3_x, vector3_y, vector3_z and vector3_multiply - created new vector3 variable block Fixes #330 --- .../blocks/math/vector3_multiply.tres | 20 +++ addons/block_code/blocks/math/vector3_x.tres | 19 +++ addons/block_code/blocks/math/vector3_y.tres | 19 +++ addons/block_code/blocks/math/vector3_z.tres | 19 +++ .../block_code/blocks/variables/vector3.tres | 21 +++ .../block_code/code_generation/block_ast.gd | 2 + .../code_generation/blocks_catalog.gd | 27 +++- addons/block_code/types/types.gd | 4 + .../parameter_input/parameter_input.gd | 43 ++++++ .../parameter_input/parameter_input.tscn | 137 +++++++++++++++++- 10 files changed, 308 insertions(+), 3 deletions(-) create mode 100644 addons/block_code/blocks/math/vector3_multiply.tres create mode 100644 addons/block_code/blocks/math/vector3_x.tres create mode 100644 addons/block_code/blocks/math/vector3_y.tres create mode 100644 addons/block_code/blocks/math/vector3_z.tres create mode 100644 addons/block_code/blocks/variables/vector3.tres diff --git a/addons/block_code/blocks/math/vector3_multiply.tres b/addons/block_code/blocks/math/vector3_multiply.tres new file mode 100644 index 00000000..7ec43ac8 --- /dev/null +++ b/addons/block_code/blocks/math/vector3_multiply.tres @@ -0,0 +1,20 @@ +[gd_resource type="Resource" load_steps=2 format=3 uid="uid://bff7cwmpisihj"] + +[ext_resource type="Script" path="res://addons/block_code/code_generation/block_definition.gd" id="1_52jwf"] + +[resource] +script = ExtResource("1_52jwf") +name = &"vector3_multiply" +target_node_class = "" +description = "Multiplies a Vector3 with a number. Use this, for example, to get a point some distance away along an angle." +category = "Math" +type = 3 +variant_type = 9 +display_template = "multiply {vector: VECTOR3} by {number: FLOAT}" +code_template = "{vector} * {number}" +defaults = { +"number": 1.0, +"vector": Vector3(1, 1, 1) +} +signal_name = "" +scope = "" diff --git a/addons/block_code/blocks/math/vector3_x.tres b/addons/block_code/blocks/math/vector3_x.tres new file mode 100644 index 00000000..3a4f4c76 --- /dev/null +++ b/addons/block_code/blocks/math/vector3_x.tres @@ -0,0 +1,19 @@ +[gd_resource type="Resource" load_steps=2 format=3 uid="uid://cehtd3jqu5es2"] + +[ext_resource type="Script" path="res://addons/block_code/code_generation/block_definition.gd" id="1_p3bft"] + +[resource] +script = ExtResource("1_p3bft") +name = &"vector3_x" +target_node_class = "" +description = "Gives the x of a [i]Vector3[/i]" +category = "Math" +type = 3 +variant_type = 3 +display_template = "x of {vector3: VECTOR3}" +code_template = "{vector3}.x" +defaults = { +"vector3": Vector3(0, 0, 0) +} +signal_name = "" +scope = "" diff --git a/addons/block_code/blocks/math/vector3_y.tres b/addons/block_code/blocks/math/vector3_y.tres new file mode 100644 index 00000000..31702319 --- /dev/null +++ b/addons/block_code/blocks/math/vector3_y.tres @@ -0,0 +1,19 @@ +[gd_resource type="Resource" load_steps=2 format=3 uid="uid://cehtd3jqu5es2"] + +[ext_resource type="Script" path="res://addons/block_code/code_generation/block_definition.gd" id="1_p3bft"] + +[resource] +script = ExtResource("1_p3bft") +name = &"vector3_y" +target_node_class = "" +description = "Gives the y of a [i]Vector3[/i]" +category = "Math" +type = 3 +variant_type = 3 +display_template = "y of {vector3: VECTOR3}" +code_template = "{vector3}.y" +defaults = { +"vector3": Vector3(0, 0, 0) +} +signal_name = "" +scope = "" diff --git a/addons/block_code/blocks/math/vector3_z.tres b/addons/block_code/blocks/math/vector3_z.tres new file mode 100644 index 00000000..b1b29b84 --- /dev/null +++ b/addons/block_code/blocks/math/vector3_z.tres @@ -0,0 +1,19 @@ +[gd_resource type="Resource" load_steps=2 format=3 uid="uid://cehtd3jqu5es2"] + +[ext_resource type="Script" path="res://addons/block_code/code_generation/block_definition.gd" id="1_p3bft"] + +[resource] +script = ExtResource("1_p3bft") +name = &"vector3_z" +target_node_class = "" +description = "Gives the z of a [i]Vector3[/i]" +category = "Math" +type = 3 +variant_type = 3 +display_template = "z of {vector3: VECTOR3}" +code_template = "{vector3}.z" +defaults = { +"vector3": Vector3(0, 0, 0) +} +signal_name = "" +scope = "" diff --git a/addons/block_code/blocks/variables/vector3.tres b/addons/block_code/blocks/variables/vector3.tres new file mode 100644 index 00000000..ac239691 --- /dev/null +++ b/addons/block_code/blocks/variables/vector3.tres @@ -0,0 +1,21 @@ +[gd_resource type="Resource" load_steps=2 format=3 uid="uid://ddj24k1fp0s82"] + +[ext_resource type="Script" path="res://addons/block_code/code_generation/block_definition.gd" id="1_ilw3v"] + +[resource] +script = ExtResource("1_ilw3v") +name = &"vector3" +target_node_class = "" +description = "" +category = "Math" +type = 3 +variant_type = 9 +display_template = "vector3 x: {x: FLOAT} y: {y: FLOAT}: z: {z: FLOAT}" +code_template = "Vector3({x}, {y}, {z})" +defaults = { +"x": 0.0, +"y": 0.0, +"z": 0.0 +} +signal_name = "" +scope = "" diff --git a/addons/block_code/code_generation/block_ast.gd b/addons/block_code/code_generation/block_ast.gd index a90657e2..865e3047 100644 --- a/addons/block_code/code_generation/block_ast.gd +++ b/addons/block_code/code_generation/block_ast.gd @@ -131,6 +131,8 @@ static func raw_input_to_code_string(input) -> String: return "'%s'" % input.c_escape() TYPE_VECTOR2: return "Vector2%s" % str(input) + TYPE_VECTOR3: + return "Vector3%s" % str(input) TYPE_COLOR: return "Color%s" % str(input) _: diff --git a/addons/block_code/code_generation/blocks_catalog.gd b/addons/block_code/code_generation/blocks_catalog.gd index 04aebdb2..2009112f 100644 --- a/addons/block_code/code_generation/blocks_catalog.gd +++ b/addons/block_code/code_generation/blocks_catalog.gd @@ -12,6 +12,7 @@ const _FALLBACK_SET_FOR_TYPE = { TYPE_INT: 0, TYPE_FLOAT: 0.0, TYPE_VECTOR2: Vector2(0, 0), + TYPE_VECTOR3: Vector3(0, 0, 0), TYPE_COLOR: Color.DARK_ORANGE, } @@ -20,6 +21,7 @@ const _FALLBACK_CHANGE_FOR_TYPE = { TYPE_INT: 1, TYPE_FLOAT: 1.0, TYPE_VECTOR2: Vector2(1, 1), + TYPE_VECTOR3: Vector3(1, 1, 1), TYPE_COLOR: Color.DARK_ORANGE, } @@ -45,6 +47,27 @@ const _SETTINGS_FOR_CLASS_PROPERTY = { "default_change": Vector2(0.1, 0.1), }, }, + "Node3D": + { + "position": + { + "category": "Transform | Position", + "default_set": Vector3(0, 0, 0), + "default_change": Vector3(0.1, 0.1, 0.1), + }, + "rotation": + { + "category": "Transform | Rotation", + "default_set": Vector3(0, 0, 0), + "default_change": Vector3(0.1, 0.1, 0.1), + }, + "scale": + { + "category": "Transform | Scale", + "default_set": Vector3(1, 1, 1), + "default_change": Vector3(0.1, 0.1, 0.1), + } + }, "CanvasItem": { "modulate": @@ -280,13 +303,13 @@ static func get_variable_getter_block_definition(variable: VariableDefinition) - static func get_variable_setter_block_definition(variable: VariableDefinition) -> BlockDefinition: - var type_string: String = Types.VARIANT_TYPE_TO_STRING[variable.var_type] + var _type_string: String = Types.VARIANT_TYPE_TO_STRING[variable.var_type] var block_def := BlockDefinition.new() block_def.name = "set_var_%s" % variable.var_name block_def.category = "Variables" block_def.type = Types.BlockType.STATEMENT - block_def.display_template = "Set %s to {value: %s}" % [variable.var_name, type_string] + block_def.display_template = "Set %s to {value: %s}" % [variable.var_name, _type_string] block_def.code_template = "%s = {value}" % variable.var_name return block_def diff --git a/addons/block_code/types/types.gd b/addons/block_code/types/types.gd index 4a7de445..e1768560 100644 --- a/addons/block_code/types/types.gd +++ b/addons/block_code/types/types.gd @@ -14,6 +14,7 @@ const VARIANT_TYPE_TO_STRING: Dictionary = { TYPE_FLOAT: "FLOAT", TYPE_BOOL: "BOOL", TYPE_VECTOR2: "VECTOR2", + TYPE_VECTOR3: "VECTOR3", TYPE_COLOR: "COLOR", TYPE_NODE_PATH: "NODE_PATH", TYPE_OBJECT: "OBJECT", @@ -27,6 +28,7 @@ const STRING_TO_VARIANT_TYPE: Dictionary = { "FLOAT": TYPE_FLOAT, "BOOL": TYPE_BOOL, "VECTOR2": TYPE_VECTOR2, + "VECTOR3": TYPE_VECTOR3, "COLOR": TYPE_COLOR, "NODE_PATH": TYPE_NODE_PATH, "OBJECT": TYPE_OBJECT, @@ -42,6 +44,8 @@ const cast_relationships = [ [TYPE_COLOR, TYPE_STRING, "str(%s)"], [TYPE_VECTOR2, TYPE_STRING, "str(%s)"], [TYPE_VECTOR2, TYPE_BOOL, "%s"], + [TYPE_VECTOR3, TYPE_STRING, "str(%s)"], + [TYPE_VECTOR3, TYPE_BOOL, "%s"], ] # Directed graph, edges are CastGraphEdge diff --git a/addons/block_code/ui/blocks/utilities/parameter_input/parameter_input.gd b/addons/block_code/ui/blocks/utilities/parameter_input/parameter_input.gd index 4c9d9d41..46de1795 100644 --- a/addons/block_code/ui/blocks/utilities/parameter_input/parameter_input.gd +++ b/addons/block_code/ui/blocks/utilities/parameter_input/parameter_input.gd @@ -37,6 +37,11 @@ var _drag_start: Vector2 = Vector2.INF @onready var _vector2_input := %Vector2Input @onready var _x_line_edit := %XLineEdit @onready var _y_line_edit := %YLineEdit +# Vector3 +@onready var _vector3_input := %Vector3Input +@onready var _v3_x_line_edit := %V3XLineEdit +@onready var _v3_y_line_edit := %V3YLineEdit +@onready var _v3_z_line_edit := %V3ZLineEdit # Bool @onready var _bool_input := %BoolInput @onready var _bool_input_option := %BoolInputOption @@ -46,6 +51,9 @@ var _drag_start: Vector2 = Vector2.INF _line_edit: "", _x_line_edit: "", _y_line_edit: "", + _v3_x_line_edit: "", + _v3_y_line_edit: "", + _v3_z_line_edit: "", } @@ -73,6 +81,10 @@ func set_raw_input(raw_input: Variant): # Rounding because floats are doubles by default but Vector2s have single components _x_line_edit.text = ("%.4f" % raw_input.x).rstrip("0").rstrip(".") if raw_input != null else "" _y_line_edit.text = ("%.4f" % raw_input.y).rstrip("0").rstrip(".") if raw_input != null else "" + TYPE_VECTOR3: + _v3_x_line_edit.text = ("%.4f" % raw_input.x).rstrip("0").rstrip(".") if raw_input != null else "" + _v3_y_line_edit.text = ("%.4f" % raw_input.y).rstrip("0").rstrip(".") if raw_input != null else "" + _v3_z_line_edit.text = ("%.4f" % raw_input.z).rstrip("0").rstrip(".") if raw_input != null else "" TYPE_BOOL: _bool_input_option.select(1 if raw_input else 0) TYPE_NIL: @@ -83,6 +95,9 @@ func set_raw_input(raw_input: Variant): _last_submitted_text[_line_edit] = _line_edit.text _last_submitted_text[_x_line_edit] = _x_line_edit.text _last_submitted_text[_y_line_edit] = _y_line_edit.text + _last_submitted_text[_v3_x_line_edit] = _v3_x_line_edit.text + _last_submitted_text[_v3_y_line_edit] = _v3_y_line_edit.text + _last_submitted_text[_v3_z_line_edit] = _v3_z_line_edit.text ## Gets the value, which could be one of a variety of types depending on @@ -102,6 +117,8 @@ func get_raw_input() -> Variant: return _color_input.color TYPE_VECTOR2: return Vector2(float(_x_line_edit.text), float(_y_line_edit.text)) + TYPE_VECTOR3: + return Vector3(float(_v3_x_line_edit.text), float(_v3_y_line_edit.text), float(_v3_z_line_edit.text)) TYPE_BOOL: return bool(_bool_input_option.selected) TYPE_INT: @@ -203,6 +220,30 @@ func _on_y_line_edit_focus_exited(): _validate_and_submit_edit_text(_y_line_edit, TYPE_FLOAT) +func _on_v3_x_line_edit_text_submitted(_new_text): + _validate_and_submit_edit_text(_v3_x_line_edit, TYPE_FLOAT) + + +func _on_v3_x_line_edit_focus_exited(): + _validate_and_submit_edit_text(_v3_x_line_edit, TYPE_FLOAT) + + +func _on_v3_y_line_edit_text_submitted(_new_text): + _validate_and_submit_edit_text(_v3_y_line_edit, TYPE_FLOAT) + + +func _on_v3_y_line_edit_focus_exited(): + _validate_and_submit_edit_text(_v3_y_line_edit, TYPE_FLOAT) + + +func _on_v3_z_line_edit_text_submitted(_new_text): + _validate_and_submit_edit_text(_v3_z_line_edit, TYPE_FLOAT) + + +func _on_v3_z_line_edit_focus_exited(): + _validate_and_submit_edit_text(_v3_z_line_edit, TYPE_FLOAT) + + func _update_visible_input(): if snap_point.has_snapped_block(): _switch_input(null) @@ -214,6 +255,8 @@ func _update_visible_input(): _switch_input(_color_input) TYPE_VECTOR2: _switch_input(_vector2_input) + TYPE_VECTOR3: + _switch_input(_vector3_input) TYPE_BOOL: _switch_input(_bool_input) _: diff --git a/addons/block_code/ui/blocks/utilities/parameter_input/parameter_input.tscn b/addons/block_code/ui/blocks/utilities/parameter_input/parameter_input.tscn index c4949f7b..7add975d 100644 --- a/addons/block_code/ui/blocks/utilities/parameter_input/parameter_input.tscn +++ b/addons/block_code/ui/blocks/utilities/parameter_input/parameter_input.tscn @@ -39,6 +39,7 @@ script = ExtResource("1_rgmxn") unique_name_in_owner = true layout_mode = 2 script = ExtResource("2_68spp") +color = Color(1, 1, 1, 1) block_type = 3 [node name="InputSwitcher" type="MarginContainer" parent="."] @@ -220,7 +221,6 @@ action_mode = 1 selected = 0 item_count = 2 popup/item_0/text = "false" -popup/item_0/id = 0 popup/item_1/text = "true" popup/item_1/id = 1 @@ -228,6 +228,130 @@ popup/item_1/id = 1 layout_mode = 1 drag_outside = true +[node name="Vector3Input" type="MarginContainer" parent="InputSwitcher"] +unique_name_in_owner = true +visible = false +layout_mode = 2 +theme_override_constants/margin_left = 8 +theme_override_constants/margin_top = 4 +theme_override_constants/margin_right = 8 +theme_override_constants/margin_bottom = 4 + +[node name="HBoxContainer" type="HBoxContainer" parent="InputSwitcher/Vector3Input"] +layout_mode = 2 + +[node name="Control" type="Control" parent="InputSwitcher/Vector3Input/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="V3XLineEdit" type="LineEdit" parent="InputSwitcher/Vector3Input/HBoxContainer"] +unique_name_in_owner = true +auto_translate_mode = 2 +layout_mode = 2 +mouse_filter = 1 +theme_override_colors/font_placeholder_color = Color(0.76662, 0.76662, 0.76662, 1) +theme_override_colors/font_uneditable_color = Color(0.117647, 0.117647, 0.117647, 1) +theme_override_colors/font_color = Color(0.118581, 0.118581, 0.118581, 1) +theme_override_constants/minimum_character_width = 0 +theme_override_styles/focus = SubResource("StyleBoxEmpty_afyv2") +theme_override_styles/read_only = SubResource("StyleBoxEmpty_3r4mt") +theme_override_styles/normal = SubResource("StyleBoxEmpty_6oowp") +placeholder_text = "x" +alignment = 1 +expand_to_text_length = true + +[node name="DragDropArea" parent="InputSwitcher/Vector3Input/HBoxContainer/V3XLineEdit" instance=ExtResource("2_05gck")] +layout_mode = 1 +drag_outside = true + +[node name="Control3" type="Control" parent="InputSwitcher/Vector3Input/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="CenterContainer" type="MarginContainer" parent="InputSwitcher/Vector3Input/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="ColorRect" type="ColorRect" parent="InputSwitcher/Vector3Input/HBoxContainer/CenterContainer"] +custom_minimum_size = Vector2(2, 0) +layout_mode = 2 +size_flags_horizontal = 4 +color = Color(0.804743, 0.804743, 0.804743, 1) + +[node name="DragDropArea" parent="InputSwitcher/Vector3Input/HBoxContainer/CenterContainer/ColorRect" instance=ExtResource("2_05gck")] +layout_mode = 1 +drag_outside = true + +[node name="Control4" type="Control" parent="InputSwitcher/Vector3Input/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="V3YLineEdit" type="LineEdit" parent="InputSwitcher/Vector3Input/HBoxContainer"] +unique_name_in_owner = true +auto_translate_mode = 2 +layout_mode = 2 +mouse_filter = 1 +theme_override_colors/font_placeholder_color = Color(0.76662, 0.76662, 0.76662, 1) +theme_override_colors/font_uneditable_color = Color(0.117647, 0.117647, 0.117647, 1) +theme_override_colors/font_color = Color(0.118581, 0.118581, 0.118581, 1) +theme_override_constants/minimum_character_width = 0 +theme_override_styles/focus = SubResource("StyleBoxEmpty_afyv2") +theme_override_styles/read_only = SubResource("StyleBoxEmpty_3r4mt") +theme_override_styles/normal = SubResource("StyleBoxEmpty_6oowp") +placeholder_text = "y" +alignment = 1 +expand_to_text_length = true + +[node name="DragDropArea" parent="InputSwitcher/Vector3Input/HBoxContainer/V3YLineEdit" instance=ExtResource("2_05gck")] +layout_mode = 1 +drag_outside = true + +[node name="Control2" type="Control" parent="InputSwitcher/Vector3Input/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="CenterContainer2" type="MarginContainer" parent="InputSwitcher/Vector3Input/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="ColorRect" type="ColorRect" parent="InputSwitcher/Vector3Input/HBoxContainer/CenterContainer2"] +custom_minimum_size = Vector2(2, 0) +layout_mode = 2 +size_flags_horizontal = 4 +color = Color(0.804743, 0.804743, 0.804743, 1) + +[node name="DragDropArea" parent="InputSwitcher/Vector3Input/HBoxContainer/CenterContainer2/ColorRect" instance=ExtResource("2_05gck")] +layout_mode = 1 +drag_outside = true + +[node name="Control5" type="Control" parent="InputSwitcher/Vector3Input/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="V3ZLineEdit" type="LineEdit" parent="InputSwitcher/Vector3Input/HBoxContainer"] +unique_name_in_owner = true +auto_translate_mode = 2 +layout_mode = 2 +mouse_filter = 1 +theme_override_colors/font_placeholder_color = Color(0.76662, 0.76662, 0.76662, 1) +theme_override_colors/font_uneditable_color = Color(0.117647, 0.117647, 0.117647, 1) +theme_override_colors/font_color = Color(0.118581, 0.118581, 0.118581, 1) +theme_override_constants/minimum_character_width = 0 +theme_override_styles/focus = SubResource("StyleBoxEmpty_afyv2") +theme_override_styles/read_only = SubResource("StyleBoxEmpty_3r4mt") +theme_override_styles/normal = SubResource("StyleBoxEmpty_6oowp") +placeholder_text = "z" +alignment = 1 +expand_to_text_length = true + +[node name="DragDropArea" parent="InputSwitcher/Vector3Input/HBoxContainer/V3ZLineEdit" instance=ExtResource("2_05gck")] +layout_mode = 1 +drag_outside = true + +[node name="Control6" type="Control" parent="InputSwitcher/Vector3Input/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 + [node name="SnapPoint" parent="." instance=ExtResource("2_6esp3")] unique_name_in_owner = true layout_mode = 2 @@ -250,4 +374,15 @@ variant_type = 4 [connection signal="drag_started" from="InputSwitcher/Vector2Input/HBoxContainer/YLineEdit/DragDropArea" to="." method="_on_drag_drop_area_drag_started"] [connection signal="item_selected" from="InputSwitcher/BoolInput/BoolInputOption" to="." method="_on_option_input_item_selected"] [connection signal="drag_started" from="InputSwitcher/BoolInput/BoolInputOption/DragDropArea" to="." method="_on_drag_drop_area_drag_started"] +[connection signal="focus_exited" from="InputSwitcher/Vector3Input/HBoxContainer/V3XLineEdit" to="." method="_on_v3_x_line_edit_focus_exited"] +[connection signal="text_submitted" from="InputSwitcher/Vector3Input/HBoxContainer/V3XLineEdit" to="." method="_on_v3_x_line_edit_text_submitted"] +[connection signal="drag_started" from="InputSwitcher/Vector3Input/HBoxContainer/V3XLineEdit/DragDropArea" to="." method="_on_drag_drop_area_drag_started"] +[connection signal="drag_started" from="InputSwitcher/Vector3Input/HBoxContainer/CenterContainer/ColorRect/DragDropArea" to="." method="_on_drag_drop_area_drag_started"] +[connection signal="focus_exited" from="InputSwitcher/Vector3Input/HBoxContainer/V3YLineEdit" to="." method="_on_v3_y_line_edit_focus_exited"] +[connection signal="text_submitted" from="InputSwitcher/Vector3Input/HBoxContainer/V3YLineEdit" to="." method="_on_v3_y_line_edit_text_submitted"] +[connection signal="drag_started" from="InputSwitcher/Vector3Input/HBoxContainer/V3YLineEdit/DragDropArea" to="." method="_on_drag_drop_area_drag_started"] +[connection signal="drag_started" from="InputSwitcher/Vector3Input/HBoxContainer/CenterContainer2/ColorRect/DragDropArea" to="." method="_on_drag_drop_area_drag_started"] +[connection signal="focus_exited" from="InputSwitcher/Vector3Input/HBoxContainer/V3ZLineEdit" to="." method="_on_v3_z_line_edit_focus_exited"] +[connection signal="text_submitted" from="InputSwitcher/Vector3Input/HBoxContainer/V3ZLineEdit" to="." method="_on_v3_z_line_edit_text_submitted"] +[connection signal="drag_started" from="InputSwitcher/Vector3Input/HBoxContainer/V3ZLineEdit/DragDropArea" to="." method="_on_drag_drop_area_drag_started"] [connection signal="snapped_block_changed" from="SnapPoint" to="." method="_on_snap_point_snapped_block_changed"] From 00c0317ca2226978235b54f95e4d5384428598c1 Mon Sep 17 00:00:00 2001 From: j30 <46060104+joaquin30@users.noreply.github.com> Date: Tue, 17 Dec 2024 10:55:37 -0500 Subject: [PATCH 08/21] Improved resolution of collapse/expand icon and added | separator on animationplayer_play. This commit adds SVG icons to collapse/expand and modifies the template string of animationplayer_play.tres to hide advanced settings. Fixes https://github.com/endlessm/godot-block-coding/issues/288. --- .../blocks/graphics/animationplayer_play.tres | 2 +- .../template_editor/collapsable_settings.tscn | 8 +-- .../utilities/template_editor/minus.png | Bin 197 -> 0 bytes .../utilities/template_editor/minus.svg | 56 ++++++++++++++++ .../{plus.png.import => minus.svg.import} | 11 +-- .../blocks/utilities/template_editor/plus.png | Bin 206 -> 0 bytes .../blocks/utilities/template_editor/plus.svg | 63 ++++++++++++++++++ .../{minus.png.import => plus.svg.import} | 11 +-- 8 files changed, 138 insertions(+), 13 deletions(-) delete mode 100644 addons/block_code/ui/blocks/utilities/template_editor/minus.png create mode 100644 addons/block_code/ui/blocks/utilities/template_editor/minus.svg rename addons/block_code/ui/blocks/utilities/template_editor/{plus.png.import => minus.svg.import} (66%) delete mode 100644 addons/block_code/ui/blocks/utilities/template_editor/plus.png create mode 100644 addons/block_code/ui/blocks/utilities/template_editor/plus.svg rename addons/block_code/ui/blocks/utilities/template_editor/{minus.png.import => plus.svg.import} (66%) diff --git a/addons/block_code/blocks/graphics/animationplayer_play.tres b/addons/block_code/blocks/graphics/animationplayer_play.tres index 3a593f83..6e8cefdc 100644 --- a/addons/block_code/blocks/graphics/animationplayer_play.tres +++ b/addons/block_code/blocks/graphics/animationplayer_play.tres @@ -27,7 +27,7 @@ description = "Play the animation." category = "Graphics | Animation" type = 2 variant_type = 0 -display_template = "play {animation: STRING} {direction: NIL} {wait_mode: NIL}" +display_template = "play {animation: STRING} | {direction: NIL} {wait_mode: NIL}" code_template = "if {direction} == \"forward\": play({animation}) else: diff --git a/addons/block_code/ui/blocks/utilities/template_editor/collapsable_settings.tscn b/addons/block_code/ui/blocks/utilities/template_editor/collapsable_settings.tscn index 653cc063..9d198c6f 100644 --- a/addons/block_code/ui/blocks/utilities/template_editor/collapsable_settings.tscn +++ b/addons/block_code/ui/blocks/utilities/template_editor/collapsable_settings.tscn @@ -1,8 +1,8 @@ [gd_scene load_steps=4 format=3 uid="uid://1xfpd777g8pf"] [ext_resource type="Script" path="res://addons/block_code/ui/blocks/utilities/template_editor/collapsable_settings.gd" id="1_f0ssn"] -[ext_resource type="Texture2D" uid="uid://br7yvjjtbuups" path="res://addons/block_code/ui/blocks/utilities/template_editor/plus.png" id="2_8s057"] -[ext_resource type="Texture2D" uid="uid://di3ona3fudjkx" path="res://addons/block_code/ui/blocks/utilities/template_editor/minus.png" id="3_6qcv3"] +[ext_resource type="Texture2D" uid="uid://cd243la33evh" path="res://addons/block_code/ui/blocks/utilities/template_editor/plus.svg" id="2_mp58d"] +[ext_resource type="Texture2D" uid="uid://dmplpvmlpcdrk" path="res://addons/block_code/ui/blocks/utilities/template_editor/minus.svg" id="3_adq5s"] [node name="CollapsableSettings" type="HBoxContainer"] offset_right = 36.0 @@ -12,7 +12,7 @@ script = ExtResource("1_f0ssn") [node name="ExpandSettingsButton" type="Button" parent="."] unique_name_in_owner = true layout_mode = 2 -icon = ExtResource("2_8s057") +icon = ExtResource("2_mp58d") flat = true icon_alignment = 1 @@ -20,6 +20,6 @@ icon_alignment = 1 unique_name_in_owner = true custom_minimum_size = Vector2(20, 20) layout_mode = 2 -icon = ExtResource("3_6qcv3") +icon = ExtResource("3_adq5s") flat = true icon_alignment = 1 diff --git a/addons/block_code/ui/blocks/utilities/template_editor/minus.png b/addons/block_code/ui/blocks/utilities/template_editor/minus.png deleted file mode 100644 index 88af774e3a3fa486d8e33ef4c5e3eb913dfc6371..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 197 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE;AkEe@ch(+((5Ko~43LM!p{{27w zlG9zcdy!?5kW$YhPKQZhvJ5u8l@BD>O7OFu&JatLsW|c?O7Q<#p~`@JIXYn*nZ8c& z+U22aeo50~lj@o!o44#=`sHqzZ&gRAP2=nhR!!4Bq*(3^^P6VK%+Mwo7Box$shih# v-R$Fc&o7irU-Ieu)=Re8&!p0hU9_-MXo}EVvDq~b=q?6NS3j3^P6 + + + + + + + + + + diff --git a/addons/block_code/ui/blocks/utilities/template_editor/plus.png.import b/addons/block_code/ui/blocks/utilities/template_editor/minus.svg.import similarity index 66% rename from addons/block_code/ui/blocks/utilities/template_editor/plus.png.import rename to addons/block_code/ui/blocks/utilities/template_editor/minus.svg.import index 446a2f83..0f5418dc 100644 --- a/addons/block_code/ui/blocks/utilities/template_editor/plus.png.import +++ b/addons/block_code/ui/blocks/utilities/template_editor/minus.svg.import @@ -2,16 +2,16 @@ importer="texture" type="CompressedTexture2D" -uid="uid://br7yvjjtbuups" -path="res://.godot/imported/plus.png-415014510d01c9db50069dbfc9e6ab6f.ctex" +uid="uid://dmplpvmlpcdrk" +path="res://.godot/imported/minus.svg-91b3ae6e73af60de8d208e1e34387d89.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://addons/block_code/ui/blocks/utilities/template_editor/plus.png" -dest_files=["res://.godot/imported/plus.png-415014510d01c9db50069dbfc9e6ab6f.ctex"] +source_file="res://addons/block_code/ui/blocks/utilities/template_editor/minus.svg" +dest_files=["res://.godot/imported/minus.svg-91b3ae6e73af60de8d208e1e34387d89.ctex"] [params] @@ -32,3 +32,6 @@ process/hdr_as_srgb=false process/hdr_clamp_exposure=false process/size_limit=0 detect_3d/compress_to=1 +svg/scale=1.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/addons/block_code/ui/blocks/utilities/template_editor/plus.png b/addons/block_code/ui/blocks/utilities/template_editor/plus.png deleted file mode 100644 index 8f17cccecdf6f8529a42b67bc8f4c31c470bb387..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 206 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE5c!FX08ZbTnJkGg4KIjGYSw1;d!_4Hox()NSZV3Y@B}V`v>Vtv=Mn$5>xVo9kUh zRYv={f2TaeABvak`>6Eh9N)?7cGDj1PBmm(pi!aZ^@39^GF_+pLyG0TF#lGJ$mvP#qScY25&`aOmufDuD%Z*q2agL0=hd_qrk`3BSKnF5-y85}Sb4q9e E0MH9ci~s-t diff --git a/addons/block_code/ui/blocks/utilities/template_editor/plus.svg b/addons/block_code/ui/blocks/utilities/template_editor/plus.svg new file mode 100644 index 00000000..62f6fb2b --- /dev/null +++ b/addons/block_code/ui/blocks/utilities/template_editor/plus.svg @@ -0,0 +1,63 @@ + + + + + + + + + + + + diff --git a/addons/block_code/ui/blocks/utilities/template_editor/minus.png.import b/addons/block_code/ui/blocks/utilities/template_editor/plus.svg.import similarity index 66% rename from addons/block_code/ui/blocks/utilities/template_editor/minus.png.import rename to addons/block_code/ui/blocks/utilities/template_editor/plus.svg.import index cbc94bf0..c70b64f2 100644 --- a/addons/block_code/ui/blocks/utilities/template_editor/minus.png.import +++ b/addons/block_code/ui/blocks/utilities/template_editor/plus.svg.import @@ -2,16 +2,16 @@ importer="texture" type="CompressedTexture2D" -uid="uid://di3ona3fudjkx" -path="res://.godot/imported/minus.png-7cbe293178ea19d9e5fbc8ba50c3a01b.ctex" +uid="uid://cd243la33evh" +path="res://.godot/imported/plus.svg-ca1f07941354f8a370925e9c4f909843.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://addons/block_code/ui/blocks/utilities/template_editor/minus.png" -dest_files=["res://.godot/imported/minus.png-7cbe293178ea19d9e5fbc8ba50c3a01b.ctex"] +source_file="res://addons/block_code/ui/blocks/utilities/template_editor/plus.svg" +dest_files=["res://.godot/imported/plus.svg-ca1f07941354f8a370925e9c4f909843.ctex"] [params] @@ -32,3 +32,6 @@ process/hdr_as_srgb=false process/hdr_clamp_exposure=false process/size_limit=0 detect_3d/compress_to=1 +svg/scale=1.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false From 554123123bcdd91504fa3df873e03fb965ee75d9 Mon Sep 17 00:00:00 2001 From: urbit-pilled Date: Mon, 16 Dec 2024 22:31:29 +1300 Subject: [PATCH 09/21] SimpleCharacter: Use input map for keyboard input Previously, keypresses were detected directly, rather than going through the input map. In preparation for handling multiple input devices for each action, add appropriate entries to the input map at runtime, if not already present. Map each one to the same key as previously. --- .../simple_character/simple_character.gd | 36 +++++++++++-------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/addons/block_code/simple_nodes/simple_character/simple_character.gd b/addons/block_code/simple_nodes/simple_character/simple_character.gd index 7f3982a7..9787fd2c 100644 --- a/addons/block_code/simple_nodes/simple_character/simple_character.gd +++ b/addons/block_code/simple_nodes/simple_character/simple_character.gd @@ -14,22 +14,20 @@ const Types = preload("res://addons/block_code/types/types.gd") @export var speed: Vector2 = Vector2(300, 300) -const PLAYER_KEYS = { - "player_1": +const PLAYER_KEYS = [ { "up": KEY_W, "down": KEY_S, "left": KEY_A, "right": KEY_D, }, - "player_2": { "up": KEY_UP, "down": KEY_DOWN, "left": KEY_LEFT, "right": KEY_RIGHT, } -} +] var sprite: Sprite2D var collision: CollisionShape2D @@ -83,24 +81,32 @@ func _ready(): func simple_setup(): add_to_group("affected_by_gravity", true) + _setup_actions() _texture_updated() -func get_custom_class(): - return "SimpleCharacter" +func _setup_actions(): + if Engine.is_editor_hint() or InputMap.has_action("player_1_left"): + return + + for i in PLAYER_KEYS.size(): + for action in PLAYER_KEYS[i]: + var player = "player_%d" % [i + 1] + var action_name = player + "_" + action + InputMap.add_action(action_name) + #keyboard event + var e = InputEventKey.new() + e.physical_keycode = PLAYER_KEYS[i][action] + InputMap.action_add_event(action_name, e) -func _player_input_to_direction(player: String): - var direction = Vector2() - direction.x += float(Input.is_physical_key_pressed(PLAYER_KEYS[player]["right"])) - direction.x -= float(Input.is_physical_key_pressed(PLAYER_KEYS[player]["left"])) - direction.y += float(Input.is_physical_key_pressed(PLAYER_KEYS[player]["down"])) - direction.y -= float(Input.is_physical_key_pressed(PLAYER_KEYS[player]["up"])) - return direction + +func get_custom_class(): + return "SimpleCharacter" func move_with_player_buttons(player: String, kind: String, delta: float): - var direction = _player_input_to_direction(player) + var direction = Input.get_vector(player + "_left", player + "_right", player + "_up", player + "_down") direction_x = direction.x if kind == "top-down": @@ -111,7 +117,7 @@ func move_with_player_buttons(player: String, kind: String, delta: float): if not is_on_floor(): velocity.y += gravity * delta else: - if not _jumping and Input.is_physical_key_pressed(PLAYER_KEYS[player]["up"]): + if not _jumping and direction.y < 0: _jumping = true velocity.y -= speed.y else: From 34301a18df9974da9ac1671ea1bd950f9aba78d6 Mon Sep 17 00:00:00 2001 From: urbit-pilled Date: Mon, 16 Dec 2024 22:31:29 +1300 Subject: [PATCH 10/21] SimpleCharacter: Add controller support Map the d-pad and left stick of controllers 0 and 1 to the directional actions of players 1 and 2, respectively, in addition to the keyboard mappings. Fixes: https://github.com/endlessm/godot-block-coding/issues/257 --- .../simple_character/simple_character.gd | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/addons/block_code/simple_nodes/simple_character/simple_character.gd b/addons/block_code/simple_nodes/simple_character/simple_character.gd index 9787fd2c..674095f2 100644 --- a/addons/block_code/simple_nodes/simple_character/simple_character.gd +++ b/addons/block_code/simple_nodes/simple_character/simple_character.gd @@ -29,6 +29,36 @@ const PLAYER_KEYS = [ } ] +const PLAYER_JOYSTICK_BUTTONS = { + "up": JOY_BUTTON_DPAD_UP, + "down": JOY_BUTTON_DPAD_DOWN, + "left": JOY_BUTTON_DPAD_LEFT, + "right": JOY_BUTTON_DPAD_RIGHT, +} + +const PLAYER_JOYSTICK_MOTION = { + "up": + { + "axis": JOY_AXIS_LEFT_Y, + "axis_value": -1, + }, + "down": + { + "axis": JOY_AXIS_LEFT_Y, + "axis_value": 1, + }, + "left": + { + "axis": JOY_AXIS_LEFT_X, + "axis_value": -1, + }, + "right": + { + "axis": JOY_AXIS_LEFT_X, + "axis_value": 1, + }, +} + var sprite: Sprite2D var collision: CollisionShape2D @@ -100,6 +130,19 @@ func _setup_actions(): e.physical_keycode = PLAYER_KEYS[i][action] InputMap.action_add_event(action_name, e) + #controller d-pad event + var ej = InputEventJoypadButton.new() + ej.device = i + ej.button_index = PLAYER_JOYSTICK_BUTTONS[action] + InputMap.action_add_event(action_name, ej) + + #controller left stick event + var ejm = InputEventJoypadMotion.new() + ejm.device = i + ejm.axis = PLAYER_JOYSTICK_MOTION[action]["axis"] + ejm.axis_value = PLAYER_JOYSTICK_MOTION[action]["axis_value"] + InputMap.action_add_event(action_name, ejm) + func get_custom_class(): return "SimpleCharacter" From 9cf33daddc4f04d6794f62682087090a47aefdbf Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Wed, 18 Dec 2024 08:18:25 +0000 Subject: [PATCH 11/21] README: Update to mention gamepad input --- addons/block_code/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/block_code/README.md b/addons/block_code/README.md index 650c0135..89036b93 100644 --- a/addons/block_code/README.md +++ b/addons/block_code/README.md @@ -13,7 +13,7 @@ Our aim is to reduce the learning curve faced by learners who are on the early p With this project, we aim to reduce the height of the mountain that such learners have to climb. Specifically, we aim to eliminate the requirement of learners having to simultaneously learn to code while building their first games. Instead of writing GDScript to implement games, this plugin enables learners use block coding. Tools like [Scratch](https://scratch.mit.edu/), [Blockly](https://developers.google.com/blockly), and [MakeCode](https://www.microsoft.com/en-us/makecode) have demonstrated that block coding can be much more accessible and intuitive to beginners than textual programming—we are bringing those concepts into Godot to help learners become familiar with some aspects of Godot itself while simplifying the creation of their first games. -In order to be learner-friendly, we implement blocks at a suitable level of abstraction. For example, we have blocks that allow the user to trivially connect keyboard input to the movement of a particular game element, and to make the score show up on-screen. That abstraction does place limits on what can be achieved with this tool, while still allowing us to provide a gentler introduction to Godot for learners, such that they can get familiar with other aspects of the Godot Editor and learn programming concepts while creating basic games. We envision that learners would use block coding as a stepping stone and then later progress onto learning GDScript. +In order to be learner-friendly, we implement blocks at a suitable level of abstraction. For example, we have blocks that allow the user to trivially connect keyboard and gamepad input to the movement of a particular game element, and to make the score show up on-screen. That abstraction does place limits on what can be achieved with this tool, while still allowing us to provide a gentler introduction to Godot for learners, such that they can get familiar with other aspects of the Godot Editor and learn programming concepts while creating basic games. We envision that learners would use block coding as a stepping stone and then later progress onto learning GDScript. That said, we are in no way opposed to having this project grow to be able to create more complex games, as long as it does not negatively affect the experience for early stage learners. @@ -60,7 +60,7 @@ The selection of available blocks varies based on the node type. For example, cr If you wish to switch context to another node, you need to define a function in that other node, and then call it. Once execution jumps into that function, blocks will now act against that other node, and you'll have access to type-specific blocks belonging to that other node. You'll need do this kind of thing if you want to trigger the freeing of another node, or trigger an animation to start playing. This is both strong in conveying the concepts of objects and encapsulation, while also a bit tedious - we may revisit in future! -We have some high level blocks for simplifying common game elements. Add a SimpleCharacter node to get a game element that can be connected to keyboard input with just one type-specific block. Add a SimpleScoring node to display a score on-screen, accompanied by simple blocks for adjusting that score. +We have some high level blocks for simplifying common game elements. Add a SimpleCharacter node to get a game element that can be connected to keyboard and gamepad input with just one type-specific block. Add a SimpleScoring node to display a score on-screen, accompanied by simple blocks for adjusting that score. Lean into animations! Godot's animations functionality goes beyond just simple animations of graphics. You can do so much by combining block coding with Godot's powerful animations editor. From b8013bf2407a6da1558743235d9727b946d24483 Mon Sep 17 00:00:00 2001 From: Daze Date: Thu, 24 Oct 2024 00:20:56 +0000 Subject: [PATCH 12/21] Add Duplicate blocks functionality Add a context menu with duplicate and delete options. Delete was previously only available from a Del shortcut. Duplicate affects snapped blocks. The context menu is displayed when the canvas receives a mouse right click. Fixes https://github.com/endlessm/godot-block-coding/issues/201 --- addons/block_code/ui/blocks/block/block.gd | 101 ++++++++++++++---- .../drag_drop_area/drag_drop_area.gd | 42 +++++++- 2 files changed, 122 insertions(+), 21 deletions(-) diff --git a/addons/block_code/ui/blocks/block/block.gd b/addons/block_code/ui/blocks/block/block.gd index d8ebc64b..fea24b3c 100644 --- a/addons/block_code/ui/blocks/block/block.gd +++ b/addons/block_code/ui/blocks/block/block.gd @@ -43,6 +43,8 @@ var can_delete: bool = true var _block_extension: BlockExtension +var _block_canvas: Node + @onready var _context := BlockEditorContext.get_default() @@ -163,24 +165,58 @@ func _on_block_extension_changed(): func _gui_input(event): if event is InputEventKey: - if event.pressed and event.keycode == KEY_DELETE: - # Always accept the Delete key so it doesn't propagate to the - # BlockCode node in the scene tree. - accept_event() - - if not can_delete: - return - - var dialog := ConfirmationDialog.new() - var num_blocks = _count_child_blocks(self) + 1 - # FIXME: Maybe this should use block_name or label, but that - # requires one to be both unique and human friendly. - if num_blocks > 1: - dialog.dialog_text = "Delete %d blocks?" % num_blocks - else: - dialog.dialog_text = "Delete block?" - dialog.confirmed.connect(remove_from_tree) - EditorInterface.popup_dialog_centered(dialog) + if event.pressed: + if event.keycode == KEY_DELETE: + # Always accept the Delete key so it doesn't propagate to the + # BlockCode node in the scene tree. + accept_event() + confirm_delete() + elif event.ctrl_pressed and not event.shift_pressed and not event.alt_pressed and not event.meta_pressed: + # Should not accept when other keys are pressed + if event.keycode == KEY_D: + accept_event() + confirm_duplicate() + + +func confirm_delete(): + if not can_delete: + return + + var dialog := ConfirmationDialog.new() + var num_blocks = _count_child_blocks(self) + 1 + # FIXME: Maybe this should use block_name or label, but that + # requires one to be both unique and human friendly. + if num_blocks > 1: + dialog.dialog_text = "Delete %d blocks?" % num_blocks + else: + dialog.dialog_text = "Delete block?" + dialog.confirmed.connect(remove_from_tree) + EditorInterface.popup_dialog_centered(dialog) + + +func confirm_duplicate(): + if not can_delete: + return + + var new_block: Block = _context.block_script.instantiate_block(definition) + + var new_parent: Node = get_parent() + while not new_parent.name == "Window": + new_parent = new_parent.get_parent() + + if not _block_canvas: + _block_canvas = get_parent() + while not _block_canvas.name == "BlockCanvas": + _block_canvas = _block_canvas.get_parent() + + new_parent.add_child(new_block) + new_block.global_position = global_position + (Vector2(100, 50) * new_parent.scale) + + _copy_snapped_blocks(self, new_block) + + _block_canvas.reconnect_block.emit(new_block) + + modified.emit() func remove_from_tree(): @@ -236,6 +272,33 @@ func _count_child_blocks(node: Node) -> int: for child in node.get_children(): if child is SnapPoint and child.has_snapped_block(): count += 1 - count += _count_child_blocks(child) + + if child is Container: + count += _count_child_blocks(child) return count + + +func _copy_snapped_blocks(copy_from: Node, copy_to: Node): + var copy_to_child: Node + var child_index := 0 + var maximum_count := copy_to.get_child_count() + + for copy_from_child in copy_from.get_children(): + if child_index + 1 > maximum_count: + return + + copy_to_child = copy_to.get_child(child_index) + child_index += 1 + + if copy_from_child is SnapPoint and copy_from_child.has_snapped_block(): + copy_to_child.add_child(_context.block_script.instantiate_block(copy_from_child.snapped_block.definition)) + _block_canvas.reconnect_block.emit(copy_to_child.snapped_block) + elif copy_from_child.name.begins_with("ParameterInput"): + var raw_input = copy_from_child.get_raw_input() + + if not raw_input is Block: + copy_to_child.set_raw_input(raw_input) + + if copy_from_child is Container: + _copy_snapped_blocks(copy_from_child, copy_to_child) diff --git a/addons/block_code/ui/blocks/utilities/drag_drop_area/drag_drop_area.gd b/addons/block_code/ui/blocks/utilities/drag_drop_area/drag_drop_area.gd index 2269e901..7f386281 100644 --- a/addons/block_code/ui/blocks/utilities/drag_drop_area/drag_drop_area.gd +++ b/addons/block_code/ui/blocks/utilities/drag_drop_area/drag_drop_area.gd @@ -8,6 +8,7 @@ extends Control const Constants = preload("res://addons/block_code/ui/constants.gd") +const BlockTreeUtil = preload("res://addons/block_code/ui/block_tree_util.gd") signal drag_started(offset: Vector2) @@ -16,6 +17,7 @@ signal drag_started(offset: Vector2) @export var drag_outside: bool = false var _drag_start_position: Vector2 = Vector2.INF +var parent_block: Block func _gui_input(event: InputEvent) -> void: @@ -27,7 +29,7 @@ func _gui_input(event: InputEvent) -> void: var button_event: InputEventMouseButton = event as InputEventMouseButton - if button_event.button_index != MOUSE_BUTTON_LEFT: + if button_event.button_index != MOUSE_BUTTON_LEFT and button_event.button_index != MOUSE_BUTTON_RIGHT: return if button_event.double_click: @@ -37,7 +39,27 @@ func _gui_input(event: InputEvent) -> void: elif button_event.pressed: # Keep track of where the mouse click originated, but allow this # event to propagate to other nodes. - _drag_start_position = event.global_position + if button_event.button_index == MOUSE_BUTTON_LEFT: + _drag_start_position = event.global_position + else: + if not parent_block: + parent_block = BlockTreeUtil.get_parent_block(self) + + if parent_block and parent_block.can_delete: + # Accepts to avoid menu conflicts + accept_event() + + # A new right-click menu with items + var _context_menu := PopupMenu.new() + _context_menu.add_icon_item(EditorInterface.get_editor_theme().get_icon("Duplicate", "EditorIcons"), "Duplicate") + _context_menu.add_icon_item(EditorInterface.get_editor_theme().get_icon("Remove", "EditorIcons"), "Delete") + _context_menu.popup_hide.connect(_cleanup) + _context_menu.id_pressed.connect(_menu_pressed.bind(_context_menu)) + + _context_menu.position = DisplayServer.mouse_get_position() + add_child(_context_menu) + + _context_menu.show() else: _drag_start_position = Vector2.INF @@ -64,3 +86,19 @@ func _input(event: InputEvent) -> void: get_viewport().set_input_as_handled() drag_started.emit(_drag_start_position - motion_event.global_position) _drag_start_position = Vector2.INF + + +func _menu_pressed(_index: int, _context_menu: PopupMenu): + # Getting which item was pressed and the corresponding function + var _pressed_label: String = _context_menu.get_item_text(_index) + + if _pressed_label == "Duplicate": + parent_block.confirm_duplicate() + elif _pressed_label == "Delete": + parent_block.confirm_delete() + + +func _cleanup(): + for child in get_children(): + remove_child(child) + child.queue_free() From 26f39de20f1c6a1eb572c3c482cb2e6794917a5e Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Mon, 4 Nov 2024 10:26:15 +0000 Subject: [PATCH 13/21] ci: List Godot versions to test one per line This will make future diffs that add and remove engine versions more legible. --- .github/workflows/checks.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index 12cd71c5..06a2dcdc 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -32,7 +32,9 @@ jobs: name: Tests strategy: matrix: - godot-version: [4.2.2, 4.3.0] + godot-version: + - 4.2.2 + - 4.3.0 runs-on: ubuntu-latest steps: - name: Checkout From 6f4335cbd0344ffa84667646e2d83a1b37f6ce36 Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Wed, 18 Dec 2024 11:43:46 +0000 Subject: [PATCH 14/21] Set Godot 4.3 as minimum supported version Godot 4.3 has been available for 4 months and it seems unlikely that anyone will have a pressing need to add blocks to a Godot 4.2 project. Although we have been running unit tests against 4.2 in CI, those do not cover the full functionality of the plugin. To the best of my knowledge, no-one is regularly testing the plugin interactively against Godot 4.2. Set the minimum version in the asset library template. Drop 4.2 from the CI test matrix. --- .github/workflows/checks.yaml | 1 - asset-template.json.hb | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index 06a2dcdc..1d4e315c 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -33,7 +33,6 @@ jobs: strategy: matrix: godot-version: - - 4.2.2 - 4.3.0 runs-on: ubuntu-latest steps: diff --git a/asset-template.json.hb b/asset-template.json.hb index d9539075..a0093ae6 100644 --- a/asset-template.json.hb +++ b/asset-template.json.hb @@ -2,7 +2,7 @@ "title": "Block Coding", "description": "Create games using a high-level, block-based visual programming language.\r\n\r\nIntended as an educational tool for learners in the earlier stages of their journey towards becoming game developers. This plugin lets you create your first games with high-level blocks, avoiding the immediate need to learn to code in GDScript. Building games in this way provides a gentle introduction to programming concepts and allows you to focus your efforts on becoming familiar with the rest of the Godot Editor UI.", "category_id": "5", - "godot_version": "4.2", + "godot_version": "4.3", "version_string": "{{ context.release.name }}", "cost": "MIT", "support_level": "community", From c59c6a1fe606e327a4c378a9617190089a87e29b Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Wed, 18 Dec 2024 11:50:04 +0000 Subject: [PATCH 15/21] block: Use Dictionary.merged() Now that Godot 4.3 is the minimum supported version, we can use this new method to merge two dictionaries a little more tersely. --- addons/block_code/ui/blocks/block/block.gd | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/addons/block_code/ui/blocks/block/block.gd b/addons/block_code/ui/blocks/block/block.gd index fea24b3c..6a6f851e 100644 --- a/addons/block_code/ui/blocks/block/block.gd +++ b/addons/block_code/ui/blocks/block/block.gd @@ -132,10 +132,7 @@ func _get_parameter_defaults() -> Dictionary: if not block_extension: return definition.defaults - # Use Dictionary.merge instead of Dictionary.merged for Godot 4.2 compatibility - var new_defaults := block_extension.get_defaults() - new_defaults.merge(definition.defaults) - return new_defaults + return block_extension.get_defaults().merged(definition.defaults) func _get_or_create_block_extension() -> BlockExtension: From 2684d95088a641b9414c2e0fa7a15bb67895ddf8 Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Wed, 18 Dec 2024 11:52:34 +0000 Subject: [PATCH 16/21] Back out "Fix error in simple_spawner.gd with Godot 4.2.2" This backs out commit 99e2dc15adad1add1a568ff12ccce7b8441d388f. We now require Godot 4.3. --- addons/block_code/simple_spawner/simple_spawner.gd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/block_code/simple_spawner/simple_spawner.gd b/addons/block_code/simple_spawner/simple_spawner.gd index acae8032..89e3f3d3 100644 --- a/addons/block_code/simple_spawner/simple_spawner.gd +++ b/addons/block_code/simple_spawner/simple_spawner.gd @@ -89,7 +89,7 @@ func spawn_once(): if scenes.size() == 0: return - _spawned_scenes = _spawned_scenes.filter(func(instance): return is_instance_valid(instance)) + _spawned_scenes = _spawned_scenes.filter(is_instance_valid) if spawn_limit != 0 and _spawned_scenes.size() >= spawn_limit: if limit_behavior == LimitBehavior.NO_SPAWN: From d54673ead324bdd662c81265f827d0201cf31150 Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Fri, 8 Nov 2024 14:26:17 +0000 Subject: [PATCH 17/21] SimpleCharacter: Fix axis confusion in tooltip Previously this description claimed that x is vertical and y horizontal. Fix this, and clarify some other terms. --- .../simple_nodes/simple_character/simple_character.gd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/block_code/simple_nodes/simple_character/simple_character.gd b/addons/block_code/simple_nodes/simple_character/simple_character.gd index 674095f2..ec4f9799 100644 --- a/addons/block_code/simple_nodes/simple_character/simple_character.gd +++ b/addons/block_code/simple_nodes/simple_character/simple_character.gd @@ -185,11 +185,11 @@ static func setup_custom_blocks(): block_definition.display_template = "move with {player: NIL} buttons as {kind: NIL}" block_definition.description = """Move the character using the “Player 1” or “Player 2” controls as configured in Godot. -“Top-down” enables the character to move in both x (vertical) and y (horizontal) dimensions, as if the camera is above the character, looking down. No gravity is added. +“Top-down” enables the character to move in both x (horizontal) and y (vertical) dimensions, as if the camera is above the character, looking down. No gravity is added. -“Platformer” enables the character to move as if the camera is looking from the side, like a side-scroller. Gravity is applied on the x (vertical) axis, making the character fall down until they collide. +“Platformer” enables the character to move as if the camera is looking from the side, like a side-scroller. Gravity is applied on the y (vertical) axis, making the character fall down until they collide with something. -“Spaceship” uses the left/right controls to turn the character and up/down controls to go forward or backward.""" +“Spaceship” uses the left/right controls to rotate the character and up/down controls to go forward or backward in the direction they are pointing.""" # TODO: delta here is assumed to be the parameter name of # the _process or _physics_process method: block_definition.code_template = "move_with_player_buttons({player}, {kind}, delta)" From 0525fbe0cfcce133ed52aa0b34de0e70deb38c38 Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Wed, 18 Dec 2024 18:38:40 +0000 Subject: [PATCH 18/21] Remove polyfill for Node.is_part_of_edited_scene() We now require Godot 4.3, which introduces this method. --- addons/block_code/ui/block_canvas/block_canvas.gd | 4 ++-- .../ui/picker/categories/block_category_button.gd | 2 +- addons/block_code/ui/tooltip/tooltip.gd | 2 +- addons/block_code/ui/util.gd | 13 ------------- 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/addons/block_code/ui/block_canvas/block_canvas.gd b/addons/block_code/ui/block_canvas/block_canvas.gd index ef07844b..a9b385f4 100644 --- a/addons/block_code/ui/block_canvas/block_canvas.gd +++ b/addons/block_code/ui/block_canvas/block_canvas.gd @@ -67,7 +67,7 @@ signal replace_block_code func _ready(): _context.changed.connect(_on_context_changed) - if not _open_scene_button.icon and not Util.node_is_part_of_edited_scene(self): + if not _open_scene_button.icon and not self.is_part_of_edited_scene(): _open_scene_button.icon = _open_scene_icon if not _zoom_out_button.icon: _zoom_out_button.icon = _icon_zoom_out @@ -99,7 +99,7 @@ func _can_drop_data(at_position: Vector2, data: Variant) -> bool: # Don't allow dropping BlockCode nodes or nodes that aren't part of the # edited scene. var node := get_tree().root.get_node(abs_path) - if node is BlockCode or not Util.node_is_part_of_edited_scene(node): + if node is BlockCode or not node.is_part_of_edited_scene(): return false # Don't allow dropping the BlockCode node's parent as that's already self. diff --git a/addons/block_code/ui/picker/categories/block_category_button.gd b/addons/block_code/ui/picker/categories/block_category_button.gd index 4edb3123..06fa7fb0 100644 --- a/addons/block_code/ui/picker/categories/block_category_button.gd +++ b/addons/block_code/ui/picker/categories/block_category_button.gd @@ -16,7 +16,7 @@ func _ready(): if not category: category = BlockCategory.new("Example", Color.RED) - if not Util.node_is_part_of_edited_scene(self): + if not self.is_part_of_edited_scene(): var new_stylebox: StyleBoxFlat = _panel.get_theme_stylebox("panel").duplicate() new_stylebox.bg_color = category.color _panel.add_theme_stylebox_override("panel", new_stylebox) diff --git a/addons/block_code/ui/tooltip/tooltip.gd b/addons/block_code/ui/tooltip/tooltip.gd index 5f165021..76306b11 100644 --- a/addons/block_code/ui/tooltip/tooltip.gd +++ b/addons/block_code/ui/tooltip/tooltip.gd @@ -27,5 +27,5 @@ func override_fonts(): func _ready(): - if not Util.node_is_part_of_edited_scene(self): + if not self.is_part_of_edited_scene(): override_fonts() diff --git a/addons/block_code/ui/util.gd b/addons/block_code/ui/util.gd index 70c84781..2a856de1 100644 --- a/addons/block_code/ui/util.gd +++ b/addons/block_code/ui/util.gd @@ -1,19 +1,6 @@ extends Object -## Polyfill of Node.is_part_of_edited_scene(), available to GDScript in Godot 4.3+. -static func node_is_part_of_edited_scene(node: Node) -> bool: - if not Engine.is_editor_hint(): - return false - - var tree := node.get_tree() - if not tree or not tree.edited_scene_root: - return false - - var edited_scene_parent := tree.edited_scene_root.get_parent() - return edited_scene_parent and edited_scene_parent.is_ancestor_of(node) - - ## Get the path from [param reference] to [param node] within a scene. ## ## Returns the path from [param reference] to [param node] without referencing From 354dde19087729fdaf6c5cd89319ae2e67a65b2f Mon Sep 17 00:00:00 2001 From: Daze Date: Fri, 20 Dec 2024 22:38:12 +0000 Subject: [PATCH 19/21] Condenses as vector2_xy and vector3_xyz blocks Condenses the existing vector2_x/y blocks and vector3_x/y/z blocks into singular blocks. This makes switching an axis easier and reduces redundancy in the block picker. --- addons/block_code/blocks/math/vector2_x.tres | 19 -------------- addons/block_code/blocks/math/vector2_xy.tres | 26 +++++++++++++++++++ addons/block_code/blocks/math/vector2_y.tres | 19 -------------- addons/block_code/blocks/math/vector3_x.tres | 19 -------------- .../block_code/blocks/math/vector3_xyz.tres | 26 +++++++++++++++++++ addons/block_code/blocks/math/vector3_y.tres | 19 -------------- addons/block_code/blocks/math/vector3_z.tres | 19 -------------- 7 files changed, 52 insertions(+), 95 deletions(-) delete mode 100644 addons/block_code/blocks/math/vector2_x.tres create mode 100644 addons/block_code/blocks/math/vector2_xy.tres delete mode 100644 addons/block_code/blocks/math/vector2_y.tres delete mode 100644 addons/block_code/blocks/math/vector3_x.tres create mode 100644 addons/block_code/blocks/math/vector3_xyz.tres delete mode 100644 addons/block_code/blocks/math/vector3_y.tres delete mode 100644 addons/block_code/blocks/math/vector3_z.tres diff --git a/addons/block_code/blocks/math/vector2_x.tres b/addons/block_code/blocks/math/vector2_x.tres deleted file mode 100644 index 7e5e3dfa..00000000 --- a/addons/block_code/blocks/math/vector2_x.tres +++ /dev/null @@ -1,19 +0,0 @@ -[gd_resource type="Resource" load_steps=2 format=3 uid="uid://btsfimn63xhi2"] - -[ext_resource type="Script" path="res://addons/block_code/code_generation/block_definition.gd" id="1_dvsrc"] - -[resource] -script = ExtResource("1_dvsrc") -name = &"vector2_x" -target_node_class = "" -description = "Gives the x of a [i]Vector2[/i]" -category = "Math" -type = 3 -variant_type = 3 -display_template = "x of {vector2: VECTOR2}" -code_template = "{vector2}.x" -defaults = { -"vector2": Vector2(0, 0) -} -signal_name = "" -scope = "" diff --git a/addons/block_code/blocks/math/vector2_xy.tres b/addons/block_code/blocks/math/vector2_xy.tres new file mode 100644 index 00000000..47fa7358 --- /dev/null +++ b/addons/block_code/blocks/math/vector2_xy.tres @@ -0,0 +1,26 @@ +[gd_resource type="Resource" load_steps=4 format=3 uid="uid://bpdjqy6oidfo4"] + +[ext_resource type="Script" path="res://addons/block_code/code_generation/option_data.gd" id="1_p8v57"] +[ext_resource type="Script" path="res://addons/block_code/code_generation/block_definition.gd" id="2_207xo"] + +[sub_resource type="Resource" id="Resource_ie4sg"] +script = ExtResource("1_p8v57") +selected = 0 +items = ["x", "y"] + +[resource] +script = ExtResource("2_207xo") +name = &"vector2_xy" +target_node_class = "" +description = "Gives the x or y of a [b]Vector2[/b]" +category = "Math" +type = 3 +variant_type = 3 +display_template = "{xy: NIL} of {vector2: VECTOR2}" +code_template = "{vector2}.{{xy}}" +defaults = { +"xy": SubResource("Resource_ie4sg") +} +signal_name = "" +scope = "" +is_advanced = false diff --git a/addons/block_code/blocks/math/vector2_y.tres b/addons/block_code/blocks/math/vector2_y.tres deleted file mode 100644 index 802f0b56..00000000 --- a/addons/block_code/blocks/math/vector2_y.tres +++ /dev/null @@ -1,19 +0,0 @@ -[gd_resource type="Resource" load_steps=2 format=3 uid="uid://ccbrbp4lee3wt"] - -[ext_resource type="Script" path="res://addons/block_code/code_generation/block_definition.gd" id="1_wuold"] - -[resource] -script = ExtResource("1_wuold") -name = &"vector2_y" -target_node_class = "" -description = "Gives the y of a [i]Vector2[/i]" -category = "Math" -type = 3 -variant_type = 3 -display_template = "y of {vector2: VECTOR2}" -code_template = "{vector2}.y" -defaults = { -"vector2": Vector2(0, 0) -} -signal_name = "" -scope = "" diff --git a/addons/block_code/blocks/math/vector3_x.tres b/addons/block_code/blocks/math/vector3_x.tres deleted file mode 100644 index 3a4f4c76..00000000 --- a/addons/block_code/blocks/math/vector3_x.tres +++ /dev/null @@ -1,19 +0,0 @@ -[gd_resource type="Resource" load_steps=2 format=3 uid="uid://cehtd3jqu5es2"] - -[ext_resource type="Script" path="res://addons/block_code/code_generation/block_definition.gd" id="1_p3bft"] - -[resource] -script = ExtResource("1_p3bft") -name = &"vector3_x" -target_node_class = "" -description = "Gives the x of a [i]Vector3[/i]" -category = "Math" -type = 3 -variant_type = 3 -display_template = "x of {vector3: VECTOR3}" -code_template = "{vector3}.x" -defaults = { -"vector3": Vector3(0, 0, 0) -} -signal_name = "" -scope = "" diff --git a/addons/block_code/blocks/math/vector3_xyz.tres b/addons/block_code/blocks/math/vector3_xyz.tres new file mode 100644 index 00000000..a49c3a41 --- /dev/null +++ b/addons/block_code/blocks/math/vector3_xyz.tres @@ -0,0 +1,26 @@ +[gd_resource type="Resource" load_steps=4 format=3 uid="uid://s72tgtbci1ui"] + +[ext_resource type="Script" path="res://addons/block_code/code_generation/option_data.gd" id="1_0wc0o"] +[ext_resource type="Script" path="res://addons/block_code/code_generation/block_definition.gd" id="2_e6ohf"] + +[sub_resource type="Resource" id="Resource_ie4sg"] +script = ExtResource("1_0wc0o") +selected = 0 +items = ["x", "y", "z"] + +[resource] +script = ExtResource("2_e6ohf") +name = &"vector3_xyz" +target_node_class = "" +description = "Gives the x, y, or z of a [b]Vector3[/b]" +category = "Math" +type = 3 +variant_type = 3 +display_template = "{xyz: NIL} of {vector3: VECTOR3}" +code_template = "{vector3}.{{xyz}}" +defaults = { +"xyz": SubResource("Resource_ie4sg") +} +signal_name = "" +scope = "" +is_advanced = false diff --git a/addons/block_code/blocks/math/vector3_y.tres b/addons/block_code/blocks/math/vector3_y.tres deleted file mode 100644 index 31702319..00000000 --- a/addons/block_code/blocks/math/vector3_y.tres +++ /dev/null @@ -1,19 +0,0 @@ -[gd_resource type="Resource" load_steps=2 format=3 uid="uid://cehtd3jqu5es2"] - -[ext_resource type="Script" path="res://addons/block_code/code_generation/block_definition.gd" id="1_p3bft"] - -[resource] -script = ExtResource("1_p3bft") -name = &"vector3_y" -target_node_class = "" -description = "Gives the y of a [i]Vector3[/i]" -category = "Math" -type = 3 -variant_type = 3 -display_template = "y of {vector3: VECTOR3}" -code_template = "{vector3}.y" -defaults = { -"vector3": Vector3(0, 0, 0) -} -signal_name = "" -scope = "" diff --git a/addons/block_code/blocks/math/vector3_z.tres b/addons/block_code/blocks/math/vector3_z.tres deleted file mode 100644 index b1b29b84..00000000 --- a/addons/block_code/blocks/math/vector3_z.tres +++ /dev/null @@ -1,19 +0,0 @@ -[gd_resource type="Resource" load_steps=2 format=3 uid="uid://cehtd3jqu5es2"] - -[ext_resource type="Script" path="res://addons/block_code/code_generation/block_definition.gd" id="1_p3bft"] - -[resource] -script = ExtResource("1_p3bft") -name = &"vector3_z" -target_node_class = "" -description = "Gives the z of a [i]Vector3[/i]" -category = "Math" -type = 3 -variant_type = 3 -display_template = "z of {vector3: VECTOR3}" -code_template = "{vector3}.z" -defaults = { -"vector3": Vector3(0, 0, 0) -} -signal_name = "" -scope = "" From db76b779d79b91abb3f6e07a00fab620acb7db45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= Date: Thu, 26 Dec 2024 17:19:35 -0300 Subject: [PATCH 20/21] Fix remove polyfill for Node.is_part_of_edited_scene() There was one pending reference to the polyfill. Fixup for commit 0525fbe0cfcce133ed52aa0b34de0e70deb38c38 --- addons/block_code/blocks/communication/groups.gd | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/block_code/blocks/communication/groups.gd b/addons/block_code/blocks/communication/groups.gd index 8faf4aa1..c217d71a 100644 --- a/addons/block_code/blocks/communication/groups.gd +++ b/addons/block_code/blocks/communication/groups.gd @@ -3,7 +3,6 @@ extends BlockExtension const OptionData = preload("res://addons/block_code/code_generation/option_data.gd") -const Util = preload("res://addons/block_code/ui/util.gd") # Global groups are just project settings in the global_group group. @@ -58,7 +57,7 @@ func get_defaults() -> Dictionary: return {} # The default groups are only needed in the editor. - if not Util.node_is_part_of_edited_scene(context_node): + if not context_node.is_part_of_edited_scene(): return {} var groups: Array[String] = _get_edited_scene_groups() From 16a75ab2cefcc19af16411d3ca3c3eb20ff59ac2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= Date: Thu, 26 Dec 2024 17:29:44 -0300 Subject: [PATCH 21/21] Add is_advanced = false to non-advanced blocks Godot does this automatically. Preventing the diff. --- addons/block_code/blocks/communication/add_node_to_group.tres | 1 + addons/block_code/blocks/communication/add_to_group.tres | 1 + addons/block_code/blocks/communication/call_method_group.tres | 1 + addons/block_code/blocks/communication/get_node.tres | 1 + addons/block_code/blocks/communication/is_in_group.tres | 1 + addons/block_code/blocks/communication/is_node_in_group.tres | 1 + addons/block_code/blocks/communication/remove_from_group.tres | 1 + .../block_code/blocks/communication/remove_node_from_group.tres | 1 + addons/block_code/blocks/graphics/animationplayer_play.tres | 1 + addons/block_code/blocks/input/is_input_actioned.tres | 1 + addons/block_code/blocks/logic/compare.tres | 1 + addons/block_code/blocks/sounds/pause_continue_sound.tres | 1 + 12 files changed, 12 insertions(+) diff --git a/addons/block_code/blocks/communication/add_node_to_group.tres b/addons/block_code/blocks/communication/add_node_to_group.tres index 2e386d22..0531ce2f 100644 --- a/addons/block_code/blocks/communication/add_node_to_group.tres +++ b/addons/block_code/blocks/communication/add_node_to_group.tres @@ -24,4 +24,5 @@ defaults = { } signal_name = "" scope = "" +is_advanced = false extension_script = ExtResource("1_p83c7") diff --git a/addons/block_code/blocks/communication/add_to_group.tres b/addons/block_code/blocks/communication/add_to_group.tres index 04e14a6f..1d00f270 100644 --- a/addons/block_code/blocks/communication/add_to_group.tres +++ b/addons/block_code/blocks/communication/add_to_group.tres @@ -24,4 +24,5 @@ defaults = { } signal_name = "" scope = "" +is_advanced = false extension_script = ExtResource("2_42ixf") diff --git a/addons/block_code/blocks/communication/call_method_group.tres b/addons/block_code/blocks/communication/call_method_group.tres index 06515f55..b7e38026 100644 --- a/addons/block_code/blocks/communication/call_method_group.tres +++ b/addons/block_code/blocks/communication/call_method_group.tres @@ -24,4 +24,5 @@ defaults = { } signal_name = "" scope = "" +is_advanced = false extension_script = ExtResource("1_of577") diff --git a/addons/block_code/blocks/communication/get_node.tres b/addons/block_code/blocks/communication/get_node.tres index 22f7f5ff..79788891 100644 --- a/addons/block_code/blocks/communication/get_node.tres +++ b/addons/block_code/blocks/communication/get_node.tres @@ -24,4 +24,5 @@ defaults = { } signal_name = "" scope = "" +is_advanced = false extension_script = ExtResource("1_we5wl") diff --git a/addons/block_code/blocks/communication/is_in_group.tres b/addons/block_code/blocks/communication/is_in_group.tres index afd089d8..23fa4191 100644 --- a/addons/block_code/blocks/communication/is_in_group.tres +++ b/addons/block_code/blocks/communication/is_in_group.tres @@ -24,4 +24,5 @@ defaults = { } signal_name = "" scope = "" +is_advanced = false extension_script = ExtResource("2_o165d") diff --git a/addons/block_code/blocks/communication/is_node_in_group.tres b/addons/block_code/blocks/communication/is_node_in_group.tres index d56b3f7e..83b5611b 100644 --- a/addons/block_code/blocks/communication/is_node_in_group.tres +++ b/addons/block_code/blocks/communication/is_node_in_group.tres @@ -24,4 +24,5 @@ defaults = { } signal_name = "" scope = "" +is_advanced = false extension_script = ExtResource("1_r4prw") diff --git a/addons/block_code/blocks/communication/remove_from_group.tres b/addons/block_code/blocks/communication/remove_from_group.tres index b25fe8ad..f33b5acb 100644 --- a/addons/block_code/blocks/communication/remove_from_group.tres +++ b/addons/block_code/blocks/communication/remove_from_group.tres @@ -24,4 +24,5 @@ defaults = { } signal_name = "" scope = "" +is_advanced = false extension_script = ExtResource("1_i50fw") diff --git a/addons/block_code/blocks/communication/remove_node_from_group.tres b/addons/block_code/blocks/communication/remove_node_from_group.tres index defa9251..50f5195b 100644 --- a/addons/block_code/blocks/communication/remove_node_from_group.tres +++ b/addons/block_code/blocks/communication/remove_node_from_group.tres @@ -24,4 +24,5 @@ defaults = { } signal_name = "" scope = "" +is_advanced = false extension_script = ExtResource("1_h3lhb") diff --git a/addons/block_code/blocks/graphics/animationplayer_play.tres b/addons/block_code/blocks/graphics/animationplayer_play.tres index 6e8cefdc..c7d77924 100644 --- a/addons/block_code/blocks/graphics/animationplayer_play.tres +++ b/addons/block_code/blocks/graphics/animationplayer_play.tres @@ -42,4 +42,5 @@ defaults = { } signal_name = "" scope = "" +is_advanced = false extension_script = ExtResource("2_7ymgi") diff --git a/addons/block_code/blocks/input/is_input_actioned.tres b/addons/block_code/blocks/input/is_input_actioned.tres index 5f7545f3..a8412821 100644 --- a/addons/block_code/blocks/input/is_input_actioned.tres +++ b/addons/block_code/blocks/input/is_input_actioned.tres @@ -24,4 +24,5 @@ defaults = { } signal_name = "" scope = "" +is_advanced = false extension_script = ExtResource("2_h11b7") diff --git a/addons/block_code/blocks/logic/compare.tres b/addons/block_code/blocks/logic/compare.tres index d4b4dc4f..dca45e8d 100644 --- a/addons/block_code/blocks/logic/compare.tres +++ b/addons/block_code/blocks/logic/compare.tres @@ -25,3 +25,4 @@ defaults = { } signal_name = "" scope = "" +is_advanced = false diff --git a/addons/block_code/blocks/sounds/pause_continue_sound.tres b/addons/block_code/blocks/sounds/pause_continue_sound.tres index 17487bbc..e66333f2 100644 --- a/addons/block_code/blocks/sounds/pause_continue_sound.tres +++ b/addons/block_code/blocks/sounds/pause_continue_sound.tres @@ -28,3 +28,4 @@ defaults = { } signal_name = "" scope = "" +is_advanced = false