summaryrefslogtreecommitdiff
path: root/editor/editor_data.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_data.cpp')
-rw-r--r--editor/editor_data.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp
index c12a112fa4..374688f2db 100644
--- a/editor/editor_data.cpp
+++ b/editor/editor_data.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "editor_data.h"
#include "editor_node.h"
@@ -37,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++) {
@@ -47,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
@@ -151,7 +158,7 @@ bool EditorHistory::is_at_end() const {
bool EditorHistory::next() {
- _cleanup_history();
+ cleanup_history();
if ((current + 1) < history.size())
current++;
@@ -163,7 +170,7 @@ bool EditorHistory::next() {
bool EditorHistory::previous() {
- _cleanup_history();
+ cleanup_history();
if (current > 0)
current--;