Implemented repeatable action feature from Hammer into scene mapper.#10446
Open
Ajay-Ghale-sudo wants to merge 2 commits intoFacepunch:masterfrom
Open
Implemented repeatable action feature from Hammer into scene mapper.#10446Ajay-Ghale-sudo wants to merge 2 commits intoFacepunch:masterfrom
Ajay-Ghale-sudo wants to merge 2 commits intoFacepunch:masterfrom
Conversation
Author
|
I thought about trying to implement Trenchbroom's stack system to track a history of actions and let the user repeat multiple at a time, but that's beyond the scope of this PR I think. |
95fee88 to
7a6acbd
Compare
7a6acbd to
79d5fac
Compare
API. Moved RepeatActionTool to more relevant folder.
79d5fac to
93288cf
Compare
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.
Pull Request
Thanks for contributing to s&box ❤️
Please fill out the sections below to help us review your change efficiently.
Summary
Implements repeat last action feature that was lost in translation from Hammer tool to scene view mapper. Captures a single change to a face/edge/vertex/object and allows it to be repeated by pressing a hotkey.
Motivation & Context
I missed the repeat last action tool in the migration from the Hammer tool to the scene mapper version, so I reimplemented it. First time open source contributor here, if there are major issues with my implementation, let me know.
Fixes: #10241
Implementation Details
Pending/Commit pattern on writes because mesh tool Record happens every frame during a drag, creating cumulative deltas
IsReplaying guard to prevent overwriting stored actions with themselves
Still not sure about the rotation implementation. It would be as simple as the rest of it if I didn't have to factor in pivots. I initially was just using a TransformDelta struct that tracked the transform from the first/most recent interaction with the gizmo to the last, but that ended up causing problems with the position of the object as it was being tracked too, and it would send them off into the distance.
Two paths: since object-mode tools don't share a common transform interface, I ended up splitting this in two or I would have had to do some major rewrites (as far as I could tell), which seemed beyond the scope of this PR.
Undo scope: RegisterUndoListener hooks OnUndo to Clear so that undoing the original action also invalidates the stored repeat data, otherwise it would be possible to undo a move and replay a stale delta on an object/face/edge/vertex.
Problems:
Currently for object mode, rotating around a changed pivot is not implemented. I tried a few methods, doing a save/restore around duplication, but OnSelectionChanged still ran and called ClearPivot mid-drag. Skipping OnSelectionChanged and manually doing it causes the OnMeshSelectionChanged to reset the pivot one frame later. If anyone has any ideas for this one, I'm all ears.
Screenshots / Videos (if applicable)
Object scale repeat action:
https://github.com/user-attachments/assets/80d493b6-9fa0-4c5a-a5ee-9f7c55e4394a
Object move repeat action:
https://github.com/user-attachments/assets/9e27a893-46d8-458e-b576-4af511a44a04
Object rotate repeat action:
https://github.com/user-attachments/assets/7979ab3b-2c85-45d5-b7ea-65cdb3acb123
Faces scale repeat action:
https://github.com/user-attachments/assets/56df8ff3-c73e-47f4-a925-d696a4f35623
Face rotate repeat action:
https://github.com/user-attachments/assets/2348a646-eed4-41fd-8ef7-18025f5ab4db
Face move repeat action:
https://github.com/user-attachments/assets/0f31c656-7ce7-459b-8be7-df5b8225c3e8
Checklist