Skip to content

frontend: Improve preview source snapping - #12298

Merged
RytoEX merged 2 commits into
obsproject:masterfrom
Warchamp7:more-snapping
Sep 22, 2026
Merged

RytoEX merged 2 commits into
obsproject:masterfrom
Warchamp7:more-snapping

Conversation

@Warchamp7

@Warchamp7 Warchamp7 commented Jun 19, 2025 •

Copy link
Copy Markdown
Member

Description

This PR makes a number of changes to source snapping in the preview:

  • Sources no longer snap to hidden sources
  • Edges can now snap to the same axis edge of other sources
    • Ex. The top edge of a source can now snap to the top edge of another source
  • Sources snap along the entire axis
    • Sources don't have to be touching to snap
  • Visual indicators for snapping
  • Replaces calculation macro with a static method

Additionally

  • Changes the default snap distance from 10.0 -> 5.0
  • Hidden sources can no longer be hovered or clicked in the preview to select them
obs64_wuvM7eemGG.mp4

Motivation and Context

I want to improve source snapping behaviour and visual feedback

How Has This Been Tested?

Moved a bunch of sources around. Toggled relevant snapping settings on and off to ensure behaviour matched settings.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Tweak (non-breaking change to improve existing functionality)
  • Code cleanup (non-breaking change which makes code smaller or more readable)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

@Warchamp7 Warchamp7 added the area/ui-ux Anything to do with changes or additions to UI/UX elements. label Jun 19, 2025
@Warchamp7 Warchamp7 added this to the OBS Studio 32.0 milestone Jun 19, 2025
@WizardCM WizardCM added the kind/enhancement Enhancements are not bugs or new features but can improve usability or performance. label Jun 21, 2025
@Warchamp7
Warchamp7 requested a review from PatTheMav September 23, 2025 21:47

@PatTheMav PatTheMav left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functionally this PR is fine, but it seems very brute force and not particularly efficient to me and falls victim to "featuritis", just piling on little features one by one, each doing its own thing in isolation with no regard to other (similar) features and the architecture behind it.

Preview control drawing should be a single process, by a single responsible entity in code that knows about all of its "features" and thus set up a single render pass to draw all the pieces it knows should be visible for any given frame.

Comment thread frontend/widgets/OBSBasicPreview.cpp Resolved
Comment thread frontend/widgets/OBSBasicPreview.cpp Resolved
Comment thread frontend/widgets/OBSBasicPreview.cpp Resolved
Comment thread frontend/widgets/OBSBasicPreview.cpp Resolved
@Warchamp7 Warchamp7 moved this to Ready For Review in OBS Studio 32.1 PR Considerations Oct 29, 2025
@RytoEX RytoEX moved this from Ready For Review to Requires Changes in OBS Studio 32.1 PR Considerations Dec 18, 2025
@Warchamp7 Warchamp7 moved this from Requires Changes to Ready For Review in OBS Studio 32.1 PR Considerations Jan 8, 2026
@Warchamp7
Warchamp7 force-pushed the more-snapping branch 2 times, most recently from a7a004e to f53cd97 Compare January 13, 2026 22:10
@RytoEX
RytoEX requested a review from PatTheMav May 8, 2026 18:41
@Warchamp7
Warchamp7 force-pushed the more-snapping branch 2 times, most recently from 152442d to 02623d0 Compare June 15, 2026 22:28
@Warchamp7

Copy link
Copy Markdown
Member Author

I've added another commit that updates the default snap distance from 10.0 -> 5.0 and will migrate the old value one time. Since the snap distance is scaled by preview zoom level the default value of 10 is pretty aggressive especially with more snap candidates now.

Comment thread frontend/widgets/OBSBasicPreview.hpp Resolved
Comment thread frontend/widgets/OBSBasicPreview.cpp Resolved
Comment thread frontend/widgets/OBSBasicPreview.cpp Resolved
Comment thread frontend/widgets/OBSBasicPreview.hpp Resolved
Comment thread frontend/OBSApp.cpp Resolved
@github-project-automation github-project-automation Bot moved this from Ready For Review to Requires Changes in Current Release Tracker (33.0) Aug 28, 2026
@Warchamp7
Warchamp7 force-pushed the more-snapping branch 2 times, most recently from d1742b9 to 46e61b4 Compare September 4, 2026 23:38
Comment thread frontend/widgets/OBSBasicPreview.cpp Resolved
@Warchamp7
Warchamp7 requested a review from PatTheMav September 14, 2026 18:19
@Warchamp7 Warchamp7 moved this from Requires Changes to Ready For Review in Current Release Tracker (33.0) Sep 14, 2026

@RytoEX RytoEX left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine other than review comments. Commits will need to be squashed after addressing those.

Comment thread frontend/OBSApp.cpp Resolved
Comment thread frontend/OBSApp.cpp Resolved
@github-project-automation github-project-automation Bot moved this from Ready For Review to Requires Changes in Current Release Tracker (33.0) Sep 21, 2026
@RytoEX

RytoEX commented Sep 22, 2026

Copy link
Copy Markdown
Member

LGTM. Squash commits and I'll approve+merge.

@RytoEX
RytoEX merged commit 0888aea into obsproject:master Sep 22, 2026
15 checks passed
@github-project-automation github-project-automation Bot moved this from Requires Changes to Merged in Current Release Tracker (33.0) Sep 22, 2026
@RytoEX RytoEX added the release-note/change Groups pull request under the "Changes" section in the associated patch notes label Sep 22, 2026
@Warchamp7 Warchamp7 added release-note/feature Groups pull request under the "New Features" section in the associated patch notes and removed release-note/change Groups pull request under the "Changes" section in the associated patch notes labels Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ui-ux Anything to do with changes or additions to UI/UX elements. kind/enhancement Enhancements are not bugs or new features but can improve usability or performance. release-note/feature Groups pull request under the "New Features" section in the associated patch notes

Projects

Status: Merged

Development

Successfully merging this pull request may close these issues.

4 participants