From e03de3ddfcb3d4d8111d5d3f50eb1301e47cb4e5 Mon Sep 17 00:00:00 2001 From: Michael Alexsander Silva Dias Date: Wed, 16 May 2018 12:23:20 -0300 Subject: [PATCH] Exposed set/get_project_metadata in EditorSettings. --- doc/classes/EditorInterface.xml | 2 +- doc/classes/EditorSettings.xml | 24 +++++++++++++++++++++++- editor/editor_settings.cpp | 5 ++++- editor/editor_settings.h | 2 +- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/doc/classes/EditorInterface.xml b/doc/classes/EditorInterface.xml index 006a7ca690a..19bd7e6d52f 100644 --- a/doc/classes/EditorInterface.xml +++ b/doc/classes/EditorInterface.xml @@ -4,7 +4,7 @@ Editor interface and main components. - Editor interface. Allows saving and (re-)loading scenes, rendering mesh previews, inspecting and editing resources and objects and provides access to [EditorSettings], [EditorFileSystem], [EditorResourcePreview]\ er, [ScriptEditor], the editor viewport, as well as information about scenes. Also see [EditorPlugin] and [EditorScript]. + Editor interface. Allows saving and (re-)loading scenes, rendering mesh previews, inspecting and editing resources and objects and provides access to [EditorSettings], [EditorFileSystem], [EditorResourcePreview], [ScriptEditor], the editor viewport, as well as information about scenes. Also see [EditorPlugin] and [EditorScript]. diff --git a/doc/classes/EditorSettings.xml b/doc/classes/EditorSettings.xml index cdd9560eda5..5325a67de32 100644 --- a/doc/classes/EditorSettings.xml +++ b/doc/classes/EditorSettings.xml @@ -55,7 +55,19 @@ Get the list of favorite directories for this project. - + + + + + + + + + + + + + @@ -131,6 +143,16 @@ + + + + + + + + + + diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index fe0392334c6..a47605be154 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -1151,7 +1151,7 @@ void EditorSettings::set_project_metadata(const String &p_section, const String cf->save(path); } -Variant EditorSettings::get_project_metadata(const String &p_section, const String &p_key, Variant p_default) { +Variant EditorSettings::get_project_metadata(const String &p_section, const String &p_key, Variant p_default) const { Ref cf = memnew(ConfigFile); String path = get_project_settings_dir().plus_file("project_metadata.cfg"); Error err = cf->load(path); @@ -1493,6 +1493,9 @@ void EditorSettings::_bind_methods() { ClassDB::bind_method(D_METHOD("get_settings_dir"), &EditorSettings::get_settings_dir); ClassDB::bind_method(D_METHOD("get_project_settings_dir"), &EditorSettings::get_project_settings_dir); + ClassDB::bind_method(D_METHOD("set_project_metadata", "section", "key", "data"), &EditorSettings::set_project_metadata); + ClassDB::bind_method(D_METHOD("get_project_metadata", "section", "key", "default"), &EditorSettings::get_project_metadata, DEFVAL(Variant())); + ClassDB::bind_method(D_METHOD("set_favorite_dirs", "dirs"), &EditorSettings::set_favorite_dirs); ClassDB::bind_method(D_METHOD("get_favorite_dirs"), &EditorSettings::get_favorite_dirs); ClassDB::bind_method(D_METHOD("set_recent_dirs", "dirs"), &EditorSettings::set_recent_dirs); diff --git a/editor/editor_settings.h b/editor/editor_settings.h index e196ca506ed..b48aac89c7b 100644 --- a/editor/editor_settings.h +++ b/editor/editor_settings.h @@ -167,7 +167,7 @@ public: String get_cache_dir() const; void set_project_metadata(const String &p_section, const String &p_key, Variant p_data); - Variant get_project_metadata(const String &p_section, const String &p_key, Variant p_default); + Variant get_project_metadata(const String &p_section, const String &p_key, Variant p_default) const; void set_favorite_dirs(const Vector &p_favorites_dirs); Vector get_favorite_dirs() const;