[Bf-blender-cvs] [6f6d76554f4] blender2.8: UI: move layer up/down reverse into the operator
Campbell Barton
noreply at git.blender.org
Fri Oct 12 00:55:53 CEST 2018
Commit: 6f6d76554f4eb5335a42874da65d2fca7bbb2cb0
Author: Campbell Barton
Date: Fri Oct 12 09:54:26 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB6f6d76554f4eb5335a42874da65d2fca7bbb2cb0
UI: move layer up/down reverse into the operator
===================================================================
M release/scripts/startup/bl_ui/space_topbar.py
M source/blender/editors/gpencil/gpencil_data.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py
index 192cacd6fea..f40307b5b11 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -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()
diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c
index bfaf0ee2659..64cb91c3e14 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -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))
More information about the Bf-blender-cvs
mailing list