diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-01-04 17:37:45 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-01-04 17:37:45 -0300 |
commit | 9e477babb3bf0ce5179395c2a5155a3f3cd36798 (patch) | |
tree | 5246a7c0bc09580f60ea17b694aacc9cd8da8731 /core | |
parent | 76c2e8583e70e8c976a306e77a40e8e7226aa249 (diff) |
-GDScript support for accessing properties directly
-Added code lookup and code completion support for properties too
Diffstat (limited to 'core')
-rw-r--r-- | core/object_type_db.cpp | 16 | ||||
-rw-r--r-- | core/object_type_db.h | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/core/object_type_db.cpp b/core/object_type_db.cpp index babbb6b8ad..94cc865b62 100644 --- a/core/object_type_db.cpp +++ b/core/object_type_db.cpp @@ -991,6 +991,22 @@ StringName ClassDB::get_property_getter(StringName p_class,const StringName p_pr return StringName(); } +bool ClassDB::has_property(const StringName& p_class, const StringName& p_property, bool p_no_inheritance) { + + + ClassInfo *type=classes.getptr(p_class); + ClassInfo *check=type; + while(check) { + if (check->property_setget.has(p_property)) + return true; + + if (p_no_inheritance) + break; + check=check->inherits_ptr; + } + + return false; +} void ClassDB::set_method_flags(StringName p_class,StringName p_method,int p_flags) { diff --git a/core/object_type_db.h b/core/object_type_db.h index aebe767028..3613d351e4 100644 --- a/core/object_type_db.h +++ b/core/object_type_db.h @@ -481,6 +481,7 @@ public: static void get_property_list(StringName p_class, List<PropertyInfo> *p_list, bool p_no_inheritance=false, const Object *p_validator=NULL); static bool set_property(Object* p_object, const StringName& p_property, const Variant& p_value, bool *r_valid=NULL); static bool get_property(Object* p_object,const StringName& p_property, Variant& r_value); + static bool has_property(const StringName& p_class,const StringName& p_property,bool p_no_inheritance=false); static Variant::Type get_property_type(const StringName& p_class, const StringName& p_property,bool *r_is_valid=NULL); static StringName get_property_setter(StringName p_class,const StringName p_property); static StringName get_property_getter(StringName p_class,const StringName p_property); |