GPencil Tools: Optimize Undo for Rotate Canvas
[blender-addons.git] / greasepencil_tools / draw_tools.py
blobf8cd27b62c53ceea54eb1fe014cd3332f80de705
1 # SPDX-FileCopyrightText: 2022-2023 Blender Foundation
3 # SPDX-License-Identifier: GPL-2.0-or-later
5 import bpy
7 class VIEW3D_OT_camera_flip_x(bpy.types.Operator):
8 bl_idname = "view3d.camera_flip_x"
9 bl_label = "Camera Flip X"
10 bl_description = "Invert active camera scale.x to flip view horizontally"
11 bl_options = {"REGISTER", "UNDO_GROUPED"}
13 @classmethod
14 def poll(cls, context):
15 return context.area.type == 'VIEW_3D' \
16 and context.space_data.region_3d.view_perspective == 'CAMERA'
18 def execute(self, context):
19 context.scene.camera.scale.x *= -1
20 return {"FINISHED"}
22 def register():
23 bpy.utils.register_class(VIEW3D_OT_camera_flip_x)
25 def unregister():
26 bpy.utils.unregister_class(VIEW3D_OT_camera_flip_x)