mx1001/Fidget

hotkey setup from preferences

Closed this issue · 1 comments

ok so we do have 3 buttons in the manipulator, but we want them to work in context just like our menu in hardops. But because this time we will use default operators we want users to be able to set hotkeys.

so we have that

if event.type == 'LEFTMOUSE':

                if event.value == 'PRESS':
                    if context.active_object is None:
                        pass
                    else:
                        if bpy.context.active_object.mode == 'EDIT':
                            if self.button_top:
                                # Face Mode
                                if tuple(bpy.context.scene.tool_settings.mesh_select_mode) == (False, False, True):
                                    bpy.ops.mesh.extrude_region_move()
                                    bpy.ops.transform.translate('INVOKE_DEFAULT', constraint_axis=(False, False, True), constraint_orientation='NORMAL')
                                    return {'RUNNING_MODAL'}
                                elif tuple(bpy.context.scene.tool_settings.mesh_select_mode) == (True, False, False):
                                    bpy.ops.clean1.objects('INVOKE_DEFAULT', clearsharps=False)
                                    return {'RUNNING_MODAL'}
                                elif tuple(bpy.context.scene.tool_settings.mesh_select_mode) == (True, False, False):
                                    bpy.ops.clean1.objects('INVOKE_DEFAULT', clearsharps=False)
                                    return {'RUNNING_MODAL'}
                                else:
                                    bpy.ops.clean1.objects('INVOKE_DEFAULT', clearsharps=False)
                                    return {'RUNNING_MODAL'}
                            elif self.button_right:
                                # Face Mode
                                if tuple(bpy.context.scene.tool_settings.mesh_select_mode) == (False, False, True):
                                    bpy.ops.mesh.inset('INVOKE_DEFAULT')
                                    return {'RUNNING_MODAL'}
                                elif tuple(bpy.context.scene.tool_settings.mesh_select_mode) == (True, False, False):
                                    bpy.ops.hops.set_edit_sharpen('INVOKE_DEFAULT')
                                    return {'RUNNING_MODAL'}
                                elif tuple(bpy.context.scene.tool_settings.mesh_select_mode) == (True, False, False):
                                    bpy.ops.hops.set_edit_sharpen('INVOKE_DEFAULT')
                                    return {'RUNNING_MODAL'}
                                else:
                                    bpy.ops.hops.set_edit_sharpen('INVOKE_DEFAULT')
                                    return {'RUNNING_MODAL'}
                            elif self.button_left:
                                bpy.ops.clean1.objects('INVOKE_DEFAULT', clearsharps=False)
                                bpy.ops.mesh.bevel('INVOKE_DEFAULT')
                                return {'RUNNING_MODAL'}

                        if bpy.context.active_object.mode == 'OBJECT':
                            if self.button_top:
                                if len(bpy.context.selected_objects) > 1:
                                    bpy.ops.wm.call_menu(name='hops.bool_menu')
                                    return {'RUNNING_MODAL'}
                                else:
                                    bpy.ops.wm.call_menu(name='INFO_MT_mesh_add')
                                    return {'RUNNING_MODAL'}
                            elif self.button_right:
                                if len(bpy.context.selected_objects) > 1:
                                    bpy.ops.hops.bool_difference('INVOKE_DEFAULT')
                                    return {'RUNNING_MODAL'}
                                else:
                                    pass
                            elif self.button_left:
                                if len(bpy.context.selected_objects) > 1:
                                    bpy.ops.hops.slash('INVOKE_DEFAULT')
                                    return {'RUNNING_MODAL'}
                                else:
                                    bpy.ops.wm.call_menu(name='hops.symetry_submenu')
                                    return {'RUNNING_MODAL'}

                elif event.value == 'RELEASE':
                    if context.active_object is None:
                        pass
                    else:
                        if bpy.context.active_object.mode == 'EDIT':
                            if self.button_top:
                                # Face Mode
                                if tuple(bpy.context.scene.tool_settings.mesh_select_mode) == (False, False, True):
                                    pass
                                elif tuple(bpy.context.scene.tool_settings.mesh_select_mode) == (True, False, False):
                                    pass
                                elif tuple(bpy.context.scene.tool_settings.mesh_select_mode) == (True, False, False):
                                    pass
                                else:
                                    pass

but instead of hard coding we will need it here

blender_2017-08-15_17-20-35

the system should allow swapping global mode ( the dots near manipulator -3 modes in general but one will be hardops so just 2 for users) then global mode (just like in code none object and edit. and then the selection status.

it should look something like that

untitled-1

the tricky part is that we need to give user ability to release or press in case they will like to use it for calling menus. Also, it should support multi lines since some operators like extrude, call transform right after.

let me know what You guys think

redesigned idea to use nodes
moved here #13