Reset follow mode focus count on selection change

This commit is contained in:
ryevdokimov 2026-03-08 03:16:13 -04:00
parent 220b0b2f74
commit 005a661bd0
2 changed files with 9 additions and 0 deletions

View file

@ -3965,6 +3965,13 @@ void Node3DEditorViewport::_disable_follow_mode() {
times_focused_consecutively = 0;
}
void Node3DEditorViewport::_reset_follow_mode_count() {
bool is_in_follow_mode = times_focused_consecutively >= 2 && times_focused_consecutively % 2 == 0;
if (!is_in_follow_mode) {
times_focused_consecutively = 0;
}
}
void Node3DEditorViewport::_toggle_camera_preview(bool p_activate) {
ERR_FAIL_COND(p_activate && !preview);
ERR_FAIL_COND(!p_activate && !previewing);
@ -5731,6 +5738,7 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, int p
index = p_index;
editor_selection = EditorNode::get_singleton()->get_editor_selection();
editor_selection->connect("selection_changed", callable_mp(this, &Node3DEditorViewport::_reset_follow_mode_count));
message_time = 0;
zoom_indicator_delay = 0.0;

View file

@ -409,6 +409,7 @@ private:
void _preview_camera_property_changed();
void _update_centered_labels();
void _disable_follow_mode();
void _reset_follow_mode_count();
void _toggle_camera_preview(bool);
void _toggle_cinema_preview(bool);
void _init_gizmo_instance(int p_idx);