Skip to content

Commit

Permalink
Add DockableLayout.is_empty method
Browse files Browse the repository at this point in the history
  • Loading branch information
gilzoide committed Feb 13, 2024
1 parent 7aa8c17 commit de2ac62
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions addons/dockable_container/layout.gd
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ func clone() -> DockableLayout:
return duplicate()


func is_empty() -> bool:
return _root.is_empty()


func get_names() -> PackedStringArray:
return _root.get_names()

Expand Down
4 changes: 3 additions & 1 deletion addons/dockable_container/samples/TestScene.gd
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ func _on_save_pressed() -> void:


func _on_load_pressed() -> void:
if not ResourceLoader.exists(SAVED_LAYOUT_PATH):
return
var res = load(SAVED_LAYOUT_PATH) as DockableLayout
if res:
if res and not res.is_empty():
_container.set_layout(res.clone())
else:
print("Error")
Expand Down
2 changes: 1 addition & 1 deletion addons/dockable_container/samples/TestScene.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ serialized_data = {
"first": {
"direction": 1,
"first": {
"current_tab": 1,
"current_tab": 0,
"names": PackedStringArray("Control0")
},
"percent": 0.5,
Expand Down

0 comments on commit de2ac62

Please sign in to comment.