summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-01-08 14:28:25 +0100
committerGitHub <noreply@github.com>2018-01-08 14:28:25 +0100
commit8f4140c9c1d9c1e28da27f56cddf5b1e541956c6 (patch)
treeb6077c90110c33d11456ea12ded618a93020f27a /editor
parent11cc70381055d0b1a37bf4f62c9931bd8ce179b7 (diff)
parent9d3eb3d2b04647d8132807d6d5c733e3b79b7c9c (diff)
Merge pull request #15480 from StateOff/fixes_deleted_nodes_in_history
Fixes #15416 - "The deleted nodes are hanging in the inspector."
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_data.cpp16
-rw-r--r--editor/editor_data.h4
-rw-r--r--editor/editor_node.cpp2
-rw-r--r--editor/scene_tree_dock.cpp5
4 files changed, 19 insertions, 8 deletions
diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp
index 9e8521e0fe..374688f2db 100644
--- a/editor/editor_data.cpp
+++ b/editor/editor_data.cpp
@@ -38,7 +38,7 @@
#include "project_settings.h"
#include "scene/resources/packed_scene.h"
-void EditorHistory::_cleanup_history() {
+void EditorHistory::cleanup_history() {
for (int i = 0; i < history.size(); i++) {
@@ -48,8 +48,14 @@ void EditorHistory::_cleanup_history() {
if (!history[i].path[j].ref.is_null())
continue;
- if (ObjectDB::get_instance(history[i].path[j].object))
- continue; //has isntance, try next
+ Object *obj = ObjectDB::get_instance(history[i].path[j].object);
+ if (obj) {
+ Node *n = Object::cast_to<Node>(obj);
+ if (n && n->is_inside_tree())
+ continue;
+ if (!n) // Possibly still alive
+ continue;
+ }
if (j <= history[i].level) {
//before or equal level, complete fail
@@ -152,7 +158,7 @@ bool EditorHistory::is_at_end() const {
bool EditorHistory::next() {
- _cleanup_history();
+ cleanup_history();
if ((current + 1) < history.size())
current++;
@@ -164,7 +170,7 @@ bool EditorHistory::next() {
bool EditorHistory::previous() {
- _cleanup_history();
+ cleanup_history();
if (current > 0)
current--;
diff --git a/editor/editor_data.h b/editor/editor_data.h
index eacde04134..844145853d 100644
--- a/editor/editor_data.h
+++ b/editor/editor_data.h
@@ -70,11 +70,11 @@ class EditorHistory {
Variant value;
};
- void _cleanup_history();
-
void _add_object(ObjectID p_object, const String &p_property, int p_level_change);
public:
+ void cleanup_history();
+
bool is_at_beginning() const;
bool is_at_end() const;
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index f480883867..2b62faf218 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -1398,7 +1398,7 @@ void EditorNode::_property_editor_forward() {
}
void EditorNode::_property_editor_back() {
- if (editor_history.previous())
+ if (editor_history.previous() || editor_history.get_path_size() == 1)
_edit_current();
}
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index 1f732992d5..d8d44a635a 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -1285,6 +1285,11 @@ void SceneTreeDock::_delete_confirm() {
editor->get_viewport_control()->update();
editor->push_item(NULL);
+
+ // Fixes the EditorHistory from still offering deleted notes
+ EditorHistory *editor_history = EditorNode::get_singleton()->get_editor_history();
+ editor_history->cleanup_history();
+ EditorNode::get_singleton()->call("_prepare_history");
}
void SceneTreeDock::_selection_changed() {