Merge pull request #49109 from Chaosus/fix_console_errors

Fixed console error spam at editor startup (about invalid edited scene index)
This commit is contained in:
Rémi Verschelde 2021-05-26 20:36:30 +02:00 committed by GitHub
commit bfcb1d2d41
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 4 deletions

View file

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

View file

@ -4380,7 +4380,7 @@ void CanvasItemEditor::_update_scrollbars() {
// Calculate scrollable area.
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());
canvas_item_rect.expand_to(content_rect.position);
canvas_item_rect.expand_to(content_rect.position + content_rect.size);

View file

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