Exposed set/get_project_metadata in EditorSettings.
This commit is contained in:
parent
760ec584df
commit
e03de3ddfc
4 changed files with 29 additions and 4 deletions
|
@ -4,7 +4,7 @@
|
|||
Editor interface and main components.
|
||||
</brief_description>
|
||||
<description>
|
||||
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].
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
|
|
|
@ -55,7 +55,19 @@
|
|||
Get the list of favorite directories for this project.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_project_settings_dir" qualifiers="const">
|
||||
<method name="get_project_metadata" qualifiers="const">
|
||||
<return type="Variant">
|
||||
</return>
|
||||
<argument index="0" name="section" type="String">
|
||||
</argument>
|
||||
<argument index="1" name="key" type="String">
|
||||
</argument>
|
||||
<argument index="2" name="default" type="Variant" default="null">
|
||||
</argument>
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_project_settings_dir">
|
||||
<return type="String">
|
||||
</return>
|
||||
<description>
|
||||
|
@ -131,6 +143,16 @@
|
|||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_project_metadata">
|
||||
<argument index="0" name="section" type="String">
|
||||
</argument>
|
||||
<argument index="1" name="key" type="String">
|
||||
</argument>
|
||||
<argument index="2" name="data" type="Variant">
|
||||
</argument>
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_recent_dirs">
|
||||
<return type="void">
|
||||
</return>
|
||||
|
|
|
@ -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<ConfigFile> 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);
|
||||
|
|
|
@ -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<String> &p_favorites_dirs);
|
||||
Vector<String> get_favorite_dirs() const;
|
||||
|
|
Loading…
Reference in a new issue