Skip to content

Commit 0525fbe

Browse files
committed
Remove polyfill for Node.is_part_of_edited_scene()
We now require Godot 4.3, which introduces this method.
1 parent 2684d95 commit 0525fbe

File tree

4 files changed

+4
-17
lines changed

4 files changed

+4
-17
lines changed

addons/block_code/ui/block_canvas/block_canvas.gd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ signal replace_block_code
6767
func _ready():
6868
_context.changed.connect(_on_context_changed)
6969

70-
if not _open_scene_button.icon and not Util.node_is_part_of_edited_scene(self):
70+
if not _open_scene_button.icon and not self.is_part_of_edited_scene():
7171
_open_scene_button.icon = _open_scene_icon
7272
if not _zoom_out_button.icon:
7373
_zoom_out_button.icon = _icon_zoom_out
@@ -99,7 +99,7 @@ func _can_drop_data(at_position: Vector2, data: Variant) -> bool:
9999
# Don't allow dropping BlockCode nodes or nodes that aren't part of the
100100
# edited scene.
101101
var node := get_tree().root.get_node(abs_path)
102-
if node is BlockCode or not Util.node_is_part_of_edited_scene(node):
102+
if node is BlockCode or not node.is_part_of_edited_scene():
103103
return false
104104

105105
# Don't allow dropping the BlockCode node's parent as that's already self.

addons/block_code/ui/picker/categories/block_category_button.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func _ready():
1616
if not category:
1717
category = BlockCategory.new("Example", Color.RED)
1818

19-
if not Util.node_is_part_of_edited_scene(self):
19+
if not self.is_part_of_edited_scene():
2020
var new_stylebox: StyleBoxFlat = _panel.get_theme_stylebox("panel").duplicate()
2121
new_stylebox.bg_color = category.color
2222
_panel.add_theme_stylebox_override("panel", new_stylebox)

addons/block_code/ui/tooltip/tooltip.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ func override_fonts():
2727

2828

2929
func _ready():
30-
if not Util.node_is_part_of_edited_scene(self):
30+
if not self.is_part_of_edited_scene():
3131
override_fonts()

addons/block_code/ui/util.gd

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
11
extends Object
22

33

4-
## Polyfill of Node.is_part_of_edited_scene(), available to GDScript in Godot 4.3+.
5-
static func node_is_part_of_edited_scene(node: Node) -> bool:
6-
if not Engine.is_editor_hint():
7-
return false
8-
9-
var tree := node.get_tree()
10-
if not tree or not tree.edited_scene_root:
11-
return false
12-
13-
var edited_scene_parent := tree.edited_scene_root.get_parent()
14-
return edited_scene_parent and edited_scene_parent.is_ancestor_of(node)
15-
16-
174
## Get the path from [param reference] to [param node] within a scene.
185
##
196
## Returns the path from [param reference] to [param node] without referencing

0 commit comments

Comments
 (0)