2.5 Buttons:
[blender.git] / release / ui / buttons_data_camera.py
1
2 import bpy
3
4 class DataButtonsPanel(bpy.types.Panel):
5         __space_type__ = "BUTTONS_WINDOW"
6         __region_type__ = "WINDOW"
7         __context__ = "data"
8
9         def poll(self, context):
10                 ob = context.active_object
11                 return (ob and ob.type == 'CAMERA')
12                 
13 class DATA_PT_cameralens(DataButtonsPanel):
14         __idname__ = "DATA_PT_camera"
15         __label__ = "Lens"
16
17         def draw(self, context):
18                 cam = context.active_object.data
19                 layout = self.layout
20
21                 layout.itemR(cam, "type", expand=True)
22                 
23                 row = layout.row(align=True)
24                 if cam.type == 'PERSP':
25                         row.itemR(cam, "lens_unit", text="")
26                         if cam.lens_unit == 'MILLIMETERS':
27                                 row.itemR(cam, "lens", text="Angle")
28                         elif cam.lens_unit == 'DEGREES':
29                                 row.itemR(cam, "angle")
30
31                 elif cam.type == 'ORTHO':
32                         row.itemR(cam, "ortho_scale")
33                         
34                 split = layout.split()
35                 
36                 sub = split.column(align=True)
37                 sub.itemL(text="Shift:")
38                 sub.itemR(cam, "shift_x", text="X")
39                 sub.itemR(cam, "shift_y", text="Y")
40                 
41                 sub = split.column(align=True)
42                 sub.itemL(text="Clipping:")
43                 sub.itemR(cam, "clip_start", text="Start")
44                 sub.itemR(cam, "clip_end", text="End")
45                 
46                 row = layout.row()
47                 row.itemR(cam, "dof_object")
48                 row.itemR(cam, "dof_distance")
49                 
50 class DATA_PT_cameradisplay(DataButtonsPanel):
51         __idname__ = "DATA_PT_cameradisplay"
52         __label__ = "Display"
53         
54         def draw(self, context):
55                 cam = context.active_object.data
56                 layout = self.layout
57
58                 split = layout.split()
59                 
60                 sub = split.column()
61                 sub.itemR(cam, "show_limits", text="Limits")
62                 sub.itemR(cam, "show_mist", text="Mist")
63                 sub.itemR(cam, "show_title_safe", text="Title Safe")
64                 sub.itemR(cam, "show_name", text="Name")
65                         
66                 sub = split.column()
67                 sub.itemR(cam, "show_passepartout", text="Passepartout")
68                 if (cam.show_passepartout):
69                         sub.itemR(cam, "passepartout_alpha", text="Alpha", slider=True)
70                 sub.itemR(cam, "draw_size", text="Size")
71                 
72 bpy.types.register(DATA_PT_cameralens)
73 bpy.types.register(DATA_PT_cameradisplay)