bb87bdf3d068826c46f4f9ca0d9e4518b5d0dc2d
[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                 if not cam:
22                         return
23                 
24                 layout.itemR(cam, "type", expand=True)
25                 
26                 row = layout.row(align=True)
27                 if cam.type == 'PERSP':
28                         if cam.lens_unit == 'MILLIMETERS':
29                                 row.itemR(cam, "lens", text="Angle")
30                         elif cam.lens_unit == 'DEGREES':
31                                 row.itemR(cam, "angle")
32
33                         row.itemR(cam, "lens_unit", text="")
34                 elif cam.type == 'ORTHO':
35                         row.itemR(cam, "ortho_scale")
36                         
37                 split = layout.split()
38                 
39                 sub = split.column(align=True)
40                 sub.itemL(text="Shift:")
41                 sub.itemR(cam, "shift_x", text="X")
42                 sub.itemR(cam, "shift_y", text="Y")
43                 
44                 sub = split.column(align=True)
45                 sub.itemL(text="Clipping:")
46                 sub.itemR(cam, "clip_start", text="Start")
47                 sub.itemR(cam, "clip_end", text="End")
48                 
49                 row = layout.row()
50                 row.itemR(cam, "dof_object")
51                 row.itemR(cam, "dof_distance")
52                 
53 class DATA_PT_cameradisplay(DataButtonsPanel):
54         __idname__ = "DATA_PT_cameradisplay"
55         __label__ = "Display"
56         
57         def draw(self, context):
58                 cam = context.active_object.data
59                 layout = self.layout
60
61                 if not cam:
62                         return
63                         
64                 split = layout.split()
65                 
66                 sub = split.column()
67                 sub.itemR(cam, "show_limits", text="Limits")
68                 sub.itemR(cam, "show_mist", text="Mist")
69                 sub.itemR(cam, "show_title_safe", text="Title Safe")
70                 sub.itemR(cam, "show_name", text="Name")
71                         
72                 sub = split.column()
73                 sub.itemR(cam, "show_passepartout", text="Passepartout")
74                 if (cam.show_passepartout):
75                         sub.itemR(cam, "passepartout_alpha", text="Alpha", slider="True")
76                 sub.itemR(cam, "draw_size", text="Size")
77                 
78 bpy.types.register(DATA_PT_cameralens)
79 bpy.types.register(DATA_PT_cameradisplay)
80
81