Skip to content

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

simpkins
Copy link
Contributor

@simpkins simpkins commented Jul 4, 2025

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

@simpkins simpkins requested a review from a team as a code owner July 4, 2025 20:41
@Chaosus Chaosus added this to the 4.6 milestone Jul 5, 2025
@Repiteo Repiteo modified the milestones: 4.6, 4.5 Jul 17, 2025
@Repiteo Repiteo requested a review from Calinou July 17, 2025 14:29
@Repiteo
Copy link
Contributor

Repiteo commented Jul 17, 2025

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.
@simpkins simpkins force-pushed the soft_body_pin_gizmo branch from 77a6da9 to 8b6cc6a Compare July 17, 2025 18:01
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));
Copy link
Member

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:

Suggested change
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));
image

Copy link
Member

@Calinou Calinou left a 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

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

Successfully merging this pull request may close these issues.

SoftBody3D: Toggling vertex attachments in the editor does not apply the changes
4 participants