Skip to content

Instantly share code, notes, and snippets.

@PierrickKoch
Created November 10, 2011 07:10
Show Gist options
  • Save PierrickKoch/1354317 to your computer and use it in GitHub Desktop.
Save PierrickKoch/1354317 to your computer and use it in GitHub Desktop.
Blender setDefaultSpaceViewPort script
import bpy
def setDefaultSpaceViewPort(viewport_shade='WIREFRAME'):
""" setDefaultSpaceViewPort
:param viewport_shade: enum in ['BOUNDBOX', 'WIREFRAME', 'SOLID', 'TEXTURED'], default 'WIREFRAME'
:return: number of viewport_shade set; 0 if no 3D View in the current window
"""
num_view = 0
for area in bpy.context.window.screen.areas:
if area.type == 'VIEW_3D':
for space in area.spaces:
if space.type == 'VIEW_3D':
space.viewport_shade = viewport_shade
num_view += 1
return num_view
if __name__ == "__main__":
setDefaultSpaceViewPort()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment