Add Assign Material option to Special menu (W key)

Also some renames and cleanups.
This commit is contained in:
Antonio Vazquez 2018-08-02 19:35:29 +02:00
parent 45751065c0
commit 836db3aee8
Notes: blender-bot 2023-02-14 10:32:59 +01:00
Referenced by issue #56216, Blender Crashes when I add a material
3 changed files with 64 additions and 57 deletions

View File

@ -582,59 +582,6 @@ class GPENCIL_MT_separate(Menu):
layout.operator("gpencil.stroke_separate", text="Active Layer").mode = 'LAYER'
class GPENCIL_MT_gpencil_edit_specials(Menu):
bl_label = "GPencil Specials"
def draw(self, context):
layout = self.layout
is_3d_view = context.space_data.type == 'VIEW_3D'
layout.operator_context = 'INVOKE_REGION_WIN'
layout.operator("gpencil.stroke_subdivide", text="Subdivide")
layout.operator("gpencil.stroke_simplify_fixed", text="Simplify")
layout.operator("gpencil.stroke_simplify", text="Simplify Adaptative")
layout.separator()
layout.menu("GPENCIL_MT_separate", text="Separate")
layout.separator()
layout.operator("gpencil.stroke_split", text="Split")
layout.separator()
layout.operator("gpencil.stroke_join", text="Join").type = 'JOIN'
layout.operator("gpencil.stroke_join", text="Join & Copy").type = 'JOINCOPY'
layout.operator("gpencil.stroke_flip", text="Flip Direction")
layout.separator()
layout.operator("gpencil.frame_duplicate", text="Duplicate Active Frame")
layout.operator("gpencil.frame_duplicate", text="Duplicate Active Frame All Layers").mode = 'ALL'
if is_3d_view:
layout.separator()
layout.operator("gpencil.reproject")
class GPENCIL_MT_gpencil_sculpt_specials(Menu):
bl_label = "GPencil Specials"
def draw(self, context):
layout = self.layout
is_3d_view = context.space_data.type == 'VIEW_3D'
layout.operator_context = 'INVOKE_REGION_WIN'
layout.operator("gpencil.frame_duplicate", text="Duplicate Active Frame")
layout.operator("gpencil.frame_duplicate", text="Duplicate Active Frame All Layers").mode = 'ALL'
layout.separator()
layout.operator("gpencil.stroke_subdivide", text="Subdivide")
layout.operator("gpencil.stroke_simplify_fixed", text="Simplify")
layout.operator("gpencil.stroke_simplify", text="Simplify Adaptative")
class GPENCIL_MT_gpencil_draw_specials(Menu):
bl_label = "GPencil Draw Specials"
@ -859,8 +806,6 @@ classes = (
GPENCIL_MT_snap,
GPENCIL_MT_separate,
GPENCIL_MT_gpencil_edit_specials,
GPENCIL_MT_gpencil_sculpt_specials,
GPENCIL_MT_gpencil_draw_specials,
GPENCIL_MT_gpencil_draw_delete,

View File

@ -3539,6 +3539,7 @@ class VIEW3D_MT_paint_gpencil(Menu):
layout.operator("gpencil.delete", text="Delete Frame").type = 'FRAME'
layout.operator("gpencil.active_frames_delete_all")
class VIEW3D_MT_assign_material(Menu):
bl_label = "Assign Material"
@ -3549,6 +3550,7 @@ class VIEW3D_MT_assign_material(Menu):
for mat in ob.data.materials:
layout.operator("gpencil.stroke_change_color", text=mat.name).material = mat.name
class VIEW3D_MT_edit_gpencil(Menu):
bl_label = "Strokes"
@ -4898,6 +4900,64 @@ class VIEW3D_PT_gpencil_multi_frame(Panel):
layout.template_curve_mapping(settings, "multiframe_falloff_curve", brush=True)
class VIEW3D_MT_gpencil_edit_specials(Menu):
bl_label = "Grease Pencil Specials"
def draw(self, context):
layout = self.layout
is_3d_view = context.space_data.type == 'VIEW_3D'
layout.operator_context = 'INVOKE_REGION_WIN'
layout.menu("VIEW3D_MT_assign_material")
layout.separator()
layout.operator("gpencil.stroke_subdivide", text="Subdivide")
layout.operator("gpencil.stroke_simplify_fixed", text="Simplify")
layout.operator("gpencil.stroke_simplify", text="Simplify Adaptative")
layout.separator()
layout.menu("GPENCIL_MT_separate", text="Separate")
layout.separator()
layout.operator("gpencil.stroke_split", text="Split")
layout.separator()
layout.operator("gpencil.stroke_join", text="Join").type = 'JOIN'
layout.operator("gpencil.stroke_join", text="Join & Copy").type = 'JOINCOPY'
layout.operator("gpencil.stroke_flip", text="Flip Direction")
layout.separator()
layout.operator("gpencil.frame_duplicate", text="Duplicate Active Frame")
layout.operator("gpencil.frame_duplicate", text="Duplicate Active Frame All Layers").mode = 'ALL'
if is_3d_view:
layout.separator()
layout.operator("gpencil.reproject")
class VIEW3D_MT_gpencil_sculpt_specials(Menu):
bl_label = "Grease Pencil Specials"
def draw(self, context):
layout = self.layout
is_3d_view = context.space_data.type == 'VIEW_3D'
layout.operator_context = 'INVOKE_REGION_WIN'
layout.menu("VIEW3D_MT_assign_material")
layout.separator()
layout.operator("gpencil.frame_duplicate", text="Duplicate Active Frame")
layout.operator("gpencil.frame_duplicate", text="Duplicate Active Frame All Layers").mode = 'ALL'
layout.separator()
layout.operator("gpencil.stroke_subdivide", text="Subdivide")
layout.operator("gpencil.stroke_simplify_fixed", text="Simplify")
layout.operator("gpencil.stroke_simplify", text="Simplify Adaptative")
classes = (
VIEW3D_HT_header,
VIEW3D_MT_editor_menus,
@ -5041,6 +5101,8 @@ classes = (
VIEW3D_PT_object_type_visibility,
VIEW3D_PT_grease_pencil,
VIEW3D_PT_gpencil_multi_frame,
VIEW3D_MT_gpencil_edit_specials,
VIEW3D_MT_gpencil_sculpt_specials,
VIEW3D_PT_quad_view,
VIEW3D_PT_view3d_stereo,
VIEW3D_PT_shading,

View File

@ -299,7 +299,7 @@ static void ed_keymap_gpencil_sculpt(wmKeyMap *keymap)
RNA_string_set(kmi->ptr, "data_path_primary", "tool_settings.gpencil_sculpt.brush.size");
/* menu sculpt specials */
WM_keymap_add_menu(keymap, "GPENCIL_MT_gpencil_sculpt_specials", WKEY, KM_PRESS, 0, 0);
WM_keymap_add_menu(keymap, "VIEW3D_MT_gpencil_sculpt_specials", WKEY, KM_PRESS, 0, 0);
}
static void ed_keymap_gpencil_weight(wmKeyMap *keymap)
@ -371,7 +371,7 @@ static void ed_keymap_gpencil_editing(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "GPENCIL_OT_active_frames_delete_all", DELKEY, KM_PRESS, KM_SHIFT, 0);
/* menu edit specials */
WM_keymap_add_menu(keymap, "GPENCIL_MT_gpencil_edit_specials", WKEY, KM_PRESS, 0, 0);
WM_keymap_add_menu(keymap, "VIEW3D_MT_gpencil_edit_specials", WKEY, KM_PRESS, 0, 0);
/* menu separate */
WM_keymap_add_menu(keymap, "GPENCIL_MT_separate", PKEY, KM_PRESS, 0, 0);