diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2016-08-27 22:04:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-27 22:04:50 +0200 |
commit | c29c70275e127e178c06b4c01f65acac124ba7ca (patch) | |
tree | 8f9070e2477b3d5d89b1cc4bd6e5de38576c3e0b /core/globals.cpp | |
parent | 1b01246731f3733b90e18d1d0ff95120e1f52781 (diff) | |
parent | 038e99e1074111c31d9d73d2d389f73078dcd07e (diff) | |
download | redot-engine-c29c70275e127e178c06b4c01f65acac124ba7ca.tar.gz |
Merge pull request #6187 from TheHX/pr-pinfo-function
Added add_property_info function to Globals and EditorSettings classes
Diffstat (limited to 'core/globals.cpp')
-rw-r--r-- | core/globals.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/core/globals.cpp b/core/globals.cpp index e760bc00d4..3f0edd68f4 100644 --- a/core/globals.cpp +++ b/core/globals.cpp @@ -1375,6 +1375,25 @@ Vector<String> Globals::get_optimizer_presets() const { } +void Globals::_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"]; + + set_custom_property_info(pinfo.name, pinfo); +} + void Globals::set_custom_property_info(const String& p_prop,const PropertyInfo& p_info) { ERR_FAIL_COND(!props.has(p_prop)); @@ -1399,6 +1418,7 @@ void Globals::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_order","name"),&Globals::get_order); ObjectTypeDB::bind_method(_MD("set_persisting","name","enable"),&Globals::set_persisting); ObjectTypeDB::bind_method(_MD("is_persisting","name"),&Globals::is_persisting); + ObjectTypeDB::bind_method(_MD("add_property_info", "hint"),&Globals::_add_property_info_bind); ObjectTypeDB::bind_method(_MD("clear","name"),&Globals::clear); ObjectTypeDB::bind_method(_MD("localize_path","path"),&Globals::localize_path); ObjectTypeDB::bind_method(_MD("globalize_path","path"),&Globals::globalize_path); |