From dbcf969fbf9d10910904a190c315db89cf40a2e2 Mon Sep 17 00:00:00 2001 From: Ignacio Etcheverry Date: Tue, 12 Apr 2016 18:21:37 +0200 Subject: [PATCH] Keep editable instances data when replacing tree root node (cherry picked from commit 3029f5ee02483021aadd5d5bc48becb2490791f1) --- scene/main/node.cpp | 10 ++++++++++ scene/main/node.h | 2 ++ tools/editor/scene_tree_dock.cpp | 1 + 3 files changed, 13 insertions(+) diff --git a/scene/main/node.cpp b/scene/main/node.cpp index b90edb38b22..f4c41256db1 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -1374,6 +1374,16 @@ bool Node::is_editable_instance(Node *p_node) const { return data.editable_instances.has(p); } +void Node::set_editable_instances(const HashMap& p_editable_instances) { + + data.editable_instances=p_editable_instances; +} + +HashMap Node::get_editable_instances() const { + + return data.editable_instances; +} + #if 0 diff --git a/scene/main/node.h b/scene/main/node.h index 5c6147d644f..560a2e588a5 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -239,6 +239,8 @@ public: void set_editable_instance(Node* p_node,bool p_editable); bool is_editable_instance(Node* p_node) const; + void set_editable_instances(const HashMap& p_editable_instances); + HashMap get_editable_instances() const; /* NOTIFICATIONS */ diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp index 5877ce1a436..37a316ae9c8 100644 --- a/tools/editor/scene_tree_dock.cpp +++ b/tools/editor/scene_tree_dock.cpp @@ -1318,6 +1318,7 @@ void SceneTreeDock::_create() { if (n==edited_scene) { edited_scene=newnode; editor->set_edited_scene(newnode); + newnode->set_editable_instances(n->get_editable_instances()); } //small hack to make collisionshapes and other kind of nodes to work