Grease Pencil: Draw operator always capture tools #57527

Closed
opened 2018-10-31 00:13:04 +01:00 by Campbell Barton · 10 comments

Note: original text by @antoniov

Related to #55420, 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.

*Note: original text by @antoniov* Related to #55420, 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.
Campbell Barton self-assigned this 2018-10-31 00:13:04 +01:00
Author
Owner

Added subscribers: @antoniov, @ideasman42, @WilliamReynish, @Djay

Added subscribers: @antoniov, @ideasman42, @WilliamReynish, @Djay
Author
Owner

Removed subscribers: @Djay, @WilliamReynish

Removed subscribers: @Djay, @WilliamReynish

@ideasman42 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:

image.png

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?

@ideasman42 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: ![image.png](https://archive.blender.org/developer/F5353113/image.png) ``` 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?

Added subscribers: @mendio, @billrey, @pepe-school-land

Added subscribers: @mendio, @billrey, @pepe-school-land

@billrey @mendio @pepe-school-land 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.

@billrey @mendio @pepe-school-land 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: Captura_09.JPG

Here is a toolbar mockup for Draw Mode with the new tools: ![Captura_09.JPG](https://archive.blender.org/developer/F5354214/Captura_09.JPG)

This issue was referenced by df6530594f

This issue was referenced by df6530594f02969e6fae25df38d1b947411a9a82
Author
Owner

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Author
Owner

This was in fact fixed by 80a7c57e5e

This was in fact fixed by 80a7c57e5e

@ideasman42 Sorry, I compiled just before your fix

@ideasman42 Sorry, I compiled just before your fix
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#57527
No description provided.