Skip to content

Offset after autoplace - #34424

Open
miiizen wants to merge 2 commits into
musescore:mainfrom
miiizen:offsetAfterAutoplace
Open

Offset after autoplace#34424
miiizen wants to merge 2 commits into
musescore:mainfrom
miiizen:offsetAfterAutoplace

Conversation

@miiizen

@miiizen miiizen commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Resolves: #34411

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 143ba2da-85a0-4cb9-8bc2-656eb57312a0

📥 Commits

Reviewing files that changed from the base of the PR and between 7f1a340 and 16ae913.

📒 Files selected for processing (29)
  • src/app/configs/data/shortcuts.xml
  • src/app/configs/data/shortcuts_azerty.xml
  • src/app/configs/data/shortcuts_mac.xml
  • src/engraving/CMakeLists.txt
  • src/engraving/dom/engravingitem.cpp
  • src/engraving/dom/engravingitem.h
  • src/engraving/dom/engravingobject.cpp
  • src/engraving/dom/engravingobject.h
  • src/engraving/dom/guitarbend.cpp
  • src/engraving/dom/image.cpp
  • src/engraving/dom/line.cpp
  • src/engraving/editing/editposition.cpp
  • src/engraving/editing/editposition.h
  • src/engraving/editing/flip.cpp
  • src/engraving/rendering/score/autoplace.cpp
  • src/engraving/rendering/score/autoplace.h
  • src/engraving/rendering/score/tlayout.cpp
  • src/notation/inotationinteraction.h
  • src/notation/internal/notationinteraction.cpp
  • src/notation/internal/notationinteraction.h
  • src/notation/tests/mocks/notationinteractionmock.h
  • src/notationscene/internal/notationactioncontroller.cpp
  • src/notationscene/internal/notationcommandsregister.cpp
  • src/notationscene/internal/notationuiactions.cpp
  • src/notationscene/notationcommands.h
  • src/propertiespanel/qml/MuseScore/PropertiesPanel/general/appearance/AppearanceSettings.qml
  • src/propertiespanel/qml/MuseScore/PropertiesPanel/general/appearance/appearancesettingsmodel.cpp
  • src/propertiespanel/qml/MuseScore/PropertiesPanel/general/appearance/appearancesettingsmodel.h
  • src/propertiespanel/qml/MuseScore/PropertiesPanel/general/appearance/internal/AppearanceOffsetSection.qml
💤 Files with no reviewable changes (8)
  • src/engraving/editing/flip.cpp
  • src/engraving/dom/image.cpp
  • src/engraving/dom/line.cpp
  • src/engraving/dom/engravingobject.cpp
  • src/engraving/rendering/score/tlayout.cpp
  • src/engraving/dom/engravingitem.h
  • src/engraving/dom/guitarbend.cpp
  • src/engraving/dom/engravingitem.cpp
🚧 Files skipped from review as they are similar to previous changes (21)
  • src/notationscene/notationcommands.h
  • src/engraving/dom/engravingobject.h
  • src/notationscene/internal/notationuiactions.cpp
  • src/notation/inotationinteraction.h
  • src/notationscene/internal/notationactioncontroller.cpp
  • src/engraving/CMakeLists.txt
  • src/notation/tests/mocks/notationinteractionmock.h
  • src/engraving/editing/editposition.h
  • src/propertiespanel/qml/MuseScore/PropertiesPanel/general/appearance/internal/AppearanceOffsetSection.qml
  • src/notationscene/internal/notationcommandsregister.cpp
  • src/propertiespanel/qml/MuseScore/PropertiesPanel/general/appearance/appearancesettingsmodel.h
  • src/app/configs/data/shortcuts_mac.xml
  • src/propertiespanel/qml/MuseScore/PropertiesPanel/general/appearance/AppearanceSettings.qml
  • src/notation/internal/notationinteraction.h
  • src/engraving/rendering/score/autoplace.h
  • src/app/configs/data/shortcuts.xml
  • src/notation/internal/notationinteraction.cpp
  • src/engraving/editing/editposition.cpp
  • src/engraving/rendering/score/autoplace.cpp
  • src/propertiespanel/qml/MuseScore/PropertiesPanel/general/appearance/appearancesettingsmodel.cpp
  • src/app/configs/data/shortcuts_azerty.xml

📝 Walkthrough

Walkthrough

The change removes offset-change tracking from engraving items, undo handling, dragging, flipping, and autoplace. Autoplace now applies calculated movement directly. A new EditPosition operation freezes selected item positions by disabling autoplace and storing offsets with undo support. Commands, shortcuts, notation interaction, and appearance-panel controls expose the operation.

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description only links issue #34411 and omits the required change summary and checklist responses. Add a short change summary and motivation, then complete the template checklist with accurate selections and required details.
Out of Scope Changes check ⚠️ Warning The freeze-current-placement command, shortcuts, and Properties Panel UI add functionality not required by issue #34411. Move the freeze-current-placement feature to a separate issue or document its direct requirement and scope in the linked issue.
Docstring Coverage ⚠️ Warning Docstring coverage is 10.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title identifies the offset and autoplace change addressed by the pull request.
Linked Issues check ✅ Passed The changes remove offset rebasing and support direct offset application, addressing issue #34411's 0,0 drawn-position requirement.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Linked repositories: Public OSS repositories can only analyze public repositories installed in this organization. No linked repositories were analyzed; skipped musescore/muse_framework.git.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@miiizen
miiizen force-pushed the offsetAfterAutoplace branch from c69ad87 to 2746cbd Compare July 31, 2026 12:27

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/engraving/rendering/score/autoplace.cpp`:
- Line 72: Update the measure autoplace path around the shape construction and
skyline insertion to use an offset-free measurement pose: subtract
item->offset() before clearance measurement/padding, then restore the offset
exactly once when adding the result to the skyline. Apply the same adjustment to
the related logic at the referenced measure-path locations, while preserving the
segment path’s existing behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 39137e54-e0e5-40ee-a620-f44358221701

📥 Commits

Reviewing files that changed from the base of the PR and between c69ad87 and 2746cbd.

📒 Files selected for processing (10)
  • src/engraving/dom/engravingitem.cpp
  • src/engraving/dom/engravingitem.h
  • src/engraving/dom/engravingobject.cpp
  • src/engraving/dom/guitarbend.cpp
  • src/engraving/dom/image.cpp
  • src/engraving/dom/line.cpp
  • src/engraving/editing/flip.cpp
  • src/engraving/rendering/score/autoplace.cpp
  • src/engraving/rendering/score/autoplace.h
  • src/engraving/rendering/score/tlayout.cpp
💤 Files with no reviewable changes (9)
  • src/engraving/dom/image.cpp
  • src/engraving/dom/line.cpp
  • src/engraving/editing/flip.cpp
  • src/engraving/dom/engravingobject.cpp
  • src/engraving/rendering/score/autoplace.h
  • src/engraving/dom/engravingitem.h
  • src/engraving/dom/guitarbend.cpp
  • src/engraving/rendering/score/tlayout.cpp
  • src/engraving/dom/engravingitem.cpp

Comment thread src/engraving/rendering/score/autoplace.cpp
@miiizen
miiizen force-pushed the offsetAfterAutoplace branch from 2746cbd to 5337da3 Compare August 4, 2026 19:26

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
src/notation/internal/notationinteraction.cpp (1)

6439-6451: 🎯 Functional Correctness | 🔵 Trivial | 🏗️ Heavy lift

Add regression coverage for freeze and undo.

Cover an autoplaced item, an already non-autoplaced or generated item, an empty selection, and undo/redo. Assert that the item keeps its drawn position after relayout and that undo restores the previous autoplace and offset state.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/notation/internal/notationinteraction.cpp` around lines 6439 - 6451,
Extend regression tests for NotationInteraction::freezeSelectionPosition to
cover autoplaced items, already non-autoplaced or generated items, and an empty
selection. Verify frozen items retain their drawn position after relayout, and
verify undo and redo restore and reapply the autoplace and offset states
respectively.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/engraving/editing/editposition.cpp`:
- Around line 48-50: Update the offset property handling in the surrounding
edit-position logic before calling item->undoChangeProperty: convert offsetPf
from PropertyFlags::STYLED to PropertyFlags::UNSTYLED for the calculated freeze
offset, while preserving PropertyFlags::NOSTYLE for elements without a styled
offset. Keep the existing offset calculation and undoChangeProperty call
unchanged otherwise.

In `@src/engraving/editing/editposition.h`:
- Line 32: Include the standard <vector> header in editposition.h so the
std::vector type used by freezeItemsPositions is declared directly, removing
reliance on transitive or precompiled headers.

In
`@src/propertiespanel/qml/MuseScore/PropertiesPanel/general/appearance/internal/AppearanceOffsetSection.qml`:
- Around line 62-82: Update the navigation.row assignments for
freezePlacementButton and configureGridButton to use unique sequential rows in
visual order: place freezePlacementButton immediately after OffsetSection, then
place snapToGridCheckbox after the freeze button, with configureGridButton
following the appropriate preceding control. Ensure no controls share the same
navigation row.

---

Nitpick comments:
In `@src/notation/internal/notationinteraction.cpp`:
- Around line 6439-6451: Extend regression tests for
NotationInteraction::freezeSelectionPosition to cover autoplaced items, already
non-autoplaced or generated items, and an empty selection. Verify frozen items
retain their drawn position after relayout, and verify undo and redo restore and
reapply the autoplace and offset states respectively.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: bfccc913-3955-4eab-b0e9-eafb92dbcc9b

📥 Commits

Reviewing files that changed from the base of the PR and between 2746cbd and 5337da3.

📒 Files selected for processing (29)
  • src/app/configs/data/shortcuts.xml
  • src/app/configs/data/shortcuts_azerty.xml
  • src/app/configs/data/shortcuts_mac.xml
  • src/engraving/CMakeLists.txt
  • src/engraving/dom/engravingitem.cpp
  • src/engraving/dom/engravingitem.h
  • src/engraving/dom/engravingobject.cpp
  • src/engraving/dom/engravingobject.h
  • src/engraving/dom/guitarbend.cpp
  • src/engraving/dom/image.cpp
  • src/engraving/dom/line.cpp
  • src/engraving/editing/editposition.cpp
  • src/engraving/editing/editposition.h
  • src/engraving/editing/flip.cpp
  • src/engraving/rendering/score/autoplace.cpp
  • src/engraving/rendering/score/autoplace.h
  • src/engraving/rendering/score/tlayout.cpp
  • src/notation/inotationinteraction.h
  • src/notation/internal/notationinteraction.cpp
  • src/notation/internal/notationinteraction.h
  • src/notation/tests/mocks/notationinteractionmock.h
  • src/notationscene/internal/notationactioncontroller.cpp
  • src/notationscene/internal/notationcommandsregister.cpp
  • src/notationscene/internal/notationuiactions.cpp
  • src/notationscene/notationcommands.h
  • src/propertiespanel/qml/MuseScore/PropertiesPanel/general/appearance/AppearanceSettings.qml
  • src/propertiespanel/qml/MuseScore/PropertiesPanel/general/appearance/appearancesettingsmodel.cpp
  • src/propertiespanel/qml/MuseScore/PropertiesPanel/general/appearance/appearancesettingsmodel.h
  • src/propertiespanel/qml/MuseScore/PropertiesPanel/general/appearance/internal/AppearanceOffsetSection.qml
💤 Files with no reviewable changes (8)
  • src/engraving/dom/engravingobject.cpp
  • src/engraving/dom/guitarbend.cpp
  • src/engraving/editing/flip.cpp
  • src/engraving/dom/image.cpp
  • src/engraving/dom/engravingitem.cpp
  • src/engraving/dom/line.cpp
  • src/engraving/rendering/score/tlayout.cpp
  • src/engraving/dom/engravingitem.h
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/engraving/rendering/score/autoplace.cpp

Comment thread src/engraving/editing/editposition.cpp
Comment thread src/engraving/editing/editposition.h
@miiizen
miiizen force-pushed the offsetAfterAutoplace branch from 5337da3 to 62600f2 Compare August 5, 2026 07:19
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@miiizen
miiizen force-pushed the offsetAfterAutoplace branch from 62600f2 to 106a05c Compare August 5, 2026 07:24
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@miiizen
miiizen force-pushed the offsetAfterAutoplace branch from 106a05c to 9439623 Compare August 5, 2026 07:26
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@miiizen
miiizen force-pushed the offsetAfterAutoplace branch from 9439623 to 16ae913 Compare August 5, 2026 07:46
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@avvvvve

avvvvve commented Aug 6, 2026

Copy link
Copy Markdown

@miiizen Noticed that the shortcut for 'Freeze current placement' doesn't work when the appearance popup is open. Is that expected?

Also, undoing the freeze does restore auto-place to being on, but does not reset the offset.

Screen.Recording.2026-08-06.at.9.10.07.AM.mov

@miiizen

miiizen commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

@avvvvve None of our notation shortcuts work if a a text/spinbox field have focus, so I think this is expected. It works for me if nothing is selected in the popup.

We don't want the offset to be reset, we want it to return to what it was before clicking freeze which it looks like it does in the video. When you click freeze in the video offset is zero because of this issue. It's actually (0.14, 3.7).

@avvvvve

avvvvve commented Aug 7, 2026

Copy link
Copy Markdown

Ah yeah, I think I got confused because the first time I tried the undo, I had the appearance popup open and the offset did not visually reset to its previous state (I didn't mean it should always reset to 0,0, my bad for not writing clearly). Anyway, yes, the behavior looks right otherwise.


Also, are there some elements that don't need the 'Freeze' button at all?

For example, it's available for notes—but when you press it, it doesn't actually turn off auto-place. Perhaps we should just not show it for notes/rests/note slashes. Same for all frame types, unless you can think of a reason why to include it for these. cc @davidstephengrant

@miiizen

miiizen commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

Yes - we could disable it for any element autoplace does nothing for. While we're at it, it might make sense to also disable the autoplace checkbox.

@avvvvve

avvvvve commented Aug 7, 2026

Copy link
Copy Markdown

That sounds good to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make drawn position for auto-placed elements 0,0 (offset)

3 participants