Fixes #15416 - "The deleted nodes are hanging in the inspector."
This commit is contained in:
parent
37ca542d2b
commit
9d3eb3d2b0
4 changed files with 19 additions and 8 deletions
|
@ -38,7 +38,7 @@
|
||||||
#include "project_settings.h"
|
#include "project_settings.h"
|
||||||
#include "scene/resources/packed_scene.h"
|
#include "scene/resources/packed_scene.h"
|
||||||
|
|
||||||
void EditorHistory::_cleanup_history() {
|
void EditorHistory::cleanup_history() {
|
||||||
|
|
||||||
for (int i = 0; i < history.size(); i++) {
|
for (int i = 0; i < history.size(); i++) {
|
||||||
|
|
||||||
|
@ -48,8 +48,14 @@ void EditorHistory::_cleanup_history() {
|
||||||
if (!history[i].path[j].ref.is_null())
|
if (!history[i].path[j].ref.is_null())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (ObjectDB::get_instance(history[i].path[j].object))
|
Object *obj = ObjectDB::get_instance(history[i].path[j].object);
|
||||||
continue; //has isntance, try next
|
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) {
|
if (j <= history[i].level) {
|
||||||
//before or equal level, complete fail
|
//before or equal level, complete fail
|
||||||
|
@ -152,7 +158,7 @@ bool EditorHistory::is_at_end() const {
|
||||||
|
|
||||||
bool EditorHistory::next() {
|
bool EditorHistory::next() {
|
||||||
|
|
||||||
_cleanup_history();
|
cleanup_history();
|
||||||
|
|
||||||
if ((current + 1) < history.size())
|
if ((current + 1) < history.size())
|
||||||
current++;
|
current++;
|
||||||
|
@ -164,7 +170,7 @@ bool EditorHistory::next() {
|
||||||
|
|
||||||
bool EditorHistory::previous() {
|
bool EditorHistory::previous() {
|
||||||
|
|
||||||
_cleanup_history();
|
cleanup_history();
|
||||||
|
|
||||||
if (current > 0)
|
if (current > 0)
|
||||||
current--;
|
current--;
|
||||||
|
|
|
@ -70,11 +70,11 @@ class EditorHistory {
|
||||||
Variant value;
|
Variant value;
|
||||||
};
|
};
|
||||||
|
|
||||||
void _cleanup_history();
|
|
||||||
|
|
||||||
void _add_object(ObjectID p_object, const String &p_property, int p_level_change);
|
void _add_object(ObjectID p_object, const String &p_property, int p_level_change);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
void cleanup_history();
|
||||||
|
|
||||||
bool is_at_beginning() const;
|
bool is_at_beginning() const;
|
||||||
bool is_at_end() const;
|
bool is_at_end() const;
|
||||||
|
|
||||||
|
|
|
@ -1398,7 +1398,7 @@ void EditorNode::_property_editor_forward() {
|
||||||
}
|
}
|
||||||
void EditorNode::_property_editor_back() {
|
void EditorNode::_property_editor_back() {
|
||||||
|
|
||||||
if (editor_history.previous())
|
if (editor_history.previous() || editor_history.get_path_size() == 1)
|
||||||
_edit_current();
|
_edit_current();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1285,6 +1285,11 @@ void SceneTreeDock::_delete_confirm() {
|
||||||
editor->get_viewport_control()->update();
|
editor->get_viewport_control()->update();
|
||||||
|
|
||||||
editor->push_item(NULL);
|
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() {
|
void SceneTreeDock::_selection_changed() {
|
||||||
|
|
Loading…
Reference in a new issue