diff options
Diffstat (limited to 'precision_drawing_tools/pdt_view.py')
-rw-r--r-- | precision_drawing_tools/pdt_view.py | 46 |
1 files changed, 31 insertions, 15 deletions
diff --git a/precision_drawing_tools/pdt_view.py b/precision_drawing_tools/pdt_view.py index f1e73245..087ce2f5 100644 --- a/precision_drawing_tools/pdt_view.py +++ b/precision_drawing_tools/pdt_view.py @@ -32,6 +32,8 @@ from .pdt_functions import debug, euler_to_quaternion class PDT_OT_ViewRot(Operator): + """Rotate View by Absolute Coordinates.""" + bl_idname = "pdt.viewrot" bl_label = "Rotate View" bl_options = {"REGISTER", "UNDO"} @@ -58,13 +60,15 @@ class PDT_OT_ViewRot(Operator): roll_value = euler_to_quaternion( pg.rotation_coords.x * pi / 180, pg.rotation_coords.y * pi / 180, - pg.rotation_coords.z * pi / 180 + pg.rotation_coords.z * pi / 180, ) context.region_data.view_rotation = roll_value return {"FINISHED"} -class PDT_OT_vRotL(Operator): +class PDT_OT_ViewRotL(Operator): + """Rotate View Left.""" + bl_idname = "pdt.viewleft" bl_label = "Rotate Left" bl_options = {"REGISTER", "UNDO"} @@ -90,7 +94,9 @@ class PDT_OT_vRotL(Operator): return {"FINISHED"} -class PDT_OT_vRotR(Operator): +class PDT_OT_ViewRotR(Operator): + """Rotate View Right.""" + bl_idname = "pdt.viewright" bl_label = "Rotate Right" bl_options = {"REGISTER", "UNDO"} @@ -117,7 +123,9 @@ class PDT_OT_vRotR(Operator): return {"FINISHED"} -class PDT_OT_vRotU(Operator): +class PDT_OT_ViewRotU(Operator): + """Rotate View Up.""" + bl_idname = "pdt.viewup" bl_label = "Rotate Up" bl_options = {"REGISTER", "UNDO"} @@ -144,7 +152,9 @@ class PDT_OT_vRotU(Operator): return {"FINISHED"} -class PDT_OT_vRotD(Operator): +class PDT_OT_ViewRotD(Operator): + """Rotate View Down.""" + bl_idname = "pdt.viewdown" bl_label = "Rotate Down" bl_options = {"REGISTER", "UNDO"} @@ -171,7 +181,9 @@ class PDT_OT_vRotD(Operator): return {"FINISHED"} -class PDT_OT_vRoll(Operator): +class PDT_OT_ViewRoll(Operator): + """Roll View.""" + bl_idname = "pdt.viewroll" bl_label = "Roll View" bl_options = {"REGISTER", "UNDO"} @@ -198,7 +210,9 @@ class PDT_OT_vRoll(Operator): return {"FINISHED"} -class PDT_OT_viso(Operator): +class PDT_OT_ViewIso(Operator): + """Set View Isometric.""" + bl_idname = "pdt.viewiso" bl_label = "Isometric View" bl_options = {"REGISTER", "UNDO"} @@ -216,17 +230,17 @@ class PDT_OT_viso(Operator): Status Set. """ # Try working this out in your head! - context.region_data.view_rotation = Quaternion( - (0.8205, 0.4247, -0.1759, -0.3399) - ) - context.region_data.view_perspective = 'ORTHO' + context.region_data.view_rotation = Quaternion((0.8205, 0.4247, -0.1759, -0.3399)) + context.region_data.view_perspective = "ORTHO" return {"FINISHED"} class PDT_OT_Reset3DView(Operator): + """Reset Views to Factory Default.""" + bl_idname = "pdt.reset_3d_view" bl_label = "Reset 3D View" - bl_options = {'REGISTER', 'UNDO'} + bl_options = {"REGISTER", "UNDO"} bl_description = "Reset 3D View to Blender Defaults." def execute(self, context): @@ -241,13 +255,15 @@ class PDT_OT_Reset3DView(Operator): # The default view_distance to the origin when starting up Blender default_view_distance = 17.986562728881836 - default_view_distance = bpy.data.screens['Layout'].areas[-1].spaces[0].region_3d.view_distance + default_view_distance = ( + bpy.data.screens["Layout"].areas[-1].spaces[0].region_3d.view_distance + ) # The default view_matrix when starting up Blender default_view_matrix = ( (0.41, -0.4017, 0.8188, 0.0), (0.912, 0.1936, -0.3617, 0.0), (-0.0133, 0.8950, 0.4458, 0.0), - (0.0, 0.0, -17.9866, 1.0) + (0.0, 0.0, -17.9866, 1.0), ) view = context.region_data @@ -270,4 +286,4 @@ class PDT_OT_Reset3DView(Operator): view.update() debug(f"view_matrix AFTER reset:\n{view.view_matrix}") - return {'FINISHED'} + return {"FINISHED"} |