Merge with 2.5 -r 21619:21756.
[blender.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.screen_full_area")
77
78 class VIEW3D_HT_header(bpy.types.Header):
79         __space_type__ = "VIEW_3D"
80
81         def draw(self, context):
82                 layout = self.layout
83
84                 layout.template_header()
85
86                 # menus
87                 if context.area.show_menus:
88                         row = layout.row()
89                         row.itemM("VIEW3D_MT_view")
90
91                 layout.template_header_3D()
92
93 class VIEW3D_PT_3dview_properties(bpy.types.Panel):
94         __space_type__ = "VIEW_3D"
95         __region_type__ = "UI"
96         __label__ = "View"
97
98         def poll(self, context):
99                 view = context.space_data
100                 return (view)
101
102         def draw(self, context):
103                 view = context.space_data
104                 layout = self.layout
105                 
106                 split = layout.split()
107                 col = split.column()
108                 col.itemR(view, "camera")
109                 col.itemR(view, "lens")
110                 col.itemL(text="Clip:")
111                 col.itemR(view, "clip_start", text="Start")
112                 col.itemR(view, "clip_end", text="End")
113                 col.itemL(text="Grid:")
114                 col.itemR(view, "grid_spacing", text="Spacing")
115                 col.itemR(view, "grid_subdivisions", text="Subdivisions")
116                 
117 class VIEW3D_PT_3dview_display(bpy.types.Panel):
118         __space_type__ = "VIEW_3D"
119         __region_type__ = "UI"
120         __label__ = "Display"
121
122         def poll(self, context):
123                 view = context.space_data
124                 return (view)
125
126         def draw(self, context):
127                 view = context.space_data
128                 layout = self.layout
129                 
130                 split = layout.split()
131                 col = split.column()
132                 col.itemR(view, "display_floor", text="Grid Floor")
133                 col.itemR(view, "display_x_axis", text="X Axis")
134                 col.itemR(view, "display_y_axis", text="Y Axis")
135                 col.itemR(view, "display_z_axis", text="Z Axis")
136                 col.itemR(view, "outline_selected")
137                 col.itemR(view, "all_object_centers")
138                 col.itemR(view, "relationship_lines")
139                 col.itemR(view, "textured_solid")
140                         
141 class VIEW3D_PT_background_image(bpy.types.Panel):
142         __space_type__ = "VIEW_3D"
143         __region_type__ = "UI"
144         __label__ = "Background Image"
145
146         def poll(self, context):
147                 view = context.space_data
148                 bg = context.space_data.background_image
149                 return (view)
150
151         def draw_header(self, context):
152                 layout = self.layout
153                 view = context.space_data
154
155                 layout.itemR(view, "display_background_image", text="")
156
157         def draw(self, context):
158                 view = context.space_data
159                 bg = context.space_data.background_image
160                 layout = self.layout
161                 
162                 layout.active = view.display_background_image
163                 split = layout.split()
164                 col = split.column()
165                 col.itemR(bg, "image")
166 #               col.itemR(bg, "image_user")
167                 col.itemR(bg, "size")
168                 col.itemR(bg, "transparency", slider=True)
169                 col.itemL(text="Offset:")
170                 col.itemR(bg, "x_offset", text="X")
171                 col.itemR(bg, "y_offset", text="Y")
172
173 bpy.types.register(VIEW3D_MT_view_navigation)
174 bpy.types.register(VIEW3D_MT_view)
175 bpy.types.register(VIEW3D_HT_header)
176 bpy.types.register(VIEW3D_PT_3dview_properties)
177 bpy.types.register(VIEW3D_PT_3dview_display)
178 bpy.types.register(VIEW3D_PT_background_image)
179
180