4 class DataButtonsPanel(bpy.types.Panel):
5 __space_type__ = "BUTTONS_WINDOW"
6 __region_type__ = "WINDOW"
9 def poll(self, context):
10 return (context.lamp != None)
12 class DATA_PT_preview(DataButtonsPanel):
13 __idname__= "DATA_PT_preview"
16 def draw(self, context):
20 layout.template_preview(lamp)
22 class DATA_PT_lamp(DataButtonsPanel):
23 __idname__ = "DATA_PT_lamp"
26 def poll(self, context):
27 return ((context.object and context.object.type == 'LAMP') or context.lamp)
29 def draw(self, context):
34 space = context.space_data
36 split = layout.split(percentage=0.65)
39 split.template_ID(context, ob, "data")
42 split.template_ID(context, space, "pin_id")
47 layout.itemR(lamp, "type", expand=True)
49 split = layout.split()
52 sub.itemR(lamp, "color")
53 sub.itemR(lamp, "energy")
54 sub.itemR(lamp, "distance")
55 sub.itemR(lamp, "negative")
58 sub.itemR(lamp, "layer", text="This Layer Only")
59 sub.itemR(lamp, "specular")
60 sub.itemR(lamp, "diffuse")
62 if lamp.type in ('POINT', 'SPOT'):
63 sub.itemR(lamp, "falloff_type")
64 sub.itemR(lamp, "sphere")
66 if (lamp.falloff_type == 'LINEAR_QUADRATIC_WEIGHTED'):
67 sub.itemR(lamp, "linear_attenuation")
68 sub.itemR(lamp, "quadratic_attenuation")
70 if lamp.type == 'AREA':
72 sub.itemR(lamp, "gamma")
73 sub.itemR(lamp, "shape")
74 if (lamp.shape == 'SQUARE'):
75 sub.itemR(lamp, "size")
76 if (lamp.shape == 'RECTANGLE'):
77 sub.itemR(lamp, "size", text="Size X")
78 sub.itemR(lamp, "size_y")
80 class DATA_PT_sunsky(DataButtonsPanel):
81 __idname__ = "DATA_PT_sunsky"
84 def poll(self, context):
86 return (lamp and lamp.type == 'SUN')
88 def draw(self, context):
90 lamp = context.lamp.sky
93 row.itemR(lamp, "sky")
94 row.itemR(lamp, "atmosphere")
97 row.active = lamp.sky or lamp.atmosphere
98 row.itemR(lamp, "atmosphere_turbidity", text="Turbidity")
100 split = layout.split()
104 sub.active = lamp.sky
105 sub.itemR(lamp, "sky_blend_type", text="Blend Type")
106 sub.itemR(lamp, "sky_blend")
107 sub.itemR(lamp, "sky_color_space", text="Color Space")
108 sub.itemR(lamp, "sky_exposure")
109 sub.itemR(lamp, "horizon_brightness", text="Hor Bright")
110 sub.itemR(lamp, "spread", text="Hor Spread")
111 sub.itemR(lamp, "sun_brightness", text="Sun Bright")
112 sub.itemR(lamp, "sun_size")
113 sub.itemR(lamp, "backscattered_light", text="Back Light")
116 sub.active = lamp.atmosphere
117 sub.itemR(lamp, "sun_intensity", text="Sun Intens")
118 sub.itemR(lamp, "atmosphere_inscattering", text="Inscattering")
119 sub.itemR(lamp, "atmosphere_extinction", text="Extinction")
120 sub.itemR(lamp, "atmosphere_distance_factor", text="Distance")
122 class DATA_PT_shadow(DataButtonsPanel):
123 __idname__ = "DATA_PT_shadow"
126 def poll(self, context):
128 return (lamp and lamp.type in ('POINT','SUN', 'SPOT', 'AREA'))
130 def draw(self, context):
134 layout.itemR(lamp, "shadow_method", expand=True)
136 if lamp.shadow_method in ('BUFFER_SHADOW', 'RAY_SHADOW'):
138 split = layout.split()
141 sub.itemR(lamp, "shadow_color")
144 sub.itemR(lamp, "shadow_layer", text="This Layer Only")
145 sub.itemR(lamp, "only_shadow")
147 if lamp.shadow_method == 'RAY_SHADOW':
149 col = layout.column()
150 col.itemL(text="Sampling:")
151 col.row().itemR(lamp, "shadow_ray_sampling_method", expand=True)
153 if lamp.type in ('POINT', 'SUN', 'SPOT'):
154 flow = layout.column_flow()
155 flow.itemR(lamp, "shadow_soft_size", text="Soft Size")
156 flow.itemR(lamp, "shadow_ray_samples", text="Samples")
157 if lamp.shadow_ray_sampling_method == 'ADAPTIVE_QMC':
158 flow.itemR(lamp, "shadow_adaptive_threshold", text="Threshold")
160 if lamp.type == 'AREA':
161 flow = layout.column_flow()
162 flow.itemR(lamp, "shadow_ray_samples_x", text="Samples")
163 if lamp.shadow_ray_sampling_method == 'ADAPTIVE_QMC':
164 flow.itemR(lamp, "shadow_adaptive_threshold", text="Threshold")
165 if lamp.shadow_ray_sampling_method == 'CONSTANT_JITTERED':
166 flow.itemR(lamp, "umbra")
167 flow.itemR(lamp, "dither")
168 flow.itemR(lamp, "jitter")
170 if lamp.shadow_method == 'BUFFER_SHADOW':
171 col = layout.column()
172 col.itemL(text="Buffer Type:")
173 col.row().itemR(lamp, "shadow_buffer_type", expand=True)
175 if lamp.shadow_buffer_type in ('REGULAR', 'HALFWAY'):
176 flow = layout.column_flow()
177 flow.itemL(text="Sample Buffers:")
178 flow.itemR(lamp, "shadow_sample_buffers", text="")
179 flow.itemL(text="Filter Type:")
180 flow.itemR(lamp, "shadow_filter_type", text="")
182 flow = layout.column_flow()
183 flow.itemR(lamp, "shadow_buffer_size", text="Size")
184 flow.itemR(lamp, "shadow_buffer_samples", text="Samples")
185 flow.itemR(lamp, "shadow_buffer_bias", text="Bias")
186 flow.itemR(lamp, "shadow_buffer_soft", text="Soft")
188 if (lamp.shadow_buffer_type == 'IRREGULAR'):
190 row.itemR(lamp, "shadow_buffer_bias", text="Bias")
193 row.itemR(lamp, "auto_clip_start", text="Autoclip Start")
194 if not (lamp.auto_clip_start):
195 row.itemR(lamp, "shadow_buffer_clip_start", text="Clip Start")
197 row.itemR(lamp, "auto_clip_end", text="Autoclip End")
198 if not (lamp.auto_clip_end):
199 row.itemR(lamp, "shadow_buffer_clip_end", text=" Clip End")
201 class DATA_PT_spot(DataButtonsPanel):
202 __idname__ = "DATA_PT_spot"
205 def poll(self, context):
207 return (lamp and lamp.type == 'SPOT')
209 def draw(self, context):
213 split = layout.split()
216 sub.itemR(lamp, "spot_size", text="Size")
217 sub.itemR(lamp, "spot_blend", text="Blend")
218 sub.itemR(lamp, "square")
221 col.itemR(lamp, "halo")
222 colsub = col.column()
223 colsub.active = lamp.halo
224 colsub.itemR(lamp, "halo_intensity", text="Intensity")
225 if lamp.shadow_method == 'BUFFER_SHADOW':
226 colsub.itemR(lamp, "halo_step", text="Step")
228 class DATA_PT_falloff_curve(DataButtonsPanel):
229 __idname__ = "DATA_PT_falloff_curve"
230 __label__ = "Falloff Curve"
232 def poll(self, context):
235 if lamp and lamp.type in ('POINT', 'SPOT'):
236 if lamp.falloff_type == 'CUSTOM_CURVE':
241 def draw(self, context):
245 layout.template_curve_mapping(lamp.falloff_curve)
247 bpy.types.register(DATA_PT_preview)
248 bpy.types.register(DATA_PT_lamp)
249 bpy.types.register(DATA_PT_shadow)
250 bpy.types.register(DATA_PT_sunsky)
251 bpy.types.register(DATA_PT_spot)
252 bpy.types.register(DATA_PT_falloff_curve)