You could link the location and distance of your main 3d view to the quad views with Python using scene_update_post
handler. The good news is that it updates the quad views every time you navigate, the bad news is that it updates the quad views every time you navigate. :) This does what you need, but also requires some processing power pretty much constantly:
import bpy
from bpy.app.handlers import persistent
for w in bpy.data.window_managers[0].windows: # let's find what's what
for a in w.screen.areas:
if a.type == 'VIEW_3D':
if len(a.spaces[0].region_quadviews) > 0: #if quadviews are active
quad_views = a.spaces[0].region_quadviews
else:
main_view = a.spaces[0].region_3d
@persistent # This makes it stay if another file is opened
def update_handler(dummy):
for every_view in quad_views:
every_view.view_location = main_view.view_location
every_view.view_distance = main_view.view_distance
bpy.app.handlers.scene_update_post.append(update_handler)
#bpy.app.handlers.scene_update_post.remove(update_handler)
You could just use it as an operator assigned to some shortcut so it only does it's thing once when you press a button:
bl_info = {
"name": "Quad View Updater",
"author": "Martynas Žiemys",
"version": (1, 0),
"blender": (2, 79, 0),
"location": "shift + num .",
"description": "...",
"warning": "",
"wiki_url": "",
"category": "3d View",
}
import bpy
class ViewSelectedPlusQuadViews(bpy.types.Operator):
"""View Selected Plus Quad Views"""
bl_idname = "3d_view.view_selected_plus"
bl_label = "View Selected Plus Quad Views"
@classmethod
def poll(cls, context):
return True
def execute(self, context):
#bpy.ops.view3d.view_selected() #Maybe center selected before?
for w in bpy.data.window_managers[0].windows: # let's find what's what
for a in w.screen.areas:
if a.type == 'VIEW_3D':
if len(a.spaces[0].region_quadviews) > 0: #if quadviews are active
quad_views = a.spaces[0].region_quadviews
else:
main_view = a.spaces[0].region_3d
for every_view in quad_views:
every_view.view_location = main_view.view_location
every_view.view_distance = main_view.view_distance
return {'FINISHED'}
addon_keymaps = []
def registerKeymaps():
wm = bpy.context.window_manager
if wm.keyconfigs.addon:
km = wm.keyconfigs.addon.keymaps.new(name='3D View Generic', space_type='VIEW_3D')
kmi = km.keymap_items.new('3d_view.view_selected_plus', 'NUMPAD_PERIOD', 'PRESS', shift=True, alt=False,ctrl=False)
addon_keymaps.append((km, kmi))
def unregisterKeymaps():
for km, kmi in addon_keymaps:
km.keymap_items.remove(kmi)
addon_keymaps.clear()
def register():
registerKeymaps()
bpy.utils.register_class(ViewSelectedPlusQuadViews)
def unregister():
unregisterKeymaps()
bpy.utils.unregister_class(ViewSelectedPlusQuadViews)
if __name__ == "__main__":
register()
You could save this to a file with .py extension and install it as an add-on.
I tried to detect changes of the active object with scene_update_post
handler and then view selected in the quad views, but it seems there is some bug in Blender and working with bpy.context
inside the handler crashes Blender. So if you wanted to center the quad views I can only offer a method using a keyboard shortcut. There should be a way to do it automatically, but the bug prevents it. If someone is interested in this, here is the code that crashes.
You can copy this into a .py file and install it as an addon to be able to view selected in all quad vies with Shift+Numpad .:
bl_info = {
"name": "View Selected in Quad Views",
"author": "Martynas Žiemys",
"version": (1, 0),
"blender": (2, 79, 0),
"location": "shift + num .",
"description": "...",
"warning": "",
"wiki_url": "",
"category": "3d View",
}
import bpy
class ViewSelectedInQuadViews(bpy.types.Operator):
"""View Selected In Quad Views"""
bl_idname = "view3d.view_selected_quad"
bl_label = "View Selected In Quad Views"
@classmethod
def poll(cls, context):
return True
def execute(self, context):
context = bpy.context.copy()
for w in bpy.data.window_managers[0].windows: # let's find what's what
for a in w.screen.areas:
if a.type == 'VIEW_3D':
if len(a.spaces[0].region_quadviews) > 0: #if quadviews are active
for every_region in a.regions[4:]:
override = context
override['window'] = w
override['area'] = a
override['region'] = every_region
bpy.ops.view3d.view_selected(override)
return {'FINISHED'}
addon_keymaps = []
def registerKeymaps():
wm = bpy.context.window_manager
if wm.keyconfigs.addon:
km = wm.keyconfigs.addon.keymaps.new(name='3D View Generic', space_type='VIEW_3D')
kmi = km.keymap_items.new('view3d.view_selected_quad', 'NUMPAD_PERIOD', 'PRESS', shift=True, alt=False,ctrl=False)
addon_keymaps.append((km, kmi))
def unregisterKeymaps():
for km, kmi in addon_keymaps:
km.keymap_items.remove(kmi)
addon_keymaps.clear()
def register():
bpy.utils.register_class(ViewSelectedInQuadViews)
registerKeymaps()
def unregister():
unregisterKeymaps()
bpy.utils.unregister_class(ViewSelectedInQuadViews)
if __name__ == "__main__":
register()