GP: Remove Layer order userprefs parameter

After a lot of discussion about this option (see 18f1175940) we have decided set always the order of GP layers in 2D mode (Top->Down) and remove the parameter from User Preferences screen.

Internally all works equal, but in the UI the list is inverted.

The filter buttons to reverse the list or sort alphabetically have been removed because these buttons are not logic in this context.
This commit is contained in:
Antonio Vazquez 2018-10-13 20:34:11 +02:00
parent dd6bf3f84a
commit b8327ee129
6 changed files with 5 additions and 33 deletions

View File

@ -125,16 +125,13 @@ 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, reverse=reverse)
rows=layer_rows, reverse=True)
col = row.column()

View File

@ -352,15 +352,12 @@ 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, reverse=reverse)
rows=layer_rows, reverse=True)
col = row.column()

View File

@ -274,10 +274,6 @@ class USERPREF_PT_edit(Panel):
col.prop(edit, "grease_pencil_euclidean_distance", text="Euclidean Distance")
col.separator()
col.label(text="Grease Pencil:")
col.prop(edit, "use_grease_pencil_reverse_layers", text="Layers order Top-Down")
col.separator()
col.label(text="Annotations:")
sub = col.row()
sub.prop(edit, "grease_pencil_default_color", text="Default Color")

View File

@ -338,8 +338,7 @@ 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);
const bool reverse = (bool)(U.gp_settings & GP_PAINT_REVERSE_LAYERS);
const int direction = RNA_enum_get(op->ptr, "type") * (reverse ? -1 : 1);
const int direction = RNA_enum_get(op->ptr, "type") * -1;
/* sanity checks */
if (ELEM(NULL, gpd, gpl))
@ -1084,18 +1083,8 @@ void GPENCIL_OT_layer_isolate(wmOperatorType *ot)
static int gp_merge_layer_exec(bContext *C, wmOperator *op)
{
bGPdata *gpd = ED_gpencil_data_get_active(C);
const bool reverse = (bool)(U.gp_settings & GP_PAINT_REVERSE_LAYERS);
bGPDlayer *gpl_current = NULL;
bGPDlayer *gpl_next = NULL;
if (!reverse) {
gpl_current = BKE_gpencil_layer_getactive(gpd);
gpl_next = gpl_current->next;
}
else {
gpl_next = BKE_gpencil_layer_getactive(gpd);
gpl_current = gpl_next->prev;
}
bGPDlayer *gpl_next = BKE_gpencil_layer_getactive(gpd);
bGPDlayer *gpl_current = gpl_next->prev;
if (ELEM(NULL, gpd, gpl_current, gpl_next)) {
BKE_report(op->reports, RPT_ERROR, "No layers to merge");

View File

@ -885,7 +885,6 @@ typedef enum eText_Draw_Options {
typedef enum eGP_UserdefSettings {
GP_PAINT_DOSMOOTH = (1 << 0),
GP_PAINT_DOSIMPLIFY = (1 << 1),
GP_PAINT_REVERSE_LAYERS = (1 << 2),
} eGP_UserdefSettings;
enum {

View File

@ -3994,17 +3994,11 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "gp_settings", GP_PAINT_DOSIMPLIFY);
RNA_def_property_ui_text(prop, "Grease Pencil Simplify Stroke", "Simplify the final stroke");
prop = RNA_def_property(srna, "use_grease_pencil_reverse_layers", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "gp_settings", GP_PAINT_REVERSE_LAYERS);
RNA_def_property_ui_text(prop, "Layers list Top-Down",
"Order the grease pencil list of layers from Top to Down");
prop = RNA_def_property(srna, "grease_pencil_eraser_radius", PROP_INT, PROP_PIXEL);
RNA_def_property_int_sdna(prop, NULL, "gp_eraser");
RNA_def_property_range(prop, 1, 500);
RNA_def_property_ui_text(prop, "Grease Pencil Eraser Radius", "Radius of eraser 'brush'");
prop = RNA_def_property(srna, "grease_pencil_default_color", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "gpencil_new_layer_col");
RNA_def_property_array(prop, 4);