[Bf-blender-cvs] [91ea42b8dfd] blender2.8: Remove Align to View Operator
Campbell Barton
noreply at git.blender.org
Wed Oct 10 00:25:55 CEST 2018
Commit: 91ea42b8dfde9d8b0203d50f2873ecf90653c3aa
Author: Campbell Barton
Date: Wed Oct 10 09:19:09 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB91ea42b8dfde9d8b0203d50f2873ecf90653c3aa
Remove Align to View Operator
This only worked on new objects, which is no longer needed.
It didn't account for:
- Quaternion or axis-angle rotation.
- Parenting.
- Constraints.
If we support object rotation alignment, it might be best to
make it a more general set of alignment operators
(align transform, orientation - not limiting to view).
===================================================================
M release/scripts/startup/bl_operators/object.py
===================================================================
diff --git a/release/scripts/startup/bl_operators/object.py b/release/scripts/startup/bl_operators/object.py
index c5801b5a4e6..ae12db225cf 100644
--- a/release/scripts/startup/bl_operators/object.py
+++ b/release/scripts/startup/bl_operators/object.py
@@ -914,50 +914,7 @@ class LoadImageAsEmpty(Operator):
return {'FINISHED'}
-class AlignObjectsToView(bpy.types.Operator):
- bl_idname = "object.align_to_view"
- bl_label = "Align Objects to View"
- bl_options = {"REGISTER", "UNDO"}
-
- front_axis: EnumProperty(
- name="Front Axis",
- default='POS_Z',
- items=(
- (sign + axis, sign_sym + axis, "")
- for sign, sign_sym in (('POS_', '+'), ('NEG_', "-"))
- for axis in ('X', 'Y', 'Z')
- )
- )
-
- @classmethod
- def poll(cls, context):
- return context.space_data.type == "VIEW_3D"
-
- def execute(self, context):
- from math import radians
- from mathutils import Euler
-
- axis_data = {
- 'POS_X': Euler((0.0, radians(-90.0), 0.0)),
- 'NEG_X': Euler((0.0, radians(90.0), 0.0)),
- 'POS_Y': Euler((radians(90.0), 0.0, 0.0)),
- 'NEG_Y': Euler((radians(-90.0), 0.0, 0.0)),
- 'POS_Z': Euler((0.0, 0.0, 0.0)),
- 'NEG_Z': Euler((0.0, radians(180.0), 0.0))
- }
-
- base = axis_data[self.front_axis].to_matrix()
-
- view = context.space_data.region_3d.view_matrix
- rotation = (view.to_3x3().inverted() @ base).to_euler()
- for obj in context.selected_objects:
- obj.rotation_euler = rotation
-
- return {"FINISHED"}
-
-
classes = (
- AlignObjectsToView,
ClearAllRestrictRender,
DupliOffsetFromCursor,
IsolateTypeRender,
More information about the Bf-blender-cvs
mailing list