Created
November 10, 2011 07:10
-
-
Save PierrickKoch/1354317 to your computer and use it in GitHub Desktop.
Blender setDefaultSpaceViewPort script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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