Browse Source

Fix "Align with view" undo, fixes #1443

Franklin Sobrinho 10 years ago
parent
commit
18392e28b6
1 changed files with 5 additions and 5 deletions
  1. 5 5
      tools/editor/plugins/spatial_editor_plugin.cpp

+ 5 - 5
tools/editor/plugins/spatial_editor_plugin.cpp

@@ -1957,11 +1957,11 @@ void SpatialEditorViewport::_menu_option(int p_option) {
 				if (!se)
 					continue;
 
-				Vector3 original_scale = sp->get_scale();
-				sp->set_global_transform(camera_transform);
-				sp->set_scale(original_scale);
-				undo_redo->add_do_method(sp,"set_global_transform",sp->get_global_transform());
-				undo_redo->add_undo_method(sp,"set_global_transform",se->original);
+				Transform xform = camera_transform;
+				xform.scale_basis(sp->get_scale());
+
+				undo_redo->add_do_method(sp,"set_global_transform",xform);
+				undo_redo->add_undo_method(sp,"set_global_transform",sp->get_global_transform());
 			}
 			undo_redo->commit_action();
 		} break;