Fix resources being skipped in InstancePlaceholder
This commit is contained in:
parent
97b8ad1af0
commit
260c05152d
|
@ -161,12 +161,12 @@ void InstancePlaceholder::set_value_on_instance(InstancePlaceholder *p_placehold
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (current_type) {
|
switch (current_type) {
|
||||||
case Variant::Type::NIL:
|
case Variant::Type::NIL: {
|
||||||
if (placeholder_type != Variant::Type::NODE_PATH) {
|
Ref<Resource> resource = p_set.value;
|
||||||
|
if (placeholder_type != Variant::Type::NODE_PATH && !resource.is_valid()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// If it's nil but we have a NodePath, we guess what works.
|
// If it's nil but we have a NodePath or a Resource, we guess what works.
|
||||||
|
|
||||||
p_instance->set(p_set.name, p_set.value, &is_valid);
|
p_instance->set(p_set.name, p_set.value, &is_valid);
|
||||||
if (is_valid) {
|
if (is_valid) {
|
||||||
break;
|
break;
|
||||||
|
@ -174,13 +174,15 @@ void InstancePlaceholder::set_value_on_instance(InstancePlaceholder *p_placehold
|
||||||
|
|
||||||
p_instance->set(p_set.name, try_get_node(p_placeholder, p_instance, p_set.value), &is_valid);
|
p_instance->set(p_set.name, try_get_node(p_placeholder, p_instance, p_set.value), &is_valid);
|
||||||
break;
|
break;
|
||||||
case Variant::Type::OBJECT:
|
}
|
||||||
|
case Variant::Type::OBJECT: {
|
||||||
if (placeholder_type != Variant::Type::NODE_PATH) {
|
if (placeholder_type != Variant::Type::NODE_PATH) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Easiest case, we want a node, but we have a deferred NodePath.
|
// Easiest case, we want a node, but we have a deferred NodePath.
|
||||||
p_instance->set(p_set.name, try_get_node(p_placeholder, p_instance, p_set.value));
|
p_instance->set(p_set.name, try_get_node(p_placeholder, p_instance, p_set.value));
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case Variant::Type::ARRAY: {
|
case Variant::Type::ARRAY: {
|
||||||
// If we have reached here it means our array types don't match,
|
// If we have reached here it means our array types don't match,
|
||||||
// so we will convert the placeholder array into the correct type
|
// so we will convert the placeholder array into the correct type
|
||||||
|
@ -209,9 +211,10 @@ void InstancePlaceholder::set_value_on_instance(InstancePlaceholder *p_placehold
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default: {
|
||||||
WARN_PRINT(vformat("Property '%s' with type '%s' could not be set when creating instance of '%s'.", p_set.name, Variant::get_type_name(current_type), p_placeholder->get_name()));
|
WARN_PRINT(vformat("Property '%s' with type '%s' could not be set when creating instance of '%s'.", p_set.name, Variant::get_type_name(current_type), p_placeholder->get_name()));
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue