diff options
Diffstat (limited to 'scene/resources/packed_scene.cpp')
-rw-r--r-- | scene/resources/packed_scene.cpp | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index 9bb2a4ddb8..eddbb9a842 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -206,8 +206,8 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const { node->set(snames[nprops[j].name], props[nprops[j].value], &valid); //restore old state for new script, if exists - for (List<Pair<StringName, Variant>>::Element *E = old_state.front(); E; E = E->next()) { - node->set(E->get().first, E->get().second); + for (const Pair<StringName, Variant> &E : old_state) { + node->set(E.first, E.second); } } else { Variant value = props[nprops[j].value]; @@ -477,13 +477,13 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map script->update_exports(); } - for (List<PropertyInfo>::Element *E = plist.front(); E; E = E->next()) { - if (!(E->get().usage & PROPERTY_USAGE_STORAGE)) { + for (const PropertyInfo &E : plist) { + if (!(E.usage & PROPERTY_USAGE_STORAGE)) { continue; } - String name = E->get().name; - Variant value = p_node->get(E->get().name); + String name = E.name; + Variant value = p_node->get(E.name); bool isdefault = false; Variant default_value = ClassDB::class_get_default_property_value(type, name); @@ -497,7 +497,7 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map } // the version above makes more sense, because it does not rely on placeholder or usage flag // in the script, just the default value function. - // if (E->get().usage & PROPERTY_USAGE_SCRIPT_DEFAULT_VALUE) { + // if (E.usage & PROPERTY_USAGE_SCRIPT_DEFAULT_VALUE) { // isdefault = true; //is script default value // } @@ -507,7 +507,7 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map // only save what has been changed // only save changed properties in instance - if ((E->get().usage & PROPERTY_USAGE_NO_INSTANCE_STATE) || E->get().name == "__meta__") { + if ((E.usage & PROPERTY_USAGE_NO_INSTANCE_STATE) || E.name == "__meta__") { //property has requested that no instance state is saved, sorry //also, meta won't be overridden or saved continue; @@ -520,7 +520,7 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map //check all levels of pack to see if the property exists somewhere const PackState &ps = F->get(); - original = ps.state->get_property_value(ps.node, E->get().name, exists); + original = ps.state->get_property_value(ps.node, E.name, exists); if (exists) { break; } @@ -565,9 +565,7 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map List<Node::GroupInfo> groups; p_node->get_groups(&groups); - for (List<Node::GroupInfo>::Element *E = groups.front(); E; E = E->next()) { - Node::GroupInfo &gi = E->get(); - + for (const Node::GroupInfo &gi : groups) { if (!gi.persistent) { continue; } @@ -577,9 +575,9 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map */ bool skip = false; - for (List<PackState>::Element *F = pack_state_stack.front(); F; F = F->next()) { + for (const PackState &F : pack_state_stack) { //check all levels of pack to see if the group was added somewhere - const PackState &ps = F->get(); + const PackState &ps = F; if (ps.state->is_node_in_group(ps.node, gi.name)) { skip = true; break; @@ -679,14 +677,14 @@ Error SceneState::_parse_connections(Node *p_owner, Node *p_node, Map<StringName //ERR_FAIL_COND_V( !node_map.has(p_node), ERR_BUG); //NodeData &nd = nodes[node_map[p_node]]; - for (List<MethodInfo>::Element *E = _signals.front(); E; E = E->next()) { + for (const MethodInfo &E : _signals) { List<Node::Connection> conns; - p_node->get_signal_connection_list(E->get().name, &conns); + p_node->get_signal_connection_list(E.name, &conns); conns.sort(); - for (List<Node::Connection>::Element *F = conns.front(); F; F = F->next()) { - const Node::Connection &c = F->get(); + for (const Node::Connection &F : conns) { + const Node::Connection &c = F; if (!(c.flags & CONNECT_PERSIST)) { //only persistent connections get saved continue; |