diff options
Diffstat (limited to 'core/object.cpp')
-rw-r--r-- | core/object.cpp | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/core/object.cpp b/core/object.cpp index 07ac430d7a..f6ba76a0b5 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -314,6 +314,7 @@ void Object::set(const StringName& p_name, const Variant& p_value, bool *r_valid _edited=true; #endif + if (script_instance) { if (script_instance->set(p_name,p_value)) { @@ -326,9 +327,9 @@ void Object::set(const StringName& p_name, const Variant& p_value, bool *r_valid //try built-in setgetter { - if (ObjectTypeDB::set_property(this,p_name,p_value)) { - if (r_valid) - *r_valid=true; + if (ObjectTypeDB::set_property(this,p_name,p_value,r_valid)) { + //if (r_valid) + // *r_valid=true; return; } } @@ -970,7 +971,10 @@ void Object::set_script_instance(ScriptInstance *p_instance) { script_instance=p_instance; - script=p_instance->get_script().get_ref_ptr(); + if (p_instance) + script=p_instance->get_script().get_ref_ptr(); + else + script=RefPtr(); } RefPtr Object::get_script() const { @@ -1401,6 +1405,10 @@ bool Object::is_connected(const StringName& p_signal, Object *p_to_object, const bool signal_is_valid = ObjectTypeDB::has_signal(get_type_name(),p_signal); if (signal_is_valid) return false; + + if (!script.is_null() && Ref<Script>(script)->has_script_signal(p_signal)) + return false; + ERR_EXPLAIN("Nonexistent signal: "+p_signal); ERR_FAIL_COND_V(!s,false); } @@ -1691,6 +1699,26 @@ void Object::get_translatable_strings(List<String> *p_strings) const { } +Variant::Type Object::get_static_property_type(const StringName& p_property, bool *r_valid) const { + + bool valid; + Variant::Type t = ObjectTypeDB::get_property_type(get_type_name(),p_property,&valid); + if (valid) { + if (r_valid) + *r_valid=true; + return t; + } + + if (get_script_instance()) { + return get_script_instance()->get_property_type(p_property,r_valid); + } + if (r_valid) + *r_valid=false; + + return Variant::NIL; + +} + bool Object::is_queued_for_deletion() const { return _is_queued_for_deletion; } |