summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro J. Estébanez <pedrojrulez@gmail.com>2017-04-07 15:48:07 +0200
committerPedro J. Estébanez <pedrojrulez@gmail.com>2017-04-07 15:48:07 +0200
commit4b85ddabdaf8314238cfecb1fa74ccb08f5d67d3 (patch)
tree40fd07947b6469f219ee80102cd9a29aed276e9e
parent65f8210e503dd6cc8fdfcae7de5cb7d9a1bed854 (diff)
Reset display folded for an instanced scene if editable children is toggled off
This avoids the display folded flag needlessly getting into the scene file (potentially forever) and also gives more visual feedback if the user re-enables editable children so it will display unfolded at first.
-rwxr-xr-xscene/main/node.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 42e9cec217..6db4eb5640 100755
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -2063,10 +2063,14 @@ void Node::set_editable_instance(Node *p_node, bool p_editable) {
ERR_FAIL_NULL(p_node);
ERR_FAIL_COND(!is_a_parent_of(p_node));
NodePath p = get_path_to(p_node);
- if (!p_editable)
+ if (!p_editable) {
data.editable_instances.erase(p);
- else
+ // Avoid this flag being needlessly saved;
+ // also give more visual feedback if editable children is reenabled
+ set_display_folded(false);
+ } else {
data.editable_instances[p] = true;
+ }
}
bool Node::is_editable_instance(Node *p_node) const {