Commit transforms on editor mode switch

This commit is contained in:
Robert Yevdokimov 2024-01-07 11:55:05 -05:00 committed by Robert Yevdokimov
parent 9cd297b6f2
commit 9b0b9ef450
2 changed files with 10 additions and 0 deletions

View file

@ -7296,6 +7296,12 @@ void Node3DEditor::_menu_item_pressed(int p_option) {
case MENU_TOOL_ROTATE:
case MENU_TOOL_SCALE:
case MENU_TOOL_LIST_SELECT: {
for (uint32_t i = 0; i < VIEWPORTS_COUNT; i++) {
if (viewports[i]->_edit.mode != Node3DEditorViewport::TRANSFORM_NONE) {
viewports[i]->commit_transform();
}
}
for (int i = 0; i < TOOL_MAX; i++) {
tool_button[i]->set_pressed(i == p_option);
}

View file

@ -4546,6 +4546,10 @@ void CanvasItemEditor::_button_toggle_grid_snap(bool p_status) {
}
void CanvasItemEditor::_button_tool_select(int p_index) {
if (drag_type != DRAG_NONE) {
_commit_drag();
}
Button *tb[TOOL_MAX] = { select_button, list_select_button, move_button, scale_button, rotate_button, pivot_button, pan_button, ruler_button };
for (int i = 0; i < TOOL_MAX; i++) {
tb[i]->set_pressed(i == p_index);