GP: Invert UP/DOWN buttons when layer list is inverted

This fix the task T56985
This commit is contained in:
Antonio Vazquez 2018-10-11 18:27:09 +02:00
parent 18f1175940
commit d6dc8cda8b
Notes: blender-bot 2024-01-31 11:35:08 +01:00
Referenced by issue #56985, GP : Layers : "Invert items order" button doesn't invert the ^v arrows at the side!
2 changed files with 23 additions and 6 deletions

View File

@ -125,11 +125,16 @@ class DATA_PT_gpencil_datapanel(Panel):
self.draw_layers(context, layout, gpd)
def draw_layers(self, context, layout, gpd):
userpref = context.user_preferences
edit = userpref.edit
reverse = edit.use_grease_pencil_reverse_layers
row = layout.row()
col = row.column()
layer_rows = 7
col.template_list("GPENCIL_UL_layer", "", gpd, "layers", gpd.layers, "active_index", rows=layer_rows)
col.template_list("GPENCIL_UL_layer", "", gpd, "layers", gpd.layers, "active_index",
rows=layer_rows, reverse=reverse)
col = row.column()
@ -145,8 +150,12 @@ class DATA_PT_gpencil_datapanel(Panel):
col.separator()
sub = col.column(align=True)
sub.operator("gpencil.layer_move", icon='TRIA_UP', text="").type = 'UP'
sub.operator("gpencil.layer_move", icon='TRIA_DOWN', text="").type = 'DOWN'
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'
col.separator()

View File

@ -352,11 +352,15 @@ class TOPBAR_PT_gpencil_layers(Panel):
self.draw_layers(context, layout, gpd)
def draw_layers(self, context, layout, gpd):
userpref = context.user_preferences
edit = userpref.edit
reverse = edit.use_grease_pencil_reverse_layers
row = layout.row()
col = row.column()
layer_rows = 10
col.template_list("GPENCIL_UL_layer", "", gpd, "layers", gpd.layers, "active_index", rows=layer_rows)
col.template_list("GPENCIL_UL_layer", "", gpd, "layers", gpd.layers, "active_index",
rows=layer_rows, reverse=reverse)
col = row.column()
@ -372,8 +376,12 @@ class TOPBAR_PT_gpencil_layers(Panel):
col.separator()
sub = col.column(align=True)
sub.operator("gpencil.layer_move", icon='TRIA_UP', text="").type = 'UP'
sub.operator("gpencil.layer_move", icon='TRIA_DOWN', text="").type = 'DOWN'
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'
col.separator()