diff options
| author | Franklin Sobrinho | 2016-08-16 17:10:53 -0300 |
|---|---|---|
| committer | Rémi Verschelde | 2016-09-01 08:40:49 +0200 |
| commit | 5f9e6d2b48ee4b76eb145c92de8a581bcf38c6a8 (patch) | |
| tree | c0b8ca49923554d0f3828f3fd80865b5492da751 /tools | |
| parent | 6327fc47c88fa1cb5d104122e1c5245325ee15fa (diff) | |
| download | godot-5f9e6d2b48ee4b76eb145c92de8a581bcf38c6a8.tar.gz godot-5f9e6d2b48ee4b76eb145c92de8a581bcf38c6a8.tar.zst godot-5f9e6d2b48ee4b76eb145c92de8a581bcf38c6a8.zip | |
Added add_property_info function to Globals and EditorSettings classes
(cherry picked from commit 9f242ed6e553df947c3696be5f23cd06649deab0)
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/editor/editor_settings.cpp | 21 | ||||
| -rw-r--r-- | tools/editor/editor_settings.h | 2 |
2 files changed, 23 insertions, 0 deletions
diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp index 6b9d13dc4..36ef2c917 100644 --- a/tools/editor/editor_settings.cpp +++ b/tools/editor/editor_settings.cpp @@ -736,6 +736,25 @@ void EditorSettings::notify_changes() { } +void EditorSettings::_add_property_info_bind(const Dictionary& p_info) { + + ERR_FAIL_COND(!p_info.has("name")); + ERR_FAIL_COND(!p_info.has("type")); + + PropertyInfo pinfo; + pinfo.name = p_info["name"]; + ERR_FAIL_COND(!props.has(pinfo.name)); + pinfo.type = Variant::Type(p_info["type"].operator int()); + ERR_FAIL_INDEX(pinfo.type, Variant::VARIANT_MAX); + + if (p_info.has("hint")) + pinfo.hint = PropertyHint(p_info["hint"].operator int()); + if (p_info.has("hint_string")) + pinfo.hint_string = p_info["hint_string"]; + + add_property_hint(pinfo); +} + void EditorSettings::add_property_hint(const PropertyInfo& p_hint) { _THREAD_SAFE_METHOD_ @@ -1004,6 +1023,8 @@ void EditorSettings::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_settings_path"),&EditorSettings::get_settings_path); ObjectTypeDB::bind_method(_MD("get_project_settings_path"),&EditorSettings::get_project_settings_path); + ObjectTypeDB::bind_method(_MD("add_property_info", "info"),&EditorSettings::_add_property_info_bind); + ObjectTypeDB::bind_method(_MD("set_favorite_dirs","dirs"),&EditorSettings::set_favorite_dirs); ObjectTypeDB::bind_method(_MD("get_favorite_dirs"),&EditorSettings::get_favorite_dirs); diff --git a/tools/editor/editor_settings.h b/tools/editor/editor_settings.h index 937956a36..2a7d3bb4f 100644 --- a/tools/editor/editor_settings.h +++ b/tools/editor/editor_settings.h @@ -104,6 +104,8 @@ private: Map<String,Ref<ShortCut> > shortcuts; + void _add_property_info_bind(const Dictionary& p_info); + protected: static void _bind_methods(); |
