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