diff options
| author | Ignacio Etcheverry | 2017-08-06 02:04:10 +0200 |
|---|---|---|
| committer | Ignacio Etcheverry | 2017-08-06 02:04:10 +0200 |
| commit | aee99ab59ff73f54dcf834d870432a62f17ccc82 (patch) | |
| tree | f69a8a64e7751eedce154c3fe87d44ff1e591712 /core/class_db.cpp | |
| parent | 3b2dfae5af9759da31516de25fcae12001092bb0 (diff) | |
| download | godot-aee99ab59ff73f54dcf834d870432a62f17ccc82.tar.gz godot-aee99ab59ff73f54dcf834d870432a62f17ccc82.tar.zst godot-aee99ab59ff73f54dcf834d870432a62f17ccc82.zip | |
Diffstat (limited to 'core/class_db.cpp')
| -rw-r--r-- | core/class_db.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/core/class_db.cpp b/core/class_db.cpp index 6b8c290a9..24d71f86b 100644 --- a/core/class_db.cpp +++ b/core/class_db.cpp @@ -937,6 +937,28 @@ bool ClassDB::get_property(Object *p_object, const StringName &p_property, Varia return false; } +int ClassDB::get_property_index(const StringName &p_class, const StringName &p_property, bool *r_is_valid) { + + ClassInfo *type = classes.getptr(p_class); + ClassInfo *check = type; + while (check) { + const PropertySetGet *psg = check->property_setget.getptr(p_property); + if (psg) { + + if (r_is_valid) + *r_is_valid = true; + + return psg->index; + } + + check = check->inherits_ptr; + } + if (r_is_valid) + *r_is_valid = false; + + return -1; +} + Variant::Type ClassDB::get_property_type(const StringName &p_class, const StringName &p_property, bool *r_is_valid) { ClassInfo *type = classes.getptr(p_class); |
