summaryrefslogtreecommitdiff
path: root/scene/resources/packed_scene.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-06-29 00:29:49 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-06-29 00:29:49 -0300
commit95047562d743b1c1fdc007432c8a0c145a455c5d (patch)
treef563e5c900c4330fcc602b6e5a721bc63022b253 /scene/resources/packed_scene.cpp
parent2b64f73b0459190d20b2f6de39275ee7979317c4 (diff)
Several performance improvements, mainly in loading and instancing scenes and resources.
A general speedup should be apparent, with even more peformance increase when compiling optimized. WARNING: Tested and it seems to work, but if something breaks, please report.
Diffstat (limited to 'scene/resources/packed_scene.cpp')
-rw-r--r--scene/resources/packed_scene.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp
index a1cb1205e5..b6082c3a76 100644
--- a/scene/resources/packed_scene.cpp
+++ b/scene/resources/packed_scene.cpp
@@ -53,7 +53,7 @@ Node *PackedScene::instance(bool p_gen_edit_state) const {
if (prop_count)
props=&variants[0];
- Vector<Variant> properties;
+ //Vector<Variant> properties;
const NodeData *nd = &nodes[0];
@@ -257,10 +257,13 @@ Error PackedScene::_parse_node(Node *p_owner,Node *p_node,int p_parent_idx, Map<
String name = E->get().name;
Variant value = p_node->get( E->get().name );
- if (E->get().usage & PROPERTY_USAGE_STORE_IF_NONZERO && value.is_zero()) {
+ if (nd.instance<0 && ((E->get().usage & PROPERTY_USAGE_STORE_IF_NONZERO) && value.is_zero()) || ((E->get().usage & PROPERTY_USAGE_STORE_IF_NONONE) && value.is_one())) {
continue;
}
+ print_line("PASSED!");
+ print_line("at: "+String(p_node->get_name())+"::"+name+": - nz: "+itos(E->get().usage&PROPERTY_USAGE_STORE_IF_NONZERO)+" no: "+itos(E->get().usage&PROPERTY_USAGE_STORE_IF_NONONE));
+ print_line("value: "+String(value)+" is zero: "+itos(value.is_zero())+" is one" +itos(value.is_one()));
if (nd.instance>=0) {
//only save changed properties in instance
@@ -278,7 +281,7 @@ Error PackedScene::_parse_node(Node *p_owner,Node *p_node,int p_parent_idx, Map<
continue;
}
- if (instance_state[name]==value) {
+ if (instance_state.has(name) && instance_state[name]==value) {
continue;
}