Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPullusb <bernou.samuel@gmail.com>2022-03-15 00:53:28 +0300
committerPullusb <bernou.samuel@gmail.com>2022-03-15 00:53:28 +0300
commit80c14a2adc06c92620471b226a64a3540718dd71 (patch)
tree43c726380020cc2cfe447f953285705183677d34
parent82d7d6b8bdec8dfc47c5366607f40b8ff219a718 (diff)
GPencil Tools: Added mirror flip
New button in menu to flip view horizontally within camera by inverting x-scale
-rw-r--r--greasepencil_tools/__init__.py5
-rw-r--r--greasepencil_tools/draw_tools.py23
-rw-r--r--greasepencil_tools/ui_panels.py15
3 files changed, 39 insertions, 4 deletions
diff --git a/greasepencil_tools/__init__.py b/greasepencil_tools/__init__.py
index 0205362b..980493ed 100644
--- a/greasepencil_tools/__init__.py
+++ b/greasepencil_tools/__init__.py
@@ -4,7 +4,7 @@ bl_info = {
"name": "Grease Pencil Tools",
"description": "Extra tools for Grease Pencil",
"author": "Samuel Bernou, Antonio Vazquez, Daniel Martinez Lara, Matias Mendiola",
-"version": (1, 5, 7),
+"version": (1, 6, 0),
"blender": (2, 91, 0),
"location": "Sidebar > Grease Pencil > Grease Pencil Tools",
"warning": "",
@@ -20,6 +20,7 @@ from . import (prefs,
line_reshape,
rotate_canvas,
timeline_scrub,
+ draw_tools,
import_brush_pack,
ui_panels,
)
@@ -32,6 +33,7 @@ def register():
box_deform.register()
line_reshape.register()
rotate_canvas.register()
+ draw_tools.register()
import_brush_pack.register()
ui_panels.register()
@@ -43,6 +45,7 @@ def unregister():
return
ui_panels.unregister()
import_brush_pack.unregister()
+ draw_tools.unregister()
rotate_canvas.unregister()
box_deform.unregister()
line_reshape.unregister()
diff --git a/greasepencil_tools/draw_tools.py b/greasepencil_tools/draw_tools.py
new file mode 100644
index 00000000..6d2cf3a9
--- /dev/null
+++ b/greasepencil_tools/draw_tools.py
@@ -0,0 +1,23 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+import bpy
+
+class GP_OT_camera_flip_x(bpy.types.Operator):
+ bl_idname = "gp.camera_flip_x"
+ bl_label = "Camera Flip X"
+ bl_description = "Invert active camera scale.x to flip view horizontally"
+ bl_options = {"REGISTER"}
+
+ @classmethod
+ def poll(cls, context):
+ return context.space_data.region_3d.view_perspective == 'CAMERA'
+
+ def execute(self, context):
+ context.scene.camera.scale.x *= -1
+ return {"FINISHED"}
+
+def register():
+ bpy.utils.register_class(GP_OT_camera_flip_x)
+
+def unregister():
+ bpy.utils.unregister_class(GP_OT_camera_flip_x)
diff --git a/greasepencil_tools/ui_panels.py b/greasepencil_tools/ui_panels.py
index ff3900de..2e8a50f1 100644
--- a/greasepencil_tools/ui_panels.py
+++ b/greasepencil_tools/ui_panels.py
@@ -20,15 +20,24 @@ class GP_PT_sidebarPanel(bpy.types.Panel):
layout.operator('gp.straight_stroke', icon ="CURVE_PATH")# IPO_LINEAR
- # Expose Native view operators
- # if context.scene.camera:
+ # Expose native view operators
row = layout.row(align=True)
- row.operator('view3d.zoom_camera_1_to_1', text = 'Zoom 1:1', icon = 'ZOOM_PREVIOUS')# FULLSCREEN_EXIT?
+ row.operator('view3d.zoom_camera_1_to_1', text = 'Zoom 1:1', icon = 'ZOOM_PREVIOUS') # FULLSCREEN_EXIT
row.operator('view3d.view_center_camera', text = 'Zoom Fit', icon = 'FULLSCREEN_ENTER')
+
+ # Rotation save/load
row = layout.row(align=True)
row.operator('view3d.rotate_canvas_reset', text = 'Reset Rotation', icon = 'FILE_REFRESH')
row.operator('view3d.rotate_canvas_set', text = 'Save Rotation', icon = 'DRIVER_ROTATIONAL_DIFFERENCE')
+ # View flip
+ if context.scene.camera and context.scene.camera.scale.x < 0:
+ row = layout.row(align=True)
+ row.operator('gp.camera_flip_x', text = 'Camera Mirror Flip', icon = 'MOD_MIRROR')
+ row.label(text='', icon='LOOP_BACK')
+ else:
+ layout.operator('gp.camera_flip_x', text = 'Camera Mirror Flip', icon = 'MOD_MIRROR')
+
def menu_boxdeform_entry(self, context):
"""Transform shortcut to append in existing menu"""