2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * Contributor(s): Blender Foundation (2008).
20 * ***** END GPL LICENSE BLOCK *****
23 /** \file blender/makesrna/intern/rna_scene.c
29 #include "RNA_define.h"
30 #include "RNA_enum_types.h"
32 #include "rna_internal.h"
34 #include "DNA_brush_types.h"
35 #include "DNA_group_types.h"
36 #include "DNA_modifier_types.h"
37 #include "DNA_particle_types.h"
38 #include "DNA_scene_types.h"
39 #include "DNA_userdef_types.h"
40 #include "DNA_world_types.h"
44 #include "BLF_translation.h"
46 #include "BKE_tessmesh.h"
48 /* Include for Bake Options */
49 #include "RE_engine.h"
50 #include "RE_pipeline.h"
53 #include "quicktime_export.h"
54 # ifdef WITH_AUDASPACE
55 # include "AUD_Space.h"
60 #include "BKE_writeffmpeg.h"
61 #include <libavcodec/avcodec.h>
62 #include <libavformat/avformat.h>
65 #include "ED_render.h"
70 #include "BLI_threads.h"
72 EnumPropertyItem uv_sculpt_relaxation_items[] = {
73 {UV_SCULPT_TOOL_RELAX_LAPLACIAN, "LAPLACIAN", 0, "Laplacian", "Use Laplacian method for relaxation"},
74 {UV_SCULPT_TOOL_RELAX_HC, "HC", 0, "HC", "Use HC method for relaxation"},
75 {0, NULL, 0, NULL, NULL}
78 EnumPropertyItem uv_sculpt_tool_items[] = {
79 {UV_SCULPT_TOOL_PINCH, "PINCH", 0, "Pinch", "Pinch UVs"},
80 {UV_SCULPT_TOOL_RELAX, "RELAX", 0, "Relax", "Relax UVs"},
81 {UV_SCULPT_TOOL_GRAB, "GRAB", 0, "Grab", "Grab UVs"},
82 {0, NULL, 0, NULL, NULL}
86 EnumPropertyItem snap_target_items[] = {
87 {SCE_SNAP_TARGET_CLOSEST, "CLOSEST", 0, "Closest", "Snap closest point onto target"},
88 {SCE_SNAP_TARGET_CENTER, "CENTER", 0, "Center", "Snap center onto target"},
89 {SCE_SNAP_TARGET_MEDIAN, "MEDIAN", 0, "Median", "Snap median onto target"},
90 {SCE_SNAP_TARGET_ACTIVE, "ACTIVE", 0, "Active", "Snap active onto target"},
91 {0, NULL, 0, NULL, NULL}
94 EnumPropertyItem proportional_falloff_items[] = {
95 {PROP_SMOOTH, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", "Smooth falloff"},
96 {PROP_SPHERE, "SPHERE", ICON_SPHERECURVE, "Sphere", "Spherical falloff"},
97 {PROP_ROOT, "ROOT", ICON_ROOTCURVE, "Root", "Root falloff"},
98 {PROP_SHARP, "SHARP", ICON_SHARPCURVE, "Sharp", "Sharp falloff"},
99 {PROP_LIN, "LINEAR", ICON_LINCURVE, "Linear", "Linear falloff"},
100 {PROP_CONST, "CONSTANT", ICON_NOCURVE, "Constant", "Constant falloff"},
101 {PROP_RANDOM, "RANDOM", ICON_RNDCURVE, "Random", "Random falloff"},
102 {0, NULL, 0, NULL, NULL}
105 /* subset of the enum - only curves, missing random and const */
106 EnumPropertyItem proportional_falloff_curve_only_items[] = {
107 {PROP_SMOOTH, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", "Smooth falloff"},
108 {PROP_SPHERE, "SPHERE", ICON_SPHERECURVE, "Sphere", "Spherical falloff"},
109 {PROP_ROOT, "ROOT", ICON_ROOTCURVE, "Root", "Root falloff"},
110 {PROP_SHARP, "SHARP", ICON_SHARPCURVE, "Sharp", "Sharp falloff"},
111 {PROP_LIN, "LINEAR", ICON_LINCURVE, "Linear", "Linear falloff"},
112 {0, NULL, 0, NULL, NULL}
116 EnumPropertyItem proportional_editing_items[] = {
117 {PROP_EDIT_OFF, "DISABLED", ICON_PROP_OFF, "Disable", "Proportional Editing disabled"},
118 {PROP_EDIT_ON, "ENABLED", ICON_PROP_ON, "Enable", "Proportional Editing enabled"},
119 {PROP_EDIT_CONNECTED, "CONNECTED", ICON_PROP_CON, "Connected", "Proportional Editing using connected geometry only"},
120 {0, NULL, 0, NULL, NULL}
123 /* keep for operators, not used here */
124 EnumPropertyItem mesh_select_mode_items[] = {
125 {SCE_SELECT_VERTEX, "VERTEX", ICON_VERTEXSEL, "Vertex", "Vertex selection mode"},
126 {SCE_SELECT_EDGE, "EDGE", ICON_EDGESEL, "Edge", "Edge selection mode"},
127 {SCE_SELECT_FACE, "FACE", ICON_FACESEL, "Face", "Face selection mode"},
128 {0, NULL, 0, NULL, NULL}
131 EnumPropertyItem snap_element_items[] = {
132 {SCE_SNAP_MODE_INCREMENT, "INCREMENT", ICON_SNAP_INCREMENT, "Increment", "Snap to increments of grid"},
133 {SCE_SNAP_MODE_VERTEX, "VERTEX", ICON_SNAP_VERTEX, "Vertex", "Snap to vertices"},
134 {SCE_SNAP_MODE_EDGE, "EDGE", ICON_SNAP_EDGE, "Edge", "Snap to edges"},
135 {SCE_SNAP_MODE_FACE, "FACE", ICON_SNAP_FACE, "Face", "Snap to faces"},
136 {SCE_SNAP_MODE_VOLUME, "VOLUME", ICON_SNAP_VOLUME, "Volume", "Snap to volume"},
137 {0, NULL, 0, NULL, NULL}
140 EnumPropertyItem snap_node_element_items[] = {
141 {SCE_SNAP_MODE_INCREMENT, "INCREMENT", ICON_SNAP_INCREMENT, "Increment", "Snap to increments of grid"},
142 {SCE_SNAP_MODE_NODE_X, "NODE_X", ICON_SNAP_EDGE, "Node X", "Snap to left/right node border"},
143 {SCE_SNAP_MODE_NODE_Y, "NODE_Y", ICON_SNAP_EDGE, "Node Y", "Snap to top/bottom node border"},
144 {SCE_SNAP_MODE_NODE_XY, "NODE_XY", ICON_SNAP_EDGE, "Node X / Y", "Snap to any node border"},
145 {0, NULL, 0, NULL, NULL}
148 EnumPropertyItem snap_uv_element_items[] = {
149 {SCE_SNAP_MODE_INCREMENT, "INCREMENT", ICON_SNAP_INCREMENT, "Increment", "Snap to increments of grid"},
150 {SCE_SNAP_MODE_VERTEX, "VERTEX", ICON_SNAP_VERTEX, "Vertex", "Snap to vertices"},
151 {0, NULL, 0, NULL, NULL}
154 /* workaround for duplicate enums,
155 * have each enum line as a defne then conditionally set it or not
158 #define R_IMF_ENUM_BMP {R_IMF_IMTYPE_BMP, "BMP", ICON_FILE_IMAGE, "BMP", "Output image in bitmap format"},
159 #define R_IMF_ENUM_IRIS {R_IMF_IMTYPE_IRIS, "IRIS", ICON_FILE_IMAGE, "Iris", \
160 "Output image in (old!) SGI IRIS format"},
161 #define R_IMF_ENUM_PNG {R_IMF_IMTYPE_PNG, "PNG", ICON_FILE_IMAGE, "PNG", "Output image in PNG format"},
162 #define R_IMF_ENUM_JPEG {R_IMF_IMTYPE_JPEG90, "JPEG", ICON_FILE_IMAGE, "JPEG", "Output image in JPEG format"},
163 #define R_IMF_ENUM_TAGA {R_IMF_IMTYPE_TARGA, "TARGA", ICON_FILE_IMAGE, "Targa", "Output image in Targa format"},
164 #define R_IMF_ENUM_TAGA_RAW {R_IMF_IMTYPE_RAWTGA, "TARGA_RAW", ICON_FILE_IMAGE, "Targa Raw", \
165 "Output image in uncompressed Targa format"},
167 #if 0 /* UNUSED (so far) */
169 # define R_IMF_ENUM_DDS {R_IMF_IMTYPE_DDS, "DDS", ICON_FILE_IMAGE, "DDS", "Output image in DDS format"},
171 # define R_IMF_ENUM_DDS
176 # define R_IMF_ENUM_JPEG2K {R_IMF_IMTYPE_JP2, "JPEG2000", ICON_FILE_IMAGE, "JPEG 2000", \
177 "Output image in JPEG 2000 format"},
179 # define R_IMF_ENUM_JPEG2K
183 # define R_IMF_ENUM_CINEON {R_IMF_IMTYPE_CINEON, "CINEON", ICON_FILE_IMAGE, "Cineon", \
184 "Output image in Cineon format"},
185 # define R_IMF_ENUM_DPX {R_IMF_IMTYPE_DPX, "DPX", ICON_FILE_IMAGE, "DPX", "Output image in DPX format"},
187 # define R_IMF_ENUM_CINEON
188 # define R_IMF_ENUM_DPX
192 # define R_IMF_ENUM_EXR_MULTI {R_IMF_IMTYPE_MULTILAYER, "OPEN_EXR_MULTILAYER", ICON_FILE_IMAGE, \
193 "OpenEXR MultiLayer", \
194 "Output image in multilayer OpenEXR format"},
195 # define R_IMF_ENUM_EXR {R_IMF_IMTYPE_OPENEXR, "OPEN_EXR", ICON_FILE_IMAGE, "OpenEXR", \
196 "Output image in OpenEXR format"},
198 # define R_IMF_ENUM_EXR_MULTI
199 # define R_IMF_ENUM_EXR
203 # define R_IMF_ENUM_HDR {R_IMF_IMTYPE_RADHDR, "HDR", ICON_FILE_IMAGE, "Radiance HDR", \
204 "Output image in Radiance HDR format"},
206 # define R_IMF_ENUM_HDR
210 # define R_IMF_ENUM_TIFF {R_IMF_IMTYPE_TIFF, "TIFF", ICON_FILE_IMAGE, "TIFF", "Output image in TIFF format"},
212 # define R_IMF_ENUM_TIFF
216 #define IMAGE_TYPE_ITEMS_IMAGE_ONLY \
218 /* DDS save not supported yet R_IMF_ENUM_DDS */ \
224 R_IMF_ENUM_TAGA_RAW \
225 {0, "", 0, " ", NULL}, \
228 R_IMF_ENUM_EXR_MULTI \
234 EnumPropertyItem image_only_type_items[] = {
236 IMAGE_TYPE_ITEMS_IMAGE_ONLY
238 {0, NULL, 0, NULL, NULL}
241 EnumPropertyItem image_type_items[] = {
242 {0, "", 0, N_("Image"), NULL},
244 IMAGE_TYPE_ITEMS_IMAGE_ONLY
246 {0, "", 0, N_("Movie"), NULL},
247 {R_IMF_IMTYPE_AVIJPEG, "AVI_JPEG", ICON_FILE_MOVIE, "AVI JPEG", "Output video in AVI JPEG format"},
248 {R_IMF_IMTYPE_AVIRAW, "AVI_RAW", ICON_FILE_MOVIE, "AVI Raw", "Output video in AVI Raw format"},
249 #ifdef WITH_FRAMESERVER
250 {R_IMF_IMTYPE_FRAMESERVER, "FRAMESERVER", ICON_FILE_SCRIPT, "Frame Server", "Output image to a frameserver"},
253 {R_IMF_IMTYPE_H264, "H264", ICON_FILE_MOVIE, "H.264", "Output video in H.264 format"},
254 {R_IMF_IMTYPE_FFMPEG, "FFMPEG", ICON_FILE_MOVIE, "MPEG", "Output video in MPEG format"},
255 {R_IMF_IMTYPE_THEORA, "THEORA", ICON_FILE_MOVIE, "Ogg Theora", "Output video in Ogg format"},
257 #ifdef WITH_QUICKTIME
259 {R_IMF_IMTYPE_QUICKTIME, "QUICKTIME_QTKIT", ICON_FILE_MOVIE, "QuickTime", "Output video in Quicktime format"},
261 {R_IMF_IMTYPE_QUICKTIME, "QUICKTIME_CARBON", ICON_FILE_MOVIE, "QuickTime", "Output video in Quicktime format"},
265 {R_IMF_IMTYPE_XVID, "XVID", ICON_FILE_MOVIE, "Xvid", "Output video in Xvid format"},
267 {0, NULL, 0, NULL, NULL}
270 EnumPropertyItem image_color_mode_items[] = {
271 {R_IMF_PLANES_BW, "BW", 0, "BW", "Images get saved in 8 bits grayscale (only PNG, JPEG, TGA, TIF)"},
272 {R_IMF_PLANES_RGB, "RGB", 0, "RGB", "Images are saved with RGB (color) data"},
273 {R_IMF_PLANES_RGBA, "RGBA", 0, "RGBA", "Images are saved with RGB and Alpha data (if supported)"},
274 {0, NULL, 0, NULL, NULL}
277 #define IMAGE_COLOR_MODE_BW image_color_mode_items[0]
278 #define IMAGE_COLOR_MODE_RGB image_color_mode_items[1]
279 #define IMAGE_COLOR_MODE_RGBA image_color_mode_items[2]
281 EnumPropertyItem image_color_depth_items[] = {
282 /* 1 (monochrome) not used */
283 {R_IMF_CHAN_DEPTH_8, "8", 0, "8", "8 bit color channels"},
284 {R_IMF_CHAN_DEPTH_10, "10", 0, "10", "10 bit color channels"},
285 {R_IMF_CHAN_DEPTH_12, "12", 0, "12", "12 bit color channels"},
286 {R_IMF_CHAN_DEPTH_16, "16", 0, "16", "16 bit color channels"},
288 {R_IMF_CHAN_DEPTH_32, "32", 0, "32", "32 bit color channels"},
289 {0, NULL, 0, NULL, NULL}
294 #include "DNA_anim_types.h"
295 #include "DNA_node_types.h"
296 #include "DNA_object_types.h"
297 #include "DNA_mesh_types.h"
299 #include "RNA_access.h"
301 #include "MEM_guardedalloc.h"
303 #include "BLI_threads.h"
305 #include "BKE_brush.h"
306 #include "BKE_context.h"
307 #include "BKE_global.h"
308 #include "BKE_image.h"
309 #include "BKE_main.h"
310 #include "BKE_node.h"
311 #include "BKE_pointcache.h"
312 #include "BKE_scene.h"
313 #include "BKE_depsgraph.h"
314 #include "BKE_image.h"
315 #include "BKE_mesh.h"
316 #include "BKE_sound.h"
317 #include "BKE_screen.h"
318 #include "BKE_sequencer.h"
319 #include "BKE_animsys.h"
325 #include "ED_view3d.h"
327 #include "ED_keyframing.h"
328 #include "ED_image.h"
330 #include "RE_engine.h"
332 static void rna_SpaceImageEditor_uv_sculpt_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr))
334 ED_space_image_uv_sculpt_update(bmain->wm.first, scene->toolsettings);
337 static int rna_Scene_object_bases_lookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr)
339 Scene *scene = (Scene *)ptr->data;
342 for (base = scene->base.first; base; base = base->next) {
343 if (strncmp(base->object->id.name + 2, key, sizeof(base->object->id.name) - 2) == 0) {
344 *r_ptr = rna_pointer_inherit_refine(ptr, &RNA_ObjectBase, base);
352 static PointerRNA rna_Scene_objects_get(CollectionPropertyIterator *iter)
354 ListBaseIterator *internal = iter->internal;
356 /* we are actually iterating a Base list, so override get */
357 return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, ((Base *)internal->link)->object);
360 static Base *rna_Scene_object_link(Scene *scene, bContext *C, ReportList *reports, Object *ob)
362 Scene *scene_act = CTX_data_scene(C);
365 if (BKE_scene_base_find(scene, ob)) {
366 BKE_reportf(reports, RPT_ERROR, "Object '%s' is already in scene '%s'", ob->id.name + 2, scene->id.name + 2);
370 base = BKE_scene_base_add(scene, ob);
373 /* this is similar to what object_add_type and BKE_object_add do */
374 base->lay = scene->lay;
376 /* when linking to an inactive scene don't touch the layer */
377 if (scene == scene_act)
380 ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
382 /* slows down importers too much, run scene.update() */
383 /* DAG_scene_sort(G.main, scene); */
385 WM_main_add_notifier(NC_SCENE | ND_OB_ACTIVE, scene);
390 static void rna_Scene_object_unlink(Scene *scene, ReportList *reports, Object *ob)
392 Base *base = BKE_scene_base_find(scene, ob);
394 BKE_reportf(reports, RPT_ERROR, "Object '%s' is not in this scene '%s'", ob->id.name + 2, scene->id.name + 2);
397 if (base == scene->basact && ob->mode != OB_MODE_OBJECT) {
398 BKE_reportf(reports, RPT_ERROR, "Object '%s' must be in object mode to unlink", ob->id.name + 2);
401 if (scene->basact == base) {
402 scene->basact = NULL;
405 BLI_remlink(&scene->base, base);
410 /* needed otherwise the depgraph will contain freed objects which can crash, see [#20958] */
411 DAG_scene_sort(G.main, scene);
412 DAG_ids_flush_update(G.main, 0);
414 WM_main_add_notifier(NC_SCENE | ND_OB_ACTIVE, scene);
417 static void rna_Scene_skgen_etch_template_set(PointerRNA *ptr, PointerRNA value)
419 ToolSettings *ts = (ToolSettings *)ptr->data;
420 if (value.data && ((Object *)value.data)->type == OB_ARMATURE)
421 ts->skgen_template = value.data;
423 ts->skgen_template = NULL;
426 static PointerRNA rna_Scene_active_object_get(PointerRNA *ptr)
428 Scene *scene = (Scene *)ptr->data;
429 return rna_pointer_inherit_refine(ptr, &RNA_Object, scene->basact ? scene->basact->object : NULL);
432 static void rna_Scene_active_object_set(PointerRNA *ptr, PointerRNA value)
434 Scene *scene = (Scene *)ptr->data;
436 scene->basact = BKE_scene_base_find(scene, (Object *)value.data);
438 scene->basact = NULL;
441 static void rna_Scene_set_set(PointerRNA *ptr, PointerRNA value)
443 Scene *scene = (Scene *)ptr->data;
444 Scene *set = (Scene *)value.data;
447 for (nested_set = set; nested_set; nested_set = nested_set->set) {
448 if (nested_set == scene)
455 static void rna_Scene_layer_set(PointerRNA *ptr, const int *values)
457 Scene *scene = (Scene *)ptr->data;
459 scene->lay = ED_view3d_scene_layer_set(scene->lay, values, &scene->layact);
462 static int rna_Scene_active_layer_get(PointerRNA *ptr)
464 Scene *scene = (Scene *)ptr->data;
466 return (int)(log(scene->layact) / M_LN2);
469 static void rna_Scene_view3d_update(Main *bmain, Scene *UNUSED(scene_unused), PointerRNA *ptr)
471 Scene *scene = (Scene *)ptr->data;
473 BKE_screen_view3d_main_sync(&bmain->screen, scene);
476 static void rna_Scene_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
478 rna_Scene_view3d_update(bmain, scene, ptr);
479 DAG_on_visible_update(bmain, FALSE);
482 static void rna_Scene_fps_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
484 sound_update_fps(scene);
485 BKE_sequencer_update_sound_bounds_all(scene);
488 static void rna_Scene_listener_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
490 sound_update_scene_listener(scene);
493 static void rna_Scene_volume_set(PointerRNA *ptr, float value)
495 Scene *scene = (Scene *)(ptr->data);
497 scene->audio.volume = value;
498 if (scene->sound_scene)
499 sound_set_scene_volume(scene, value);
502 static void rna_Scene_framelen_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
504 scene->r.framelen = (float)scene->r.framapto / (float)scene->r.images;
508 static void rna_Scene_frame_current_set(PointerRNA *ptr, int value)
510 Scene *data = (Scene *)ptr->data;
512 /* if negative frames aren't allowed, then we can't use them */
513 FRAMENUMBER_MIN_CLAMP(value);
514 data->r.cfra = value;
517 static void rna_Scene_start_frame_set(PointerRNA *ptr, int value)
519 Scene *data = (Scene *)ptr->data;
520 /* MINFRAME not MINAFRAME, since some output formats can't taken negative frames */
521 CLAMP(value, MINFRAME, MAXFRAME);
522 data->r.sfra = value;
524 if (data->r.sfra >= data->r.efra) {
525 data->r.efra = MIN2(data->r.sfra, MAXFRAME);
529 static void rna_Scene_end_frame_set(PointerRNA *ptr, int value)
531 Scene *data = (Scene *)ptr->data;
532 CLAMP(value, MINFRAME, MAXFRAME);
533 data->r.efra = value;
535 if (data->r.sfra >= data->r.efra) {
536 data->r.sfra = MAX2(data->r.efra, MINFRAME);
540 static void rna_Scene_use_preview_range_set(PointerRNA *ptr, int value)
542 Scene *data = (Scene *)ptr->data;
545 /* copy range from scene if not set before */
546 if ((data->r.psfra == data->r.pefra) && (data->r.psfra == 0)) {
547 data->r.psfra = data->r.sfra;
548 data->r.pefra = data->r.efra;
551 data->r.flag |= SCER_PRV_RANGE;
554 data->r.flag &= ~SCER_PRV_RANGE;
558 static void rna_Scene_preview_range_start_frame_set(PointerRNA *ptr, int value)
560 Scene *data = (Scene *)ptr->data;
562 /* check if enabled already */
563 if ((data->r.flag & SCER_PRV_RANGE) == 0) {
564 /* set end of preview range to end frame, then clamp as per normal */
565 /* TODO: or just refuse to set instead? */
566 data->r.pefra = data->r.efra;
569 /* now set normally */
570 CLAMP(value, MINAFRAME, data->r.pefra);
571 data->r.psfra = value;
574 static void rna_Scene_preview_range_end_frame_set(PointerRNA *ptr, int value)
576 Scene *data = (Scene *)ptr->data;
578 /* check if enabled already */
579 if ((data->r.flag & SCER_PRV_RANGE) == 0) {
580 /* set start of preview range to start frame, then clamp as per normal */
581 /* TODO: or just refuse to set instead? */
582 data->r.psfra = data->r.sfra;
585 /* now set normally */
586 CLAMP(value, data->r.psfra, MAXFRAME);
587 data->r.pefra = value;
590 static void rna_Scene_frame_update(Main *bmain, Scene *UNUSED(current_scene), PointerRNA *ptr)
592 Scene *scene = (Scene *)ptr->id.data;
593 sound_seek_scene(bmain, scene);
596 static PointerRNA rna_Scene_active_keying_set_get(PointerRNA *ptr)
598 Scene *scene = (Scene *)ptr->data;
599 return rna_pointer_inherit_refine(ptr, &RNA_KeyingSet, ANIM_scene_get_active_keyingset(scene));
602 static void rna_Scene_active_keying_set_set(PointerRNA *ptr, PointerRNA value)
604 Scene *scene = (Scene *)ptr->data;
605 KeyingSet *ks = (KeyingSet *)value.data;
607 scene->active_keyingset = ANIM_scene_get_keyingset_index(scene, ks);
610 /* get KeyingSet index stuff for list of Keying Sets editing UI
611 * - active_keyingset-1 since 0 is reserved for 'none'
612 * - don't clamp, otherwise can never set builtins types as active...
614 static int rna_Scene_active_keying_set_index_get(PointerRNA *ptr)
616 Scene *scene = (Scene *)ptr->data;
617 return scene->active_keyingset - 1;
620 /* get KeyingSet index stuff for list of Keying Sets editing UI
621 * - value+1 since 0 is reserved for 'none'
623 static void rna_Scene_active_keying_set_index_set(PointerRNA *ptr, int value)
625 Scene *scene = (Scene *)ptr->data;
626 scene->active_keyingset = value + 1;
629 /* XXX: evil... builtin_keyingsets is defined in keyingsets.c! */
630 /* TODO: make API function to retrieve this... */
631 extern ListBase builtin_keyingsets;
633 static void rna_Scene_all_keyingsets_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
635 Scene *scene = (Scene *)ptr->data;
637 /* start going over the scene KeyingSets first, while we still have pointer to it
638 * but only if we have any Keying Sets to use...
640 if (scene->keyingsets.first)
641 rna_iterator_listbase_begin(iter, &scene->keyingsets, NULL);
643 rna_iterator_listbase_begin(iter, &builtin_keyingsets, NULL);
646 static void rna_Scene_all_keyingsets_next(CollectionPropertyIterator *iter)
648 ListBaseIterator *internal = iter->internal;
649 KeyingSet *ks = (KeyingSet *)internal->link;
651 /* if we've run out of links in Scene list, jump over to the builtins list unless we're there already */
652 if ((ks->next == NULL) && (ks != builtin_keyingsets.last))
653 internal->link = (Link *)builtin_keyingsets.first;
655 internal->link = (Link *)ks->next;
657 iter->valid = (internal->link != NULL);
660 static char *rna_RenderSettings_path(PointerRNA *UNUSED(ptr))
662 return BLI_sprintfN("render");
665 static int rna_RenderSettings_threads_get(PointerRNA *ptr)
667 RenderData *rd = (RenderData *)ptr->data;
669 if (rd->mode & R_FIXED_THREADS)
672 return BLI_system_thread_count();
675 static int rna_RenderSettings_is_movie_fomat_get(PointerRNA *ptr)
677 RenderData *rd = (RenderData *)ptr->data;
678 return BKE_imtype_is_movie(rd->im_format.imtype);
681 static int rna_RenderSettings_save_buffers_get(PointerRNA *ptr)
683 RenderData *rd = (RenderData *)ptr->data;
684 if (rd->mode & R_BORDER)
687 return (rd->scemode & (R_EXR_TILE_FILE | R_FULL_SAMPLE)) != 0;
690 static int rna_RenderSettings_full_sample_get(PointerRNA *ptr)
692 RenderData *rd = (RenderData *)ptr->data;
694 return (rd->scemode & R_FULL_SAMPLE) && !(rd->mode & R_BORDER);
697 static void rna_ImageFormatSettings_file_format_set(PointerRNA *ptr, int value)
699 ImageFormatData *imf = (ImageFormatData *)ptr->data;
700 ID *id = ptr->id.data;
701 const char is_render = (id && GS(id->name) == ID_SCE);
702 /* see note below on why this is */
703 const char chan_flag = BKE_imtype_valid_channels(imf->imtype) | (is_render ? IMA_CHAN_FLAG_BW : 0);
707 /* ensure depth and color settings match */
708 if ( ((imf->planes == R_IMF_PLANES_BW) && !(chan_flag & IMA_CHAN_FLAG_BW)) ||
709 ((imf->planes == R_IMF_PLANES_RGBA) && !(chan_flag & IMA_CHAN_FLAG_ALPHA)))
711 imf->planes = R_IMF_PLANES_RGB;
714 /* ensure usable depth */
716 const int depth_ok = BKE_imtype_valid_depths(imf->imtype);
717 if ((imf->depth & depth_ok) == 0) {
718 /* set first available depth */
719 char depth_ls[] = {R_IMF_CHAN_DEPTH_32,
729 for (i = 0; depth_ls[i]; i++) {
730 if (depth_ok & depth_ls[i]) {
731 imf->depth = depth_ls[i];
738 if (id && GS(id->name) == ID_SCE) {
739 Scene *scene = ptr->id.data;
740 RenderData *rd = &scene->r;
742 BKE_ffmpeg_image_type_verify(rd, imf);
744 #ifdef WITH_QUICKTIME
745 quicktime_verify_image_type(rd, imf);
751 static EnumPropertyItem *rna_ImageFormatSettings_file_format_itemf(bContext *C, PointerRNA *ptr,
752 PropertyRNA *UNUSED(prop), int *UNUSED(free))
754 ID *id = ptr->id.data;
755 if (id && GS(id->name) == ID_SCE) {
756 return image_type_items;
759 return image_only_type_items;
763 static EnumPropertyItem *rna_ImageFormatSettings_color_mode_itemf(bContext *C, PointerRNA *ptr,
764 PropertyRNA *UNUSED(prop), int *free)
766 ImageFormatData *imf = (ImageFormatData *)ptr->data;
767 ID *id = ptr->id.data;
768 const char is_render = (id && GS(id->name) == ID_SCE);
770 /* note, we need to act differently for render
771 * where 'BW' will force grayscale even if the output format writes
772 * as RGBA, this is age old blender convention and not sure how useful
773 * it really is but keep it for now - campbell */
774 char chan_flag = BKE_imtype_valid_channels(imf->imtype) | (is_render ? IMA_CHAN_FLAG_BW : 0);
777 /* a WAY more crappy case than B&W flag: depending on codec, file format MIGHT support
778 * alpha channel. for example MPEG format with h264 codec can't do alpha channel, but
779 * the same MPEG format with QTRLE codec can easily handle alpha channel.
780 * not sure how to deal with such cases in a nicer way (sergey) */
782 Scene *scene = ptr->id.data;
783 RenderData *rd = &scene->r;
785 if (BKE_ffmpeg_alpha_channel_is_supported(rd))
786 chan_flag |= IMA_CHAN_FLAG_ALPHA;
790 if (chan_flag == (IMA_CHAN_FLAG_BW | IMA_CHAN_FLAG_RGB | IMA_CHAN_FLAG_ALPHA)) {
791 return image_color_mode_items;
795 EnumPropertyItem *item = NULL;
797 if (chan_flag & IMA_CHAN_FLAG_BW) RNA_enum_item_add(&item, &totitem, &IMAGE_COLOR_MODE_BW);
798 if (chan_flag & IMA_CHAN_FLAG_RGB) RNA_enum_item_add(&item, &totitem, &IMAGE_COLOR_MODE_RGB);
799 if (chan_flag & IMA_CHAN_FLAG_ALPHA) RNA_enum_item_add(&item, &totitem, &IMAGE_COLOR_MODE_RGBA);
801 RNA_enum_item_end(&item, &totitem);
808 static EnumPropertyItem *rna_ImageFormatSettings_color_depth_itemf(bContext *C, PointerRNA *ptr,
809 PropertyRNA *UNUSED(prop), int *free)
811 ImageFormatData *imf = (ImageFormatData *)ptr->data;
814 return image_color_depth_items;
817 const int depth_ok = BKE_imtype_valid_depths(imf->imtype);
818 const int is_float = ELEM3(imf->imtype, R_IMF_IMTYPE_RADHDR, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER);
820 EnumPropertyItem *item_8bit = &image_color_depth_items[0];
821 EnumPropertyItem *item_10bit = &image_color_depth_items[1];
822 EnumPropertyItem *item_12bit = &image_color_depth_items[2];
823 EnumPropertyItem *item_16bit = &image_color_depth_items[3];
824 EnumPropertyItem *item_32bit = &image_color_depth_items[4];
827 EnumPropertyItem *item = NULL;
828 EnumPropertyItem tmp = {0, "", 0, "", ""};
830 if (depth_ok & R_IMF_CHAN_DEPTH_8) {
831 RNA_enum_item_add(&item, &totitem, item_8bit);
834 if (depth_ok & R_IMF_CHAN_DEPTH_10) {
835 RNA_enum_item_add(&item, &totitem, item_10bit);
838 if (depth_ok & R_IMF_CHAN_DEPTH_12) {
839 RNA_enum_item_add(&item, &totitem, item_12bit);
842 if (depth_ok & R_IMF_CHAN_DEPTH_16) {
845 tmp.name = "Float (Half)";
846 RNA_enum_item_add(&item, &totitem, &tmp);
849 RNA_enum_item_add(&item, &totitem, item_16bit);
853 if (depth_ok & R_IMF_CHAN_DEPTH_32) {
856 tmp.name = "Float (Full)";
857 RNA_enum_item_add(&item, &totitem, &tmp);
860 RNA_enum_item_add(&item, &totitem, item_32bit);
864 RNA_enum_item_end(&item, &totitem);
871 static int rna_SceneRender_file_ext_length(PointerRNA *ptr)
873 RenderData *rd = (RenderData *)ptr->data;
876 BKE_add_image_extension(ext, rd->im_format.imtype);
880 static void rna_SceneRender_file_ext_get(PointerRNA *ptr, char *str)
882 RenderData *rd = (RenderData *)ptr->data;
884 BKE_add_image_extension(str, rd->im_format.imtype);
887 #ifdef WITH_QUICKTIME
888 static int rna_RenderSettings_qtcodecsettings_codecType_get(PointerRNA *ptr)
890 QuicktimeCodecSettings *settings = (QuicktimeCodecSettings *)ptr->data;
892 return quicktime_rnatmpvalue_from_videocodectype(settings->codecType);
895 static void rna_RenderSettings_qtcodecsettings_codecType_set(PointerRNA *ptr, int value)
897 QuicktimeCodecSettings *settings = (QuicktimeCodecSettings *)ptr->data;
899 settings->codecType = quicktime_videocodecType_from_rnatmpvalue(value);
902 static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_codecType_itemf(bContext *C, PointerRNA *ptr,
903 PropertyRNA *UNUSED(prop), int *free)
905 EnumPropertyItem *item = NULL;
906 EnumPropertyItem tmp = {0, "", 0, "", ""};
907 QuicktimeCodecTypeDesc *codecTypeDesc;
908 int i = 1, totitem = 0;
911 for (i = 0; i < quicktime_get_num_videocodecs(); i++) {
912 codecTypeDesc = quicktime_get_videocodecType_desc(i);
913 if (!codecTypeDesc) break;
915 tmp.value = codecTypeDesc->rnatmpvalue;
916 *((int *)id) = codecTypeDesc->codecType;
919 tmp.name = codecTypeDesc->codecName;
920 RNA_enum_item_add(&item, &totitem, &tmp);
923 RNA_enum_item_end(&item, &totitem);
930 static int rna_RenderSettings_qtcodecsettings_audiocodecType_get(PointerRNA *ptr)
932 QuicktimeCodecSettings *settings = (QuicktimeCodecSettings *)ptr->data;
934 return quicktime_rnatmpvalue_from_audiocodectype(settings->audiocodecType);
937 static void rna_RenderSettings_qtcodecsettings_audiocodecType_set(PointerRNA *ptr, int value)
939 QuicktimeCodecSettings *settings = (QuicktimeCodecSettings *)ptr->data;
941 settings->audiocodecType = quicktime_audiocodecType_from_rnatmpvalue(value);
944 static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_audiocodecType_itemf(bContext *C, PointerRNA *ptr,
945 PropertyRNA *UNUSED(prop), int *free)
947 EnumPropertyItem *item = NULL;
948 EnumPropertyItem tmp = {0, "", 0, "", ""};
949 QuicktimeCodecTypeDesc *codecTypeDesc;
950 int i = 1, totitem = 0;
952 for (i = 0; i < quicktime_get_num_audiocodecs(); i++) {
953 codecTypeDesc = quicktime_get_audiocodecType_desc(i);
954 if (!codecTypeDesc) break;
956 tmp.value = codecTypeDesc->rnatmpvalue;
957 tmp.identifier = codecTypeDesc->codecName;
958 tmp.name = codecTypeDesc->codecName;
959 RNA_enum_item_add(&item, &totitem, &tmp);
962 RNA_enum_item_end(&item, &totitem);
971 static void rna_FFmpegSettings_lossless_output_set(PointerRNA *ptr, int value)
973 Scene *scene = (Scene *) ptr->id.data;
974 RenderData *rd = &scene->r;
977 rd->ffcodecdata.flags |= FFMPEG_LOSSLESS_OUTPUT;
979 rd->ffcodecdata.flags &= ~FFMPEG_LOSSLESS_OUTPUT;
981 BKE_ffmpeg_codec_settings_verify(rd);
984 static void rna_FFmpegSettings_codec_settings_update(Main *UNUSED(bmain), Scene *UNUSED(scene_unused), PointerRNA *ptr)
986 Scene *scene = (Scene *) ptr->id.data;
987 RenderData *rd = &scene->r;
989 BKE_ffmpeg_codec_settings_verify(rd);
993 static int rna_RenderSettings_active_layer_index_get(PointerRNA *ptr)
995 RenderData *rd = (RenderData *)ptr->data;
999 static void rna_RenderSettings_active_layer_index_set(PointerRNA *ptr, int value)
1001 RenderData *rd = (RenderData *)ptr->data;
1005 static void rna_RenderSettings_active_layer_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
1007 RenderData *rd = (RenderData *)ptr->data;
1010 *max = max_ii(0, BLI_countlist(&rd->layers) - 1);
1013 static PointerRNA rna_RenderSettings_active_layer_get(PointerRNA *ptr)
1015 RenderData *rd = (RenderData *)ptr->data;
1016 SceneRenderLayer *srl = BLI_findlink(&rd->layers, rd->actlay);
1018 return rna_pointer_inherit_refine(ptr, &RNA_SceneRenderLayer, srl);
1021 static void rna_RenderSettings_active_layer_set(PointerRNA *ptr, PointerRNA value)
1023 RenderData *rd = (RenderData *)ptr->data;
1024 SceneRenderLayer *srl = (SceneRenderLayer *)value.data;
1025 const int index = BLI_findindex(&rd->layers, srl);
1026 if (index != -1) rd->actlay = index;
1029 static SceneRenderLayer *rna_RenderLayer_new(ID *id, RenderData *UNUSED(rd), const char *name)
1031 Scene *scene = (Scene *)id;
1032 SceneRenderLayer *srl = BKE_scene_add_render_layer(scene, name);
1034 WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
1039 static void rna_RenderLayer_remove(ID *id, RenderData *UNUSED(rd), Main *bmain, ReportList *reports,
1040 PointerRNA *srl_ptr)
1042 SceneRenderLayer *srl = srl_ptr->data;
1043 Scene *scene = (Scene *)id;
1045 if (!BKE_scene_remove_render_layer(bmain, scene, srl)) {
1046 BKE_reportf(reports, RPT_ERROR, "Render layer '%s' could not be removed from scene '%s'",
1047 srl->name, scene->id.name + 2);
1051 RNA_POINTER_INVALIDATE(srl_ptr);
1053 WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
1056 static void rna_RenderSettings_engine_set(PointerRNA *ptr, int value)
1058 RenderData *rd = (RenderData *)ptr->data;
1059 RenderEngineType *type = BLI_findlink(&R_engines, value);
1062 BLI_strncpy_utf8(rd->engine, type->idname, sizeof(rd->engine));
1065 static EnumPropertyItem *rna_RenderSettings_engine_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr),
1066 PropertyRNA *UNUSED(prop), int *free)
1068 RenderEngineType *type;
1069 EnumPropertyItem *item = NULL;
1070 EnumPropertyItem tmp = {0, "", 0, "", ""};
1071 int a = 0, totitem = 0;
1073 for (type = R_engines.first; type; type = type->next, a++) {
1075 tmp.identifier = type->idname;
1076 tmp.name = type->name;
1077 RNA_enum_item_add(&item, &totitem, &tmp);
1080 RNA_enum_item_end(&item, &totitem);
1086 static int rna_RenderSettings_engine_get(PointerRNA *ptr)
1088 RenderData *rd = (RenderData *)ptr->data;
1089 RenderEngineType *type;
1092 for (type = R_engines.first; type; type = type->next, a++)
1093 if (strcmp(type->idname, rd->engine) == 0)
1099 static void rna_RenderSettings_engine_update(Main *bmain, Scene *UNUSED(unused), PointerRNA *UNUSED(ptr))
1101 ED_render_engine_changed(bmain);
1104 static void rna_Scene_glsl_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1106 Scene *scene = (Scene *)ptr->id.data;
1108 DAG_id_tag_update(&scene->id, 0);
1111 static void rna_SceneRenderLayer_name_set(PointerRNA *ptr, const char *value)
1113 Scene *scene = (Scene *)ptr->id.data;
1114 SceneRenderLayer *rl = (SceneRenderLayer *)ptr->data;
1115 BLI_strncpy_utf8(rl->name, value, sizeof(rl->name));
1116 BLI_uniquename(&scene->r.layers, rl, "RenderLayer", '.', offsetof(SceneRenderLayer, name), sizeof(rl->name));
1118 if (scene->nodetree) {
1120 int index = BLI_findindex(&scene->r.layers, rl);
1122 for (node = scene->nodetree->nodes.first; node; node = node->next) {
1123 if (node->type == CMP_NODE_R_LAYERS && node->id == NULL) {
1124 if (node->custom1 == index)
1125 BLI_strncpy(node->name, rl->name, NODE_MAXSTR);
1131 static char *rna_SceneRenderLayer_path(PointerRNA *ptr)
1133 SceneRenderLayer *srl = (SceneRenderLayer*)ptr->data;
1134 return BLI_sprintfN("render.layers[\"%s\"]", srl->name);
1137 static int rna_RenderSettings_multiple_engines_get(PointerRNA *UNUSED(ptr))
1139 return (BLI_countlist(&R_engines) > 1);
1142 static int rna_RenderSettings_use_shading_nodes_get(PointerRNA *ptr)
1144 Scene *scene = (Scene *)ptr->id.data;
1145 return BKE_scene_use_new_shading_nodes(scene);
1148 static int rna_RenderSettings_use_game_engine_get(PointerRNA *ptr)
1150 RenderData *rd = (RenderData *)ptr->data;
1151 RenderEngineType *type;
1153 for (type = R_engines.first; type; type = type->next)
1154 if (strcmp(type->idname, rd->engine) == 0)
1155 return (type->flag & RE_GAME);
1160 static void rna_SceneRenderLayer_layer_set(PointerRNA *ptr, const int *values)
1162 SceneRenderLayer *rl = (SceneRenderLayer *)ptr->data;
1163 rl->lay = ED_view3d_scene_layer_set(rl->lay, values, NULL);
1166 static void rna_SceneRenderLayer_pass_update(Main *bmain, Scene *activescene, PointerRNA *ptr)
1168 Scene *scene = (Scene *)ptr->id.data;
1170 if (scene->nodetree)
1171 ntreeCompositForceHidden(scene->nodetree, scene);
1173 rna_Scene_glsl_update(bmain, activescene, ptr);
1176 static void rna_Scene_use_nodes_set(PointerRNA *ptr, int value)
1178 Scene *scene = (Scene *)ptr->data;
1180 scene->use_nodes = value;
1181 if (scene->use_nodes && scene->nodetree == NULL)
1182 ED_node_composit_default(scene);
1185 static void rna_Physics_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1187 Scene *scene = (Scene *)ptr->id.data;
1190 for (base = scene->base.first; base; base = base->next)
1191 BKE_ptcache_object_reset(scene, base->object, PTCACHE_RESET_DEPSGRAPH);
1194 static void rna_Scene_editmesh_select_mode_set(PointerRNA *ptr, const int *value)
1196 Scene *scene = (Scene *)ptr->id.data;
1197 ToolSettings *ts = (ToolSettings *)ptr->data;
1198 int flag = (value[0] ? SCE_SELECT_VERTEX : 0) | (value[1] ? SCE_SELECT_EDGE : 0) | (value[2] ? SCE_SELECT_FACE : 0);
1201 ts->selectmode = flag;
1203 if (scene->basact) {
1204 Mesh *me = BKE_mesh_from_object(scene->basact->object);
1205 if (me && me->edit_btmesh && me->edit_btmesh->selectmode != flag) {
1206 me->edit_btmesh->selectmode = flag;
1207 EDBM_selectmode_set(me->edit_btmesh);
1213 static void rna_Scene_editmesh_select_mode_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
1217 if (scene->basact) {
1218 me = BKE_mesh_from_object(scene->basact->object);
1219 if (me && me->edit_btmesh == NULL)
1223 WM_main_add_notifier(NC_GEOM | ND_SELECT, me);
1224 WM_main_add_notifier(NC_SCENE | ND_TOOLSETTINGS, NULL);
1227 static void object_simplify_update(Object *ob)
1230 ParticleSystem *psys;
1232 for (md = ob->modifiers.first; md; md = md->next) {
1233 if (ELEM3(md->type, eModifierType_Subsurf, eModifierType_Multires, eModifierType_ParticleSystem)) {
1234 ob->recalc |= PSYS_RECALC_CHILD;
1235 DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
1239 for (psys = ob->particlesystem.first; psys; psys = psys->next)
1240 psys->recalc |= PSYS_RECALC_CHILD;
1242 if (ob->dup_group) {
1245 for (gob = ob->dup_group->gobject.first; gob; gob = gob->next)
1246 object_simplify_update(gob->ob);
1250 static void rna_Scene_use_simplify_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
1252 Scene *sce = ptr->id.data;
1256 for (SETLOOPER(sce, sce_iter, base))
1257 object_simplify_update(base->object);
1259 DAG_ids_flush_update(bmain, 0);
1260 WM_main_add_notifier(NC_GEOM | ND_DATA, NULL);
1263 static void rna_Scene_simplify_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
1265 Scene *sce = ptr->id.data;
1267 if (sce->r.mode & R_SIMPLIFY)
1268 rna_Scene_use_simplify_update(bmain, sce, ptr);
1271 static void rna_Scene_use_persistent_data_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
1273 Scene *sce = ptr->id.data;
1275 if (!(sce->r.mode & R_PERSISTENT_DATA))
1276 RE_FreePersistentData();
1279 static int rna_Scene_use_audio_get(PointerRNA *ptr)
1281 Scene *scene = (Scene *)ptr->data;
1282 return scene->audio.flag & AUDIO_MUTE;
1285 static void rna_Scene_use_audio_set(PointerRNA *ptr, int value)
1287 Scene *scene = (Scene *)ptr->data;
1290 scene->audio.flag |= AUDIO_MUTE;
1292 scene->audio.flag &= ~AUDIO_MUTE;
1294 sound_mute_scene(scene, value);
1297 static int rna_Scene_sync_mode_get(PointerRNA *ptr)
1299 Scene *scene = (Scene *)ptr->data;
1300 if (scene->audio.flag & AUDIO_SYNC)
1302 return scene->flag & SCE_FRAME_DROP;
1305 static void rna_Scene_sync_mode_set(PointerRNA *ptr, int value)
1307 Scene *scene = (Scene *)ptr->data;
1309 if (value == AUDIO_SYNC) {
1310 scene->audio.flag |= AUDIO_SYNC;
1312 else if (value == SCE_FRAME_DROP) {
1313 scene->audio.flag &= ~AUDIO_SYNC;
1314 scene->flag |= SCE_FRAME_DROP;
1317 scene->audio.flag &= ~AUDIO_SYNC;
1318 scene->flag &= ~SCE_FRAME_DROP;
1322 static int rna_GameSettings_auto_start_get(PointerRNA *UNUSED(ptr))
1324 if (G.fileflags & G_FILE_AUTOPLAY)
1330 static void rna_GameSettings_auto_start_set(PointerRNA *UNUSED(ptr), int value)
1333 G.fileflags |= G_FILE_AUTOPLAY;
1335 G.fileflags &= ~G_FILE_AUTOPLAY;
1338 static void rna_GameSettings_exit_key_set(PointerRNA *ptr, int value)
1340 GameData *gm = (GameData *)ptr->data;
1342 if (ISKEYBOARD(value))
1343 gm->exitkey = value;
1346 static TimeMarker *rna_TimeLine_add(Scene *scene, const char name[])
1348 TimeMarker *marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker");
1349 marker->flag = SELECT;
1351 BLI_strncpy_utf8(marker->name, name, sizeof(marker->name));
1352 BLI_addtail(&scene->markers, marker);
1354 WM_main_add_notifier(NC_SCENE | ND_MARKERS, NULL);
1355 WM_main_add_notifier(NC_ANIMATION | ND_MARKERS, NULL);
1360 static void rna_TimeLine_remove(Scene *scene, ReportList *reports, PointerRNA *marker_ptr)
1362 TimeMarker *marker = marker_ptr->data;
1363 if (BLI_remlink_safe(&scene->markers, marker) == FALSE) {
1364 BKE_reportf(reports, RPT_ERROR, "Timeline marker '%s' not found in scene '%s'", marker->name, scene->id.name + 2);
1369 RNA_POINTER_INVALIDATE(marker_ptr);
1371 WM_main_add_notifier(NC_SCENE | ND_MARKERS, NULL);
1372 WM_main_add_notifier(NC_ANIMATION | ND_MARKERS, NULL);
1375 static void rna_TimeLine_clear(Scene *scene)
1377 BLI_freelistN(&scene->markers);
1379 WM_main_add_notifier(NC_SCENE | ND_MARKERS, NULL);
1380 WM_main_add_notifier(NC_ANIMATION | ND_MARKERS, NULL);
1383 static KeyingSet *rna_Scene_keying_set_new(Scene *sce, ReportList *reports, const char idname[], const char name[])
1385 KeyingSet *ks = NULL;
1387 /* call the API func, and set the active keyingset index */
1388 ks = BKE_keyingset_add(&sce->keyingsets, idname, name, KEYINGSET_ABSOLUTE, 0);
1391 sce->active_keyingset = BLI_countlist(&sce->keyingsets);
1395 BKE_report(reports, RPT_ERROR, "Keying set could not be added");
1400 static void rna_UnifiedPaintSettings_size_set(PointerRNA *ptr, int value)
1402 UnifiedPaintSettings *ups = ptr->data;
1404 /* scale unprojected radius so it stays consistent with brush size */
1405 BKE_brush_scale_unprojected_radius(&ups->unprojected_radius,
1410 static void rna_UnifiedPaintSettings_unprojected_radius_set(PointerRNA *ptr, float value)
1412 UnifiedPaintSettings *ups = ptr->data;
1414 /* scale brush size so it stays consistent with unprojected_radius */
1415 BKE_brush_scale_size(&ups->size, value, ups->unprojected_radius);
1416 ups->unprojected_radius = value;
1419 /* note: without this, when Multi-Paint is activated/deactivated, the colors
1420 * will not change right away when multiple bones are selected, this function
1421 * is not for general use and only for the few cases where changing scene
1422 * settings and NOT for general purpose updates, possibly this should be
1423 * given its own notifier. */
1424 static void rna_Scene_update_active_object_data(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
1428 DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
1429 WM_main_add_notifier(NC_OBJECT | ND_DRAW, &ob->id);
1433 static void rna_SceneCamera_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1435 Scene *scene = (Scene *)ptr->id.data;
1436 Object *camera = scene->camera;
1439 DAG_id_tag_update(&camera->id, 0);
1442 static void rna_SceneSequencer_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
1444 BKE_sequencer_cache_cleanup();
1445 BKE_sequencer_preprocessed_cache_cleanup();
1450 static void rna_def_transform_orientation(BlenderRNA *brna)
1455 const int matrix_dimsize[] = {3, 3};
1457 srna = RNA_def_struct(brna, "TransformOrientation", NULL);
1459 prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
1460 RNA_def_property_float_sdna(prop, NULL, "mat");
1461 RNA_def_property_multi_array(prop, 2, matrix_dimsize);
1462 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
1464 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1465 RNA_def_struct_name_property(srna, prop);
1466 RNA_def_property_ui_text(prop, "Name", "Name of the custom transform orientation");
1467 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
1470 static void rna_def_tool_settings(BlenderRNA *brna)
1475 static EnumPropertyItem uv_select_mode_items[] = {
1476 {UV_SELECT_VERTEX, "VERTEX", ICON_UV_VERTEXSEL, "Vertex", "Vertex selection mode"},
1477 {UV_SELECT_EDGE, "EDGE", ICON_UV_EDGESEL, "Edge", "Edge selection mode"},
1478 {UV_SELECT_FACE, "FACE", ICON_UV_FACESEL, "Face", "Face selection mode"},
1479 {UV_SELECT_ISLAND, "ISLAND", ICON_UV_ISLANDSEL, "Island", "Island selection mode"},
1480 {0, NULL, 0, NULL, NULL}
1483 /* the construction of this enum is quite special - everything is stored as bitflags,
1484 * with 1st position only for for on/off (and exposed as boolean), while others are mutually
1485 * exclusive options but which will only have any effect when autokey is enabled
1487 static EnumPropertyItem auto_key_items[] = {
1488 {AUTOKEY_MODE_NORMAL & ~AUTOKEY_ON, "ADD_REPLACE_KEYS", 0, "Add & Replace", ""},
1489 {AUTOKEY_MODE_EDITKEYS & ~AUTOKEY_ON, "REPLACE_KEYS", 0, "Replace", ""},
1490 {0, NULL, 0, NULL, NULL}
1493 static EnumPropertyItem retarget_roll_items[] = {
1494 {SK_RETARGET_ROLL_NONE, "NONE", 0, "None", "Don't adjust roll"},
1495 {SK_RETARGET_ROLL_VIEW, "VIEW", 0, "View", "Roll bones to face the view"},
1496 {SK_RETARGET_ROLL_JOINT, "JOINT", 0, "Joint", "Roll bone to original joint plane offset"},
1497 {0, NULL, 0, NULL, NULL}
1500 static EnumPropertyItem sketch_convert_items[] = {
1501 {SK_CONVERT_CUT_FIXED, "FIXED", 0, "Fixed", "Subdivide stroke in fixed number of bones"},
1502 {SK_CONVERT_CUT_LENGTH, "LENGTH", 0, "Length", "Subdivide stroke in bones of specific length"},
1503 {SK_CONVERT_CUT_ADAPTATIVE, "ADAPTIVE", 0, "Adaptive",
1504 "Subdivide stroke adaptively, with more subdivision in curvier parts"},
1505 {SK_CONVERT_RETARGET, "RETARGET", 0, "Retarget", "Retarget template bone chain to stroke"},
1506 {0, NULL, 0, NULL, NULL}
1509 static EnumPropertyItem edge_tag_items[] = {
1510 {EDGE_MODE_SELECT, "SELECT", 0, "Select", ""},
1511 {EDGE_MODE_TAG_SEAM, "SEAM", 0, "Tag Seam", ""},
1512 {EDGE_MODE_TAG_SHARP, "SHARP", 0, "Tag Sharp", ""},
1513 {EDGE_MODE_TAG_CREASE, "CREASE", 0, "Tag Crease", ""},
1514 {EDGE_MODE_TAG_BEVEL, "BEVEL", 0, "Tag Bevel", ""},
1515 {0, NULL, 0, NULL, NULL}
1518 srna = RNA_def_struct(brna, "ToolSettings", NULL);
1519 RNA_def_struct_ui_text(srna, "Tool Settings", "");
1521 prop = RNA_def_property(srna, "sculpt", PROP_POINTER, PROP_NONE);
1522 RNA_def_property_struct_type(prop, "Sculpt");
1523 RNA_def_property_ui_text(prop, "Sculpt", "");
1525 prop = RNA_def_property(srna, "use_auto_normalize", PROP_BOOLEAN, PROP_NONE);
1526 RNA_def_property_boolean_sdna(prop, NULL, "auto_normalize", 1);
1527 RNA_def_property_ui_text(prop, "WPaint Auto-Normalize",
1528 "Ensure all bone-deforming vertex groups add up "
1529 "to 1.0 while weight painting");
1530 RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data");
1532 prop = RNA_def_property(srna, "use_multipaint", PROP_BOOLEAN, PROP_NONE);
1533 RNA_def_property_boolean_sdna(prop, NULL, "multipaint", 1);
1534 RNA_def_property_ui_text(prop, "WPaint Multi-Paint",
1535 "Paint across all selected bones while "
1537 RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data");
1539 prop = RNA_def_property(srna, "vertex_paint", PROP_POINTER, PROP_NONE);
1540 RNA_def_property_pointer_sdna(prop, NULL, "vpaint");
1541 RNA_def_property_ui_text(prop, "Vertex Paint", "");
1543 prop = RNA_def_property(srna, "weight_paint", PROP_POINTER, PROP_NONE);
1544 RNA_def_property_pointer_sdna(prop, NULL, "wpaint");
1545 RNA_def_property_ui_text(prop, "Weight Paint", "");
1547 prop = RNA_def_property(srna, "image_paint", PROP_POINTER, PROP_NONE);
1548 RNA_def_property_pointer_sdna(prop, NULL, "imapaint");
1549 RNA_def_property_ui_text(prop, "Image Paint", "");
1551 prop = RNA_def_property(srna, "uv_sculpt", PROP_POINTER, PROP_NONE);
1552 RNA_def_property_pointer_sdna(prop, NULL, "uvsculpt");
1553 RNA_def_property_ui_text(prop, "UV Sculpt", "");
1555 prop = RNA_def_property(srna, "particle_edit", PROP_POINTER, PROP_NONE);
1556 RNA_def_property_pointer_sdna(prop, NULL, "particle");
1557 RNA_def_property_ui_text(prop, "Particle Edit", "");
1559 prop = RNA_def_property(srna, "use_uv_sculpt", PROP_BOOLEAN, PROP_NONE);
1560 RNA_def_property_boolean_sdna(prop, NULL, "use_uv_sculpt", 1);
1561 RNA_def_property_ui_text(prop, "UV Sculpt", "Enable brush for UV sculpting");
1562 RNA_def_property_ui_icon(prop, ICON_TPAINT_HLT, 0);
1563 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, "rna_SpaceImageEditor_uv_sculpt_update");
1565 prop = RNA_def_property(srna, "uv_sculpt_lock_borders", PROP_BOOLEAN, PROP_NONE);
1566 RNA_def_property_boolean_sdna(prop, NULL, "uv_sculpt_settings", UV_SCULPT_LOCK_BORDERS);
1567 RNA_def_property_ui_text(prop, "Lock Borders", "Disable editing of boundary edges");
1569 prop = RNA_def_property(srna, "uv_sculpt_all_islands", PROP_BOOLEAN, PROP_NONE);
1570 RNA_def_property_boolean_sdna(prop, NULL, "uv_sculpt_settings", UV_SCULPT_ALL_ISLANDS);
1571 RNA_def_property_ui_text(prop, "Sculpt All Islands", "Brush operates on all islands");
1573 prop = RNA_def_property(srna, "uv_sculpt_tool", PROP_ENUM, PROP_NONE);
1574 RNA_def_property_enum_sdna(prop, NULL, "uv_sculpt_tool");
1575 RNA_def_property_enum_items(prop, uv_sculpt_tool_items);
1576 RNA_def_property_ui_text(prop, "UV Sculpt Tools", "Select Tools for the UV sculpt brushes");
1578 prop = RNA_def_property(srna, "uv_relax_method", PROP_ENUM, PROP_NONE);
1579 RNA_def_property_enum_sdna(prop, NULL, "uv_relax_method");
1580 RNA_def_property_enum_items(prop, uv_sculpt_relaxation_items);
1581 RNA_def_property_ui_text(prop, "Relaxation Method", "Algorithm used for UV relaxation");
1584 prop = RNA_def_property(srna, "proportional_edit", PROP_ENUM, PROP_NONE);
1585 RNA_def_property_enum_sdna(prop, NULL, "proportional");
1586 RNA_def_property_enum_items(prop, proportional_editing_items);
1587 RNA_def_property_ui_text(prop, "Proportional Editing",
1588 "Proportional Editing mode, allows transforms with distance fall-off");
1589 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1591 prop = RNA_def_property(srna, "use_proportional_edit_objects", PROP_BOOLEAN, PROP_NONE);
1592 RNA_def_property_boolean_sdna(prop, NULL, "proportional_objects", 0);
1593 RNA_def_property_ui_text(prop, "Proportional Editing Objects", "Proportional editing object mode");
1594 RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1);
1595 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1597 prop = RNA_def_property(srna, "use_proportional_edit_mask", PROP_BOOLEAN, PROP_NONE);
1598 RNA_def_property_boolean_sdna(prop, NULL, "proportional_mask", 0);
1599 RNA_def_property_ui_text(prop, "Proportional Editing Objects", "Proportional editing mask mode");
1600 RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1);
1601 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1603 prop = RNA_def_property(srna, "proportional_edit_falloff", PROP_ENUM, PROP_NONE);
1604 RNA_def_property_enum_sdna(prop, NULL, "prop_mode");
1605 RNA_def_property_enum_items(prop, proportional_falloff_items);
1606 RNA_def_property_ui_text(prop, "Proportional Editing Falloff", "Falloff type for proportional editing mode");
1607 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1609 prop = RNA_def_property(srna, "proportional_size", PROP_FLOAT, PROP_DISTANCE);
1610 RNA_def_property_float_sdna(prop, NULL, "proportional_size");
1611 RNA_def_property_ui_text(prop, "Proportional Size", "Display size for proportional editing circle");
1612 RNA_def_property_range(prop, 0.00001, 5000.0);
1614 prop = RNA_def_property(srna, "normal_size", PROP_FLOAT, PROP_DISTANCE);
1615 RNA_def_property_float_sdna(prop, NULL, "normalsize");
1616 RNA_def_property_ui_text(prop, "Normal Size", "Display size for normals in the 3D view");
1617 RNA_def_property_range(prop, 0.00001, 1000.0);
1618 RNA_def_property_ui_range(prop, 0.01, 10.0, 10.0, 2);
1619 RNA_def_property_update(prop, NC_GEOM | ND_DATA, NULL);
1621 prop = RNA_def_property(srna, "double_threshold", PROP_FLOAT, PROP_DISTANCE);
1622 RNA_def_property_float_sdna(prop, NULL, "doublimit");
1623 RNA_def_property_ui_text(prop, "Double Threshold", "Limit for removing duplicates and 'Auto Merge'");
1624 RNA_def_property_range(prop, 0.0, 1.0);
1625 RNA_def_property_ui_range(prop, 0.0, 0.1, 0.01, 6);
1627 prop = RNA_def_property(srna, "use_mesh_automerge", PROP_BOOLEAN, PROP_NONE);
1628 RNA_def_property_boolean_sdna(prop, NULL, "automerge", 0);
1629 RNA_def_property_ui_text(prop, "AutoMerge Editing", "Automatically merge vertices moved to the same location");
1631 prop = RNA_def_property(srna, "use_snap", PROP_BOOLEAN, PROP_NONE);
1632 RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP);
1633 RNA_def_property_ui_text(prop, "Snap", "Snap during transform");
1634 RNA_def_property_ui_icon(prop, ICON_SNAP_OFF, 1);
1635 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1637 prop = RNA_def_property(srna, "use_snap_align_rotation", PROP_BOOLEAN, PROP_NONE);
1638 RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_ROTATE);
1639 RNA_def_property_ui_text(prop, "Snap Align Rotation", "Align rotation with the snapping target");
1640 RNA_def_property_ui_icon(prop, ICON_SNAP_NORMAL, 0);
1641 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1643 prop = RNA_def_property(srna, "snap_element", PROP_ENUM, PROP_NONE);
1644 RNA_def_property_enum_sdna(prop, NULL, "snap_mode");
1645 RNA_def_property_enum_items(prop, snap_element_items);
1646 RNA_def_property_ui_text(prop, "Snap Element", "Type of element to snap to");
1647 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1649 /* node editor uses own set of snap modes */
1650 prop = RNA_def_property(srna, "snap_node_element", PROP_ENUM, PROP_NONE);
1651 RNA_def_property_enum_sdna(prop, NULL, "snap_node_mode");
1652 RNA_def_property_enum_items(prop, snap_node_element_items);
1653 RNA_def_property_ui_text(prop, "Snap Node Element", "Type of element to snap to");
1654 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1656 /* image editor uses own set of snap modes */
1657 prop = RNA_def_property(srna, "snap_uv_element", PROP_ENUM, PROP_NONE);
1658 RNA_def_property_enum_sdna(prop, NULL, "snap_uv_mode");
1659 RNA_def_property_enum_items(prop, snap_uv_element_items);
1660 RNA_def_property_ui_text(prop, "Snap UV Element", "Type of element to snap to");
1661 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1663 prop = RNA_def_property(srna, "snap_target", PROP_ENUM, PROP_NONE);
1664 RNA_def_property_enum_sdna(prop, NULL, "snap_target");
1665 RNA_def_property_enum_items(prop, snap_target_items);
1666 RNA_def_property_ui_text(prop, "Snap Target", "Which part to snap onto the target");
1667 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1669 prop = RNA_def_property(srna, "use_snap_peel_object", PROP_BOOLEAN, PROP_NONE);
1670 RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_PEEL_OBJECT);
1671 RNA_def_property_ui_text(prop, "Snap Peel Object", "Consider objects as whole when finding volume center");
1672 RNA_def_property_ui_icon(prop, ICON_SNAP_PEEL_OBJECT, 0);
1673 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1675 prop = RNA_def_property(srna, "use_snap_project", PROP_BOOLEAN, PROP_NONE);
1676 RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_PROJECT);
1677 RNA_def_property_ui_text(prop, "Project Individual Elements",
1678 "Project individual elements on the surface of other objects");
1679 RNA_def_property_ui_icon(prop, ICON_RETOPO, 0);
1680 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1682 prop = RNA_def_property(srna, "use_snap_self", PROP_BOOLEAN, PROP_NONE);
1683 RNA_def_property_boolean_negative_sdna(prop, NULL, "snap_flag", SCE_SNAP_NO_SELF);
1684 RNA_def_property_ui_text(prop, "Project to Self", "Snap onto itself (editmode)");
1685 RNA_def_property_ui_icon(prop, ICON_ORTHO, 0);
1686 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1689 prop = RNA_def_property(srna, "use_grease_pencil_sessions", PROP_BOOLEAN, PROP_NONE);
1690 RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_PAINTSESSIONS_ON);
1691 RNA_def_property_ui_text(prop, "Use Sketching Sessions",
1692 "Allow drawing multiple strokes at a time with Grease Pencil");
1693 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* xxx: need toolbar to be redrawn... */
1696 prop = RNA_def_property(srna, "use_keyframe_insert_auto", PROP_BOOLEAN, PROP_NONE);
1697 RNA_def_property_boolean_sdna(prop, NULL, "autokey_mode", AUTOKEY_ON);
1698 RNA_def_property_ui_text(prop, "Auto Keying", "Automatic keyframe insertion for Objects and Bones");
1699 RNA_def_property_ui_icon(prop, ICON_REC, 0);
1701 prop = RNA_def_property(srna, "auto_keying_mode", PROP_ENUM, PROP_NONE);
1702 RNA_def_property_enum_bitflag_sdna(prop, NULL, "autokey_mode");
1703 RNA_def_property_enum_items(prop, auto_key_items);
1704 RNA_def_property_ui_text(prop, "Auto-Keying Mode", "Mode of automatic keyframe insertion for Objects and Bones");
1706 prop = RNA_def_property(srna, "use_record_with_nla", PROP_BOOLEAN, PROP_NONE);
1707 RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", ANIMRECORD_FLAG_WITHNLA);
1708 RNA_def_property_ui_text(prop, "Layered",
1709 "Add a new NLA Track + Strip for every loop/pass made over the animation "
1710 "to allow non-destructive tweaking");
1712 prop = RNA_def_property(srna, "use_keyframe_insert_keyingset", PROP_BOOLEAN, PROP_NONE);
1713 RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_ONLYKEYINGSET);
1714 RNA_def_property_ui_text(prop, "Auto Keyframe Insert Keying Set",
1715 "Automatic keyframe insertion using active Keying Set only");
1716 RNA_def_property_ui_icon(prop, ICON_KEYINGSET, 0);
1719 prop = RNA_def_property(srna, "uv_select_mode", PROP_ENUM, PROP_NONE);
1720 RNA_def_property_enum_sdna(prop, NULL, "uv_selectmode");
1721 RNA_def_property_enum_items(prop, uv_select_mode_items);
1722 RNA_def_property_ui_text(prop, "UV Selection Mode", "UV selection and display mode");
1723 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
1725 prop = RNA_def_property(srna, "use_uv_select_sync", PROP_BOOLEAN, PROP_NONE);
1726 RNA_def_property_boolean_sdna(prop, NULL, "uv_flag", UV_SYNC_SELECTION);
1727 RNA_def_property_ui_text(prop, "UV Sync Selection", "Keep UV and edit mode mesh selection in sync");
1728 RNA_def_property_ui_icon(prop, ICON_EDIT, 0);
1729 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
1731 prop = RNA_def_property(srna, "show_uv_local_view", PROP_BOOLEAN, PROP_NONE);
1732 RNA_def_property_boolean_sdna(prop, NULL, "uv_flag", UV_SHOW_SAME_IMAGE);
1733 RNA_def_property_ui_text(prop, "UV Local View", "Draw only faces with the currently displayed image assigned");
1734 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
1737 prop = RNA_def_property(srna, "mesh_select_mode", PROP_BOOLEAN, PROP_NONE);
1738 RNA_def_property_boolean_sdna(prop, NULL, "selectmode", 1);
1739 RNA_def_property_array(prop, 3);
1740 RNA_def_property_boolean_funcs(prop, NULL, "rna_Scene_editmesh_select_mode_set");
1741 RNA_def_property_ui_text(prop, "Mesh Selection Mode", "Which mesh elements selection works on");
1742 RNA_def_property_update(prop, 0, "rna_Scene_editmesh_select_mode_update");
1744 prop = RNA_def_property(srna, "vertex_group_weight", PROP_FLOAT, PROP_FACTOR);
1745 RNA_def_property_float_sdna(prop, NULL, "vgroup_weight");
1746 RNA_def_property_ui_text(prop, "Vertex Group Weight", "Weight to assign in vertex groups");
1748 /* use with MESH_OT_select_shortest_path */
1749 prop = RNA_def_property(srna, "edge_path_mode", PROP_ENUM, PROP_NONE);
1750 RNA_def_property_enum_sdna(prop, NULL, "edge_mode");
1751 RNA_def_property_enum_items(prop, edge_tag_items);
1752 RNA_def_property_ui_text(prop, "Edge Tag Mode", "The edge flag to tag when selecting the shortest path");
1754 prop = RNA_def_property(srna, "edge_path_live_unwrap", PROP_BOOLEAN, PROP_NONE);
1755 RNA_def_property_boolean_sdna(prop, NULL, "edge_mode_live_unwrap", 1);
1756 RNA_def_property_ui_text(prop, "Live Unwrap", "Changing edges seam re-calculates UV unwrap");
1759 prop = RNA_def_property(srna, "use_bone_sketching", PROP_BOOLEAN, PROP_NONE);
1760 RNA_def_property_boolean_sdna(prop, NULL, "bone_sketching", BONE_SKETCHING);
1761 RNA_def_property_ui_text(prop, "Use Bone Sketching", "DOC BROKEN");
1762 /* RNA_def_property_ui_icon(prop, ICON_EDIT, 0); */
1764 prop = RNA_def_property(srna, "use_etch_quick", PROP_BOOLEAN, PROP_NONE);
1765 RNA_def_property_boolean_sdna(prop, NULL, "bone_sketching", BONE_SKETCHING_QUICK);
1766 RNA_def_property_ui_text(prop, "Quick Sketching", "DOC BROKEN");
1768 prop = RNA_def_property(srna, "use_etch_overdraw", PROP_BOOLEAN, PROP_NONE);
1769 RNA_def_property_boolean_sdna(prop, NULL, "bone_sketching", BONE_SKETCHING_ADJUST);
1770 RNA_def_property_ui_text(prop, "Overdraw Sketching", "DOC BROKEN");
1772 prop = RNA_def_property(srna, "use_etch_autoname", PROP_BOOLEAN, PROP_NONE);
1773 RNA_def_property_boolean_sdna(prop, NULL, "skgen_retarget_options", SK_RETARGET_AUTONAME);
1774 RNA_def_property_ui_text(prop, "Autoname", "DOC BROKEN");
1776 prop = RNA_def_property(srna, "etch_number", PROP_STRING, PROP_NONE);
1777 RNA_def_property_string_sdna(prop, NULL, "skgen_num_string");
1778 RNA_def_property_ui_text(prop, "Number", "DOC BROKEN");
1780 prop = RNA_def_property(srna, "etch_side", PROP_STRING, PROP_NONE);
1781 RNA_def_property_string_sdna(prop, NULL, "skgen_num_string");
1782 RNA_def_property_ui_text(prop, "Side", "DOC BROKEN");
1784 prop = RNA_def_property(srna, "etch_template", PROP_POINTER, PROP_NONE);
1785 RNA_def_property_pointer_sdna(prop, NULL, "skgen_template");
1786 RNA_def_property_flag(prop, PROP_EDITABLE);
1787 RNA_def_property_struct_type(prop, "Object");
1788 RNA_def_property_pointer_funcs(prop, NULL, "rna_Scene_skgen_etch_template_set", NULL, NULL);
1789 RNA_def_property_ui_text(prop, "Template", "Template armature that will be retargeted to the stroke");
1791 prop = RNA_def_property(srna, "etch_subdivision_number", PROP_INT, PROP_NONE);
1792 RNA_def_property_int_sdna(prop, NULL, "skgen_subdivision_number");
1793 RNA_def_property_range(prop, 1, 255);
1794 RNA_def_property_ui_text(prop, "Subdivisions", "Number of bones in the subdivided stroke");
1795 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
1797 prop = RNA_def_property(srna, "etch_adaptive_limit", PROP_FLOAT, PROP_FACTOR);
1798 RNA_def_property_float_sdna(prop, NULL, "skgen_correlation_limit");
1799 RNA_def_property_range(prop, 0.00001, 1.0);
1800 RNA_def_property_ui_range(prop, 0.01, 1.0, 0.01, 2);
1801 RNA_def_property_ui_text(prop, "Limit", "Number of bones in the subdivided stroke");
1802 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
1804 prop = RNA_def_property(srna, "etch_length_limit", PROP_FLOAT, PROP_DISTANCE);
1805 RNA_def_property_float_sdna(prop, NULL, "skgen_length_limit");
1806 RNA_def_property_range(prop, 0.00001, 100000.0);
1807 RNA_def_property_ui_range(prop, 0.001, 100.0, 0.1, 3);
1808 RNA_def_property_ui_text(prop, "Length", "Number of bones in the subdivided stroke");
1809 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
1811 prop = RNA_def_property(srna, "etch_roll_mode", PROP_ENUM, PROP_NONE);
1812 RNA_def_property_enum_bitflag_sdna(prop, NULL, "skgen_retarget_roll");
1813 RNA_def_property_enum_items(prop, retarget_roll_items);
1814 RNA_def_property_ui_text(prop, "Retarget roll mode", "Method used to adjust the roll of bones when retargeting");
1816 prop = RNA_def_property(srna, "etch_convert_mode", PROP_ENUM, PROP_NONE);
1817 RNA_def_property_enum_bitflag_sdna(prop, NULL, "bone_sketching_convert");
1818 RNA_def_property_enum_items(prop, sketch_convert_items);
1819 RNA_def_property_ui_text(prop, "Stroke conversion method", "Method used to convert stroke to bones");
1820 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
1822 /* Unified Paint Settings */
1823 prop = RNA_def_property(srna, "unified_paint_settings", PROP_POINTER, PROP_NONE);
1824 RNA_def_property_flag(prop, PROP_NEVER_NULL);
1825 RNA_def_property_struct_type(prop, "UnifiedPaintSettings");
1826 RNA_def_property_ui_text(prop, "Unified Paint Settings", NULL);
1829 static void rna_def_unified_paint_settings(BlenderRNA *brna)
1834 srna = RNA_def_struct(brna, "UnifiedPaintSettings", NULL);
1835 RNA_def_struct_ui_text(srna, "Unified Paint Settings", "Overrides for some of the active brush's settings");
1837 /* high-level flags to enable or disable unified paint settings */
1838 prop = RNA_def_property(srna, "use_unified_size", PROP_BOOLEAN, PROP_NONE);
1839 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_SIZE);
1840 RNA_def_property_ui_text(prop, "Use Unified Radius",
1841 "Instead of per-brush radius, the radius is shared across brushes");
1843 prop = RNA_def_property(srna, "use_unified_strength", PROP_BOOLEAN, PROP_NONE);
1844 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_ALPHA);
1845 RNA_def_property_ui_text(prop, "Use Unified Strength",
1846 "Instead of per-brush strength, the strength is shared across brushes");
1848 prop = RNA_def_property(srna, "use_unified_weight", PROP_BOOLEAN, PROP_NONE);
1849 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_WEIGHT);
1850 RNA_def_property_ui_text(prop, "Use Unified Weight",
1851 "Instead of per-brush weight, the weight is shared across brushes");
1853 /* unified paint settings that override the equivalent settings
1854 * from the active brush */
1855 prop = RNA_def_property(srna, "size", PROP_INT, PROP_DISTANCE);
1856 RNA_def_property_int_funcs(prop, NULL, "rna_UnifiedPaintSettings_size_set", NULL);
1857 RNA_def_property_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS * 10);
1858 RNA_def_property_ui_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS, 1, 0);
1859 RNA_def_property_ui_text(prop, "Radius", "Radius of the brush in pixels");
1861 prop = RNA_def_property(srna, "unprojected_radius", PROP_FLOAT, PROP_DISTANCE);
1862 RNA_def_property_float_funcs(prop, NULL, "rna_UnifiedPaintSettings_unprojected_radius_set", NULL);
1863 RNA_def_property_range(prop, 0.001, FLT_MAX);
1864 RNA_def_property_ui_range(prop, 0.001, 1, 0, 0);
1865 RNA_def_property_ui_text(prop, "Unprojected Radius", "Radius of brush in Blender units");
1867 prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
1868 RNA_def_property_float_sdna(prop, NULL, "alpha");
1869 RNA_def_property_float_default(prop, 0.5f);
1870 RNA_def_property_range(prop, 0.0f, 10.0f);
1871 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
1872 RNA_def_property_ui_text(prop, "Strength", "How powerful the effect of the brush is when applied");
1874 prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_FACTOR);
1875 RNA_def_property_float_sdna(prop, NULL, "weight");
1876 RNA_def_property_float_default(prop, 0.5f);
1877 RNA_def_property_range(prop, 0.0f, 1.0f);
1878 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
1879 RNA_def_property_ui_text(prop, "Weight", "Weight to assign in vertex groups");
1881 prop = RNA_def_property(srna, "use_pressure_size", PROP_BOOLEAN, PROP_NONE);
1882 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_BRUSH_SIZE_PRESSURE);
1883 RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
1884 RNA_def_property_ui_text(prop, "Size Pressure", "Enable tablet pressure sensitivity for size");
1886 prop = RNA_def_property(srna, "use_pressure_strength", PROP_BOOLEAN, PROP_NONE);
1887 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_BRUSH_ALPHA_PRESSURE);
1888 RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
1889 RNA_def_property_ui_text(prop, "Strength Pressure", "Enable tablet pressure sensitivity for strength");
1891 prop = RNA_def_property(srna, "use_locked_size", PROP_BOOLEAN, PROP_NONE);
1892 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_BRUSH_LOCK_SIZE);
1893 RNA_def_property_ui_text(prop, "Use Blender Units",
1894 "When locked brush stays same size relative to object; "
1895 "when unlocked brush size is given in pixels");
1898 static void rna_def_unit_settings(BlenderRNA *brna)
1903 static EnumPropertyItem unit_systems[] = {
1904 {USER_UNIT_NONE, "NONE", 0, "None", ""},
1905 {USER_UNIT_METRIC, "METRIC", 0, "Metric", ""},
1906 {USER_UNIT_IMPERIAL, "IMPERIAL", 0, "Imperial", ""},
1907 {0, NULL, 0, NULL, NULL}
1910 static EnumPropertyItem rotation_units[] = {
1911 {0, "DEGREES", 0, "Degrees", "Use degrees for measuring angles and rotations"},
1912 {USER_UNIT_ROT_RADIANS, "RADIANS", 0, "Radians", ""},
1913 {0, NULL, 0, NULL, NULL}
1916 srna = RNA_def_struct(brna, "UnitSettings", NULL);
1917 RNA_def_struct_ui_text(srna, "Unit Settings", "");
1920 prop = RNA_def_property(srna, "system", PROP_ENUM, PROP_NONE);
1921 RNA_def_property_enum_items(prop, unit_systems);
1922 RNA_def_property_ui_text(prop, "Unit System", "The unit system to use for button display");
1923 RNA_def_property_update(prop, NC_WINDOW, NULL);
1925 prop = RNA_def_property(srna, "system_rotation", PROP_ENUM, PROP_NONE);
1926 RNA_def_property_enum_items(prop, rotation_units);
1927 RNA_def_property_ui_text(prop, "Rotation Units", "Unit to use for displaying/editing rotation values");
1928 RNA_def_property_update(prop, NC_WINDOW, NULL);
1930 prop = RNA_def_property(srna, "scale_length", PROP_FLOAT, PROP_UNSIGNED);
1931 RNA_def_property_ui_text(prop, "Unit Scale", "Scale to use when converting between blender units and dimensions");
1932 RNA_def_property_range(prop, 0.00001, 100000.0);
1933 RNA_def_property_ui_range(prop, 0.001, 100.0, 0.1, 3);
1934 RNA_def_property_update(prop, NC_WINDOW, NULL);
1936 prop = RNA_def_property(srna, "use_separate", PROP_BOOLEAN, PROP_NONE);
1937 RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_UNIT_OPT_SPLIT);
1938 RNA_def_property_ui_text(prop, "Separate Units", "Display units in pairs (e.g. 1m 0cm)");
1939 RNA_def_property_update(prop, NC_WINDOW, NULL);
1942 void rna_def_render_layer_common(StructRNA *srna, int scene)
1946 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1947 if (scene) RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SceneRenderLayer_name_set");
1948 else RNA_def_property_string_sdna(prop, NULL, "name");
1949 RNA_def_property_ui_text(prop, "Name", "Render layer name");
1950 RNA_def_struct_name_property(srna, prop);
1951 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
1952 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1954 prop = RNA_def_property(srna, "material_override", PROP_POINTER, PROP_NONE);
1955 RNA_def_property_pointer_sdna(prop, NULL, "mat_override");
1956 RNA_def_property_struct_type(prop, "Material");
1957 RNA_def_property_flag(prop, PROP_EDITABLE);
1958 RNA_def_property_ui_text(prop, "Material Override",
1959 "Material to override all other materials in this render layer");
1960 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
1961 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1963 prop = RNA_def_property(srna, "light_override", PROP_POINTER, PROP_NONE);
1964 RNA_def_property_pointer_sdna(prop, NULL, "light_override");
1965 RNA_def_property_struct_type(prop, "Group");
1966 RNA_def_property_flag(prop, PROP_EDITABLE);
1967 RNA_def_property_ui_text(prop, "Light Override", "Group to override all other lights in this render layer");
1968 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
1969 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1972 prop = RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
1973 RNA_def_property_boolean_sdna(prop, NULL, "lay", 1);
1974 RNA_def_property_array(prop, 20);
1975 RNA_def_property_ui_text(prop, "Visible Layers", "Scene layers included in this render layer");
1976 if (scene) RNA_def_property_boolean_funcs(prop, NULL, "rna_SceneRenderLayer_layer_set");
1977 else RNA_def_property_boolean_funcs(prop, NULL, "rna_RenderLayer_layer_set");
1978 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
1979 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1981 prop = RNA_def_property(srna, "layers_zmask", PROP_BOOLEAN, PROP_LAYER);
1982 RNA_def_property_boolean_sdna(prop, NULL, "lay_zmask", 1);
1983 RNA_def_property_array(prop, 20);
1984 RNA_def_property_ui_text(prop, "Zmask Layers", "Zmask scene layers for solid faces");
1985 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
1986 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1988 prop = RNA_def_property(srna, "layers_exclude", PROP_BOOLEAN, PROP_LAYER);
1989 RNA_def_property_boolean_sdna(prop, NULL, "lay_exclude", 1);
1990 RNA_def_property_array(prop, 20);
1991 RNA_def_property_ui_text(prop, "Exclude Layers", "Exclude scene layers from having any influence");
1992 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
1993 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1996 prop = RNA_def_property(srna, "samples", PROP_INT, PROP_UNSIGNED);
1997 RNA_def_property_ui_text(prop, "Samples", "Override number of render samples for this render layer, 0 will use the scene setting");
1998 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2002 prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
2003 RNA_def_property_boolean_negative_sdna(prop, NULL, "layflag", SCE_LAY_DISABLE);
2004 RNA_def_property_ui_text(prop, "Enabled", "Disable or enable the render layer");
2005 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
2006 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2008 prop = RNA_def_property(srna, "use_zmask", PROP_BOOLEAN, PROP_NONE);
2009 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ZMASK);
2010 RNA_def_property_ui_text(prop, "Zmask", "Only render what's in front of the solid z values");
2011 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
2012 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2014 prop = RNA_def_property(srna, "invert_zmask", PROP_BOOLEAN, PROP_NONE);
2015 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_NEG_ZMASK);
2016 RNA_def_property_ui_text(prop, "Zmask Negate",
2017 "For Zmask, only render what is behind solid z values instead of in front");
2018 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
2019 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2021 prop = RNA_def_property(srna, "use_all_z", PROP_BOOLEAN, PROP_NONE);
2022 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ALL_Z);
2023 RNA_def_property_ui_text(prop, "All Z", "Fill in Z values for solid faces in invisible layers, for masking");
2024 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2025 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2027 prop = RNA_def_property(srna, "use_solid", PROP_BOOLEAN, PROP_NONE);
2028 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_SOLID);
2029 RNA_def_property_ui_text(prop, "Solid", "Render Solid faces in this Layer");
2030 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2031 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2033 prop = RNA_def_property(srna, "use_halo", PROP_BOOLEAN, PROP_NONE);
2034 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_HALO);
2035 RNA_def_property_ui_text(prop, "Halo", "Render Halos in this Layer (on top of Solid)");
2036 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2037 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2039 prop = RNA_def_property(srna, "use_ztransp", PROP_BOOLEAN, PROP_NONE);
2040 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ZTRA);
2041 RNA_def_property_ui_text(prop, "ZTransp", "Render Z-Transparent faces in this Layer (on top of Solid and Halos)");
2042 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2043 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2045 prop = RNA_def_property(srna, "use_sky", PROP_BOOLEAN, PROP_NONE);
2046 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_SKY);
2047 RNA_def_property_ui_text(prop, "Sky", "Render Sky in this Layer");
2048 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
2049 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2051 prop = RNA_def_property(srna, "use_edge_enhance", PROP_BOOLEAN, PROP_NONE);
2052 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_EDGE);
2053 RNA_def_property_ui_text(prop, "Edge", "Render Edge-enhance in this Layer (only works for Solid faces)");
2054 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2055 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2057 prop = RNA_def_property(srna, "use_strand", PROP_BOOLEAN, PROP_NONE);
2058 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_STRAND);
2059 RNA_def_property_ui_text(prop, "Strand", "Render Strands in this Layer");
2060 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2061 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2064 prop = RNA_def_property(srna, "use_pass_combined", PROP_BOOLEAN, PROP_NONE);
2065 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_COMBINED);
2066 RNA_def_property_ui_text(prop, "Combined", "Deliver full combined RGBA buffer");
2067 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2068 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2070 prop = RNA_def_property(srna, "use_pass_z", PROP_BOOLEAN, PROP_NONE);
2071 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_Z);
2072 RNA_def_property_ui_text(prop, "Z", "Deliver Z values pass");
2073 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2074 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2076 prop = RNA_def_property(srna, "use_pass_vector", PROP_BOOLEAN, PROP_NONE);
2077 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_VECTOR);
2078 RNA_def_property_ui_text(prop, "Vector", "Deliver speed vector pass");
2079 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2080 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2082 prop = RNA_def_property(srna, "use_pass_normal", PROP_BOOLEAN, PROP_NONE);
2083 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_NORMAL);
2084 RNA_def_property_ui_text(prop, "Normal", "Deliver normal pass");
2085 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2086 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2088 prop = RNA_def_property(srna, "use_pass_uv", PROP_BOOLEAN, PROP_NONE);
2089 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_UV);
2090 RNA_def_property_ui_text(prop, "UV", "Deliver texture UV pass");
2091 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2092 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2094 prop = RNA_def_property(srna, "use_pass_mist", PROP_BOOLEAN, PROP_NONE);
2095 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_MIST);
2096 RNA_def_property_ui_text(prop, "Mist", "Deliver mist factor pass (0.0-1.0)");
2097 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2098 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2100 prop = RNA_def_property(srna, "use_pass_object_index", PROP_BOOLEAN, PROP_NONE);
2101 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_INDEXOB);
2102 RNA_def_property_ui_text(prop, "Object Index", "Deliver object index pass");
2103 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2104 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2106 prop = RNA_def_property(srna, "use_pass_material_index", PROP_BOOLEAN, PROP_NONE);
2107 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_INDEXMA);
2108 RNA_def_property_ui_text(prop, "Material Index", "Deliver material index pass");
2109 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2110 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2112 prop = RNA_def_property(srna, "use_pass_color", PROP_BOOLEAN, PROP_NONE);
2113 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_RGBA);
2114 RNA_def_property_ui_text(prop, "Color", "Deliver shade-less color pass");
2115 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2116 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2118 prop = RNA_def_property(srna, "use_pass_diffuse", PROP_BOOLEAN, PROP_NONE);
2119 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE);
2120 RNA_def_property_ui_text(prop, "Diffuse", "Deliver diffuse pass");
2121 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2122 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2124 prop = RNA_def_property(srna, "use_pass_specular", PROP_BOOLEAN, PROP_NONE);
2125 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SPEC);
2126 RNA_def_property_ui_text(prop, "Specular", "Deliver specular pass");
2127 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2128 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2130 prop = RNA_def_property(srna, "use_pass_shadow", PROP_BOOLEAN, PROP_NONE);
2131 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SHADOW);
2132 RNA_def_property_ui_text(prop, "Shadow", "Deliver shadow pass");
2133 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2134 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2136 prop = RNA_def_property(srna, "use_pass_ambient_occlusion", PROP_BOOLEAN, PROP_NONE);
2137 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_AO);
2138 RNA_def_property_ui_text(prop, "AO", "Deliver AO pass");
2139 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2140 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2142 prop = RNA_def_property(srna, "use_pass_reflection", PROP_BOOLEAN, PROP_NONE);
2143 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_REFLECT);
2144 RNA_def_property_ui_text(prop, "Reflection", "Deliver raytraced reflection pass");
2145 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2146 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2148 prop = RNA_def_property(srna, "use_pass_refraction", PROP_BOOLEAN, PROP_NONE);
2149 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_REFRACT);
2150 RNA_def_property_ui_text(prop, "Refraction", "Deliver raytraced refraction pass");
2151 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2152 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2154 prop = RNA_def_property(srna, "use_pass_emit", PROP_BOOLEAN, PROP_NONE);
2155 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_EMIT);
2156 RNA_def_property_ui_text(prop, "Emit", "Deliver emission pass");
2157 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2158 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2160 prop = RNA_def_property(srna, "use_pass_environment", PROP_BOOLEAN, PROP_NONE);
2161 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_ENVIRONMENT);
2162 RNA_def_property_ui_text(prop, "Environment", "Deliver environment lighting pass");
2163 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2164 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2166 prop = RNA_def_property(srna, "use_pass_indirect", PROP_BOOLEAN, PROP_NONE);
2167 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_INDIRECT);
2168 RNA_def_property_ui_text(prop, "Indirect", "Deliver indirect lighting pass");
2169 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2170 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2172 prop = RNA_def_property(srna, "exclude_specular", PROP_BOOLEAN, PROP_NONE);
2173 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_SPEC);
2174 RNA_def_property_ui_text(prop, "Specular Exclude", "Exclude specular pass from combined");
2175 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2176 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2177 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2179 prop = RNA_def_property(srna, "exclude_shadow", PROP_BOOLEAN, PROP_NONE);
2180 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_SHADOW);
2181 RNA_def_property_ui_text(prop, "Shadow Exclude", "Exclude shadow pass from combined");
2182 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2183 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2184 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2186 prop = RNA_def_property(srna, "exclude_ambient_occlusion", PROP_BOOLEAN, PROP_NONE);
2187 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_AO);
2188 RNA_def_property_ui_text(prop, "AO Exclude", "Exclude AO pass from combined");
2189 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2190 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2191 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2193 prop = RNA_def_property(srna, "exclude_reflection", PROP_BOOLEAN, PROP_NONE);
2194 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_REFLECT);
2195 RNA_def_property_ui_text(prop, "Reflection Exclude", "Exclude raytraced reflection pass from combined");
2196 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2197 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2198 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2200 prop = RNA_def_property(srna, "exclude_refraction", PROP_BOOLEAN, PROP_NONE);
2201 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_REFRACT);
2202 RNA_def_property_ui_text(prop, "Refraction Exclude", "Exclude raytraced refraction pass from combined");
2203 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2204 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2205 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2207 prop = RNA_def_property(srna, "exclude_emit", PROP_BOOLEAN, PROP_NONE);
2208 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_EMIT);
2209 RNA_def_property_ui_text(prop, "Emit Exclude", "Exclude emission pass from combined");
2210 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2211 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2212 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2214 prop = RNA_def_property(srna, "exclude_environment", PROP_BOOLEAN, PROP_NONE);
2215 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_ENVIRONMENT);
2216 RNA_def_property_ui_text(prop, "Environment Exclude", "Exclude environment pass from combined");
2217 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2218 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2219 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2221 prop = RNA_def_property(srna, "exclude_indirect", PROP_BOOLEAN, PROP_NONE);
2222 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_INDIRECT);
2223 RNA_def_property_ui_text(prop, "Indirect Exclude", "Exclude indirect pass from combined");
2224 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2225 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2226 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2228 prop = RNA_def_property(srna, "use_pass_diffuse_direct", PROP_BOOLEAN, PROP_NONE);
2229 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE_DIRECT);
2230 RNA_def_property_ui_text(prop, "Diffuse Direct", "Deliver diffuse direct pass");
2231 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2232 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2234 prop = RNA_def_property(srna, "use_pass_diffuse_indirect", PROP_BOOLEAN, PROP_NONE);
2235 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE_INDIRECT);
2236 RNA_def_property_ui_text(prop, "Diffuse Indirect", "Deliver diffuse indirect pass");
2237 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2238 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2240 prop = RNA_def_property(srna, "use_pass_diffuse_color", PROP_BOOLEAN, PROP_NONE);
2241 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE_COLOR);
2242 RNA_def_property_ui_text(prop, "Diffuse Color", "Deliver diffuse color pass");
2243 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2244 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2246 prop = RNA_def_property(srna, "use_pass_glossy_direct", PROP_BOOLEAN, PROP_NONE);
2247 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_GLOSSY_DIRECT);
2248 RNA_def_property_ui_text(prop, "Glossy Direct", "Deliver glossy direct pass");
2249 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2250 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2252 prop = RNA_def_property(srna, "use_pass_glossy_indirect", PROP_BOOLEAN, PROP_NONE);
2253 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_GLOSSY_INDIRECT);
2254 RNA_def_property_ui_text(prop, "Glossy Indirect", "Deliver glossy indirect pass");
2255 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2256 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2258 prop = RNA_def_property(srna, "use_pass_glossy_color", PROP_BOOLEAN, PROP_NONE);
2259 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_GLOSSY_COLOR);
2260 RNA_def_property_ui_text(prop, "Glossy Color", "Deliver glossy color pass");
2261 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2262 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2264 prop = RNA_def_property(srna, "use_pass_transmission_direct", PROP_BOOLEAN, PROP_NONE);
2265 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_TRANSM_DIRECT);
2266 RNA_def_property_ui_text(prop, "Transmission Direct", "Deliver transmission direct pass");
2267 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2268 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2270 prop = RNA_def_property(srna, "use_pass_transmission_indirect", PROP_BOOLEAN, PROP_NONE);
2271 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_TRANSM_INDIRECT);
2272 RNA_def_property_ui_text(prop, "Transmission Indirect", "Deliver transmission indirect pass");
2273 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2274 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2276 prop = RNA_def_property(srna, "use_pass_transmission_color", PROP_BOOLEAN, PROP_NONE);
2277 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_TRANSM_COLOR);
2278 RNA_def_property_ui_text(prop, "Transmission Color", "Deliver transmission color pass");
2279 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2280 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2283 static void rna_def_scene_game_recast_data(BlenderRNA *brna)
2288 srna = RNA_def_struct(brna, "SceneGameRecastData", NULL);
2289 RNA_def_struct_sdna(srna, "RecastData");
2290 RNA_def_struct_nested(brna, srna, "Scene");
2291 RNA_def_struct_ui_text(srna, "Recast Data", "Recast data for a Game datablock");
2293 prop = RNA_def_property(srna, "cell_size", PROP_FLOAT, PROP_NONE);
2294 RNA_def_property_float_sdna(prop, NULL, "cellsize");
2295 RNA_def_property_ui_range(prop, 0.1, 1, 1, 2);
2296 RNA_def_property_ui_text(prop, "Cell Size", "Rasterized cell size");
2297 RNA_def_property_update(prop, NC_SCENE, NULL);
2299 prop = RNA_def_property(srna, "cell_height", PROP_FLOAT, PROP_NONE);
2300 RNA_def_property_float_sdna(prop, NULL, "cellheight");
2301 RNA_def_property_ui_range(prop, 0.1, 1, 1, 2);
2302 RNA_def_property_ui_text(prop, "Cell Height", "Rasterized cell height");
2303 RNA_def_property_update(prop, NC_SCENE, NULL);
2305 prop = RNA_def_property(srna, "agent_height", PROP_FLOAT, PROP_NONE);
2306 RNA_def_property_float_sdna(prop, NULL, "agentheight");
2307 RNA_def_property_ui_range(prop, 0.1, 5, 1, 2);
2308 RNA_def_property_ui_text(prop, "Agent Height", "Minimum height where the agent can still walk");
2309 RNA_def_property_update(prop, NC_SCENE, NULL);
2311 prop = RNA_def_property(srna, "agent_radius", PROP_FLOAT, PROP_NONE);
2312 RNA_def_property_float_sdna(prop, NULL, "agentradius");
2313 RNA_def_property_ui_range(prop, 0.1, 5, 1, 2);
2314 RNA_def_property_ui_text(prop, "Agent Radius", "Radius of the agent");
2315 RNA_def_property_update(prop, NC_SCENE, NULL);
2317 prop = RNA_def_property(srna, "climb_max", PROP_FLOAT, PROP_NONE);
2318 RNA_def_property_float_sdna(prop, NULL, "agentmaxclimb");
2319 RNA_def_property_ui_range(prop, 0.1, 5, 1, 2);
2320 RNA_def_property_ui_text(prop, "Max Climb", "Maximum height between grid cells the agent can climb");
2321 RNA_def_property_update(prop, NC_SCENE, NULL);
2323 prop = RNA_def_property(srna, "slope_max", PROP_FLOAT, PROP_ANGLE);
2324 RNA_def_property_float_sdna(prop, NULL, "agentmaxslope");
2325 RNA_def_property_range(prop, 0, M_PI / 2);
2326 RNA_def_property_ui_text(prop, "Max Slope", "Maximum walkable slope angle in degrees");
2327 RNA_def_property_update(prop, NC_SCENE, NULL);
2330 prop = RNA_def_property(srna, "region_min_size", PROP_FLOAT, PROP_NONE);
2331 RNA_def_property_float_sdna(prop, NULL, "regionminsize");
2332 RNA_def_property_ui_range(prop, 0, 150, 1, 2);
2333 RNA_def_property_ui_text(prop, "Min Region Size", "Minimum regions size (smaller regions will be deleted)");
2334 RNA_def_property_update(prop, NC_SCENE, NULL);
2336 prop = RNA_def_property(srna, "region_merge_size", PROP_FLOAT, PROP_NONE);
2337 RNA_def_property_float_sdna(prop, NULL, "regionmergesize");
2338 RNA_def_property_ui_range(prop, 0, 150, 1, 2);
2339 RNA_def_property_ui_text(prop, "Merged Region Size", "Minimum regions size (smaller regions will be merged)");
2340 RNA_def_property_update(prop, NC_SCENE, NULL);
2342 prop = RNA_def_property(srna, "edge_max_len", PROP_FLOAT, PROP_NONE);
2343 RNA_def_property_float_sdna(prop, NULL, "edgemaxlen");
2344 RNA_def_property_ui_range(prop, 0, 50, 1, 2);
2345 RNA_def_property_ui_text(prop, "Max Edge Length", "Maximum contour edge length");
2346 RNA_def_property_update(prop, NC_SCENE, NULL);
2348 prop = RNA_def_property(srna, "edge_max_error", PROP_FLOAT, PROP_NONE);
2349 RNA_def_property_float_sdna(prop, NULL, "edgemaxerror");
2350 RNA_def_property_ui_range(prop, 0.1, 3.0, 1, 2);
2351 RNA_def_property_ui_text(prop, "Max Edge Error", "Maximum distance error from contour to cells");
2352 RNA_def_property_update(prop, NC_SCENE, NULL);
2354 prop = RNA_def_property(srna, "verts_per_poly", PROP_INT, PROP_NONE);
2355 RNA_def_property_int_sdna(prop, NULL, "vertsperpoly");
2356 RNA_def_property_ui_range(prop, 3, 12, 1, 0);
2357 RNA_def_property_ui_text(prop, "Verts Per Poly", "Max number of vertices per polygon");
2358 RNA_def_property_update(prop, NC_SCENE, NULL);
2360 prop = RNA_def_property(srna, "sample_dist", PROP_FLOAT, PROP_NONE);
2361 RNA_def_property_float_sdna(prop, NULL, "detailsampledist");
2362 RNA_def_property_ui_range(prop, 0.0, 16.0, 1, 2);
2363 RNA_def_property_ui_text(prop, "Sample Distance", "Detail mesh sample spacing");
2364 RNA_def_property_update(prop, NC_SCENE, NULL);
2366 prop = RNA_def_property(srna, "sample_max_error", PROP_FLOAT, PROP_NONE);
2367 RNA_def_property_float_sdna(prop, NULL, "detailsamplemaxerror");
2368 RNA_def_property_ui_range(prop, 0.0, 16.0, 1, 2);
2369 RNA_def_property_ui_text(prop, "Max Sample Error", "Detail mesh simplification max sample error");
2370 RNA_def_property_update(prop, NC_SCENE, NULL);
2373 static void rna_def_scene_game_data(BlenderRNA *brna)
2378 static EnumPropertyItem aasamples_items[] = {
2379 {0, "SAMPLES_0", 0, "Off", ""},
2380 {2, "SAMPLES_2", 0, "2x", ""},
2381 {4, "SAMPLES_4", 0, "4x", ""},
2382 {8, "SAMPLES_8", 0, "8x", ""},
2383 {16, "SAMPLES_16", 0, "16x", ""},
2384 {0, NULL, 0, NULL, NULL}
2387 static EnumPropertyItem framing_types_items[] = {
2388 {SCE_GAMEFRAMING_BARS, "LETTERBOX", 0, "Letterbox",
2389 "Show the entire viewport in the display window, using bar horizontally or vertically"},
2390 {SCE_GAMEFRAMING_EXTEND, "EXTEND", 0, "Extend",
2391 "Show the entire viewport in the display window, viewing more horizontally "
2393 {SCE_GAMEFRAMING_SCALE, "SCALE", 0, "Scale", "Stretch or squeeze the viewport to fill the display window"},
2394 {0, NULL, 0, NULL, NULL}
2397 static EnumPropertyItem dome_modes_items[] = {
2398 {DOME_FISHEYE, "FISHEYE", 0, "Fisheye", ""},
2399 {DOME_TRUNCATED_FRONT, "TRUNCATED_FRONT", 0, "Front-Truncated", ""},
2400 {DOME_TRUNCATED_REAR, "TRUNCATED_REAR", 0, "Rear-Truncated", ""},
2401 {DOME_ENVMAP, "ENVMAP", 0, "Cube Map", ""},
2402 {DOME_PANORAM_SPH, "PANORAM_SPH", 0, "Spherical Panoramic", ""},
2403 {0, NULL, 0, NULL, NULL}
2406 static EnumPropertyItem stereo_modes_items[] = {
2407 {STEREO_QUADBUFFERED, "QUADBUFFERED", 0, "Quad-Buffer", ""},
2408 {STEREO_ABOVEBELOW, "ABOVEBELOW", 0, "Above-Below", ""},
2409 {STEREO_INTERLACED, "INTERLACED", 0, "Interlaced", ""},
2410 {STEREO_ANAGLYPH, "ANAGLYPH", 0, "Anaglyph", ""},
2411 {STEREO_SIDEBYSIDE, "SIDEBYSIDE", 0, "Side-by-side", ""},
2412 {STEREO_VINTERLACE, "VINTERLACE", 0, "Vinterlace", ""},
2413 {0, NULL, 0, NULL, NULL}
2416 static EnumPropertyItem stereo_items[] = {
2417 {STEREO_NOSTEREO, "NONE", 0, "None", "Disable Stereo and Dome environments"},
2418 {STEREO_ENABLED, "STEREO", 0, "Stereo", "Enable Stereo environment"},
2419 {STEREO_DOME, "DOME", 0, "Dome", "Enable Dome environment"},
2420 {0, NULL, 0, NULL, NULL}
2423 static EnumPropertyItem physics_engine_items[] = {
2424 {WOPHY_NONE, "NONE", 0, "None", "Don't use a physics engine"},
2425 /*{WOPHY_ENJI, "ENJI", 0, "Enji", ""}, */
2426 /*{WOPHY_SUMO, "SUMO", 0, "Sumo (Deprecated)", ""}, */
2427 /*{WOPHY_DYNAMO, "DYNAMO", 0, "Dynamo", ""}, */
2428 /*{WOPHY_ODE, "ODE", 0, "ODE", ""}, */
2429 {WOPHY_BULLET, "BULLET", 0, "Bullet", "Use the Bullet physics engine"},
2430 {0, NULL, 0, NULL, NULL}
2433 static EnumPropertyItem material_items[] = {
2434 {GAME_MAT_TEXFACE, "SINGLETEXTURE", 0, "Singletexture", "Singletexture face materials"},
2435 {GAME_MAT_MULTITEX, "MULTITEXTURE", 0, "Multitexture", "Multitexture materials"},
2436 {GAME_MAT_GLSL, "GLSL", 0, "GLSL", "OpenGL shading language shaders"},
2437 {0, NULL, 0, NULL, NULL}
2440 static EnumPropertyItem obstacle_simulation_items[] = {
2441 {OBSTSIMULATION_NONE, "NONE", 0, "None", ""},
2442 {OBSTSIMULATION_TOI_rays, "RVO_RAYS", 0, "RVO (rays)", ""},
2443 {OBSTSIMULATION_TOI_cells, "RVO_CELLS", 0, "RVO (cells)", ""},
2444 {0, NULL, 0, NULL, NULL}
2447 srna = RNA_def_struct(brna, "SceneGameData", NULL);
2448 RNA_def_struct_sdna(srna, "GameData");
2449 RNA_def_struct_nested(brna, srna, "Scene");
2450 RNA_def_struct_ui_text(srna, "Game Data", "Game data for a Scene datablock");
2452 prop = RNA_def_property(srna, "resolution_x", PROP_INT, PROP_NONE);
2453 RNA_def_property_int_sdna(prop, NULL, "xplay");
2454 RNA_def_property_range(prop, 4, 10000);
2455 RNA_def_property_ui_text(prop, "Resolution X", "Number of horizontal pixels in the screen");
2456 RNA_def_property_update(prop, NC_SCENE, NULL);
2458 prop = RNA_def_property(srna, "resolution_y", PROP_INT, PROP_NONE);
2459 RNA_def_property_int_sdna(prop, NULL, "yplay");
2460 RNA_def_property_range(prop, 4, 10000);
2461 RNA_def_property_ui_text(prop, "Resolution Y", "Number of vertical pixels in the screen");
2462 RNA_def_property_update(prop, NC_SCENE, NULL);
2464 prop = RNA_def_property(srna, "samples", PROP_ENUM, PROP_NONE);
2465 RNA_def_property_enum_sdna(prop, NULL, "aasamples");
2466 RNA_def_property_enum_items(prop, aasamples_items);
2467 RNA_def_property_ui_text(prop, "AA Samples", "The number of AA Samples to use for MSAA");
2469 prop = RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED);
2470 RNA_def_property_int_sdna(prop, NULL, "depth");
2471 RNA_def_property_range(prop, 8, 32);
2472 RNA_def_property_ui_text(prop, "Bits", "Display bit depth of full screen display");
2473 RNA_def_property_update(prop, NC_SCENE, NULL);
2475 prop = RNA_def_property(srna, "exit_key", PROP_ENUM, PROP_NONE);
2476 RNA_def_property_enum_sdna(prop, NULL, "exitkey");
2477 RNA_def_property_enum_items(prop, event_type_items);
2478 RNA_def_property_enum_funcs(prop, NULL, "rna_GameSettings_exit_key_set", NULL);
2479 RNA_def_property_ui_text(prop, "Exit Key", "The key that exits the Game Engine");
2480 RNA_def_property_update(prop, NC_SCENE, NULL);
2482 /* Do we need it here ? (since we already have it in World */
2483 prop = RNA_def_property(srna, "frequency", PROP_INT, PROP_NONE);
2484 RNA_def_property_int_sdna(prop, NULL, "freqplay");
2485 RNA_def_property_range(prop, 4, 2000);
2486 RNA_def_property_ui_text(prop, "Freq", "Display clock frequency of fullscreen display");
2487 RNA_def_property_update(prop, NC_SCENE, NULL);
2489 prop = RNA_def_property(srna, "show_fullscreen", PROP_BOOLEAN, PROP_NONE);
2490 RNA_def_property_boolean_sdna(prop, NULL, "playerflag", GAME_PLAYER_FULLSCREEN);
2491 RNA_def_property_ui_text(prop, "Fullscreen", "Start player in a new fullscreen display");
2492 RNA_def_property_update(prop, NC_SCENE, NULL);
2494 prop = RNA_def_property(srna, "use_desktop", PROP_BOOLEAN, PROP_NONE);
2495 RNA_def_property_boolean_sdna(prop, NULL, "playerflag", GAME_PLAYER_DESKTOP_RESOLUTION);
2496 RNA_def_property_ui_text(prop, "Desktop", "Use the current desktop resolution in fullscreen mode");
2497 RNA_def_property_update(prop, NC_SCENE, NULL);
2500 prop = RNA_def_property(srna, "frame_type", PROP_ENUM, PROP_NONE);
2501 RNA_def_property_enum_sdna(prop, NULL, "framing.type");
2502 RNA_def_property_enum_items(prop, framing_types_items);
2503 RNA_def_property_ui_text(prop, "Framing Types", "Select the type of Framing you want");
2504 RNA_def_property_update(prop, NC_SCENE, NULL);
2506 prop = RNA_def_property(srna, "frame_color", PROP_FLOAT, PROP_COLOR);
2507 RNA_def_property_float_sdna(prop, NULL, "framing.col");
2508 RNA_def_property_range(prop, 0.0f, 1.0f);
2509 RNA_def_property_array(prop, 3);
2510 RNA_def_property_ui_text(prop, "Framing Color", "Set color of the bars");
2511 RNA_def_property_update(prop, NC_SCENE, NULL);
2514 prop = RNA_def_property(srna, "stereo", PROP_ENUM, PROP_NONE);
2515 RNA_def_property_enum_sdna(prop, NULL, "stereoflag");
2516 RNA_def_property_enum_items(prop, stereo_items);
2517 RNA_def_property_ui_text(prop, "Stereo Options", "");
2518 RNA_def_property_update(prop, NC_SCENE, NULL);
2520 prop = RNA_def_property(srna, "stereo_mode", PROP_ENUM, PROP_NONE);
2521 RNA_def_property_enum_sdna(prop, NULL, "stereomode");
2522 RNA_def_property_enum_items(prop, stereo_modes_items);
2523 RNA_def_property_ui_text(prop, "Stereo Mode", "Stereographic techniques");
2524 RNA_def_property_update(prop, NC_SCENE, NULL);
2526 prop = RNA_def_property(srna, "stereo_eye_separation", PROP_FLOAT, PROP_NONE);
2527 RNA_def_property_float_sdna(prop, NULL, "eyeseparation");
2528 RNA_def_property_range(prop, 0.01, 5.0);
2529 RNA_def_property_ui_text(prop, "Eye Separation",
2530 "Set the distance between the eyes - the camera focal length/30 should be fine");
2531 RNA_def_property_update(prop, NC_SCENE, NULL);
2534 prop = RNA_def_property(srna, "dome_mode", PROP_ENUM, PROP_NONE);
2535 RNA_def_property_enum_sdna(prop, NULL, "dome.mode");
2536 RNA_def_property_enum_items(prop, dome_modes_items);
2537 RNA_def_property_ui_text(prop, "Dome Mode", "Dome physical configurations");
2538 RNA_def_property_update(prop, NC_SCENE, NULL);
2540 prop = RNA_def_property(srna, "dome_tessellation", PROP_INT, PROP_NONE);
2541 RNA_def_property_int_sdna(prop, NULL, "dome.res");
2542 RNA_def_property_ui_range(prop, 1, 8, 1, 1);
2543 RNA_def_property_ui_text(prop, "Tessellation", "Tessellation level - check the generated mesh in wireframe mode");
2544 RNA_def_property_update(prop, NC_SCENE, NULL);
2546 prop = RNA_def_property(srna, "dome_buffer_resolution", PROP_FLOAT, PROP_NONE);
2547 RNA_def_property_float_sdna(prop, NULL, "dome.resbuf");
2548 RNA_def_property_ui_range(prop, 0.1, 1.0, 0.1, 2);
2549 RNA_def_property_ui_text(prop, "Buffer Resolution", "Buffer Resolution - decrease it to increase speed");
2550 RNA_def_property_update(prop, NC_SCENE, NULL);
2552 prop = RNA_def_property(srna, "dome_angle", PROP_INT, PROP_NONE);
2553 RNA_def_property_int_sdna(prop, NULL, "dome.angle");
2554 RNA_def_property_ui_range(prop, 90, 250, 1, 1);
2555 RNA_def_property_ui_text(prop, "Angle", "Field of View of the Dome - it only works in mode Fisheye and Truncated");
2556 RNA_def_property_update(prop, NC_SCENE, NULL);
2558 prop = RNA_def_property(srna, "dome_tilt", PROP_INT, PROP_NONE);
2559 RNA_def_property_int_sdna(prop, NULL, "dome.tilt");
2560 RNA_def_property_ui_range(prop, -180, 180, 1, 1);
2561 RNA_def_property_ui_text(prop, "Tilt", "Camera rotation in horizontal axis");
2562 RNA_def_property_update(prop, NC_SCENE, NULL);
2564 prop = RNA_def_property(srna, "dome_text", PROP_POINTER, PROP_NONE);
2565 RNA_def_property_pointer_sdna(prop, NULL, "dome.warptext");
2566 RNA_def_property_struct_type(prop, "Text");
2567 RNA_def_property_flag(prop, PROP_EDITABLE);
2568 RNA_def_property_ui_text(prop, "Warp Data", "Custom Warp Mesh data file");
2569 RNA_def_property_update(prop, NC_SCENE, NULL);
2572 prop = RNA_def_property(srna, "physics_engine", PROP_ENUM, PROP_NONE);
2573 RNA_def_property_enum_sdna(prop, NULL, "physicsEngine");
2574 RNA_def_property_enum_items(prop, physics_engine_items);
2575 RNA_def_property_ui_text(prop, "Physics Engine", "Physics engine used for physics simulation in the game engine");
2576 RNA_def_property_update(prop, NC_SCENE, NULL);
2578 prop = RNA_def_property(srna, "physics_gravity", PROP_FLOAT, PROP_ACCELERATION);
2579 RNA_def_property_float_sdna(prop, NULL, "gravity");
2580 RNA_def_property_ui_range(prop, 0.0, 25.0, 1, 2);
2581 RNA_def_property_range(prop, 0.0, 10000.0);
2582 RNA_def_property_ui_text(prop, "Physics Gravity",
2583 "Gravitational constant used for physics simulation in the game engine");
2584 RNA_def_property_update(prop, NC_SCENE, NULL);
2586 prop = RNA_def_property(srna, "occlusion_culling_resolution", PROP_INT, PROP_NONE);
2587 RNA_def_property_int_sdna(prop, NULL, "occlusionRes");
2588 RNA_def_property_range(prop, 128.0, 1024.0);
2589 RNA_def_property_ui_text(prop, "Occlusion Resolution",
2590 "Size of the occlusion buffer in pixel, use higher value for better precision (slower)");
2591 RNA_def_property_update(prop, NC_SCENE, NULL);
2593 prop = RNA_def_property(srna, "fps", PROP_INT, PROP_NONE);
2594 RNA_def_property_int_sdna(prop, NULL, "ticrate");
2595 RNA_def_property_ui_range(prop, 1, 60, 1, 1);
2596 RNA_def_property_range(prop, 1, 250);
2597 RNA_def_property_ui_text(prop, "Frames Per Second",
2598 "Nominal number of game frames per second "
2599 "(physics fixed timestep = 1/fps, independently of actual frame rate)");
2600 RNA_def_property_update(prop, NC_SCENE, NULL);
2602 prop = RNA_def_property(srna, "logic_step_max", PROP_INT, PROP_NONE);
2603 RNA_def_property_int_sdna(prop, NULL, "maxlogicstep");
2604 RNA_def_property_ui_range(prop, 1, 5, 1, 1);
2605 RNA_def_property_range(prop, 1, 5);
2606 RNA_def_property_ui_text(prop, "Max Logic Steps",
2607 "Maximum number of logic frame per game frame if graphics slows down the game, "
2608 "higher value allows better synchronization with physics");
2609 RNA_def_property_update(prop, NC_SCENE, NULL);
2611 prop = RNA_def_property(srna, "physics_step_max", PROP_INT, PROP_NONE);
2612 RNA_def_property_int_sdna(prop, NULL, "maxphystep");
2613 RNA_def_property_ui_range(prop, 1, 5, 1, 1);
2614 RNA_def_property_range(prop, 1, 5);
2615 RNA_def_property_ui_text(prop, "Max Physics Steps",
2616 "Maximum number of physics step per game frame if graphics slows down the game, "
2617 "higher value allows physics to keep up with realtime");
2618 RNA_def_property_update(prop, NC_SCENE, NULL);
2620 prop = RNA_def_property(srna, "physics_step_sub", PROP_INT, PROP_NONE);
2621 RNA_def_property_int_sdna(prop, NULL, "physubstep");
2622 RNA_def_property_range(prop, 1, 50);
2623 RNA_def_property_ui_range(prop, 1, 5, 1, 1);
2624 RNA_def_property_ui_text(prop, "Physics Sub Steps",
2625 "Number of simulation substep per physic timestep, "
2626 "higher value give better physics precision");
2627 RNA_def_property_update(prop, NC_SCENE, NULL);
2629 prop = RNA_def_property(srna, "deactivation_linear_threshold", PROP_FLOAT, PROP_NONE);
2630 RNA_def_property_float_sdna(prop, NULL, "lineardeactthreshold");
2631 RNA_def_property_ui_range(prop, 0.001, 10000.0, 2, 3);
2632 RNA_def_property_range(prop, 0.001, 10000.0);
2633 RNA_def_property_ui_text(prop, "Deactivation Linear Threshold",
2634 "Linear velocity that an object must be below before the deactivation timer can start");
2635 RNA_def_property_update(prop, NC_SCENE, NULL);
2637 prop = RNA_def_property(srna, "deactivation_angular_threshold", PROP_FLOAT, PROP_NONE);
2638 RNA_def_property_float_sdna(prop, NULL, "angulardeactthreshold");
2639 RNA_def_property_ui_range(prop, 0.001, 10000.0, 2, 3);
2640 RNA_def_property_range(prop, 0.001, 10000.0);
2641 RNA_def_property_ui_text(prop, "Deactivation Angular Threshold",
2642 "Angular velocity that an object must be below before the deactivation timer can start");
2643 RNA_def_property_update(prop, NC_SCENE, NULL);
2645 prop = RNA_def_property(srna, "deactivation_time", PROP_FLOAT, PROP_NONE);
2646 RNA_def_property_float_sdna(prop, NULL, "deactivationtime");
2647 RNA_def_property_ui_range(prop, 0.0, 60.0, 1, 1);
2648 RNA_def_property_range(prop, 0.0, 60.0);
2649 RNA_def_property_ui_text(prop, "Deactivation Time",
2650 "Amount of time (in seconds) after which objects with a velocity less than the given "
2651 "threshold will deactivate (0.0 means no deactivation)");
2652 RNA_def_property_update(prop, NC_SCENE, NULL);
2655 prop = RNA_def_property(srna, "use_occlusion_culling", PROP_BOOLEAN, PROP_NONE);
2656 RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_DBVT_CULLING);
2657 RNA_def_property_ui_text(prop, "DBVT culling",
2658 "Use optimized Bullet DBVT tree for view frustum and occlusion culling");
2660 /* not used *//* deprecated !!!!!!!!!!!!! */
2661 prop = RNA_def_property(srna, "use_activity_culling", PROP_BOOLEAN, PROP_NONE);
2662 RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_ACTIVITY_CULLING);
2663 RNA_def_property_ui_text(prop, "Activity Culling", "Activity culling is enabled");
2665 /* not used *//* deprecated !!!!!!!!!!!!! */
2666 prop = RNA_def_property(srna, "activity_culling_box_radius", PROP_FLOAT, PROP_NONE);
2667 RNA_def_property_float_sdna(prop, NULL, "activityBoxRadius");
2668 RNA_def_property_range(prop, 0.0, 1000.0);
2669 RNA_def_property_ui_text(prop, "Box Radius",
2670 "Radius of the activity bubble, in Manhattan length "
2671 "(objects outside the box are activity-culled)");
2674 prop = RNA_def_property(srna, "show_debug_properties", PROP_BOOLEAN, PROP_NONE);
2675 RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_DEBUG_PROPS);
2676 RNA_def_property_ui_text(prop, "Show Debug Properties",
2677 "Show properties marked for debugging while the game runs");
2679 prop = RNA_def_property(srna, "show_framerate_profile", PROP_BOOLEAN, PROP_NONE);
2680 RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_FRAMERATE);
2681 RNA_def_property_ui_text(prop, "Show Framerate and Profile",
2682 "Show framerate and profiling information while the game runs");
2684 prop = RNA_def_property(srna, "show_physics_visualization", PROP_BOOLEAN, PROP_NONE);
2685 RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_PHYSICS);
2686 RNA_def_property_ui_text(prop, "Show Physics Visualization",
2687 "Show a visualization of physics bounds and interactions");
2689 prop = RNA_def_property(srna, "show_mouse", PROP_BOOLEAN, PROP_NONE);
2690 RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_MOUSE);
2691 RNA_def_property_ui_text(prop, "Show Mouse", "Start player with a visible mouse cursor");
2693 prop = RNA_def_property(srna, "use_frame_rate", PROP_BOOLEAN, PROP_NONE);
2694 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_ENABLE_ALL_FRAMES);
2695 RNA_def_property_ui_text(prop, "Use Frame Rate",
2696 "Respect the frame rate rather than rendering as many frames as possible");
2698 prop = RNA_def_property(srna, "use_display_lists", PROP_BOOLEAN, PROP_NONE);
2699 RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_DISPLAY_LISTS);
2700 RNA_def_property_ui_text(prop, "Display Lists",
2701 "Use display lists to speed up rendering by keeping geometry on the GPU");
2703 prop = RNA_def_property(srna, "use_deprecation_warnings", PROP_BOOLEAN, PROP_NONE);
2704 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_IGNORE_DEPRECATION_WARNINGS);
2705 RNA_def_property_ui_text(prop, "Deprecation Warnings",
2706 "Print warnings when using deprecated features in the python API");
2708 prop = RNA_def_property(srna, "use_animation_record", PROP_BOOLEAN, PROP_NONE);
2709 RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_ENABLE_ANIMATION_RECORD);
2710 RNA_def_property_ui_text(prop, "Record Animation", "Record animation to F-Curves");
2712 prop = RNA_def_property(srna, "use_auto_start", PROP_BOOLEAN, PROP_NONE);
2713 RNA_def_property_boolean_funcs(prop, "rna_GameSettings_auto_start_get", "rna_GameSettings_auto_start_set");
2714 RNA_def_property_ui_text(prop, "Auto Start", "Automatically start game at load time");
2716 prop = RNA_def_property(srna, "restrict_animation_updates", PROP_BOOLEAN, PROP_NONE);
2717 RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_RESTRICT_ANIM_UPDATES);
2718 RNA_def_property_ui_text(prop, "Restrict Animation Updates",
2719 "Restrict the number of animation updates to the animation FPS (this is "
2720 "better for performance, but can cause issues with smooth playback)");
2723 prop = RNA_def_property(srna, "material_mode", PROP_ENUM, PROP_NONE);
2724 RNA_def_property_enum_sdna(prop, NULL, "matmode");
2725 RNA_def_property_enum_items(prop, material_items);
2726 RNA_def_property_ui_text(prop, "Material Mode", "Material mode to use for rendering");
2727 RNA_def_property_update(prop, NC_SCENE | NA_EDITED, NULL);
2729 prop = RNA_def_property(srna, "use_glsl_lights", PROP_BOOLEAN, PROP_NONE);
2730 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_LIGHTS);
2731 RNA_def_property_ui_text(prop, "GLSL Lights", "Use lights for GLSL rendering");
2732 RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_glsl_update");
2734 prop = RNA_def_property(srna, "use_glsl_shaders", PROP_BOOLEAN, PROP_NONE);
2735 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_SHADERS);
2736 RNA_def_property_ui_text(prop, "GLSL Shaders", "Use shaders for GLSL rendering");
2737 RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_glsl_update");
2739 prop = RNA_def_property(srna, "use_glsl_shadows", PROP_BOOLEAN, PROP_NONE);
2740 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_SHADOWS);
2741 RNA_def_property_ui_text(prop, "GLSL Shadows", "Use shadows for GLSL rendering");
2742 RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_glsl_update");
2744 prop = RNA_def_property(srna, "use_glsl_ramps", PROP_BOOLEAN, PROP_NONE);
2745 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_RAMPS);
2746 RNA_def_property_ui_text(prop, "GLSL Ramps", "Use ramps for GLSL rendering");
2747 RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_glsl_update");
2749 prop = RNA_def_property(srna, "use_glsl_nodes", PROP_BOOLEAN, PROP_NONE);
2750 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_NODES);
2751 RNA_def_property_ui_text(prop, "GLSL Nodes", "Use nodes for GLSL rendering");
2752 RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_glsl_update");
2754 prop = RNA_def_property(srna, "use_glsl_color_management", PROP_BOOLEAN, PROP_NONE);
2755 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_COLOR_MANAGEMENT);
2756 RNA_def_property_ui_text(prop, "GLSL Color Management", "Use color management for GLSL rendering");
2757 RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_glsl_update");
2759 prop = RNA_def_property(srna, "use_glsl_extra_textures", PROP_BOOLEAN, PROP_NONE);
2760 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_EXTRA_TEX);
2761 RNA_def_property_ui_text(prop, "GLSL Extra Textures",
2762 "Use extra textures like normal or specular maps for GLSL rendering");
2763 RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_glsl_update");
2765 /* obstacle simulation */
2766 prop = RNA_def_property(srna, "obstacle_simulation", PROP_ENUM, PROP_NONE);
2767 RNA_def_property_enum_sdna(prop, NULL, "obstacleSimulation");
2768 RNA_def_property_enum_items(prop, obstacle_simulation_items);
2769 RNA_def_property_ui_text(prop, "Obstacle simulation", "Simulation used for obstacle avoidance in the game engine");
2770 RNA_def_property_update(prop, NC_SCENE, NULL);
2772 prop = RNA_def_property(srna, "level_height", PROP_FLOAT, PROP_ACCELERATION);
2773 RNA_def_property_float_sdna(prop, NULL, "levelHeight");
2774 RNA_def_property_range(prop, 0.0f, 200.0f);
2775 RNA_def_property_ui_text(prop, "Level height",
2776 "Max difference in heights of obstacles to enable their interaction");
2777 RNA_def_property_update(prop, NC_SCENE, NULL);
2779 prop = RNA_def_property(srna, "show_obstacle_simulation", PROP_BOOLEAN, PROP_NONE);
2780 RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_OBSTACLE_SIMULATION);
2781 RNA_def_property_ui_text(prop, "Visualization", "Enable debug visualization for obstacle simulation");
2783 /* Recast Settings */
2784 prop = RNA_def_property(srna, "recast_data", PROP_POINTER, PROP_NONE);
2785 RNA_def_property_flag(prop, PROP_NEVER_NULL);
2786 RNA_def_property_pointer_sdna(prop, NULL, "recastData");
2787 RNA_def_property_struct_type(prop, "SceneGameRecastData");
2788 RNA_def_property_ui_text(prop, "Recast Data", "");
2791 rna_def_scene_game_recast_data(brna);
2794 static void rna_def_scene_render_layer(BlenderRNA *brna)
2798 srna = RNA_def_struct(brna, "SceneRenderLayer", NULL);
2799 RNA_def_struct_ui_text(srna, "Scene Render Layer", "Render layer");
2800 RNA_def_struct_ui_icon(srna, ICON_RENDERLAYERS);
2801 RNA_def_struct_path_func(srna, "rna_SceneRenderLayer_path");
2803 rna_def_render_layer_common(srna, 1);
2807 static void rna_def_render_layers(BlenderRNA *brna, PropertyRNA *cprop)
2815 RNA_def_property_srna(cprop, "RenderLayers");
2816 srna = RNA_def_struct(brna, "RenderLayers", NULL);
2817 RNA_def_struct_sdna(srna, "RenderData");
2818 RNA_def_struct_ui_text(srna, "Render Layers", "Collection of render layers");
2820 prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
2821 RNA_def_property_int_sdna(prop, NULL, "actlay");
2822 RNA_def_property_int_funcs(prop, "rna_RenderSettings_active_layer_index_get",
2823 "rna_RenderSettings_active_layer_index_set",
2824 "rna_RenderSettings_active_layer_index_range");
2825 RNA_def_property_ui_text(prop, "Active Layer Index", "Active index in render layer array");
2826 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
2828 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
2829 RNA_def_property_struct_type(prop, "SceneRenderLayer");
2830 RNA_def_property_pointer_funcs(prop, "rna_RenderSettings_active_layer_get",
2831 "rna_RenderSettings_active_layer_set", NULL, NULL);
2832 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
2833 RNA_def_property_ui_text(prop, "Active Render Layer", "Active Render Layer");
2834 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
2836 func = RNA_def_function(srna, "new", "rna_RenderLayer_new");
2837 RNA_def_function_ui_description(func, "Add a render layer to scene");
2838 RNA_def_function_flag(func, FUNC_USE_SELF_ID);
2839 parm = RNA_def_string(func, "name", "RenderLayer", 0, "", "New name for the marker (not unique)");
2840 RNA_def_property_flag(parm, PROP_REQUIRED);
2841 parm = RNA_def_pointer(func, "result", "SceneRenderLayer", "", "Newly created render layer");
2842 RNA_def_function_return(func, parm);
2844 func = RNA_def_function(srna, "remove", "rna_RenderLayer_remove");
2845 RNA_def_function_ui_description(func, "Remove a render layer");
2846 RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
2847 parm = RNA_def_pointer(func, "layer", "SceneRenderLayer", "", "Timeline marker to remove");
2848 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
2849 RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
2852 /* use for render output and image save operator,
2853 * note: there are some cases where the members act differently when this is
2854 * used from a scene, video formats can only be selected for render output
2855 * for example, this is checked by seeing if the ptr->id.data is a Scene id */
2857 static void rna_def_scene_image_format_data(BlenderRNA *brna)
2860 static EnumPropertyItem exr_codec_items[] = {
2861 {R_IMF_EXR_CODEC_NONE, "NONE", 0, "None", ""},
2862 {R_IMF_EXR_CODEC_PXR24, "PXR24", 0, "Pxr24 (lossy)", ""},
2863 {R_IMF_EXR_CODEC_ZIP, "ZIP", 0, "ZIP (lossless)", ""},
2864 {R_IMF_EXR_CODEC_PIZ, "PIZ", 0, "PIZ (lossless)", ""},
2865 {R_IMF_EXR_CODEC_RLE, "RLE", 0, "RLE (lossless)", ""},
2866 {0, NULL, 0, NULL, NULL}
2873 srna = RNA_def_struct(brna, "ImageFormatSettings", NULL);
2874 RNA_def_struct_sdna(srna, "ImageFormatData");
2875 RNA_def_struct_nested(brna, srna, "Scene");
2876 /* RNA_def_struct_path_func(srna, "rna_RenderSettings_path"); *//* no need for the path, its not animated! */
2877 RNA_def_struct_ui_text(srna, "Image Format", "Settings for image formats");
2879 prop = RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE);
2880 RNA_def_property_enum_sdna(prop, NULL, "imtype");
2881 RNA_def_property_enum_items(prop, image_type_items);
2882 RNA_def_property_enum_funcs(prop, NULL, "rna_ImageFormatSettings_file_format_set",
2883 "rna_ImageFormatSettings_file_format_itemf");
2884 RNA_def_property_ui_text(prop, "File Format", "File format to save the rendered images as");
2885 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2887 prop = RNA_def_property(srna, "color_mode", PROP_ENUM, PROP_NONE);
2888 RNA_def_property_enum_bitflag_sdna(prop, NULL, "planes");
2889 RNA_def_property_enum_items(prop, image_color_mode_items);
2890 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_ImageFormatSettings_color_mode_itemf");
2891 RNA_def_property_ui_text(prop, "Color Mode",
2892 "Choose BW for saving grayscale images, RGB for saving red, green and blue channels, "
2893 "and RGBA for saving red, green, blue and alpha channels");
2894 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2896 prop = RNA_def_property(srna, "color_depth", PROP_ENUM, PROP_NONE);
2897 RNA_def_property_enum_bitflag_sdna(prop, NULL, "depth");
2898 RNA_def_property_enum_items(prop, image_color_depth_items);
2899 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_ImageFormatSettings_color_depth_itemf");
2900 RNA_def_property_ui_text(prop, "Color Depth", "Bit depth per channel");
2901 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2903 /* was 'file_quality' */
2904 prop = RNA_def_property(srna, "quality", PROP_INT, PROP_PERCENTAGE);
2905 RNA_def_property_int_sdna(prop, NULL, "quality");
2906 RNA_def_property_range(prop, 0, 100); /* 0 is needed for compression. */
2907 RNA_def_property_ui_text(prop, "Quality", "Quality for image formats that support lossy compression");
2908 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2910 /* was shared with file_quality */
2911 prop = RNA_def_property(srna, "compression", PROP_INT, PROP_PERCENTAGE);
2912 RNA_def_property_int_sdna(prop, NULL, "compress");
2913 RNA_def_property_range(prop, 0, 100); /* 0 is needed for compression. */
2914 RNA_def_property_ui_text(prop, "Compression", "Compression level for formats that support lossless compression");
2915 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2918 prop = RNA_def_property(srna, "use_zbuffer", PROP_BOOLEAN, PROP_NONE);
2919 RNA_def_property_boolean_sdna(prop, NULL, "flag", R_IMF_FLAG_ZBUF);
2920 RNA_def_property_ui_text(prop, "Z Buffer", "Save the z-depth per pixel (32 bit unsigned int z-buffer)");
2921 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2923 prop = RNA_def_property(srna, "use_preview", PROP_BOOLEAN, PROP_NONE);
2924 RNA_def_property_boolean_sdna(prop, NULL, "flag", R_IMF_FLAG_PREVIEW_JPG);
2925 RNA_def_property_ui_text(prop, "Preview", "When rendering animations, save JPG preview images in same directory");
2926 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2928 /* format specific */
2933 prop = RNA_def_property(srna, "exr_codec", PROP_ENUM, PROP_NONE);
2934 RNA_def_property_enum_sdna(prop, NULL, "exr_codec");
2935 RNA_def_property_enum_items(prop, exr_codec_items);
2936 RNA_def_property_ui_text(prop, "Codec", "Codec settings for OpenEXR");
2937 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2941 #ifdef WITH_OPENJPEG
2943 prop = RNA_def_property(srna, "use_jpeg2k_ycc", PROP_BOOLEAN, PROP_NONE);
2944 RNA_def_property_boolean_sdna(prop, NULL, "jp2_flag", R_IMF_JP2_FLAG_YCC);
2945 RNA_def_property_ui_text(prop, "YCC", "Save luminance-chrominance-chrominance channels instead of RGB colors");
2946 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2948 prop = RNA_def_property(srna, "use_jpeg2k_cinema_preset", PROP_BOOLEAN, PROP_NONE);
2949 RNA_def_property_boolean_sdna(prop, NULL, "jp2_flag", R_IMF_JP2_FLAG_CINE_PRESET);
2950 RNA_def_property_ui_text(prop, "Cinema", "Use Openjpeg Cinema Preset");
2951 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2953 prop = RNA_def_property(srna, "use_jpeg2k_cinema_48", PROP_BOOLEAN, PROP_NONE);
2954 RNA_def_property_boolean_sdna(prop, NULL, "jp2_flag", R_IMF_JP2_FLAG_CINE_48);
2955 RNA_def_property_ui_text(prop, "Cinema (48)", "Use Openjpeg Cinema Preset (48fps)");
2956 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2959 /* Cineon and DPX */
2961 prop = RNA_def_property(srna, "use_cineon_log", PROP_BOOLEAN, PROP_NONE);
2962 RNA_def_property_boolean_sdna(prop, NULL, "cineon_flag", R_IMF_CINEON_FLAG_LOG);
2963 RNA_def_property_ui_text(prop, "Log", "Convert to logarithmic color space");
2964 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2966 prop = RNA_def_property(srna, "cineon_black", PROP_INT, PROP_NONE);
2967 RNA_def_property_int_sdna(prop, NULL, "cineon_black");
2968 RNA_def_property_range(prop, 0, 1024);
2969 RNA_def_property_ui_text(prop, "B", "Log conversion reference blackpoint");
2970 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2972 prop = RNA_def_property(srna, "cineon_white", PROP_INT, PROP_NONE);
2973 RNA_def_property_int_sdna(prop, NULL, "cineon_white");
2974 RNA_def_property_range(prop, 0, 1024);
2975 RNA_def_property_ui_text(prop, "W", "Log conversion reference whitepoint");
2976 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2978 prop = RNA_def_property(srna, "cineon_gamma", PROP_FLOAT, PROP_NONE);
2979 RNA_def_property_float_sdna(prop, NULL, "cineon_gamma");
2980 RNA_def_property_range(prop, 0.0f, 10.0f);
2981 RNA_def_property_ui_text(prop, "G", "Log conversion gamma");
2982 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2984 /* color management */
2985 prop = RNA_def_property(srna, "view_settings", PROP_POINTER, PROP_NONE);
2986 RNA_def_property_pointer_sdna(prop, NULL, "view_settings");
2987 RNA_def_property_struct_type(prop, "ColorManagedViewSettings");
2988 RNA_def_property_ui_text(prop, "View Settings", "Color management settings applied on image before saving");
2990 prop = RNA_def_property(srna, "display_settings", PROP_POINTER, PROP_NONE);
2991 RNA_def_property_pointer_sdna(prop, NULL, "display_settings");
2992 RNA_def_property_struct_type(prop, "ColorManagedDisplaySettings");
2993 RNA_def_property_ui_text(prop, "Display Settings", "Settings of device saved image would be displayed on");
2996 static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna)
3002 static EnumPropertyItem ffmpeg_format_items[] = {
3003 {FFMPEG_MPEG1, "MPEG1", 0, "MPEG-1", ""},
3004 {FFMPEG_MPEG2, "MPEG2", 0, "MPEG-2", ""},
3005 {FFMPEG_MPEG4, "MPEG4", 0, "MPEG-4", ""},
3006 {FFMPEG_AVI, "AVI", 0, "AVI", ""},
3007 {FFMPEG_MOV, "QUICKTIME", 0, "Quicktime", ""},
3008 {FFMPEG_DV, "DV", 0, "DV", ""},
3009 {FFMPEG_H264, "H264", 0, "H.264", ""},
3010 {FFMPEG_XVID, "XVID", 0, "Xvid", ""},
3011 {FFMPEG_OGG, "OGG", 0, "Ogg", ""},
3012 {FFMPEG_MKV, "MKV", 0, "Matroska", ""},
3013 {FFMPEG_FLV, "FLASH", 0, "Flash", ""},
3014 {FFMPEG_WAV, "WAV", 0, "Wav", ""},
3015 {FFMPEG_MP3, "MP3", 0, "Mp3", ""},
3016 {0, NULL, 0, NULL, NULL}
3019 static EnumPropertyItem ffmpeg_codec_items[] = {
3020 {CODEC_ID_NONE, "NONE", 0, "None", ""},
3021 {CODEC_ID_MPEG1VIDEO, "MPEG1", 0, "MPEG-1", ""},
3022 {CODEC_ID_MPEG2VIDEO, "MPEG2", 0, "MPEG-2", ""},
3023 {CODEC_ID_MPEG4, "MPEG4", 0, "MPEG-4(divx)", ""},
3024 {CODEC_ID_HUFFYUV, "HUFFYUV", 0, "HuffYUV", ""},
3025 {CODEC_ID_DVVIDEO, "DV", 0, "DV", ""},
3026 {CODEC_ID_H264, "H264", 0, "H.264", ""},
3027 {CODEC_ID_THEORA, "THEORA", 0, "Theora", ""},
3028 {CODEC_ID_FLV1, "FLASH", 0, "Flash Video", ""},
3029 {CODEC_ID_FFV1, "FFV1", 0, "FFmpeg video codec #1", ""},
3030 {CODEC_ID_QTRLE, "QTRLE", 0, "QTRLE", ""},
3031 {CODEC_ID_DNXHD, "DNXHD", 0, "DNxHD", ""},
3032 {0, NULL, 0, NULL, NULL}
3035 static EnumPropertyItem ffmpeg_audio_codec_items[] = {
3036 {CODEC_ID_NONE, "NONE", 0, "None", ""},
3037 {CODEC_ID_MP2, "MP2", 0, "MP2", ""},
3038 {CODEC_ID_MP3, "MP3", 0, "MP3", ""},
3039 {CODEC_ID_AC3, "AC3", 0, "AC3", ""},
3040 {CODEC_ID_AAC, "AAC", 0, "AAC", ""},
3041 {CODEC_ID_VORBIS, "VORBIS", 0, "Vorbis", ""},
3042 {CODEC_ID_FLAC, "FLAC", 0, "FLAC", ""},
3043 {CODEC_ID_PCM_S16LE, "PCM", 0, "PCM", ""},
3044 {0, NULL, 0, NULL, NULL}
3048 static EnumPropertyItem audio_channel_items[] = {
3049 {1, "MONO", 0, "Mono", "Set audio channels to mono"},
3050 {2, "STEREO", 0, "Stereo", "Set audio channels to stereo"},
3051 {4, "SURROUND4", 0, "4 Channels", "Set audio channels to 4 channels"},
3052 {6, "SURROUND51", 0, "5.1 Surround", "Set audio channels to 5.1 surround sound"},
3053 {8, "SURROUND71", 0, "7.1 Surround", "Set audio channels to 7.1 surround sound"},
3054 {0, NULL, 0, NULL, NULL}
3057 srna = RNA_def_struct(brna, "FFmpegSettings", NULL);
3058 RNA_def_struct_sdna(srna, "FFMpegCodecData");
3059 RNA_def_struct_ui_text(srna, "FFmpeg Settings", "FFmpeg related settings for the scene");
3062 prop = RNA_def_property(srna, "format", PROP_ENUM, PROP_NONE);
3063 RNA_def_property_enum_bitflag_sdna(prop, NULL, "type");
3064 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3065 RNA_def_property_enum_items(prop, ffmpeg_format_items);
3066 RNA_def_property_ui_text(prop, "Format", "Output file format");
3067 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_FFmpegSettings_codec_settings_update");
3069 prop = RNA_def_property(srna, "codec", PROP_ENUM, PROP_NONE);
3070 RNA_def_property_enum_bitflag_sdna(prop, NULL, "codec");
3071 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3072 RNA_def_property_enum_items(prop, ffmpeg_codec_items);
3073 RNA_def_property_ui_text(prop, "Codec", "FFmpeg codec to use");
3074 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_FFmpegSettings_codec_settings_update");
3076 prop = RNA_def_property(srna, "video_bitrate", PROP_INT, PROP_NONE);
3077 RNA_def_property_int_sdna(prop, NULL, "video_bitrate");
3078 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3079 RNA_def_property_ui_text(prop, "Bitrate", "Video bitrate (kb/s)");
3080 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
3082 prop = RNA_def_property(srna, "minrate", PROP_INT, PROP_NONE);
3083 RNA_def_property_int_sdna(prop, NULL, "rc_min_rate");
3084 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3085 RNA_def_property_ui_text(prop, "Min Rate", "Rate control: min rate (kb/s)");
3086 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
3088 prop = RNA_def_property(srna, "maxrate", PROP_INT, PROP_NONE);
3089 RNA_def_property_int_sdna(prop, NULL, "rc_max_rate");
3090 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3091 RNA_def_property_ui_text(prop, "Max Rate", "Rate control: max rate (kb/s)");
3092 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
3094 prop = RNA_def_property(srna, "muxrate", PROP_INT, PROP_NONE);
3095 RNA_def_property_int_sdna(prop, NULL, "mux_rate");
3096 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3097 RNA_def_property_range(prop, 0, 100000000);
3098 RNA_def_property_ui_text(prop, "Mux Rate", "Mux rate (bits/s(!))");
3099 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
3101 prop = RNA_def_property(srna, "gopsize", PROP_INT, PROP_NONE);
3102 RNA_def_property_int_sdna(prop, NULL, "gop_size");
3103 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3104 RNA_def_property_range(prop, 0, 100);
3105 RNA_def_property_ui_text(prop, "GOP Size", "Distance between key frames");
3106 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
3108 prop = RNA_def_property(srna, "buffersize", PROP_INT, PROP_NONE);
3109 RNA_def_property_int_sdna(prop, NULL, "rc_buffer_size");
3110 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3111 RNA_def_property_range(prop, 0, 2000);
3112 RNA_def_property_ui_text(prop, "Buffersize", "Rate control: buffer size (kb)");
3113 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
3115 prop = RNA_def_property(srna, "packetsize", PROP_INT, PROP_NONE);
3116 RNA_def_property_int_sdna(prop, NULL, "mux_packet_size");
3117 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3118 RNA_def_property_range(prop, 0, 16384);
3119 RNA_def_property_ui_text(prop, "Mux Packet Size", "Mux packet size (byte)");
3120 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
3122 prop = RNA_def_property(srna, "use_autosplit", PROP_BOOLEAN, PROP_NONE);
3123 RNA_def_property_boolean_sdna(prop, NULL, "flags", FFMPEG_AUTOSPLIT_OUTPUT);
3124 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3125 RNA_def_property_ui_text(prop, "Autosplit Output", "Autosplit output at 2GB boundary");
3126 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
3128 prop = RNA_def_property(srna, "use_lossless_output", PROP_BOOLEAN, PROP_NONE);
3129 RNA_def_property_boolean_sdna(prop, NULL, "flags", FFMPEG_LOSSLESS_OUTPUT);
3130 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3131 RNA_def_property_boolean_funcs(prop, NULL, "rna_FFmpegSettings_lossless_output_set");
3132 RNA_def_property_ui_text(prop, "Lossless Output", "Use lossless output for video streams");
3133 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
3136 prop = RNA_def_property(srna, "audio_codec", PROP_ENUM, PROP_NONE);
3137 RNA_def_property_enum_bitflag_sdna(prop, NULL, "audio_codec");
3138 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3139 RNA_def_property_enum_items(prop, ffmpeg_audio_codec_items);
3140 RNA_def_property_ui_text(prop, "Audio Codec", "FFmpeg audio codec to use");
3141 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
3143 prop = RNA_def_property(srna, "audio_bitrate", PROP_INT, PROP_NONE);
3144 RNA_def_property_int_sdna(prop, NULL, "audio_bitrate");
3145 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3146 RNA_def_property_range(prop, 32, 384);
3147 RNA_def_property_ui_text(prop, "Bitrate", "Audio bitrate (kb/s)");
3148 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
3150 prop = RNA_def_property(srna, "audio_volume", PROP_FLOAT, PROP_NONE);
3151 RNA_def_property_float_sdna(prop, NULL, "audio_volume");
3152 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3153 RNA_def_property_range(prop, 0.0f, 1.0f);
3154 RNA_def_property_ui_text(prop, "Volume", "Audio volume");
3155 RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_SOUND);
3156 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
3159 /* the following two "ffmpeg" settings are general audio settings */
3160 prop = RNA_def_property(srna, "audio_mixrate", PROP_INT, PROP_NONE);
3161 RNA_def_property_int_sdna(prop, NULL, "audio_mixrate");
3162 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3163 RNA_def_property_range(prop, 8000, 192000);
3164 RNA_def_property_ui_text(prop, "Samplerate", "Audio samplerate(samples/s)");
3165 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
3167 prop = RNA_def_property(srna, "audio_channels", PROP_ENUM, PROP_NONE);
3168 RNA_def_property_enum_sdna(prop, NULL, "audio_channels");
3169 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3170 RNA_def_property_enum_items(prop, audio_channel_items);
3171 RNA_def_property_ui_text(prop, "Audio Channels", "Audio channel count");
3174 #ifdef WITH_QUICKTIME
3175 static void rna_def_scene_quicktime_settings(BlenderRNA *brna)
3180 static EnumPropertyItem quicktime_codec_type_items[] = {
3181 {0, "codec", 0, "codec", ""},
3182 {0, NULL, 0, NULL, NULL}
3186 static EnumPropertyItem quicktime_audio_samplerate_items[] = {
3187 {22050, "22050", 0, "22kHz", ""},
3188 {44100, "44100", 0, "44.1kHz", ""},
3189 {48000, "48000", 0, "48kHz", ""},
3190 {88200, "88200", 0, "88.2kHz", ""},
3191 {96000, "96000", 0, "96kHz", ""},
3192 {192000, "192000", 0, "192kHz", ""},
3193 {0, NULL, 0, NULL, NULL}
3196 static EnumPropertyItem quicktime_audio_bitdepth_items[] = {
3197 {AUD_FORMAT_U8, "8BIT", 0, "8bit", ""},
3198 {AUD_FORMAT_S16, "16BIT", 0, "16bit", ""},
3199 {AUD_FORMAT_S24, "24BIT", 0, "24bit", ""},
3200 {AUD_FORMAT_S32, "32BIT", 0, "32bit", ""},
3201 {AUD_FORMAT_FLOAT32, "FLOAT32", 0, "float32", ""},
3202 {AUD_FORMAT_FLOAT64, "FLOAT64", 0, "float64", ""},
3203 {0, NULL, 0, NULL, NULL}
3206 static EnumPropertyItem quicktime_audio_bitrate_items[] = {
3207 {64000, "64000", 0, "64kbps", ""},
3208 {112000, "112000", 0, "112kpbs", ""},
3209 {128000, "128000", 0, "128kbps", ""},
3210 {192000, "192000", 0, "192kbps", ""},
3211 {256000, "256000", 0, "256kbps", ""},
3212 {320000, "320000", 0, "320kbps", ""},
3213 {0, NULL, 0, NULL, NULL}