diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/object_type_db.cpp | 34 | ||||
-rw-r--r-- | core/object_type_db.h | 2 | ||||
-rw-r--r-- | core/resource.cpp | 5 |
3 files changed, 39 insertions, 2 deletions
diff --git a/core/object_type_db.cpp b/core/object_type_db.cpp index 208782cc4c..babbb6b8ad 100644 --- a/core/object_type_db.cpp +++ b/core/object_type_db.cpp @@ -957,6 +957,40 @@ Variant::Type ClassDB::get_property_type(const StringName& p_class, const String } +StringName ClassDB::get_property_setter(StringName p_class,const StringName p_property) { + + ClassInfo *type=classes.getptr(p_class); + ClassInfo *check=type; + while(check) { + const PropertySetGet *psg = check->property_setget.getptr(p_property); + if (psg) { + + return psg->setter; + } + + check=check->inherits_ptr; + } + + return StringName(); +} + +StringName ClassDB::get_property_getter(StringName p_class,const StringName p_property) { + + ClassInfo *type=classes.getptr(p_class); + ClassInfo *check=type; + while(check) { + const PropertySetGet *psg = check->property_setget.getptr(p_property); + if (psg) { + + return psg->getter; + } + + check=check->inherits_ptr; + } + + return StringName(); +} + 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 6371011577..aebe767028 100644 --- a/core/object_type_db.h +++ b/core/object_type_db.h @@ -482,6 +482,8 @@ public: 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 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); diff --git a/core/resource.cpp b/core/resource.cpp index ba330c758f..a503e965b0 100644 --- a/core/resource.cpp +++ b/core/resource.cpp @@ -302,8 +302,9 @@ void Resource::_bind_methods() { ClassDB::bind_method(_MD("duplicate","subresources"),&Resource::duplicate,DEFVAL(false)); ADD_SIGNAL( MethodInfo("changed") ); - ADD_PROPERTY( PropertyInfo(Variant::STRING,"resource/path",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_EDITOR ), _SCS("set_path"),_SCS("get_path")); - ADD_PROPERTYNZ( PropertyInfo(Variant::STRING,"resource/name"), _SCS("set_name"),_SCS("get_name")); + ADD_GROUP("Resource","resource_"); + ADD_PROPERTY( PropertyInfo(Variant::STRING,"resource_path",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_EDITOR ), _SCS("set_path"),_SCS("get_path")); + ADD_PROPERTYNZ( PropertyInfo(Variant::STRING,"resource_name"), _SCS("set_name"),_SCS("get_name")); } RID Resource::get_rid() const { |