From 9d571d8eacb07e1b96de049feca976b3309cd21d Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Fri, 22 Jan 2016 18:54:43 -0300 Subject: [PATCH] -Fix viewport converting the scren in grayness, fixes #3406 --- scene/main/viewport.cpp | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 5e8868c3267..9297d49e2bf 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -331,20 +331,24 @@ void Viewport::_notification(int p_what) { } } + + parent=NULL; + Node *parent_node=get_parent(); + + + while(parent_node) { + + parent = parent_node->cast_to(); + if (parent) + break; + + parent_node=parent_node->get_parent(); + } + + if (!render_target) _vp_enter_tree(); - this->parent=NULL; - Node *parent=get_parent(); - - if (parent) { - - - while(parent && !(this->parent=parent->cast_to())) { - - parent=parent->get_parent(); - } - } current_canvas=find_world_2d()->get_canvas(); VisualServer::get_singleton()->viewport_set_scenario(viewport,find_world()->get_scenario());