aboutsummaryrefslogtreecommitdiff
path: root/core/globals.cpp
diff options
context:
space:
mode:
authorFranklin Sobrinho2016-08-16 17:10:53 -0300
committerRémi Verschelde2016-09-01 08:40:49 +0200
commit5f9e6d2b48ee4b76eb145c92de8a581bcf38c6a8 (patch)
treec0b8ca49923554d0f3828f3fd80865b5492da751 /core/globals.cpp
parent6327fc47c88fa1cb5d104122e1c5245325ee15fa (diff)
downloadgodot-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 'core/globals.cpp')
-rw-r--r--core/globals.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/core/globals.cpp b/core/globals.cpp
index e760bc00d..3f0edd68f 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);