Quick Navigation (Bounding Box Navigation)

I created a script for blender that switches the viewport render to BOUNDBOX when you hold down the middle mouse button. I’ve read about it a few times across the forum, and decided I’d upload it.

import bpy

# TODO: hide all other object in edit mode etc.

bl_info = {
    "name": "Quick Navigation",
    "author": "Lan Faust (Lanarky)",
    "version": (1, 1, 0),
    "blender": (2, 6, 9),
    "location": "View 3D -> Middle Mouse Button, G, R, S",
    "description": "Changes viewport shading to wireframe when navigating a scene",
    "warning": "Doesn't work as an extension, must be run as a script",
    "wiki_url": "",
    "tracker_url": "",
    "category": "3D View"}

# This is the movement value, and can be changed.
# I suggest using 'BOUNDBOX', or 'WIREFRAME'.
movement_shade = 'BOUNDBOX'

# This captures event input.
# You can add 'WHEELUPMOUSE' and 'WHEELDOWNMOUSE' for faster zooming,
# or just use CTRL + MIDDLE MOUSE BUTTON, since it flickers otherwise.
event_capture = ['MIDDLEMOUSE', 'G', 'R', 'S']

# This ends translations.
event_capture_end = ['LEFTMOUSE', 'RIGHTMOUSE']
event_capture_last = None

# Set the reverting value for the viewport, 'SOLID' being
# the default if it conflicts with the code.
for area in bpy.context.screen.areas:
    if area.type == "VIEW_3D":
        if area.spaces.active.viewport_shade == movement_shade:
            view_shade = 'SOLID'
            view_shade = area.spaces.active.viewport_shade

# A little fix, so you can still select the movement shade from the 3D View.
button = False

class QuickNav(bpy.types.Operator):
    """Changes the viewport shading, when rotating or zooming."""
    bl_idname = "view3d.quicknav"
    bl_label = "Automatic Wireframe Navigation"
    def modal(self, context, event):
        global view_shade, movement_shade, button, event_capture_last

            current_view = context.area.type
            current_view = None
        if current_view == 'VIEW_3D':

            # Check the event used.
            if event.type in event_capture:
                event_capture_last = event_capture
                if event.type in event_capture_end:
                    event_capture_last = None

                # Set the viewport to the specified movement shade type.
                # But only if you haven't manually set it to the movement shade.
                if not (context.area.spaces.active.viewport_shade == movement_shade):
                    view_shade = context.area.spaces.active.viewport_shade
                    context.area.spaces.active.viewport_shade = movement_shade
                    button = True


                # Reset the viewport to the previous setting, unless already set.
                # And only if not translating.
                # BUG: Alt+A overrides this?.
                if event_capture_last not in ['G', 'R', 'S']:
                    if context.area.spaces.active.viewport_shade == movement_shade and button ==True:
                        context.area.spaces.active.viewport_shade = view_shade
                        button = False

        return {'PASS_THROUGH'}

    def execute(self, context):
        '''Start the program.'''
        return {'RUNNING_MODAL'}

    def cancel(self, context):
        '''Kill the program.'''
        return {'CANCELLED'}

def register():

def unregister():

# Doesn't auto start with this line...
#if __name__ == "__main__":


Now it only works in the 3D View.
Now works while Moving / Rotating / Scaling objects with the keyboard.

Return to the heat and bring to a boil again.After 1 to 2 minutes on the stove, remove from the heat and drizzle over your diced sweet potatoes before roasting.Bourbon whipped cream is easy to make. If you TMre making your own whipped cream, whip up 1 cup of heavy whipping cream until there are stiff peaks, then gradually add 1 tablespoon of your favorite bourbon and 2 tablespoons of sugar.Use the cream to top pies,jordans pas cher, cakes or even put it in between two oatmeal raisin cookies for a bourbon cream cookie sandwich. Water, vinegar (apple cider vinegar is also a great option),nike air max, oil, ketchup, mustard,jordan 5 pas cher, Worcestershire sauce,jeremy scott wings 2.0 american flag pas cher, and of course, my special ingredient,jordan pas cher femme, bourbon.If you want to skip the hassle of whipping up a new sauce, give your favorite premade BBQ sauce a kick by adding 2 tablespoons of bourbon to every 1 cup of sauce.4. Looking puzzled, his security detail took the cage, containing a pair of white doves,jeremy scott mickey mouse pas cher, and handed it to Francis. Without hesitation,nike air max 2013 pas cher, the pope opened the cage door,nike blazer pas cher, thrust a hand inside and extracted one dove,jordan 8 pas cher, and with a flick of his hand, sent the bird flying over the square. (AP Photo/Alessandra Tarantino). New Orleans has been hit and severely damaged by hurricanes about every 21 years since it was founded in 1715. Katrina was not a one in a thousand year storm, it was a one in 21 year storm. Its a little early to tell what Gustav may do,jeremy scott wings 2.0, the margin of error on the predictions of landfall is about 300 miles either way at this point,jeremy scott wings denim pas cher, and the amount of strengtheneing is also uncertain. The provinces were a battleground in every major European war from the 17th cent. To World War II,new balance homme pas cher, but after each war their industry and commercial enterprise enabled a quick recovery. Spain lost North Brabant and part of Limburg to the United Provinces at the Peace of Westphalia (1648); Artois and parts of Hainaut and Luxembourg provs. Archive your financial records: I do not want to make the suggestion that the “Men in Black” are lurking around every corner and will show up to your doorstep with an audit notice. But part of being good in business is keeping your business organized. Every receipt, tax bill, or transaction related to your business should be kept in your personal records so you can refer to them at a moment’s notice or at tax time. Many company owners think they are making a wise decision since TV advertising costs them less and reach to more target audiences. Most financial experts recommend for business keepers to consider TV commercials. They advise businesses to get this done therefore marketing and advertising may reach a broader audience, simply because not everyone frequently uses the internet. ???: instead of you handwashing them commanding role. A lion in winter I just adore them. The colorful 26 0800lateain no need to get down Decades ago

simple but powerful - Andrew Price would like this to work for all transformation on heavy mesh objects :slight_smile:

Could actually be done by replacing all transform keybindings, and make the keys call macros instead. The macros would set shading, then run transformation, and finally return to original shading. There’s one little problem though: if you cancel the macro, you are left with the bbox/wireframe shading. This can be circumvented by wrapping the macro with a modal op, but it’s really not that nice.

useful script.thanks.

Now it only works in the 3D View.
Now works while Moving / Rotating / Scaling objects with the keyboard.

Thanks for the tips. I don’t know much about macros, but I tied the keyboard keys into it. I also finally removed the glitch where it’d activate in other panels.