[Bf-blender-cvs] [e226e0df505] greasepencil-object: GPencil: First steps to create a new Vertex Mode
Antonio Vazquez
noreply at git.blender.org
Thu Nov 7 18:07:18 CET 2019
Commit: e226e0df505edc4b686b0b182d57faaaecacb0bd
Author: Antonio Vazquez
Date: Wed Nov 6 20:05:04 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rBe226e0df505edc4b686b0b182d57faaaecacb0bd
GPencil: First steps to create a new Vertex Mode
===================================================================
M release/scripts/modules/bl_keymap_utils/keymap_from_toolbar.py
M release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py
M release/scripts/presets/keyconfig/keymap_data/blender_default.py
M release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
M release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
M release/scripts/startup/bl_ui/space_view3d.py
M release/scripts/startup/bl_ui/space_view3d_toolbar.py
M source/blender/blenkernel/BKE_context.h
M source/blender/blenkernel/BKE_paint.h
M source/blender/blenkernel/intern/context.c
M source/blender/blenkernel/intern/library_query.c
M source/blender/blenkernel/intern/paint.c
M source/blender/blenkernel/intern/paint_toolslots.c
M source/blender/blenkernel/intern/scene.c
M source/blender/blenloader/intern/readfile.c
M source/blender/blenloader/intern/writefile.c
M source/blender/draw/intern/draw_manager.c
M source/blender/editors/gpencil/gpencil_edit.c
M source/blender/editors/gpencil/gpencil_intern.h
M source/blender/editors/gpencil/gpencil_ops.c
M source/blender/editors/gpencil/gpencil_utils.c
M source/blender/editors/object/object_edit.c
M source/blender/editors/object/object_modes.c
M source/blender/editors/sculpt_paint/paint_ops.c
M source/blender/editors/space_view3d/space_view3d.c
M source/blender/editors/space_view3d/view3d_select.c
M source/blender/editors/transform/transform_convert.c
M source/blender/editors/undo/ed_undo.c
M source/blender/makesdna/DNA_brush_types.h
M source/blender/makesdna/DNA_gpencil_types.h
M source/blender/makesdna/DNA_object_enums.h
M source/blender/makesdna/DNA_scene_types.h
M source/blender/makesrna/RNA_enum_types.h
M source/blender/makesrna/intern/rna_brush.c
M source/blender/makesrna/intern/rna_context.c
M source/blender/makesrna/intern/rna_gpencil.c
M source/blender/makesrna/intern/rna_object.c
M source/blender/makesrna/intern/rna_scene.c
M source/blender/makesrna/intern/rna_sculpt_paint.c
M source/blender/windowmanager/intern/wm_keymap_utils.c
M source/blender/windowmanager/intern/wm_toolsystem.c
===================================================================
diff --git a/release/scripts/modules/bl_keymap_utils/keymap_from_toolbar.py b/release/scripts/modules/bl_keymap_utils/keymap_from_toolbar.py
index da4a47783ad..586c3180900 100644
--- a/release/scripts/modules/bl_keymap_utils/keymap_from_toolbar.py
+++ b/release/scripts/modules/bl_keymap_utils/keymap_from_toolbar.py
@@ -199,6 +199,7 @@ def generate(context, space_type, use_fallback_keys=True, use_reset=True):
'WEIGHT_PAINT': "weight_tool",
'TEXTURE_PAINT': "image_tool",
'PAINT_GPENCIL': "gpencil_tool",
+ 'VERTEX_GPENCIL': "gpencil_vertex_tool",
}.get(mode, None)
if attr is not None:
setattr(kmi_hack_brush_select_properties, attr, item.data_block)
diff --git a/release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py b/release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py
index 211059bd850..88a6d48fddf 100644
--- a/release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py
+++ b/release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py
@@ -198,6 +198,7 @@ _km_hierarchy = [
('Grease Pencil Stroke Paint Mode', 'EMPTY', 'WINDOW', []),
('Grease Pencil Stroke Sculpt Mode', 'EMPTY', 'WINDOW', []),
('Grease Pencil Stroke Weight Mode', 'EMPTY', 'WINDOW', []),
+ ('Grease Pencil Stroke Vertex Mode', 'EMPTY', 'WINDOW', []),
]),
('Mask Editing', 'EMPTY', 'WINDOW', []),
('Frames', 'EMPTY', 'WINDOW', []), # frame navigation (per region)
diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 6cb8e31e546..32df7c75aa0 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -3347,6 +3347,33 @@ def km_grease_pencil_stroke_weight_mode(_params):
return keymap
+def km_grease_pencil_stroke_vertex_mode(_params):
+ items = []
+ keymap = (
+ "Grease Pencil Stroke Vertex Mode",
+ {"space_type": 'EMPTY', "region_type": 'WINDOW'},
+ {"items": items},
+ )
+
+ items.extend([
+ # Tint
+ ("gpencil.tint", {"type": 'LEFTMOUSE', "value": 'PRESS'},
+ {"properties": [("wait_for_input", False)]}),
+ ("gpencil.tint", {"type": 'LEFTMOUSE', "value": 'PRESS', "ctrl": True},
+ {"properties": [("wait_for_input", False)]}),
+ # Brush strength
+ ("wm.radial_control", {"type": 'F', "value": 'PRESS', "shift": True},
+ {"properties": [("data_path_primary", 'tool_settings.gpencil_vertex_paint.brush.gpencil_settings.pen_strength')]}),
+ # Brush size
+ ("wm.radial_control", {"type": 'F', "value": 'PRESS'},
+ {"properties": [("data_path_primary", 'tool_settings.gpencil_vertex_paint.brush.size')]}),
+ # Display
+ *_grease_pencil_display(),
+ ])
+
+ return keymap
+
+
def km_face_mask(params):
items = []
keymap = (
@@ -6145,6 +6172,7 @@ def generate_keymaps(params=None):
km_grease_pencil_stroke_paint_tint(params),
km_grease_pencil_stroke_sculpt_mode(params),
km_grease_pencil_stroke_weight_mode(params),
+ km_grease_pencil_stroke_vertex_mode(params),
km_face_mask(params),
km_weight_paint_vertex_selection(params),
km_pose(params),
diff --git a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
index 0ecffefc2b9..1e6a905fb05 100644
--- a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
+++ b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
@@ -2542,6 +2542,33 @@ def km_grease_pencil_stroke_weight_mode(params):
return keymap
+def km_grease_pencil_stroke_vertex_mode(_params):
+ items = []
+ keymap = (
+ "Grease Pencil Stroke Vertex Mode",
+ {"space_type": 'EMPTY', "region_type": 'WINDOW'},
+ {"items": items},
+ )
+
+ items.extend([
+ # Tint
+ ("gpencil.tint", {"type": 'LEFTMOUSE', "value": 'PRESS'},
+ {"properties": [("wait_for_input", False)]}),
+ ("gpencil.tint", {"type": 'LEFTMOUSE', "value": 'PRESS', "ctrl": True},
+ {"properties": [("wait_for_input", False)]}),
+ # Brush strength
+ ("wm.radial_control", {"type": 'F', "value": 'PRESS', "shift": True},
+ {"properties": [("data_path_primary", 'tool_settings.gpencil_vertex_paint.brush.gpencil_settings.pen_strength')]}),
+ # Brush size
+ ("wm.radial_control", {"type": 'F', "value": 'PRESS'},
+ {"properties": [("data_path_primary", 'tool_settings.gpencil_vertex_paint.brush.size')]}),
+ # Display
+ *_grease_pencil_display(),
+ ])
+
+ return keymap
+
+
def km_face_mask(params):
items = []
keymap = (
@@ -3812,6 +3839,7 @@ def generate_keymaps(params=None):
km_grease_pencil_stroke_paint_tint(params),
km_grease_pencil_stroke_sculpt_mode(params),
km_grease_pencil_stroke_weight_mode(params),
+ km_grease_pencil_stroke_vertex_mode(params),
km_face_mask(params),
km_weight_paint_vertex_selection(params),
km_pose(params),
diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index 736fc12c5ae..cf8031dd644 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -1559,6 +1559,7 @@ class _defs_gpencil_edit:
draw_settings=draw_settings,
)
+
class _defs_gpencil_sculpt:
@staticmethod
@@ -1603,6 +1604,23 @@ class _defs_gpencil_weight:
)
+class _defs_gpencil_vertex:
+
+ @staticmethod
+ def generate_from_brushes(context):
+ return generate_from_enum_ex(
+ context,
+ idname_prefix="builtin_brush.",
+ icon_prefix="brush.paint_vertex.",
+ type=bpy.types.Brush,
+ attr="gpencil_vertex_tool",
+ cursor='DOT',
+ tooldef_keywords=dict(
+ operator="gpencil.tint",
+ ),
+ )
+
+
class _defs_node_select:
@ToolDef.from_fn
@@ -2117,6 +2135,9 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel):
'WEIGHT_GPENCIL': [
_defs_gpencil_weight.generate_from_brushes,
],
+ 'VERTEX_GPENCIL': [
+ _defs_gpencil_vertex.generate_from_brushes,
+ ],
}
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 442b6e0b97c..b207f18a4e2 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -111,6 +111,9 @@ class VIEW3D_HT_tool_header(Header):
elif tool_mode == 'PAINT_GPENCIL':
if (tool is not None) and tool.has_datablock:
layout.popover_group(context=".greasepencil_paint", **popover_kw)
+ elif tool_mode == 'VERTEX_GPENCIL':
+ if (tool is not None) and tool.has_datablock:
+ layout.popover_group(context=".greasepencil_vertex", **popover_kw)
elif tool_mode == 'SCULPT_GPENCIL':
layout.popover_group(context=".greasepencil_sculpt", **popover_kw)
elif tool_mode == 'WEIGHT_GPENCIL':
@@ -198,7 +201,7 @@ class VIEW3D_HT_tool_header(Header):
layout.popover_group(context=".particlemode", **popover_kw)
elif mode_string == 'OBJECT':
layout.popover_group(context=".objectmode", **popover_kw)
- elif mode_string in {'PAINT_GPENCIL', 'EDIT_GPENCIL', 'SCULPT_GPENCIL', 'WEIGHT_GPENCIL'}:
+ elif mode_string in {'PAINT_GPENCIL', 'EDIT_GPENCIL', 'SCULPT_GPENCIL', 'WEIGHT_GPENCIL', 'VERTEX_GPENCIL'}:
# Grease pencil layer.
gpl = context.active_gpencil_layer
if gpl and gpl.info is not None:
@@ -411,6 +414,37 @@ class _draw_tool_settings_context_mode:
)
brush_basic_gpencil_weight_settings(layout, context, brush, compact=True)
+ @staticmethod
+ def VERTEX_GPENCIL(context, layout, tool):
+ if tool is None:
+ return
+
+ if not tool.has_datablock:
+ return
+
+ paint = context.tool_settings.gpencil_vertex_paint
+ brush = paint.brush
+ if brush is None:
+ return
+
+ row = layout.row(align=True)
+ tool_settings = context.scene.tool_settings
+ settings = tool_settings.gpencil_vertex_paint
+ row.template_ID_preview(settings, "brush", rows=3, cols=8, hide_buttons=True)
+
+ row.separator(factor=0.4)
+ row.prop(brush, "color", text="")
+ # row.popover(
+ # panel="TOPBAR_PT_gpencil_vertexcolor",
+ # text="Vertex Color",
+ # )
+
+ from bl_ui.properties_paint_common import (
+ brush_basic_gpencil_paint_settings,
+ )
+
+ brush_basic_gpencil_paint_settings(layout, context, brush, tool, compact=True, is_toolbar=True)
+
@staticmethod
def PARTICLE(context, layout, tool):
if (tool is None) or (not tool.has_datablock):
@@ -743,14 +777,15 @@ class VIEW3D_MT_editor_menus(Menu):
obj = context.active_object
mode_string = context.mode
edit_object = context.edit_object
- gp_edit = obj and obj.mode in {'EDIT_GPENCIL', 'PAINT_GPENCIL', 'SCULPT_GPENCIL', 'WEIGHT_GPENCIL'}
+ gp_edit = obj and obj.mode in {'EDIT_GPENCIL', 'PAINT_GPENCIL', 'SCULPT_GPENCIL',
+ 'WEIGHT_GPENCIL', 'VERTEX_GPENCIL'}
ts = context.scene.tool_settings
layout.menu("VIEW3D_MT_view")
# Select Menu
if gp_edit:
- if mode_string not in {'PAINT_GPENCIL', 'WEIGHT_GPENCIL'}:
+ if mode_string not in {'PAINT_GPENCIL', 'WEIGHT_GPENCIL', 'VERTEX_GPENCIL'}:
if mode_string == 'SCULPT_GPENCIL' and \
(ts.use_gpencil_select_mask_point or
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list