@@ -1835,8 +1835,11 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
18351835 _menu_option (orthogonal ? VIEW_PERSPECTIVE : VIEW_ORTHOGONAL);
18361836 _update_name ();
18371837 }
1838- if (ED_IS_SHORTCUT (" spatial_editor/align_selection_with_view" , p_event)) {
1839- _menu_option (VIEW_ALIGN_SELECTION_WITH_VIEW);
1838+ if (ED_IS_SHORTCUT (" spatial_editor/align_transform_with_view" , p_event)) {
1839+ _menu_option (VIEW_ALIGN_TRANSFORM_WITH_VIEW);
1840+ }
1841+ if (ED_IS_SHORTCUT (" spatial_editor/align_rotation_with_view" , p_event)) {
1842+ _menu_option (VIEW_ALIGN_ROTATION_WITH_VIEW);
18401843 }
18411844 if (ED_IS_SHORTCUT (" spatial_editor/insert_anim_key" , p_event)) {
18421845 if (!get_selected_count () || _edit.mode != TRANSFORM_NONE)
@@ -2562,7 +2565,7 @@ void SpatialEditorViewport::_menu_option(int p_option) {
25622565 focus_selection ();
25632566
25642567 } break ;
2565- case VIEW_ALIGN_SELECTION_WITH_VIEW : {
2568+ case VIEW_ALIGN_TRANSFORM_WITH_VIEW : {
25662569
25672570 if (!get_selected_count ())
25682571 break ;
@@ -2571,7 +2574,8 @@ void SpatialEditorViewport::_menu_option(int p_option) {
25712574
25722575 List<Node *> &selection = editor_selection->get_selected_node_list ();
25732576
2574- undo_redo->create_action (TTR (" Align with View" ));
2577+ undo_redo->create_action (TTR (" Align Transform with View" ));
2578+
25752579 for (List<Node *>::Element *E = selection.front (); E; E = E->next ()) {
25762580
25772581 Spatial *sp = Object::cast_to<Spatial>(E->get ());
@@ -2595,6 +2599,34 @@ void SpatialEditorViewport::_menu_option(int p_option) {
25952599 undo_redo->add_undo_method (sp, " set_global_transform" , sp->get_global_gizmo_transform ());
25962600 }
25972601 undo_redo->commit_action ();
2602+ focus_selection ();
2603+
2604+ } break ;
2605+ case VIEW_ALIGN_ROTATION_WITH_VIEW: {
2606+
2607+ if (!get_selected_count ())
2608+ break ;
2609+
2610+ Transform camera_transform = camera->get_global_transform ();
2611+
2612+ List<Node *> &selection = editor_selection->get_selected_node_list ();
2613+
2614+ undo_redo->create_action (TTR (" Align Rotation with View" ));
2615+ for (List<Node *>::Element *E = selection.front (); E; E = E->next ()) {
2616+
2617+ Spatial *sp = Object::cast_to<Spatial>(E->get ());
2618+ if (!sp)
2619+ continue ;
2620+
2621+ SpatialEditorSelectedItem *se = editor_selection->get_node_editor_data <SpatialEditorSelectedItem>(sp);
2622+ if (!se)
2623+ continue ;
2624+
2625+ undo_redo->add_do_method (sp, " set_rotation" , camera_transform.basis .get_rotation ());
2626+ undo_redo->add_undo_method (sp, " set_rotation" , sp->get_rotation ());
2627+ }
2628+ undo_redo->commit_action ();
2629+
25982630 } break ;
25992631 case VIEW_ENVIRONMENT: {
26002632
@@ -3544,7 +3576,8 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed
35443576 view_menu->get_popup ()->add_separator ();
35453577 view_menu->get_popup ()->add_shortcut (ED_GET_SHORTCUT (" spatial_editor/focus_origin" ), VIEW_CENTER_TO_ORIGIN);
35463578 view_menu->get_popup ()->add_shortcut (ED_GET_SHORTCUT (" spatial_editor/focus_selection" ), VIEW_CENTER_TO_SELECTION);
3547- view_menu->get_popup ()->add_shortcut (ED_GET_SHORTCUT (" spatial_editor/align_selection_with_view" ), VIEW_ALIGN_SELECTION_WITH_VIEW);
3579+ view_menu->get_popup ()->add_shortcut (ED_GET_SHORTCUT (" spatial_editor/align_transform_with_view" ), VIEW_ALIGN_TRANSFORM_WITH_VIEW);
3580+ view_menu->get_popup ()->add_shortcut (ED_GET_SHORTCUT (" spatial_editor/align_rotation_with_view" ), VIEW_ALIGN_ROTATION_WITH_VIEW);
35483581 view_menu->get_popup ()->connect (" id_pressed" , this , " _menu_option" );
35493582
35503583 view_menu->set_disable_shortcuts (true );
@@ -5601,7 +5634,8 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
56015634 ED_SHORTCUT (" spatial_editor/insert_anim_key" , TTR (" Insert Animation Key" ), KEY_K);
56025635 ED_SHORTCUT (" spatial_editor/focus_origin" , TTR (" Focus Origin" ), KEY_O);
56035636 ED_SHORTCUT (" spatial_editor/focus_selection" , TTR (" Focus Selection" ), KEY_F);
5604- ED_SHORTCUT (" spatial_editor/align_selection_with_view" , TTR (" Align Selection With View" ), KEY_MASK_ALT + KEY_MASK_CMD + KEY_F);
5637+ ED_SHORTCUT (" spatial_editor/align_transform_with_view" , TTR (" Align Transform with View" ), KEY_MASK_ALT + KEY_MASK_CMD + KEY_M);
5638+ ED_SHORTCUT (" spatial_editor/align_rotation_with_view" , TTR (" Align Rotation with View" ), KEY_MASK_ALT + KEY_MASK_CMD + KEY_F);
56055639
56065640 ED_SHORTCUT (" spatial_editor/tool_select" , TTR (" Tool Select" ), KEY_Q);
56075641 ED_SHORTCUT (" spatial_editor/tool_move" , TTR (" Tool Move" ), KEY_W);
0 commit comments