Fix annotate tool in the 3D view

We can't share tools between space-types since they contain keymaps
that store the space type.
This commit is contained in:
Campbell Barton 2018-08-23 20:25:25 +10:00
parent 32f3ecf701
commit 73f90b2505

@ -196,8 +196,9 @@ class _defs_view3d_generic:
),
)
def _defs_annotate_factory():
class _defs_annotate:
class _defs_annotate:
@staticmethod
def draw_settings_common(context, layout, tool):
ts = context.tool_settings
@ -282,6 +283,11 @@ class _defs_annotate:
),
draw_settings=draw_settings,
)
return _defs_annotate
# Needed so annotation gets a keymap per space type.
_defs_annotate_image = _defs_annotate_factory()
_defs_annotate_view3d = _defs_annotate_factory()
class _defs_transform:
@ -1473,10 +1479,10 @@ class IMAGE_PT_tools_active(ToolSelectPanelHelper, Panel):
_tools_annotate = (
(
_defs_annotate.scribble,
_defs_annotate.line,
_defs_annotate.poly,
_defs_annotate.eraser,
_defs_annotate_image.scribble,
_defs_annotate_image.line,
_defs_annotate_image.poly,
_defs_annotate_image.eraser,
),
)
@ -1543,10 +1549,10 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel):
_tools_annotate = (
(
_defs_annotate.scribble,
_defs_annotate.line,
_defs_annotate.poly,
_defs_annotate.eraser,
_defs_annotate_view3d.scribble,
_defs_annotate_view3d.line,
_defs_annotate_view3d.poly,
_defs_annotate_view3d.eraser,
),
_defs_view3d_generic.ruler,
)