Page MenuHome

Grease Pencil: Draw operator always capture tools
Closed, ResolvedPublicBUG

Description

Note: original text by @Antonio Vazquez (antoniov)

Related to T55420, when I add a new tool to the toolbar, in this case 3D cursor tool to set cursor position, the tool is enabled, but the grease pencil draw operator capture the event before and instead to get a new position of the 3D cursor, what you get is a new stroke on screen.

Revisions and Commits

Event Timeline

@Campbell Barton (campbellbarton) I have added (try) new tools to the draw toolbar, but the tools do not work. I guess all is related to this issue

This is the code I tested:

diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index d5019d1..1fa67ec 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -1393,6 +1393,45 @@ class _defs_gpencil_paint:
             ),
         )
 
+    @ToolDef.from_fn
+    def line():
+        return dict(
+            text="Line",
+            icon="ops.gpencil.primitive_line",
+            widget=None,
+            keymap=(
+                ("gpencil.primitive",
+                 dict(type='LINE'),
+                 dict(type='EVT_TWEAK_A', value='ANY')),
+            ),
+        )
+
+    @ToolDef.from_fn
+    def box():
+        return dict(
+            text="Box",
+            icon="ops.gpencil.primitive_box",
+            widget=None,
+            keymap=(
+                ("gpencil.primitive",
+                 dict(type='BOX'),
+                 dict(type='EVT_TWEAK_A', value='ANY')),
+            ),
+        )
+
+    @ToolDef.from_fn
+    def circle():
+        return dict(
+            text="Circle",
+            icon="ops.gpencil.primitive_circle",
+            widget=None,
+            keymap=(
+                ("gpencil.primitive",
+                 dict(type='CIRCLE'),
+                 dict(type='EVT_TWEAK_A', value='ANY')),
+            ),
+        )
+
 
 class _defs_gpencil_edit:
     @ToolDef.from_fn
@@ -2012,7 +2051,13 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel):
             _defs_weight_paint.gradient,
         ],
         'GPENCIL_PAINT': [
+            _defs_view3d_generic.cursor,
+            None,
             _defs_gpencil_paint.generate_from_brushes,
+            None,
+            _defs_gpencil_paint.line,
+            _defs_gpencil_paint.box,
+            _defs_gpencil_paint.circle,
         ],
         'GPENCIL_EDIT': [
             _defs_view3d_generic.cursor,

When this problem is solved, I can apply this patch for the toolbar, no?

@William Reynish (billrey) @Matias Mendiola (mendio) @Daniel Martinez Lara (pepeland) This is the pending Toolbar new design. I think we will need icons.

When Campbell fix the issue, I can apply the patch and remove the shapes menu.

Here is a toolbar mockup for Draw Mode with the new tools: