4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * Contributor(s): Blender Foundation (2008).
22 * ***** END GPL LICENSE BLOCK *****
28 #include "RNA_define.h"
30 #include "rna_internal.h"
32 #include "DNA_material_types.h"
33 #include "DNA_texture_types.h"
34 #include "DNA_world_types.h"
40 #include "MEM_guardedalloc.h"
42 #include "BKE_depsgraph.h"
44 #include "BKE_texture.h"
48 static PointerRNA rna_World_lighting_get(PointerRNA *ptr)
50 return rna_pointer_inherit_refine(ptr, &RNA_WorldLighting, ptr->id.data);
53 static PointerRNA rna_World_stars_get(PointerRNA *ptr)
55 return rna_pointer_inherit_refine(ptr, &RNA_WorldStarsSettings, ptr->id.data);
58 static PointerRNA rna_World_mist_get(PointerRNA *ptr)
60 return rna_pointer_inherit_refine(ptr, &RNA_WorldMistSettings, ptr->id.data);
63 static void rna_World_mtex_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
65 World *wo= (World*)ptr->data;
66 rna_iterator_array_begin(iter, (void*)wo->mtex, sizeof(MTex*), MAX_MTEX, 0, NULL);
69 static PointerRNA rna_World_active_texture_get(PointerRNA *ptr)
71 World *wo= (World*)ptr->data;
74 tex= give_current_world_texture(wo);
75 return rna_pointer_inherit_refine(ptr, &RNA_Texture, tex);
78 static void rna_World_active_texture_set(PointerRNA *ptr, PointerRNA value)
80 World *wo= (World*)ptr->data;
82 set_current_world_texture(wo, value.data);
85 static void rna_World_update(Main *bmain, Scene *scene, PointerRNA *ptr)
87 World *wo= ptr->id.data;
89 DAG_id_flush_update(&wo->id, 0);
90 WM_main_add_notifier(NC_WORLD, wo);
93 static void rna_World_draw_update(Main *bmain, Scene *scene, PointerRNA *ptr)
95 World *wo= ptr->id.data;
97 DAG_id_flush_update(&wo->id, 0);
98 WM_main_add_notifier(NC_WORLD|ND_WORLD_DRAW, wo);
101 /* so camera mist limits redraw */
102 static void rna_World_draw_mist_update(Main *bmain, Scene *scene, PointerRNA *ptr)
104 World *wo= ptr->id.data;
106 DAG_id_flush_update(&wo->id, 0);
107 WM_main_add_notifier(NC_WORLD|ND_WORLD_DRAW, wo);
108 WM_main_add_notifier(NC_OBJECT|ND_DRAW, NULL);
111 static void rna_World_stars_update(Main *bmain, Scene *scene, PointerRNA *ptr)
113 World *wo= ptr->id.data;
115 DAG_id_flush_update(&wo->id, 0);
116 WM_main_add_notifier(NC_WORLD|ND_WORLD_STARS, wo);
122 static void rna_def_world_mtex(BlenderRNA *brna)
127 static EnumPropertyItem texco_items[] = {
128 {TEXCO_VIEW, "VIEW", 0, "View", "Uses view vector for the texture coordinates"},
129 {TEXCO_GLOB, "GLOBAL", 0, "Global", "Uses global coordinates for the texture coordinates (interior mist)"},
130 {TEXCO_ANGMAP, "ANGMAP", 0, "AngMap", "Uses 360 degree angular coordinates, e.g. for spherical light probes"},
131 {TEXCO_H_SPHEREMAP, "SPHERE", 0, "Sphere", "For 360 degree panorama sky, spherical mapped, only top half"},
132 {TEXCO_H_TUBEMAP, "TUBE", 0, "Tube", "For 360 degree panorama sky, cylindrical mapped, only top half"},
133 {TEXCO_OBJECT, "OBJECT", 0, "Object", "Uses linked object's coordinates for texture coordinates"},
134 {0, NULL, 0, NULL, NULL}};
136 srna= RNA_def_struct(brna, "WorldTextureSlot", "TextureSlot");
137 RNA_def_struct_sdna(srna, "MTex");
138 RNA_def_struct_ui_text(srna, "World Texture Slot", "Texture slot for textures in a World datablock");
141 prop= RNA_def_property(srna, "use_map_blend", PROP_BOOLEAN, PROP_NONE);
142 RNA_def_property_boolean_sdna(prop, NULL, "mapto", WOMAP_BLEND);
143 RNA_def_property_ui_text(prop, "Blend", "Affect the color progression of the background");
144 RNA_def_property_update(prop, 0, "rna_World_update");
146 prop= RNA_def_property(srna, "use_map_horizon", PROP_BOOLEAN, PROP_NONE);
147 RNA_def_property_boolean_sdna(prop, NULL, "mapto", WOMAP_HORIZ);
148 RNA_def_property_ui_text(prop, "Horizon", "Affect the color of the horizon");
149 RNA_def_property_update(prop, 0, "rna_World_update");
151 prop= RNA_def_property(srna, "use_map_zenith_up", PROP_BOOLEAN, PROP_NONE);
152 RNA_def_property_boolean_sdna(prop, NULL, "mapto", WOMAP_ZENUP);
153 RNA_def_property_ui_text(prop, "Zenith Up", "Affect the color of the zenith above");
154 RNA_def_property_update(prop, 0, "rna_World_update");
156 prop= RNA_def_property(srna, "use_map_zenith_down", PROP_BOOLEAN, PROP_NONE);
157 RNA_def_property_boolean_sdna(prop, NULL, "mapto", WOMAP_ZENDOWN);
158 RNA_def_property_ui_text(prop, "Zenith Down", "Affect the color of the zenith below");
159 RNA_def_property_update(prop, 0, "rna_World_update");
162 prop= RNA_def_property(srna, "map_mist", PROP_BOOLEAN, PROP_NONE);
163 RNA_def_property_boolean_sdna(prop, NULL, "mapto", WOMAP_MIST);
164 RNA_def_property_ui_text(prop, "Mist", "Causes the texture to affect the intensity of the mist");*/
166 prop= RNA_def_property(srna, "texture_coords", PROP_ENUM, PROP_NONE);
167 RNA_def_property_enum_sdna(prop, NULL, "texco");
168 RNA_def_property_enum_items(prop, texco_items);
169 RNA_def_property_ui_text(prop, "Texture Coordinates", "Texture coordinates used to map the texture onto the background");
170 RNA_def_property_update(prop, 0, "rna_World_update");
172 prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
173 RNA_def_property_pointer_sdna(prop, NULL, "object");
174 RNA_def_property_struct_type(prop, "Object");
175 RNA_def_property_flag(prop, PROP_EDITABLE);
176 RNA_def_property_ui_text(prop, "Object", "Object to use for mapping with Object texture coordinates");
177 RNA_def_property_update(prop, 0, "rna_World_update");
179 prop= RNA_def_property(srna, "blend_factor", PROP_FLOAT, PROP_NONE);
180 RNA_def_property_float_sdna(prop, NULL, "blendfac");
181 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
182 RNA_def_property_ui_text(prop, "Blend Factor", "Amount texture affects color progression of the background");
183 RNA_def_property_update(prop, 0, "rna_World_update");
185 prop= RNA_def_property(srna, "horizon_factor", PROP_FLOAT, PROP_NONE);
186 RNA_def_property_float_sdna(prop, NULL, "colfac");
187 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
188 RNA_def_property_ui_text(prop, "Horizon Factor", "Amount texture affects color of the horizon");
189 RNA_def_property_update(prop, 0, "rna_World_update");
191 prop= RNA_def_property(srna, "zenith_up_factor", PROP_FLOAT, PROP_NONE);
192 RNA_def_property_float_sdna(prop, NULL, "zenupfac");
193 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
194 RNA_def_property_ui_text(prop, "Zenith Up Factor", "Amount texture affects color of the zenith above");
195 RNA_def_property_update(prop, 0, "rna_World_update");
197 prop= RNA_def_property(srna, "zenith_down_factor", PROP_FLOAT, PROP_NONE);
198 RNA_def_property_float_sdna(prop, NULL, "zendownfac");
199 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
200 RNA_def_property_ui_text(prop, "Zenith Down Factor", "Amount texture affects color of the zenith below");
201 RNA_def_property_update(prop, 0, "rna_World_update");
204 static void rna_def_lighting(BlenderRNA *brna)
209 static EnumPropertyItem blend_mode_items[] = {
210 {WO_AOMUL, "MULTIPLY", 0, "Multiply", "Multiply direct lighting with ambient occlusion, darkening the result"},
211 {WO_AOADD, "ADD", 0, "Add", "Add light and shadow"},
212 {0, NULL, 0, NULL, NULL}};
214 static EnumPropertyItem prop_color_items[] = {
215 {WO_AOPLAIN, "PLAIN", 0, "White", "Plain diffuse energy (white.)"},
216 {WO_AOSKYCOL, "SKY_COLOR", 0, "Sky Color", "Use horizon and zenith color for diffuse energy"},
217 {WO_AOSKYTEX, "SKY_TEXTURE", 0, "Sky Texture", "Does full Sky texture render for diffuse energy"},
218 {0, NULL, 0, NULL, NULL}};
220 static EnumPropertyItem prop_sample_method_items[] = {
221 {WO_AOSAMP_CONSTANT, "CONSTANT_JITTERED", 0, "Constant Jittered", ""},
222 {WO_AOSAMP_HALTON, "ADAPTIVE_QMC", 0, "Adaptive QMC", "Fast in high-contrast areas"},
223 {WO_AOSAMP_HAMMERSLEY, "CONSTANT_QMC", 0, "Constant QMC", "Best quality"},
224 {0, NULL, 0, NULL, NULL}};
226 static EnumPropertyItem prop_gather_method_items[] = {
227 {WO_AOGATHER_RAYTRACE, "RAYTRACE", 0, "Raytrace", "Accurate, but slow when noise-free results are required"},
228 {WO_AOGATHER_APPROX, "APPROXIMATE", 0, "Approximate", "Inaccurate, but faster and without noise"},
229 {0, NULL, 0, NULL, NULL}};
231 srna= RNA_def_struct(brna, "WorldLighting", NULL);
232 RNA_def_struct_sdna(srna, "World");
233 RNA_def_struct_nested(brna, srna, "World");
234 RNA_def_struct_ui_text(srna, "Lighting", "Lighting for a World datablock");
236 /* ambient occlusion */
237 prop= RNA_def_property(srna, "use_ambient_occlusion", PROP_BOOLEAN, PROP_NONE);
238 RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_AMB_OCC);
239 RNA_def_property_ui_text(prop, "Use Ambient Occlusion", "Use Ambient Occlusion to add shadowing based on distance between objects");
240 RNA_def_property_update(prop, 0, "rna_World_update");
242 prop= RNA_def_property(srna, "ao_factor", PROP_FLOAT, PROP_FACTOR);
243 RNA_def_property_float_sdna(prop, NULL, "aoenergy");
244 RNA_def_property_range(prop, 0, INT_MAX);
245 RNA_def_property_ui_range(prop, 0, 1, 0.1, 2);
246 RNA_def_property_ui_text(prop, "Factor", "Factor for ambient occlusion blending");
247 RNA_def_property_update(prop, 0, "rna_World_update");
249 prop= RNA_def_property(srna, "ao_blend_type", PROP_ENUM, PROP_NONE);
250 RNA_def_property_enum_sdna(prop, NULL, "aomix");
251 RNA_def_property_enum_items(prop, blend_mode_items);
252 RNA_def_property_ui_text(prop, "Blend Mode", "Defines how AO mixes with material shading");
253 RNA_def_property_update(prop, 0, "rna_World_update");
255 /* environment lighting */
256 prop= RNA_def_property(srna, "use_environment_light", PROP_BOOLEAN, PROP_NONE);
257 RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_ENV_LIGHT);
258 RNA_def_property_ui_text(prop, "Use Environment Lighting", "Add light coming from the environment");
259 RNA_def_property_update(prop, 0, "rna_World_update");
261 prop= RNA_def_property(srna, "environment_energy", PROP_FLOAT, PROP_NONE);
262 RNA_def_property_float_sdna(prop, NULL, "ao_env_energy");
263 RNA_def_property_ui_range(prop, 0, FLT_MAX, 1, 3);
264 RNA_def_property_ui_text(prop, "Environment Color", "Defines the strength of environment light");
265 RNA_def_property_update(prop, 0, "rna_World_update");
267 prop= RNA_def_property(srna, "environment_color", PROP_ENUM, PROP_NONE);
268 RNA_def_property_enum_sdna(prop, NULL, "aocolor");
269 RNA_def_property_enum_items(prop, prop_color_items);
270 RNA_def_property_ui_text(prop, "Environment Color", "Defines where the color of the environment light comes from");
271 RNA_def_property_update(prop, 0, "rna_World_update");
273 /* indirect lighting */
274 prop= RNA_def_property(srna, "use_indirect_light", PROP_BOOLEAN, PROP_NONE);
275 RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_INDIRECT_LIGHT);
276 RNA_def_property_ui_text(prop, "Use Indirect Lighting", "Add indirect light bouncing of surrounding objects");
277 RNA_def_property_update(prop, 0, "rna_World_update");
279 prop= RNA_def_property(srna, "indirect_factor", PROP_FLOAT, PROP_FACTOR);
280 RNA_def_property_float_sdna(prop, NULL, "ao_indirect_energy");
281 RNA_def_property_range(prop, 0, INT_MAX);
282 RNA_def_property_ui_range(prop, 0, 1, 0.1, 2);
283 RNA_def_property_ui_text(prop, "Indirect Factor", "Factor for how much surrounding objects contribute to light");
284 RNA_def_property_update(prop, 0, "rna_World_update");
286 prop= RNA_def_property(srna, "indirect_bounces", PROP_INT, PROP_UNSIGNED);
287 RNA_def_property_int_sdna(prop, NULL, "ao_indirect_bounces");
288 RNA_def_property_range(prop, 1, SHRT_MAX);
289 RNA_def_property_ui_text(prop, "Bounces", "Number of indirect diffuse light bounces to use for approximate ambient occlusion");
290 RNA_def_property_update(prop, 0, "rna_World_update");
292 /* gathering parameters */
293 prop= RNA_def_property(srna, "gather_method", PROP_ENUM, PROP_NONE);
294 RNA_def_property_enum_sdna(prop, NULL, "ao_gather_method");
295 RNA_def_property_enum_items(prop, prop_gather_method_items);
296 RNA_def_property_ui_text(prop, "Gather Method", "");
297 RNA_def_property_update(prop, 0, "rna_World_update");
299 prop= RNA_def_property(srna, "passes", PROP_INT, PROP_NONE);
300 RNA_def_property_int_sdna(prop, NULL, "ao_approx_passes");
301 RNA_def_property_range(prop, 0, 10);
302 RNA_def_property_ui_text(prop, "Passes", "Number of preprocessing passes to reduce overocclusion (for approximate ambient occlusion)");
303 RNA_def_property_update(prop, 0, "rna_World_update");
305 prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
306 RNA_def_property_float_sdna(prop, NULL, "aodist");
307 RNA_def_property_ui_text(prop, "Distance", "Length of rays, defines how far away other faces give occlusion effect");
308 RNA_def_property_update(prop, 0, "rna_World_update");
310 prop= RNA_def_property(srna, "falloff_strength", PROP_FLOAT, PROP_NONE);
311 RNA_def_property_float_sdna(prop, NULL, "aodistfac");
312 RNA_def_property_ui_text(prop, "Strength", "Distance attenuation factor, the higher, the 'shorter' the shadows");
313 RNA_def_property_update(prop, 0, "rna_World_update");
315 prop= RNA_def_property(srna, "bias", PROP_FLOAT, PROP_NONE);
316 RNA_def_property_float_sdna(prop, NULL, "aobias");
317 RNA_def_property_range(prop, 0, 0.5);
318 RNA_def_property_ui_text(prop, "Bias", "Bias (in radians) to prevent smoothed faces from showing banding (for Raytrace Constant Jittered)");
319 RNA_def_property_update(prop, 0, "rna_World_update");
321 prop= RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
322 RNA_def_property_float_sdna(prop, NULL, "ao_adapt_thresh");
323 RNA_def_property_range(prop, 0, 1);
324 RNA_def_property_ui_text(prop, "Threshold", "Samples below this threshold will be considered fully shadowed/unshadowed and skipped (for Raytrace Adaptive QMC)");
325 RNA_def_property_update(prop, 0, "rna_World_update");
327 prop= RNA_def_property(srna, "adapt_to_speed", PROP_FLOAT, PROP_NONE);
328 RNA_def_property_float_sdna(prop, NULL, "ao_adapt_speed_fac");
329 RNA_def_property_range(prop, 0, 1);
330 RNA_def_property_ui_text(prop, "Adapt To Speed", "Use the speed vector pass to reduce AO samples in fast moving pixels. Higher values result in more aggressive sample reduction. Requires Vec pass enabled (for Raytrace Adaptive QMC)");
331 RNA_def_property_update(prop, 0, "rna_World_update");
333 prop= RNA_def_property(srna, "error_threshold", PROP_FLOAT, PROP_NONE);
334 RNA_def_property_float_sdna(prop, NULL, "ao_approx_error");
335 RNA_def_property_range(prop, 0.0001, 10);
336 RNA_def_property_ui_text(prop, "Error Tolerance", "Low values are slower and higher quality (for Approximate)");
337 RNA_def_property_update(prop, 0, "rna_World_update");
339 prop= RNA_def_property(srna, "correction", PROP_FLOAT, PROP_NONE);
340 RNA_def_property_float_sdna(prop, NULL, "ao_approx_correction");
341 RNA_def_property_range(prop, 0, 1);
342 RNA_def_property_ui_range(prop, 0, 1, 0.1, 2);
343 RNA_def_property_ui_text(prop, "Correction", "Ad-hoc correction for over-occlusion due to the approximation (for Approximate)");
344 RNA_def_property_update(prop, 0, "rna_World_update");
346 prop= RNA_def_property(srna, "use_falloff", PROP_BOOLEAN, PROP_NONE);
347 RNA_def_property_boolean_sdna(prop, NULL, "aomode", WO_AODIST);
348 RNA_def_property_ui_text(prop, "Falloff", "");
349 RNA_def_property_update(prop, 0, "rna_World_update");
351 prop= RNA_def_property(srna, "use_cache", PROP_BOOLEAN, PROP_NONE);
352 RNA_def_property_boolean_sdna(prop, NULL, "aomode", WO_AOCACHE);
353 RNA_def_property_ui_text(prop, "Pixel Cache", "Cache AO results in pixels and interpolate over neighbouring pixels for speedup (for Approximate)");
354 RNA_def_property_update(prop, 0, "rna_World_update");
356 prop= RNA_def_property(srna, "samples", PROP_INT, PROP_NONE);
357 RNA_def_property_int_sdna(prop, NULL, "aosamp");
358 RNA_def_property_range(prop, 1, 32);
359 RNA_def_property_ui_text(prop, "Samples", "Amount of ray samples. Higher values give smoother results and longer rendering times");
360 RNA_def_property_update(prop, 0, "rna_World_update");
362 prop= RNA_def_property(srna, "sample_method", PROP_ENUM, PROP_NONE);
363 RNA_def_property_enum_sdna(prop, NULL, "ao_samp_method");
364 RNA_def_property_enum_items(prop, prop_sample_method_items);
365 RNA_def_property_ui_text(prop, "Sample Method", "Method for generating shadow samples (for Raytrace)");
366 RNA_def_property_update(prop, 0, "rna_World_update");
369 static void rna_def_world_mist(BlenderRNA *brna)
374 static EnumPropertyItem falloff_items[] = {
375 {0, "QUADRATIC", 0, "Quadratic", "Mist uses quadratic progression"},
376 {1, "LINEAR", 0, "Linear", "Mist uses linear progression"},
377 {2, "INVERSE_QUADRATIC", 0, "Inverse Quadratic", "Mist uses inverse quadratic progression"},
378 {0, NULL, 0, NULL, NULL}};
380 srna= RNA_def_struct(brna, "WorldMistSettings", NULL);
381 RNA_def_struct_sdna(srna, "World");
382 RNA_def_struct_nested(brna, srna, "World");
383 RNA_def_struct_ui_text(srna, "World Mist", "Mist settings for a World data-block");
385 prop= RNA_def_property(srna, "use_mist", PROP_BOOLEAN, PROP_NONE);
386 RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_MIST);
387 RNA_def_property_ui_text(prop, "Use Mist", "Occlude objects with the environment color as they are further away");
388 RNA_def_property_update(prop, 0, "rna_World_draw_update");
390 prop= RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE);
391 RNA_def_property_float_sdna(prop, NULL, "misi");
392 RNA_def_property_range(prop, 0, 1);
393 RNA_def_property_ui_text(prop, "Intensity", "Intensity of the mist effect");
394 RNA_def_property_update(prop, 0, "rna_World_update");
396 prop= RNA_def_property(srna, "start", PROP_FLOAT, PROP_DISTANCE);
397 RNA_def_property_float_sdna(prop, NULL, "miststa");
398 RNA_def_property_range(prop, 0, FLT_MAX);
399 RNA_def_property_ui_range(prop, 0, 10000, 10, 2);
400 RNA_def_property_ui_text(prop, "Start", "Starting distance of the mist, measured from the camera");
401 RNA_def_property_update(prop, 0, "rna_World_draw_mist_update");
403 prop= RNA_def_property(srna, "depth", PROP_FLOAT, PROP_DISTANCE);
404 RNA_def_property_float_sdna(prop, NULL, "mistdist");
405 RNA_def_property_range(prop, 0, FLT_MAX);
406 RNA_def_property_ui_range(prop, 0, 10000, 10, 2);
407 RNA_def_property_ui_text(prop, "Depth", "The distance over which the mist effect fades in");
408 RNA_def_property_update(prop, 0, "rna_World_draw_mist_update");
410 prop= RNA_def_property(srna, "height", PROP_FLOAT, PROP_DISTANCE);
411 RNA_def_property_float_sdna(prop, NULL, "misthi");
412 RNA_def_property_range(prop, 0, 100);
413 RNA_def_property_ui_text(prop, "Height", "Control how much mist density decreases with height");
414 RNA_def_property_update(prop, 0, "rna_World_update");
416 prop= RNA_def_property(srna, "falloff", PROP_ENUM, PROP_NONE);
417 RNA_def_property_enum_sdna(prop, NULL, "mistype");
418 RNA_def_property_enum_items(prop, falloff_items);
419 RNA_def_property_ui_text(prop, "Falloff", "Type of transition used to fade mist");
420 RNA_def_property_update(prop, 0, "rna_World_update");
423 static void rna_def_world_stars(BlenderRNA *brna)
428 srna= RNA_def_struct(brna, "WorldStarsSettings", NULL);
429 RNA_def_struct_sdna(srna, "World");
430 RNA_def_struct_nested(brna, srna, "World");
431 RNA_def_struct_ui_text(srna, "World Stars", "Stars setting for a World data-block");
433 prop= RNA_def_property(srna, "use_stars", PROP_BOOLEAN, PROP_NONE);
434 RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_STARS);
435 RNA_def_property_ui_text(prop, "Use Stars", "Enable starfield generation");
436 RNA_def_property_update(prop, 0, "rna_World_stars_update");
438 prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
439 RNA_def_property_float_sdna(prop, NULL, "starsize");
440 RNA_def_property_range(prop, 0, 10);
441 RNA_def_property_ui_text(prop, "Size", "Average screen dimension of stars");
442 RNA_def_property_update(prop, 0, "rna_World_draw_update"); /* use normal update since this isnt visualized */
444 prop= RNA_def_property(srna, "distance_min", PROP_FLOAT, PROP_DISTANCE);
445 RNA_def_property_float_sdna(prop, NULL, "starmindist");
446 RNA_def_property_range(prop, 0, 1000);
447 RNA_def_property_ui_text(prop, "Minimum Distance", "Minimum distance to the camera for stars");
448 RNA_def_property_update(prop, 0, "rna_World_stars_update");
450 prop= RNA_def_property(srna, "average_separation", PROP_FLOAT, PROP_NONE);
451 RNA_def_property_float_sdna(prop, NULL, "stardist");
452 RNA_def_property_range(prop, 2, 1000);
453 RNA_def_property_ui_text(prop, "Average Separation", "Average distance between any two stars");
454 RNA_def_property_update(prop, 0, "rna_World_stars_update");
456 prop= RNA_def_property(srna, "color_random", PROP_FLOAT, PROP_NONE);
457 RNA_def_property_float_sdna(prop, NULL, "starcolnoise");
458 RNA_def_property_range(prop, 0, 1);
459 RNA_def_property_ui_text(prop, "Color Randomization", "Randomize star colors");
460 RNA_def_property_update(prop, 0, "rna_World_stars_update");
463 prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
464 RNA_def_property_float_sdna(prop, NULL, "starr");
465 RNA_def_property_array(prop, 3);
466 RNA_def_property_ui_text(prop, "Color", "Stars color");
467 RNA_def_property_update(prop, 0, "rna_World_update");*/
470 void RNA_def_world(BlenderRNA *brna)
476 static EnumPropertyItem physics_engine_items[] = {
477 {WOPHY_NONE, "NONE", 0, "None", ""},
478 //{WOPHY_ENJI, "ENJI", 0, "Enji", ""},
479 //{WOPHY_SUMO, "SUMO", 0, "Sumo (Deprecated)", ""},
480 //{WOPHY_DYNAMO, "DYNAMO", 0, "Dynamo", ""},
481 //{WOPHY_ODE, "ODE", 0, "ODE", ""},
482 {WOPHY_BULLET, "BULLET", 0, "Bullet", ""},
483 {0, NULL, 0, NULL, NULL}};
486 srna= RNA_def_struct(brna, "World", "ID");
487 RNA_def_struct_ui_text(srna, "World", "World datablock describing the environment and ambient lighting of a scene");
488 RNA_def_struct_ui_icon(srna, ICON_WORLD_DATA);
490 rna_def_animdata_common(srna);
491 rna_def_mtex_common(brna, srna, "rna_World_mtex_begin", "rna_World_active_texture_get",
492 "rna_World_active_texture_set", "WorldTextureSlot", "WorldTextureSlots", "rna_World_update");
495 prop= RNA_def_property(srna, "horizon_color", PROP_FLOAT, PROP_COLOR);
496 RNA_def_property_float_sdna(prop, NULL, "horr");
497 RNA_def_property_array(prop, 3);
498 RNA_def_property_ui_text(prop, "Horizon Color", "Color at the horizon");
499 /* RNA_def_property_update(prop, 0, "rna_World_update"); */
500 /* render-only uses this */
501 RNA_def_property_update(prop, NC_WORLD|ND_WORLD_DRAW, "rna_World_update");
504 prop= RNA_def_property(srna, "zenith_color", PROP_FLOAT, PROP_COLOR);
505 RNA_def_property_float_sdna(prop, NULL, "zenr");
506 RNA_def_property_array(prop, 3);
507 RNA_def_property_ui_text(prop, "Zenith Color", "Color at the zenith");
508 RNA_def_property_update(prop, 0, "rna_World_update");
510 prop= RNA_def_property(srna, "ambient_color", PROP_FLOAT, PROP_COLOR);
511 RNA_def_property_float_sdna(prop, NULL, "ambr");
512 RNA_def_property_array(prop, 3);
513 RNA_def_property_ui_text(prop, "Ambient Color", "");
514 RNA_def_property_update(prop, 0, "rna_World_update");
517 prop= RNA_def_property(srna, "exposure", PROP_FLOAT, PROP_NONE);
518 RNA_def_property_float_sdna(prop, NULL, "exp");
519 RNA_def_property_range(prop, 0.0, 1.0);
520 RNA_def_property_ui_text(prop, "Exposure", "Amount of exponential color correction for light");
521 RNA_def_property_update(prop, 0, "rna_World_update");
523 prop= RNA_def_property(srna, "color_range", PROP_FLOAT, PROP_NONE);
524 RNA_def_property_float_sdna(prop, NULL, "range");
525 RNA_def_property_range(prop, 0.2, 5.0);
526 RNA_def_property_ui_text(prop, "Range", "The color range that will be mapped to 0-1");
527 RNA_def_property_update(prop, 0, "rna_World_update");
530 prop= RNA_def_property(srna, "use_sky_blend", PROP_BOOLEAN, PROP_NONE);
531 RNA_def_property_boolean_sdna(prop, NULL, "skytype", WO_SKYBLEND);
532 RNA_def_property_ui_text(prop, "Blend Sky", "Render background with natural progression from horizon to zenith");
533 RNA_def_property_update(prop, 0, "rna_World_update");
535 prop= RNA_def_property(srna, "use_sky_paper", PROP_BOOLEAN, PROP_NONE);
536 RNA_def_property_boolean_sdna(prop, NULL, "skytype", WO_SKYPAPER);
537 RNA_def_property_ui_text(prop, "Paper Sky", "Flatten blend or texture coordinates");
538 RNA_def_property_update(prop, 0, "rna_World_update");
540 prop= RNA_def_property(srna, "use_sky_real", PROP_BOOLEAN, PROP_NONE);
541 RNA_def_property_boolean_sdna(prop, NULL, "skytype", WO_SKYREAL);
542 RNA_def_property_ui_text(prop, "Real Sky", "Render background with a real horizon, relative to the camera angle");
543 RNA_def_property_update(prop, 0, "rna_World_update");
546 prop= RNA_def_property(srna, "light_settings", PROP_POINTER, PROP_NONE);
547 RNA_def_property_flag(prop, PROP_NEVER_NULL);
548 RNA_def_property_struct_type(prop, "WorldLighting");
549 RNA_def_property_pointer_funcs(prop, "rna_World_lighting_get", NULL, NULL, NULL);
550 RNA_def_property_ui_text(prop, "Lighting", "World lighting settings");
552 prop= RNA_def_property(srna, "mist_settings", PROP_POINTER, PROP_NONE);
553 RNA_def_property_flag(prop, PROP_NEVER_NULL);
554 RNA_def_property_struct_type(prop, "WorldMistSettings");
555 RNA_def_property_pointer_funcs(prop, "rna_World_mist_get", NULL, NULL, NULL);
556 RNA_def_property_ui_text(prop, "Mist", "World mist settings");
558 prop= RNA_def_property(srna, "star_settings", PROP_POINTER, PROP_NONE);
559 RNA_def_property_flag(prop, PROP_NEVER_NULL);
560 RNA_def_property_struct_type(prop, "WorldStarsSettings");
561 RNA_def_property_pointer_funcs(prop, "rna_World_stars_get", NULL, NULL, NULL);
562 RNA_def_property_ui_text(prop, "Stars", "World stars settings");
564 rna_def_lighting(brna);
565 rna_def_world_mist(brna);
566 rna_def_world_stars(brna);
567 rna_def_world_mtex(brna);