Added some clean up in camera/viewport management. Fixes #12279, Fixes #12774

This commit is contained in:
Juan Linietsky 2017-12-07 12:13:20 -03:00
parent 5614902611
commit dd892a327d
2 changed files with 8 additions and 4 deletions

View file

@ -191,11 +191,12 @@ void Camera::_update_camera() {
get_viewport()->_camera_transform_changed_notify();
*/
if (is_inside_tree() && is_current()) {
get_viewport()->_camera_transform_changed_notify();
}
if (!is_inside_tree() || get_tree()->is_node_being_edited(this) || !is_current())
return;
if (is_current() && get_world().is_valid()) {
get_viewport()->_camera_transform_changed_notify();
if (get_world().is_valid()) {
get_world()->_update_camera(this);
}
}

View file

@ -936,6 +936,9 @@ void Viewport::_camera_remove(Camera *p_camera) {
cameras.erase(p_camera);
if (camera == p_camera) {
if (camera && find_world().is_valid()) {
camera->notification(Camera::NOTIFICATION_LOST_CURRENT);
}
camera = NULL;
}
}