Browse Source

Fixed console error spam (about invalid edited scene index)

Yuri Roubinsky 4 years ago
parent
commit
af3f047f49

+ 1 - 1
editor/editor_inspector.cpp

@@ -1626,7 +1626,7 @@ void EditorInspector::update_tree() {
 
 
 	bool draw_red = false;
 	bool draw_red = false;
 
 
-	{
+	if (is_inside_tree()) {
 		Node *nod = Object::cast_to<Node>(object);
 		Node *nod = Object::cast_to<Node>(object);
 		Node *es = EditorNode::get_singleton()->get_edited_scene();
 		Node *es = EditorNode::get_singleton()->get_edited_scene();
 		if (nod && es != nod && nod->get_owner() != es) {
 		if (nod && es != nod && nod->get_owner() != es) {

+ 1 - 1
editor/plugins/canvas_item_editor_plugin.cpp

@@ -4380,7 +4380,7 @@ void CanvasItemEditor::_update_scrollbars() {
 
 
 	// Calculate scrollable area.
 	// Calculate scrollable area.
 	Rect2 canvas_item_rect = Rect2(Point2(), screen_rect);
 	Rect2 canvas_item_rect = Rect2(Point2(), screen_rect);
-	if (editor->get_edited_scene()) {
+	if (editor->is_inside_tree() && editor->get_edited_scene()) {
 		Rect2 content_rect = _get_encompassing_rect(editor->get_edited_scene());
 		Rect2 content_rect = _get_encompassing_rect(editor->get_edited_scene());
 		canvas_item_rect.expand_to(content_rect.position);
 		canvas_item_rect.expand_to(content_rect.position);
 		canvas_item_rect.expand_to(content_rect.position + content_rect.size);
 		canvas_item_rect.expand_to(content_rect.position + content_rect.size);

+ 4 - 2
editor/plugins/script_editor_plugin.cpp

@@ -1504,8 +1504,10 @@ void ScriptEditor::_notification(int p_what) {
 
 
 			recent_scripts->set_as_minsize();
 			recent_scripts->set_as_minsize();
 
 
-			_update_script_colors();
-			_update_script_names();
+			if (is_inside_tree()) {
+				_update_script_colors();
+				_update_script_names();
+			}
 		} break;
 		} break;
 
 
 		case NOTIFICATION_READY: {
 		case NOTIFICATION_READY: {