Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set Godot 4.3 as minimum supported version #346

Merged
merged 5 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ jobs:
name: Tests
strategy:
matrix:
godot-version: [4.2.2, 4.3.0]
godot-version:
- 4.3.0
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion addons/block_code/simple_spawner/simple_spawner.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions addons/block_code/ui/block_canvas/block_canvas.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
5 changes: 1 addition & 4 deletions addons/block_code/ui/blocks/block/block.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion addons/block_code/ui/tooltip/tooltip.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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()
13 changes: 0 additions & 13 deletions addons/block_code/ui/util.gd
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion asset-template.json.hb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading