Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for issue #206 (BetterUndoRedo) #210

Merged
merged 3 commits into from
Apr 4, 2024
Merged

Conversation

gotmachine
Copy link
Contributor

@gotmachine gotmachine commented Mar 2, 2024

We need to move calls to EditorLogic.SetBackup() before the actions take place (instead of after), see issue #206

  • Offset/Rotate gizmo
    The backup is created from callbacks called from the gizmo components OnMoveEnd / OnRotateEnd methods, triggered when the gizmo is released. The gizmos do have a On*Start method, but unfortunately they aren't hooked to a callback, and those are generic components that can potentially be used elsewhere. We can still patch those methods, and compare the gizmo instance to the EditorLogic.gizmo* fields.
  • Switching between part variants
    Requires moving the SetBackup() call at the beginning of the ModulePartVariants.onVariantChanged method
    Doesn't work because the field is already set when ModulePartVariants.onVariantChanged, so the changes will be saved to the backup anyway. Alternatively, we patch UIPartActionVariantSelector.SelectVariant()
  • Removing parts from symmetry
    Requires moving the SetBackup() call at the beginning of the Part.RemoveFromSymmetry method
  • Adding/removing part actions to action groups, and resetting part actions on the selected part
    Requires moving the SetBackup() call at the beginning of the EditorActionGroups ResetPart, AddActionToGroup and RemoveActionFromGroup methods
  • Using the reset button of the stage manager
    Requires moving the SetBackup() call at the beginning of the StageManager.Reset method
    Actually after further testing, it seems the backup is already created before the action, so nothing to fix here

@gotmachine gotmachine marked this pull request as draft March 2, 2024 16:59
@gotmachine gotmachine marked this pull request as ready for review March 2, 2024 21:52
@gotmachine gotmachine changed the title WIP fixes for issue #206 Fixes for issue #206 (BetterUndoRedo) Mar 2, 2024
@gotmachine gotmachine added the bug Something isn't working label Mar 2, 2024
@gotmachine gotmachine marked this pull request as draft March 2, 2024 21:57
@gotmachine
Copy link
Contributor Author

Reverted to draft, as I forgot that we need to keep the firing of the GameEvents.onEditorShipModified from SetBackup() at the original point (ie, after the action took place). So more work is needed on those patches...

@gotmachine gotmachine marked this pull request as ready for review March 3, 2024 08:38
@gotmachine
Copy link
Contributor Author

@JonnyOThan feel free to merge and push to a release

@gotmachine gotmachine merged commit 19a1d6a into dev Apr 4, 2024
1 check passed
@gotmachine gotmachine deleted the BetterUndoRedoFixes branch April 5, 2024 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging this pull request may close these issues.

1 participant