[Bf-blender-cvs] [5f669240663] blender2.8: Fix exception w/ grease pencil brush tooltips

Campbell Barton noreply at git.blender.org
Thu Sep 6 10:27:33 CEST 2018


Commit: 5f669240663649ee5532f935a8178bf9db7b10cf
Author: Campbell Barton
Date:   Thu Sep 6 18:23:51 2018 +1000
Branches: blender2.8
https://developer.blender.org/rB5f669240663649ee5532f935a8178bf9db7b10cf

Fix exception w/ grease pencil brush tooltips

===================================================================

M	release/scripts/startup/bl_ui/space_toolsystem_common.py

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_toolsystem_common.py b/release/scripts/startup/bl_ui/space_toolsystem_common.py
index ba06a4e4b50..37f3138fea8 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_common.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_common.py
@@ -769,14 +769,21 @@ def keymap_from_context(context, space_type):
                                 'WEIGHT_PAINT': ("weight_paint_tool", "vertex_tool"),
                                 'VERTEX_PAINT': ("vertex_paint_tool", "vertex_tool"),
                                 'TEXTURE_PAINT': ("texture_paint_tool", "image_tool"),
-                            }[mode]
-                            kmi_hack_brush_select_properties.paint_mode = mode
-                            setattr(kmi_hack_brush_select_properties, attr_op, getattr(brush, attr_brush))
-                            kmi_found = wm.keyconfigs.find_item_from_operator(
-                                idname="paint.brush_select",
-                                context='INVOKE_REGION_WIN',
-                                properties=kmi_hack_brush_select_properties,
-                            )[1]
+                            }.get(mode, (None, None))
+                            if attr_op is not None:
+                                kmi_hack_brush_select_properties.paint_mode = mode
+                                setattr(kmi_hack_brush_select_properties, attr_op, getattr(brush, attr_brush))
+                                kmi_found = wm.keyconfigs.find_item_from_operator(
+                                    idname="paint.brush_select",
+                                    context='INVOKE_REGION_WIN',
+                                    properties=kmi_hack_brush_select_properties,
+                                )[1]
+                            elif mode == 'GPENCIL_PAINT':
+                                # TODO: gpencil.brush_select
+                                # By default no keys are mapped to this, pass.
+                                pass
+                            else:
+                                print("Unsupported mode:", mode)
                             del mode, attr_op, attr_brush
 
             else:



More information about the Bf-blender-cvs mailing list