4
$\begingroup$

My original intention is to transfer settings with a .blend file, but as far as I know, ordinary blends don't store everything.

I have tried to understand the API documentation for a while now, yet since I'm not a developer, I have a hard time closing the 'assumed knowledge' gap.

So far I've found bpy.types.SpaceView3D.use_occlude_geometry but no sample code or link and I just get error messages.

Blender's Info window output isn't revealing much either when I push the button manually, at least not to the untrained eye. bpy.data.screens["Default"].(null) = False

So, here are my needs:

  • Switch MMB with SHIFT-MMB
  • Turn on trackball rotation for viewport rotation
  • Disable Limit selection to visible
$\endgroup$

2 Answers 2

4
$\begingroup$
  • Switch MMB with SHIFTMMB

    view3d_km = bpy.context.window_manager.keyconfigs['Blender'].keymaps['3D View']
    view3d_km.keymap_items['view3d.rotate'].map_type = 'MOUSE'
    view3d_km.keymap_items['view3d.rotate'].type = 'MIDDLEMOUSE'
    view3d_km.keymap_items['view3d.rotate'].shift = True
    
  • Turn on trackball rotation for MMB

    bpy.context.user_preferences.inputs.view_rotate_method = 'TRACKBALL'
    
  • Disable Limit selection to visible

    for scr in bpy.data.screens:
        for area in scr.areas:
            for space in area.spaces:
                if space.type == 'VIEW_3D':
                    space.use_occlude_geometry = True
    
$\endgroup$
2
  • $\begingroup$ This really helps. It seems to be enough to change the .shift values of view3D.rotate and view3d.move $\endgroup$ Commented Aug 24, 2013 at 5:03
  • $\begingroup$ Yep - if it's already set up to use middlemouse, which it usually will be. $\endgroup$
    – z0r
    Commented Aug 24, 2013 at 5:23
3
$\begingroup$

Not sure on the first one (you want to swap rotate with pan?) but...

Turn on trackball rotation:

bpy.context.user_preferences.inputs.view_rotate_method = 'TRACKBALL'

Disable Limit selection to visible in all 3D Views in all screens:

for screen in bpy.data.screens:
    for area in screen.areas:
        if area.type == 'VIEW_3D':
            area.spaces[0].use_occlude_geometry = False
$\endgroup$
2
  • $\begingroup$ Since Gimp and basically all 2D areas in Blender use MMB to pan, and since I pan more than I rotate and because it once was a simple toggle button in Blender, I use MMB to pan in the 3D view. My muscle memory likes it. $\endgroup$ Commented Aug 24, 2013 at 4:49
  • $\begingroup$ This is a great example how four lines of code give me a clear picture instantly. Thank you $\endgroup$ Commented Aug 24, 2013 at 5:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .