UI: move layer up/down reverse into the operator

This commit is contained in:
Campbell Barton 2018-10-12 09:54:26 +11:00
parent 45881003f0
commit 6f6d76554f
2 changed files with 4 additions and 7 deletions

@ -376,12 +376,8 @@ class TOPBAR_PT_gpencil_layers(Panel):
col.separator()
sub = col.column(align=True)
if reverse is False:
sub.operator("gpencil.layer_move", icon='TRIA_UP', text="").type = 'UP'
sub.operator("gpencil.layer_move", icon='TRIA_DOWN', text="").type = 'DOWN'
else:
sub.operator("gpencil.layer_move", icon='TRIA_UP', text="").type = 'DOWN'
sub.operator("gpencil.layer_move", icon='TRIA_DOWN', text="").type = 'UP'
sub.operator("gpencil.layer_move", icon='TRIA_UP', text="").type = 'UP'
sub.operator("gpencil.layer_move", icon='TRIA_DOWN', text="").type = 'DOWN'
col.separator()

@ -338,7 +338,8 @@ static int gp_layer_move_exec(bContext *C, wmOperator *op)
bGPdata *gpd = ED_gpencil_data_get_active(C);
bGPDlayer *gpl = BKE_gpencil_layer_getactive(gpd);
int direction = RNA_enum_get(op->ptr, "type");
const bool reverse = (bool)(U.gp_settings & GP_PAINT_REVERSE_LAYERS);
const int direction = RNA_enum_get(op->ptr, "type") * (reverse ? -1 : 1);
/* sanity checks */
if (ELEM(NULL, gpd, gpl))