fix: fit backdrops on navigation instead of forcing 100% zoom - #64
Merged
Merged
Conversation
navigate_to_backdrop() called nuke.zoom(1.0, center), which jumps to an absolute 100% zoom scale regardless of backdrop size. Large backdrops were therefore zoomed in too far, while small ones happened to look fine — the inconsistent "sometimes" framing reported during UAT. Select the backdrop and use nuke.zoomToFitSelected() instead, so the zoom scale adapts to the backdrop's size (matching what selecting the backdrop and running zoomToFitSelected() in the Script Editor does). The old docstring's reason for avoiding zoomToFitSelected (root-DAG vs group panel targeting) is obsolete: navigation is dispatched after the picker closes via QTimer.singleShot, so the focused panel is already active — the same path navigate_to_anchor relies on. Tests: navigate_to_backdrop test now asserts zoomToFitSelected() is called; added a regression test asserting no absolute zoom scale is set.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Navigating to a backdrop with Alt+A zoomed in too far on large backdrops, while small ones looked fine — an inconsistent "sometimes" framing. Selecting the same backdrop and running
zoomToFitSelected()in the Script Editor framed it correctly.This is a pre-existing bug, independent of the #61 / #62 / #63 module-margin work.
Root cause
navigate_to_backdrop()callednuke.zoom(1.0, [center_x, center_y]). The first argument is an absolute zoom scale (100% — one node-grid unit per screen pixel), not a fit. So it always jumped to 100% regardless of backdrop size:The center math was correct; only the hardcoded scale was wrong.
Fix
Select the backdrop and call
nuke.zoomToFitSelected(), so the scale adapts to the backdrop's size — the same thing that works from the Script Editor.The old docstring justified avoiding
zoomToFitSelected()to target a Group's internal DAG panel rather than the root DAG. That reasoning is obsolete: navigation is dispatched after the picker closes viaQtCore.QTimer.singleShot(_anchor_navigate_invoke), so the focused panel is already active — the exact pathnavigate_to_anchor()already uses withzoomToFitSelected().Tests
test_navigate_to_backdrop_selects_and_zoomsto assertzoomToFitSelected()is called.test_navigate_to_backdrop_does_not_force_fixed_zoom— asserts no absolute zoom scale is set.Full suite: 486 passed.
UAT
Pending — to be performed in Nuke by the maintainer: