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"
43 #include "BLF_translation.h"
45 #include "BKE_tessmesh.h"
47 /* Include for Bake Options */
48 #include "RE_engine.h"
49 #include "RE_pipeline.h"
52 #include "quicktime_export.h"
53 # ifdef WITH_AUDASPACE
54 # include "AUD_Space.h"
59 #include "BKE_writeffmpeg.h"
60 #include <libavcodec/avcodec.h>
61 #include <libavformat/avformat.h>
64 #include "ED_render.h"
69 #include "BLI_threads.h"
71 EnumPropertyItem uv_sculpt_relaxation_items[] = {
72 {UV_SCULPT_TOOL_RELAX_LAPLACIAN, "LAPLACIAN", 0, "Laplacian", "Use Laplacian method for relaxation"},
73 {UV_SCULPT_TOOL_RELAX_HC, "HC", 0, "HC", "Use HC method for relaxation"},
74 {0, NULL, 0, NULL, NULL}
77 EnumPropertyItem uv_sculpt_tool_items[] = {
78 {UV_SCULPT_TOOL_PINCH, "PINCH", 0, "Pinch", "Pinch UVs"},
79 {UV_SCULPT_TOOL_RELAX, "RELAX", 0, "Relax", "Relax UVs"},
80 {UV_SCULPT_TOOL_GRAB, "GRAB", 0, "Grab", "Grab UVs"},
81 {0, NULL, 0, NULL, NULL}
85 EnumPropertyItem snap_target_items[] = {
86 {SCE_SNAP_TARGET_CLOSEST, "CLOSEST", 0, "Closest", "Snap closest point onto target"},
87 {SCE_SNAP_TARGET_CENTER, "CENTER", 0, "Center", "Snap center onto target"},
88 {SCE_SNAP_TARGET_MEDIAN, "MEDIAN", 0, "Median", "Snap median onto target"},
89 {SCE_SNAP_TARGET_ACTIVE, "ACTIVE", 0, "Active", "Snap active onto target"},
90 {0, NULL, 0, NULL, NULL}
93 EnumPropertyItem proportional_falloff_items[] = {
94 {PROP_SMOOTH, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", "Smooth falloff"},
95 {PROP_SPHERE, "SPHERE", ICON_SPHERECURVE, "Sphere", "Spherical falloff"},
96 {PROP_ROOT, "ROOT", ICON_ROOTCURVE, "Root", "Root falloff"},
97 {PROP_SHARP, "SHARP", ICON_SHARPCURVE, "Sharp", "Sharp falloff"},
98 {PROP_LIN, "LINEAR", ICON_LINCURVE, "Linear", "Linear falloff"},
99 {PROP_CONST, "CONSTANT", ICON_NOCURVE, "Constant", "Constant falloff"},
100 {PROP_RANDOM, "RANDOM", ICON_RNDCURVE, "Random", "Random falloff"},
101 {0, NULL, 0, NULL, NULL}
104 /* subset of the enum - only curves, missing random and const */
105 EnumPropertyItem proportional_falloff_curve_only_items[] = {
106 {PROP_SMOOTH, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", "Smooth falloff"},
107 {PROP_SPHERE, "SPHERE", ICON_SPHERECURVE, "Sphere", "Spherical falloff"},
108 {PROP_ROOT, "ROOT", ICON_ROOTCURVE, "Root", "Root falloff"},
109 {PROP_SHARP, "SHARP", ICON_SHARPCURVE, "Sharp", "Sharp falloff"},
110 {PROP_LIN, "LINEAR", ICON_LINCURVE, "Linear", "Linear falloff"},
111 {0, NULL, 0, NULL, NULL}
115 EnumPropertyItem proportional_editing_items[] = {
116 {PROP_EDIT_OFF, "DISABLED", ICON_PROP_OFF, "Disable", "Proportional Editing disabled"},
117 {PROP_EDIT_ON, "ENABLED", ICON_PROP_ON, "Enable", "Proportional Editing enabled"},
118 {PROP_EDIT_CONNECTED, "CONNECTED", ICON_PROP_CON, "Connected", "Proportional Editing using connected geometry only"},
119 {0, NULL, 0, NULL, NULL}
122 /* keep for operators, not used here */
123 EnumPropertyItem mesh_select_mode_items[] = {
124 {SCE_SELECT_VERTEX, "VERTEX", ICON_VERTEXSEL, "Vertex", "Vertex selection mode"},
125 {SCE_SELECT_EDGE, "EDGE", ICON_EDGESEL, "Edge", "Edge selection mode"},
126 {SCE_SELECT_FACE, "FACE", ICON_FACESEL, "Face", "Face selection mode"},
127 {0, NULL, 0, NULL, NULL}
130 EnumPropertyItem snap_element_items[] = {
131 {SCE_SNAP_MODE_INCREMENT, "INCREMENT", ICON_SNAP_INCREMENT, "Increment", "Snap to increments of grid"},
132 {SCE_SNAP_MODE_VERTEX, "VERTEX", ICON_SNAP_VERTEX, "Vertex", "Snap to vertices"},
133 {SCE_SNAP_MODE_EDGE, "EDGE", ICON_SNAP_EDGE, "Edge", "Snap to edges"},
134 {SCE_SNAP_MODE_FACE, "FACE", ICON_SNAP_FACE, "Face", "Snap to faces"},
135 {SCE_SNAP_MODE_VOLUME, "VOLUME", ICON_SNAP_VOLUME, "Volume", "Snap to volume"},
136 {0, NULL, 0, NULL, NULL}
139 EnumPropertyItem snap_node_element_items[] = {
140 {SCE_SNAP_MODE_INCREMENT, "INCREMENT", ICON_SNAP_INCREMENT, "Increment", "Snap to increments of grid"},
141 {SCE_SNAP_MODE_NODE_X, "NODE_X", ICON_SNAP_EDGE, "Node X", "Snap to left/right node border"},
142 {SCE_SNAP_MODE_NODE_Y, "NODE_Y", ICON_SNAP_EDGE, "Node Y", "Snap to top/bottom node border"},
143 {SCE_SNAP_MODE_NODE_XY, "NODE_XY", ICON_SNAP_EDGE, "Node X / Y", "Snap to any node border"},
144 {0, NULL, 0, NULL, NULL}
148 /* workaround for duplicate enums,
149 * have each enum line as a defne then conditionally set it or not
152 #define R_IMF_ENUM_BMP {R_IMF_IMTYPE_BMP, "BMP", ICON_FILE_IMAGE, "BMP", "Output image in bitmap format"},
153 #define R_IMF_ENUM_IRIS {R_IMF_IMTYPE_IRIS, "IRIS", ICON_FILE_IMAGE, "Iris", \
154 "Output image in (old!) SGI IRIS format"},
155 #define R_IMF_ENUM_PNG {R_IMF_IMTYPE_PNG, "PNG", ICON_FILE_IMAGE, "PNG", "Output image in PNG format"},
156 #define R_IMF_ENUM_JPEG {R_IMF_IMTYPE_JPEG90, "JPEG", ICON_FILE_IMAGE, "JPEG", "Output image in JPEG format"},
157 #define R_IMF_ENUM_TAGA {R_IMF_IMTYPE_TARGA, "TARGA", ICON_FILE_IMAGE, "Targa", "Output image in Targa format"},
158 #define R_IMF_ENUM_TAGA_RAW {R_IMF_IMTYPE_RAWTGA, "TARGA_RAW", ICON_FILE_IMAGE, "Targa Raw", \
159 "Output image in uncompressed Targa format"},
163 # define R_IMF_ENUM_DDS {R_IMF_IMTYPE_DDS, "DDS", ICON_FILE_IMAGE, "DDS", "Output image in DDS format"},
165 # define R_IMF_ENUM_DDS
169 # define R_IMF_ENUM_JPEG2K {R_IMF_IMTYPE_JP2, "JPEG2000", ICON_FILE_IMAGE, "JPEG 2000", \
170 "Output image in JPEG 2000 format"},
172 # define R_IMF_ENUM_JPEG2K
176 # define R_IMF_ENUM_CINEON {R_IMF_IMTYPE_CINEON, "CINEON", ICON_FILE_IMAGE, "Cineon", \
177 "Output image in Cineon format"},
178 # define R_IMF_ENUM_DPX {R_IMF_IMTYPE_DPX, "DPX", ICON_FILE_IMAGE, "DPX", "Output image in DPX format"},
180 # define R_IMF_ENUM_CINEON
181 # define R_IMF_ENUM_DPX
185 # define R_IMF_ENUM_EXR_MULTI {R_IMF_IMTYPE_MULTILAYER, "OPEN_EXR_MULTILAYER", ICON_FILE_IMAGE, \
186 "OpenEXR MultiLayer", \
187 "Output image in multilayer OpenEXR format"},
188 # define R_IMF_ENUM_EXR {R_IMF_IMTYPE_OPENEXR, "OPEN_EXR", ICON_FILE_IMAGE, "OpenEXR", \
189 "Output image in OpenEXR format"},
191 # define R_IMF_ENUM_EXR_MULTI
192 # define R_IMF_ENUM_EXR
196 # define R_IMF_ENUM_HDR {R_IMF_IMTYPE_RADHDR, "HDR", ICON_FILE_IMAGE, "Radiance HDR", \
197 "Output image in Radiance HDR format"},
199 # define R_IMF_ENUM_HDR
203 # define R_IMF_ENUM_TIFF {R_IMF_IMTYPE_TIFF, "TIFF", ICON_FILE_IMAGE, "TIFF", "Output image in TIFF format"},
205 # define R_IMF_ENUM_TIFF
209 #define IMAGE_TYPE_ITEMS_IMAGE_ONLY \
217 R_IMF_ENUM_TAGA_RAW \
218 {0, "", 0, " ", NULL}, \
221 R_IMF_ENUM_EXR_MULTI \
227 EnumPropertyItem image_only_type_items[] = {
229 IMAGE_TYPE_ITEMS_IMAGE_ONLY
231 {0, NULL, 0, NULL, NULL}
234 EnumPropertyItem image_type_items[] = {
235 {0, "", 0, N_("Image"), NULL},
237 IMAGE_TYPE_ITEMS_IMAGE_ONLY
239 {0, "", 0, N_("Movie"), NULL},
241 /* XXX Missing codec menu */
242 {R_IMF_IMTYPE_AVICODEC, "AVICODEC", ICON_FILE_MOVIE, "AVI Codec", "Output video in AVI format"},
244 {R_IMF_IMTYPE_AVIJPEG, "AVI_JPEG", ICON_FILE_MOVIE, "AVI JPEG", "Output video in AVI JPEG format"},
245 {R_IMF_IMTYPE_AVIRAW, "AVI_RAW", ICON_FILE_MOVIE, "AVI Raw", "Output video in AVI Raw format"},
246 #ifdef WITH_FRAMESERVER
247 {R_IMF_IMTYPE_FRAMESERVER, "FRAMESERVER", ICON_FILE_SCRIPT, "Frame Server", "Output image to a frameserver"},
250 {R_IMF_IMTYPE_H264, "H264", ICON_FILE_MOVIE, "H.264", "Output video in H.264 format"},
251 {R_IMF_IMTYPE_FFMPEG, "FFMPEG", ICON_FILE_MOVIE, "MPEG", "Output video in MPEG format"},
252 {R_IMF_IMTYPE_THEORA, "THEORA", ICON_FILE_MOVIE, "Ogg Theora", "Output video in Ogg format"},
254 #ifdef WITH_QUICKTIME
256 {R_IMF_IMTYPE_QUICKTIME, "QUICKTIME_QTKIT", ICON_FILE_MOVIE, "QuickTime", "Output video in Quicktime format"},
258 {R_IMF_IMTYPE_QUICKTIME, "QUICKTIME_CARBON", ICON_FILE_MOVIE, "QuickTime", "Output video in Quicktime format"},
262 {R_IMF_IMTYPE_XVID, "XVID", ICON_FILE_MOVIE, "Xvid", "Output video in Xvid format"},
264 {0, NULL, 0, NULL, NULL}
267 EnumPropertyItem image_color_mode_items[] = {
268 {R_IMF_PLANES_BW, "BW", 0, "BW", "Images get saved in 8 bits grayscale (only PNG, JPEG, TGA, TIF)"},
269 {R_IMF_PLANES_RGB, "RGB", 0, "RGB", "Images are saved with RGB (color) data"},
270 {R_IMF_PLANES_RGBA, "RGBA", 0, "RGBA", "Images are saved with RGB and Alpha data (if supported)"},
271 {0, NULL, 0, NULL, NULL}
274 #define IMAGE_COLOR_MODE_BW image_color_mode_items[0]
275 #define IMAGE_COLOR_MODE_RGB image_color_mode_items[1]
276 #define IMAGE_COLOR_MODE_RGBA image_color_mode_items[2]
278 EnumPropertyItem image_color_depth_items[] = {
279 /* 1 (monochrome) not used */
280 {R_IMF_CHAN_DEPTH_8, "8", 0, "8", "8 bit color channels"},
281 {R_IMF_CHAN_DEPTH_12, "12", 0, "12", "12 bit color channels"},
282 {R_IMF_CHAN_DEPTH_16, "16", 0, "16", "16 bit color channels"},
284 {R_IMF_CHAN_DEPTH_32, "32", 0, "32", "32 bit color channels"},
285 {0, NULL, 0, NULL, NULL}
290 #include "DNA_anim_types.h"
291 #include "DNA_node_types.h"
292 #include "DNA_object_types.h"
293 #include "DNA_mesh_types.h"
295 #include "RNA_access.h"
297 #include "MEM_guardedalloc.h"
299 #include "BLI_threads.h"
301 #include "BKE_brush.h"
302 #include "BKE_context.h"
303 #include "BKE_global.h"
304 #include "BKE_image.h"
305 #include "BKE_main.h"
306 #include "BKE_node.h"
307 #include "BKE_pointcache.h"
308 #include "BKE_scene.h"
309 #include "BKE_depsgraph.h"
310 #include "BKE_image.h"
311 #include "BKE_mesh.h"
312 #include "BKE_sound.h"
313 #include "BKE_screen.h"
314 #include "BKE_sequencer.h"
315 #include "BKE_animsys.h"
321 #include "ED_view3d.h"
323 #include "ED_keyframing.h"
324 #include "ED_image.h"
326 #include "RE_engine.h"
328 static void rna_SpaceImageEditor_uv_sculpt_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr))
330 ED_space_image_uv_sculpt_update(bmain->wm.first, scene->toolsettings);
333 static int rna_Scene_object_bases_lookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr)
335 Scene *scene = (Scene *)ptr->data;
338 for (base = scene->base.first; base; base = base->next) {
339 if (strncmp(base->object->id.name + 2, key, sizeof(base->object->id.name) - 2) == 0) {
340 *r_ptr = rna_pointer_inherit_refine(ptr, &RNA_ObjectBase, base);
348 static PointerRNA rna_Scene_objects_get(CollectionPropertyIterator *iter)
350 ListBaseIterator *internal = iter->internal;
352 /* we are actually iterating a Base list, so override get */
353 return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, ((Base *)internal->link)->object);
356 static Base *rna_Scene_object_link(Scene *scene, bContext *C, ReportList *reports, Object *ob)
358 Scene *scene_act = CTX_data_scene(C);
361 if (BKE_scene_base_find(scene, ob)) {
362 BKE_reportf(reports, RPT_ERROR, "Object \"%s\" is already in scene \"%s\"", ob->id.name + 2, scene->id.name + 2);
366 base = BKE_scene_base_add(scene, ob);
369 /* this is similar to what object_add_type and BKE_object_add do */
370 base->lay = scene->lay;
372 /* when linking to an inactive scene don't touch the layer */
373 if (scene == scene_act)
376 ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
378 /* slows down importers too much, run scene.update() */
379 /* DAG_scene_sort(G.main, scene); */
381 WM_main_add_notifier(NC_SCENE | ND_OB_ACTIVE, scene);
386 static void rna_Scene_object_unlink(Scene *scene, ReportList *reports, Object *ob)
388 Base *base = BKE_scene_base_find(scene, ob);
390 BKE_reportf(reports, RPT_ERROR, "Object '%s' is not in this scene '%s'", ob->id.name + 2, scene->id.name + 2);
393 if (base == scene->basact && ob->mode != OB_MODE_OBJECT) {
394 BKE_reportf(reports, RPT_ERROR, "Object '%s' must be in 'Object Mode' to unlink", ob->id.name + 2);
397 if (scene->basact == base) {
398 scene->basact = NULL;
401 BLI_remlink(&scene->base, base);
406 /* needed otherwise the depgraph will contain freed objects which can crash, see [#20958] */
407 DAG_scene_sort(G.main, scene);
408 DAG_ids_flush_update(G.main, 0);
410 WM_main_add_notifier(NC_SCENE | ND_OB_ACTIVE, scene);
413 static void rna_Scene_skgen_etch_template_set(PointerRNA *ptr, PointerRNA value)
415 ToolSettings *ts = (ToolSettings *)ptr->data;
416 if (value.data && ((Object *)value.data)->type == OB_ARMATURE)
417 ts->skgen_template = value.data;
419 ts->skgen_template = NULL;
422 static PointerRNA rna_Scene_active_object_get(PointerRNA *ptr)
424 Scene *scene = (Scene *)ptr->data;
425 return rna_pointer_inherit_refine(ptr, &RNA_Object, scene->basact ? scene->basact->object : NULL);
428 static void rna_Scene_active_object_set(PointerRNA *ptr, PointerRNA value)
430 Scene *scene = (Scene *)ptr->data;
432 scene->basact = BKE_scene_base_find(scene, (Object *)value.data);
434 scene->basact = NULL;
437 static void rna_Scene_set_set(PointerRNA *ptr, PointerRNA value)
439 Scene *scene = (Scene *)ptr->data;
440 Scene *set = (Scene *)value.data;
443 for (nested_set = set; nested_set; nested_set = nested_set->set) {
444 if (nested_set == scene)
451 static void rna_Scene_layer_set(PointerRNA *ptr, const int *values)
453 Scene *scene = (Scene *)ptr->data;
455 scene->lay = ED_view3d_scene_layer_set(scene->lay, values, &scene->layact);
458 static int rna_Scene_active_layer_get(PointerRNA *ptr)
460 Scene *scene = (Scene *)ptr->data;
462 return (int)(log(scene->layact) / M_LN2);
465 static void rna_Scene_view3d_update(Main *bmain, Scene *UNUSED(scene_unused), PointerRNA *ptr)
467 Scene *scene = (Scene *)ptr->data;
469 BKE_screen_view3d_main_sync(&bmain->screen, scene);
472 static void rna_Scene_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
474 rna_Scene_view3d_update(bmain, scene, ptr);
475 DAG_on_visible_update(bmain, FALSE);
478 static void rna_Scene_fps_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
480 sound_update_fps(scene);
481 seq_update_sound_bounds_all(scene);
484 static void rna_Scene_listener_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
486 sound_update_scene_listener(scene);
489 static void rna_Scene_volume_set(PointerRNA *ptr, float value)
491 Scene *scene = (Scene *)(ptr->data);
493 scene->audio.volume = value;
494 if (scene->sound_scene)
495 sound_set_scene_volume(scene, value);
498 static void rna_Scene_framelen_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
500 scene->r.framelen = (float)scene->r.framapto / (float)scene->r.images;
504 static void rna_Scene_current_frame_set(PointerRNA *ptr, int value)
506 Scene *data = (Scene *)ptr->data;
508 /* if negative frames aren't allowed, then we can't use them */
509 FRAMENUMBER_MIN_CLAMP(value);
510 data->r.cfra = value;
513 static void rna_Scene_start_frame_set(PointerRNA *ptr, int value)
515 Scene *data = (Scene *)ptr->data;
516 /* MINFRAME not MINAFRAME, since some output formats can't taken negative frames */
517 CLAMP(value, MINFRAME, MAXFRAME);
518 data->r.sfra = value;
520 if (data->r.sfra >= data->r.efra) {
521 data->r.efra = MIN2(data->r.sfra, MAXFRAME);
525 static void rna_Scene_end_frame_set(PointerRNA *ptr, int value)
527 Scene *data = (Scene *)ptr->data;
528 CLAMP(value, MINFRAME, MAXFRAME);
529 data->r.efra = value;
531 if (data->r.sfra >= data->r.efra) {
532 data->r.sfra = MAX2(data->r.efra, MINFRAME);
536 static void rna_Scene_use_preview_range_set(PointerRNA *ptr, int value)
538 Scene *data = (Scene *)ptr->data;
541 /* copy range from scene if not set before */
542 if ((data->r.psfra == data->r.pefra) && (data->r.psfra == 0)) {
543 data->r.psfra = data->r.sfra;
544 data->r.pefra = data->r.efra;
547 data->r.flag |= SCER_PRV_RANGE;
550 data->r.flag &= ~SCER_PRV_RANGE;
554 static void rna_Scene_preview_range_start_frame_set(PointerRNA *ptr, int value)
556 Scene *data = (Scene *)ptr->data;
558 /* check if enabled already */
559 if ((data->r.flag & SCER_PRV_RANGE) == 0) {
560 /* set end of preview range to end frame, then clamp as per normal */
561 /* TODO: or just refuse to set instead? */
562 data->r.pefra = data->r.efra;
565 /* now set normally */
566 CLAMP(value, MINAFRAME, data->r.pefra);
567 data->r.psfra = value;
570 static void rna_Scene_preview_range_end_frame_set(PointerRNA *ptr, int value)
572 Scene *data = (Scene *)ptr->data;
574 /* check if enabled already */
575 if ((data->r.flag & SCER_PRV_RANGE) == 0) {
576 /* set start of preview range to start frame, then clamp as per normal */
577 /* TODO: or just refuse to set instead? */
578 data->r.psfra = data->r.sfra;
581 /* now set normally */
582 CLAMP(value, data->r.psfra, MAXFRAME);
583 data->r.pefra = value;
586 static void rna_Scene_frame_update(Main *bmain, Scene *UNUSED(current_scene), PointerRNA *ptr)
588 Scene *scene = (Scene *)ptr->id.data;
589 sound_seek_scene(bmain, scene);
592 static PointerRNA rna_Scene_active_keying_set_get(PointerRNA *ptr)
594 Scene *scene = (Scene *)ptr->data;
595 return rna_pointer_inherit_refine(ptr, &RNA_KeyingSet, ANIM_scene_get_active_keyingset(scene));
598 static void rna_Scene_active_keying_set_set(PointerRNA *ptr, PointerRNA value)
600 Scene *scene = (Scene *)ptr->data;
601 KeyingSet *ks = (KeyingSet *)value.data;
603 scene->active_keyingset = ANIM_scene_get_keyingset_index(scene, ks);
606 /* get KeyingSet index stuff for list of Keying Sets editing UI
607 * - active_keyingset-1 since 0 is reserved for 'none'
608 * - don't clamp, otherwise can never set builtins types as active...
610 static int rna_Scene_active_keying_set_index_get(PointerRNA *ptr)
612 Scene *scene = (Scene *)ptr->data;
613 return scene->active_keyingset - 1;
616 /* get KeyingSet index stuff for list of Keying Sets editing UI
617 * - value+1 since 0 is reserved for 'none'
619 static void rna_Scene_active_keying_set_index_set(PointerRNA *ptr, int value)
621 Scene *scene = (Scene *)ptr->data;
622 scene->active_keyingset = value + 1;
625 /* XXX: evil... builtin_keyingsets is defined in keyingsets.c! */
626 /* TODO: make API function to retrieve this... */
627 extern ListBase builtin_keyingsets;
629 static void rna_Scene_all_keyingsets_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
631 Scene *scene = (Scene *)ptr->data;
633 /* start going over the scene KeyingSets first, while we still have pointer to it
634 * but only if we have any Keying Sets to use...
636 if (scene->keyingsets.first)
637 rna_iterator_listbase_begin(iter, &scene->keyingsets, NULL);
639 rna_iterator_listbase_begin(iter, &builtin_keyingsets, NULL);
642 static void rna_Scene_all_keyingsets_next(CollectionPropertyIterator *iter)
644 ListBaseIterator *internal = iter->internal;
645 KeyingSet *ks = (KeyingSet *)internal->link;
647 /* if we've run out of links in Scene list, jump over to the builtins list unless we're there already */
648 if ((ks->next == NULL) && (ks != builtin_keyingsets.last))
649 internal->link = (Link *)builtin_keyingsets.first;
651 internal->link = (Link *)ks->next;
653 iter->valid = (internal->link != NULL);
656 static char *rna_RenderSettings_path(PointerRNA *UNUSED(ptr))
658 return BLI_sprintfN("render");
661 static int rna_RenderSettings_threads_get(PointerRNA *ptr)
663 RenderData *rd = (RenderData *)ptr->data;
665 if (rd->mode & R_FIXED_THREADS)
668 return BLI_system_thread_count();
671 static int rna_RenderSettings_is_movie_fomat_get(PointerRNA *ptr)
673 RenderData *rd = (RenderData *)ptr->data;
674 return BKE_imtype_is_movie(rd->im_format.imtype);
677 static int rna_RenderSettings_save_buffers_get(PointerRNA *ptr)
679 RenderData *rd = (RenderData *)ptr->data;
680 if (rd->mode & R_BORDER)
683 return (rd->scemode & (R_EXR_TILE_FILE | R_FULL_SAMPLE)) != 0;
686 static int rna_RenderSettings_full_sample_get(PointerRNA *ptr)
688 RenderData *rd = (RenderData *)ptr->data;
690 return (rd->scemode & R_FULL_SAMPLE) && !(rd->mode & R_BORDER);
693 static void rna_ImageFormatSettings_file_format_set(PointerRNA *ptr, int value)
695 ImageFormatData *imf = (ImageFormatData *)ptr->data;
696 ID *id = ptr->id.data;
697 const char is_render = (id && GS(id->name) == ID_SCE);
698 /* see note below on why this is */
699 const char chan_flag = BKE_imtype_valid_channels(imf->imtype) | (is_render ? IMA_CHAN_FLAG_BW : 0);
703 /* ensure depth and color settings match */
704 if ( ((imf->planes == R_IMF_PLANES_BW) && !(chan_flag & IMA_CHAN_FLAG_BW)) ||
705 ((imf->planes == R_IMF_PLANES_RGBA) && !(chan_flag & IMA_CHAN_FLAG_ALPHA)))
707 imf->planes = R_IMF_PLANES_RGB;
710 /* ensure usable depth */
712 const int depth_ok = BKE_imtype_valid_depths(imf->imtype);
713 if ((imf->depth & depth_ok) == 0) {
714 /* set first available depth */
715 char depth_ls[] = {R_IMF_CHAN_DEPTH_32,
724 for (i = 0; depth_ls[i]; i++) {
725 if (depth_ok & depth_ls[i]) {
726 imf->depth = depth_ls[i];
733 if (id && GS(id->name) == ID_SCE) {
734 Scene *scene = ptr->id.data;
735 RenderData *rd = &scene->r;
737 BKE_ffmpeg_image_type_verify(rd, imf);
739 #ifdef WITH_QUICKTIME
740 quicktime_verify_image_type(rd, imf);
746 static EnumPropertyItem *rna_ImageFormatSettings_file_format_itemf(bContext *C, PointerRNA *ptr,
747 PropertyRNA *UNUSED(prop), int *UNUSED(free))
749 ID *id = ptr->id.data;
750 if (id && GS(id->name) == ID_SCE) {
751 return image_type_items;
754 return image_only_type_items;
758 static EnumPropertyItem *rna_ImageFormatSettings_color_mode_itemf(bContext *C, PointerRNA *ptr,
759 PropertyRNA *UNUSED(prop), int *free)
761 ImageFormatData *imf = (ImageFormatData *)ptr->data;
762 ID *id = ptr->id.data;
763 const char is_render = (id && GS(id->name) == ID_SCE);
765 /* note, we need to act differently for render
766 * where 'BW' will force grayscale even if the output format writes
767 * as RGBA, this is age old blender convention and not sure how useful
768 * it really is but keep it for now - campbell */
769 char chan_flag = BKE_imtype_valid_channels(imf->imtype) | (is_render ? IMA_CHAN_FLAG_BW : 0);
772 /* a WAY more crappy case than B&W flag: depending on codec, file format MIGHT support
773 * alpha channel. for example MPEG format with h264 codec can't do alpha channel, but
774 * the same MPEG format with QTRLE codec can easily handle alpha channel.
775 * not sure how to deal with such cases in a nicer way (sergey) */
777 Scene *scene = ptr->id.data;
778 RenderData *rd = &scene->r;
780 if (BKE_ffmpeg_alpha_channel_is_supported(rd))
781 chan_flag |= IMA_CHAN_FLAG_ALPHA;
785 if (chan_flag == (IMA_CHAN_FLAG_BW | IMA_CHAN_FLAG_RGB | IMA_CHAN_FLAG_ALPHA)) {
786 return image_color_mode_items;
790 EnumPropertyItem *item = NULL;
792 if (chan_flag & IMA_CHAN_FLAG_BW) RNA_enum_item_add(&item, &totitem, &IMAGE_COLOR_MODE_BW);
793 if (chan_flag & IMA_CHAN_FLAG_RGB) RNA_enum_item_add(&item, &totitem, &IMAGE_COLOR_MODE_RGB);
794 if (chan_flag & IMA_CHAN_FLAG_ALPHA) RNA_enum_item_add(&item, &totitem, &IMAGE_COLOR_MODE_RGBA);
796 RNA_enum_item_end(&item, &totitem);
803 static EnumPropertyItem *rna_ImageFormatSettings_color_depth_itemf(bContext *C, PointerRNA *ptr,
804 PropertyRNA *UNUSED(prop), int *free)
806 ImageFormatData *imf = (ImageFormatData *)ptr->data;
809 return image_color_depth_items;
812 const int depth_ok = BKE_imtype_valid_depths(imf->imtype);
813 const int is_float = ELEM3(imf->imtype, R_IMF_IMTYPE_RADHDR, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER);
815 EnumPropertyItem *item_8bit = &image_color_depth_items[0];
816 EnumPropertyItem *item_12bit = &image_color_depth_items[1];
817 EnumPropertyItem *item_16bit = &image_color_depth_items[2];
818 EnumPropertyItem *item_32bit = &image_color_depth_items[3];
821 EnumPropertyItem *item = NULL;
822 EnumPropertyItem tmp = {0, "", 0, "", ""};
824 if (depth_ok & R_IMF_CHAN_DEPTH_8) {
825 RNA_enum_item_add(&item, &totitem, item_8bit);
828 if (depth_ok & R_IMF_CHAN_DEPTH_12) {
829 RNA_enum_item_add(&item, &totitem, item_12bit);
832 if (depth_ok & R_IMF_CHAN_DEPTH_16) {
835 tmp.name = "Float (Half)";
836 RNA_enum_item_add(&item, &totitem, &tmp);
839 RNA_enum_item_add(&item, &totitem, item_16bit);
843 if (depth_ok & R_IMF_CHAN_DEPTH_32) {
846 tmp.name = "Float (Full)";
847 RNA_enum_item_add(&item, &totitem, &tmp);
850 RNA_enum_item_add(&item, &totitem, item_32bit);
854 RNA_enum_item_end(&item, &totitem);
861 static int rna_SceneRender_file_ext_length(PointerRNA *ptr)
863 RenderData *rd = (RenderData *)ptr->data;
866 BKE_add_image_extension(ext, rd->im_format.imtype);
870 static void rna_SceneRender_file_ext_get(PointerRNA *ptr, char *str)
872 RenderData *rd = (RenderData *)ptr->data;
874 BKE_add_image_extension(str, rd->im_format.imtype);
877 #ifdef WITH_QUICKTIME
878 static int rna_RenderSettings_qtcodecsettings_codecType_get(PointerRNA *ptr)
880 QuicktimeCodecSettings *settings = (QuicktimeCodecSettings *)ptr->data;
882 return quicktime_rnatmpvalue_from_videocodectype(settings->codecType);
885 static void rna_RenderSettings_qtcodecsettings_codecType_set(PointerRNA *ptr, int value)
887 QuicktimeCodecSettings *settings = (QuicktimeCodecSettings *)ptr->data;
889 settings->codecType = quicktime_videocodecType_from_rnatmpvalue(value);
892 static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_codecType_itemf(bContext *C, PointerRNA *ptr,
893 PropertyRNA *UNUSED(prop), int *free)
895 EnumPropertyItem *item = NULL;
896 EnumPropertyItem tmp = {0, "", 0, "", ""};
897 QuicktimeCodecTypeDesc *codecTypeDesc;
898 int i = 1, totitem = 0;
901 for (i = 0; i < quicktime_get_num_videocodecs(); i++) {
902 codecTypeDesc = quicktime_get_videocodecType_desc(i);
903 if (!codecTypeDesc) break;
905 tmp.value = codecTypeDesc->rnatmpvalue;
906 *((int *)id) = codecTypeDesc->codecType;
909 tmp.name = codecTypeDesc->codecName;
910 RNA_enum_item_add(&item, &totitem, &tmp);
913 RNA_enum_item_end(&item, &totitem);
920 static int rna_RenderSettings_qtcodecsettings_audiocodecType_get(PointerRNA *ptr)
922 QuicktimeCodecSettings *settings = (QuicktimeCodecSettings *)ptr->data;
924 return quicktime_rnatmpvalue_from_audiocodectype(settings->audiocodecType);
927 static void rna_RenderSettings_qtcodecsettings_audiocodecType_set(PointerRNA *ptr, int value)
929 QuicktimeCodecSettings *settings = (QuicktimeCodecSettings *)ptr->data;
931 settings->audiocodecType = quicktime_audiocodecType_from_rnatmpvalue(value);
934 static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_audiocodecType_itemf(bContext *C, PointerRNA *ptr,
935 PropertyRNA *UNUSED(prop), int *free)
937 EnumPropertyItem *item = NULL;
938 EnumPropertyItem tmp = {0, "", 0, "", ""};
939 QuicktimeCodecTypeDesc *codecTypeDesc;
940 int i = 1, totitem = 0;
942 for (i = 0; i < quicktime_get_num_audiocodecs(); i++) {
943 codecTypeDesc = quicktime_get_audiocodecType_desc(i);
944 if (!codecTypeDesc) break;
946 tmp.value = codecTypeDesc->rnatmpvalue;
947 tmp.identifier = codecTypeDesc->codecName;
948 tmp.name = codecTypeDesc->codecName;
949 RNA_enum_item_add(&item, &totitem, &tmp);
952 RNA_enum_item_end(&item, &totitem);
961 static void rna_FFmpegSettings_lossless_output_set(PointerRNA *ptr, int value)
963 Scene *scene = (Scene *) ptr->id.data;
964 RenderData *rd = &scene->r;
967 rd->ffcodecdata.flags |= FFMPEG_LOSSLESS_OUTPUT;
969 rd->ffcodecdata.flags &= ~FFMPEG_LOSSLESS_OUTPUT;
971 BKE_ffmpeg_codec_settings_verify(rd);
974 static void rna_FFmpegSettings_codec_settings_update(Main *UNUSED(bmain), Scene *UNUSED(scene_unused), PointerRNA *ptr)
976 Scene *scene = (Scene *) ptr->id.data;
977 RenderData *rd = &scene->r;
979 BKE_ffmpeg_codec_settings_verify(rd);
983 static int rna_RenderSettings_active_layer_index_get(PointerRNA *ptr)
985 RenderData *rd = (RenderData *)ptr->data;
989 static void rna_RenderSettings_active_layer_index_set(PointerRNA *ptr, int value)
991 RenderData *rd = (RenderData *)ptr->data;
995 static void rna_RenderSettings_active_layer_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
997 RenderData *rd = (RenderData *)ptr->data;
1000 *max = BLI_countlist(&rd->layers) - 1;
1001 *max = MAX2(0, *max);
1004 static PointerRNA rna_RenderSettings_active_layer_get(PointerRNA *ptr)
1006 RenderData *rd = (RenderData *)ptr->data;
1007 SceneRenderLayer *srl = BLI_findlink(&rd->layers, rd->actlay);
1009 return rna_pointer_inherit_refine(ptr, &RNA_SceneRenderLayer, srl);
1012 static void rna_RenderSettings_active_layer_set(PointerRNA *ptr, PointerRNA value)
1014 RenderData *rd = (RenderData *)ptr->data;
1015 SceneRenderLayer *srl = (SceneRenderLayer *)value.data;
1016 const int index = BLI_findindex(&rd->layers, srl);
1017 if (index != -1) rd->actlay = index;
1020 static SceneRenderLayer *rna_RenderLayer_new(ID *id, RenderData *UNUSED(rd), const char *name)
1022 Scene *scene = (Scene *)id;
1023 SceneRenderLayer *srl = BKE_scene_add_render_layer(scene, name);
1025 WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
1030 static void rna_RenderLayer_remove(ID *id, RenderData *UNUSED(rd), Main *bmain, ReportList *reports,
1031 SceneRenderLayer *srl)
1033 Scene *scene = (Scene *)id;
1035 if (!BKE_scene_remove_render_layer(bmain, scene, srl)) {
1036 BKE_reportf(reports, RPT_ERROR, "RenderLayer '%s' could not be removed from scene '%s'",
1037 srl->name, scene->id.name + 2);
1040 WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
1044 static void rna_RenderSettings_engine_set(PointerRNA *ptr, int value)
1046 RenderData *rd = (RenderData *)ptr->data;
1047 RenderEngineType *type = BLI_findlink(&R_engines, value);
1050 BLI_strncpy_utf8(rd->engine, type->idname, sizeof(rd->engine));
1053 static EnumPropertyItem *rna_RenderSettings_engine_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr),
1054 PropertyRNA *UNUSED(prop), int *free)
1056 RenderEngineType *type;
1057 EnumPropertyItem *item = NULL;
1058 EnumPropertyItem tmp = {0, "", 0, "", ""};
1059 int a = 0, totitem = 0;
1061 for (type = R_engines.first; type; type = type->next, a++) {
1063 tmp.identifier = type->idname;
1064 tmp.name = type->name;
1065 RNA_enum_item_add(&item, &totitem, &tmp);
1068 RNA_enum_item_end(&item, &totitem);
1074 static int rna_RenderSettings_engine_get(PointerRNA *ptr)
1076 RenderData *rd = (RenderData *)ptr->data;
1077 RenderEngineType *type;
1080 for (type = R_engines.first; type; type = type->next, a++)
1081 if (strcmp(type->idname, rd->engine) == 0)
1087 static void rna_RenderSettings_engine_update(Main *bmain, Scene *UNUSED(unused), PointerRNA *UNUSED(ptr))
1089 ED_render_engine_changed(bmain);
1092 static void rna_Scene_glsl_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1094 Scene *scene = (Scene *)ptr->id.data;
1096 DAG_id_tag_update(&scene->id, 0);
1099 static void rna_RenderSettings_color_management_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
1101 /* reset image nodes */
1102 Scene *scene = (Scene *)ptr->id.data;
1103 bNodeTree *ntree = scene->nodetree;
1106 if (ntree && scene->use_nodes) {
1107 /* images are freed here, stop render and preview threads, until
1108 * Image is threadsafe. when we are changing this property from a
1109 * python script in the render thread, don't stop own thread */
1110 if (BLI_thread_is_main())
1111 WM_jobs_stop_all(bmain->wm.first);
1113 for (node = ntree->nodes.first; node; node = node->next) {
1114 if (ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_IMAGE)) {
1115 ED_node_changed_update(&scene->id, node);
1116 WM_main_add_notifier(NC_NODE | NA_EDITED, node);
1118 if (node->type == CMP_NODE_IMAGE)
1119 BKE_image_signal((Image *)node->id, NULL, IMA_SIGNAL_FREE);
1124 rna_Scene_glsl_update(bmain, scene, ptr);
1127 static void rna_SceneRenderLayer_name_set(PointerRNA *ptr, const char *value)
1129 Scene *scene = (Scene *)ptr->id.data;
1130 SceneRenderLayer *rl = (SceneRenderLayer *)ptr->data;
1131 BLI_strncpy_utf8(rl->name, value, sizeof(rl->name));
1132 BLI_uniquename(&scene->r.layers, rl, "RenderLayer", '.', offsetof(SceneRenderLayer, name), sizeof(rl->name));
1134 if (scene->nodetree) {
1136 int index = BLI_findindex(&scene->r.layers, rl);
1138 for (node = scene->nodetree->nodes.first; node; node = node->next) {
1139 if (node->type == CMP_NODE_R_LAYERS && node->id == NULL) {
1140 if (node->custom1 == index)
1141 BLI_strncpy(node->name, rl->name, NODE_MAXSTR);
1147 static int rna_RenderSettings_multiple_engines_get(PointerRNA *UNUSED(ptr))
1149 return (BLI_countlist(&R_engines) > 1);
1152 static int rna_RenderSettings_use_shading_nodes_get(PointerRNA *ptr)
1154 Scene *scene = (Scene *)ptr->id.data;
1155 return BKE_scene_use_new_shading_nodes(scene);
1158 static int rna_RenderSettings_use_game_engine_get(PointerRNA *ptr)
1160 RenderData *rd = (RenderData *)ptr->data;
1161 RenderEngineType *type;
1163 for (type = R_engines.first; type; type = type->next)
1164 if (strcmp(type->idname, rd->engine) == 0)
1165 return (type->flag & RE_GAME);
1170 static void rna_SceneRenderLayer_layer_set(PointerRNA *ptr, const int *values)
1172 SceneRenderLayer *rl = (SceneRenderLayer *)ptr->data;
1173 rl->lay = ED_view3d_scene_layer_set(rl->lay, values, NULL);
1176 static void rna_SceneRenderLayer_pass_update(Main *bmain, Scene *activescene, PointerRNA *ptr)
1178 Scene *scene = (Scene *)ptr->id.data;
1180 if (scene->nodetree)
1181 ntreeCompositForceHidden(scene->nodetree, scene);
1183 rna_Scene_glsl_update(bmain, activescene, ptr);
1186 static void rna_Scene_use_nodes_set(PointerRNA *ptr, int value)
1188 Scene *scene = (Scene *)ptr->data;
1190 scene->use_nodes = value;
1191 if (scene->use_nodes && scene->nodetree == NULL)
1192 ED_node_composit_default(scene);
1195 static void rna_Physics_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1197 Scene *scene = (Scene *)ptr->id.data;
1200 for (base = scene->base.first; base; base = base->next)
1201 BKE_ptcache_object_reset(scene, base->object, PTCACHE_RESET_DEPSGRAPH);
1204 static void rna_Scene_editmesh_select_mode_set(PointerRNA *ptr, const int *value)
1206 Scene *scene = (Scene *)ptr->id.data;
1207 ToolSettings *ts = (ToolSettings *)ptr->data;
1208 int flag = (value[0] ? SCE_SELECT_VERTEX : 0) | (value[1] ? SCE_SELECT_EDGE : 0) | (value[2] ? SCE_SELECT_FACE : 0);
1211 ts->selectmode = flag;
1213 if (scene->basact) {
1214 Mesh *me = BKE_mesh_from_object(scene->basact->object);
1215 if (me && me->edit_btmesh && me->edit_btmesh->selectmode != flag) {
1216 me->edit_btmesh->selectmode = flag;
1217 EDBM_selectmode_set(me->edit_btmesh);
1223 static void rna_Scene_editmesh_select_mode_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
1227 if (scene->basact) {
1228 me = BKE_mesh_from_object(scene->basact->object);
1229 if (me && me->edit_btmesh == NULL)
1233 WM_main_add_notifier(NC_GEOM | ND_SELECT, me);
1234 WM_main_add_notifier(NC_SCENE | ND_TOOLSETTINGS, NULL);
1237 static void object_simplify_update(Object *ob)
1240 ParticleSystem *psys;
1242 for (md = ob->modifiers.first; md; md = md->next)
1243 if (ELEM3(md->type, eModifierType_Subsurf, eModifierType_Multires, eModifierType_ParticleSystem))
1244 ob->recalc |= OB_RECALC_DATA | PSYS_RECALC_CHILD;
1246 for (psys = ob->particlesystem.first; psys; psys = psys->next)
1247 psys->recalc |= PSYS_RECALC_CHILD;
1249 if (ob->dup_group) {
1252 for (gob = ob->dup_group->gobject.first; gob; gob = gob->next)
1253 object_simplify_update(gob->ob);
1257 static void rna_Scene_use_simplify_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr))
1262 for (SETLOOPER(scene, sce_iter, base))
1263 object_simplify_update(base->object);
1265 DAG_ids_flush_update(bmain, 0);
1266 WM_main_add_notifier(NC_GEOM | ND_DATA, NULL);
1269 static void rna_Scene_simplify_update(Main *bmain, Scene *scene, PointerRNA *ptr)
1271 if (scene->r.mode & R_SIMPLIFY)
1272 rna_Scene_use_simplify_update(bmain, scene, ptr);
1275 static int rna_Scene_use_audio_get(PointerRNA *ptr)
1277 Scene *scene = (Scene *)ptr->data;
1278 return scene->audio.flag & AUDIO_MUTE;
1281 static void rna_Scene_use_audio_set(PointerRNA *ptr, int value)
1283 Scene *scene = (Scene *)ptr->data;
1286 scene->audio.flag |= AUDIO_MUTE;
1288 scene->audio.flag &= ~AUDIO_MUTE;
1290 sound_mute_scene(scene, value);
1293 static int rna_Scene_sync_mode_get(PointerRNA *ptr)
1295 Scene *scene = (Scene *)ptr->data;
1296 if (scene->audio.flag & AUDIO_SYNC)
1298 return scene->flag & SCE_FRAME_DROP;
1301 static void rna_Scene_sync_mode_set(PointerRNA *ptr, int value)
1303 Scene *scene = (Scene *)ptr->data;
1305 if (value == AUDIO_SYNC) {
1306 scene->audio.flag |= AUDIO_SYNC;
1308 else if (value == SCE_FRAME_DROP) {
1309 scene->audio.flag &= ~AUDIO_SYNC;
1310 scene->flag |= SCE_FRAME_DROP;
1313 scene->audio.flag &= ~AUDIO_SYNC;
1314 scene->flag &= ~SCE_FRAME_DROP;
1318 static int rna_GameSettings_auto_start_get(PointerRNA *UNUSED(ptr))
1320 if (G.fileflags & G_FILE_AUTOPLAY)
1326 static void rna_GameSettings_auto_start_set(PointerRNA *UNUSED(ptr), int value)
1329 G.fileflags |= G_FILE_AUTOPLAY;
1331 G.fileflags &= ~G_FILE_AUTOPLAY;
1334 static void rna_GameSettings_exit_key_set(PointerRNA *ptr, int value)
1336 GameData *gm = (GameData *)ptr->data;
1338 if (ISKEYBOARD(value))
1339 gm->exitkey = value;
1342 static TimeMarker *rna_TimeLine_add(Scene *scene, const char name[])
1344 TimeMarker *marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker");
1345 marker->flag = SELECT;
1347 BLI_strncpy_utf8(marker->name, name, sizeof(marker->name));
1348 BLI_addtail(&scene->markers, marker);
1350 WM_main_add_notifier(NC_SCENE | ND_MARKERS, NULL);
1351 WM_main_add_notifier(NC_ANIMATION | ND_MARKERS, NULL);
1356 static void rna_TimeLine_remove(Scene *scene, ReportList *reports, TimeMarker *marker)
1358 if (!BLI_remlink_safe(&scene->markers, marker)) {
1359 BKE_reportf(reports, RPT_ERROR, "TimelineMarker '%s' not found in scene '%s'", marker->name, scene->id.name + 2);
1363 /* XXX, invalidates PyObject */
1366 WM_main_add_notifier(NC_SCENE | ND_MARKERS, NULL);
1367 WM_main_add_notifier(NC_ANIMATION | ND_MARKERS, NULL);
1370 static void rna_TimeLine_clear(Scene *scene)
1372 BLI_freelistN(&scene->markers);
1374 WM_main_add_notifier(NC_SCENE | ND_MARKERS, NULL);
1375 WM_main_add_notifier(NC_ANIMATION | ND_MARKERS, NULL);
1378 static KeyingSet *rna_Scene_keying_set_new(Scene *sce, ReportList *reports, const char idname[], const char name[])
1380 KeyingSet *ks = NULL;
1382 /* call the API func, and set the active keyingset index */
1383 ks = BKE_keyingset_add(&sce->keyingsets, idname, name, KEYINGSET_ABSOLUTE, 0);
1386 sce->active_keyingset = BLI_countlist(&sce->keyingsets);
1390 BKE_report(reports, RPT_ERROR, "Keying Set could not be added");
1395 static void rna_UnifiedPaintSettings_size_set(PointerRNA *ptr, int value)
1397 UnifiedPaintSettings *ups = ptr->data;
1399 /* scale unprojected radius so it stays consistent with brush size */
1400 BKE_brush_scale_unprojected_radius(&ups->unprojected_radius,
1405 static void rna_UnifiedPaintSettings_unprojected_radius_set(PointerRNA *ptr, float value)
1407 UnifiedPaintSettings *ups = ptr->data;
1409 /* scale brush size so it stays consistent with unprojected_radius */
1410 BKE_brush_scale_size(&ups->size, value, ups->unprojected_radius);
1411 ups->unprojected_radius = value;
1414 /* note: without this, when Multi-Paint is activated/deactivated, the colors
1415 * will not change right away when multiple bones are selected, this function
1416 * is not for general use and only for the few cases where changing scene
1417 * settings and NOT for general purpose updates, possibly this should be
1418 * given its own notifier. */
1419 static void rna_Scene_update_active_object_data(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
1423 DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
1424 WM_main_add_notifier(NC_OBJECT | ND_DRAW, &ob->id);
1428 static void rna_SceneCamera_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1430 Scene *scene = (Scene *)ptr->id.data;
1431 Object *camera = scene->camera;
1434 DAG_id_tag_update(&camera->id, 0);
1439 static void rna_def_transform_orientation(BlenderRNA *brna)
1444 const int matrix_dimsize[] = {3, 3};
1446 srna = RNA_def_struct(brna, "TransformOrientation", NULL);
1448 prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
1449 RNA_def_property_float_sdna(prop, NULL, "mat");
1450 RNA_def_property_multi_array(prop, 2, matrix_dimsize);
1451 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
1453 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1454 RNA_def_struct_name_property(srna, prop);
1455 RNA_def_property_ui_text(prop, "Name", "Name of the custom transform orientation");
1456 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
1459 static void rna_def_tool_settings(BlenderRNA *brna)
1464 static EnumPropertyItem uv_select_mode_items[] = {
1465 {UV_SELECT_VERTEX, "VERTEX", ICON_UV_VERTEXSEL, "Vertex", "Vertex selection mode"},
1466 {UV_SELECT_EDGE, "EDGE", ICON_UV_EDGESEL, "Edge", "Edge selection mode"},
1467 {UV_SELECT_FACE, "FACE", ICON_UV_FACESEL, "Face", "Face selection mode"},
1468 {UV_SELECT_ISLAND, "ISLAND", ICON_UV_ISLANDSEL, "Island", "Island selection mode"},
1469 {0, NULL, 0, NULL, NULL}
1472 /* the construction of this enum is quite special - everything is stored as bitflags,
1473 * with 1st position only for for on/off (and exposed as boolean), while others are mutually
1474 * exclusive options but which will only have any effect when autokey is enabled
1476 static EnumPropertyItem auto_key_items[] = {
1477 {AUTOKEY_MODE_NORMAL & ~AUTOKEY_ON, "ADD_REPLACE_KEYS", 0, "Add & Replace", ""},
1478 {AUTOKEY_MODE_EDITKEYS & ~AUTOKEY_ON, "REPLACE_KEYS", 0, "Replace", ""},
1479 {0, NULL, 0, NULL, NULL}
1482 static EnumPropertyItem retarget_roll_items[] = {
1483 {SK_RETARGET_ROLL_NONE, "NONE", 0, "None", "Don't adjust roll"},
1484 {SK_RETARGET_ROLL_VIEW, "VIEW", 0, "View", "Roll bones to face the view"},
1485 {SK_RETARGET_ROLL_JOINT, "JOINT", 0, "Joint", "Roll bone to original joint plane offset"},
1486 {0, NULL, 0, NULL, NULL}
1489 static EnumPropertyItem sketch_convert_items[] = {
1490 {SK_CONVERT_CUT_FIXED, "FIXED", 0, "Fixed", "Subdivide stroke in fixed number of bones"},
1491 {SK_CONVERT_CUT_LENGTH, "LENGTH", 0, "Length", "Subdivide stroke in bones of specific length"},
1492 {SK_CONVERT_CUT_ADAPTATIVE, "ADAPTIVE", 0, "Adaptive",
1493 "Subdivide stroke adaptively, with more subdivision in curvier parts"},
1494 {SK_CONVERT_RETARGET, "RETARGET", 0, "Retarget", "Retarget template bone chain to stroke"},
1495 {0, NULL, 0, NULL, NULL}
1498 static EnumPropertyItem edge_tag_items[] = {
1499 {EDGE_MODE_SELECT, "SELECT", 0, "Select", ""},
1500 {EDGE_MODE_TAG_SEAM, "SEAM", 0, "Tag Seam", ""},
1501 {EDGE_MODE_TAG_SHARP, "SHARP", 0, "Tag Sharp", ""},
1502 {EDGE_MODE_TAG_CREASE, "CREASE", 0, "Tag Crease", ""},
1503 {EDGE_MODE_TAG_BEVEL, "BEVEL", 0, "Tag Bevel", ""},
1504 {0, NULL, 0, NULL, NULL}
1507 srna = RNA_def_struct(brna, "ToolSettings", NULL);
1508 RNA_def_struct_ui_text(srna, "Tool Settings", "");
1510 prop = RNA_def_property(srna, "sculpt", PROP_POINTER, PROP_NONE);
1511 RNA_def_property_struct_type(prop, "Sculpt");
1512 RNA_def_property_ui_text(prop, "Sculpt", "");
1514 prop = RNA_def_property(srna, "use_auto_normalize", PROP_BOOLEAN, PROP_NONE);
1515 RNA_def_property_boolean_sdna(prop, NULL, "auto_normalize", 1);
1516 RNA_def_property_ui_text(prop, "WPaint Auto-Normalize",
1517 "Ensure all bone-deforming vertex groups add up "
1518 "to 1.0 while weight painting");
1519 RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data");
1521 prop = RNA_def_property(srna, "use_multipaint", PROP_BOOLEAN, PROP_NONE);
1522 RNA_def_property_boolean_sdna(prop, NULL, "multipaint", 1);
1523 RNA_def_property_ui_text(prop, "WPaint Multi-Paint",
1524 "Paint across all selected bones while "
1526 RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data");
1528 prop = RNA_def_property(srna, "vertex_paint", PROP_POINTER, PROP_NONE);
1529 RNA_def_property_pointer_sdna(prop, NULL, "vpaint");
1530 RNA_def_property_ui_text(prop, "Vertex Paint", "");
1532 prop = RNA_def_property(srna, "weight_paint", PROP_POINTER, PROP_NONE);
1533 RNA_def_property_pointer_sdna(prop, NULL, "wpaint");
1534 RNA_def_property_ui_text(prop, "Weight Paint", "");
1536 prop = RNA_def_property(srna, "image_paint", PROP_POINTER, PROP_NONE);
1537 RNA_def_property_pointer_sdna(prop, NULL, "imapaint");
1538 RNA_def_property_ui_text(prop, "Image Paint", "");
1540 prop = RNA_def_property(srna, "uv_sculpt", PROP_POINTER, PROP_NONE);
1541 RNA_def_property_pointer_sdna(prop, NULL, "uvsculpt");
1542 RNA_def_property_ui_text(prop, "UV Sculpt", "");
1544 prop = RNA_def_property(srna, "particle_edit", PROP_POINTER, PROP_NONE);
1545 RNA_def_property_pointer_sdna(prop, NULL, "particle");
1546 RNA_def_property_ui_text(prop, "Particle Edit", "");
1548 prop = RNA_def_property(srna, "use_uv_sculpt", PROP_BOOLEAN, PROP_NONE);
1549 RNA_def_property_boolean_sdna(prop, NULL, "use_uv_sculpt", 1);
1550 RNA_def_property_ui_text(prop, "UV Sculpt", "Enable brush for UV sculpting");
1551 RNA_def_property_ui_icon(prop, ICON_TPAINT_HLT, 0);
1552 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, "rna_SpaceImageEditor_uv_sculpt_update");
1554 prop = RNA_def_property(srna, "uv_sculpt_lock_borders", PROP_BOOLEAN, PROP_NONE);
1555 RNA_def_property_boolean_sdna(prop, NULL, "uv_sculpt_settings", UV_SCULPT_LOCK_BORDERS);
1556 RNA_def_property_ui_text(prop, "Lock Borders", "Disable editing of boundary edges");
1558 prop = RNA_def_property(srna, "uv_sculpt_all_islands", PROP_BOOLEAN, PROP_NONE);
1559 RNA_def_property_boolean_sdna(prop, NULL, "uv_sculpt_settings", UV_SCULPT_ALL_ISLANDS);
1560 RNA_def_property_ui_text(prop, "Sculpt All Islands", "Brush operates on all islands");
1562 prop = RNA_def_property(srna, "uv_sculpt_tool", PROP_ENUM, PROP_NONE);
1563 RNA_def_property_enum_sdna(prop, NULL, "uv_sculpt_tool");
1564 RNA_def_property_enum_items(prop, uv_sculpt_tool_items);
1565 RNA_def_property_ui_text(prop, "UV Sculpt Tools", "Select Tools for the UV sculpt brushes");
1567 prop = RNA_def_property(srna, "uv_relax_method", PROP_ENUM, PROP_NONE);
1568 RNA_def_property_enum_sdna(prop, NULL, "uv_relax_method");
1569 RNA_def_property_enum_items(prop, uv_sculpt_relaxation_items);
1570 RNA_def_property_ui_text(prop, "Relaxation Method", "Algorithm used for UV relaxation");
1573 prop = RNA_def_property(srna, "proportional_edit", PROP_ENUM, PROP_NONE);
1574 RNA_def_property_enum_sdna(prop, NULL, "proportional");
1575 RNA_def_property_enum_items(prop, proportional_editing_items);
1576 RNA_def_property_ui_text(prop, "Proportional Editing",
1577 "Proportional Editing mode, allows transforms with distance fall-off");
1578 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1580 prop = RNA_def_property(srna, "use_proportional_edit_objects", PROP_BOOLEAN, PROP_NONE);
1581 RNA_def_property_boolean_sdna(prop, NULL, "proportional_objects", 0);
1582 RNA_def_property_ui_text(prop, "Proportional Editing Objects", "Proportional editing object mode");
1583 RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1);
1584 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1586 prop = RNA_def_property(srna, "use_proportional_edit_mask", PROP_BOOLEAN, PROP_NONE);
1587 RNA_def_property_boolean_sdna(prop, NULL, "proportional_mask", 0);
1588 RNA_def_property_ui_text(prop, "Proportional Editing Objects", "Proportional editing mask mode");
1589 RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1);
1590 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1592 prop = RNA_def_property(srna, "proportional_edit_falloff", PROP_ENUM, PROP_NONE);
1593 RNA_def_property_enum_sdna(prop, NULL, "prop_mode");
1594 RNA_def_property_enum_items(prop, proportional_falloff_items);
1595 RNA_def_property_ui_text(prop, "Proportional Editing Falloff", "Falloff type for proportional editing mode");
1596 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1598 prop = RNA_def_property(srna, "proportional_size", PROP_FLOAT, PROP_DISTANCE);
1599 RNA_def_property_float_sdna(prop, NULL, "proportional_size");
1600 RNA_def_property_ui_text(prop, "Proportional Size", "Display size for proportional editing circle");
1601 RNA_def_property_range(prop, 0.00001, 5000.0);
1603 prop = RNA_def_property(srna, "normal_size", PROP_FLOAT, PROP_DISTANCE);
1604 RNA_def_property_float_sdna(prop, NULL, "normalsize");
1605 RNA_def_property_ui_text(prop, "Normal Size", "Display size for normals in the 3D view");
1606 RNA_def_property_range(prop, 0.00001, 1000.0);
1607 RNA_def_property_ui_range(prop, 0.01, 10.0, 10.0, 2);
1608 RNA_def_property_update(prop, NC_GEOM | ND_DATA, NULL);
1610 prop = RNA_def_property(srna, "double_threshold", PROP_FLOAT, PROP_DISTANCE);
1611 RNA_def_property_float_sdna(prop, NULL, "doublimit");
1612 RNA_def_property_ui_text(prop, "Double Threshold", "Limit for removing duplicates and 'Auto Merge'");
1613 RNA_def_property_range(prop, 0.0, 1.0);
1614 RNA_def_property_ui_range(prop, 0.0, 0.1, 0.01, 6);
1616 prop = RNA_def_property(srna, "use_mesh_automerge", PROP_BOOLEAN, PROP_NONE);
1617 RNA_def_property_boolean_sdna(prop, NULL, "automerge", 0);
1618 RNA_def_property_ui_text(prop, "AutoMerge Editing", "Automatically merge vertices moved to the same location");
1620 prop = RNA_def_property(srna, "use_snap", PROP_BOOLEAN, PROP_NONE);
1621 RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP);
1622 RNA_def_property_ui_text(prop, "Snap", "Snap during transform");
1623 RNA_def_property_ui_icon(prop, ICON_SNAP_OFF, 1);
1624 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1626 prop = RNA_def_property(srna, "use_snap_align_rotation", PROP_BOOLEAN, PROP_NONE);
1627 RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_ROTATE);
1628 RNA_def_property_ui_text(prop, "Snap Align Rotation", "Align rotation with the snapping target");
1629 RNA_def_property_ui_icon(prop, ICON_SNAP_NORMAL, 0);
1630 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1632 prop = RNA_def_property(srna, "snap_element", PROP_ENUM, PROP_NONE);
1633 RNA_def_property_enum_sdna(prop, NULL, "snap_mode");
1634 RNA_def_property_enum_items(prop, snap_element_items);
1635 RNA_def_property_ui_text(prop, "Snap Element", "Type of element to snap to");
1636 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1638 /* node editor uses own set of snap modes */
1639 prop = RNA_def_property(srna, "snap_node_element", PROP_ENUM, PROP_NONE);
1640 RNA_def_property_enum_sdna(prop, NULL, "snap_node_mode");
1641 RNA_def_property_enum_items(prop, snap_node_element_items);
1642 RNA_def_property_ui_text(prop, "Snap Node Element", "Type of element to snap to");
1643 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1645 prop = RNA_def_property(srna, "snap_target", PROP_ENUM, PROP_NONE);
1646 RNA_def_property_enum_sdna(prop, NULL, "snap_target");
1647 RNA_def_property_enum_items(prop, snap_target_items);
1648 RNA_def_property_ui_text(prop, "Snap Target", "Which part to snap onto the target");
1649 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1651 prop = RNA_def_property(srna, "use_snap_peel_object", PROP_BOOLEAN, PROP_NONE);
1652 RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_PEEL_OBJECT);
1653 RNA_def_property_ui_text(prop, "Snap Peel Object", "Consider objects as whole when finding volume center");
1654 RNA_def_property_ui_icon(prop, ICON_SNAP_PEEL_OBJECT, 0);
1655 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1657 prop = RNA_def_property(srna, "use_snap_project", PROP_BOOLEAN, PROP_NONE);
1658 RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_PROJECT);
1659 RNA_def_property_ui_text(prop, "Project Individual Elements",
1660 "Project individual elements on the surface of other objects");
1661 RNA_def_property_ui_icon(prop, ICON_RETOPO, 0);
1662 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1664 prop = RNA_def_property(srna, "use_snap_self", PROP_BOOLEAN, PROP_NONE);
1665 RNA_def_property_boolean_negative_sdna(prop, NULL, "snap_flag", SCE_SNAP_NO_SELF);
1666 RNA_def_property_ui_text(prop, "Project to Self", "Snap onto itself (editmode)");
1667 RNA_def_property_ui_icon(prop, ICON_ORTHO, 0);
1668 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1671 prop = RNA_def_property(srna, "use_grease_pencil_sessions", PROP_BOOLEAN, PROP_NONE);
1672 RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_PAINTSESSIONS_ON);
1673 RNA_def_property_ui_text(prop, "Use Sketching Sessions",
1674 "Allow drawing multiple strokes at a time with Grease Pencil");
1675 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* xxx: need toolbar to be redrawn... */
1678 prop = RNA_def_property(srna, "use_keyframe_insert_auto", PROP_BOOLEAN, PROP_NONE);
1679 RNA_def_property_boolean_sdna(prop, NULL, "autokey_mode", AUTOKEY_ON);
1680 RNA_def_property_ui_text(prop, "Auto Keying", "Automatic keyframe insertion for Objects and Bones");
1681 RNA_def_property_ui_icon(prop, ICON_REC, 0);
1683 prop = RNA_def_property(srna, "auto_keying_mode", PROP_ENUM, PROP_NONE);
1684 RNA_def_property_enum_bitflag_sdna(prop, NULL, "autokey_mode");
1685 RNA_def_property_enum_items(prop, auto_key_items);
1686 RNA_def_property_ui_text(prop, "Auto-Keying Mode", "Mode of automatic keyframe insertion for Objects and Bones");
1688 prop = RNA_def_property(srna, "use_record_with_nla", PROP_BOOLEAN, PROP_NONE);
1689 RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", ANIMRECORD_FLAG_WITHNLA);
1690 RNA_def_property_ui_text(prop, "Layered",
1691 "Add a new NLA Track + Strip for every loop/pass made over the animation "
1692 "to allow non-destructive tweaking");
1694 prop = RNA_def_property(srna, "use_keyframe_insert_keyingset", PROP_BOOLEAN, PROP_NONE);
1695 RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_ONLYKEYINGSET);
1696 RNA_def_property_ui_text(prop, "Auto Keyframe Insert Keying Set",
1697 "Automatic keyframe insertion using active Keying Set only");
1698 RNA_def_property_ui_icon(prop, ICON_KEYINGSET, 0);
1701 prop = RNA_def_property(srna, "uv_select_mode", PROP_ENUM, PROP_NONE);
1702 RNA_def_property_enum_sdna(prop, NULL, "uv_selectmode");
1703 RNA_def_property_enum_items(prop, uv_select_mode_items);
1704 RNA_def_property_ui_text(prop, "UV Selection Mode", "UV selection and display mode");
1705 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
1707 prop = RNA_def_property(srna, "use_uv_select_sync", PROP_BOOLEAN, PROP_NONE);
1708 RNA_def_property_boolean_sdna(prop, NULL, "uv_flag", UV_SYNC_SELECTION);
1709 RNA_def_property_ui_text(prop, "UV Sync Selection", "Keep UV and edit mode mesh selection in sync");
1710 RNA_def_property_ui_icon(prop, ICON_EDIT, 0);
1711 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
1713 prop = RNA_def_property(srna, "show_uv_local_view", PROP_BOOLEAN, PROP_NONE);
1714 RNA_def_property_boolean_sdna(prop, NULL, "uv_flag", UV_SHOW_SAME_IMAGE);
1715 RNA_def_property_ui_text(prop, "UV Local View", "Draw only faces with the currently displayed image assigned");
1716 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
1719 prop = RNA_def_property(srna, "mesh_select_mode", PROP_BOOLEAN, PROP_NONE);
1720 RNA_def_property_boolean_sdna(prop, NULL, "selectmode", 1);
1721 RNA_def_property_array(prop, 3);
1722 RNA_def_property_boolean_funcs(prop, NULL, "rna_Scene_editmesh_select_mode_set");
1723 RNA_def_property_ui_text(prop, "Mesh Selection Mode", "Which mesh elements selection works on");
1724 RNA_def_property_update(prop, 0, "rna_Scene_editmesh_select_mode_update");
1726 prop = RNA_def_property(srna, "vertex_group_weight", PROP_FLOAT, PROP_FACTOR);
1727 RNA_def_property_float_sdna(prop, NULL, "vgroup_weight");
1728 RNA_def_property_ui_text(prop, "Vertex Group Weight", "Weight to assign in vertex groups");
1730 /* use with MESH_OT_select_shortest_path */
1731 prop = RNA_def_property(srna, "edge_path_mode", PROP_ENUM, PROP_NONE);
1732 RNA_def_property_enum_sdna(prop, NULL, "edge_mode");
1733 RNA_def_property_enum_items(prop, edge_tag_items);
1734 RNA_def_property_ui_text(prop, "Edge Tag Mode", "The edge flag to tag when selecting the shortest path");
1736 prop = RNA_def_property(srna, "edge_path_live_unwrap", PROP_BOOLEAN, PROP_NONE);
1737 RNA_def_property_boolean_sdna(prop, NULL, "edge_mode_live_unwrap", 1);
1738 RNA_def_property_ui_text(prop, "Live Unwrap", "Changing edges seam re-calculates UV unwrap");
1741 prop = RNA_def_property(srna, "use_bone_sketching", PROP_BOOLEAN, PROP_NONE);
1742 RNA_def_property_boolean_sdna(prop, NULL, "bone_sketching", BONE_SKETCHING);
1743 RNA_def_property_ui_text(prop, "Use Bone Sketching", "DOC BROKEN");
1744 /* RNA_def_property_ui_icon(prop, ICON_EDIT, 0); */
1746 prop = RNA_def_property(srna, "use_etch_quick", PROP_BOOLEAN, PROP_NONE);
1747 RNA_def_property_boolean_sdna(prop, NULL, "bone_sketching", BONE_SKETCHING_QUICK);
1748 RNA_def_property_ui_text(prop, "Quick Sketching", "DOC BROKEN");
1750 prop = RNA_def_property(srna, "use_etch_overdraw", PROP_BOOLEAN, PROP_NONE);
1751 RNA_def_property_boolean_sdna(prop, NULL, "bone_sketching", BONE_SKETCHING_ADJUST);
1752 RNA_def_property_ui_text(prop, "Overdraw Sketching", "DOC BROKEN");
1754 prop = RNA_def_property(srna, "use_etch_autoname", PROP_BOOLEAN, PROP_NONE);
1755 RNA_def_property_boolean_sdna(prop, NULL, "skgen_retarget_options", SK_RETARGET_AUTONAME);
1756 RNA_def_property_ui_text(prop, "Autoname", "DOC BROKEN");
1758 prop = RNA_def_property(srna, "etch_number", PROP_STRING, PROP_NONE);
1759 RNA_def_property_string_sdna(prop, NULL, "skgen_num_string");
1760 RNA_def_property_ui_text(prop, "Number", "DOC BROKEN");
1762 prop = RNA_def_property(srna, "etch_side", PROP_STRING, PROP_NONE);
1763 RNA_def_property_string_sdna(prop, NULL, "skgen_num_string");
1764 RNA_def_property_ui_text(prop, "Side", "DOC BROKEN");
1766 prop = RNA_def_property(srna, "etch_template", PROP_POINTER, PROP_NONE);
1767 RNA_def_property_pointer_sdna(prop, NULL, "skgen_template");
1768 RNA_def_property_flag(prop, PROP_EDITABLE);
1769 RNA_def_property_struct_type(prop, "Object");
1770 RNA_def_property_pointer_funcs(prop, NULL, "rna_Scene_skgen_etch_template_set", NULL, NULL);
1771 RNA_def_property_ui_text(prop, "Template", "Template armature that will be retargeted to the stroke");
1773 prop = RNA_def_property(srna, "etch_subdivision_number", PROP_INT, PROP_NONE);
1774 RNA_def_property_int_sdna(prop, NULL, "skgen_subdivision_number");
1775 RNA_def_property_range(prop, 1, 255);
1776 RNA_def_property_ui_text(prop, "Subdivisions", "Number of bones in the subdivided stroke");
1777 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
1779 prop = RNA_def_property(srna, "etch_adaptive_limit", PROP_FLOAT, PROP_FACTOR);
1780 RNA_def_property_float_sdna(prop, NULL, "skgen_correlation_limit");
1781 RNA_def_property_range(prop, 0.00001, 1.0);
1782 RNA_def_property_ui_range(prop, 0.01, 1.0, 0.01, 2);
1783 RNA_def_property_ui_text(prop, "Limit", "Number of bones in the subdivided stroke");
1784 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
1786 prop = RNA_def_property(srna, "etch_length_limit", PROP_FLOAT, PROP_DISTANCE);
1787 RNA_def_property_float_sdna(prop, NULL, "skgen_length_limit");
1788 RNA_def_property_range(prop, 0.00001, 100000.0);
1789 RNA_def_property_ui_range(prop, 0.001, 100.0, 0.1, 3);
1790 RNA_def_property_ui_text(prop, "Length", "Number of bones in the subdivided stroke");
1791 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
1793 prop = RNA_def_property(srna, "etch_roll_mode", PROP_ENUM, PROP_NONE);
1794 RNA_def_property_enum_bitflag_sdna(prop, NULL, "skgen_retarget_roll");
1795 RNA_def_property_enum_items(prop, retarget_roll_items);
1796 RNA_def_property_ui_text(prop, "Retarget roll mode", "Method used to adjust the roll of bones when retargeting");
1798 prop = RNA_def_property(srna, "etch_convert_mode", PROP_ENUM, PROP_NONE);
1799 RNA_def_property_enum_bitflag_sdna(prop, NULL, "bone_sketching_convert");
1800 RNA_def_property_enum_items(prop, sketch_convert_items);
1801 RNA_def_property_ui_text(prop, "Stroke conversion method", "Method used to convert stroke to bones");
1802 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
1804 /* Unified Paint Settings */
1805 prop = RNA_def_property(srna, "unified_paint_settings", PROP_POINTER, PROP_NONE);
1806 RNA_def_property_flag(prop, PROP_NEVER_NULL);
1807 RNA_def_property_struct_type(prop, "UnifiedPaintSettings");
1808 RNA_def_property_ui_text(prop, "Unified Paint Settings", NULL);
1811 static void rna_def_unified_paint_settings(BlenderRNA *brna)
1816 srna = RNA_def_struct(brna, "UnifiedPaintSettings", NULL);
1817 RNA_def_struct_ui_text(srna, "Unified Paint Settings", "Overrides for some of the active brush's settings");
1819 /* high-level flags to enable or disable unified paint settings */
1820 prop = RNA_def_property(srna, "use_unified_size", PROP_BOOLEAN, PROP_NONE);
1821 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_SIZE);
1822 RNA_def_property_ui_text(prop, "Use Unified Radius",
1823 "Instead of per-brush radius, the radius is shared across brushes");
1825 prop = RNA_def_property(srna, "use_unified_strength", PROP_BOOLEAN, PROP_NONE);
1826 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_ALPHA);
1827 RNA_def_property_ui_text(prop, "Use Unified Strength",
1828 "Instead of per-brush strength, the strength is shared across brushes");
1830 prop = RNA_def_property(srna, "use_unified_weight", PROP_BOOLEAN, PROP_NONE);
1831 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_WEIGHT);
1832 RNA_def_property_ui_text(prop, "Use Unified Weight",
1833 "Instead of per-brush weight, the weight is shared across brushes");
1835 /* unified paint settings that override the equivalent settings
1836 * from the active brush */
1837 prop = RNA_def_property(srna, "size", PROP_INT, PROP_DISTANCE);
1838 RNA_def_property_int_funcs(prop, NULL, "rna_UnifiedPaintSettings_size_set", NULL);
1839 RNA_def_property_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS * 10);
1840 RNA_def_property_ui_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS, 1, 0);
1841 RNA_def_property_ui_text(prop, "Radius", "Radius of the brush in pixels");
1843 prop = RNA_def_property(srna, "unprojected_radius", PROP_FLOAT, PROP_DISTANCE);
1844 RNA_def_property_float_funcs(prop, NULL, "rna_UnifiedPaintSettings_unprojected_radius_set", NULL);
1845 RNA_def_property_range(prop, 0.001, FLT_MAX);
1846 RNA_def_property_ui_range(prop, 0.001, 1, 0, 0);
1847 RNA_def_property_ui_text(prop, "Unprojected Radius", "Radius of brush in Blender units");
1849 prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
1850 RNA_def_property_float_sdna(prop, NULL, "alpha");
1851 RNA_def_property_float_default(prop, 0.5f);
1852 RNA_def_property_range(prop, 0.0f, 10.0f);
1853 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
1854 RNA_def_property_ui_text(prop, "Strength", "How powerful the effect of the brush is when applied");
1856 prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_FACTOR);
1857 RNA_def_property_float_sdna(prop, NULL, "weight");
1858 RNA_def_property_float_default(prop, 0.5f);
1859 RNA_def_property_range(prop, 0.0f, 1.0f);
1860 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
1861 RNA_def_property_ui_text(prop, "Weight", "Weight to assign in vertex groups");
1863 prop = RNA_def_property(srna, "use_pressure_size", PROP_BOOLEAN, PROP_NONE);
1864 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_BRUSH_SIZE_PRESSURE);
1865 RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
1866 RNA_def_property_ui_text(prop, "Size Pressure", "Enable tablet pressure sensitivity for size");
1868 prop = RNA_def_property(srna, "use_pressure_strength", PROP_BOOLEAN, PROP_NONE);
1869 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_BRUSH_ALPHA_PRESSURE);
1870 RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
1871 RNA_def_property_ui_text(prop, "Strength Pressure", "Enable tablet pressure sensitivity for strength");
1873 prop = RNA_def_property(srna, "use_locked_size", PROP_BOOLEAN, PROP_NONE);
1874 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_BRUSH_LOCK_SIZE);
1875 RNA_def_property_ui_text(prop, "Use Blender Units",
1876 "When locked brush stays same size relative to object; "
1877 "when unlocked brush size is given in pixels");
1880 static void rna_def_unit_settings(BlenderRNA *brna)
1885 static EnumPropertyItem unit_systems[] = {
1886 {USER_UNIT_NONE, "NONE", 0, "None", ""},
1887 {USER_UNIT_METRIC, "METRIC", 0, "Metric", ""},
1888 {USER_UNIT_IMPERIAL, "IMPERIAL", 0, "Imperial", ""},
1889 {0, NULL, 0, NULL, NULL}
1892 static EnumPropertyItem rotation_units[] = {
1893 {0, "DEGREES", 0, "Degrees", "Use degrees for measuring angles and rotations"},
1894 {USER_UNIT_ROT_RADIANS, "RADIANS", 0, "Radians", ""},
1895 {0, NULL, 0, NULL, NULL}
1898 srna = RNA_def_struct(brna, "UnitSettings", NULL);
1899 RNA_def_struct_ui_text(srna, "Unit Settings", "");
1902 prop = RNA_def_property(srna, "system", PROP_ENUM, PROP_NONE);
1903 RNA_def_property_enum_items(prop, unit_systems);
1904 RNA_def_property_ui_text(prop, "Unit System", "The unit system to use for button display");
1905 RNA_def_property_update(prop, NC_WINDOW, NULL);
1907 prop = RNA_def_property(srna, "system_rotation", PROP_ENUM, PROP_NONE);
1908 RNA_def_property_enum_items(prop, rotation_units);
1909 RNA_def_property_ui_text(prop, "Rotation Units", "Unit to use for displaying/editing rotation values");
1910 RNA_def_property_update(prop, NC_WINDOW, NULL);
1912 prop = RNA_def_property(srna, "scale_length", PROP_FLOAT, PROP_UNSIGNED);
1913 RNA_def_property_ui_text(prop, "Unit Scale", "Scale to use when converting between blender units and dimensions");
1914 RNA_def_property_range(prop, 0.00001, 100000.0);
1915 RNA_def_property_ui_range(prop, 0.001, 100.0, 0.1, 3);
1916 RNA_def_property_update(prop, NC_WINDOW, NULL);
1918 prop = RNA_def_property(srna, "use_separate", PROP_BOOLEAN, PROP_NONE);
1919 RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_UNIT_OPT_SPLIT);
1920 RNA_def_property_ui_text(prop, "Separate Units", "Display units in pairs (e.g. 1m 0cm)");
1921 RNA_def_property_update(prop, NC_WINDOW, NULL);
1924 void rna_def_render_layer_common(StructRNA *srna, int scene)
1928 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1929 if (scene) RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SceneRenderLayer_name_set");
1930 else RNA_def_property_string_sdna(prop, NULL, "name");
1931 RNA_def_property_ui_text(prop, "Name", "Render layer name");
1932 RNA_def_struct_name_property(srna, prop);
1933 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
1934 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1936 prop = RNA_def_property(srna, "material_override", PROP_POINTER, PROP_NONE);
1937 RNA_def_property_pointer_sdna(prop, NULL, "mat_override");
1938 RNA_def_property_struct_type(prop, "Material");
1939 RNA_def_property_flag(prop, PROP_EDITABLE);
1940 RNA_def_property_ui_text(prop, "Material Override",
1941 "Material to override all other materials in this render layer");
1942 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
1943 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1945 prop = RNA_def_property(srna, "light_override", PROP_POINTER, PROP_NONE);
1946 RNA_def_property_pointer_sdna(prop, NULL, "light_override");
1947 RNA_def_property_struct_type(prop, "Group");
1948 RNA_def_property_flag(prop, PROP_EDITABLE);
1949 RNA_def_property_ui_text(prop, "Light Override", "Group to override all other lights in this render layer");
1950 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
1951 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1954 prop = RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
1955 RNA_def_property_boolean_sdna(prop, NULL, "lay", 1);
1956 RNA_def_property_array(prop, 20);
1957 RNA_def_property_ui_text(prop, "Visible Layers", "Scene layers included in this render layer");
1958 if (scene) RNA_def_property_boolean_funcs(prop, NULL, "rna_SceneRenderLayer_layer_set");
1959 else RNA_def_property_boolean_funcs(prop, NULL, "rna_RenderLayer_layer_set");
1960 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
1961 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1963 prop = RNA_def_property(srna, "layers_zmask", PROP_BOOLEAN, PROP_LAYER);
1964 RNA_def_property_boolean_sdna(prop, NULL, "lay_zmask", 1);
1965 RNA_def_property_array(prop, 20);
1966 RNA_def_property_ui_text(prop, "Zmask Layers", "Zmask scene layers for solid faces");
1967 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
1968 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1970 prop = RNA_def_property(srna, "layers_exclude", PROP_BOOLEAN, PROP_LAYER);
1971 RNA_def_property_boolean_sdna(prop, NULL, "lay_exclude", 1);
1972 RNA_def_property_array(prop, 20);
1973 RNA_def_property_ui_text(prop, "Exclude Layers", "Exclude scene layers from having any influence");
1974 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
1975 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1978 prop = RNA_def_property(srna, "samples", PROP_INT, PROP_UNSIGNED);
1979 RNA_def_property_ui_text(prop, "Samples", "Override number of render samples for this render layer, 0 will use the scene setting");
1980 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
1984 prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
1985 RNA_def_property_boolean_negative_sdna(prop, NULL, "layflag", SCE_LAY_DISABLE);
1986 RNA_def_property_ui_text(prop, "Enabled", "Disable or enable the render layer");
1987 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
1988 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1990 prop = RNA_def_property(srna, "use_zmask", PROP_BOOLEAN, PROP_NONE);
1991 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ZMASK);
1992 RNA_def_property_ui_text(prop, "Zmask", "Only render what's in front of the solid z values");
1993 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
1994 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1996 prop = RNA_def_property(srna, "invert_zmask", PROP_BOOLEAN, PROP_NONE);
1997 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_NEG_ZMASK);
1998 RNA_def_property_ui_text(prop, "Zmask Negate",
1999 "For Zmask, only render what is behind solid z values instead of in front");
2000 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
2001 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2003 prop = RNA_def_property(srna, "use_all_z", PROP_BOOLEAN, PROP_NONE);
2004 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ALL_Z);
2005 RNA_def_property_ui_text(prop, "All Z", "Fill in Z values for solid faces in invisible layers, for masking");
2006 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2007 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2009 prop = RNA_def_property(srna, "use_solid", PROP_BOOLEAN, PROP_NONE);
2010 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_SOLID);
2011 RNA_def_property_ui_text(prop, "Solid", "Render Solid faces in this Layer");
2012 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2013 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2015 prop = RNA_def_property(srna, "use_halo", PROP_BOOLEAN, PROP_NONE);
2016 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_HALO);
2017 RNA_def_property_ui_text(prop, "Halo", "Render Halos in this Layer (on top of Solid)");
2018 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2019 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2021 prop = RNA_def_property(srna, "use_ztransp", PROP_BOOLEAN, PROP_NONE);
2022 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ZTRA);
2023 RNA_def_property_ui_text(prop, "ZTransp", "Render Z-Transparent faces in this Layer (on top of Solid and Halos)");
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_sky", PROP_BOOLEAN, PROP_NONE);
2028 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_SKY);
2029 RNA_def_property_ui_text(prop, "Sky", "Render Sky in this Layer");
2030 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
2031 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2033 prop = RNA_def_property(srna, "use_edge_enhance", PROP_BOOLEAN, PROP_NONE);
2034 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_EDGE);
2035 RNA_def_property_ui_text(prop, "Edge", "Render Edge-enhance in this Layer (only works for Solid faces)");
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_strand", PROP_BOOLEAN, PROP_NONE);
2040 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_STRAND);
2041 RNA_def_property_ui_text(prop, "Strand", "Render Strands in this Layer");
2042 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2043 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2046 prop = RNA_def_property(srna, "use_pass_combined", PROP_BOOLEAN, PROP_NONE);
2047 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_COMBINED);
2048 RNA_def_property_ui_text(prop, "Combined", "Deliver full combined RGBA buffer");
2049 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2050 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2052 prop = RNA_def_property(srna, "use_pass_z", PROP_BOOLEAN, PROP_NONE);
2053 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_Z);
2054 RNA_def_property_ui_text(prop, "Z", "Deliver Z values pass");
2055 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2056 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2058 prop = RNA_def_property(srna, "use_pass_vector", PROP_BOOLEAN, PROP_NONE);
2059 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_VECTOR);
2060 RNA_def_property_ui_text(prop, "Vector", "Deliver speed vector pass");
2061 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2062 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2064 prop = RNA_def_property(srna, "use_pass_normal", PROP_BOOLEAN, PROP_NONE);
2065 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_NORMAL);
2066 RNA_def_property_ui_text(prop, "Normal", "Deliver normal pass");
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_uv", PROP_BOOLEAN, PROP_NONE);
2071 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_UV);
2072 RNA_def_property_ui_text(prop, "UV", "Deliver texture UV 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_mist", PROP_BOOLEAN, PROP_NONE);
2077 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_MIST);
2078 RNA_def_property_ui_text(prop, "Mist", "Deliver mist factor pass (0.0-1.0)");
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_object_index", PROP_BOOLEAN, PROP_NONE);
2083 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_INDEXOB);
2084 RNA_def_property_ui_text(prop, "Object Index", "Deliver object index 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_material_index", PROP_BOOLEAN, PROP_NONE);
2089 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_INDEXMA);
2090 RNA_def_property_ui_text(prop, "Material Index", "Deliver material index 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_color", PROP_BOOLEAN, PROP_NONE);
2095 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_RGBA);
2096 RNA_def_property_ui_text(prop, "Color", "Deliver shade-less color pass");
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_diffuse", PROP_BOOLEAN, PROP_NONE);
2101 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE);
2102 RNA_def_property_ui_text(prop, "Diffuse", "Deliver diffuse 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_specular", PROP_BOOLEAN, PROP_NONE);
2107 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SPEC);
2108 RNA_def_property_ui_text(prop, "Specular", "Deliver specular 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_shadow", PROP_BOOLEAN, PROP_NONE);
2113 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SHADOW);
2114 RNA_def_property_ui_text(prop, "Shadow", "Deliver shadow 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_ambient_occlusion", PROP_BOOLEAN, PROP_NONE);
2119 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_AO);
2120 RNA_def_property_ui_text(prop, "AO", "Deliver AO 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_reflection", PROP_BOOLEAN, PROP_NONE);
2125 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_REFLECT);
2126 RNA_def_property_ui_text(prop, "Reflection", "Deliver raytraced reflection 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_refraction", PROP_BOOLEAN, PROP_NONE);
2131 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_REFRACT);
2132 RNA_def_property_ui_text(prop, "Refraction", "Deliver raytraced refraction 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_emit", PROP_BOOLEAN, PROP_NONE);
2137 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_EMIT);
2138 RNA_def_property_ui_text(prop, "Emit", "Deliver emission 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_environment", PROP_BOOLEAN, PROP_NONE);
2143 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_ENVIRONMENT);
2144 RNA_def_property_ui_text(prop, "Environment", "Deliver environment lighting 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_indirect", PROP_BOOLEAN, PROP_NONE);
2149 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_INDIRECT);
2150 RNA_def_property_ui_text(prop, "Indirect", "Deliver indirect lighting 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, "exclude_specular", PROP_BOOLEAN, PROP_NONE);
2155 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_SPEC);
2156 RNA_def_property_ui_text(prop, "Specular Exclude", "Exclude specular pass from combined");
2157 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2158 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2159 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2161 prop = RNA_def_property(srna, "exclude_shadow", PROP_BOOLEAN, PROP_NONE);
2162 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_SHADOW);
2163 RNA_def_property_ui_text(prop, "Shadow Exclude", "Exclude shadow pass from combined");
2164 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2165 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2166 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2168 prop = RNA_def_property(srna, "exclude_ambient_occlusion", PROP_BOOLEAN, PROP_NONE);
2169 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_AO);
2170 RNA_def_property_ui_text(prop, "AO Exclude", "Exclude AO pass from combined");
2171 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2172 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2173 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2175 prop = RNA_def_property(srna, "exclude_reflection", PROP_BOOLEAN, PROP_NONE);
2176 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_REFLECT);
2177 RNA_def_property_ui_text(prop, "Reflection Exclude", "Exclude raytraced reflection pass from combined");
2178 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2179 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2180 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2182 prop = RNA_def_property(srna, "exclude_refraction", PROP_BOOLEAN, PROP_NONE);
2183 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_REFRACT);
2184 RNA_def_property_ui_text(prop, "Refraction Exclude", "Exclude raytraced refraction pass from combined");
2185 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2186 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2187 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2189 prop = RNA_def_property(srna, "exclude_emit", PROP_BOOLEAN, PROP_NONE);
2190 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_EMIT);
2191 RNA_def_property_ui_text(prop, "Emit Exclude", "Exclude emission pass from combined");
2192 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2193 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2194 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2196 prop = RNA_def_property(srna, "exclude_environment", PROP_BOOLEAN, PROP_NONE);
2197 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_ENVIRONMENT);
2198 RNA_def_property_ui_text(prop, "Environment Exclude", "Exclude environment pass from combined");
2199 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2200 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2201 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2203 prop = RNA_def_property(srna, "exclude_indirect", PROP_BOOLEAN, PROP_NONE);
2204 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_INDIRECT);
2205 RNA_def_property_ui_text(prop, "Indirect Exclude", "Exclude indirect pass from combined");
2206 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2207 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2208 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2210 prop = RNA_def_property(srna, "use_pass_diffuse_direct", PROP_BOOLEAN, PROP_NONE);
2211 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE_DIRECT);
2212 RNA_def_property_ui_text(prop, "Diffuse Direct", "Deliver diffuse direct pass");
2213 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2214 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2216 prop = RNA_def_property(srna, "use_pass_diffuse_indirect", PROP_BOOLEAN, PROP_NONE);
2217 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE_INDIRECT);
2218 RNA_def_property_ui_text(prop, "Diffuse Indirect", "Deliver diffuse indirect pass");
2219 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2220 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2222 prop = RNA_def_property(srna, "use_pass_diffuse_color", PROP_BOOLEAN, PROP_NONE);
2223 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE_COLOR);
2224 RNA_def_property_ui_text(prop, "Diffuse Color", "Deliver diffuse color pass");
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_glossy_direct", PROP_BOOLEAN, PROP_NONE);
2229 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_GLOSSY_DIRECT);
2230 RNA_def_property_ui_text(prop, "Glossy Direct", "Deliver glossy 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_glossy_indirect", PROP_BOOLEAN, PROP_NONE);
2235 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_GLOSSY_INDIRECT);
2236 RNA_def_property_ui_text(prop, "Glossy Indirect", "Deliver glossy 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_glossy_color", PROP_BOOLEAN, PROP_NONE);
2241 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_GLOSSY_COLOR);
2242 RNA_def_property_ui_text(prop, "Glossy Color", "Deliver glossy 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_transmission_direct", PROP_BOOLEAN, PROP_NONE);
2247 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_TRANSM_DIRECT);
2248 RNA_def_property_ui_text(prop, "Transmission Direct", "Deliver transmission 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_transmission_indirect", PROP_BOOLEAN, PROP_NONE);
2253 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_TRANSM_INDIRECT);
2254 RNA_def_property_ui_text(prop, "Transmission Indirect", "Deliver transmission 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_transmission_color", PROP_BOOLEAN, PROP_NONE);
2259 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_TRANSM_COLOR);
2260 RNA_def_property_ui_text(prop, "Transmission Color", "Deliver transmission 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);
2265 static void rna_def_scene_game_recast_data(BlenderRNA *brna)
2270 srna = RNA_def_struct(brna, "SceneGameRecastData", NULL);
2271 RNA_def_struct_sdna(srna, "RecastData");
2272 RNA_def_struct_nested(brna, srna, "Scene");
2273 RNA_def_struct_ui_text(srna, "Recast Data", "Recast data for a Game datablock");
2275 prop = RNA_def_property(srna, "cell_size", PROP_FLOAT, PROP_NONE);
2276 RNA_def_property_float_sdna(prop, NULL, "cellsize");
2277 RNA_def_property_ui_range(prop, 0.1, 1, 1, 2);
2278 RNA_def_property_ui_text(prop, "Cell Size", "Rasterized cell size");
2279 RNA_def_property_update(prop, NC_SCENE, NULL);
2281 prop = RNA_def_property(srna, "cell_height", PROP_FLOAT, PROP_NONE);
2282 RNA_def_property_float_sdna(prop, NULL, "cellheight");
2283 RNA_def_property_ui_range(prop, 0.1, 1, 1, 2);
2284 RNA_def_property_ui_text(prop, "Cell Height", "Rasterized cell height");
2285 RNA_def_property_update(prop, NC_SCENE, NULL);
2287 prop = RNA_def_property(srna, "agent_height", PROP_FLOAT, PROP_NONE);
2288 RNA_def_property_float_sdna(prop, NULL, "agentheight");
2289 RNA_def_property_ui_range(prop, 0.1, 5, 1, 2);
2290 RNA_def_property_ui_text(prop, "Agent Height", "Minimum height where the agent can still walk");
2291 RNA_def_property_update(prop, NC_SCENE, NULL);
2293 prop = RNA_def_property(srna, "agent_radius", PROP_FLOAT, PROP_NONE);
2294 RNA_def_property_float_sdna(prop, NULL, "agentradius");
2295 RNA_def_property_ui_range(prop, 0.1, 5, 1, 2);
2296 RNA_def_property_ui_text(prop, "Agent Radius", "Radius of the agent");
2297 RNA_def_property_update(prop, NC_SCENE, NULL);
2299 prop = RNA_def_property(srna, "climb_max", PROP_FLOAT, PROP_NONE);
2300 RNA_def_property_float_sdna(prop, NULL, "agentmaxclimb");
2301 RNA_def_property_ui_range(prop, 0.1, 5, 1, 2);
2302 RNA_def_property_ui_text(prop, "Max Climb", "Maximum height between grid cells the agent can climb");
2303 RNA_def_property_update(prop, NC_SCENE, NULL);
2305 prop = RNA_def_property(srna, "slope_max", PROP_FLOAT, PROP_ANGLE);
2306 RNA_def_property_float_sdna(prop, NULL, "agentmaxslope");
2307 RNA_def_property_range(prop, 0, M_PI / 2);
2308 RNA_def_property_ui_text(prop, "Max Slope", "Maximum walkable slope angle in degrees");
2309 RNA_def_property_update(prop, NC_SCENE, NULL);
2312 prop = RNA_def_property(srna, "region_min_size", PROP_FLOAT, PROP_NONE);
2313 RNA_def_property_float_sdna(prop, NULL, "regionminsize");
2314 RNA_def_property_ui_range(prop, 0, 150, 1, 2);
2315 RNA_def_property_ui_text(prop, "Min Region Size", "Minimum regions size (smaller regions will be deleted)");
2316 RNA_def_property_update(prop, NC_SCENE, NULL);
2318 prop = RNA_def_property(srna, "region_merge_size", PROP_FLOAT, PROP_NONE);
2319 RNA_def_property_float_sdna(prop, NULL, "regionmergesize");
2320 RNA_def_property_ui_range(prop, 0, 150, 1, 2);
2321 RNA_def_property_ui_text(prop, "Merged Region Size", "Minimum regions size (smaller regions will be merged)");
2322 RNA_def_property_update(prop, NC_SCENE, NULL);
2324 prop = RNA_def_property(srna, "edge_max_len", PROP_FLOAT, PROP_NONE);
2325 RNA_def_property_float_sdna(prop, NULL, "edgemaxlen");
2326 RNA_def_property_ui_range(prop, 0, 50, 1, 2);
2327 RNA_def_property_ui_text(prop, "Max Edge Length", "Maximum contour edge length");
2328 RNA_def_property_update(prop, NC_SCENE, NULL);
2330 prop = RNA_def_property(srna, "edge_max_error", PROP_FLOAT, PROP_NONE);
2331 RNA_def_property_float_sdna(prop, NULL, "edgemaxerror");
2332 RNA_def_property_ui_range(prop, 0.1, 3.0, 1, 2);
2333 RNA_def_property_ui_text(prop, "Max Edge Error", "Maximum distance error from contour to cells");
2334 RNA_def_property_update(prop, NC_SCENE, NULL);
2336 prop = RNA_def_property(srna, "verts_per_poly", PROP_INT, PROP_NONE);
2337 RNA_def_property_int_sdna(prop, NULL, "vertsperpoly");
2338 RNA_def_property_ui_range(prop, 3, 12, 1, 0);
2339 RNA_def_property_ui_text(prop, "Verts Per Poly", "Max number of vertices per polygon");
2340 RNA_def_property_update(prop, NC_SCENE, NULL);
2342 prop = RNA_def_property(srna, "sample_dist", PROP_FLOAT, PROP_NONE);
2343 RNA_def_property_float_sdna(prop, NULL, "detailsampledist");
2344 RNA_def_property_ui_range(prop, 0.0, 16.0, 1, 2);
2345 RNA_def_property_ui_text(prop, "Sample Distance", "Detail mesh sample spacing");
2346 RNA_def_property_update(prop, NC_SCENE, NULL);
2348 prop = RNA_def_property(srna, "sample_max_error", PROP_FLOAT, PROP_NONE);
2349 RNA_def_property_float_sdna(prop, NULL, "detailsamplemaxerror");
2350 RNA_def_property_ui_range(prop, 0.0, 16.0, 1, 2);
2351 RNA_def_property_ui_text(prop, "Max Sample Error", "Detail mesh simplification max sample error");
2352 RNA_def_property_update(prop, NC_SCENE, NULL);
2355 static void rna_def_scene_game_data(BlenderRNA *brna)
2360 static EnumPropertyItem aasamples_items[] = {
2361 {0, "SAMPLES_0", 0, "Off", ""},
2362 {2, "SAMPLES_2", 0, "2x", ""},
2363 {4, "SAMPLES_4", 0, "4x", ""},
2364 {8, "SAMPLES_8", 0, "8x", ""},
2365 {16, "SAMPLES_16", 0, "16x", ""},
2366 {0, NULL, 0, NULL, NULL}
2369 static EnumPropertyItem framing_types_items[] = {
2370 {SCE_GAMEFRAMING_BARS, "LETTERBOX", 0, "Letterbox",
2371 "Show the entire viewport in the display window, using bar horizontally or vertically"},
2372 {SCE_GAMEFRAMING_EXTEND, "EXTEND", 0, "Extend",
2373 "Show the entire viewport in the display window, viewing more horizontally "
2375 {SCE_GAMEFRAMING_SCALE, "SCALE", 0, "Scale", "Stretch or squeeze the viewport to fill the display window"},
2376 {0, NULL, 0, NULL, NULL}
2379 static EnumPropertyItem dome_modes_items[] = {
2380 {DOME_FISHEYE, "FISHEYE", 0, "Fisheye", ""},
2381 {DOME_TRUNCATED_FRONT, "TRUNCATED_FRONT", 0, "Front-Truncated", ""},
2382 {DOME_TRUNCATED_REAR, "TRUNCATED_REAR", 0, "Rear-Truncated", ""},
2383 {DOME_ENVMAP, "ENVMAP", 0, "Cube Map", ""},
2384 {DOME_PANORAM_SPH, "PANORAM_SPH", 0, "Spherical Panoramic", ""},
2385 {0, NULL, 0, NULL, NULL}
2388 static EnumPropertyItem stereo_modes_items[] = {
2389 {STEREO_QUADBUFFERED, "QUADBUFFERED", 0, "Quad-Buffer", ""},
2390 {STEREO_ABOVEBELOW, "ABOVEBELOW", 0, "Above-Below", ""},
2391 {STEREO_INTERLACED, "INTERLACED", 0, "Interlaced", ""},
2392 {STEREO_ANAGLYPH, "ANAGLYPH", 0, "Anaglyph", ""},
2393 {STEREO_SIDEBYSIDE, "SIDEBYSIDE", 0, "Side-by-side", ""},
2394 {STEREO_VINTERLACE, "VINTERLACE", 0, "Vinterlace", ""},
2395 {0, NULL, 0, NULL, NULL}
2398 static EnumPropertyItem stereo_items[] = {
2399 {STEREO_NOSTEREO, "NONE", 0, "None", "Disable Stereo and Dome environments"},
2400 {STEREO_ENABLED, "STEREO", 0, "Stereo", "Enable Stereo environment"},
2401 {STEREO_DOME, "DOME", 0, "Dome", "Enable Dome environment"},
2402 {0, NULL, 0, NULL, NULL}
2405 static EnumPropertyItem physics_engine_items[] = {
2406 {WOPHY_NONE, "NONE", 0, "None", "Don't use a physics engine"},
2407 /*{WOPHY_ENJI, "ENJI", 0, "Enji", ""}, */
2408 /*{WOPHY_SUMO, "SUMO", 0, "Sumo (Deprecated)", ""}, */
2409 /*{WOPHY_DYNAMO, "DYNAMO", 0, "Dynamo", ""}, */
2410 /*{WOPHY_ODE, "ODE", 0, "ODE", ""}, */
2411 {WOPHY_BULLET, "BULLET", 0, "Bullet", "Use the Bullet physics engine"},
2412 {0, NULL, 0, NULL, NULL}
2415 static EnumPropertyItem material_items[] = {
2416 {GAME_MAT_TEXFACE, "SINGLETEXTURE", 0, "Singletexture", "Singletexture face materials"},
2417 {GAME_MAT_MULTITEX, "MULTITEXTURE", 0, "Multitexture", "Multitexture materials"},
2418 {GAME_MAT_GLSL, "GLSL", 0, "GLSL", "OpenGL shading language shaders"},
2419 {0, NULL, 0, NULL, NULL}
2422 static EnumPropertyItem obstacle_simulation_items[] = {
2423 {OBSTSIMULATION_NONE, "NONE", 0, "None", ""},
2424 {OBSTSIMULATION_TOI_rays, "RVO_RAYS", 0, "RVO (rays)", ""},
2425 {OBSTSIMULATION_TOI_cells, "RVO_CELLS", 0, "RVO (cells)", ""},
2426 {0, NULL, 0, NULL, NULL}
2429 srna = RNA_def_struct(brna, "SceneGameData", NULL);
2430 RNA_def_struct_sdna(srna, "GameData");
2431 RNA_def_struct_nested(brna, srna, "Scene");
2432 RNA_def_struct_ui_text(srna, "Game Data", "Game data for a Scene datablock");
2434 prop = RNA_def_property(srna, "resolution_x", PROP_INT, PROP_NONE);
2435 RNA_def_property_int_sdna(prop, NULL, "xplay");
2436 RNA_def_property_range(prop, 4, 10000);
2437 RNA_def_property_ui_text(prop, "Resolution X", "Number of horizontal pixels in the screen");
2438 RNA_def_property_update(prop, NC_SCENE, NULL);
2440 prop = RNA_def_property(srna, "resolution_y", PROP_INT, PROP_NONE);
2441 RNA_def_property_int_sdna(prop, NULL, "yplay");
2442 RNA_def_property_range(prop, 4, 10000);
2443 RNA_def_property_ui_text(prop, "Resolution Y", "Number of vertical pixels in the screen");
2444 RNA_def_property_update(prop, NC_SCENE, NULL);
2446 prop = RNA_def_property(srna, "samples", PROP_ENUM, PROP_NONE);
2447 RNA_def_property_enum_sdna(prop, NULL, "aasamples");
2448 RNA_def_property_enum_items(prop, aasamples_items);
2449 RNA_def_property_ui_text(prop, "AA Samples", "The number of AA Samples to use for MSAA");
2451 prop = RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED);
2452 RNA_def_property_int_sdna(prop, NULL, "depth");
2453 RNA_def_property_range(prop, 8, 32);
2454 RNA_def_property_ui_text(prop, "Bits", "Display bit depth of full screen display");
2455 RNA_def_property_update(prop, NC_SCENE, NULL);
2457 prop = RNA_def_property(srna, "exit_key", PROP_ENUM, PROP_NONE);
2458 RNA_def_property_enum_sdna(prop, NULL, "exitkey");
2459 RNA_def_property_enum_items(prop, event_type_items);
2460 RNA_def_property_enum_funcs(prop, NULL, "rna_GameSettings_exit_key_set", NULL);
2461 RNA_def_property_ui_text(prop, "Exit Key", "The key that exits the Game Engine");
2462 RNA_def_property_update(prop, NC_SCENE, NULL);
2464 /* Do we need it here ? (since we already have it in World */
2465 prop = RNA_def_property(srna, "frequency", PROP_INT, PROP_NONE);
2466 RNA_def_property_int_sdna(prop, NULL, "freqplay");
2467 RNA_def_property_range(prop, 4, 2000);
2468 RNA_def_property_ui_text(prop, "Freq", "Display clock frequency of fullscreen display");
2469 RNA_def_property_update(prop, NC_SCENE, NULL);
2471 prop = RNA_def_property(srna, "show_fullscreen", PROP_BOOLEAN, PROP_NONE);
2472 RNA_def_property_boolean_sdna(prop, NULL, "playerflag", GAME_PLAYER_FULLSCREEN);
2473 RNA_def_property_ui_text(prop, "Fullscreen", "Start player in a new fullscreen display");
2474 RNA_def_property_update(prop, NC_SCENE, NULL);
2476 prop = RNA_def_property(srna, "use_desktop", PROP_BOOLEAN, PROP_NONE);
2477 RNA_def_property_boolean_sdna(prop, NULL, "playerflag", GAME_PLAYER_DESKTOP_RESOLUTION);
2478 RNA_def_property_ui_text(prop, "Desktop", "Use the current desktop resolution in fullscreen mode");
2479 RNA_def_property_update(prop, NC_SCENE, NULL);
2482 prop = RNA_def_property(srna, "frame_type", PROP_ENUM, PROP_NONE);
2483 RNA_def_property_enum_sdna(prop, NULL, "framing.type");
2484 RNA_def_property_enum_items(prop, framing_types_items);
2485 RNA_def_property_ui_text(prop, "Framing Types", "Select the type of Framing you want");
2486 RNA_def_property_update(prop, NC_SCENE, NULL);
2488 prop = RNA_def_property(srna, "frame_color", PROP_FLOAT, PROP_COLOR);
2489 RNA_def_property_float_sdna(prop, NULL, "framing.col");
2490 RNA_def_property_range(prop, 0.0f, 1.0f);
2491 RNA_def_property_array(prop, 3);
2492 RNA_def_property_ui_text(prop, "Framing Color", "Set color of the bars");
2493 RNA_def_property_update(prop, NC_SCENE, NULL);
2496 prop = RNA_def_property(srna, "stereo", PROP_ENUM, PROP_NONE);
2497 RNA_def_property_enum_sdna(prop, NULL, "stereoflag");
2498 RNA_def_property_enum_items(prop, stereo_items);
2499 RNA_def_property_ui_text(prop, "Stereo Options", "");
2500 RNA_def_property_update(prop, NC_SCENE, NULL);
2502 prop = RNA_def_property(srna, "stereo_mode", PROP_ENUM, PROP_NONE);
2503 RNA_def_property_enum_sdna(prop, NULL, "stereomode");
2504 RNA_def_property_enum_items(prop, stereo_modes_items);
2505 RNA_def_property_ui_text(prop, "Stereo Mode", "Stereographic techniques");
2506 RNA_def_property_update(prop, NC_SCENE, NULL);
2508 prop = RNA_def_property(srna, "stereo_eye_separation", PROP_FLOAT, PROP_NONE);
2509 RNA_def_property_float_sdna(prop, NULL, "eyeseparation");
2510 RNA_def_property_range(prop, 0.01, 5.0);
2511 RNA_def_property_ui_text(prop, "Eye Separation",
2512 "Set the distance between the eyes - the camera focal length/30 should be fine");
2513 RNA_def_property_update(prop, NC_SCENE, NULL);
2516 prop = RNA_def_property(srna, "dome_mode", PROP_ENUM, PROP_NONE);
2517 RNA_def_property_enum_sdna(prop, NULL, "dome.mode");
2518 RNA_def_property_enum_items(prop, dome_modes_items);
2519 RNA_def_property_ui_text(prop, "Dome Mode", "Dome physical configurations");
2520 RNA_def_property_update(prop, NC_SCENE, NULL);
2522 prop = RNA_def_property(srna, "dome_tessellation", PROP_INT, PROP_NONE);
2523 RNA_def_property_int_sdna(prop, NULL, "dome.res");
2524 RNA_def_property_ui_range(prop, 1, 8, 1, 1);
2525 RNA_def_property_ui_text(prop, "Tessellation", "Tessellation level - check the generated mesh in wireframe mode");
2526 RNA_def_property_update(prop, NC_SCENE, NULL);
2528 prop = RNA_def_property(srna, "dome_buffer_resolution", PROP_FLOAT, PROP_NONE);
2529 RNA_def_property_float_sdna(prop, NULL, "dome.resbuf");
2530 RNA_def_property_ui_range(prop, 0.1, 1.0, 0.1, 2);
2531 RNA_def_property_ui_text(prop, "Buffer Resolution", "Buffer Resolution - decrease it to increase speed");
2532 RNA_def_property_update(prop, NC_SCENE, NULL);
2534 prop = RNA_def_property(srna, "dome_angle", PROP_INT, PROP_NONE);
2535 RNA_def_property_int_sdna(prop, NULL, "dome.angle");
2536 RNA_def_property_ui_range(prop, 90, 250, 1, 1);
2537 RNA_def_property_ui_text(prop, "Angle", "Field of View of the Dome - it only works in mode Fisheye and Truncated");
2538 RNA_def_property_update(prop, NC_SCENE, NULL);
2540 prop = RNA_def_property(srna, "dome_tilt", PROP_INT, PROP_NONE);
2541 RNA_def_property_int_sdna(prop, NULL, "dome.tilt");
2542 RNA_def_property_ui_range(prop, -180, 180, 1, 1);
2543 RNA_def_property_ui_text(prop, "Tilt", "Camera rotation in horizontal axis");
2544 RNA_def_property_update(prop, NC_SCENE, NULL);
2546 prop = RNA_def_property(srna, "dome_text", PROP_POINTER, PROP_NONE);
2547 RNA_def_property_pointer_sdna(prop, NULL, "dome.warptext");
2548 RNA_def_property_struct_type(prop, "Text");
2549 RNA_def_property_flag(prop, PROP_EDITABLE);
2550 RNA_def_property_ui_text(prop, "Warp Data", "Custom Warp Mesh data file");
2551 RNA_def_property_update(prop, NC_SCENE, NULL);
2554 prop = RNA_def_property(srna, "physics_engine", PROP_ENUM, PROP_NONE);
2555 RNA_def_property_enum_sdna(prop, NULL, "physicsEngine");
2556 RNA_def_property_enum_items(prop, physics_engine_items);
2557 RNA_def_property_ui_text(prop, "Physics Engine", "Physics engine used for physics simulation in the game engine");
2558 RNA_def_property_update(prop, NC_SCENE, NULL);
2560 prop = RNA_def_property(srna, "physics_gravity", PROP_FLOAT, PROP_ACCELERATION);
2561 RNA_def_property_float_sdna(prop, NULL, "gravity");
2562 RNA_def_property_ui_range(prop, 0.0, 25.0, 1, 2);
2563 RNA_def_property_range(prop, 0.0, 10000.0);
2564 RNA_def_property_ui_text(prop, "Physics Gravity",
2565 "Gravitational constant used for physics simulation in the game engine");
2566 RNA_def_property_update(prop, NC_SCENE, NULL);
2568 prop = RNA_def_property(srna, "occlusion_culling_resolution", PROP_INT, PROP_NONE);
2569 RNA_def_property_int_sdna(prop, NULL, "occlusionRes");
2570 RNA_def_property_range(prop, 128.0, 1024.0);
2571 RNA_def_property_ui_text(prop, "Occlusion Resolution",
2572 "Size of the occlusion buffer in pixel, use higher value for better precision (slower)");
2573 RNA_def_property_update(prop, NC_SCENE, NULL);
2575 prop = RNA_def_property(srna, "fps", PROP_INT, PROP_NONE);
2576 RNA_def_property_int_sdna(prop, NULL, "ticrate");
2577 RNA_def_property_ui_range(prop, 1, 60, 1, 1);
2578 RNA_def_property_range(prop, 1, 250);
2579 RNA_def_property_ui_text(prop, "Frames Per Second",
2580 "Nominal number of game frames per second "
2581 "(physics fixed timestep = 1/fps, independently of actual frame rate)");
2582 RNA_def_property_update(prop, NC_SCENE, NULL);
2584 prop = RNA_def_property(srna, "logic_step_max", PROP_INT, PROP_NONE);
2585 RNA_def_property_int_sdna(prop, NULL, "maxlogicstep");
2586 RNA_def_property_ui_range(prop, 1, 5, 1, 1);
2587 RNA_def_property_range(prop, 1, 5);
2588 RNA_def_property_ui_text(prop, "Max Logic Steps",
2589 "Maximum number of logic frame per game frame if graphics slows down the game, "
2590 "higher value allows better synchronization with physics");
2591 RNA_def_property_update(prop, NC_SCENE, NULL);
2593 prop = RNA_def_property(srna, "physics_step_max", PROP_INT, PROP_NONE);
2594 RNA_def_property_int_sdna(prop, NULL, "maxphystep");
2595 RNA_def_property_ui_range(prop, 1, 5, 1, 1);
2596 RNA_def_property_range(prop, 1, 5);
2597 RNA_def_property_ui_text(prop, "Max Physics Steps",
2598 "Maximum number of physics step per game frame if graphics slows down the game, "
2599 "higher value allows physics to keep up with realtime");
2600 RNA_def_property_update(prop, NC_SCENE, NULL);
2602 prop = RNA_def_property(srna, "physics_step_sub", PROP_INT, PROP_NONE);
2603 RNA_def_property_int_sdna(prop, NULL, "physubstep");
2604 RNA_def_property_range(prop, 1, 50);
2605 RNA_def_property_ui_range(prop, 1, 5, 1, 1);
2606 RNA_def_property_ui_text(prop, "Physics Sub Steps",
2607 "Number of simulation substep per physic timestep, "
2608 "higher value give better physics precision");
2609 RNA_def_property_update(prop, NC_SCENE, NULL);
2611 prop = RNA_def_property(srna, "deactivation_linear_threshold", PROP_FLOAT, PROP_NONE);
2612 RNA_def_property_float_sdna(prop, NULL, "lineardeactthreshold");
2613 RNA_def_property_ui_range(prop, 0.001, 10000.0, 2, 3);
2614 RNA_def_property_range(prop, 0.001, 10000.0);
2615 RNA_def_property_ui_text(prop, "Deactivation Linear Threshold",
2616 "Linear velocity that an object must be below before the deactivation timer can start");
2617 RNA_def_property_update(prop, NC_SCENE, NULL);
2619 prop = RNA_def_property(srna, "deactivation_angular_threshold", PROP_FLOAT, PROP_NONE);
2620 RNA_def_property_float_sdna(prop, NULL, "angulardeactthreshold");
2621 RNA_def_property_ui_range(prop, 0.001, 10000.0, 2, 3);
2622 RNA_def_property_range(prop, 0.001, 10000.0);
2623 RNA_def_property_ui_text(prop, "Deactivation Angular Threshold",
2624 "Angular velocity that an object must be below before the deactivation timer can start");
2625 RNA_def_property_update(prop, NC_SCENE, NULL);
2627 prop = RNA_def_property(srna, "deactivation_time", PROP_FLOAT, PROP_NONE);
2628 RNA_def_property_float_sdna(prop, NULL, "deactivationtime");
2629 RNA_def_property_ui_range(prop, 0.0, 60.0, 1, 1);
2630 RNA_def_property_range(prop, 0.0, 60.0);
2631 RNA_def_property_ui_text(prop, "Deactivation Time",
2632 "Amount of time (in seconds) after which objects with a velocity less than the given "
2633 "threshold will deactivate (0.0 means no deactivation)");
2634 RNA_def_property_update(prop, NC_SCENE, NULL);
2637 prop = RNA_def_property(srna, "use_occlusion_culling", PROP_BOOLEAN, PROP_NONE);
2638 RNA_def_property_boolean_sdna(prop, NULL, "mode", (1 << 5)); /*XXX mode hardcoded *//* WO_DBVT_CULLING */
2639 RNA_def_property_ui_text(prop, "DBVT culling",
2640 "Use optimized Bullet DBVT tree for view frustum and occlusion culling");
2642 /* not used *//* deprecated !!!!!!!!!!!!! */
2643 prop = RNA_def_property(srna, "use_activity_culling", PROP_BOOLEAN, PROP_NONE);
2644 RNA_def_property_boolean_sdna(prop, NULL, "mode", (1 << 3)); /*XXX mode hardcoded */
2645 RNA_def_property_ui_text(prop, "Activity Culling", "Activity culling is enabled");
2647 /* not used *//* deprecated !!!!!!!!!!!!! */
2648 prop = RNA_def_property(srna, "activity_culling_box_radius", PROP_FLOAT, PROP_NONE);
2649 RNA_def_property_float_sdna(prop, NULL, "activityBoxRadius");
2650 RNA_def_property_range(prop, 0.0, 1000.0);
2651 RNA_def_property_ui_text(prop, "Box Radius",
2652 "Radius of the activity bubble, in Manhattan length "
2653 "(objects outside the box are activity-culled)");
2656 prop = RNA_def_property(srna, "show_debug_properties", PROP_BOOLEAN, PROP_NONE);
2657 RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_DEBUG_PROPS);
2658 RNA_def_property_ui_text(prop, "Show Debug Properties",
2659 "Show properties marked for debugging while the game runs");
2661 prop = RNA_def_property(srna, "show_framerate_profile", PROP_BOOLEAN, PROP_NONE);
2662 RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_FRAMERATE);
2663 RNA_def_property_ui_text(prop, "Show Framerate and Profile",
2664 "Show framerate and profiling information while the game runs");
2666 prop = RNA_def_property(srna, "show_physics_visualization", PROP_BOOLEAN, PROP_NONE);
2667 RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_PHYSICS);
2668 RNA_def_property_ui_text(prop, "Show Physics Visualization",
2669 "Show a visualization of physics bounds and interactions");
2671 prop = RNA_def_property(srna, "show_mouse", PROP_BOOLEAN, PROP_NONE);
2672 RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_MOUSE);
2673 RNA_def_property_ui_text(prop, "Show Mouse", "Start player with a visible mouse cursor");
2675 prop = RNA_def_property(srna, "use_frame_rate", PROP_BOOLEAN, PROP_NONE);
2676 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_ENABLE_ALL_FRAMES);
2677 RNA_def_property_ui_text(prop, "Use Frame Rate",
2678 "Respect the frame rate rather than rendering as many frames as possible");
2680 prop = RNA_def_property(srna, "use_display_lists", PROP_BOOLEAN, PROP_NONE);
2681 RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_DISPLAY_LISTS);
2682 RNA_def_property_ui_text(prop, "Display Lists",
2683 "Use display lists to speed up rendering by keeping geometry on the GPU");
2685 prop = RNA_def_property(srna, "use_deprecation_warnings", PROP_BOOLEAN, PROP_NONE);
2686 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_IGNORE_DEPRECATION_WARNINGS);
2687 RNA_def_property_ui_text(prop, "Deprecation Warnings",
2688 "Print warnings when using deprecated features in the python API");
2690 prop = RNA_def_property(srna, "use_animation_record", PROP_BOOLEAN, PROP_NONE);
2691 RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_ENABLE_ANIMATION_RECORD);
2692 RNA_def_property_ui_text(prop, "Record Animation", "Record animation to F-Curves");
2694 prop = RNA_def_property(srna, "use_auto_start", PROP_BOOLEAN, PROP_NONE);
2695 RNA_def_property_boolean_funcs(prop, "rna_GameSettings_auto_start_get", "rna_GameSettings_auto_start_set");
2696 RNA_def_property_ui_text(prop, "Auto Start", "Automatically start game at load time");
2698 prop = RNA_def_property(srna, "restrict_animation_updates", PROP_BOOLEAN, PROP_NONE);
2699 RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_RESTRICT_ANIM_UPDATES);
2700 RNA_def_property_ui_text(prop, "Restrict Animation Updates",
2701 "Restrict the number of animation updates to the animation FPS (this is "
2702 "better for performance, but can cause issues with smooth playback)");
2705 prop = RNA_def_property(srna, "material_mode", PROP_ENUM, PROP_NONE);
2706 RNA_def_property_enum_sdna(prop, NULL, "matmode");
2707 RNA_def_property_enum_items(prop, material_items);
2708 RNA_def_property_ui_text(prop, "Material Mode", "Material mode to use for rendering");
2709 RNA_def_property_update(prop, NC_SCENE | NA_EDITED, NULL);
2711 prop = RNA_def_property(srna, "use_glsl_lights", PROP_BOOLEAN, PROP_NONE);
2712 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_LIGHTS);
2713 RNA_def_property_ui_text(prop, "GLSL Lights", "Use lights for GLSL rendering");
2714 RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_glsl_update");
2716 prop = RNA_def_property(srna, "use_glsl_shaders", PROP_BOOLEAN, PROP_NONE);
2717 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_SHADERS);
2718 RNA_def_property_ui_text(prop, "GLSL Shaders", "Use shaders for GLSL rendering");
2719 RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_glsl_update");
2721 prop = RNA_def_property(srna, "use_glsl_shadows", PROP_BOOLEAN, PROP_NONE);
2722 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_SHADOWS);
2723 RNA_def_property_ui_text(prop, "GLSL Shadows", "Use shadows for GLSL rendering");
2724 RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_glsl_update");
2726 prop = RNA_def_property(srna, "use_glsl_ramps", PROP_BOOLEAN, PROP_NONE);
2727 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_RAMPS);
2728 RNA_def_property_ui_text(prop, "GLSL Ramps", "Use ramps for GLSL rendering");
2729 RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_glsl_update");
2731 prop = RNA_def_property(srna, "use_glsl_nodes", PROP_BOOLEAN, PROP_NONE);
2732 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_NODES);
2733 RNA_def_property_ui_text(prop, "GLSL Nodes", "Use nodes for GLSL rendering");
2734 RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_glsl_update");
2736 prop = RNA_def_property(srna, "use_glsl_color_management", PROP_BOOLEAN, PROP_NONE);
2737 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_COLOR_MANAGEMENT);
2738 RNA_def_property_ui_text(prop, "GLSL Color Management", "Use color management for GLSL rendering");
2739 RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_glsl_update");
2741 prop = RNA_def_property(srna, "use_glsl_extra_textures", PROP_BOOLEAN, PROP_NONE);
2742 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_EXTRA_TEX);
2743 RNA_def_property_ui_text(prop, "GLSL Extra Textures",
2744 "Use extra textures like normal or specular maps for GLSL rendering");
2745 RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_glsl_update");
2747 /* obstacle simulation */
2748 prop = RNA_def_property(srna, "obstacle_simulation", PROP_ENUM, PROP_NONE);
2749 RNA_def_property_enum_sdna(prop, NULL, "obstacleSimulation");
2750 RNA_def_property_enum_items(prop, obstacle_simulation_items);
2751 RNA_def_property_ui_text(prop, "Obstacle simulation", "Simulation used for obstacle avoidance in the game engine");
2752 RNA_def_property_update(prop, NC_SCENE, NULL);
2754 prop = RNA_def_property(srna, "level_height", PROP_FLOAT, PROP_ACCELERATION);
2755 RNA_def_property_float_sdna(prop, NULL, "levelHeight");
2756 RNA_def_property_range(prop, 0.0f, 200.0f);
2757 RNA_def_property_ui_text(prop, "Level height",
2758 "Max difference in heights of obstacles to enable their interaction");
2759 RNA_def_property_update(prop, NC_SCENE, NULL);
2761 prop = RNA_def_property(srna, "show_obstacle_simulation", PROP_BOOLEAN, PROP_NONE);
2762 RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_OBSTACLE_SIMULATION);
2763 RNA_def_property_ui_text(prop, "Visualization", "Enable debug visualization for obstacle simulation");
2765 /* Recast Settings */
2766 prop = RNA_def_property(srna, "recast_data", PROP_POINTER, PROP_NONE);
2767 RNA_def_property_flag(prop, PROP_NEVER_NULL);
2768 RNA_def_property_pointer_sdna(prop, NULL, "recastData");
2769 RNA_def_property_struct_type(prop, "SceneGameRecastData");
2770 RNA_def_property_ui_text(prop, "Recast Data", "");
2773 rna_def_scene_game_recast_data(brna);
2776 static void rna_def_scene_render_layer(BlenderRNA *brna)
2780 srna = RNA_def_struct(brna, "SceneRenderLayer", NULL);
2781 RNA_def_struct_ui_text(srna, "Scene Render Layer", "Render layer");
2782 RNA_def_struct_ui_icon(srna, ICON_RENDERLAYERS);
2784 rna_def_render_layer_common(srna, 1);
2788 static void rna_def_render_layers(BlenderRNA *brna, PropertyRNA *cprop)
2796 RNA_def_property_srna(cprop, "RenderLayers");
2797 srna = RNA_def_struct(brna, "RenderLayers", NULL);
2798 RNA_def_struct_sdna(srna, "RenderData");
2799 RNA_def_struct_ui_text(srna, "Render Layers", "Collection of render layers");
2801 prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
2802 RNA_def_property_int_sdna(prop, NULL, "actlay");
2803 RNA_def_property_int_funcs(prop, "rna_RenderSettings_active_layer_index_get",
2804 "rna_RenderSettings_active_layer_index_set",
2805 "rna_RenderSettings_active_layer_index_range");
2806 RNA_def_property_ui_text(prop, "Active Layer Index", "Active index in render layer array");
2807 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
2809 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_UNSIGNED);
2810 RNA_def_property_struct_type(prop, "SceneRenderLayer");
2811 RNA_def_property_pointer_funcs(prop, "rna_RenderSettings_active_layer_get",
2812 "rna_RenderSettings_active_layer_set", NULL, NULL);
2813 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
2814 RNA_def_property_ui_text(prop, "Active Render Layer", "Active Render Layer");
2815 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
2817 func = RNA_def_function(srna, "new", "rna_RenderLayer_new");
2818 RNA_def_function_ui_description(func, "Add a render layer to scene");
2819 RNA_def_function_flag(func, FUNC_USE_SELF_ID);
2820 parm = RNA_def_string(func, "name", "RenderLayer", 0, "", "New name for the marker (not unique)");
2821 RNA_def_property_flag(parm, PROP_REQUIRED);
2822 parm = RNA_def_pointer(func, "result", "SceneRenderLayer", "", "Newly created render layer");
2823 RNA_def_function_return(func, parm);
2825 func = RNA_def_function(srna, "remove", "rna_RenderLayer_remove");
2826 RNA_def_function_ui_description(func, "Remove a render layer");
2827 RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
2828 parm = RNA_def_pointer(func, "layer", "SceneRenderLayer", "", "Timeline marker to remove");
2829 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
2832 /* use for render output and image save operator,
2833 * note: there are some cases where the members act differently when this is
2834 * used from a scene, video formats can only be selected for render output
2835 * for example, this is checked by seeing if the ptr->id.data is a Scene id */
2837 static void rna_def_scene_image_format_data(BlenderRNA *brna)
2840 static EnumPropertyItem exr_codec_items[] = {
2841 {R_IMF_EXR_CODEC_NONE, "NONE", 0, "None", ""},
2842 {R_IMF_EXR_CODEC_PXR24, "PXR24", 0, "Pxr24 (lossy)", ""},
2843 {R_IMF_EXR_CODEC_ZIP, "ZIP", 0, "ZIP (lossless)", ""},
2844 {R_IMF_EXR_CODEC_PIZ, "PIZ", 0, "PIZ (lossless)", ""},
2845 {R_IMF_EXR_CODEC_RLE, "RLE", 0, "RLE (lossless)", ""},
2846 {0, NULL, 0, NULL, NULL}
2853 srna = RNA_def_struct(brna, "ImageFormatSettings", NULL);
2854 RNA_def_struct_sdna(srna, "ImageFormatData");
2855 RNA_def_struct_nested(brna, srna, "Scene");
2856 /* RNA_def_struct_path_func(srna, "rna_RenderSettings_path"); *//* no need for the path, its not animated! */
2857 RNA_def_struct_ui_text(srna, "Image Format", "Settings for image formats");
2859 prop = RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE);
2860 RNA_def_property_enum_sdna(prop, NULL, "imtype");
2861 RNA_def_property_enum_items(prop, image_type_items);
2862 RNA_def_property_enum_funcs(prop, NULL, "rna_ImageFormatSettings_file_format_set",
2863 "rna_ImageFormatSettings_file_format_itemf");
2864 RNA_def_property_ui_text(prop, "File Format", "File format to save the rendered images as");
2865 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2867 prop = RNA_def_property(srna, "color_mode", PROP_ENUM, PROP_NONE);
2868 RNA_def_property_enum_bitflag_sdna(prop, NULL, "planes");
2869 RNA_def_property_enum_items(prop, image_color_mode_items);
2870 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_ImageFormatSettings_color_mode_itemf");
2871 RNA_def_property_ui_text(prop, "Color Mode",
2872 "Choose BW for saving grayscale images, RGB for saving red, green and blue channels, "
2873 "and RGBA for saving red, green, blue and alpha channels");
2874 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2876 prop = RNA_def_property(srna, "color_depth", PROP_ENUM, PROP_NONE);
2877 RNA_def_property_enum_bitflag_sdna(prop, NULL, "depth");
2878 RNA_def_property_enum_items(prop, image_color_depth_items);
2879 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_ImageFormatSettings_color_depth_itemf");
2880 RNA_def_property_ui_text(prop, "Color Depth", "Bit depth per channel");
2881 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2883 /* was 'file_quality' */
2884 prop = RNA_def_property(srna, "quality", PROP_INT, PROP_PERCENTAGE);
2885 RNA_def_property_int_sdna(prop, NULL, "quality");
2886 RNA_def_property_range(prop, 0, 100); /* 0 is needed for compression. */
2887 RNA_def_property_ui_text(prop, "Quality", "Quality for image formats that support lossy compression");
2888 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2890 /* was shared with file_quality */
2891 prop = RNA_def_property(srna, "compression", PROP_INT, PROP_PERCENTAGE);
2892 RNA_def_property_int_sdna(prop, NULL, "compress");
2893 RNA_def_property_range(prop, 0, 100); /* 0 is needed for compression. */
2894 RNA_def_property_ui_text(prop, "Compression", "Compression level for formats that support lossless compression");
2895 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2898 prop = RNA_def_property(srna, "use_zbuffer", PROP_BOOLEAN, PROP_NONE);
2899 RNA_def_property_boolean_sdna(prop, NULL, "flag", R_IMF_FLAG_ZBUF);
2900 RNA_def_property_ui_text(prop, "Z Buffer", "Save the z-depth per pixel (32 bit unsigned int z-buffer)");
2901 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2903 prop = RNA_def_property(srna, "use_preview", PROP_BOOLEAN, PROP_NONE);
2904 RNA_def_property_boolean_sdna(prop, NULL, "flag", R_IMF_FLAG_PREVIEW_JPG);
2905 RNA_def_property_ui_text(prop, "Preview", "When rendering animations, save JPG preview images in same directory");
2906 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2908 /* format specific */
2913 prop = RNA_def_property(srna, "exr_codec", PROP_ENUM, PROP_NONE);
2914 RNA_def_property_enum_sdna(prop, NULL, "exr_codec");
2915 RNA_def_property_enum_items(prop, exr_codec_items);
2916 RNA_def_property_ui_text(prop, "Codec", "Codec settings for OpenEXR");
2917 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2922 #ifdef WITH_OPENJPEG
2924 prop = RNA_def_property(srna, "use_jpeg2k_ycc", PROP_BOOLEAN, PROP_NONE);
2925 RNA_def_property_boolean_sdna(prop, NULL, "jp2_flag", R_IMF_JP2_FLAG_YCC);
2926 RNA_def_property_ui_text(prop, "YCC", "Save luminance-chrominance-chrominance channels instead of RGB colors");
2927 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2929 prop = RNA_def_property(srna, "use_jpeg2k_cinema_preset", PROP_BOOLEAN, PROP_NONE);
2930 RNA_def_property_boolean_sdna(prop, NULL, "jp2_flag", R_IMF_JP2_FLAG_CINE_PRESET);
2931 RNA_def_property_ui_text(prop, "Cinema", "Use Openjpeg Cinema Preset");
2932 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2934 prop = RNA_def_property(srna, "use_jpeg2k_cinema_48", PROP_BOOLEAN, PROP_NONE);
2935 RNA_def_property_boolean_sdna(prop, NULL, "jp2_flag", R_IMF_JP2_FLAG_CINE_48);
2936 RNA_def_property_ui_text(prop, "Cinema (48)", "Use Openjpeg Cinema Preset (48fps)");
2937 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2940 /* Cineon and DPX */
2942 prop = RNA_def_property(srna, "use_cineon_log", PROP_BOOLEAN, PROP_NONE);
2943 RNA_def_property_boolean_sdna(prop, NULL, "cineon_flag", R_CINEON_LOG);
2944 RNA_def_property_ui_text(prop, "Log", "Convert to logarithmic color space");
2945 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2947 prop = RNA_def_property(srna, "cineon_black", PROP_INT, PROP_NONE);
2948 RNA_def_property_int_sdna(prop, NULL, "cineon_black");
2949 RNA_def_property_range(prop, 0, 1024);
2950 RNA_def_property_ui_text(prop, "B", "Log conversion reference blackpoint");
2951 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2953 prop = RNA_def_property(srna, "cineon_white", PROP_INT, PROP_NONE);
2954 RNA_def_property_int_sdna(prop, NULL, "cineon_white");
2955 RNA_def_property_range(prop, 0, 1024);
2956 RNA_def_property_ui_text(prop, "W", "Log conversion reference whitepoint");
2957 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2959 prop = RNA_def_property(srna, "cineon_gamma", PROP_FLOAT, PROP_NONE);
2960 RNA_def_property_float_sdna(prop, NULL, "cineon_gamma");
2961 RNA_def_property_range(prop, 0.0f, 10.0f);
2962 RNA_def_property_ui_text(prop, "G", "Log conversion gamma");
2963 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2966 static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna)
2972 static EnumPropertyItem ffmpeg_format_items[] = {
2973 {FFMPEG_MPEG1, "MPEG1", 0, "MPEG-1", ""},
2974 {FFMPEG_MPEG2, "MPEG2", 0, "MPEG-2", ""},
2975 {FFMPEG_MPEG4, "MPEG4", 0, "MPEG-4", ""},
2976 {FFMPEG_AVI, "AVI", 0, "AVI", ""},
2977 {FFMPEG_MOV, "QUICKTIME", 0, "Quicktime", ""},
2978 {FFMPEG_DV, "DV", 0, "DV", ""},
2979 {FFMPEG_H264, "H264", 0, "H.264", ""},
2980 {FFMPEG_XVID, "XVID", 0, "Xvid", ""},
2981 {FFMPEG_OGG, "OGG", 0, "Ogg", ""},
2982 {FFMPEG_MKV, "MKV", 0, "Matroska", ""},
2983 {FFMPEG_FLV, "FLASH", 0, "Flash", ""},
2984 {FFMPEG_WAV, "WAV", 0, "Wav", ""},
2985 {FFMPEG_MP3, "MP3", 0, "Mp3", ""},
2986 {0, NULL, 0, NULL, NULL}
2989 static EnumPropertyItem ffmpeg_codec_items[] = {
2990 {CODEC_ID_NONE, "NONE", 0, "None", ""},
2991 {CODEC_ID_MPEG1VIDEO, "MPEG1", 0, "MPEG-1", ""},
2992 {CODEC_ID_MPEG2VIDEO, "MPEG2", 0, "MPEG-2", ""},
2993 {CODEC_ID_MPEG4, "MPEG4", 0, "MPEG-4(divx)", ""},
2994 {CODEC_ID_HUFFYUV, "HUFFYUV", 0, "HuffYUV", ""},
2995 {CODEC_ID_DVVIDEO, "DV", 0, "DV", ""},
2996 {CODEC_ID_H264, "H264", 0, "H.264", ""},
2997 {CODEC_ID_THEORA, "THEORA", 0, "Theora", ""},
2998 {CODEC_ID_FLV1, "FLASH", 0, "Flash Video", ""},
2999 {CODEC_ID_FFV1, "FFV1", 0, "FFmpeg video codec #1", ""},
3000 {CODEC_ID_QTRLE, "QTRLE", 0, "QTRLE", ""},
3001 /* {CODEC_ID_DNXHD, "DNXHD", 0, "DNxHD", ""}, */ /* disabled for after release */
3002 {0, NULL, 0, NULL, NULL}
3005 static EnumPropertyItem ffmpeg_audio_codec_items[] = {
3006 {CODEC_ID_NONE, "NONE", 0, "None", ""},
3007 {CODEC_ID_MP2, "MP2", 0, "MP2", ""},
3008 {CODEC_ID_MP3, "MP3", 0, "MP3", ""},
3009 {CODEC_ID_AC3, "AC3", 0, "AC3", ""},
3010 {CODEC_ID_AAC, "AAC", 0, "AAC", ""},
3011 {CODEC_ID_VORBIS, "VORBIS", 0, "Vorbis", ""},
3012 {CODEC_ID_FLAC, "FLAC", 0, "FLAC", ""},
3013 {CODEC_ID_PCM_S16LE, "PCM", 0, "PCM", ""},
3014 {0, NULL, 0, NULL, NULL}
3018 static EnumPropertyItem audio_channel_items[] = {
3019 {1, "MONO", 0, "Mono", "Set audio channels to mono"},
3020 {2, "STEREO", 0, "Stereo", "Set audio channels to stereo"},
3021 {4, "SURROUND4", 0, "4 Channels", "Set audio channels to 4 channels"},
3022 {6, "SURROUND51", 0, "5.1 Surround", "Set audio channels to 5.1 surround sound"},
3023 {8, "SURROUND71", 0, "7.1 Surround", "Set audio channels to 7.1 surround sound"},
3024 {0, NULL, 0, NULL, NULL}
3027 srna = RNA_def_struct(brna, "FFmpegSettings", NULL);
3028 RNA_def_struct_sdna(srna, "FFMpegCodecData");
3029 RNA_def_struct_ui_text(srna, "FFmpeg Settings", "FFmpeg related settings for the scene");
3032 prop = RNA_def_property(srna, "format", PROP_ENUM, PROP_NONE);
3033 RNA_def_property_enum_bitflag_sdna(prop, NULL, "type");
3034 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3035 RNA_def_property_enum_items(prop, ffmpeg_format_items);
3036 RNA_def_property_ui_text(prop, "Format", "Output file format");
3037 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_FFmpegSettings_codec_settings_update");
3039 prop = RNA_def_property(srna, "codec", PROP_ENUM, PROP_NONE);
3040 RNA_def_property_enum_bitflag_sdna(prop, NULL, "codec");
3041 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3042 RNA_def_property_enum_items(prop, ffmpeg_codec_items);
3043 RNA_def_property_ui_text(prop, "Codec", "FFmpeg codec to use");
3044 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_FFmpegSettings_codec_settings_update");
3046 prop = RNA_def_property(srna, "video_bitrate", PROP_INT, PROP_NONE);
3047 RNA_def_property_int_sdna(prop, NULL, "video_bitrate");
3048 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3049 RNA_def_property_range(prop, 1, 64000);
3050 RNA_def_property_ui_text(prop, "Bitrate", "Video bitrate (kb/s)");
3051 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
3053 prop = RNA_def_property(srna, "minrate", PROP_INT, PROP_NONE);
3054 RNA_def_property_int_sdna(prop, NULL, "rc_min_rate");
3055 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3056 RNA_def_property_range(prop, 0, 9000);
3057 RNA_def_property_ui_text(prop, "Min Rate", "Rate control: min rate (kb/s)");
3058 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
3060 prop = RNA_def_property(srna, "maxrate", PROP_INT, PROP_NONE);
3061 RNA_def_property_int_sdna(prop, NULL, "rc_max_rate");
3062 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3063 RNA_def_property_range(prop, 1, 14000);
3064 RNA_def_property_ui_text(prop, "Max Rate", "Rate control: max rate (kb/s)");
3065 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
3067 prop = RNA_def_property(srna, "muxrate", PROP_INT, PROP_NONE);
3068 RNA_def_property_int_sdna(prop, NULL, "mux_rate");
3069 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3070 RNA_def_property_range(prop, 0, 100000000);
3071 RNA_def_property_ui_text(prop, "Mux Rate", "Mux rate (bits/s(!))");
3072 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
3074 prop = RNA_def_property(srna, "gopsize", PROP_INT, PROP_NONE);
3075 RNA_def_property_int_sdna(prop, NULL, "gop_size");
3076 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3077 RNA_def_property_range(prop, 0, 100);
3078 RNA_def_property_ui_text(prop, "GOP Size", "Distance between key frames");
3079 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
3081 prop = RNA_def_property(srna, "buffersize", PROP_INT, PROP_NONE);
3082 RNA_def_property_int_sdna(prop, NULL, "rc_buffer_size");
3083 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3084 RNA_def_property_range(prop, 0, 2000);
3085 RNA_def_property_ui_text(prop, "Buffersize", "Rate control: buffer size (kb)");
3086 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
3088 prop = RNA_def_property(srna, "packetsize", PROP_INT, PROP_NONE);
3089 RNA_def_property_int_sdna(prop, NULL, "mux_packet_size");
3090 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3091 RNA_def_property_range(prop, 0, 16384);
3092 RNA_def_property_ui_text(prop, "Mux Packet Size", "Mux packet size (byte)");
3093 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
3095 prop = RNA_def_property(srna, "use_autosplit", PROP_BOOLEAN, PROP_NONE);
3096 RNA_def_property_boolean_sdna(prop, NULL, "flags", FFMPEG_AUTOSPLIT_OUTPUT);
3097 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3098 RNA_def_property_ui_text(prop, "Autosplit Output", "Autosplit output at 2GB boundary");
3099 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
3101 prop = RNA_def_property(srna, "use_lossless_output", PROP_BOOLEAN, PROP_NONE);
3102 RNA_def_property_boolean_sdna(prop, NULL, "flags", FFMPEG_LOSSLESS_OUTPUT);
3103 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3104 RNA_def_property_boolean_funcs(prop, NULL, "rna_FFmpegSettings_lossless_output_set");
3105 RNA_def_property_ui_text(prop, "Lossless Output", "Use lossless output for video streams");
3106 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
3109 prop = RNA_def_property(srna, "audio_codec", PROP_ENUM, PROP_NONE);
3110 RNA_def_property_enum_bitflag_sdna(prop, NULL, "audio_codec");
3111 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3112 RNA_def_property_enum_items(prop, ffmpeg_audio_codec_items);
3113 RNA_def_property_ui_text(prop, "Audio Codec", "FFmpeg audio codec to use");
3114 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
3116 prop = RNA_def_property(srna, "audio_bitrate", PROP_INT, PROP_NONE);
3117 RNA_def_property_int_sdna(prop, NULL, "audio_bitrate");
3118 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3119 RNA_def_property_range(prop, 32, 384);
3120 RNA_def_property_ui_text(prop, "Bitrate", "Audio bitrate (kb/s)");
3121 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
3123 prop = RNA_def_property(srna, "audio_volume", PROP_FLOAT, PROP_NONE);
3124 RNA_def_property_float_sdna(prop, NULL, "audio_volume");
3125 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3126 RNA_def_property_range(prop, 0.0f, 1.0f);
3127 RNA_def_property_ui_text(prop, "Volume", "Audio volume");
3128 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
3131 /* the following two "ffmpeg" settings are general audio settings */
3132 prop = RNA_def_property(srna, "audio_mixrate", PROP_INT, PROP_NONE);
3133 RNA_def_property_int_sdna(prop, NULL, "audio_mixrate");
3134 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3135 RNA_def_property_range(prop, 8000, 192000);
3136 RNA_def_property_ui_text(prop, "Samplerate", "Audio samplerate(samples/s)");
3137 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
3139 prop = RNA_def_property(srna, "audio_channels", PROP_ENUM, PROP_NONE);
3140 RNA_def_property_enum_sdna(prop, NULL, "audio_channels");
3141 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3142 RNA_def_property_enum_items(prop, audio_channel_items);
3143 RNA_def_property_ui_text(prop, "Audio Channels", "Audio channel count");
3146 #ifdef WITH_QUICKTIME
3147 static void rna_def_scene_quicktime_settings(BlenderRNA *brna)
3152 static EnumPropertyItem quicktime_codec_type_items[] = {
3153 {0, "codec", 0, "codec", ""},
3154 {0, NULL, 0, NULL, NULL}
3158 static EnumPropertyItem quicktime_audio_samplerate_items[] = {
3159 {22050, "22050", 0, "22kHz", ""},
3160 {44100, "44100", 0, "44.1kHz", ""},
3161 {48000, "48000", 0, "48kHz", ""},
3162 {88200, "88200", 0, "88.2kHz", ""},
3163 {96000, "96000", 0, "96kHz", ""},
3164 {192000, "192000", 0, "192kHz", ""},
3165 {0, NULL, 0, NULL, NULL}
3168 static EnumPropertyItem quicktime_audio_bitdepth_items[] = {
3169 {AUD_FORMAT_U8, "8BIT", 0, "8bit", ""},
3170 {AUD_FORMAT_S16, "16BIT", 0, "16bit", ""},
3171 {AUD_FORMAT_S24, "24BIT", 0, "24bit", ""},
3172 {AUD_FORMAT_S32, "32BIT", 0, "32bit", ""},
3173 {AUD_FORMAT_FLOAT32, "FLOAT32", 0, "float32", ""},
3174 {AUD_FORMAT_FLOAT64, "FLOAT64", 0, "float64", ""},
3175 {0, NULL, 0, NULL, NULL}
3178 static EnumPropertyItem quicktime_audio_bitrate_items[] = {
3179 {64000, "64000", 0, "64kbps", ""},
3180 {112000, "112000", 0, "112kpbs", ""},
3181 {128000, "128000", 0, "128kbps", ""},
3182 {192000, "192000", 0, "192kbps", ""},
3183 {256000, "256000", 0, "256kbps", ""},
3184 {320000, "320000", 0, "320kbps", ""},
3185 {0, NULL, 0, NULL, NULL}
3190 srna = RNA_def_struct(brna, "QuickTimeSettings", NULL);
3191 RNA_def_struct_sdna(srna, "QuicktimeCodecSettings");
3192 RNA_def_struct_ui_text(srna, "QuickTime Settings", "QuickTime related settings for the scene");
3194 prop = RNA_def_property(srna, "codec_type", PROP_ENUM, PROP_NONE);
3195 RNA_def_property_enum_bitflag_sdna(prop, NULL, "codecType");
3196 RNA_def_property_enum_items(prop, quicktime_codec_type_items);
3197 RNA_def_property_enum_funcs(prop, "rna_RenderSettings_qtcodecsettings_codecType_get",
3198 "rna_RenderSettings_qtcodecsettings_codecType_set",
3199 "rna_RenderSettings_qtcodecsettings_codecType_itemf");
3200 RNA_def_property_ui_text(prop, "Codec", "QuickTime codec type");
3201 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
3203 prop = RNA_def_property(srna, "codec_spatial_quality", PROP_INT,&nbs