Merge pull request #73846 from KoBeWi/blind_surveillance
Fix custom viewports in Camera2D
This commit is contained in:
commit
cf68821dd8
1 changed files with 8 additions and 4 deletions
|
@ -414,15 +414,19 @@ Camera2D::Camera2DProcessCallback Camera2D::get_process_callback() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Camera2D::_make_current(Object *p_which) {
|
void Camera2D::_make_current(Object *p_which) {
|
||||||
|
if (!viewport || (custom_viewport && !ObjectDB::get_instance(custom_viewport_id))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (p_which == this) {
|
if (p_which == this) {
|
||||||
if (is_inside_tree()) {
|
if (is_inside_tree()) {
|
||||||
get_viewport()->_camera_2d_set(this);
|
viewport->_camera_2d_set(this);
|
||||||
queue_redraw();
|
queue_redraw();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (is_inside_tree()) {
|
if (is_inside_tree()) {
|
||||||
if (get_viewport()->get_camera_2d() == this) {
|
if (viewport->get_camera_2d() == this) {
|
||||||
get_viewport()->_camera_2d_set(nullptr);
|
viewport->_camera_2d_set(nullptr);
|
||||||
}
|
}
|
||||||
queue_redraw();
|
queue_redraw();
|
||||||
}
|
}
|
||||||
|
@ -449,7 +453,7 @@ void Camera2D::make_current() {
|
||||||
|
|
||||||
void Camera2D::clear_current() {
|
void Camera2D::clear_current() {
|
||||||
ERR_FAIL_COND(!is_current());
|
ERR_FAIL_COND(!is_current());
|
||||||
if (viewport && !(custom_viewport && !ObjectDB::get_instance(custom_viewport_id))) {
|
if (viewport && !(custom_viewport && !ObjectDB::get_instance(custom_viewport_id)) && viewport->is_inside_tree()) {
|
||||||
viewport->assign_next_enabled_camera_2d(group_name);
|
viewport->assign_next_enabled_camera_2d(group_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue