diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-01-18 12:30:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-18 12:30:38 +0100 |
commit | 5496174dd40b61a6cfb7d55639820703480846b7 (patch) | |
tree | 63de579f9f64a2a76de42de7edfde18ddb8281c7 /scene | |
parent | 16fa4201f1c2f3b46c63e6d9933333e97354c753 (diff) | |
parent | 05f29b16b62bd71148f4144a4f1a6b8399501b8f (diff) |
Merge pull request #45265 from KoBeWi/children_editing_2077
Change how editable children data is stored
Diffstat (limited to 'scene')
-rw-r--r-- | scene/main/node.cpp | 18 | ||||
-rw-r--r-- | scene/main/node.h | 5 |
2 files changed, 5 insertions, 18 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 1b6f73efe1..6a1b896b04 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -1920,32 +1920,22 @@ String Node::get_editor_description() const { 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) { - data.editable_instances.erase(p); + p_node->data.editable_instance = false; // Avoid this flag being needlessly saved; // also give more visual feedback if editable children is re-enabled set_display_folded(false); } else { - data.editable_instances[p] = true; + p_node->data.editable_instance = true; } } bool Node::is_editable_instance(const Node *p_node) const { if (!p_node) { - return false; //easier, null is never editable :) + return false; // Easier, null is never editable. :) } ERR_FAIL_COND_V(!is_a_parent_of(p_node), false); - NodePath p = get_path_to(p_node); - return data.editable_instances.has(p); -} - -void Node::set_editable_instances(const HashMap<NodePath, int> &p_editable_instances) { - data.editable_instances = p_editable_instances; -} - -HashMap<NodePath, int> Node::get_editable_instances() const { - return data.editable_instances; + return p_node->data.editable_instance; } void Node::set_scene_instance_state(const Ref<SceneState> &p_state) { diff --git a/scene/main/node.h b/scene/main/node.h index fc7590c5a4..a0dca75791 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -88,8 +88,6 @@ private: Ref<SceneState> instance_state; Ref<SceneState> inherited_state; - HashMap<NodePath, int> editable_instances; - Node *parent = nullptr; Node *owner = nullptr; Vector<Node *> children; @@ -136,6 +134,7 @@ private: bool use_placeholder = false; bool display_folded = false; + bool editable_instance = false; mutable NodePath *path_cache = nullptr; @@ -325,8 +324,6 @@ public: void set_editable_instance(Node *p_node, bool p_editable); bool is_editable_instance(const Node *p_node) const; - void set_editable_instances(const HashMap<NodePath, int> &p_editable_instances); - HashMap<NodePath, int> get_editable_instances() const; /* NOTIFICATIONS */ |