4 class DataButtonsPanel(bpy.types.Panel):
5 __space_type__ = "BUTTONS_WINDOW"
6 __region_type__ = "WINDOW"
9 def poll(self, context):
10 ob = context.active_object
11 return (ob and ob.type == 'LAMP')
13 class DATA_PT_lamp(DataButtonsPanel):
14 __idname__ = "DATA_PT_lamp"
17 def draw(self, context):
18 lamp = context.active_object.data
25 row.itemR(lamp, "type", expand=True)
27 split = layout.split()
30 sub.itemR(lamp, "color")
31 sub.itemR(lamp, "energy")
32 sub.itemR(lamp, "distance")
33 sub.itemR(lamp, "negative")
36 sub.itemR(lamp, "layer", text="This Layer Only")
37 sub.itemR(lamp, "specular")
38 sub.itemR(lamp, "diffuse")
40 if lamp.type in ('POINT', 'SPOT'):
41 sub.itemR(lamp, "falloff_type")
42 sub.itemR(lamp, "sphere")
44 if (lamp.falloff_type == 'LINEAR_QUADRATIC_WEIGHTED'):
45 sub.itemR(lamp, "linear_attenuation")
46 sub.itemR(lamp, "quadratic_attenuation")
48 if lamp.type == 'AREA':
50 sub.itemR(lamp, "gamma")
51 sub.itemR(lamp, "shape")
52 if (lamp.shape == 'SQUARE'):
53 sub.itemR(lamp, "size")
54 if (lamp.shape == 'RECTANGLE'):
55 sub.itemR(lamp, "size", text="Size X")
56 sub.itemR(lamp, "size_y")
58 class DATA_PT_sunsky(DataButtonsPanel):
59 __idname__ = "DATA_PT_sunsky"
62 def poll(self, context):
63 ob = context.active_object
64 return (ob.type == 'LAMP' and ob.data.type == 'SUN')
66 def draw(self, context):
67 lamp = context.active_object.data
74 row.itemR(lamp, "sky")
75 row.itemR(lamp, "atmosphere")
77 if lamp.sky or lamp.atmosphere:
78 layout.itemR(lamp, "atmosphere_turbidity", text="Turbidity")
80 split = layout.split()
85 sub.itemR(lamp, "sky_blend_type", text="Blend Type")
86 sub.itemR(lamp, "sky_blend")
87 sub.itemR(lamp, "sky_color_space", text="Color Space")
88 sub.itemR(lamp, "sky_exposure")
90 sub.itemR(lamp, "horizon_brightness", text="Hor Bright")
91 sub.itemR(lamp, "spread", text="Hor Spread")
92 sub.itemR(lamp, "sun_brightness", text="Sun Bright")
93 sub.itemR(lamp, "sun_size")
94 sub.itemR(lamp, "backscattered_light", text="Back Light")
98 sub.itemR(lamp, "sun_intensity", text="Sun Intens")
99 sub.itemR(lamp, "atmosphere_inscattering", text="Inscattering")
100 sub.itemR(lamp, "atmosphere_extinction", text="Extinction")
101 sub.itemR(lamp, "atmosphere_distance_factor", text="Distance")
103 class DATA_PT_shadow(DataButtonsPanel):
104 __idname__ = "DATA_PT_shadow"
107 def poll(self, context):
108 ob = context.active_object
109 return (ob.type == 'LAMP' and ob.data.type in ('POINT','SUN', 'SPOT', 'AREA'))
111 def draw(self, context):
112 lamp = context.active_object.data
118 layout.itemR(lamp, "shadow_method", expand=True)
120 if lamp.shadow_method in ('BUFFER_SHADOW', 'RAY_SHADOW'):
122 split = layout.split()
125 sub.itemR(lamp, "shadow_color")
128 sub.itemR(lamp, "shadow_layer", text="This Layer Only")
129 sub.itemR(lamp, "only_shadow")
131 if lamp.shadow_method == 'RAY_SHADOW':
133 col = layout.column()
134 col.itemL(text="Sampling:")
135 col.row().itemR(lamp, "shadow_ray_sampling_method", expand=True)
137 if lamp.type in ('POINT', 'SUN', 'SPOT'):
138 flow = layout.column_flow()
139 flow.itemR(lamp, "shadow_soft_size", text="Soft Size")
140 flow.itemR(lamp, "shadow_ray_samples", text="Samples")
141 if lamp.shadow_ray_sampling_method == 'ADAPTIVE_QMC':
142 flow.itemR(lamp, "shadow_adaptive_threshold", text="Threshold")
144 if lamp.type == 'AREA':
145 flow = layout.column_flow()
146 flow.itemR(lamp, "shadow_ray_samples_x", text="Samples")
147 if lamp.shadow_ray_sampling_method == 'ADAPTIVE_QMC':
148 flow.itemR(lamp, "shadow_adaptive_threshold", text="Threshold")
149 if lamp.shadow_ray_sampling_method == 'CONSTANT_JITTERED':
150 flow.itemR(lamp, "umbra")
151 flow.itemR(lamp, "dither")
152 flow.itemR(lamp, "jitter")
154 if lamp.shadow_method == 'BUFFER_SHADOW':
155 col = layout.column()
156 col.itemL(text="Buffer Type:")
157 col.row().itemR(lamp, "shadow_buffer_type", expand=True)
159 if lamp.shadow_buffer_type in ('REGULAR', 'HALFWAY'):
160 flow = layout.column_flow()
161 flow.itemL(text="Sample Buffers:")
162 flow.itemR(lamp, "shadow_sample_buffers", text="")
163 flow.itemL(text="Filter Type:")
164 flow.itemR(lamp, "shadow_filter_type", text="")
166 flow = layout.column_flow()
167 flow.itemR(lamp, "shadow_buffer_size", text="Size")
168 flow.itemR(lamp, "shadow_buffer_samples", text="Samples")
169 flow.itemR(lamp, "shadow_buffer_bias", text="Bias")
170 flow.itemR(lamp, "shadow_buffer_soft", text="Soft")
172 if (lamp.shadow_buffer_type == 'IRREGULAR'):
174 row.itemR(lamp, "shadow_buffer_bias", text="Bias")
177 row.itemR(lamp, "auto_clip_start", text="Autoclip Start")
178 if not (lamp.auto_clip_start):
179 row.itemR(lamp, "shadow_buffer_clip_start", text="Clip Start")
181 row.itemR(lamp, "auto_clip_end", text="Autoclip End")
182 if not (lamp.auto_clip_end):
183 row.itemR(lamp, "shadow_buffer_clip_end", text=" Clip End")
185 class DATA_PT_spot(DataButtonsPanel):
186 __idname__ = "DATA_PT_spot"
189 def poll(self, context):
190 ob = context.active_object
191 return (ob.type == 'LAMP' and ob.data.type == 'SPOT')
193 def draw(self, context):
194 lamp = context.active_object.data
200 split = layout.split()
203 sub.itemR(lamp, "square")
204 sub.itemR(lamp, "spot_size")
205 sub.itemR(lamp, "spot_blend")
208 sub.itemR(lamp, "halo")
210 sub.itemR(lamp, "halo_intensity")
211 if lamp.shadow_method == 'BUFFER_SHADOW':
212 sub.itemR(lamp, "halo_step")
214 bpy.types.register(DATA_PT_lamp)
215 bpy.types.register(DATA_PT_shadow)
216 bpy.types.register(DATA_PT_sunsky)
217 bpy.types.register(DATA_PT_spot)