2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * Contributor(s): Blender Foundation (2008).
20 * ***** END GPL LICENSE BLOCK *****
23 /** \file blender/makesrna/intern/rna_scene.c
29 #include "RNA_define.h"
30 #include "RNA_enum_types.h"
32 #include "rna_internal.h"
34 #include "DNA_brush_types.h"
35 #include "DNA_group_types.h"
36 #include "DNA_modifier_types.h"
37 #include "DNA_particle_types.h"
38 #include "DNA_scene_types.h"
39 #include "DNA_userdef_types.h"
40 #include "DNA_world_types.h"
41 #include "DNA_linestyle_types.h"
45 #include "BLF_translation.h"
47 #include "BKE_tessmesh.h"
49 /* Include for Bake Options */
50 #include "RE_engine.h"
51 #include "RE_pipeline.h"
54 #include "quicktime_export.h"
55 # ifdef WITH_AUDASPACE
56 # include "AUD_Space.h"
61 #include "BKE_writeffmpeg.h"
62 #include <libavcodec/avcodec.h>
63 #include <libavformat/avformat.h>
66 #include "ED_render.h"
71 #include "BLI_threads.h"
73 EnumPropertyItem uv_sculpt_relaxation_items[] = {
74 {UV_SCULPT_TOOL_RELAX_LAPLACIAN, "LAPLACIAN", 0, "Laplacian", "Use Laplacian method for relaxation"},
75 {UV_SCULPT_TOOL_RELAX_HC, "HC", 0, "HC", "Use HC method for relaxation"},
76 {0, NULL, 0, NULL, NULL}
79 EnumPropertyItem uv_sculpt_tool_items[] = {
80 {UV_SCULPT_TOOL_PINCH, "PINCH", 0, "Pinch", "Pinch UVs"},
81 {UV_SCULPT_TOOL_RELAX, "RELAX", 0, "Relax", "Relax UVs"},
82 {UV_SCULPT_TOOL_GRAB, "GRAB", 0, "Grab", "Grab UVs"},
83 {0, NULL, 0, NULL, NULL}
87 EnumPropertyItem snap_target_items[] = {
88 {SCE_SNAP_TARGET_CLOSEST, "CLOSEST", 0, "Closest", "Snap closest point onto target"},
89 {SCE_SNAP_TARGET_CENTER, "CENTER", 0, "Center", "Snap center onto target"},
90 {SCE_SNAP_TARGET_MEDIAN, "MEDIAN", 0, "Median", "Snap median onto target"},
91 {SCE_SNAP_TARGET_ACTIVE, "ACTIVE", 0, "Active", "Snap active onto target"},
92 {0, NULL, 0, NULL, NULL}
95 EnumPropertyItem proportional_falloff_items[] = {
96 {PROP_SMOOTH, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", "Smooth falloff"},
97 {PROP_SPHERE, "SPHERE", ICON_SPHERECURVE, "Sphere", "Spherical falloff"},
98 {PROP_ROOT, "ROOT", ICON_ROOTCURVE, "Root", "Root falloff"},
99 {PROP_SHARP, "SHARP", ICON_SHARPCURVE, "Sharp", "Sharp falloff"},
100 {PROP_LIN, "LINEAR", ICON_LINCURVE, "Linear", "Linear falloff"},
101 {PROP_CONST, "CONSTANT", ICON_NOCURVE, "Constant", "Constant falloff"},
102 {PROP_RANDOM, "RANDOM", ICON_RNDCURVE, "Random", "Random falloff"},
103 {0, NULL, 0, NULL, NULL}
106 /* subset of the enum - only curves, missing random and const */
107 EnumPropertyItem proportional_falloff_curve_only_items[] = {
108 {PROP_SMOOTH, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", "Smooth falloff"},
109 {PROP_SPHERE, "SPHERE", ICON_SPHERECURVE, "Sphere", "Spherical falloff"},
110 {PROP_ROOT, "ROOT", ICON_ROOTCURVE, "Root", "Root falloff"},
111 {PROP_SHARP, "SHARP", ICON_SHARPCURVE, "Sharp", "Sharp falloff"},
112 {PROP_LIN, "LINEAR", ICON_LINCURVE, "Linear", "Linear falloff"},
113 {0, NULL, 0, NULL, NULL}
117 EnumPropertyItem proportional_editing_items[] = {
118 {PROP_EDIT_OFF, "DISABLED", ICON_PROP_OFF, "Disable", "Proportional Editing disabled"},
119 {PROP_EDIT_ON, "ENABLED", ICON_PROP_ON, "Enable", "Proportional Editing enabled"},
120 {PROP_EDIT_CONNECTED, "CONNECTED", ICON_PROP_CON, "Connected", "Proportional Editing using connected geometry only"},
121 {0, NULL, 0, NULL, NULL}
124 /* keep for operators, not used here */
125 EnumPropertyItem mesh_select_mode_items[] = {
126 {SCE_SELECT_VERTEX, "VERTEX", ICON_VERTEXSEL, "Vertex", "Vertex selection mode"},
127 {SCE_SELECT_EDGE, "EDGE", ICON_EDGESEL, "Edge", "Edge selection mode"},
128 {SCE_SELECT_FACE, "FACE", ICON_FACESEL, "Face", "Face selection mode"},
129 {0, NULL, 0, NULL, NULL}
132 EnumPropertyItem snap_element_items[] = {
133 {SCE_SNAP_MODE_INCREMENT, "INCREMENT", ICON_SNAP_INCREMENT, "Increment", "Snap to increments of grid"},
134 {SCE_SNAP_MODE_VERTEX, "VERTEX", ICON_SNAP_VERTEX, "Vertex", "Snap to vertices"},
135 {SCE_SNAP_MODE_EDGE, "EDGE", ICON_SNAP_EDGE, "Edge", "Snap to edges"},
136 {SCE_SNAP_MODE_FACE, "FACE", ICON_SNAP_FACE, "Face", "Snap to faces"},
137 {SCE_SNAP_MODE_VOLUME, "VOLUME", ICON_SNAP_VOLUME, "Volume", "Snap to volume"},
138 {0, NULL, 0, NULL, NULL}
141 EnumPropertyItem snap_node_element_items[] = {
142 {SCE_SNAP_MODE_INCREMENT, "INCREMENT", ICON_SNAP_INCREMENT, "Increment", "Snap to increments of grid"},
143 {SCE_SNAP_MODE_NODE_X, "NODE_X", ICON_SNAP_EDGE, "Node X", "Snap to left/right node border"},
144 {SCE_SNAP_MODE_NODE_Y, "NODE_Y", ICON_SNAP_EDGE, "Node Y", "Snap to top/bottom node border"},
145 {SCE_SNAP_MODE_NODE_XY, "NODE_XY", ICON_SNAP_EDGE, "Node X / Y", "Snap to any node border"},
146 {0, NULL, 0, NULL, NULL}
150 /* workaround for duplicate enums,
151 * have each enum line as a defne then conditionally set it or not
154 #define R_IMF_ENUM_BMP {R_IMF_IMTYPE_BMP, "BMP", ICON_FILE_IMAGE, "BMP", "Output image in bitmap format"},
155 #define R_IMF_ENUM_IRIS {R_IMF_IMTYPE_IRIS, "IRIS", ICON_FILE_IMAGE, "Iris", \
156 "Output image in (old!) SGI IRIS format"},
157 #define R_IMF_ENUM_PNG {R_IMF_IMTYPE_PNG, "PNG", ICON_FILE_IMAGE, "PNG", "Output image in PNG format"},
158 #define R_IMF_ENUM_JPEG {R_IMF_IMTYPE_JPEG90, "JPEG", ICON_FILE_IMAGE, "JPEG", "Output image in JPEG format"},
159 #define R_IMF_ENUM_TAGA {R_IMF_IMTYPE_TARGA, "TARGA", ICON_FILE_IMAGE, "Targa", "Output image in Targa format"},
160 #define R_IMF_ENUM_TAGA_RAW {R_IMF_IMTYPE_RAWTGA, "TARGA_RAW", ICON_FILE_IMAGE, "Targa Raw", \
161 "Output image in uncompressed Targa format"},
163 #if 0 /* UNUSED (so far) */
165 # define R_IMF_ENUM_DDS {R_IMF_IMTYPE_DDS, "DDS", ICON_FILE_IMAGE, "DDS", "Output image in DDS format"},
167 # define R_IMF_ENUM_DDS
172 # define R_IMF_ENUM_JPEG2K {R_IMF_IMTYPE_JP2, "JPEG2000", ICON_FILE_IMAGE, "JPEG 2000", \
173 "Output image in JPEG 2000 format"},
175 # define R_IMF_ENUM_JPEG2K
179 # define R_IMF_ENUM_CINEON {R_IMF_IMTYPE_CINEON, "CINEON", ICON_FILE_IMAGE, "Cineon", \
180 "Output image in Cineon format"},
181 # define R_IMF_ENUM_DPX {R_IMF_IMTYPE_DPX, "DPX", ICON_FILE_IMAGE, "DPX", "Output image in DPX format"},
183 # define R_IMF_ENUM_CINEON
184 # define R_IMF_ENUM_DPX
188 # define R_IMF_ENUM_EXR_MULTI {R_IMF_IMTYPE_MULTILAYER, "OPEN_EXR_MULTILAYER", ICON_FILE_IMAGE, \
189 "OpenEXR MultiLayer", \
190 "Output image in multilayer OpenEXR format"},
191 # define R_IMF_ENUM_EXR {R_IMF_IMTYPE_OPENEXR, "OPEN_EXR", ICON_FILE_IMAGE, "OpenEXR", \
192 "Output image in OpenEXR format"},
194 # define R_IMF_ENUM_EXR_MULTI
195 # define R_IMF_ENUM_EXR
199 # define R_IMF_ENUM_HDR {R_IMF_IMTYPE_RADHDR, "HDR", ICON_FILE_IMAGE, "Radiance HDR", \
200 "Output image in Radiance HDR format"},
202 # define R_IMF_ENUM_HDR
206 # define R_IMF_ENUM_TIFF {R_IMF_IMTYPE_TIFF, "TIFF", ICON_FILE_IMAGE, "TIFF", "Output image in TIFF format"},
208 # define R_IMF_ENUM_TIFF
212 #define IMAGE_TYPE_ITEMS_IMAGE_ONLY \
214 /* DDS save not supported yet R_IMF_ENUM_DDS */ \
220 R_IMF_ENUM_TAGA_RAW \
221 {0, "", 0, " ", NULL}, \
224 R_IMF_ENUM_EXR_MULTI \
230 EnumPropertyItem image_only_type_items[] = {
232 IMAGE_TYPE_ITEMS_IMAGE_ONLY
234 {0, NULL, 0, NULL, NULL}
237 EnumPropertyItem image_type_items[] = {
238 {0, "", 0, N_("Image"), NULL},
240 IMAGE_TYPE_ITEMS_IMAGE_ONLY
242 {0, "", 0, N_("Movie"), NULL},
243 {R_IMF_IMTYPE_AVIJPEG, "AVI_JPEG", ICON_FILE_MOVIE, "AVI JPEG", "Output video in AVI JPEG format"},
244 {R_IMF_IMTYPE_AVIRAW, "AVI_RAW", ICON_FILE_MOVIE, "AVI Raw", "Output video in AVI Raw format"},
245 #ifdef WITH_FRAMESERVER
246 {R_IMF_IMTYPE_FRAMESERVER, "FRAMESERVER", ICON_FILE_SCRIPT, "Frame Server", "Output image to a frameserver"},
249 {R_IMF_IMTYPE_H264, "H264", ICON_FILE_MOVIE, "H.264", "Output video in H.264 format"},
250 {R_IMF_IMTYPE_FFMPEG, "FFMPEG", ICON_FILE_MOVIE, "MPEG", "Output video in MPEG format"},
251 {R_IMF_IMTYPE_THEORA, "THEORA", ICON_FILE_MOVIE, "Ogg Theora", "Output video in Ogg format"},
253 #ifdef WITH_QUICKTIME
255 {R_IMF_IMTYPE_QUICKTIME, "QUICKTIME_QTKIT", ICON_FILE_MOVIE, "QuickTime", "Output video in Quicktime format"},
257 {R_IMF_IMTYPE_QUICKTIME, "QUICKTIME_CARBON", ICON_FILE_MOVIE, "QuickTime", "Output video in Quicktime format"},
261 {R_IMF_IMTYPE_XVID, "XVID", ICON_FILE_MOVIE, "Xvid", "Output video in Xvid format"},
263 {0, NULL, 0, NULL, NULL}
266 EnumPropertyItem image_color_mode_items[] = {
267 {R_IMF_PLANES_BW, "BW", 0, "BW", "Images get saved in 8 bits grayscale (only PNG, JPEG, TGA, TIF)"},
268 {R_IMF_PLANES_RGB, "RGB", 0, "RGB", "Images are saved with RGB (color) data"},
269 {R_IMF_PLANES_RGBA, "RGBA", 0, "RGBA", "Images are saved with RGB and Alpha data (if supported)"},
270 {0, NULL, 0, NULL, NULL}
273 #define IMAGE_COLOR_MODE_BW image_color_mode_items[0]
274 #define IMAGE_COLOR_MODE_RGB image_color_mode_items[1]
275 #define IMAGE_COLOR_MODE_RGBA image_color_mode_items[2]
277 EnumPropertyItem image_color_depth_items[] = {
278 /* 1 (monochrome) not used */
279 {R_IMF_CHAN_DEPTH_8, "8", 0, "8", "8 bit color channels"},
280 {R_IMF_CHAN_DEPTH_10, "10", 0, "10", "10 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 #include "FRS_freestyle.h"
330 static void rna_SpaceImageEditor_uv_sculpt_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr))
332 ED_space_image_uv_sculpt_update(bmain->wm.first, scene->toolsettings);
335 static int rna_Scene_object_bases_lookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr)
337 Scene *scene = (Scene *)ptr->data;
340 for (base = scene->base.first; base; base = base->next) {
341 if (strncmp(base->object->id.name + 2, key, sizeof(base->object->id.name) - 2) == 0) {
342 *r_ptr = rna_pointer_inherit_refine(ptr, &RNA_ObjectBase, base);
350 static PointerRNA rna_Scene_objects_get(CollectionPropertyIterator *iter)
352 ListBaseIterator *internal = iter->internal;
354 /* we are actually iterating a Base list, so override get */
355 return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, ((Base *)internal->link)->object);
358 static Base *rna_Scene_object_link(Scene *scene, bContext *C, ReportList *reports, Object *ob)
360 Scene *scene_act = CTX_data_scene(C);
363 if (BKE_scene_base_find(scene, ob)) {
364 BKE_reportf(reports, RPT_ERROR, "Object '%s' is already in scene '%s'", ob->id.name + 2, scene->id.name + 2);
368 base = BKE_scene_base_add(scene, ob);
371 /* this is similar to what object_add_type and BKE_object_add do */
372 base->lay = scene->lay;
374 /* when linking to an inactive scene don't touch the layer */
375 if (scene == scene_act)
378 ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
380 /* slows down importers too much, run scene.update() */
381 /* DAG_scene_sort(G.main, scene); */
383 WM_main_add_notifier(NC_SCENE | ND_OB_ACTIVE, scene);
388 static void rna_Scene_object_unlink(Scene *scene, ReportList *reports, Object *ob)
390 Base *base = BKE_scene_base_find(scene, ob);
392 BKE_reportf(reports, RPT_ERROR, "Object '%s' is not in this scene '%s'", ob->id.name + 2, scene->id.name + 2);
395 if (base == scene->basact && ob->mode != OB_MODE_OBJECT) {
396 BKE_reportf(reports, RPT_ERROR, "Object '%s' must be in object mode to unlink", ob->id.name + 2);
399 if (scene->basact == base) {
400 scene->basact = NULL;
403 BLI_remlink(&scene->base, base);
408 /* needed otherwise the depgraph will contain freed objects which can crash, see [#20958] */
409 DAG_scene_sort(G.main, scene);
410 DAG_ids_flush_update(G.main, 0);
412 WM_main_add_notifier(NC_SCENE | ND_OB_ACTIVE, scene);
415 static void rna_Scene_skgen_etch_template_set(PointerRNA *ptr, PointerRNA value)
417 ToolSettings *ts = (ToolSettings *)ptr->data;
418 if (value.data && ((Object *)value.data)->type == OB_ARMATURE)
419 ts->skgen_template = value.data;
421 ts->skgen_template = NULL;
424 static PointerRNA rna_Scene_active_object_get(PointerRNA *ptr)
426 Scene *scene = (Scene *)ptr->data;
427 return rna_pointer_inherit_refine(ptr, &RNA_Object, scene->basact ? scene->basact->object : NULL);
430 static void rna_Scene_active_object_set(PointerRNA *ptr, PointerRNA value)
432 Scene *scene = (Scene *)ptr->data;
434 scene->basact = BKE_scene_base_find(scene, (Object *)value.data);
436 scene->basact = NULL;
439 static void rna_Scene_set_set(PointerRNA *ptr, PointerRNA value)
441 Scene *scene = (Scene *)ptr->data;
442 Scene *set = (Scene *)value.data;
445 for (nested_set = set; nested_set; nested_set = nested_set->set) {
446 if (nested_set == scene)
453 static void rna_Scene_layer_set(PointerRNA *ptr, const int *values)
455 Scene *scene = (Scene *)ptr->data;
457 scene->lay = ED_view3d_scene_layer_set(scene->lay, values, &scene->layact);
460 static int rna_Scene_active_layer_get(PointerRNA *ptr)
462 Scene *scene = (Scene *)ptr->data;
464 return (int)(log(scene->layact) / M_LN2);
467 static void rna_Scene_view3d_update(Main *bmain, Scene *UNUSED(scene_unused), PointerRNA *ptr)
469 Scene *scene = (Scene *)ptr->data;
471 BKE_screen_view3d_main_sync(&bmain->screen, scene);
474 static void rna_Scene_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
476 rna_Scene_view3d_update(bmain, scene, ptr);
477 DAG_on_visible_update(bmain, FALSE);
480 static void rna_Scene_fps_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
482 sound_update_fps(scene);
483 BKE_sequencer_update_sound_bounds_all(scene);
486 static void rna_Scene_listener_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
488 sound_update_scene_listener(scene);
491 static void rna_Scene_volume_set(PointerRNA *ptr, float value)
493 Scene *scene = (Scene *)(ptr->data);
495 scene->audio.volume = value;
496 if (scene->sound_scene)
497 sound_set_scene_volume(scene, value);
500 static void rna_Scene_framelen_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
502 scene->r.framelen = (float)scene->r.framapto / (float)scene->r.images;
506 static void rna_Scene_frame_current_set(PointerRNA *ptr, int value)
508 Scene *data = (Scene *)ptr->data;
510 /* if negative frames aren't allowed, then we can't use them */
511 FRAMENUMBER_MIN_CLAMP(value);
512 data->r.cfra = value;
515 static void rna_Scene_start_frame_set(PointerRNA *ptr, int value)
517 Scene *data = (Scene *)ptr->data;
518 /* MINFRAME not MINAFRAME, since some output formats can't taken negative frames */
519 CLAMP(value, MINFRAME, MAXFRAME);
520 data->r.sfra = value;
522 if (data->r.sfra >= data->r.efra) {
523 data->r.efra = MIN2(data->r.sfra, MAXFRAME);
527 static void rna_Scene_end_frame_set(PointerRNA *ptr, int value)
529 Scene *data = (Scene *)ptr->data;
530 CLAMP(value, MINFRAME, MAXFRAME);
531 data->r.efra = value;
533 if (data->r.sfra >= data->r.efra) {
534 data->r.sfra = MAX2(data->r.efra, MINFRAME);
538 static void rna_Scene_use_preview_range_set(PointerRNA *ptr, int value)
540 Scene *data = (Scene *)ptr->data;
543 /* copy range from scene if not set before */
544 if ((data->r.psfra == data->r.pefra) && (data->r.psfra == 0)) {
545 data->r.psfra = data->r.sfra;
546 data->r.pefra = data->r.efra;
549 data->r.flag |= SCER_PRV_RANGE;
552 data->r.flag &= ~SCER_PRV_RANGE;
556 static void rna_Scene_preview_range_start_frame_set(PointerRNA *ptr, int value)
558 Scene *data = (Scene *)ptr->data;
560 /* check if enabled already */
561 if ((data->r.flag & SCER_PRV_RANGE) == 0) {
562 /* set end of preview range to end frame, then clamp as per normal */
563 /* TODO: or just refuse to set instead? */
564 data->r.pefra = data->r.efra;
567 /* now set normally */
568 CLAMP(value, MINAFRAME, data->r.pefra);
569 data->r.psfra = value;
572 static void rna_Scene_preview_range_end_frame_set(PointerRNA *ptr, int value)
574 Scene *data = (Scene *)ptr->data;
576 /* check if enabled already */
577 if ((data->r.flag & SCER_PRV_RANGE) == 0) {
578 /* set start of preview range to start frame, then clamp as per normal */
579 /* TODO: or just refuse to set instead? */
580 data->r.psfra = data->r.sfra;
583 /* now set normally */
584 CLAMP(value, data->r.psfra, MAXFRAME);
585 data->r.pefra = value;
588 static void rna_Scene_frame_update(Main *bmain, Scene *UNUSED(current_scene), PointerRNA *ptr)
590 Scene *scene = (Scene *)ptr->id.data;
591 sound_seek_scene(bmain, scene);
594 static PointerRNA rna_Scene_active_keying_set_get(PointerRNA *ptr)
596 Scene *scene = (Scene *)ptr->data;
597 return rna_pointer_inherit_refine(ptr, &RNA_KeyingSet, ANIM_scene_get_active_keyingset(scene));
600 static void rna_Scene_active_keying_set_set(PointerRNA *ptr, PointerRNA value)
602 Scene *scene = (Scene *)ptr->data;
603 KeyingSet *ks = (KeyingSet *)value.data;
605 scene->active_keyingset = ANIM_scene_get_keyingset_index(scene, ks);
608 /* get KeyingSet index stuff for list of Keying Sets editing UI
609 * - active_keyingset-1 since 0 is reserved for 'none'
610 * - don't clamp, otherwise can never set builtins types as active...
612 static int rna_Scene_active_keying_set_index_get(PointerRNA *ptr)
614 Scene *scene = (Scene *)ptr->data;
615 return scene->active_keyingset - 1;
618 /* get KeyingSet index stuff for list of Keying Sets editing UI
619 * - value+1 since 0 is reserved for 'none'
621 static void rna_Scene_active_keying_set_index_set(PointerRNA *ptr, int value)
623 Scene *scene = (Scene *)ptr->data;
624 scene->active_keyingset = value + 1;
627 /* XXX: evil... builtin_keyingsets is defined in keyingsets.c! */
628 /* TODO: make API function to retrieve this... */
629 extern ListBase builtin_keyingsets;
631 static void rna_Scene_all_keyingsets_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
633 Scene *scene = (Scene *)ptr->data;
635 /* start going over the scene KeyingSets first, while we still have pointer to it
636 * but only if we have any Keying Sets to use...
638 if (scene->keyingsets.first)
639 rna_iterator_listbase_begin(iter, &scene->keyingsets, NULL);
641 rna_iterator_listbase_begin(iter, &builtin_keyingsets, NULL);
644 static void rna_Scene_all_keyingsets_next(CollectionPropertyIterator *iter)
646 ListBaseIterator *internal = iter->internal;
647 KeyingSet *ks = (KeyingSet *)internal->link;
649 /* if we've run out of links in Scene list, jump over to the builtins list unless we're there already */
650 if ((ks->next == NULL) && (ks != builtin_keyingsets.last))
651 internal->link = (Link *)builtin_keyingsets.first;
653 internal->link = (Link *)ks->next;
655 iter->valid = (internal->link != NULL);
658 static char *rna_RenderSettings_path(PointerRNA *UNUSED(ptr))
660 return BLI_sprintfN("render");
663 static int rna_RenderSettings_threads_get(PointerRNA *ptr)
665 RenderData *rd = (RenderData *)ptr->data;
667 if (rd->mode & R_FIXED_THREADS)
670 return BLI_system_thread_count();
673 static int rna_RenderSettings_is_movie_fomat_get(PointerRNA *ptr)
675 RenderData *rd = (RenderData *)ptr->data;
676 return BKE_imtype_is_movie(rd->im_format.imtype);
679 static int rna_RenderSettings_save_buffers_get(PointerRNA *ptr)
681 RenderData *rd = (RenderData *)ptr->data;
682 if (rd->mode & R_BORDER)
685 return (rd->scemode & (R_EXR_TILE_FILE | R_FULL_SAMPLE)) != 0;
688 static int rna_RenderSettings_full_sample_get(PointerRNA *ptr)
690 RenderData *rd = (RenderData *)ptr->data;
692 return (rd->scemode & R_FULL_SAMPLE) && !(rd->mode & R_BORDER);
695 static void rna_ImageFormatSettings_file_format_set(PointerRNA *ptr, int value)
697 ImageFormatData *imf = (ImageFormatData *)ptr->data;
698 ID *id = ptr->id.data;
699 const char is_render = (id && GS(id->name) == ID_SCE);
700 /* see note below on why this is */
701 const char chan_flag = BKE_imtype_valid_channels(imf->imtype) | (is_render ? IMA_CHAN_FLAG_BW : 0);
705 /* ensure depth and color settings match */
706 if ( ((imf->planes == R_IMF_PLANES_BW) && !(chan_flag & IMA_CHAN_FLAG_BW)) ||
707 ((imf->planes == R_IMF_PLANES_RGBA) && !(chan_flag & IMA_CHAN_FLAG_ALPHA)))
709 imf->planes = R_IMF_PLANES_RGB;
712 /* ensure usable depth */
714 const int depth_ok = BKE_imtype_valid_depths(imf->imtype);
715 if ((imf->depth & depth_ok) == 0) {
716 /* set first available depth */
717 char depth_ls[] = {R_IMF_CHAN_DEPTH_32,
727 for (i = 0; depth_ls[i]; i++) {
728 if (depth_ok & depth_ls[i]) {
729 imf->depth = depth_ls[i];
736 if (id && GS(id->name) == ID_SCE) {
737 Scene *scene = ptr->id.data;
738 RenderData *rd = &scene->r;
740 BKE_ffmpeg_image_type_verify(rd, imf);
742 #ifdef WITH_QUICKTIME
743 quicktime_verify_image_type(rd, imf);
749 static EnumPropertyItem *rna_ImageFormatSettings_file_format_itemf(bContext *C, PointerRNA *ptr,
750 PropertyRNA *UNUSED(prop), int *UNUSED(free))
752 ID *id = ptr->id.data;
753 if (id && GS(id->name) == ID_SCE) {
754 return image_type_items;
757 return image_only_type_items;
761 static EnumPropertyItem *rna_ImageFormatSettings_color_mode_itemf(bContext *C, PointerRNA *ptr,
762 PropertyRNA *UNUSED(prop), int *free)
764 ImageFormatData *imf = (ImageFormatData *)ptr->data;
765 ID *id = ptr->id.data;
766 const char is_render = (id && GS(id->name) == ID_SCE);
768 /* note, we need to act differently for render
769 * where 'BW' will force grayscale even if the output format writes
770 * as RGBA, this is age old blender convention and not sure how useful
771 * it really is but keep it for now - campbell */
772 char chan_flag = BKE_imtype_valid_channels(imf->imtype) | (is_render ? IMA_CHAN_FLAG_BW : 0);
775 /* a WAY more crappy case than B&W flag: depending on codec, file format MIGHT support
776 * alpha channel. for example MPEG format with h264 codec can't do alpha channel, but
777 * the same MPEG format with QTRLE codec can easily handle alpha channel.
778 * not sure how to deal with such cases in a nicer way (sergey) */
780 Scene *scene = ptr->id.data;
781 RenderData *rd = &scene->r;
783 if (BKE_ffmpeg_alpha_channel_is_supported(rd))
784 chan_flag |= IMA_CHAN_FLAG_ALPHA;
788 if (chan_flag == (IMA_CHAN_FLAG_BW | IMA_CHAN_FLAG_RGB | IMA_CHAN_FLAG_ALPHA)) {
789 return image_color_mode_items;
793 EnumPropertyItem *item = NULL;
795 if (chan_flag & IMA_CHAN_FLAG_BW) RNA_enum_item_add(&item, &totitem, &IMAGE_COLOR_MODE_BW);
796 if (chan_flag & IMA_CHAN_FLAG_RGB) RNA_enum_item_add(&item, &totitem, &IMAGE_COLOR_MODE_RGB);
797 if (chan_flag & IMA_CHAN_FLAG_ALPHA) RNA_enum_item_add(&item, &totitem, &IMAGE_COLOR_MODE_RGBA);
799 RNA_enum_item_end(&item, &totitem);
806 static EnumPropertyItem *rna_ImageFormatSettings_color_depth_itemf(bContext *C, PointerRNA *ptr,
807 PropertyRNA *UNUSED(prop), int *free)
809 ImageFormatData *imf = (ImageFormatData *)ptr->data;
812 return image_color_depth_items;
815 const int depth_ok = BKE_imtype_valid_depths(imf->imtype);
816 const int is_float = ELEM3(imf->imtype, R_IMF_IMTYPE_RADHDR, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER);
818 EnumPropertyItem *item_8bit = &image_color_depth_items[0];
819 EnumPropertyItem *item_10bit = &image_color_depth_items[1];
820 EnumPropertyItem *item_12bit = &image_color_depth_items[2];
821 EnumPropertyItem *item_16bit = &image_color_depth_items[3];
822 EnumPropertyItem *item_32bit = &image_color_depth_items[4];
825 EnumPropertyItem *item = NULL;
826 EnumPropertyItem tmp = {0, "", 0, "", ""};
828 if (depth_ok & R_IMF_CHAN_DEPTH_8) {
829 RNA_enum_item_add(&item, &totitem, item_8bit);
832 if (depth_ok & R_IMF_CHAN_DEPTH_10) {
833 RNA_enum_item_add(&item, &totitem, item_10bit);
836 if (depth_ok & R_IMF_CHAN_DEPTH_12) {
837 RNA_enum_item_add(&item, &totitem, item_12bit);
840 if (depth_ok & R_IMF_CHAN_DEPTH_16) {
843 tmp.name = "Float (Half)";
844 RNA_enum_item_add(&item, &totitem, &tmp);
847 RNA_enum_item_add(&item, &totitem, item_16bit);
851 if (depth_ok & R_IMF_CHAN_DEPTH_32) {
854 tmp.name = "Float (Full)";
855 RNA_enum_item_add(&item, &totitem, &tmp);
858 RNA_enum_item_add(&item, &totitem, item_32bit);
862 RNA_enum_item_end(&item, &totitem);
869 static int rna_SceneRender_file_ext_length(PointerRNA *ptr)
871 RenderData *rd = (RenderData *)ptr->data;
874 BKE_add_image_extension(ext, rd->im_format.imtype);
878 static void rna_SceneRender_file_ext_get(PointerRNA *ptr, char *str)
880 RenderData *rd = (RenderData *)ptr->data;
882 BKE_add_image_extension(str, rd->im_format.imtype);
885 #ifdef WITH_QUICKTIME
886 static int rna_RenderSettings_qtcodecsettings_codecType_get(PointerRNA *ptr)
888 QuicktimeCodecSettings *settings = (QuicktimeCodecSettings *)ptr->data;
890 return quicktime_rnatmpvalue_from_videocodectype(settings->codecType);
893 static void rna_RenderSettings_qtcodecsettings_codecType_set(PointerRNA *ptr, int value)
895 QuicktimeCodecSettings *settings = (QuicktimeCodecSettings *)ptr->data;
897 settings->codecType = quicktime_videocodecType_from_rnatmpvalue(value);
900 static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_codecType_itemf(bContext *C, PointerRNA *ptr,
901 PropertyRNA *UNUSED(prop), int *free)
903 EnumPropertyItem *item = NULL;
904 EnumPropertyItem tmp = {0, "", 0, "", ""};
905 QuicktimeCodecTypeDesc *codecTypeDesc;
906 int i = 1, totitem = 0;
909 for (i = 0; i < quicktime_get_num_videocodecs(); i++) {
910 codecTypeDesc = quicktime_get_videocodecType_desc(i);
911 if (!codecTypeDesc) break;
913 tmp.value = codecTypeDesc->rnatmpvalue;
914 *((int *)id) = codecTypeDesc->codecType;
917 tmp.name = codecTypeDesc->codecName;
918 RNA_enum_item_add(&item, &totitem, &tmp);
921 RNA_enum_item_end(&item, &totitem);
928 static int rna_RenderSettings_qtcodecsettings_audiocodecType_get(PointerRNA *ptr)
930 QuicktimeCodecSettings *settings = (QuicktimeCodecSettings *)ptr->data;
932 return quicktime_rnatmpvalue_from_audiocodectype(settings->audiocodecType);
935 static void rna_RenderSettings_qtcodecsettings_audiocodecType_set(PointerRNA *ptr, int value)
937 QuicktimeCodecSettings *settings = (QuicktimeCodecSettings *)ptr->data;
939 settings->audiocodecType = quicktime_audiocodecType_from_rnatmpvalue(value);
942 static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_audiocodecType_itemf(bContext *C, PointerRNA *ptr,
943 PropertyRNA *UNUSED(prop), int *free)
945 EnumPropertyItem *item = NULL;
946 EnumPropertyItem tmp = {0, "", 0, "", ""};
947 QuicktimeCodecTypeDesc *codecTypeDesc;
948 int i = 1, totitem = 0;
950 for (i = 0; i < quicktime_get_num_audiocodecs(); i++) {
951 codecTypeDesc = quicktime_get_audiocodecType_desc(i);
952 if (!codecTypeDesc) break;
954 tmp.value = codecTypeDesc->rnatmpvalue;
955 tmp.identifier = codecTypeDesc->codecName;
956 tmp.name = codecTypeDesc->codecName;
957 RNA_enum_item_add(&item, &totitem, &tmp);
960 RNA_enum_item_end(&item, &totitem);
969 static void rna_FFmpegSettings_lossless_output_set(PointerRNA *ptr, int value)
971 Scene *scene = (Scene *) ptr->id.data;
972 RenderData *rd = &scene->r;
975 rd->ffcodecdata.flags |= FFMPEG_LOSSLESS_OUTPUT;
977 rd->ffcodecdata.flags &= ~FFMPEG_LOSSLESS_OUTPUT;
979 BKE_ffmpeg_codec_settings_verify(rd);
982 static void rna_FFmpegSettings_codec_settings_update(Main *UNUSED(bmain), Scene *UNUSED(scene_unused), PointerRNA *ptr)
984 Scene *scene = (Scene *) ptr->id.data;
985 RenderData *rd = &scene->r;
987 BKE_ffmpeg_codec_settings_verify(rd);
991 static int rna_RenderSettings_active_layer_index_get(PointerRNA *ptr)
993 RenderData *rd = (RenderData *)ptr->data;
997 static void rna_RenderSettings_active_layer_index_set(PointerRNA *ptr, int value)
999 RenderData *rd = (RenderData *)ptr->data;
1003 static void rna_RenderSettings_active_layer_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
1005 RenderData *rd = (RenderData *)ptr->data;
1008 *max = max_ii(0, BLI_countlist(&rd->layers) - 1);
1011 static PointerRNA rna_RenderSettings_active_layer_get(PointerRNA *ptr)
1013 RenderData *rd = (RenderData *)ptr->data;
1014 SceneRenderLayer *srl = BLI_findlink(&rd->layers, rd->actlay);
1016 return rna_pointer_inherit_refine(ptr, &RNA_SceneRenderLayer, srl);
1019 static void rna_RenderSettings_active_layer_set(PointerRNA *ptr, PointerRNA value)
1021 RenderData *rd = (RenderData *)ptr->data;
1022 SceneRenderLayer *srl = (SceneRenderLayer *)value.data;
1023 const int index = BLI_findindex(&rd->layers, srl);
1024 if (index != -1) rd->actlay = index;
1027 static SceneRenderLayer *rna_RenderLayer_new(ID *id, RenderData *UNUSED(rd), const char *name)
1029 Scene *scene = (Scene *)id;
1030 SceneRenderLayer *srl = BKE_scene_add_render_layer(scene, name);
1032 WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
1037 static void rna_RenderLayer_remove(ID *id, RenderData *UNUSED(rd), Main *bmain, ReportList *reports,
1038 PointerRNA *srl_ptr)
1040 SceneRenderLayer *srl = srl_ptr->data;
1041 Scene *scene = (Scene *)id;
1043 if (!BKE_scene_remove_render_layer(bmain, scene, srl)) {
1044 BKE_reportf(reports, RPT_ERROR, "Render layer '%s' could not be removed from scene '%s'",
1045 srl->name, scene->id.name + 2);
1049 RNA_POINTER_INVALIDATE(srl_ptr);
1051 WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
1054 static void rna_RenderSettings_engine_set(PointerRNA *ptr, int value)
1056 RenderData *rd = (RenderData *)ptr->data;
1057 RenderEngineType *type = BLI_findlink(&R_engines, value);
1060 BLI_strncpy_utf8(rd->engine, type->idname, sizeof(rd->engine));
1063 static EnumPropertyItem *rna_RenderSettings_engine_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr),
1064 PropertyRNA *UNUSED(prop), int *free)
1066 RenderEngineType *type;
1067 EnumPropertyItem *item = NULL;
1068 EnumPropertyItem tmp = {0, "", 0, "", ""};
1069 int a = 0, totitem = 0;
1071 for (type = R_engines.first; type; type = type->next, a++) {
1073 tmp.identifier = type->idname;
1074 tmp.name = type->name;
1075 RNA_enum_item_add(&item, &totitem, &tmp);
1078 RNA_enum_item_end(&item, &totitem);
1084 static int rna_RenderSettings_engine_get(PointerRNA *ptr)
1086 RenderData *rd = (RenderData *)ptr->data;
1087 RenderEngineType *type;
1090 for (type = R_engines.first; type; type = type->next, a++)
1091 if (strcmp(type->idname, rd->engine) == 0)
1097 static void rna_RenderSettings_engine_update(Main *bmain, Scene *UNUSED(unused), PointerRNA *UNUSED(ptr))
1099 ED_render_engine_changed(bmain);
1102 static void rna_Scene_glsl_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1104 Scene *scene = (Scene *)ptr->id.data;
1106 DAG_id_tag_update(&scene->id, 0);
1109 static void rna_SceneRenderLayer_name_set(PointerRNA *ptr, const char *value)
1111 Scene *scene = (Scene *)ptr->id.data;
1112 SceneRenderLayer *rl = (SceneRenderLayer *)ptr->data;
1113 BLI_strncpy_utf8(rl->name, value, sizeof(rl->name));
1114 BLI_uniquename(&scene->r.layers, rl, "RenderLayer", '.', offsetof(SceneRenderLayer, name), sizeof(rl->name));
1116 if (scene->nodetree) {
1118 int index = BLI_findindex(&scene->r.layers, rl);
1120 for (node = scene->nodetree->nodes.first; node; node = node->next) {
1121 if (node->type == CMP_NODE_R_LAYERS && node->id == NULL) {
1122 if (node->custom1 == index)
1123 BLI_strncpy(node->name, rl->name, NODE_MAXSTR);
1129 static int rna_RenderSettings_multiple_engines_get(PointerRNA *UNUSED(ptr))
1131 return (BLI_countlist(&R_engines) > 1);
1134 static int rna_RenderSettings_use_shading_nodes_get(PointerRNA *ptr)
1136 Scene *scene = (Scene *)ptr->id.data;
1137 return BKE_scene_use_new_shading_nodes(scene);
1140 static int rna_RenderSettings_use_game_engine_get(PointerRNA *ptr)
1142 RenderData *rd = (RenderData *)ptr->data;
1143 RenderEngineType *type;
1145 for (type = R_engines.first; type; type = type->next)
1146 if (strcmp(type->idname, rd->engine) == 0)
1147 return (type->flag & RE_GAME);
1152 static void rna_SceneRenderLayer_layer_set(PointerRNA *ptr, const int *values)
1154 SceneRenderLayer *rl = (SceneRenderLayer *)ptr->data;
1155 rl->lay = ED_view3d_scene_layer_set(rl->lay, values, NULL);
1158 static void rna_SceneRenderLayer_pass_update(Main *bmain, Scene *activescene, PointerRNA *ptr)
1160 Scene *scene = (Scene *)ptr->id.data;
1162 if (scene->nodetree)
1163 ntreeCompositForceHidden(scene->nodetree, scene);
1165 rna_Scene_glsl_update(bmain, activescene, ptr);
1168 static void rna_Scene_use_nodes_set(PointerRNA *ptr, int value)
1170 Scene *scene = (Scene *)ptr->data;
1172 scene->use_nodes = value;
1173 if (scene->use_nodes && scene->nodetree == NULL)
1174 ED_node_composit_default(scene);
1177 static void rna_Physics_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1179 Scene *scene = (Scene *)ptr->id.data;
1182 for (base = scene->base.first; base; base = base->next)
1183 BKE_ptcache_object_reset(scene, base->object, PTCACHE_RESET_DEPSGRAPH);
1186 static void rna_Scene_editmesh_select_mode_set(PointerRNA *ptr, const int *value)
1188 Scene *scene = (Scene *)ptr->id.data;
1189 ToolSettings *ts = (ToolSettings *)ptr->data;
1190 int flag = (value[0] ? SCE_SELECT_VERTEX : 0) | (value[1] ? SCE_SELECT_EDGE : 0) | (value[2] ? SCE_SELECT_FACE : 0);
1193 ts->selectmode = flag;
1195 if (scene->basact) {
1196 Mesh *me = BKE_mesh_from_object(scene->basact->object);
1197 if (me && me->edit_btmesh && me->edit_btmesh->selectmode != flag) {
1198 me->edit_btmesh->selectmode = flag;
1199 EDBM_selectmode_set(me->edit_btmesh);
1205 static void rna_Scene_editmesh_select_mode_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
1209 if (scene->basact) {
1210 me = BKE_mesh_from_object(scene->basact->object);
1211 if (me && me->edit_btmesh == NULL)
1215 WM_main_add_notifier(NC_GEOM | ND_SELECT, me);
1216 WM_main_add_notifier(NC_SCENE | ND_TOOLSETTINGS, NULL);
1219 static void object_simplify_update(Object *ob)
1222 ParticleSystem *psys;
1224 for (md = ob->modifiers.first; md; md = md->next) {
1225 if (ELEM3(md->type, eModifierType_Subsurf, eModifierType_Multires, eModifierType_ParticleSystem)) {
1226 ob->recalc |= PSYS_RECALC_CHILD;
1227 DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
1231 for (psys = ob->particlesystem.first; psys; psys = psys->next)
1232 psys->recalc |= PSYS_RECALC_CHILD;
1234 if (ob->dup_group) {
1237 for (gob = ob->dup_group->gobject.first; gob; gob = gob->next)
1238 object_simplify_update(gob->ob);
1242 static void rna_Scene_use_simplify_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr))
1247 for (SETLOOPER(scene, sce_iter, base))
1248 object_simplify_update(base->object);
1250 DAG_ids_flush_update(bmain, 0);
1251 WM_main_add_notifier(NC_GEOM | ND_DATA, NULL);
1254 static void rna_Scene_simplify_update(Main *bmain, Scene *scene, PointerRNA *ptr)
1256 if (scene->r.mode & R_SIMPLIFY)
1257 rna_Scene_use_simplify_update(bmain, scene, ptr);
1260 static void rna_Scene_use_persistent_data_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr))
1262 if (!(scene->r.mode & R_PERSISTENT_DATA))
1263 RE_FreePersistentData();
1266 static int rna_Scene_use_audio_get(PointerRNA *ptr)
1268 Scene *scene = (Scene *)ptr->data;
1269 return scene->audio.flag & AUDIO_MUTE;
1272 static void rna_Scene_use_audio_set(PointerRNA *ptr, int value)
1274 Scene *scene = (Scene *)ptr->data;
1277 scene->audio.flag |= AUDIO_MUTE;
1279 scene->audio.flag &= ~AUDIO_MUTE;
1281 sound_mute_scene(scene, value);
1284 static int rna_Scene_sync_mode_get(PointerRNA *ptr)
1286 Scene *scene = (Scene *)ptr->data;
1287 if (scene->audio.flag & AUDIO_SYNC)
1289 return scene->flag & SCE_FRAME_DROP;
1292 static void rna_Scene_sync_mode_set(PointerRNA *ptr, int value)
1294 Scene *scene = (Scene *)ptr->data;
1296 if (value == AUDIO_SYNC) {
1297 scene->audio.flag |= AUDIO_SYNC;
1299 else if (value == SCE_FRAME_DROP) {
1300 scene->audio.flag &= ~AUDIO_SYNC;
1301 scene->flag |= SCE_FRAME_DROP;
1304 scene->audio.flag &= ~AUDIO_SYNC;
1305 scene->flag &= ~SCE_FRAME_DROP;
1309 static int rna_GameSettings_auto_start_get(PointerRNA *UNUSED(ptr))
1311 if (G.fileflags & G_FILE_AUTOPLAY)
1317 static void rna_GameSettings_auto_start_set(PointerRNA *UNUSED(ptr), int value)
1320 G.fileflags |= G_FILE_AUTOPLAY;
1322 G.fileflags &= ~G_FILE_AUTOPLAY;
1325 static void rna_GameSettings_exit_key_set(PointerRNA *ptr, int value)
1327 GameData *gm = (GameData *)ptr->data;
1329 if (ISKEYBOARD(value))
1330 gm->exitkey = value;
1333 static TimeMarker *rna_TimeLine_add(Scene *scene, const char name[])
1335 TimeMarker *marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker");
1336 marker->flag = SELECT;
1338 BLI_strncpy_utf8(marker->name, name, sizeof(marker->name));
1339 BLI_addtail(&scene->markers, marker);
1341 WM_main_add_notifier(NC_SCENE | ND_MARKERS, NULL);
1342 WM_main_add_notifier(NC_ANIMATION | ND_MARKERS, NULL);
1347 static void rna_TimeLine_remove(Scene *scene, ReportList *reports, PointerRNA *marker_ptr)
1349 TimeMarker *marker = marker_ptr->data;
1350 if (BLI_remlink_safe(&scene->markers, marker) == FALSE) {
1351 BKE_reportf(reports, RPT_ERROR, "Timeline marker '%s' not found in scene '%s'", marker->name, scene->id.name + 2);
1356 RNA_POINTER_INVALIDATE(marker_ptr);
1358 WM_main_add_notifier(NC_SCENE | ND_MARKERS, NULL);
1359 WM_main_add_notifier(NC_ANIMATION | ND_MARKERS, NULL);
1362 static void rna_TimeLine_clear(Scene *scene)
1364 BLI_freelistN(&scene->markers);
1366 WM_main_add_notifier(NC_SCENE | ND_MARKERS, NULL);
1367 WM_main_add_notifier(NC_ANIMATION | ND_MARKERS, NULL);
1370 static KeyingSet *rna_Scene_keying_set_new(Scene *sce, ReportList *reports, const char idname[], const char name[])
1372 KeyingSet *ks = NULL;
1374 /* call the API func, and set the active keyingset index */
1375 ks = BKE_keyingset_add(&sce->keyingsets, idname, name, KEYINGSET_ABSOLUTE, 0);
1378 sce->active_keyingset = BLI_countlist(&sce->keyingsets);
1382 BKE_report(reports, RPT_ERROR, "Keying set could not be added");
1387 static void rna_UnifiedPaintSettings_size_set(PointerRNA *ptr, int value)
1389 UnifiedPaintSettings *ups = ptr->data;
1391 /* scale unprojected radius so it stays consistent with brush size */
1392 BKE_brush_scale_unprojected_radius(&ups->unprojected_radius,
1397 static void rna_UnifiedPaintSettings_unprojected_radius_set(PointerRNA *ptr, float value)
1399 UnifiedPaintSettings *ups = ptr->data;
1401 /* scale brush size so it stays consistent with unprojected_radius */
1402 BKE_brush_scale_size(&ups->size, value, ups->unprojected_radius);
1403 ups->unprojected_radius = value;
1406 /* note: without this, when Multi-Paint is activated/deactivated, the colors
1407 * will not change right away when multiple bones are selected, this function
1408 * is not for general use and only for the few cases where changing scene
1409 * settings and NOT for general purpose updates, possibly this should be
1410 * given its own notifier. */
1411 static void rna_Scene_update_active_object_data(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
1415 DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
1416 WM_main_add_notifier(NC_OBJECT | ND_DRAW, &ob->id);
1420 static void rna_SceneCamera_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1422 Scene *scene = (Scene *)ptr->id.data;
1423 Object *camera = scene->camera;
1426 DAG_id_tag_update(&camera->id, 0);
1429 static void rna_SceneSequencer_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
1431 BKE_sequencer_cache_cleanup();
1432 BKE_sequencer_preprocessed_cache_cleanup();
1435 static PointerRNA rna_FreestyleLineSet_linestyle_get(PointerRNA *ptr)
1437 FreestyleLineSet *lineset= (FreestyleLineSet *)ptr->data;
1439 return rna_pointer_inherit_refine(ptr, &RNA_FreestyleLineStyle, lineset->linestyle);
1442 static void rna_FreestyleLineSet_linestyle_set(PointerRNA *ptr, PointerRNA value)
1444 FreestyleLineSet *lineset= (FreestyleLineSet*)ptr->data;
1446 lineset->linestyle->id.us--;
1447 lineset->linestyle = (FreestyleLineStyle *)value.data;
1448 lineset->linestyle->id.us++;
1451 static PointerRNA rna_FreestyleSettings_active_lineset_get(PointerRNA *ptr)
1453 FreestyleConfig *config= (FreestyleConfig *)ptr->data;
1454 FreestyleLineSet *lineset= FRS_get_active_lineset(config);
1455 return rna_pointer_inherit_refine(ptr, &RNA_FreestyleLineSet, lineset);
1458 static void rna_FreestyleSettings_active_lineset_index_range(PointerRNA *ptr, int *min, int *max)
1460 FreestyleConfig *config= (FreestyleConfig *)ptr->data;
1462 *max= BLI_countlist(&config->linesets)-1;
1463 *max= MAX2(0, *max);
1466 static int rna_FreestyleSettings_active_lineset_index_get(PointerRNA *ptr)
1468 FreestyleConfig *config= (FreestyleConfig *)ptr->data;
1469 return FRS_get_active_lineset_index(config);
1472 static void rna_FreestyleSettings_active_lineset_index_set(PointerRNA *ptr, int value)
1474 FreestyleConfig *config= (FreestyleConfig *)ptr->data;
1475 FRS_set_active_lineset_index(config, value);
1480 static void rna_def_transform_orientation(BlenderRNA *brna)
1485 const int matrix_dimsize[] = {3, 3};
1487 srna = RNA_def_struct(brna, "TransformOrientation", NULL);
1489 prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
1490 RNA_def_property_float_sdna(prop, NULL, "mat");
1491 RNA_def_property_multi_array(prop, 2, matrix_dimsize);
1492 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
1494 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1495 RNA_def_struct_name_property(srna, prop);
1496 RNA_def_property_ui_text(prop, "Name", "Name of the custom transform orientation");
1497 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
1500 static void rna_def_tool_settings(BlenderRNA *brna)
1505 static EnumPropertyItem uv_select_mode_items[] = {
1506 {UV_SELECT_VERTEX, "VERTEX", ICON_UV_VERTEXSEL, "Vertex", "Vertex selection mode"},
1507 {UV_SELECT_EDGE, "EDGE", ICON_UV_EDGESEL, "Edge", "Edge selection mode"},
1508 {UV_SELECT_FACE, "FACE", ICON_UV_FACESEL, "Face", "Face selection mode"},
1509 {UV_SELECT_ISLAND, "ISLAND", ICON_UV_ISLANDSEL, "Island", "Island selection mode"},
1510 {0, NULL, 0, NULL, NULL}
1513 /* the construction of this enum is quite special - everything is stored as bitflags,
1514 * with 1st position only for for on/off (and exposed as boolean), while others are mutually
1515 * exclusive options but which will only have any effect when autokey is enabled
1517 static EnumPropertyItem auto_key_items[] = {
1518 {AUTOKEY_MODE_NORMAL & ~AUTOKEY_ON, "ADD_REPLACE_KEYS", 0, "Add & Replace", ""},
1519 {AUTOKEY_MODE_EDITKEYS & ~AUTOKEY_ON, "REPLACE_KEYS", 0, "Replace", ""},
1520 {0, NULL, 0, NULL, NULL}
1523 static EnumPropertyItem retarget_roll_items[] = {
1524 {SK_RETARGET_ROLL_NONE, "NONE", 0, "None", "Don't adjust roll"},
1525 {SK_RETARGET_ROLL_VIEW, "VIEW", 0, "View", "Roll bones to face the view"},
1526 {SK_RETARGET_ROLL_JOINT, "JOINT", 0, "Joint", "Roll bone to original joint plane offset"},
1527 {0, NULL, 0, NULL, NULL}
1530 static EnumPropertyItem sketch_convert_items[] = {
1531 {SK_CONVERT_CUT_FIXED, "FIXED", 0, "Fixed", "Subdivide stroke in fixed number of bones"},
1532 {SK_CONVERT_CUT_LENGTH, "LENGTH", 0, "Length", "Subdivide stroke in bones of specific length"},
1533 {SK_CONVERT_CUT_ADAPTATIVE, "ADAPTIVE", 0, "Adaptive",
1534 "Subdivide stroke adaptively, with more subdivision in curvier parts"},
1535 {SK_CONVERT_RETARGET, "RETARGET", 0, "Retarget", "Retarget template bone chain to stroke"},
1536 {0, NULL, 0, NULL, NULL}
1539 static EnumPropertyItem edge_tag_items[] = {
1540 {EDGE_MODE_SELECT, "SELECT", 0, "Select", ""},
1541 {EDGE_MODE_TAG_SEAM, "SEAM", 0, "Tag Seam", ""},
1542 {EDGE_MODE_TAG_SHARP, "SHARP", 0, "Tag Sharp", ""},
1543 {EDGE_MODE_TAG_CREASE, "CREASE", 0, "Tag Crease", ""},
1544 {EDGE_MODE_TAG_BEVEL, "BEVEL", 0, "Tag Bevel", ""},
1545 {EDGE_MODE_TAG_FREESTYLE, "FREESTYLE", 0, "Tag Freestyle Edge Mark", ""},
1546 {0, NULL, 0, NULL, NULL}
1549 srna = RNA_def_struct(brna, "ToolSettings", NULL);
1550 RNA_def_struct_ui_text(srna, "Tool Settings", "");
1552 prop = RNA_def_property(srna, "sculpt", PROP_POINTER, PROP_NONE);
1553 RNA_def_property_struct_type(prop, "Sculpt");
1554 RNA_def_property_ui_text(prop, "Sculpt", "");
1556 prop = RNA_def_property(srna, "use_auto_normalize", PROP_BOOLEAN, PROP_NONE);
1557 RNA_def_property_boolean_sdna(prop, NULL, "auto_normalize", 1);
1558 RNA_def_property_ui_text(prop, "WPaint Auto-Normalize",
1559 "Ensure all bone-deforming vertex groups add up "
1560 "to 1.0 while weight painting");
1561 RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data");
1563 prop = RNA_def_property(srna, "use_multipaint", PROP_BOOLEAN, PROP_NONE);
1564 RNA_def_property_boolean_sdna(prop, NULL, "multipaint", 1);
1565 RNA_def_property_ui_text(prop, "WPaint Multi-Paint",
1566 "Paint across all selected bones while "
1568 RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data");
1570 prop = RNA_def_property(srna, "vertex_paint", PROP_POINTER, PROP_NONE);
1571 RNA_def_property_pointer_sdna(prop, NULL, "vpaint");
1572 RNA_def_property_ui_text(prop, "Vertex Paint", "");
1574 prop = RNA_def_property(srna, "weight_paint", PROP_POINTER, PROP_NONE);
1575 RNA_def_property_pointer_sdna(prop, NULL, "wpaint");
1576 RNA_def_property_ui_text(prop, "Weight Paint", "");
1578 prop = RNA_def_property(srna, "image_paint", PROP_POINTER, PROP_NONE);
1579 RNA_def_property_pointer_sdna(prop, NULL, "imapaint");
1580 RNA_def_property_ui_text(prop, "Image Paint", "");
1582 prop = RNA_def_property(srna, "uv_sculpt", PROP_POINTER, PROP_NONE);
1583 RNA_def_property_pointer_sdna(prop, NULL, "uvsculpt");
1584 RNA_def_property_ui_text(prop, "UV Sculpt", "");
1586 prop = RNA_def_property(srna, "particle_edit", PROP_POINTER, PROP_NONE);
1587 RNA_def_property_pointer_sdna(prop, NULL, "particle");
1588 RNA_def_property_ui_text(prop, "Particle Edit", "");
1590 prop = RNA_def_property(srna, "use_uv_sculpt", PROP_BOOLEAN, PROP_NONE);
1591 RNA_def_property_boolean_sdna(prop, NULL, "use_uv_sculpt", 1);
1592 RNA_def_property_ui_text(prop, "UV Sculpt", "Enable brush for UV sculpting");
1593 RNA_def_property_ui_icon(prop, ICON_TPAINT_HLT, 0);
1594 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, "rna_SpaceImageEditor_uv_sculpt_update");
1596 prop = RNA_def_property(srna, "uv_sculpt_lock_borders", PROP_BOOLEAN, PROP_NONE);
1597 RNA_def_property_boolean_sdna(prop, NULL, "uv_sculpt_settings", UV_SCULPT_LOCK_BORDERS);
1598 RNA_def_property_ui_text(prop, "Lock Borders", "Disable editing of boundary edges");
1600 prop = RNA_def_property(srna, "uv_sculpt_all_islands", PROP_BOOLEAN, PROP_NONE);
1601 RNA_def_property_boolean_sdna(prop, NULL, "uv_sculpt_settings", UV_SCULPT_ALL_ISLANDS);
1602 RNA_def_property_ui_text(prop, "Sculpt All Islands", "Brush operates on all islands");
1604 prop = RNA_def_property(srna, "uv_sculpt_tool", PROP_ENUM, PROP_NONE);
1605 RNA_def_property_enum_sdna(prop, NULL, "uv_sculpt_tool");
1606 RNA_def_property_enum_items(prop, uv_sculpt_tool_items);
1607 RNA_def_property_ui_text(prop, "UV Sculpt Tools", "Select Tools for the UV sculpt brushes");
1609 prop = RNA_def_property(srna, "uv_relax_method", PROP_ENUM, PROP_NONE);
1610 RNA_def_property_enum_sdna(prop, NULL, "uv_relax_method");
1611 RNA_def_property_enum_items(prop, uv_sculpt_relaxation_items);
1612 RNA_def_property_ui_text(prop, "Relaxation Method", "Algorithm used for UV relaxation");
1615 prop = RNA_def_property(srna, "proportional_edit", PROP_ENUM, PROP_NONE);
1616 RNA_def_property_enum_sdna(prop, NULL, "proportional");
1617 RNA_def_property_enum_items(prop, proportional_editing_items);
1618 RNA_def_property_ui_text(prop, "Proportional Editing",
1619 "Proportional Editing mode, allows transforms with distance fall-off");
1620 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1622 prop = RNA_def_property(srna, "use_proportional_edit_objects", PROP_BOOLEAN, PROP_NONE);
1623 RNA_def_property_boolean_sdna(prop, NULL, "proportional_objects", 0);
1624 RNA_def_property_ui_text(prop, "Proportional Editing Objects", "Proportional editing object mode");
1625 RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1);
1626 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1628 prop = RNA_def_property(srna, "use_proportional_edit_mask", PROP_BOOLEAN, PROP_NONE);
1629 RNA_def_property_boolean_sdna(prop, NULL, "proportional_mask", 0);
1630 RNA_def_property_ui_text(prop, "Proportional Editing Objects", "Proportional editing mask mode");
1631 RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1);
1632 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1634 prop = RNA_def_property(srna, "proportional_edit_falloff", PROP_ENUM, PROP_NONE);
1635 RNA_def_property_enum_sdna(prop, NULL, "prop_mode");
1636 RNA_def_property_enum_items(prop, proportional_falloff_items);
1637 RNA_def_property_ui_text(prop, "Proportional Editing Falloff", "Falloff type for proportional editing mode");
1638 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1640 prop = RNA_def_property(srna, "proportional_size", PROP_FLOAT, PROP_DISTANCE);
1641 RNA_def_property_float_sdna(prop, NULL, "proportional_size");
1642 RNA_def_property_ui_text(prop, "Proportional Size", "Display size for proportional editing circle");
1643 RNA_def_property_range(prop, 0.00001, 5000.0);
1645 prop = RNA_def_property(srna, "normal_size", PROP_FLOAT, PROP_DISTANCE);
1646 RNA_def_property_float_sdna(prop, NULL, "normalsize");
1647 RNA_def_property_ui_text(prop, "Normal Size", "Display size for normals in the 3D view");
1648 RNA_def_property_range(prop, 0.00001, 1000.0);
1649 RNA_def_property_ui_range(prop, 0.01, 10.0, 10.0, 2);
1650 RNA_def_property_update(prop, NC_GEOM | ND_DATA, NULL);
1652 prop = RNA_def_property(srna, "double_threshold", PROP_FLOAT, PROP_DISTANCE);
1653 RNA_def_property_float_sdna(prop, NULL, "doublimit");
1654 RNA_def_property_ui_text(prop, "Double Threshold", "Limit for removing duplicates and 'Auto Merge'");
1655 RNA_def_property_range(prop, 0.0, 1.0);
1656 RNA_def_property_ui_range(prop, 0.0, 0.1, 0.01, 6);
1658 prop = RNA_def_property(srna, "use_mesh_automerge", PROP_BOOLEAN, PROP_NONE);
1659 RNA_def_property_boolean_sdna(prop, NULL, "automerge", 0);
1660 RNA_def_property_ui_text(prop, "AutoMerge Editing", "Automatically merge vertices moved to the same location");
1662 prop = RNA_def_property(srna, "use_snap", PROP_BOOLEAN, PROP_NONE);
1663 RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP);
1664 RNA_def_property_ui_text(prop, "Snap", "Snap during transform");
1665 RNA_def_property_ui_icon(prop, ICON_SNAP_OFF, 1);
1666 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1668 prop = RNA_def_property(srna, "use_snap_align_rotation", PROP_BOOLEAN, PROP_NONE);
1669 RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_ROTATE);
1670 RNA_def_property_ui_text(prop, "Snap Align Rotation", "Align rotation with the snapping target");
1671 RNA_def_property_ui_icon(prop, ICON_SNAP_NORMAL, 0);
1672 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1674 prop = RNA_def_property(srna, "snap_element", PROP_ENUM, PROP_NONE);
1675 RNA_def_property_enum_sdna(prop, NULL, "snap_mode");
1676 RNA_def_property_enum_items(prop, snap_element_items);
1677 RNA_def_property_ui_text(prop, "Snap Element", "Type of element to snap to");
1678 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1680 /* node editor uses own set of snap modes */
1681 prop = RNA_def_property(srna, "snap_node_element", PROP_ENUM, PROP_NONE);
1682 RNA_def_property_enum_sdna(prop, NULL, "snap_node_mode");
1683 RNA_def_property_enum_items(prop, snap_node_element_items);
1684 RNA_def_property_ui_text(prop, "Snap Node Element", "Type of element to snap to");
1685 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1687 prop = RNA_def_property(srna, "snap_target", PROP_ENUM, PROP_NONE);
1688 RNA_def_property_enum_sdna(prop, NULL, "snap_target");
1689 RNA_def_property_enum_items(prop, snap_target_items);
1690 RNA_def_property_ui_text(prop, "Snap Target", "Which part to snap onto the target");
1691 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1693 prop = RNA_def_property(srna, "use_snap_peel_object", PROP_BOOLEAN, PROP_NONE);
1694 RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_PEEL_OBJECT);
1695 RNA_def_property_ui_text(prop, "Snap Peel Object", "Consider objects as whole when finding volume center");
1696 RNA_def_property_ui_icon(prop, ICON_SNAP_PEEL_OBJECT, 0);
1697 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1699 prop = RNA_def_property(srna, "use_snap_project", PROP_BOOLEAN, PROP_NONE);
1700 RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_PROJECT);
1701 RNA_def_property_ui_text(prop, "Project Individual Elements",
1702 "Project individual elements on the surface of other objects");
1703 RNA_def_property_ui_icon(prop, ICON_RETOPO, 0);
1704 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1706 prop = RNA_def_property(srna, "use_snap_self", PROP_BOOLEAN, PROP_NONE);
1707 RNA_def_property_boolean_negative_sdna(prop, NULL, "snap_flag", SCE_SNAP_NO_SELF);
1708 RNA_def_property_ui_text(prop, "Project to Self", "Snap onto itself (editmode)");
1709 RNA_def_property_ui_icon(prop, ICON_ORTHO, 0);
1710 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1713 prop = RNA_def_property(srna, "use_grease_pencil_sessions", PROP_BOOLEAN, PROP_NONE);
1714 RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_PAINTSESSIONS_ON);
1715 RNA_def_property_ui_text(prop, "Use Sketching Sessions",
1716 "Allow drawing multiple strokes at a time with Grease Pencil");
1717 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* xxx: need toolbar to be redrawn... */
1720 prop = RNA_def_property(srna, "use_keyframe_insert_auto", PROP_BOOLEAN, PROP_NONE);
1721 RNA_def_property_boolean_sdna(prop, NULL, "autokey_mode", AUTOKEY_ON);
1722 RNA_def_property_ui_text(prop, "Auto Keying", "Automatic keyframe insertion for Objects and Bones");
1723 RNA_def_property_ui_icon(prop, ICON_REC, 0);
1725 prop = RNA_def_property(srna, "auto_keying_mode", PROP_ENUM, PROP_NONE);
1726 RNA_def_property_enum_bitflag_sdna(prop, NULL, "autokey_mode");
1727 RNA_def_property_enum_items(prop, auto_key_items);
1728 RNA_def_property_ui_text(prop, "Auto-Keying Mode", "Mode of automatic keyframe insertion for Objects and Bones");
1730 prop = RNA_def_property(srna, "use_record_with_nla", PROP_BOOLEAN, PROP_NONE);
1731 RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", ANIMRECORD_FLAG_WITHNLA);
1732 RNA_def_property_ui_text(prop, "Layered",
1733 "Add a new NLA Track + Strip for every loop/pass made over the animation "
1734 "to allow non-destructive tweaking");
1736 prop = RNA_def_property(srna, "use_keyframe_insert_keyingset", PROP_BOOLEAN, PROP_NONE);
1737 RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_ONLYKEYINGSET);
1738 RNA_def_property_ui_text(prop, "Auto Keyframe Insert Keying Set",
1739 "Automatic keyframe insertion using active Keying Set only");
1740 RNA_def_property_ui_icon(prop, ICON_KEYINGSET, 0);
1743 prop = RNA_def_property(srna, "uv_select_mode", PROP_ENUM, PROP_NONE);
1744 RNA_def_property_enum_sdna(prop, NULL, "uv_selectmode");
1745 RNA_def_property_enum_items(prop, uv_select_mode_items);
1746 RNA_def_property_ui_text(prop, "UV Selection Mode", "UV selection and display mode");
1747 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
1749 prop = RNA_def_property(srna, "use_uv_select_sync", PROP_BOOLEAN, PROP_NONE);
1750 RNA_def_property_boolean_sdna(prop, NULL, "uv_flag", UV_SYNC_SELECTION);
1751 RNA_def_property_ui_text(prop, "UV Sync Selection", "Keep UV and edit mode mesh selection in sync");
1752 RNA_def_property_ui_icon(prop, ICON_EDIT, 0);
1753 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
1755 prop = RNA_def_property(srna, "show_uv_local_view", PROP_BOOLEAN, PROP_NONE);
1756 RNA_def_property_boolean_sdna(prop, NULL, "uv_flag", UV_SHOW_SAME_IMAGE);
1757 RNA_def_property_ui_text(prop, "UV Local View", "Draw only faces with the currently displayed image assigned");
1758 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
1761 prop = RNA_def_property(srna, "mesh_select_mode", PROP_BOOLEAN, PROP_NONE);
1762 RNA_def_property_boolean_sdna(prop, NULL, "selectmode", 1);
1763 RNA_def_property_array(prop, 3);
1764 RNA_def_property_boolean_funcs(prop, NULL, "rna_Scene_editmesh_select_mode_set");
1765 RNA_def_property_ui_text(prop, "Mesh Selection Mode", "Which mesh elements selection works on");
1766 RNA_def_property_update(prop, 0, "rna_Scene_editmesh_select_mode_update");
1768 prop = RNA_def_property(srna, "vertex_group_weight", PROP_FLOAT, PROP_FACTOR);
1769 RNA_def_property_float_sdna(prop, NULL, "vgroup_weight");
1770 RNA_def_property_ui_text(prop, "Vertex Group Weight", "Weight to assign in vertex groups");
1772 /* use with MESH_OT_select_shortest_path */
1773 prop = RNA_def_property(srna, "edge_path_mode", PROP_ENUM, PROP_NONE);
1774 RNA_def_property_enum_sdna(prop, NULL, "edge_mode");
1775 RNA_def_property_enum_items(prop, edge_tag_items);
1776 RNA_def_property_ui_text(prop, "Edge Tag Mode", "The edge flag to tag when selecting the shortest path");
1778 prop = RNA_def_property(srna, "edge_path_live_unwrap", PROP_BOOLEAN, PROP_NONE);
1779 RNA_def_property_boolean_sdna(prop, NULL, "edge_mode_live_unwrap", 1);
1780 RNA_def_property_ui_text(prop, "Live Unwrap", "Changing edges seam re-calculates UV unwrap");
1783 prop = RNA_def_property(srna, "use_bone_sketching", PROP_BOOLEAN, PROP_NONE);
1784 RNA_def_property_boolean_sdna(prop, NULL, "bone_sketching", BONE_SKETCHING);
1785 RNA_def_property_ui_text(prop, "Use Bone Sketching", "DOC BROKEN");
1786 /* RNA_def_property_ui_icon(prop, ICON_EDIT, 0); */
1788 prop = RNA_def_property(srna, "use_etch_quick", PROP_BOOLEAN, PROP_NONE);
1789 RNA_def_property_boolean_sdna(prop, NULL, "bone_sketching", BONE_SKETCHING_QUICK);
1790 RNA_def_property_ui_text(prop, "Quick Sketching", "DOC BROKEN");
1792 prop = RNA_def_property(srna, "use_etch_overdraw", PROP_BOOLEAN, PROP_NONE);
1793 RNA_def_property_boolean_sdna(prop, NULL, "bone_sketching", BONE_SKETCHING_ADJUST);
1794 RNA_def_property_ui_text(prop, "Overdraw Sketching", "DOC BROKEN");
1796 prop = RNA_def_property(srna, "use_etch_autoname", PROP_BOOLEAN, PROP_NONE);
1797 RNA_def_property_boolean_sdna(prop, NULL, "skgen_retarget_options", SK_RETARGET_AUTONAME);
1798 RNA_def_property_ui_text(prop, "Autoname", "DOC BROKEN");
1800 prop = RNA_def_property(srna, "etch_number", PROP_STRING, PROP_NONE);
1801 RNA_def_property_string_sdna(prop, NULL, "skgen_num_string");
1802 RNA_def_property_ui_text(prop, "Number", "DOC BROKEN");
1804 prop = RNA_def_property(srna, "etch_side", PROP_STRING, PROP_NONE);
1805 RNA_def_property_string_sdna(prop, NULL, "skgen_num_string");
1806 RNA_def_property_ui_text(prop, "Side", "DOC BROKEN");
1808 prop = RNA_def_property(srna, "etch_template", PROP_POINTER, PROP_NONE);
1809 RNA_def_property_pointer_sdna(prop, NULL, "skgen_template");
1810 RNA_def_property_flag(prop, PROP_EDITABLE);
1811 RNA_def_property_struct_type(prop, "Object");
1812 RNA_def_property_pointer_funcs(prop, NULL, "rna_Scene_skgen_etch_template_set", NULL, NULL);
1813 RNA_def_property_ui_text(prop, "Template", "Template armature that will be retargeted to the stroke");
1815 prop = RNA_def_property(srna, "etch_subdivision_number", PROP_INT, PROP_NONE);
1816 RNA_def_property_int_sdna(prop, NULL, "skgen_subdivision_number");
1817 RNA_def_property_range(prop, 1, 255);
1818 RNA_def_property_ui_text(prop, "Subdivisions", "Number of bones in the subdivided stroke");
1819 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
1821 prop = RNA_def_property(srna, "etch_adaptive_limit", PROP_FLOAT, PROP_FACTOR);
1822 RNA_def_property_float_sdna(prop, NULL, "skgen_correlation_limit");
1823 RNA_def_property_range(prop, 0.00001, 1.0);
1824 RNA_def_property_ui_range(prop, 0.01, 1.0, 0.01, 2);
1825 RNA_def_property_ui_text(prop, "Limit", "Number of bones in the subdivided stroke");
1826 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
1828 prop = RNA_def_property(srna, "etch_length_limit", PROP_FLOAT, PROP_DISTANCE);
1829 RNA_def_property_float_sdna(prop, NULL, "skgen_length_limit");
1830 RNA_def_property_range(prop, 0.00001, 100000.0);
1831 RNA_def_property_ui_range(prop, 0.001, 100.0, 0.1, 3);
1832 RNA_def_property_ui_text(prop, "Length", "Number of bones in the subdivided stroke");
1833 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
1835 prop = RNA_def_property(srna, "etch_roll_mode", PROP_ENUM, PROP_NONE);
1836 RNA_def_property_enum_bitflag_sdna(prop, NULL, "skgen_retarget_roll");
1837 RNA_def_property_enum_items(prop, retarget_roll_items);
1838 RNA_def_property_ui_text(prop, "Retarget roll mode", "Method used to adjust the roll of bones when retargeting");
1840 prop = RNA_def_property(srna, "etch_convert_mode", PROP_ENUM, PROP_NONE);
1841 RNA_def_property_enum_bitflag_sdna(prop, NULL, "bone_sketching_convert");
1842 RNA_def_property_enum_items(prop, sketch_convert_items);
1843 RNA_def_property_ui_text(prop, "Stroke conversion method", "Method used to convert stroke to bones");
1844 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
1846 /* Unified Paint Settings */
1847 prop = RNA_def_property(srna, "unified_paint_settings", PROP_POINTER, PROP_NONE);
1848 RNA_def_property_flag(prop, PROP_NEVER_NULL);
1849 RNA_def_property_struct_type(prop, "UnifiedPaintSettings");
1850 RNA_def_property_ui_text(prop, "Unified Paint Settings", NULL);
1853 static void rna_def_unified_paint_settings(BlenderRNA *brna)
1858 srna = RNA_def_struct(brna, "UnifiedPaintSettings", NULL);
1859 RNA_def_struct_ui_text(srna, "Unified Paint Settings", "Overrides for some of the active brush's settings");
1861 /* high-level flags to enable or disable unified paint settings */
1862 prop = RNA_def_property(srna, "use_unified_size", PROP_BOOLEAN, PROP_NONE);
1863 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_SIZE);
1864 RNA_def_property_ui_text(prop, "Use Unified Radius",
1865 "Instead of per-brush radius, the radius is shared across brushes");
1867 prop = RNA_def_property(srna, "use_unified_strength", PROP_BOOLEAN, PROP_NONE);
1868 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_ALPHA);
1869 RNA_def_property_ui_text(prop, "Use Unified Strength",
1870 "Instead of per-brush strength, the strength is shared across brushes");
1872 prop = RNA_def_property(srna, "use_unified_weight", PROP_BOOLEAN, PROP_NONE);
1873 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_WEIGHT);
1874 RNA_def_property_ui_text(prop, "Use Unified Weight",
1875 "Instead of per-brush weight, the weight is shared across brushes");
1877 /* unified paint settings that override the equivalent settings
1878 * from the active brush */
1879 prop = RNA_def_property(srna, "size", PROP_INT, PROP_DISTANCE);
1880 RNA_def_property_int_funcs(prop, NULL, "rna_UnifiedPaintSettings_size_set", NULL);
1881 RNA_def_property_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS * 10);
1882 RNA_def_property_ui_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS, 1, 0);
1883 RNA_def_property_ui_text(prop, "Radius", "Radius of the brush in pixels");
1885 prop = RNA_def_property(srna, "unprojected_radius", PROP_FLOAT, PROP_DISTANCE);
1886 RNA_def_property_float_funcs(prop, NULL, "rna_UnifiedPaintSettings_unprojected_radius_set", NULL);
1887 RNA_def_property_range(prop, 0.001, FLT_MAX);
1888 RNA_def_property_ui_range(prop, 0.001, 1, 0, 0);
1889 RNA_def_property_ui_text(prop, "Unprojected Radius", "Radius of brush in Blender units");
1891 prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
1892 RNA_def_property_float_sdna(prop, NULL, "alpha");
1893 RNA_def_property_float_default(prop, 0.5f);
1894 RNA_def_property_range(prop, 0.0f, 10.0f);
1895 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
1896 RNA_def_property_ui_text(prop, "Strength", "How powerful the effect of the brush is when applied");
1898 prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_FACTOR);
1899 RNA_def_property_float_sdna(prop, NULL, "weight");
1900 RNA_def_property_float_default(prop, 0.5f);
1901 RNA_def_property_range(prop, 0.0f, 1.0f);
1902 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
1903 RNA_def_property_ui_text(prop, "Weight", "Weight to assign in vertex groups");
1905 prop = RNA_def_property(srna, "use_pressure_size", PROP_BOOLEAN, PROP_NONE);
1906 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_BRUSH_SIZE_PRESSURE);
1907 RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
1908 RNA_def_property_ui_text(prop, "Size Pressure", "Enable tablet pressure sensitivity for size");
1910 prop = RNA_def_property(srna, "use_pressure_strength", PROP_BOOLEAN, PROP_NONE);
1911 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_BRUSH_ALPHA_PRESSURE);
1912 RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
1913 RNA_def_property_ui_text(prop, "Strength Pressure", "Enable tablet pressure sensitivity for strength");
1915 prop = RNA_def_property(srna, "use_locked_size", PROP_BOOLEAN, PROP_NONE);
1916 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_BRUSH_LOCK_SIZE);
1917 RNA_def_property_ui_text(prop, "Use Blender Units",
1918 "When locked brush stays same size relative to object; "
1919 "when unlocked brush size is given in pixels");
1922 static void rna_def_unit_settings(BlenderRNA *brna)
1927 static EnumPropertyItem unit_systems[] = {
1928 {USER_UNIT_NONE, "NONE", 0, "None", ""},
1929 {USER_UNIT_METRIC, "METRIC", 0, "Metric", ""},
1930 {USER_UNIT_IMPERIAL, "IMPERIAL", 0, "Imperial", ""},
1931 {0, NULL, 0, NULL, NULL}
1934 static EnumPropertyItem rotation_units[] = {
1935 {0, "DEGREES", 0, "Degrees", "Use degrees for measuring angles and rotations"},
1936 {USER_UNIT_ROT_RADIANS, "RADIANS", 0, "Radians", ""},
1937 {0, NULL, 0, NULL, NULL}
1940 srna = RNA_def_struct(brna, "UnitSettings", NULL);
1941 RNA_def_struct_ui_text(srna, "Unit Settings", "");
1944 prop = RNA_def_property(srna, "system", PROP_ENUM, PROP_NONE);
1945 RNA_def_property_enum_items(prop, unit_systems);
1946 RNA_def_property_ui_text(prop, "Unit System", "The unit system to use for button display");
1947 RNA_def_property_update(prop, NC_WINDOW, NULL);
1949 prop = RNA_def_property(srna, "system_rotation", PROP_ENUM, PROP_NONE);
1950 RNA_def_property_enum_items(prop, rotation_units);
1951 RNA_def_property_ui_text(prop, "Rotation Units", "Unit to use for displaying/editing rotation values");
1952 RNA_def_property_update(prop, NC_WINDOW, NULL);
1954 prop = RNA_def_property(srna, "scale_length", PROP_FLOAT, PROP_UNSIGNED);
1955 RNA_def_property_ui_text(prop, "Unit Scale", "Scale to use when converting between blender units and dimensions");
1956 RNA_def_property_range(prop, 0.00001, 100000.0);
1957 RNA_def_property_ui_range(prop, 0.001, 100.0, 0.1, 3);
1958 RNA_def_property_update(prop, NC_WINDOW, NULL);
1960 prop = RNA_def_property(srna, "use_separate", PROP_BOOLEAN, PROP_NONE);
1961 RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_UNIT_OPT_SPLIT);
1962 RNA_def_property_ui_text(prop, "Separate Units", "Display units in pairs (e.g. 1m 0cm)");
1963 RNA_def_property_update(prop, NC_WINDOW, NULL);
1966 void rna_def_render_layer_common(StructRNA *srna, int scene)
1970 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1971 if (scene) RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SceneRenderLayer_name_set");
1972 else RNA_def_property_string_sdna(prop, NULL, "name");
1973 RNA_def_property_ui_text(prop, "Name", "Render layer name");
1974 RNA_def_struct_name_property(srna, prop);
1975 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
1976 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1978 prop = RNA_def_property(srna, "material_override", PROP_POINTER, PROP_NONE);
1979 RNA_def_property_pointer_sdna(prop, NULL, "mat_override");
1980 RNA_def_property_struct_type(prop, "Material");
1981 RNA_def_property_flag(prop, PROP_EDITABLE);
1982 RNA_def_property_ui_text(prop, "Material Override",
1983 "Material to override all other materials in this render layer");
1984 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
1985 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1987 prop = RNA_def_property(srna, "light_override", PROP_POINTER, PROP_NONE);
1988 RNA_def_property_pointer_sdna(prop, NULL, "light_override");
1989 RNA_def_property_struct_type(prop, "Group");
1990 RNA_def_property_flag(prop, PROP_EDITABLE);
1991 RNA_def_property_ui_text(prop, "Light Override", "Group to override all other lights in this render layer");
1992 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
1993 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1996 prop = RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
1997 RNA_def_property_boolean_sdna(prop, NULL, "lay", 1);
1998 RNA_def_property_array(prop, 20);
1999 RNA_def_property_ui_text(prop, "Visible Layers", "Scene layers included in this render layer");
2000 if (scene) RNA_def_property_boolean_funcs(prop, NULL, "rna_SceneRenderLayer_layer_set");
2001 else RNA_def_property_boolean_funcs(prop, NULL, "rna_RenderLayer_layer_set");
2002 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
2003 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2005 prop = RNA_def_property(srna, "layers_zmask", PROP_BOOLEAN, PROP_LAYER);
2006 RNA_def_property_boolean_sdna(prop, NULL, "lay_zmask", 1);
2007 RNA_def_property_array(prop, 20);
2008 RNA_def_property_ui_text(prop, "Zmask Layers", "Zmask scene layers for solid faces");
2009 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
2010 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2012 prop = RNA_def_property(srna, "layers_exclude", PROP_BOOLEAN, PROP_LAYER);
2013 RNA_def_property_boolean_sdna(prop, NULL, "lay_exclude", 1);
2014 RNA_def_property_array(prop, 20);
2015 RNA_def_property_ui_text(prop, "Exclude Layers", "Exclude scene layers from having any influence");
2016 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
2017 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2020 prop = RNA_def_property(srna, "samples", PROP_INT, PROP_UNSIGNED);
2021 RNA_def_property_ui_text(prop, "Samples", "Override number of render samples for this render layer, 0 will use the scene setting");
2022 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2026 prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
2027 RNA_def_property_boolean_negative_sdna(prop, NULL, "layflag", SCE_LAY_DISABLE);
2028 RNA_def_property_ui_text(prop, "Enabled", "Disable or enable the render layer");
2029 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
2030 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2032 prop = RNA_def_property(srna, "use_zmask", PROP_BOOLEAN, PROP_NONE);
2033 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ZMASK);
2034 RNA_def_property_ui_text(prop, "Zmask", "Only render what's in front of the solid z values");
2035 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
2036 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2038 prop = RNA_def_property(srna, "invert_zmask", PROP_BOOLEAN, PROP_NONE);
2039 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_NEG_ZMASK);
2040 RNA_def_property_ui_text(prop, "Zmask Negate",
2041 "For Zmask, only render what is behind solid z values instead of in front");
2042 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
2043 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2045 prop = RNA_def_property(srna, "use_all_z", PROP_BOOLEAN, PROP_NONE);
2046 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ALL_Z);
2047 RNA_def_property_ui_text(prop, "All Z", "Fill in Z values for solid faces in invisible layers, for masking");
2048 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2049 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2051 prop = RNA_def_property(srna, "use_solid", PROP_BOOLEAN, PROP_NONE);
2052 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_SOLID);
2053 RNA_def_property_ui_text(prop, "Solid", "Render Solid faces in this Layer");
2054 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2055 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2057 prop = RNA_def_property(srna, "use_halo", PROP_BOOLEAN, PROP_NONE);
2058 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_HALO);
2059 RNA_def_property_ui_text(prop, "Halo", "Render Halos in this Layer (on top of Solid)");
2060 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2061 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2063 prop = RNA_def_property(srna, "use_ztransp", PROP_BOOLEAN, PROP_NONE);
2064 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ZTRA);
2065 RNA_def_property_ui_text(prop, "ZTransp", "Render Z-Transparent faces in this Layer (on top of Solid and Halos)");
2066 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2067 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2069 prop = RNA_def_property(srna, "use_sky", PROP_BOOLEAN, PROP_NONE);
2070 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_SKY);
2071 RNA_def_property_ui_text(prop, "Sky", "Render Sky in this Layer");
2072 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
2073 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2075 prop = RNA_def_property(srna, "use_edge_enhance", PROP_BOOLEAN, PROP_NONE);
2076 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_EDGE);
2077 RNA_def_property_ui_text(prop, "Edge", "Render Edge-enhance in this Layer (only works for Solid faces)");
2078 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2079 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2081 prop = RNA_def_property(srna, "use_strand", PROP_BOOLEAN, PROP_NONE);
2082 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_STRAND);
2083 RNA_def_property_ui_text(prop, "Strand", "Render Strands in this Layer");
2084 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2085 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2087 prop= RNA_def_property(srna, "use_freestyle", PROP_BOOLEAN, PROP_NONE);
2088 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_FRS);
2089 RNA_def_property_ui_text(prop, "Freestyle", "Render stylized strokes in this Layer");
2090 if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
2091 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2094 prop = RNA_def_property(srna, "use_pass_combined", PROP_BOOLEAN, PROP_NONE);
2095 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_COMBINED);
2096 RNA_def_property_ui_text(prop, "Combined", "Deliver full combined RGBA buffer");
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_z", PROP_BOOLEAN, PROP_NONE);
2101 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_Z);
2102 RNA_def_property_ui_text(prop, "Z", "Deliver Z values 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_vector", PROP_BOOLEAN, PROP_NONE);
2107 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_VECTOR);
2108 RNA_def_property_ui_text(prop, "Vector", "Deliver speed vector 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_normal", PROP_BOOLEAN, PROP_NONE);
2113 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_NORMAL);
2114 RNA_def_property_ui_text(prop, "Normal", "Deliver normal 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_uv", PROP_BOOLEAN, PROP_NONE);
2119 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_UV);
2120 RNA_def_property_ui_text(prop, "UV", "Deliver texture UV 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_mist", PROP_BOOLEAN, PROP_NONE);
2125 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_MIST);
2126 RNA_def_property_ui_text(prop, "Mist", "Deliver mist factor pass (0.0-1.0)");
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_object_index", PROP_BOOLEAN, PROP_NONE);
2131 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_INDEXOB);
2132 RNA_def_property_ui_text(prop, "Object Index", "Deliver object index 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_material_index", PROP_BOOLEAN, PROP_NONE);
2137 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_INDEXMA);
2138 RNA_def_property_ui_text(prop, "Material Index", "Deliver material index 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_color", PROP_BOOLEAN, PROP_NONE);
2143 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_RGBA);
2144 RNA_def_property_ui_text(prop, "Color", "Deliver shade-less color 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_diffuse", PROP_BOOLEAN, PROP_NONE);
2149 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE);
2150 RNA_def_property_ui_text(prop, "Diffuse", "Deliver diffuse pass");
2151 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2152 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2154 prop = RNA_def_property(srna, "use_pass_specular", PROP_BOOLEAN, PROP_NONE);
2155 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SPEC);
2156 RNA_def_property_ui_text(prop, "Specular", "Deliver specular pass");
2157 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2158 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2160 prop = RNA_def_property(srna, "use_pass_shadow", PROP_BOOLEAN, PROP_NONE);
2161 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SHADOW);
2162 RNA_def_property_ui_text(prop, "Shadow", "Deliver shadow pass");
2163 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2164 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2166 prop = RNA_def_property(srna, "use_pass_ambient_occlusion", PROP_BOOLEAN, PROP_NONE);
2167 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_AO);
2168 RNA_def_property_ui_text(prop, "AO", "Deliver AO pass");
2169 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2170 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2172 prop = RNA_def_property(srna, "use_pass_reflection", PROP_BOOLEAN, PROP_NONE);
2173 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_REFLECT);
2174 RNA_def_property_ui_text(prop, "Reflection", "Deliver raytraced reflection pass");
2175 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2176 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2178 prop = RNA_def_property(srna, "use_pass_refraction", PROP_BOOLEAN, PROP_NONE);
2179 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_REFRACT);
2180 RNA_def_property_ui_text(prop, "Refraction", "Deliver raytraced refraction pass");
2181 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2182 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2184 prop = RNA_def_property(srna, "use_pass_emit", PROP_BOOLEAN, PROP_NONE);
2185 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_EMIT);
2186 RNA_def_property_ui_text(prop, "Emit", "Deliver emission pass");
2187 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2188 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2190 prop = RNA_def_property(srna, "use_pass_environment", PROP_BOOLEAN, PROP_NONE);
2191 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_ENVIRONMENT);
2192 RNA_def_property_ui_text(prop, "Environment", "Deliver environment lighting pass");
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, "use_pass_indirect", PROP_BOOLEAN, PROP_NONE);
2197 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_INDIRECT);
2198 RNA_def_property_ui_text(prop, "Indirect", "Deliver indirect lighting pass");
2199 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2200 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2202 prop = RNA_def_property(srna, "exclude_specular", PROP_BOOLEAN, PROP_NONE);
2203 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_SPEC);
2204 RNA_def_property_ui_text(prop, "Specular Exclude", "Exclude specular pass from combined");
2205 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2206 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2207 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2209 prop = RNA_def_property(srna, "exclude_shadow", PROP_BOOLEAN, PROP_NONE);
2210 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_SHADOW);
2211 RNA_def_property_ui_text(prop, "Shadow Exclude", "Exclude shadow pass from combined");
2212 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
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, "exclude_ambient_occlusion", PROP_BOOLEAN, PROP_NONE);
2217 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_AO);
2218 RNA_def_property_ui_text(prop, "AO Exclude", "Exclude AO pass from combined");
2219 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2220 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2221 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2223 prop = RNA_def_property(srna, "exclude_reflection", PROP_BOOLEAN, PROP_NONE);
2224 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_REFLECT);
2225 RNA_def_property_ui_text(prop, "Reflection Exclude", "Exclude raytraced reflection pass from combined");
2226 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2227 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2228 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2230 prop = RNA_def_property(srna, "exclude_refraction", PROP_BOOLEAN, PROP_NONE);
2231 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_REFRACT);
2232 RNA_def_property_ui_text(prop, "Refraction Exclude", "Exclude raytraced refraction pass from combined");
2233 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2234 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2235 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2237 prop = RNA_def_property(srna, "exclude_emit", PROP_BOOLEAN, PROP_NONE);
2238 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_EMIT);
2239 RNA_def_property_ui_text(prop, "Emit Exclude", "Exclude emission pass from combined");
2240 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2241 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2242 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2244 prop = RNA_def_property(srna, "exclude_environment", PROP_BOOLEAN, PROP_NONE);
2245 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_ENVIRONMENT);
2246 RNA_def_property_ui_text(prop, "Environment Exclude", "Exclude environment pass from combined");
2247 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2248 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2249 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2251 prop = RNA_def_property(srna, "exclude_indirect", PROP_BOOLEAN, PROP_NONE);
2252 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_INDIRECT);
2253 RNA_def_property_ui_text(prop, "Indirect Exclude", "Exclude indirect pass from combined");
2254 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
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_diffuse_direct", PROP_BOOLEAN, PROP_NONE);
2259 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE_DIRECT);
2260 RNA_def_property_ui_text(prop, "Diffuse Direct", "Deliver diffuse direct pass");
2261 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2262 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2264 prop = RNA_def_property(srna, "use_pass_diffuse_indirect", PROP_BOOLEAN, PROP_NONE);
2265 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE_INDIRECT);
2266 RNA_def_property_ui_text(prop, "Diffuse Indirect", "Deliver diffuse indirect pass");
2267 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2268 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2270 prop = RNA_def_property(srna, "use_pass_diffuse_color", PROP_BOOLEAN, PROP_NONE);
2271 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE_COLOR);
2272 RNA_def_property_ui_text(prop, "Diffuse Color", "Deliver diffuse color pass");
2273 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2274 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2276 prop = RNA_def_property(srna, "use_pass_glossy_direct", PROP_BOOLEAN, PROP_NONE);
2277 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_GLOSSY_DIRECT);
2278 RNA_def_property_ui_text(prop, "Glossy Direct", "Deliver glossy direct pass");
2279 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2280 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2282 prop = RNA_def_property(srna, "use_pass_glossy_indirect", PROP_BOOLEAN, PROP_NONE);
2283 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_GLOSSY_INDIRECT);
2284 RNA_def_property_ui_text(prop, "Glossy Indirect", "Deliver glossy indirect pass");
2285 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2286 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2288 prop = RNA_def_property(srna, "use_pass_glossy_color", PROP_BOOLEAN, PROP_NONE);
2289 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_GLOSSY_COLOR);
2290 RNA_def_property_ui_text(prop, "Glossy Color", "Deliver glossy color pass");
2291 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2292 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2294 prop = RNA_def_property(srna, "use_pass_transmission_direct", PROP_BOOLEAN, PROP_NONE);
2295 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_TRANSM_DIRECT);
2296 RNA_def_property_ui_text(prop, "Transmission Direct", "Deliver transmission direct pass");
2297 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2298 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2300 prop = RNA_def_property(srna, "use_pass_transmission_indirect", PROP_BOOLEAN, PROP_NONE);
2301 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_TRANSM_INDIRECT);
2302 RNA_def_property_ui_text(prop, "Transmission Indirect", "Deliver transmission indirect pass");
2303 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2304 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2306 prop = RNA_def_property(srna, "use_pass_transmission_color", PROP_BOOLEAN, PROP_NONE);
2307 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_TRANSM_COLOR);
2308 RNA_def_property_ui_text(prop, "Transmission Color", "Deliver transmission color pass");
2309 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2310 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2313 static void rna_def_freestyle_linesets(BlenderRNA *brna, PropertyRNA *cprop)
2318 RNA_def_property_srna(cprop, "Linesets");
2319 srna= RNA_def_struct(brna, "Linesets", NULL);
2320 RNA_def_struct_sdna(srna, "FreestyleSettings");
2321 RNA_def_struct_ui_text(srna, "Line Sets", "Line sets for associating lines and style parameters");
2323 prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
2324 RNA_def_property_struct_type(prop, "FreestyleLineSet");
2325 RNA_def_property_pointer_funcs(prop, "rna_FreestyleSettings_active_lineset_get", NULL, NULL, NULL);
2326 RNA_def_property_ui_text(prop, "Active Line Set", "Active line set being displayed");
2327 RNA_def_property_update(prop, NC_SCENE, NULL);
2329 prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
2330 RNA_def_property_int_funcs(prop, "rna_FreestyleSettings_active_lineset_index_get", "rna_FreestyleSettings_active_lineset_index_set", "rna_FreestyleSettings_active_lineset_index_range");
2331 RNA_def_property_ui_text(prop, "Active Line Set Index", "Index of active line set slot");
2332 RNA_def_property_update(prop, NC_SCENE, NULL);
2335 static void rna_def_freestyle_settings(BlenderRNA *brna)
2340 static EnumPropertyItem edge_type_negation_items[] = {
2341 {0, "INCLUSIVE", 0, "Inclusive", "Select feature edges satisfying the given edge type conditions"},
2342 {FREESTYLE_LINESET_FE_NOT, "EXCLUSIVE", 0, "Exclusive", "Select feature edges not satisfying the given edge type conditions"},
2343 {0, NULL, 0, NULL, NULL}};
2345 static EnumPropertyItem edge_type_combination_items[] = {
2346 {0, "OR", 0, "Logical OR", "Combine feature edge type conditions by logical OR (logical disjunction)"},
2347 {FREESTYLE_LINESET_FE_AND, "AND", 0, "Logical AND", "Combine feature edge type conditions by logical AND (logical conjunction)"},
2348 {0, NULL, 0, NULL, NULL}};
2350 static EnumPropertyItem group_negation_items[] = {
2351 {0, "INCLUSIVE", 0, "Inclusive", "Select feature edges belonging to some object in the group"},
2352 {FREESTYLE_LINESET_GR_NOT, "EXCLUSIVE", 0, "Exclusive", "Select feature edges not belonging to any object in the group"},
2353 {0, NULL, 0, NULL, NULL}};
2355 static EnumPropertyItem face_mark_negation_items[] = {
2356 {0, "INCLUSIVE", 0, "Inclusive", "Select feature edges satisfying the given face mark conditions"},
2357 {FREESTYLE_LINESET_FM_NOT, "EXCLUSIVE", 0, "Exclusive", "Select feature edges not satisfying the given face mark conditions"},
2358 {0, NULL, 0, NULL, NULL}};
2360 static EnumPropertyItem face_mark_condition_items[] = {
2361 {0, "ONE", 0, "One Face", "Select feature edges if one of faces on the right and left has a face mark"},
2362 {FREESTYLE_LINESET_FM_BOTH, "BOTH", 0, "Both Faces", "Select feature edges if both faces on the right and left faces have a face mark"},
2363 {0, NULL, 0, NULL, NULL}};
2365 static EnumPropertyItem freestyle_ui_mode_items[] = {
2366 {FREESTYLE_CONTROL_SCRIPT_MODE, "SCRIPT", 0, "Python Scripting Mode", "Advanced mode for using style modules in Python"},
2367 {FREESTYLE_CONTROL_EDITOR_MODE, "EDITOR", 0, "Parameter Editor Mode", "Basic mode for interactive style parameter editing"},
2368 {0, NULL, 0, NULL, NULL}};
2370 static EnumPropertyItem visibility_items[] ={
2371 {FREESTYLE_QI_VISIBLE, "VISIBLE", 0, "Visible", "Select visible feature edges"},
2372 {FREESTYLE_QI_HIDDEN, "HIDDEN", 0, "Hidden", "Select hidden feature edges"},
2373 {FREESTYLE_QI_RANGE, "RANGE", 0, "QI Range", "Select feature edges within a range of quantitative invisibility (QI) values"},
2374 {0, NULL, 0, NULL, NULL}};
2376 static EnumPropertyItem freestyle_raycasting_algorithm_items[] = {
2377 {FREESTYLE_ALGO_REGULAR, "REGULAR", 0, "Normal Ray Casting", "Consider all FEdges in each ViewEdge"},
2378 {FREESTYLE_ALGO_FAST, "FAST", 0, "Fast Ray Casting", "Sample some FEdges in each ViewEdge"},
2379 {FREESTYLE_ALGO_VERYFAST, "VERYFAST", 0, "Very Fast Ray Casting", "Sample one FEdge in each ViewEdge; do not save list of occluders"},
2380 {FREESTYLE_ALGO_CULLED_ADAPTIVE_TRADITIONAL, "CULLEDADAPTIVETRADITIONAL", 0, "Culled Traditional Visibility Detection", "Culled adaptive grid with heuristic density and traditional QI calculation"},
2381 {FREESTYLE_ALGO_ADAPTIVE_TRADITIONAL, "ADAPTIVETRADITIONAL", 0, "Unculled Traditional Visibility Detection", "Adaptive grid with heuristic density and traditional QI calculation"},
2382 {FREESTYLE_ALGO_CULLED_ADAPTIVE_CUMULATIVE, "CULLEDADAPTIVECUMULATIVE", 0, "Culled Cumulative Visibility Detection", "Culled adaptive grid with heuristic density and cumulative QI calculation"},
2383 {FREESTYLE_ALGO_ADAPTIVE_CUMULATIVE, "ADAPTIVECUMULATIVE", 0, "Unculled Cumulative Visibility Detection", "Adaptive grid with heuristic density and cumulative QI calculation"},
2384 {0, NULL, 0, NULL, NULL}};
2387 /* FreestyleLineSet */
2389 srna= RNA_def_struct(brna, "FreestyleLineSet", NULL);
2390 RNA_def_struct_ui_text(srna, "Freestyle Line Set", "Line set for associating lines and style parameters");
2392 /* access to line style settings is redirected through functions */
2393 /* to allow proper id-buttons functionality */
2394 prop= RNA_def_property(srna, "linestyle", PROP_POINTER, PROP_NONE);
2395 RNA_def_property_struct_type(prop, "FreestyleLineStyle");
2396 RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_NULL);
2397 RNA_def_property_pointer_funcs(prop, "rna_FreestyleLineSet_linestyle_get", "rna_FreestyleLineSet_linestyle_set", NULL, NULL);
2398 RNA_def_property_ui_text(prop, "Line Style", "Line style settings");
2399 RNA_def_property_update(prop, NC_SCENE, NULL);
2401 prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
2402 RNA_def_property_string_sdna(prop, NULL, "name");
2403 RNA_def_property_ui_text(prop, "Line Set Name", "Line set name");
2404 RNA_def_property_update(prop, NC_SCENE, NULL);
2405 RNA_def_struct_name_property(srna, prop);
2407 prop= RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
2408 RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_LINESET_ENABLED);
2409 RNA_def_property_ui_text(prop, "Use", "Enable or disable this line set during stroke rendering");
2410 RNA_def_property_update(prop, NC_SCENE, NULL);
2412 prop= RNA_def_property(srna, "select_by_visibility", PROP_BOOLEAN, PROP_NONE);
2413 RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_VISIBILITY);
2414 RNA_def_property_ui_text(prop, "Selection by Visibility", "Select feature edges based on visibility");
2415 RNA_def_property_update(prop, NC_SCENE, NULL);
2417 prop= RNA_def_property(srna, "select_by_edge_types", PROP_BOOLEAN, PROP_NONE);
2418 RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_EDGE_TYPES);
2419 RNA_def_property_ui_text(prop, "Selection by Edge Types", "Select feature edges based on edge types");
2420 RNA_def_property_update(prop, NC_SCENE, NULL);
2422 prop= RNA_def_property(srna, "select_by_group", PROP_BOOLEAN, PROP_NONE);
2423 RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_GROUP);
2424 RNA_def_property_ui_text(prop, "Selection by Group", "Select feature edges based on a group of objects");
2425 RNA_def_property_update(prop, NC_SCENE, NULL);
2427 prop= RNA_def_property(srna, "select_by_image_border", PROP_BOOLEAN, PROP_NONE);
2428 RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_IMAGE_BORDER);
2429 RNA_def_property_ui_text(prop, "Selection by Image Border", "Select feature edges by image border (less memory consumption)");
2430 RNA_def_property_update(prop, NC_SCENE, NULL);
2432 prop= RNA_def_property(srna, "select_by_face_marks", PROP_BOOLEAN, PROP_NONE);
2433 RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_FACE_MARK);
2434 RNA_def_property_ui_text(prop, "Selection by Face Marks", "Select feature edges by face marks");
2435 RNA_def_property_update(prop, NC_SCENE, NULL);
2437 prop= RNA_def_property(srna, "edge_type_negation", PROP_ENUM, PROP_NONE);
2438 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
2439 RNA_def_property_enum_items(prop, edge_type_negation_items);
2440 RNA_def_property_ui_text(prop, "Edge Type Negation", "Set the negation operation for conditions on feature edge types");
2441 RNA_def_property_update(prop, NC_SCENE, NULL);
2443 prop= RNA_def_property(srna, "edge_type_combination", PROP_ENUM, PROP_NONE);
2444 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
2445 RNA_def_property_enum_items(prop, edge_type_combination_items);
2446 RNA_def_property_ui_text(prop, "Edge Type Combination", "Set the combination operation for conditions on feature edge types");
2447 RNA_def_property_update(prop, NC_SCENE, NULL);
2449 prop= RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE);
2450 RNA_def_property_pointer_sdna(prop, NULL, "group");
2451 RNA_def_property_struct_type(prop, "Group");
2452 RNA_def_property_flag(prop, PROP_EDITABLE);
2453 RNA_def_property_ui_text(prop, "Group", "A group of objects based on which feature edges are selected");
2454 RNA_def_property_update(prop, NC_SCENE, NULL);
2456 prop= RNA_def_property(srna, "group_negation", PROP_ENUM, PROP_NONE);
2457 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
2458 RNA_def_property_enum_items(prop, group_negation_items);
2459 RNA_def_property_ui_text(prop, "Group Negation", "Set the negation operation for conditions on feature edge types");
2460 RNA_def_property_update(prop, NC_SCENE, NULL);
2462 prop= RNA_def_property(srna, "face_mark_negation", PROP_ENUM, PROP_NONE);
2463 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
2464 RNA_def_property_enum_items(prop, face_mark_negation_items);
2465 RNA_def_property_ui_text(prop, "Face Mark Negation", "Set the negation operation for the condition on face marks");
2466 RNA_def_property_update(prop, NC_SCENE, NULL);
2468 prop= RNA_def_property(srna, "face_mark_condition", PROP_ENUM, PROP_NONE);
2469 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
2470 RNA_def_property_enum_items(prop, face_mark_condition_items);
2471 RNA_def_property_ui_text(prop, "Face Mark Condition", "Set a feature edge selection condition on face marks");
2472 RNA_def_property_update(prop, NC_SCENE, NULL);
2474 prop= RNA_def_property(srna, "select_silhouette", PROP_BOOLEAN, PROP_NONE);
2475 RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_SILHOUETTE);
2476 RNA_def_property_ui_text(prop, "Silhouette", "Select silhouette edges");
2477 RNA_def_property_update(prop, NC_SCENE, NULL);
2479 prop= RNA_def_property(srna, "select_border", PROP_BOOLEAN, PROP_NONE);
2480 RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_BORDER);
2481 RNA_def_property_ui_text(prop, "Border", "Select border edges");
2482 RNA_def_property_update(prop, NC_SCENE, NULL);
2484 prop= RNA_def_property(srna, "select_crease", PROP_BOOLEAN, PROP_NONE);
2485 RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_CREASE);
2486 RNA_def_property_ui_text(prop, "Crease", "Select crease edges");
2487 RNA_def_property_update(prop, NC_SCENE, NULL);
2489 prop= RNA_def_property(srna, "select_ridge_valley", PROP_BOOLEAN, PROP_NONE);
2490 RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_RIDGE_VALLEY);
2491 RNA_def_property_ui_text(prop, "Ridge & Valley", "Select ridges and valleys");
2492 RNA_def_property_update(prop, NC_SCENE, NULL);
2494 prop= RNA_def_property(srna, "select_suggestive_contour", PROP_BOOLEAN, PROP_NONE);
2495 RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_SUGGESTIVE_CONTOUR);
2496 RNA_def_property_ui_text(prop, "Suggestive Contour", "Select suggestive contours");
2497 RNA_def_property_update(prop, NC_SCENE, NULL);
2499 prop= RNA_def_property(srna, "select_material_boundary", PROP_BOOLEAN, PROP_NONE);
2500 RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_MATERIAL_BOUNDARY);
2501 RNA_def_property_ui_text(prop, "Material Boundary", "Select edges at material boundaries");
2502 RNA_def_property_update(prop, NC_SCENE, NULL);
2504 prop= RNA_def_property(srna, "select_contour", PROP_BOOLEAN, PROP_NONE);
2505 RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_CONTOUR);
2506 RNA_def_property_ui_text(prop, "Contour", "Select contours");
2507 RNA_def_property_update(prop, NC_SCENE, NULL);
2509 prop= RNA_def_property(srna, "select_external_contour", PROP_BOOLEAN, PROP_NONE);
2510 RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_EXTERNAL_CONTOUR);
2511 RNA_def_property_ui_text(prop, "External Contour", "Select external contours");
2512 RNA_def_property_update(prop, NC_SCENE, NULL);
2514 prop= RNA_def_property(srna, "select_edge_mark", PROP_BOOLEAN, PROP_NONE);
2515 RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_EDGE_MARK);
2516 RNA_def_property_ui_text(prop, "Edge Mark", "Select edge marks");
2517 RNA_def_property_update(prop, NC_SCENE, NULL);
2519 prop= RNA_def_property(srna, "exclude_silhouette", PROP_BOOLEAN, PROP_NONE);
2520 RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_SILHOUETTE);
2521 RNA_def_property_ui_text(prop, "Silhouette", "Exclude silhouette edges");
2522 RNA_def_property_ui_icon(prop, ICON_X, 0);
2523 RNA_def_property_update(prop, NC_SCENE, NULL);
2525 prop= RNA_def_property(srna, "exclude_border", PROP_BOOLEAN, PROP_NONE);
2526 RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_BORDER);
2527 RNA_def_property_ui_text(prop, "Border", "Exclude border edges");
2528 RNA_def_property_ui_icon(prop, ICON_X, 0);
2529 RNA_def_property_update(prop, NC_SCENE, NULL);
2531 prop= RNA_def_property(srna, "exclude_crease", PROP_BOOLEAN, PROP_NONE);
2532 RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_CREASE);
2533 RNA_def_property_ui_text(prop, "Crease", "Exclude crease edges");
2534 RNA_def_property_ui_icon(prop, ICON_X, 0);
2535 RNA_def_property_update(prop, NC_SCENE, NULL);
2537 prop= RNA_def_property(srna, "exclude_ridge_valley", PROP_BOOLEAN, PROP_NONE);
2538 RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_RIDGE_VALLEY);
2539 RNA_def_property_ui_text(prop, "Ridge & Valley", "Exclude ridges and valleys");
2540 RNA_def_property_ui_icon(prop, ICON_X, 0);
2541 RNA_def_property_update(prop, NC_SCENE, NULL);
2543 prop= RNA_def_property(srna, "exclude_suggestive_contour", PROP_BOOLEAN, PROP_NONE);
2544 RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_SUGGESTIVE_CONTOUR);
2545 RNA_def_property_ui_text(prop, "Suggestive Contour", "Exclude suggestive contours");
2546 RNA_def_property_ui_icon(prop, ICON_X, 0);
2547 RNA_def_property_update(prop, NC_SCENE, NULL);
2549 prop= RNA_def_property(srna, "exclude_material_boundary", PROP_BOOLEAN, PROP_NONE);
2550 RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_MATERIAL_BOUNDARY);
2551 RNA_def_property_ui_text(prop, "Material Boundary", "Exclude edges at material boundaries");
2552 RNA_def_property_ui_icon(prop, ICON_X, 0);
2553 RNA_def_property_update(prop, NC_SCENE, NULL);
2555 prop= RNA_def_property(srna, "exclude_contour", PROP_BOOLEAN, PROP_NONE);
2556 RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_CONTOUR);
2557 RNA_def_property_ui_text(prop, "Contour", "Exclude contours");
2558 RNA_def_property_ui_icon(prop, ICON_X, 0);
2559 RNA_def_property_update(prop, NC_SCENE, NULL);
2561 prop= RNA_def_property(srna, "exclude_external_contour", PROP_BOOLEAN, PROP_NONE);
2562 RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_EXTERNAL_CONTOUR);
2563 RNA_def_property_ui_text(prop, "External Contour", "Exclude external contours");
2564 RNA_def_property_ui_icon(prop, ICON_X, 0);
2565 RNA_def_property_update(prop, NC_SCENE, NULL);
2567 prop= RNA_def_property(srna, "exclude_edge_mark", PROP_BOOLEAN, PROP_NONE);
2568 RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_EDGE_MARK);
2569 RNA_def_property_ui_text(prop, "Edge Mark", "Exclude edge marks");
2570 RNA_def_property_ui_icon(prop, ICON_X, 0);
2571 RNA_def_property_update(prop, NC_SCENE, NULL);
2573 prop= RNA_def_property(srna, "visibility", PROP_ENUM, PROP_NONE);
2574 RNA_def_property_enum_sdna(prop, NULL, "qi");
2575 RNA_def_property_enum_items(prop, visibility_items);
2576 RNA_def_property_ui_text(prop, "Visibility", "Determine how to use visibility for feature edge selection");
2577 RNA_def_property_update(prop, NC_SCENE, NULL);
2579 prop= RNA_def_property(srna, "qi_start", PROP_INT, PROP_UNSIGNED);
2580 RNA_def_property_int_sdna(prop, NULL, "qi_start");
2581 RNA_def_property_range(prop, 0, INT_MAX);
2582 RNA_def_property_ui_text(prop, "Start", "First QI value of the QI range");
2583 RNA_def_property_update(prop, NC_SCENE, NULL);
2585 prop= RNA_def_property(srna, "qi_end", PROP_INT, PROP_UNSIGNED);
2586 RNA_def_property_int_sdna(prop, NULL, "qi_end");
2587 RNA_def_property_range(prop, 0, INT_MAX);
2588 RNA_def_property_ui_text(prop, "End", "Last QI value of the QI range");
2589 RNA_def_property_update(prop, NC_SCENE, NULL);
2591 /* FreestyleModuleSettings */
2593 srna= RNA_def_struct(brna, "FreestyleModuleSettings", NULL);
2594 RNA_def_struct_sdna(srna, "FreestyleModuleConfig");
2595 RNA_def_struct_ui_text(srna, "Freestyle Module", "Style module configuration for specifying a style module");
2597 prop= RNA_def_property(srna, "module_path", PROP_STRING, PROP_FILEPATH);
2598 RNA_def_property_string_sdna(prop, NULL, "module_path");
2599 RNA_def_property_ui_text(prop, "Module Path", "Path to a style module file");
2600 RNA_def_property_update(prop, NC_SCENE, NULL);
2602 prop= RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
2603 RNA_def_property_boolean_sdna(prop, NULL, "is_displayed", 1);
2604 RNA_def_property_ui_text(prop, "Use", "Enable or disable this style module during stroke rendering");
2605 RNA_def_property_update(prop, NC_SCENE, NULL);
2607 /* FreestyleSettings */
2609 srna= RNA_def_struct(brna, "FreestyleSettings", NULL);
2610 RNA_def_struct_sdna(srna, "FreestyleConfig");
2611 RNA_def_struct_nested(brna, srna, "SceneRenderLayer");
2612 RNA_def_struct_ui_text(srna, "Frestyle Settings", "Freestyle settings for a SceneRenderLayer datablock");
2614 prop= RNA_def_property(srna, "modules", PROP_COLLECTION, PROP_NONE);
2615 RNA_def_property_collection_sdna(prop, NULL, "modules", NULL);
2616 RNA_def_property_struct_type(prop, "FreestyleModuleSettings");
2617 RNA_def_property_ui_text(prop, "Style modules", "A list of style modules (to be applied from top to bottom)");
2619 prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
2620 RNA_def_property_enum_sdna(prop, NULL, "mode");
2621 RNA_def_property_enum_items(prop, freestyle_ui_mode_items);
2622 RNA_def_property_ui_text(prop, "Control Mode", "Select the Freestyle control mode");
2623 RNA_def_property_update(prop, NC_SCENE, NULL);
2625 prop= RNA_def_property(srna, "raycasting_algorithm", PROP_ENUM, PROP_NONE);
2626 RNA_def_property_enum_sdna(prop, NULL, "raycasting_algorithm");
2627 RNA_def_property_enum_items(prop, freestyle_raycasting_algorithm_items);
2628 RNA_def_property_ui_text(prop, "Raycasting Algorithm", "Select the Freestyle raycasting algorithm");
2629 RNA_def_property_update(prop, NC_SCENE, NULL);
2631 prop= RNA_def_property(srna, "use_culling", PROP_BOOLEAN, PROP_NONE);
2632 RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_CULLING);
2633 RNA_def_property_ui_text(prop, "Culling", "If enabled, out-of-view edges are ignored");
2634 RNA_def_property_update(prop, NC_SCENE, NULL);
2636 prop= RNA_def_property(srna, "use_suggestive_contours", PROP_BOOLEAN, PROP_NONE);
2637 RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_SUGGESTIVE_CONTOURS_FLAG);
2638 RNA_def_property_ui_text(prop, "Suggestive Contours", "Enable suggestive contours");
2639 RNA_def_property_update(prop, NC_SCENE, NULL);
2641 prop= RNA_def_property(srna, "use_ridges_and_valleys", PROP_BOOLEAN, PROP_NONE);
2642 RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_RIDGES_AND_VALLEYS_FLAG);
2643 RNA_def_property_ui_text(prop, "Ridges and Valleys", "Enable ridges and valleys");
2644 RNA_def_property_update(prop, NC_SCENE, NULL);
2646 prop= RNA_def_property(srna, "use_material_boundaries", PROP_BOOLEAN, PROP_NONE);
2647 RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_MATERIAL_BOUNDARIES_FLAG);
2648 RNA_def_property_ui_text(prop, "Material Boundaries", "Enable material boundaries");
2649 RNA_def_property_update(prop, NC_SCENE, NULL);
2651 prop= RNA_def_property(srna, "use_smoothness", PROP_BOOLEAN, PROP_NONE);
2652 RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_FACE_SMOOTHNESS_FLAG);
2653 RNA_def_property_ui_text(prop, "Face Smoothness", "Take face smoothness into account in view map calculation");
2654 RNA_def_property_update(prop, NC_SCENE, NULL);
2656 prop= RNA_def_property(srna, "use_advanced_options", PROP_BOOLEAN, PROP_NONE);
2657 RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_ADVANCED_OPTIONS_FLAG);
2658 RNA_def_property_ui_text(prop, "Advanced Edge Detection Options", "Enable advanced edge detection options (sphere radius and Kr derivative epsilon)");
2659 RNA_def_property_update(prop, NC_SCENE, NULL);
2661 prop= RNA_def_property(srna, "sphere_radius", PROP_FLOAT, PROP_NONE);
2662 RNA_def_property_float_sdna(prop, NULL, "sphere_radius");
2663 RNA_def_property_range(prop, 0.0, 1000.0);
2664 RNA_def_property_ui_text(prop, "Sphere Radius", "Sphere radius for computing curvatures");
2665 RNA_def_property_update(prop, NC_SCENE, NULL);
2667 prop= RNA_def_property(srna, "kr_derivative_epsilon", PROP_FLOAT, PROP_NONE);
2668 RNA_def_property_float_sdna(prop, NULL, "dkr_epsilon");
2669 RNA_def_property_range(prop, -1000.0, 1000.0);
2670 RNA_def_property_ui_text(prop, "Kr Derivative Epsilon", "Kr derivative epsilon for computing suggestive contours");
2671 RNA_def_property_update(prop, NC_SCENE, NULL);
2673 prop= RNA_def_property(srna, "crease_angle", PROP_FLOAT, PROP_NONE);
2674 RNA_def_property_float_sdna(prop, NULL, "crease_angle");
2675 RNA_def_property_range(prop, 0.0, 180.0);
2676 RNA_def_property_ui_text(prop, "Crease Angle", "Angular threshold in degrees (between 0 and 180) for detecting crease edges");
2677 RNA_def_property_update(prop, NC_SCENE, NULL);
2679 prop= RNA_def_property(srna, "linesets", PROP_COLLECTION, PROP_NONE);
2680 RNA_def_property_collection_sdna(prop, NULL, "linesets", NULL);
2681 RNA_def_property_struct_type(prop, "FreestyleLineSet");
2682 RNA_def_property_ui_text(prop, "Line Sets", "");
2683 rna_def_freestyle_linesets(brna, prop);
2686 static void rna_def_scene_game_recast_data(BlenderRNA *brna)
2691 srna = RNA_def_struct(brna, "SceneGameRecastData", NULL);
2692 RNA_def_struct_sdna(srna, "RecastData");
2693 RNA_def_struct_nested(brna, srna, "Scene");
2694 RNA_def_struct_ui_text(srna, "Recast Data", "Recast data for a Game datablock");
2696 prop = RNA_def_property(srna, "cell_size", PROP_FLOAT, PROP_NONE);
2697 RNA_def_property_float_sdna(prop, NULL, "cellsize");
2698 RNA_def_property_ui_range(prop, 0.1, 1, 1, 2);
2699 RNA_def_property_ui_text(prop, "Cell Size", "Rasterized cell size");
2700 RNA_def_property_update(prop, NC_SCENE, NULL);
2702 prop = RNA_def_property(srna, "cell_height", PROP_FLOAT, PROP_NONE);
2703 RNA_def_property_float_sdna(prop, NULL, "cellheight");
2704 RNA_def_property_ui_range(prop, 0.1, 1, 1, 2);
2705 RNA_def_property_ui_text(prop, "Cell Height", "Rasterized cell height");
2706 RNA_def_property_update(prop, NC_SCENE, NULL);
2708 prop = RNA_def_property(srna, "agent_height", PROP_FLOAT, PROP_NONE);
2709 RNA_def_property_float_sdna(prop, NULL, "agentheight");
2710 RNA_def_property_ui_range(prop, 0.1, 5, 1, 2);
2711 RNA_def_property_ui_text(prop, "Agent Height", "Minimum height where the agent can still walk");
2712 RNA_def_property_update(prop, NC_SCENE, NULL);
2714 prop = RNA_def_property(srna, "agent_radius", PROP_FLOAT, PROP_NONE);
2715 RNA_def_property_float_sdna(prop, NULL, "agentradius");
2716 RNA_def_property_ui_range(prop, 0.1, 5, 1, 2);
2717 RNA_def_property_ui_text(prop, "Agent Radius", "Radius of the agent");
2718 RNA_def_property_update(prop, NC_SCENE, NULL);
2720 prop = RNA_def_property(srna, "climb_max", PROP_FLOAT, PROP_NONE);
2721 RNA_def_property_float_sdna(prop, NULL, "agentmaxclimb");
2722 RNA_def_property_ui_range(prop, 0.1, 5, 1, 2);
2723 RNA_def_property_ui_text(prop, "Max Climb", "Maximum height between grid cells the agent can climb");
2724 RNA_def_property_update(prop, NC_SCENE, NULL);
2726 prop = RNA_def_property(srna, "slope_max", PROP_FLOAT, PROP_ANGLE);
2727 RNA_def_property_float_sdna(prop, NULL, "agentmaxslope");
2728 RNA_def_property_range(prop, 0, M_PI / 2);
2729 RNA_def_property_ui_text(prop, "Max Slope", "Maximum walkable slope angle in degrees");
2730 RNA_def_property_update(prop, NC_SCENE, NULL);
2733 prop = RNA_def_property(srna, "region_min_size", PROP_FLOAT, PROP_NONE);
2734 RNA_def_property_float_sdna(prop, NULL, "regionminsize");
2735 RNA_def_property_ui_range(prop, 0, 150, 1, 2);
2736 RNA_def_property_ui_text(prop, "Min Region Size", "Minimum regions size (smaller regions will be deleted)");
2737 RNA_def_property_update(prop, NC_SCENE, NULL);
2739 prop = RNA_def_property(srna, "region_merge_size", PROP_FLOAT, PROP_NONE);
2740 RNA_def_property_float_sdna(prop, NULL, "regionmergesize");
2741 RNA_def_property_ui_range(prop, 0, 150, 1, 2);
2742 RNA_def_property_ui_text(prop, "Merged Region Size", "Minimum regions size (smaller regions will be merged)");
2743 RNA_def_property_update(prop, NC_SCENE, NULL);
2745 prop = RNA_def_property(srna, "edge_max_len", PROP_FLOAT, PROP_NONE);
2746 RNA_def_property_float_sdna(prop, NULL, "edgemaxlen");
2747 RNA_def_property_ui_range(prop, 0, 50, 1, 2);
2748 RNA_def_property_ui_text(prop, "Max Edge Length", "Maximum contour edge length");
2749 RNA_def_property_update(prop, NC_SCENE, NULL);
2751 prop = RNA_def_property(srna, "edge_max_error", PROP_FLOAT, PROP_NONE);
2752 RNA_def_property_float_sdna(prop, NULL, "edgemaxerror");
2753 RNA_def_property_ui_range(prop, 0.1, 3.0, 1, 2);
2754 RNA_def_property_ui_text(prop, "Max Edge Error", "Maximum distance error from contour to cells");
2755 RNA_def_property_update(prop, NC_SCENE, NULL);
2757 prop = RNA_def_property(srna, "verts_per_poly", PROP_INT, PROP_NONE);
2758 RNA_def_property_int_sdna(prop, NULL, "vertsperpoly");
2759 RNA_def_property_ui_range(prop, 3, 12, 1, 0);
2760 RNA_def_property_ui_text(prop, "Verts Per Poly", "Max number of vertices per polygon");
2761 RNA_def_property_update(prop, NC_SCENE, NULL);
2763 prop = RNA_def_property(srna, "sample_dist", PROP_FLOAT, PROP_NONE);
2764 RNA_def_property_float_sdna(prop, NULL, "detailsampledist");
2765 RNA_def_property_ui_range(prop, 0.0, 16.0, 1, 2);
2766 RNA_def_property_ui_text(prop, "Sample Distance", "Detail mesh sample spacing");
2767 RNA_def_property_update(prop, NC_SCENE, NULL);
2769 prop = RNA_def_property(srna, "sample_max_error", PROP_FLOAT, PROP_NONE);
2770 RNA_def_property_float_sdna(prop, NULL, "detailsamplemaxerror");
2771 RNA_def_property_ui_range(prop, 0.0, 16.0, 1, 2);
2772 RNA_def_property_ui_text(prop, "Max Sample Error", "Detail mesh simplification max sample error");
2773 RNA_def_property_update(prop, NC_SCENE, NULL);
2776 static void rna_def_scene_game_data(BlenderRNA *brna)
2781 static EnumPropertyItem aasamples_items[] = {
2782 {0, "SAMPLES_0", 0, "Off", ""},
2783 {2, "SAMPLES_2", 0, "2x", ""},
2784 {4, "SAMPLES_4", 0, "4x", ""},
2785 {8, "SAMPLES_8", 0, "8x", ""},
2786 {16, "SAMPLES_16", 0, "16x", ""},
2787 {0, NULL, 0, NULL, NULL}
2790 static EnumPropertyItem framing_types_items[] = {
2791 {SCE_GAMEFRAMING_BARS, "LETTERBOX", 0, "Letterbox",
2792 "Show the entire viewport in the display window, using bar horizontally or vertically"},
2793 {SCE_GAMEFRAMING_EXTEND, "EXTEND", 0, "Extend",
2794 "Show the entire viewport in the display window, viewing more horizontally "
2796 {SCE_GAMEFRAMING_SCALE, "SCALE", 0, "Scale", "Stretch or squeeze the viewport to fill the display window"},
2797 {0, NULL, 0, NULL, NULL}
2800 static EnumPropertyItem dome_modes_items[] = {
2801 {DOME_FISHEYE, "FISHEYE", 0, "Fisheye", ""},
2802 {DOME_TRUNCATED_FRONT, "TRUNCATED_FRONT", 0, "Front-Truncated", ""},
2803 {DOME_TRUNCATED_REAR, "TRUNCATED_REAR", 0, "Rear-Truncated", ""},
2804 {DOME_ENVMAP, "ENVMAP", 0, "Cube Map", ""},
2805 {DOME_PANORAM_SPH, "PANORAM_SPH", 0, "Spherical Panoramic", ""},
2806 {0, NULL, 0, NULL, NULL}
2809 static EnumPropertyItem stereo_modes_items[] = {
2810 {STEREO_QUADBUFFERED, "QUADBUFFERED", 0, "Quad-Buffer", ""},
2811 {STEREO_ABOVEBELOW, "ABOVEBELOW", 0, "Above-Below", ""},
2812 {STEREO_INTERLACED, "INTERLACED", 0, "Interlaced", ""},
2813 {STEREO_ANAGLYPH, "ANAGLYPH", 0, "Anaglyph", ""},
2814 {STEREO_SIDEBYSIDE, "SIDEBYSIDE", 0, "Side-by-side", ""},
2815 {STEREO_VINTERLACE, "VINTERLACE", 0, "Vinterlace", ""},
2816 {0, NULL, 0, NULL, NULL}
2819 static EnumPropertyItem stereo_items[] = {
2820 {STEREO_NOSTEREO, "NONE", 0, "None", "Disable Stereo and Dome environments"},
2821 {STEREO_ENABLED, "STEREO", 0, "Stereo", "Enable Stereo environment"},
2822 {STEREO_DOME, "DOME", 0, "Dome", "Enable Dome environment"},
2823 {0, NULL, 0, NULL, NULL}
2826 static EnumPropertyItem physics_engine_items[] = {
2827 {WOPHY_NONE, "NONE", 0, "None", "Don't use a physics engine"},
2828 /*{WOPHY_ENJI, "ENJI", 0, "Enji", ""}, */
2829 /*{WOPHY_SUMO, "SUMO", 0, "Sumo (Deprecated)", ""}, */
2830 /*{WOPHY_DYNAMO, "DYNAMO", 0, "Dynamo", ""}, */
2831 /*{WOPHY_ODE, "ODE", 0, "ODE", ""}, */
2832 {WOPHY_BULLET, "BULLET", 0, "Bullet", "Use the Bullet physics engine"},
2833 {0, NULL, 0, NULL, NULL}
2836 static EnumPropertyItem material_items[] = {
2837 {GAME_MAT_TEXFACE, "SINGLETEXTURE", 0, "Singletexture", "Singletexture face materials"},
2838 {GAME_MAT_MULTITEX, "MULTITEXTURE", 0, "Multitexture", "Multitexture materials"},
2839 {GAME_MAT_GLSL, "GLSL", 0, "GLSL", "OpenGL shading language shaders"},
2840 {0, NULL, 0, NULL, NULL}
2843 static EnumPropertyItem obstacle_simulation_items[] = {
2844 {OBSTSIMULATION_NONE, "NONE", 0, "None", ""},
2845 {OBSTSIMULATION_TOI_rays, "RVO_RAYS", 0, "RVO (rays)", ""},
2846 {OBSTSIMULATION_TOI_cells, "RVO_CELLS", 0, "RVO (cells)", ""},
2847 {0, NULL, 0, NULL, NULL}
2850 srna = RNA_def_struct(brna, "SceneGameData", NULL);
2851 RNA_def_struct_sdna(srna, "GameData");
2852 RNA_def_struct_nested(brna, srna, "Scene");
2853 RNA_def_struct_ui_text(srna, "Game Data", "Game data for a Scene datablock");
2855 prop = RNA_def_property(srna, "resolution_x", PROP_INT, PROP_NONE);
2856 RNA_def_property_int_sdna(prop, NULL, "xplay");
2857 RNA_def_property_range(prop, 4, 10000);
2858 RNA_def_property_ui_text(prop, "Resolution X", "Number of horizontal pixels in the screen");
2859 RNA_def_property_update(prop, NC_SCENE, NULL);
2861 prop = RNA_def_property(srna, "resolution_y", PROP_INT, PROP_NONE);
2862 RNA_def_property_int_sdna(prop, NULL, "yplay");
2863 RNA_def_property_range(prop, 4, 10000);
2864 RNA_def_property_ui_text(prop, "Resolution Y", "Number of vertical pixels in the screen");
2865 RNA_def_property_update(prop, NC_SCENE, NULL);
2867 prop = RNA_def_property(srna, "samples", PROP_ENUM, PROP_NONE);
2868 RNA_def_property_enum_sdna(prop, NULL, "aasamples");
2869 RNA_def_property_enum_items(prop, aasamples_items);
2870 RNA_def_property_ui_text(prop, "AA Samples", "The number of AA Samples to use for MSAA");
2872 prop = RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED);
2873 RNA_def_property_int_sdna(prop, NULL, "depth");
2874 RNA_def_property_range(prop, 8, 32);
2875 RNA_def_property_ui_text(prop, "Bits", "Display bit depth of full screen display");
2876 RNA_def_property_update(prop, NC_SCENE, NULL);
2878 prop = RNA_def_property(srna, "exit_key", PROP_ENUM, PROP_NONE);
2879 RNA_def_property_enum_sdna(prop, NULL, "exitkey");
2880 RNA_def_property_enum_items(prop, event_type_items);
2881 RNA_def_property_enum_funcs(prop, NULL, "rna_GameSettings_exit_key_set", NULL);
2882 RNA_def_property_ui_text(prop, "Exit Key", "The key that exits the Game Engine");
2883 RNA_def_property_update(prop, NC_SCENE, NULL);
2885 /* Do we need it here ? (since we already have it in World */
2886 prop = RNA_def_property(srna, "frequency", PROP_INT, PROP_NONE);
2887 RNA_def_property_int_sdna(prop, NULL, "freqplay");
2888 RNA_def_property_range(prop, 4, 2000);
2889 RNA_def_property_ui_text(prop, "Freq", "Display clock frequency of fullscreen display");
2890 RNA_def_property_update(prop, NC_SCENE, NULL);
2892 prop = RNA_def_property(srna, "show_fullscreen", PROP_BOOLEAN, PROP_NONE);
2893 RNA_def_property_boolean_sdna(prop, NULL, "playerflag", GAME_PLAYER_FULLSCREEN);
2894 RNA_def_property_ui_text(prop, "Fullscreen", "Start player in a new fullscreen display");
2895 RNA_def_property_update(prop, NC_SCENE, NULL);
2897 prop = RNA_def_property(srna, "use_desktop", PROP_BOOLEAN, PROP_NONE);
2898 RNA_def_property_boolean_sdna(prop, NULL, "playerflag", GAME_PLAYER_DESKTOP_RESOLUTION);
2899 RNA_def_property_ui_text(prop, "Desktop", "Use the current desktop resolution in fullscreen mode");
2900 RNA_def_property_update(prop, NC_SCENE, NULL);
2903 prop = RNA_def_property(srna, "frame_type", PROP_ENUM, PROP_NONE);
2904 RNA_def_property_enum_sdna(prop, NULL, "framing.type");
2905 RNA_def_property_enum_items(prop, framing_types_items);
2906 RNA_def_property_ui_text(prop, "Framing Types", "Select the type of Framing you want");
2907 RNA_def_property_update(prop, NC_SCENE, NULL);
2909 prop = RNA_def_property(srna, "frame_color", PROP_FLOAT, PROP_COLOR);
2910 RNA_def_property_float_sdna(prop, NULL, "framing.col");
2911 RNA_def_property_range(prop, 0.0f, 1.0f);
2912 RNA_def_property_array(prop, 3);
2913 RNA_def_property_ui_text(prop, "Framing Color", "Set color of the bars");
2914 RNA_def_property_update(prop, NC_SCENE, NULL);
2917 prop = RNA_def_property(srna, "stereo", PROP_ENUM, PROP_NONE);
2918 RNA_def_property_enum_sdna(prop, NULL, "stereoflag");
2919 RNA_def_property_enum_items(prop, stereo_items);
2920 RNA_def_property_ui_text(prop, "Stereo Options", "");
2921 RNA_def_property_update(prop, NC_SCENE, NULL);
2923 prop = RNA_def_property(srna, "stereo_mode", PROP_ENUM, PROP_NONE);
2924 RNA_def_property_enum_sdna(prop, NULL, "stereomode");
2925 RNA_def_property_enum_items(prop, stereo_modes_items);
2926 RNA_def_property_ui_text(prop, "Stereo Mode", "Stereographic techniques");
2927 RNA_def_property_update(prop, NC_SCENE, NULL);
2929 prop = RNA_def_property(srna, "stereo_eye_separation", PROP_FLOAT, PROP_NONE);
2930 RNA_def_property_float_sdna(prop, NULL, "eyeseparation");
2931 RNA_def_property_range(prop, 0.01, 5.0);
2932 RNA_def_property_ui_text(prop, "Eye Separation",
2933 "Set the distance between the eyes - the camera focal length/30 should be fine");
2934 RNA_def_property_update(prop, NC_SCENE, NULL);
2937 prop = RNA_def_property(srna, "dome_mode", PROP_ENUM, PROP_NONE);
2938 RNA_def_property_enum_sdna(prop, NULL, "dome.mode");
2939 RNA_def_property_enum_items(prop, dome_modes_items);
2940 RNA_def_property_ui_text(prop, "Dome Mode", "Dome physical configurations");
2941 RNA_def_property_update(prop, NC_SCENE, NULL);
2943 prop = RNA_def_property(srna, "dome_tessellation", PROP_INT, PROP_NONE);
2944 RNA_def_property_int_sdna(prop, NULL, "dome.res");
2945 RNA_def_property_ui_range(prop, 1, 8, 1, 1);
2946 RNA_def_property_ui_text(prop, "Tessellation", "Tessellation level - check the generated mesh in wireframe mode");
2947 RNA_def_property_update(prop, NC_SCENE, NULL);
2949 prop = RNA_def_property(srna, "dome_buffer_resolution", PROP_FLOAT, PROP_NONE);
2950 RNA_def_property_float_sdna(prop, NULL, "dome.resbuf");
2951 RNA_def_property_ui_range(prop, 0.1, 1.0, 0.1, 2);
2952 RNA_def_property_ui_text(prop, "Buffer Resolution", "Buffer Resolution - decrease it to increase speed");
2953 RNA_def_property_update(prop, NC_SCENE, NULL);
2955 prop = RNA_def_property(srna, "dome_angle", PROP_INT, PROP_NONE);
2956 RNA_def_property_int_sdna(prop, NULL, "dome.angle");
2957 RNA_def_property_ui_range(prop, 90, 250, 1, 1);
2958 RNA_def_property_ui_text(prop, "Angle", "Field of View of the Dome - it only works in mode Fisheye and Truncated");
2959 RNA_def_property_update(prop, NC_SCENE, NULL);
2961 prop = RNA_def_property(srna, "dome_tilt", PROP_INT, PROP_NONE);
2962 RNA_def_property_int_sdna(prop, NULL, "dome.tilt");
2963 RNA_def_property_ui_range(prop, -180, 180, 1, 1);
2964 RNA_def_property_ui_text(prop, "Tilt", "Camera rotation in horizontal axis");
2965 RNA_def_property_update(prop, NC_SCENE, NULL);
2967 prop = RNA_def_property(srna, "dome_text", PROP_POINTER, PROP_NONE);
2968 RNA_def_property_pointer_sdna(prop, NULL, "dome.warptext");
2969 RNA_def_property_struct_type(prop, "Text");
2970 RNA_def_property_flag(prop, PROP_EDITABLE);
2971 RNA_def_property_ui_text(prop, "Warp Data", "Custom Warp Mesh data file");
2972 RNA_def_property_update(prop, NC_SCENE, NULL);
2975 prop = RNA_def_property(srna, "physics_engine", PROP_ENUM, PROP_NONE);
2976 RNA_def_property_enum_sdna(prop, NULL, "physicsEngine");
2977 RNA_def_property_enum_items(prop, physics_engine_items);
2978 RNA_def_property_ui_text(prop, "Physics Engine", "Physics engine used for physics simulation in the game engine");
2979 RNA_def_property_update(prop, NC_SCENE, NULL);
2981 prop = RNA_def_property(srna, "physics_gravity", PROP_FLOAT, PROP_ACCELERATION);
2982 RNA_def_property_float_sdna(prop, NULL, "gravity");
2983 RNA_def_property_ui_range(prop, 0.0, 25.0, 1, 2);
2984 RNA_def_property_range(prop, 0.0, 10000.0);
2985 RNA_def_property_ui_text(prop, "Physics Gravity",
2986 "Gravitational constant used for physics simulation in the game engine");
2987 RNA_def_property_update(prop, NC_SCENE, NULL);
2989 prop = RNA_def_property(srna, "occlusion_culling_resolution", PROP_INT, PROP_NONE);
2990 RNA_def_property_int_sdna(prop, NULL, "occlusionRes");
2991 RNA_def_property_range(prop, 128.0, 1024.0);
2992 RNA_def_property_ui_text(prop, "Occlusion Resolution",
2993 "Size of the occlusion buffer in pixel, use higher value for better precision (slower)");
2994 RNA_def_property_update(prop, NC_SCENE, NULL);
2996 prop = RNA_def_property(srna, "fps", PROP_INT, PROP_NONE);
2997 RNA_def_property_int_sdna(prop, NULL, "ticrate");
2998 RNA_def_property_ui_range(prop, 1, 60, 1, 1);
2999 RNA_def_property_range(prop, 1, 250);
3000 RNA_def_property_ui_text(prop, "Frames Per Second",
3001 "Nominal number of game frames per second "
3002 "(physics fixed timestep = 1/fps, independently of actual frame rate)");
3003 RNA_def_property_update(prop, NC_SCENE, NULL);
3005 prop = RNA_def_property(srna, "logic_step_max", PROP_INT, PROP_NONE);
3006 RNA_def_property_int_sdna(prop, NULL, "maxlogicstep");
3007 RNA_def_property_ui_range(prop, 1, 5, 1, 1);
3008 RNA_def_property_range(prop, 1, 5);
3009 RNA_def_property_ui_text(prop, "Max Logic Steps",
3010 "Maximum number of logic frame per game frame if graphics slows down the game, "
3011 "higher value allows better synchronization with physics");
3012 RNA_def_property_update(prop, NC_SCENE, NULL);
3014 prop = RNA_def_property(srna, "physics_step_max", PROP_INT, PROP_NONE);
3015 RNA_def_property_int_sdna(prop, NULL, "maxphystep");
3016 RNA_def_property_ui_range(prop, 1, 5, 1, 1);
3017 RNA_def_property_range(prop, 1, 5);
3018 RNA_def_property_ui_text(prop, "Max Physics Steps",
3019 "Maximum number of physics step per game frame if graphics slows down the game, "
3020 "higher value allows physics to keep up with realtime");
3021 RNA_def_property_update(prop, NC_SCENE, NULL);
3023 prop = RNA_def_property(srna, "physics_step_sub", PROP_INT, PROP_NONE);
3024 RNA_def_property_int_sdna(prop, NULL, "physubstep");
3025 RNA_def_property_range(prop, 1, 50);
3026 RNA_def_property_ui_range(prop, 1, 5, 1, 1);
3027 RNA_def_property_ui_text(prop, "Physics Sub Steps",
3028 "Number of simulation substep per physic timestep, "
3029 "higher value give better physics precision");
3030 RNA_def_property_update(prop, NC_SCENE, NULL);
3032 prop = RNA_def_property(srna, "deactivation_linear_threshold", PROP_FLOAT, PROP_NONE);
3033 RNA_def_property_float_sdna(prop, NULL, "lineardeactthreshold");
3034 RNA_def_property_ui_range(prop, 0.001, 10000.0, 2, 3);
3035 RNA_def_property_range(prop, 0.001, 10000.0);
3036 RNA_def_property_ui_text(prop, "Deactivation Linear Threshold",
3037 "Linear velocity that an object must be below before the deactivation timer can start");
3038 RNA_def_property_update(prop, NC_SCENE, NULL);
3040 prop = RNA_def_property(srna, "deactivation_angular_threshold", PROP_FLOAT, PROP_NONE);
3041 RNA_def_property_float_sdna(prop, NULL, "angulardeactthreshold");
3042 RNA_def_property_ui_range(prop, 0.001, 10000.0, 2, 3);
3043 RNA_def_property_range(prop, 0.001, 10000.0);
3044 RNA_def_property_ui_text(prop, "Deactivation Angular Threshold",
3045 "Angular velocity that an object must be below before the deactivation timer can start");
3046 RNA_def_property_update(prop, NC_SCENE, NULL);
3048 prop = RNA_def_property(srna, "deactivation_time", PROP_FLOAT, PROP_NONE);
3049 RNA_def_property_float_sdna(prop, NULL, "deactivationtime");
3050 RNA_def_property_ui_range(prop, 0.0, 60.0, 1, 1);
3051 RNA_def_property_range(prop, 0.0, 60.0);
3052 RNA_def_property_ui_text(prop, "Deactivation Time",
3053 "Amount of time (in seconds) after which objects with a velocity less than the given "
3054 "threshold will deactivate (0.0 means no deactivation)");
3055 RNA_def_property_update(prop, NC_SCENE, NULL);
3058 prop = RNA_def_property(srna, "use_occlusion_culling", PROP_BOOLEAN, PROP_NONE);
3059 RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_DBVT_CULLING);
3060 RNA_def_property_ui_text(prop, "DBVT culling",
3061 "Use optimized Bullet DBVT tree for view frustum and occlusion culling");
3063 /* not used *//* deprecated !!!!!!!!!!!!! */
3064 prop = RNA_def_property(srna, "use_activity_culling", PROP_BOOLEAN, PROP_NONE);
3065 RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_ACTIVITY_CULLING);
3066 RNA_def_property_ui_text(prop, "Activity Culling", "Activity culling is enabled");
3068 /* not used *//* deprecated !!!!!!!!!!!!! */
3069 prop = RNA_def_property(srna, "activity_culling_box_radius", PROP_FLOAT, PROP_NONE);
3070 RNA_def_property_float_sdna(prop, NULL, "activityBoxRadius");
3071 RNA_def_property_range(prop, 0.0, 1000.0);
3072 RNA_def_property_ui_text(prop, "Box Radius",
3073 "Radius of the activity bubble, in Manhattan length "
3074 "(objects outside the box are activity-culled)");
3077 prop = RNA_def_property(srna, "show_debug_properties", PROP_BOOLEAN, PROP_NONE);
3078 RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_DEBUG_PROPS);
3079 RNA_def_property_ui_text(prop, "Show Debug Properties",
3080 "Show properties marked for debugging while the game runs");
3082 prop = RNA_def_property(srna, "show_framerate_profile", PROP_BOOLEAN, PROP_NONE);
3083 RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_FRAMERATE);
3084 RNA_def_property_ui_text(prop, "Show Framerate and Profile",
3085 "Show framerate and profiling information while the game runs");
3087 prop = RNA_def_property(srna, "show_physics_visualization", PROP_BOOLEAN, PROP_NONE);
3088 RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_PHYSICS);
3089 RNA_def_property_ui_text(prop, "Show Physics Visualization",
3090 "Show a visualization of physics bounds and interactions");
3092 prop = RNA_def_property(srna, "show_mouse", PROP_BOOLEAN, PROP_NONE);
3093 RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_MOUSE);
3094 RNA_def_property_ui_text(prop, "Show Mouse", "Start player with a visible mouse cursor");
3096 prop = RNA_def_property(srna, "use_frame_rate", PROP_BOOLEAN, PROP_NONE);
3097 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_ENABLE_ALL_FRAMES);
3098 RNA_def_property_ui_text(prop, "Use Frame Rate",
3099 "Respect the frame rate rather than rendering as many frames as possible");
3101 prop = RNA_def_property(srna, "use_display_lists", PROP_BOOLEAN, PROP_NONE);
3102 RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_DISPLAY_LISTS);
3103 RNA_def_property_ui_text(prop, "Display Lists",
3104 "Use display lists to speed up rendering by keeping geometry on the GPU");
3106 prop = RNA_def_property(srna, "use_deprecation_warnings", PROP_BOOLEAN, PROP_NONE);
3107 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_IGNORE_DEPRECATION_WARNINGS);
3108 RNA_def_property_ui_text(prop, "Deprecation Warnings",
3109 "Print warnings when using deprecated features in the python API");
3111 prop = RNA_def_property(srna, "use_animation_record", PROP_BOOLEAN, PROP_NONE);
3112 RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_ENABLE_ANIMATION_RECORD);
3113 RNA_def_property_ui_text(prop, "Record Animation", "Record animation to F-Curves");
3115 prop = RNA_def_property(srna, "use_auto_start", PROP_BOOLEAN, PROP_NONE);
3116 RNA_def_property_boolean_funcs(prop, "rna_GameSettings_auto_start_get", "rna_GameSettings_auto_start_set");
3117 RNA_def_property_ui_text(prop, "Auto Start", "Automatically start game at load time");
3119 prop = RNA_def_property(srna, "restrict_animation_updates", PROP_BOOLEAN, PROP_NONE);
3120 RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_RESTRICT_ANIM_UPDATES);
3121 RNA_def_property_ui_text(prop, "Restrict Animation Updates",
3122 "Restrict the number of animation updates to the animation FPS (this is "
3123 "better for performance, but can cause issues with smooth playback)");
3126 prop = RNA_def_property(srna, "material_mode", PROP_ENUM, PROP_NONE);
3127 RNA_def_property_enum_sdna(prop, NULL, "matmode");
3128 RNA_def_property_enum_items(prop, material_items);
3129 RNA_def_property_ui_text(prop, "Material Mode", "Material mode to use for rendering");
3130 RNA_def_property_update(prop, NC_SCENE | NA_EDITED, NULL);
3132 prop = RNA_def_property(srna, "use_glsl_lights", PROP_BOOLEAN, PROP_NONE);
3133 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_LIGHTS);
3134 RNA_def_property_ui_text(prop, "GLSL Lights", "Use lights for GLSL rendering");
3135 RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_glsl_update");
3137 prop = RNA_def_property(srna, "use_glsl_shaders", PROP_BOOLEAN, PROP_NONE);
3138 RNA_def_property_boolean_negative_sdna(prop, NULL,