Skip to content

Commit

Permalink
Fixed export var default value in PackedScene when script is not load…
Browse files Browse the repository at this point in the history
…ed in editor

(cherry picked from commit 4e14eef)
  • Loading branch information
pouleyKetchoupp authored and akien-mga committed Feb 22, 2021
1 parent 54eabaa commit cefaa6f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scene/resources/packed_scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,11 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map
p_node->get_property_list(&plist);
StringName type = p_node->get_class();

Ref<Script> script = p_node->get_script();
if (script.is_valid()) {
script->update_exports();
}

for (List<PropertyInfo>::Element *E = plist.front(); E; E = E->next()) {

if (!(E->get().usage & PROPERTY_USAGE_STORAGE)) {
Expand All @@ -497,7 +502,6 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map
isdefault = bool(Variant::evaluate(Variant::OP_EQUAL, value, default_value));
}

Ref<Script> script = p_node->get_script();
if (!isdefault && script.is_valid() && script->get_property_default_value(name, default_value)) {
isdefault = bool(Variant::evaluate(Variant::OP_EQUAL, value, default_value));
}
Expand Down

0 comments on commit cefaa6f

Please sign in to comment.