UI
[blender-staging.git] / release / ui / space_view3d.py
1
2 import bpy
3
4 class VIEW3D_MT_view_navigation(bpy.types.Menu):
5         __space_type__ = "VIEW_3D"
6         __label__ = "Navigation"
7
8         def draw(self, context):
9                 layout = self.layout
10
11                 # layout.itemO("view3d.view_fly_mode")
12                 # layout.itemS()
13                 
14                 layout.items_enumO("view3d.view_orbit", "type")
15                 
16                 layout.itemS()
17                 
18                 layout.items_enumO("view3d.view_pan", "type")
19                 
20                 layout.itemS()
21                 
22                 layout.item_floatO("view3d.zoom", "delta", 1.0, text="Zoom In")
23                 layout.item_floatO("view3d.zoom", "delta", -1.0, text="Zoom Out")
24
25 class VIEW3D_MT_view(bpy.types.Menu):
26         __space_type__ = "VIEW_3D"
27         __label__ = "View"
28
29         def draw(self, context):
30                 layout = self.layout
31
32                 layout.itemO("view3d.properties", icon="ICON_MENU_PANEL")
33                 layout.itemO("view3d.toolbar", icon="ICON_MENU_PANEL")
34                 
35                 layout.itemS()
36                 
37                 layout.item_enumO("view3d.viewnumpad", "type", "CAMERA")
38                 layout.item_enumO("view3d.viewnumpad", "type", "TOP")
39                 layout.item_enumO("view3d.viewnumpad", "type", "FRONT")
40                 layout.item_enumO("view3d.viewnumpad", "type", "RIGHT")
41                 
42                 # layout.itemM("VIEW3D_MT_view_cameras", text="Cameras")
43                 
44                 layout.itemS()
45
46                 layout.itemO("view3d.view_persportho")
47                 
48                 layout.itemS()
49                 
50                 # layout.itemO("view3d.view_show_all_layers")
51                 
52                 # layout.itemS()
53                 
54                 # layout.itemO("view3d.view_local_view")
55                 # layout.itemO("view3d.view_global_view")
56                 
57                 # layout.itemS()
58                 
59                 layout.itemM("VIEW3D_MT_view_navigation")
60                 # layout.itemM("VIEW3D_MT_view_align", text="Align View")
61                 
62                 layout.itemS()
63
64                 layout.operator_context = "INVOKE_REGION_WIN"
65
66                 layout.itemO("view3d.clip_border")
67                 layout.itemO("view3d.zoom_border")
68                 
69                 layout.itemS()
70                 
71                 layout.itemO("view3d.view_center")
72                 layout.itemO("view3d.view_all")
73                 
74                 layout.itemS()
75                 
76                 layout.itemO("screen.region_foursplit", text="Toggle Quad View")
77                 layout.itemO("screen.screen_full_area", text="Toggle Full Screen")
78
79 class VIEW3D_HT_header(bpy.types.Header):
80         __space_type__ = "VIEW_3D"
81
82         def draw(self, context):
83                 layout = self.layout
84
85                 layout.template_header()
86
87                 # menus
88                 if context.area.show_menus:
89                         row = layout.row()
90                         row.itemM("VIEW3D_MT_view")
91
92                 layout.template_header_3D()
93
94 class VIEW3D_PT_3dview_properties(bpy.types.Panel):
95         __space_type__ = "VIEW_3D"
96         __region_type__ = "UI"
97         __label__ = "View"
98
99         def poll(self, context):
100                 view = context.space_data
101                 return (view)
102
103         def draw(self, context):
104                 view = context.space_data
105                 scene = context.scene
106                 layout = self.layout
107                 
108                 split = layout.split()
109                 col = split.column()
110                 col.itemR(view, "camera")
111                 col.itemR(view, "lens")
112                 col.itemL(text="Clip:")
113                 col.itemR(view, "clip_start", text="Start")
114                 col.itemR(view, "clip_end", text="End")
115                 col.itemL(text="Grid:")
116                 col.itemR(view, "grid_spacing", text="Spacing")
117                 col.itemR(view, "grid_subdivisions", text="Subdivisions")
118                 col.itemR(scene, "cursor_location", text="3D Cursor:")
119                 
120 class VIEW3D_PT_3dview_display(bpy.types.Panel):
121         __space_type__ = "VIEW_3D"
122         __region_type__ = "UI"
123         __label__ = "Display"
124
125         def poll(self, context):
126                 view = context.space_data
127                 return (view)
128
129         def draw(self, context):
130                 view = context.space_data
131                 layout = self.layout
132                 
133                 split = layout.split()
134                 col = split.column()
135                 col.itemR(view, "display_floor", text="Grid Floor")
136                 col.itemR(view, "display_x_axis", text="X Axis")
137                 col.itemR(view, "display_y_axis", text="Y Axis")
138                 col.itemR(view, "display_z_axis", text="Z Axis")
139                 col.itemR(view, "outline_selected")
140                 col.itemR(view, "all_object_centers")
141                 col.itemR(view, "relationship_lines")
142                 col.itemR(view, "textured_solid")
143                         
144 class VIEW3D_PT_background_image(bpy.types.Panel):
145         __space_type__ = "VIEW_3D"
146         __region_type__ = "UI"
147         __label__ = "Background Image"
148
149         def poll(self, context):
150                 view = context.space_data
151                 bg = context.space_data.background_image
152                 return (view)
153
154         def draw_header(self, context):
155                 layout = self.layout
156                 view = context.space_data
157
158                 layout.itemR(view, "display_background_image", text="")
159
160         def draw(self, context):
161                 view = context.space_data
162                 bg = context.space_data.background_image
163                 layout = self.layout
164                 
165                 layout.active = view.display_background_image
166                 split = layout.split()
167                 col = split.column()
168                 col.itemR(bg, "image")
169 #               col.itemR(bg, "image_user")
170                 col.itemR(bg, "size")
171                 col.itemR(bg, "transparency", slider=True)
172                 col.itemL(text="Offset:")
173                 col.itemR(bg, "x_offset", text="X")
174                 col.itemR(bg, "y_offset", text="Y")
175
176 bpy.types.register(VIEW3D_MT_view_navigation)
177 bpy.types.register(VIEW3D_MT_view)
178 bpy.types.register(VIEW3D_HT_header)
179 bpy.types.register(VIEW3D_PT_3dview_properties)
180 bpy.types.register(VIEW3D_PT_3dview_display)
181 bpy.types.register(VIEW3D_PT_background_image)
182
183