2.5 3DView Properties Panel:
[blender.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                 col.itemL(text="Clip:")
120                 col.itemR(view, "clip_start", text="Start")
121                 col.itemR(view, "clip_end", text="End")
122                 
123                 col.itemL(text="Grid:")
124                 col.itemR(view, "grid_spacing", text="Spacing")
125                 col.itemR(view, "grid_subdivisions", text="Subdivisions")
126                 col.itemR(scene, "cursor_location", text="3D Cursor:")
127                 
128 class VIEW3D_PT_3dview_display(bpy.types.Panel):
129         __space_type__ = "VIEW_3D"
130         __region_type__ = "UI"
131         __label__ = "Display"
132
133         def poll(self, context):
134                 view = context.space_data
135                 return (view)
136
137         def draw(self, context):
138                 layout = self.layout
139                 view = context.space_data
140                 
141                 col = layout.column()
142                 col.itemR(view, "display_floor", text="Grid Floor")
143                 col.itemR(view, "display_x_axis", text="X Axis")
144                 col.itemR(view, "display_y_axis", text="Y Axis")
145                 col.itemR(view, "display_z_axis", text="Z Axis")
146                 col.itemR(view, "outline_selected")
147                 col.itemR(view, "all_object_centers")
148                 col.itemR(view, "relationship_lines")
149                 col.itemR(view, "textured_solid")
150                 
151                 layout.itemS()
152                 
153                 layout.itemO("screen.region_foursplit")
154                 
155                 col = layout.column()
156                 col.itemR(view, "lock_rotation")
157                 col.itemR(view, "box_preview")
158                 col.itemR(view, "box_clip")
159         
160 class VIEW3D_PT_background_image(bpy.types.Panel):
161         __space_type__ = "VIEW_3D"
162         __region_type__ = "UI"
163         __label__ = "Background Image"
164         __default_closed__ = True
165
166         def poll(self, context):
167                 view = context.space_data
168                 bg = context.space_data.background_image
169                 return (view)
170
171         def draw_header(self, context):
172                 layout = self.layout
173                 view = context.space_data
174
175                 layout.itemR(view, "display_background_image", text="")
176
177         def draw(self, context):
178                 layout = self.layout
179                 
180                 view = context.space_data
181                 bg = context.space_data.background_image
182                 
183                 layout.active = view.display_background_image
184                 split = layout.split()
185                 col = split.column()
186                 col.itemR(bg, "image")
187 #               col.itemR(bg, "image_user")
188                 col.itemR(bg, "size")
189                 col.itemR(bg, "transparency", slider=True)
190                 col.itemL(text="Offset:")
191                 col.itemR(bg, "x_offset", text="X")
192                 col.itemR(bg, "y_offset", text="Y")
193
194 bpy.types.register(VIEW3D_MT_view_navigation)
195 bpy.types.register(VIEW3D_MT_view)
196 bpy.types.register(VIEW3D_HT_header)
197 bpy.types.register(VIEW3D_PT_3dview_properties)
198 bpy.types.register(VIEW3D_PT_3dview_display)
199 bpy.types.register(VIEW3D_PT_background_image)