4 class DataButtonsPanel(bpy.types.Panel):
5 __space_type__ = 'PROPERTIES'
6 __region_type__ = 'WINDOW'
9 def poll(self, context):
12 class DATA_PT_preview(DataButtonsPanel):
15 def draw(self, context):
16 self.layout.template_preview(context.lamp)
18 class DATA_PT_context_lamp(DataButtonsPanel):
19 __show_header__ = False
21 def draw(self, context):
26 space = context.space_data
28 split = layout.split(percentage=0.65)
31 split.template_ID(ob, "data")
34 split.template_ID(space, "pin_id")
37 class DATA_PT_lamp(DataButtonsPanel):
40 def draw(self, context):
45 layout.itemR(lamp, "type", expand=True)
47 split = layout.split()
51 sub.itemR(lamp, "color", text="")
52 sub.itemR(lamp, "energy")
54 if lamp.type in ('POINT', 'SPOT'):
55 sub.itemL(text="Falloff:")
56 sub.itemR(lamp, "falloff_type", text="")
57 sub.itemR(lamp, "distance")
59 if lamp.falloff_type == 'LINEAR_QUADRATIC_WEIGHTED':
60 col.itemL(text="Attenuation Factors:")
61 sub = col.column(align=True)
62 sub.itemR(lamp, "linear_attenuation", slider=True, text="Linear")
63 sub.itemR(lamp, "quadratic_attenuation", slider=True, text="Quadratic")
65 col.itemR(lamp, "sphere")
67 if lamp.type == 'AREA':
68 col.itemR(lamp, "distance")
69 col.itemR(lamp, "gamma")
72 col.itemR(lamp, "negative")
73 col.itemR(lamp, "layer", text="This Layer Only")
74 col.itemR(lamp, "specular")
75 col.itemR(lamp, "diffuse")
77 class DATA_PT_sunsky(DataButtonsPanel):
78 __label__ = "Sky & Atmosphere"
80 def poll(self, context):
82 return (lamp and lamp.type == 'SUN')
84 def draw(self, context):
87 lamp = context.lamp.sky
89 layout.itemR(lamp, "sky")
92 row.active = lamp.sky or lamp.atmosphere
93 row.itemR(lamp, "atmosphere_turbidity", text="Turbidity")
95 split = layout.split()
99 col.itemL(text="Blending:")
101 sub.itemR(lamp, "sky_blend_type", text="")
102 sub.itemR(lamp, "sky_blend", text="Factor")
104 col.itemL(text="Color Space:")
106 sub.row().itemR(lamp, "sky_color_space", expand=True)
107 sub.itemR(lamp, "sky_exposure", text="Exposure")
110 col.active = lamp.sky
111 col.itemL(text="Horizon:")
113 sub.itemR(lamp, "horizon_brightness", text="Brightness")
114 sub.itemR(lamp, "spread", text="Spread")
116 col.itemL(text="Sun:")
118 sub.itemR(lamp, "sun_brightness", text="Brightness")
119 sub.itemR(lamp, "sun_size", text="Size")
120 sub.itemR(lamp, "backscattered_light", slider=True,text="Back Light")
124 layout.itemR(lamp, "atmosphere")
126 split = layout.split()
129 col.active = lamp.atmosphere
130 col.itemL(text="Intensity:")
131 col.itemR(lamp, "sun_intensity", text="Sun")
132 col.itemR(lamp, "atmosphere_distance_factor", text="Distance")
135 col.active = lamp.atmosphere
136 col.itemL(text="Scattering:")
137 sub = col.column(align=True)
138 sub.itemR(lamp, "atmosphere_inscattering", slider=True, text="Inscattering")
139 sub.itemR(lamp, "atmosphere_extinction", slider=True ,text="Extinction")
141 class DATA_PT_shadow(DataButtonsPanel):
144 def poll(self, context):
146 return (lamp and lamp.type in ('POINT','SUN', 'SPOT', 'AREA'))
148 def draw(self, context):
153 layout.itemR(lamp, "shadow_method", expand=True)
155 if lamp.shadow_method != 'NOSHADOW':
156 split = layout.split()
159 col.itemR(lamp, "shadow_color", text="")
162 col.itemR(lamp, "shadow_layer", text="This Layer Only")
163 col.itemR(lamp, "only_shadow")
165 if lamp.shadow_method == 'RAY_SHADOW':
166 col = layout.column()
167 col.itemL(text="Sampling:")
168 col.row().itemR(lamp, "shadow_ray_sampling_method", expand=True)
170 if lamp.type in ('POINT', 'SUN', 'SPOT'):
171 split = layout.split()
174 col.itemR(lamp, "shadow_soft_size", text="Soft Size")
176 col.itemR(lamp, "shadow_ray_samples", text="Samples")
177 if lamp.shadow_ray_sampling_method == 'ADAPTIVE_QMC':
178 col.itemR(lamp, "shadow_adaptive_threshold", text="Threshold")
181 elif lamp.type == 'AREA':
182 split = layout.split()
185 sub = split.column(align=True)
186 if lamp.shape == 'SQUARE':
187 col.itemR(lamp, "shadow_ray_samples_x", text="Samples")
188 elif lamp.shape == 'RECTANGLE':
189 col.itemR(lamp, "shadow_ray_samples_x", text="Samples X")
190 col.itemR(lamp, "shadow_ray_samples_y", text="Samples Y")
192 if lamp.shadow_ray_sampling_method == 'ADAPTIVE_QMC':
193 col.itemR(lamp, "shadow_adaptive_threshold", text="Threshold")
195 elif lamp.shadow_ray_sampling_method == 'CONSTANT_JITTERED':
196 sub.itemR(lamp, "umbra")
197 sub.itemR(lamp, "dither")
198 sub.itemR(lamp, "jitter")
200 elif lamp.shadow_method == 'BUFFER_SHADOW':
201 col = layout.column()
202 col.itemL(text="Buffer Type:")
203 col.row().itemR(lamp, "shadow_buffer_type", expand=True)
205 if lamp.shadow_buffer_type in ('REGULAR', 'HALFWAY'):
206 split = layout.split()
209 col.itemL(text="Filter Type:")
210 col.itemR(lamp, "shadow_filter_type", text="")
211 sub = col.column(align=True)
212 sub.itemR(lamp, "shadow_buffer_soft", text="Soft")
213 sub.itemR(lamp, "shadow_buffer_bias", text="Bias")
216 col.itemL(text="Sample Buffers:")
217 col.itemR(lamp, "shadow_sample_buffers", text="")
218 sub = col.column(align=True)
219 sub.itemR(lamp, "shadow_buffer_size", text="Size")
220 sub.itemR(lamp, "shadow_buffer_samples", text="Samples")
222 elif lamp.shadow_buffer_type == 'IRREGULAR':
223 layout.itemR(lamp, "shadow_buffer_bias", text="Bias")
226 row.itemR(lamp, "auto_clip_start", text="Autoclip Start")
228 sub.active = not lamp.auto_clip_start
229 sub.itemR(lamp, "shadow_buffer_clip_start", text="Clip Start")
232 row.itemR(lamp, "auto_clip_end", text="Autoclip End")
234 sub.active = not lamp.auto_clip_end
235 sub.itemR(lamp, "shadow_buffer_clip_end", text=" Clip End")
237 class DATA_PT_area(DataButtonsPanel):
238 __label__ = "Area Shape"
240 def poll(self, context):
242 return (lamp and lamp.type == 'AREA')
244 def draw(self, context):
249 split = layout.split()
252 col.row().itemR(lamp, "shape", expand=True)
254 sub = col.column(align=True)
255 if (lamp.shape == 'SQUARE'):
256 sub.itemR(lamp, "size")
257 elif (lamp.shape == 'RECTANGLE'):
258 sub.itemR(lamp, "size", text="Size X")
259 sub.itemR(lamp, "size_y", text="Size Y")
261 class DATA_PT_spot(DataButtonsPanel):
262 __label__ = "Spot Shape"
264 def poll(self, context):
266 return (lamp and lamp.type == 'SPOT')
268 def draw(self, context):
273 split = layout.split()
277 sub.itemR(lamp, "spot_size", text="Size")
278 sub.itemR(lamp, "spot_blend", text="Blend", slider=True)
279 col.itemR(lamp, "square")
282 col.itemR(lamp, "halo")
283 sub = col.column(align=True)
284 sub.active = lamp.halo
285 sub.itemR(lamp, "halo_intensity", text="Intensity")
286 if lamp.shadow_method == 'BUFFER_SHADOW':
287 sub.itemR(lamp, "halo_step", text="Step")
289 class DATA_PT_falloff_curve(DataButtonsPanel):
290 __label__ = "Falloff Curve"
291 __default_closed__ = True
293 def poll(self, context):
296 return (lamp and lamp.type in ('POINT', 'SPOT') and lamp.falloff_type == 'CUSTOM_CURVE')
298 def draw(self, context):
301 self.layout.template_curve_mapping(lamp, "falloff_curve")
303 bpy.types.register(DATA_PT_context_lamp)
304 bpy.types.register(DATA_PT_preview)
305 bpy.types.register(DATA_PT_lamp)
306 bpy.types.register(DATA_PT_falloff_curve)
307 bpy.types.register(DATA_PT_area)
308 bpy.types.register(DATA_PT_spot)
309 bpy.types.register(DATA_PT_shadow)
310 bpy.types.register(DATA_PT_sunsky)