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