X Tutup
Skip to content

Commit transforms done with editor gizmo on tool mode switch. #86930

Merged
Repiteo merged 1 commit intogodotengine:masterfrom
Open-Industry-Project:commit-transforms-on-mode-switch
Nov 24, 2025
Merged

Commit transforms done with editor gizmo on tool mode switch. #86930
Repiteo merged 1 commit intogodotengine:masterfrom
Open-Industry-Project:commit-transforms-on-mode-switch

Conversation

@ryevdokimov
Copy link
Contributor

@ryevdokimov ryevdokimov commented Jan 7, 2024

Supplementary but not dependent on: #86805 and #86804

This affects 2D and 3D.

Currently you can switch gizmo tool modes while an edit is in progress, the tool will switch, but the previous tools action will continue, which is a bit strange.

2024-09-03.12-44-45.mp4

This PR will prevent this, by committing the transform in the editor when switching tool modes which seems like the more expected and less confusing result.

2024-09-03.12-52-22.mp4

@ryevdokimov ryevdokimov requested a review from a team January 7, 2024 16:04
@AThousandShips
Copy link
Member

When making several additions from suggestions please use the batch feature, it's next to the commit one 🙂

@ryevdokimov
Copy link
Contributor Author

When making several additions from suggestions please use the batch feature, it's next to the commit one 🙂

Thanks 😅

@ryevdokimov ryevdokimov force-pushed the commit-transforms-on-mode-switch branch 2 times, most recently from 0b273b6 to e683970 Compare January 7, 2024 16:57
@ryevdokimov
Copy link
Contributor Author

ryevdokimov commented Jan 7, 2024

Changes made and tested.

Thanks for your help AThousandShips.

Edit: Nevermind I missed one...

@ryevdokimov ryevdokimov force-pushed the commit-transforms-on-mode-switch branch from e683970 to 0748cbc Compare January 7, 2024 17:11
@ryevdokimov
Copy link
Contributor Author

Ok, I think it's good. Let me know if I missed anything.

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 (rebased on top of master 4d1f26e), it works as expected. Code looks good to me.

Note that Blender's behavior is to cancel the manipulation instead of commit it here, so it differs, but I personally prefer the new behavior here. It enables you to translate then rotate something in a single operation, something that is not possible in Blender.

@ryevdokimov ryevdokimov force-pushed the commit-transforms-on-mode-switch branch from 9ad681d to 92c0425 Compare October 12, 2025 01:32
@ryevdokimov ryevdokimov requested a review from a team October 12, 2025 01:32
@ryevdokimov ryevdokimov force-pushed the commit-transforms-on-mode-switch branch from 92c0425 to bd4be8a Compare October 12, 2025 01:34
@Repiteo Repiteo requested a review from KoBeWi October 21, 2025 19:37
@ryevdokimov ryevdokimov force-pushed the commit-transforms-on-mode-switch branch from bd4be8a to aab78e5 Compare October 22, 2025 07:24
@KoBeWi
Copy link
Member

KoBeWi commented Oct 31, 2025

The code could be simpler if you just called _commit_drag() in _button_tool_select(), and likewise in 3D editor 🙃
Or is it not possible for some reason?

@ryevdokimov ryevdokimov force-pushed the commit-transforms-on-mode-switch branch from aab78e5 to 9187a8f Compare October 31, 2025 15:07
@ryevdokimov
Copy link
Contributor Author

The code could be simpler if you just called _commit_drag() in _button_tool_select(), and likewise in 3D editor 🙃
Or is it not possible for some reason?

Totally possible, not sure what I was looking at when I originally wrote this PR a couple years back lol

}

void CanvasItemEditor::_button_tool_select(int p_index) {
_commit_drag();
Copy link
Member

Choose a reason for hiding this comment

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

You could check if drag_type isn't DRAG_NONE. While calling the method unnecessarily has no adverse effects, it's better to avoid it.

@KoBeWi KoBeWi modified the milestones: 4.x, 4.6 Nov 14, 2025
@ryevdokimov ryevdokimov force-pushed the commit-transforms-on-mode-switch branch from 9187a8f to 9b0b9ef Compare November 14, 2025 13:12
@Repiteo Repiteo merged commit 6d8ec7e into godotengine:master Nov 24, 2025
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Nov 24, 2025

Thanks!

@ryevdokimov ryevdokimov deleted the commit-transforms-on-mode-switch branch November 24, 2025 22:21
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.

5 participants

X Tutup