From 61aaeb3745ad72c681c17f4535dd06ffaaf78c58 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Fri, 18 Feb 2022 09:12:41 +0100 Subject: Curves: initial brush system integration for curves sculpt mode This adds the boilerplate code that is necessary to use the tool/brush/paint systems in the new sculpt curves mode. Two temporary dummy tools are part of this patch. They do nothing and only serve to test the boilerplate. When the first actual tool is added, those dummy tools will be removed. Differential Revision: https://developer.blender.org/D14117 --- .../modules/bl_keymap_utils/keymap_from_toolbar.py | 1 + .../presets/keyconfig/keymap_data/blender_default.py | 16 ++++++++++++++++ .../scripts/startup/bl_ui/space_toolsystem_toolbar.py | 16 ++++++++++++++++ 3 files changed, 33 insertions(+) (limited to 'release') 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 604d1ffd547..6d41e290512 100644 --- a/release/scripts/modules/bl_keymap_utils/keymap_from_toolbar.py +++ b/release/scripts/modules/bl_keymap_utils/keymap_from_toolbar.py @@ -189,6 +189,7 @@ def generate(context, space_type, *, use_fallback_keys=True, use_reset=True): 'VERTEX_GPENCIL': "gpencil_vertex_tool", 'SCULPT_GPENCIL': "gpencil_sculpt_tool", 'WEIGHT_GPENCIL': "gpencil_weight_tool", + 'SCULPT_CURVES': "curves_sculpt_tool", }.get(mode, None) else: attr = None diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py index 8884b835130..7373615d5ff 100644 --- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -5450,6 +5450,21 @@ def km_font(params): return keymap +def km_sculpt_curves(params): + items = [] + keymap = ( + "Sculpt Curves", + {"space_type": 'EMPTY', "region_type": 'WINDOW'}, + {"items": items}, + ) + + items.extend([ + ("sculpt_curves.brush_stroke", {"type": 'LEFTMOUSE', "value": 'PRESS'}, None), + ]) + + return keymap + + def km_object_non_modal(params): items = [] keymap = ( @@ -7771,6 +7786,7 @@ def generate_keymaps(params=None): km_lattice(params), km_particle(params), km_font(params), + km_sculpt_curves(params), km_object_non_modal(params), # Modal maps. diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py index 338bf5a9d5d..f4aa4c50d76 100644 --- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py +++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py @@ -2306,6 +2306,19 @@ class _defs_gpencil_weight: ) +class _defs_curves_sculpt: + + @staticmethod + def generate_from_brushes(context): + return generate_from_enum_ex( + context, + idname_prefix="builtin_brush.", + icon_prefix="ops.curves.sculpt_", + type= bpy.types.Brush, + attr="curves_sculpt_tool", + ) + + class _defs_gpencil_vertex: @staticmethod @@ -3065,6 +3078,9 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel): else () ), ], + 'SCULPT_CURVES': [ + _defs_curves_sculpt.generate_from_brushes, + ], } -- cgit v1.2.3