-
-
Notifications
You must be signed in to change notification settings - Fork 22.9k
Create an undo/redo action when pinning a SoftBody3D point in the editor #108291
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
base: master
Are you sure you want to change the base?
Conversation
When you get around to rebasing this, please trim the commit message to just the title. In particular: we don't want any commits mentioning issues/PR by ID, as that would cause unwanted notifications |
Previously if you pinned a point by clicking on one of the soft body vertex handles the scene was not marked as modified, and the action could not be undone by hitting Ctrl-Z.
77a6da9
to
8b6cc6a
Compare
const bool is_pinned = soft_body->is_point_pinned(p_id); | ||
|
||
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton(); | ||
undo_redo->create_action(vformat(TTR("%s SoftBody3D pinned point %d."), is_pinned ? "Remove" : "Add", p_id)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most undo/redo action names don't end with a period currently, so we should adjust this for consistency:
undo_redo->create_action(vformat(TTR("%s SoftBody3D pinned point %d."), is_pinned ? "Remove" : "Add", p_id)); | |
undo_redo->create_action(vformat(TTR("%s SoftBody3D pinned point %d"), is_pinned ? "Remove" : "Add", p_id)); |

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally, I noticed some issues:
- Undo/redo works, but it doesn't update the gizmos you see in the 3D editor until you hover any of them with the mouse.
- If I change the subdivision count in the PlaneMesh and edit points without reloading the scene, I'll get error messages about the vertex count being too low for the pinned point index I'm trying to set, but it's still working. (This issue may be present before this PR already, but I thought I'd report it nonetheless.)
Both of these issues can be seen in this video:
soft_body_undo_redo.mp4
Testing project: test_pr_108291.zip
Previously if you pinned a point by clicking on one of the soft body vertex handles the scene was not marked as modified, and the action could not be undone by hitting Ctrl-Z.
I ran into this in my own development, but I suspect that the scene not getting marked as modified is probably the root cause of issue #106325, so I suspect this change fixes that issue.
bugsquad edit: fixes #106325