diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2019-08-30 14:00:21 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2019-08-30 14:00:41 +0300 |
commit | 040d075f17ede12b589b08b6fe13b9e667740487 (patch) | |
tree | ef591381595210c99387a5196f4b5debfc731314 /release | |
parent | 44ace647a8ec0d112700afe0c394ec25257fc04f (diff) |
GPencil: Fix unreported problem with Move to Layer popup
As the operator was designed to use only as popup, when it was used as menu option, the popup was displayed again.
Reviewers: mendio, pepeland
Differential Revision: https://developer.blender.org/D5630
Diffstat (limited to 'release')
3 files changed, 27 insertions, 2 deletions
diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py index 65ea5e695f5..f789da6f3fa 100644 --- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -3063,7 +3063,7 @@ def km_grease_pencil_stroke_edit_mode(params): # Isolate layer ("gpencil.layer_isolate", {"type": 'NUMPAD_ASTERIX', "value": 'PRESS'}, None), # Move to layer - ("gpencil.move_to_layer", {"type": 'M', "value": 'PRESS'}, None), + op_menu("GPENCIL_MT_move_to_layer", {"type": 'M', "value": 'PRESS'}), # Transform tools ("transform.translate", {"type": 'G', "value": 'PRESS'}, None), ("transform.translate", {"type": params.select_tweak, "value": 'ANY'}, None), diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py index b87e4e2d0b7..9c8f62fb906 100644 --- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py +++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py @@ -591,6 +591,30 @@ class GPENCIL_MT_snap(Menu): layout.operator("view3d.snap_cursor_to_grid", text="Cursor to Grid") +class GPENCIL_MT_move_to_layer(Menu): + bl_label = "Move to Layer" + + def draw(self, context): + layout = self.layout + gpd = context.gpencil_data + if gpd: + gpl_active = context.active_gpencil_layer + tot_layers = len(gpd.layers) + i = tot_layers - 1 + while(i >= 0): + gpl = gpd.layers[i] + if gpl.info == gpl_active.info: + icon='GREASEPENCIL' + else: + icon = 'NONE' + layout.operator("gpencil.move_to_layer", text=gpl.info, icon=icon).layer=i + i -= 1 + + layout.separator() + + layout.operator("gpencil.layer_add", text="New Layer", icon='ADD') + + class GPENCIL_MT_gpencil_draw_delete(Menu): bl_label = "Delete" @@ -934,6 +958,7 @@ classes = ( GPENCIL_MT_snap, GPENCIL_MT_cleanup, + GPENCIL_MT_move_to_layer, GPENCIL_MT_gpencil_draw_delete, diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index db51523dc6c..c6dd6aed38d 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -4501,7 +4501,7 @@ class VIEW3D_MT_edit_gpencil_stroke(Menu): layout.separator() - layout.operator_menu_enum("gpencil.move_to_layer", "layer", text="Move to Layer") + layout.menu("GPENCIL_MT_move_to_layer") layout.menu("VIEW3D_MT_assign_material") layout.operator_menu_enum("gpencil.stroke_arrange", "direction", text="Arrange Strokes") |