diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-11-07 02:54:14 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-11-07 02:54:56 +0300 |
commit | 895295a9f0cb85c7c48c395621b9c9d7e5fc78a3 (patch) | |
tree | f9621ae96c65433301ba2a8ba401d43ad0df68d4 /release/scripts | |
parent | 87a6aab2518ed391c755e3e7aeae9692f25569ae (diff) |
Paint: update shortcut detection for new logic
Diffstat (limited to 'release/scripts')
-rw-r--r-- | release/scripts/startup/bl_ui/space_toolsystem_common.py | 46 |
1 files changed, 22 insertions, 24 deletions
diff --git a/release/scripts/startup/bl_ui/space_toolsystem_common.py b/release/scripts/startup/bl_ui/space_toolsystem_common.py index 138f69860a6..f23b76c5911 100644 --- a/release/scripts/startup/bl_ui/space_toolsystem_common.py +++ b/release/scripts/startup/bl_ui/space_toolsystem_common.py @@ -811,30 +811,28 @@ def keymap_from_context(context, space_type): if kmi_found is None: if item.data_block: # PAINT_OT_brush_select - brush = bpy.data.brushes.get(item.data_block) - if brush is not None: - mode = context.active_object.mode - attr_op, attr_brush = { - 'SCULPT': ("sculpt_tool", "sculpt_tool"), - 'WEIGHT_PAINT': ("weight_paint_tool", "weight_tool"), - 'VERTEX_PAINT': ("vertex_paint_tool", "vertex_tool"), - 'TEXTURE_PAINT': ("texture_paint_tool", "image_tool"), - }.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 + mode = context.active_object.mode + attr = { + 'SCULPT': "sculpt_tool", + 'WEIGHT_PAINT': "weight_paint_tool", + 'VERTEX_PAINT': "vertex_paint_tool", + 'TEXTURE_PAINT': "texture_paint_tool", + }.get(mode, (None, None)) + if attr is not None: + kmi_hack_brush_select_properties.paint_mode = mode + setattr(kmi_hack_brush_select_properties, attr, item.data_block) + 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 else: kmi_found = None |