GPv3: Add separate paint mode
This patch adds a separate paint mode for Grease Pencil 3.0. Pull Request: https://projects.blender.org/blender/blender/pulls/109453
This commit is contained in:
@@ -5170,6 +5170,26 @@ def km_weight_paint(params):
|
||||
return keymap
|
||||
|
||||
|
||||
def km_grease_pencil_paint(params):
|
||||
items = []
|
||||
keymap = (
|
||||
"Grease Pencil Paint Mode",
|
||||
{"space_type": 'EMPTY', "region_type": 'WINDOW'},
|
||||
{"items": items},
|
||||
)
|
||||
|
||||
items.extend([
|
||||
("grease_pencil.brush_stroke", {"type": 'LEFTMOUSE', "value": 'PRESS'},
|
||||
{"properties": [("mode", 'NORMAL')]}),
|
||||
("grease_pencil.brush_stroke", {"type": 'LEFTMOUSE', "value": 'PRESS', "ctrl": True},
|
||||
{"properties": [("mode", 'INVERT')]}),
|
||||
("grease_pencil.brush_stroke", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True},
|
||||
{"properties": [("mode", 'SMOOTH')]}),
|
||||
])
|
||||
|
||||
return keymap
|
||||
|
||||
|
||||
def km_sculpt(params):
|
||||
items = []
|
||||
keymap = (
|
||||
@@ -8266,6 +8286,7 @@ def generate_keymaps(params=None):
|
||||
km_image_paint(params),
|
||||
km_vertex_paint(params),
|
||||
km_weight_paint(params),
|
||||
km_grease_pencil_paint(params),
|
||||
km_sculpt(params),
|
||||
km_mesh(params),
|
||||
km_armature(params),
|
||||
|
||||
@@ -1731,6 +1731,18 @@ class _defs_weight_paint:
|
||||
)
|
||||
|
||||
|
||||
class _defs_paint_grease_pencil:
|
||||
|
||||
@ToolDef.from_fn
|
||||
def draw():
|
||||
return dict(
|
||||
idname="builtin_brush.Draw",
|
||||
label="Draw",
|
||||
icon="brush.gpencil_draw.draw",
|
||||
data_block='DRAW',
|
||||
)
|
||||
|
||||
|
||||
class _defs_image_generic:
|
||||
|
||||
@staticmethod
|
||||
@@ -1972,13 +1984,6 @@ class _defs_gpencil_paint:
|
||||
|
||||
@staticmethod
|
||||
def generate_from_brushes(context):
|
||||
if context and context.preferences.experimental.use_grease_pencil_version3:
|
||||
return tuple([ToolDef.from_dict(dict(
|
||||
idname="builtin_brush.Draw",
|
||||
label="Draw",
|
||||
icon="brush.gpencil_draw.draw",
|
||||
data_block='DRAW',
|
||||
))])
|
||||
return generate_from_enum_ex(
|
||||
context,
|
||||
idname_prefix="builtin_brush.",
|
||||
@@ -3096,6 +3101,11 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel):
|
||||
),
|
||||
*_tools_annotate,
|
||||
],
|
||||
'PAINT_GREASE_PENCIL': [
|
||||
_defs_view3d_generic.cursor,
|
||||
None,
|
||||
_defs_paint_grease_pencil.draw,
|
||||
],
|
||||
'PAINT_GPENCIL': [
|
||||
_defs_view3d_generic.cursor,
|
||||
None,
|
||||
|
||||
@@ -967,7 +967,7 @@ class VIEW3D_MT_editor_menus(Menu):
|
||||
layout.menu("VIEW3D_MT_select_paint_mask")
|
||||
elif mesh.use_paint_mask_vertex and mode_string in {'PAINT_WEIGHT', 'PAINT_VERTEX'}:
|
||||
layout.menu("VIEW3D_MT_select_paint_mask_vertex")
|
||||
elif mode_string not in {'SCULPT', 'SCULPT_CURVES'}:
|
||||
elif mode_string not in {'SCULPT', 'SCULPT_CURVES', 'PAINT_GREASE_PENCIL'}:
|
||||
layout.menu("VIEW3D_MT_select_%s" % mode_string.lower())
|
||||
|
||||
if gp_edit:
|
||||
@@ -2001,6 +2001,12 @@ class VIEW3D_MT_select_edit_grease_pencil(Menu):
|
||||
layout.operator("grease_pencil.select_more")
|
||||
layout.operator("grease_pencil.select_less")
|
||||
|
||||
class VIEW3D_MT_paint_grease_pencil(Menu):
|
||||
bl_label = "Paint"
|
||||
|
||||
def draw(self, _context):
|
||||
pass
|
||||
|
||||
|
||||
class VIEW3D_MT_paint_gpencil(Menu):
|
||||
bl_label = "Paint"
|
||||
@@ -8327,6 +8333,7 @@ classes = (
|
||||
VIEW3D_MT_edit_mesh_merge,
|
||||
VIEW3D_MT_edit_mesh_split,
|
||||
VIEW3D_MT_edit_mesh_showhide,
|
||||
VIEW3D_MT_paint_grease_pencil,
|
||||
VIEW3D_MT_paint_gpencil,
|
||||
VIEW3D_MT_draw_gpencil,
|
||||
VIEW3D_MT_assign_material,
|
||||
|
||||
Reference in New Issue
Block a user