code fix on operators and draw cam handler

2.0.5

- changed: redo panel for GP layer picker has better name and display active layer name
- changed: some operator id_name to expose "add shortcut" in context menu for some button
- fixed: error with draw_cam handler when no camera is active
This commit is contained in:
Pullusb
2022-10-07 02:20:28 +02:00
parent 43a28876d1
commit 8e3b3871e6
6 changed files with 29 additions and 17 deletions
+6 -7
View File
@@ -58,15 +58,14 @@ class GPTB_PT_sidebar_panel(Panel):
# layout.label(text='View options:')
col = layout.column()
## flip X cam
if context.scene.camera and context.scene.camera.scale.x < 0:
# layout.label(text='! Flipped !')
row = col.row(align=True)
# layout.label(text='! Flipped !')
row = col.row(align=True)
row.operator('gp.mirror_flipx', text = 'Mirror flip', icon = 'MOD_MIRROR')# ARROW_LEFTRIGHT
row.operator('view3d.camera_mirror_flipx', text = 'Mirror Flip', icon = 'MOD_MIRROR')# ARROW_LEFTRIGHT
if context.scene.camera and context.scene.camera.scale.x < 0:
row.label(text='',icon='LOOP_BACK')
else:
col.operator('gp.mirror_flipx', text = 'Mirror flip', icon = 'MOD_MIRROR')# ARROW_LEFTRIGHT
## draw/manipulation camera
if context.scene.camera and context.scene.camera.name.startswith(('draw', 'obj')):
@@ -130,7 +129,7 @@ class GPTB_PT_sidebar_panel(Panel):
## Straight line ops from official greasepencil_tools addon if enabled.
# if any(x in context.preferences.addons.keys() for x in ('greasepencil_tools', 'greasepencil-addon')): # check enabled addons
if hasattr(bpy.types, 'GP_OT_straight_stroke'): # check if operator exists : bpy.ops.gp.straight_stroke.idname()
layout.operator('gp.straight_stroke', icon ="CURVE_PATH")
layout.operator(bpy.types.GP_OT_straight_stroke.bl_idname, icon ="CURVE_PATH")
## Options
col = layout.column()