diff --git a/addons/dockable_container/layout.gd b/addons/dockable_container/layout.gd index bf0bd65..17e0a21 100644 --- a/addons/dockable_container/layout.gd +++ b/addons/dockable_container/layout.gd @@ -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() diff --git a/addons/dockable_container/samples/TestScene.gd b/addons/dockable_container/samples/TestScene.gd index 84bf93d..cbb05e7 100644 --- a/addons/dockable_container/samples/TestScene.gd +++ b/addons/dockable_container/samples/TestScene.gd @@ -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") diff --git a/addons/dockable_container/samples/TestScene.tscn b/addons/dockable_container/samples/TestScene.tscn index fee2858..fbc39e8 100644 --- a/addons/dockable_container/samples/TestScene.tscn +++ b/addons/dockable_container/samples/TestScene.tscn @@ -14,7 +14,7 @@ serialized_data = { "first": { "direction": 1, "first": { -"current_tab": 1, +"current_tab": 0, "names": PackedStringArray("Control0") }, "percent": 0.5,