Commit: 714001683888770f9d870ba73edd65f4c2757bda Author: Antonio Vazquez Date: Tue Jun 21 16:38:58 2022 +0200 Branches: master https://developer.blender.org/rB714001683888770f9d870ba73edd65f4c2757bda
GPencil: Move New Layer option to menu top The new layer option must be the first in the menu. Differential Revision: https://developer.blender.org/D15255 =================================================================== M release/scripts/startup/bl_ui/properties_grease_pencil_common.py M source/blender/editors/gpencil/gpencil_utils.c =================================================================== 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 8e5050be07e..8c43186313f 100644 --- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py +++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py @@ -234,6 +234,11 @@ class GPENCIL_MT_move_to_layer(Menu): layout = self.layout gpd = context.gpencil_data if gpd: + layout.operator_context = 'INVOKE_REGION_WIN' + layout.operator("gpencil.move_to_layer", text="New Layer", icon='ADD').layer = -1 + + layout.separator() + gpl_active = context.active_gpencil_layer tot_layers = len(gpd.layers) i = tot_layers - 1 @@ -246,11 +251,6 @@ class GPENCIL_MT_move_to_layer(Menu): layout.operator("gpencil.move_to_layer", text=gpl.info, icon=icon, translate=False).layer = i i -= 1 - layout.separator() - - layout.operator_context = 'INVOKE_REGION_WIN' - layout.operator("gpencil.move_to_layer", text="New Layer", icon='ADD').layer = -1 - class GPENCIL_MT_layer_active(Menu): bl_label = "Change Active Layer" @@ -261,6 +261,10 @@ class GPENCIL_MT_layer_active(Menu): gpd = context.gpencil_data if gpd: + layout.operator("gpencil.layer_add", text="New Layer", icon='ADD') + + layout.separator() + gpl_active = context.active_gpencil_layer tot_layers = len(gpd.layers) i = tot_layers - 1 @@ -273,10 +277,6 @@ class GPENCIL_MT_layer_active(Menu): layout.operator("gpencil.layer_active", text=gpl.info, icon=icon).layer = i i -= 1 - layout.separator() - - layout.operator("gpencil.layer_add", text="New Layer", icon='ADD') - class GPENCIL_MT_material_active(Menu): bl_label = "Change Active Material" diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c index fc5b3838900..7b659511aaa 100644 --- a/source/blender/editors/gpencil/gpencil_utils.c +++ b/source/blender/editors/gpencil/gpencil_utils.c @@ -388,6 +388,17 @@ const EnumPropertyItem *ED_gpencil_layers_with_new_enum_itemf(bContext *C, /* Create new layer */ /* TODO: have some way of specifying that we don't want this? */ + { + /* "New Layer" entry */ + item_tmp.identifier = "__CREATE__"; + item_tmp.name = "New Layer"; + item_tmp.value = -1; + item_tmp.icon = ICON_ADD; + RNA_enum_item_add(&item, &totitem, &item_tmp); + + /* separator */ + RNA_enum_item_add_separator(&item, &totitem); + } const int tot = BLI_listbase_count(&gpd->layers); /* Existing layers */ @@ -405,17 +416,6 @@ const EnumPropertyItem *ED_gpencil_layers_with_new_enum_itemf(bContext *C, RNA_enum_item_add(&item, &totitem, &item_tmp); } - { - /* separator */ - RNA_enum_item_add_separator(&item, &totitem); - - /* "New Layer" entry */ - item_tmp.identifier = "__CREATE__"; - item_tmp.name = "New Layer"; - item_tmp.value = -1; - item_tmp.icon = ICON_ADD; - RNA_enum_item_add(&item, &totitem, &item_tmp); - } RNA_enum_item_end(&item, &totitem); *r_free = true; _______________________________________________ Bf-blender-cvs mailing list [email protected] List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
