From ebd3280443073200e1bbb6d7f1350b9ca11cf327 Mon Sep 17 00:00:00 2001 From: Relintai Date: Sat, 3 May 2025 22:21:03 +0200 Subject: [PATCH] Automatically load sessions when HTTPSessionManagerFile enters tree. --- modules/web/http/http_session_manager_file.cpp | 14 ++++++++++++++ modules/web/http/http_session_manager_file.h | 1 + 2 files changed, 15 insertions(+) diff --git a/modules/web/http/http_session_manager_file.cpp b/modules/web/http/http_session_manager_file.cpp index 9de259e32..3de6d5f9c 100644 --- a/modules/web/http/http_session_manager_file.cpp +++ b/modules/web/http/http_session_manager_file.cpp @@ -163,6 +163,20 @@ HTTPSessionManagerFile::HTTPSessionManagerFile() { HTTPSessionManagerFile::~HTTPSessionManagerFile() { } +void HTTPSessionManagerFile::_notification(int p_what) { + switch (p_what) { + case NOTIFICATION_ENTER_TREE: { + if (Engine::get_singleton()->is_editor_hint()) { + return; + } + + load_sessions(); + } break; + default: + break; + } +} + void HTTPSessionManagerFile::_bind_methods() { ClassDB::bind_method(D_METHOD("get_save_folder_path"), &HTTPSessionManagerFile::get_save_folder_path); ClassDB::bind_method(D_METHOD("set_save_folder_path", "val"), &HTTPSessionManagerFile::set_save_folder_path); diff --git a/modules/web/http/http_session_manager_file.h b/modules/web/http/http_session_manager_file.h index 2e4f9b56e..d36394f30 100644 --- a/modules/web/http/http_session_manager_file.h +++ b/modules/web/http/http_session_manager_file.h @@ -54,6 +54,7 @@ public: ~HTTPSessionManagerFile(); protected: + void _notification(int p_what); static void _bind_methods(); String _save_folder_path;