Integrated Freestyle to rendering pipeline
[blender.git] / release / ui / buttons_data_camera.py
1
2 import bpy
3
4 class DataButtonsPanel(bpy.types.Panel):
5         __space_type__ = 'PROPERTIES'
6         __region_type__ = 'WINDOW'
7         __context__ = "data"
8
9         def poll(self, context):
10                 return (context.camera)
11                 
12 class DATA_PT_context_camera(DataButtonsPanel):
13         __show_header__ = False
14         
15         def draw(self, context):
16                 layout = self.layout
17                 
18                 ob = context.object
19                 cam = context.camera
20                 space = context.space_data
21
22                 split = layout.split(percentage=0.65)
23
24                 if ob:
25                         split.template_ID(ob, "data")
26                         split.itemS()
27                 elif cam:
28                         split.template_ID(space, "pin_id")
29                         split.itemS()
30
31 class DATA_PT_camera(DataButtonsPanel):
32         __label__ = "Lens"
33
34         def draw(self, context):
35                 layout = self.layout
36                 
37                 cam = context.camera
38
39                 layout.itemR(cam, "type", expand=True)
40                         
41                 row = layout.row(align=True)
42                 if cam.type == 'PERSP':
43                         row.itemR(cam, "lens_unit", text="")
44                         if cam.lens_unit == 'MILLIMETERS':
45                                 row.itemR(cam, "lens", text="Angle")
46                         elif cam.lens_unit == 'DEGREES':
47                                 row.itemR(cam, "angle")
48
49                 elif cam.type == 'ORTHO':
50                         row.itemR(cam, "ortho_scale")
51
52                 layout.itemR(cam, "panorama")
53                                 
54                 split = layout.split()
55                         
56                 col = split.column(align=True)
57                 col.itemL(text="Shift:")
58                 col.itemR(cam, "shift_x", text="X")
59                 col.itemR(cam, "shift_y", text="Y")
60                         
61                 col = split.column(align=True)
62                 col.itemL(text="Clipping:")
63                 col.itemR(cam, "clip_start", text="Start")
64                 col.itemR(cam, "clip_end", text="End")
65                         
66                 layout.itemL(text="Depth of Field:")
67                 
68                 row = layout.row()
69                 row.itemR(cam, "dof_object", text="")
70                 row.itemR(cam, "dof_distance", text="Distance")
71                 
72 class DATA_PT_camera_display(DataButtonsPanel):
73         __label__ = "Display"
74
75         def draw(self, context):
76                 layout = self.layout
77                 
78                 cam = context.camera
79
80                 split = layout.split()
81                 
82                 col = split.column()
83                 col.itemR(cam, "show_limits", text="Limits")
84                 col.itemR(cam, "show_mist", text="Mist")
85                 col.itemR(cam, "show_title_safe", text="Title Safe")
86                 col.itemR(cam, "show_name", text="Name")
87                         
88                 col = split.column()
89                 col.itemR(cam, "show_passepartout", text="Passepartout")
90                 sub = col.column()
91                 sub.active = cam.show_passepartout
92                 sub.itemR(cam, "passepartout_alpha", text="Alpha", slider=True)
93                 col.itemR(cam, "draw_size", text="Size")
94                 
95 bpy.types.register(DATA_PT_context_camera)
96 bpy.types.register(DATA_PT_camera)
97 bpy.types.register(DATA_PT_camera_display)