Object::script may not be a valid Ref<Script>
It appears that Object::script may be a valid ScriptInstance but not be
castable to Ref<Script>. There were only 5 places in the code that made
this assumption. This commit fixes that.
(cherry picked from commit 20b0046945
)
This commit is contained in:
parent
733668074a
commit
0b4dec63a9
|
@ -1330,7 +1330,10 @@ Array Object::_get_incoming_connections() const {
|
|||
void Object::get_signal_list(List<MethodInfo> *p_signals) const {
|
||||
|
||||
if (!script.is_null()) {
|
||||
Ref<Script>(script)->get_script_signal_list(p_signals);
|
||||
Ref<Script> scr = script;
|
||||
if (scr.is_valid()) {
|
||||
scr->get_script_signal_list(p_signals);
|
||||
}
|
||||
}
|
||||
|
||||
ClassDB::get_signal_list(get_class_name(), p_signals);
|
||||
|
|
|
@ -2397,10 +2397,12 @@ void PropertyEditor::_check_reload_status(const String &p_name, TreeItem *item)
|
|||
|
||||
if (!has_reload && !obj->get_script().is_null()) {
|
||||
Ref<Script> scr = obj->get_script();
|
||||
Variant orig_value;
|
||||
if (scr->get_property_default_value(p_name, orig_value)) {
|
||||
if (orig_value != obj->get(p_name)) {
|
||||
has_reload = true;
|
||||
if (scr.is_valid()) {
|
||||
Variant orig_value;
|
||||
if (scr->get_property_default_value(p_name, orig_value)) {
|
||||
if (orig_value != obj->get(p_name)) {
|
||||
has_reload = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3558,11 +3560,13 @@ void PropertyEditor::update_tree() {
|
|||
|
||||
if (!has_reload && !obj->get_script().is_null()) {
|
||||
Ref<Script> scr = obj->get_script();
|
||||
Variant orig_value;
|
||||
if (scr->get_property_default_value(p.name, orig_value)) {
|
||||
if (orig_value != obj->get(p.name)) {
|
||||
item->add_button(1, get_icon("ReloadSmall", "EditorIcons"), 3);
|
||||
has_reload = true;
|
||||
if (scr.is_valid()) {
|
||||
Variant orig_value;
|
||||
if (scr->get_property_default_value(p.name, orig_value)) {
|
||||
if (orig_value != obj->get(p.name)) {
|
||||
item->add_button(1, get_icon("ReloadSmall", "EditorIcons"), 3);
|
||||
has_reload = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3950,9 +3954,11 @@ void PropertyEditor::_edit_button(Object *p_item, int p_column, int p_button) {
|
|||
|
||||
if (!obj->get_script().is_null()) {
|
||||
Ref<Script> scr = obj->get_script();
|
||||
Variant orig_value;
|
||||
if (scr->get_property_default_value(prop, orig_value)) {
|
||||
_edit_set(prop, orig_value);
|
||||
if (scr.is_valid()) {
|
||||
Variant orig_value;
|
||||
if (scr->get_property_default_value(prop, orig_value)) {
|
||||
_edit_set(prop, orig_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2560,7 +2560,7 @@ void Node::_replace_connections_target(Node *p_new_target) {
|
|||
|
||||
if (c.flags & CONNECT_PERSIST) {
|
||||
c.source->disconnect(c.signal, this, c.method);
|
||||
bool valid = p_new_target->has_method(c.method) || p_new_target->get_script().is_null() || Ref<Script>(p_new_target->get_script())->has_method(c.method);
|
||||
bool valid = p_new_target->has_method(c.method) || Ref<Script>(p_new_target->get_script()).is_null() || Ref<Script>(p_new_target->get_script())->has_method(c.method);
|
||||
ERR_EXPLAIN("Attempt to connect signal \'" + c.source->get_class() + "." + c.signal + "\' to nonexistent method \'" + c.target->get_class() + "." + c.method + "\'");
|
||||
ERR_CONTINUE(!valid);
|
||||
c.source->connect(c.signal, p_new_target, c.method, c.binds, c.flags);
|
||||
|
|
Loading…
Reference in New Issue