Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Camera2D gizmos when screen size changes #92992

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions scene/2d/camera_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ void Camera2D::_update_scroll() {
}
}

#ifdef TOOLS_ENABLED
void Camera2D::_project_settings_changed() {
if (screen_drawing_enabled) {
queue_redraw();
}
}
#endif

void Camera2D::_update_process_callback() {
if (is_physics_interpolated_and_enabled()) {
set_process_internal(is_current());
Expand Down Expand Up @@ -267,6 +275,14 @@ void Camera2D::_ensure_update_interpolation_data() {

void Camera2D::_notification(int p_what) {
switch (p_what) {
#ifdef TOOLS_ENABLED
case NOTIFICATION_READY: {
if (Engine::get_singleton()->is_editor_hint() && is_part_of_edited_scene()) {
ProjectSettings::get_singleton()->connect(SNAME("settings_changed"), callable_mp(this, &Camera2D::_project_settings_changed));
}
} break;
#endif

case NOTIFICATION_INTERNAL_PROCESS: {
_update_scroll();
} break;
Expand Down
3 changes: 3 additions & 0 deletions scene/2d/camera_2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ class Camera2D : public Node2D {
bool _is_editing_in_editor() const;
void _update_process_callback();
void _update_scroll();
#ifdef TOOLS_ENABLED
void _project_settings_changed();
#endif

void _make_current(Object *p_which);
void _reset_just_exited() { just_exited_tree = false; }
Expand Down
Loading