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 char *rna_SceneRenderLayer_path(PointerRNA *ptr)
1131 SceneRenderLayer *srl = (SceneRenderLayer*)ptr->data;
1132 return BLI_sprintfN("render.layers[\"%s\"]", srl->name);
1135 static int rna_RenderSettings_multiple_engines_get(PointerRNA *UNUSED(ptr))
1137 return (BLI_countlist(&R_engines) > 1);
1140 static int rna_RenderSettings_use_shading_nodes_get(PointerRNA *ptr)
1142 Scene *scene = (Scene *)ptr->id.data;
1143 return BKE_scene_use_new_shading_nodes(scene);
1146 static int rna_RenderSettings_use_game_engine_get(PointerRNA *ptr)
1148 RenderData *rd = (RenderData *)ptr->data;
1149 RenderEngineType *type;
1151 for (type = R_engines.first; type; type = type->next)
1152 if (strcmp(type->idname, rd->engine) == 0)
1153 return (type->flag & RE_GAME);
1158 static void rna_SceneRenderLayer_layer_set(PointerRNA *ptr, const int *values)
1160 SceneRenderLayer *rl = (SceneRenderLayer *)ptr->data;
1161 rl->lay = ED_view3d_scene_layer_set(rl->lay, values, NULL);
1164 static void rna_SceneRenderLayer_pass_update(Main *bmain, Scene *activescene, PointerRNA *ptr)
1166 Scene *scene = (Scene *)ptr->id.data;
1168 if (scene->nodetree)
1169 ntreeCompositForceHidden(scene->nodetree, scene);
1171 rna_Scene_glsl_update(bmain, activescene, ptr);
1174 static void rna_Scene_use_nodes_set(PointerRNA *ptr, int value)
1176 Scene *scene = (Scene *)ptr->data;
1178 scene->use_nodes = value;
1179 if (scene->use_nodes && scene->nodetree == NULL)
1180 ED_node_composit_default(scene);
1183 static void rna_Physics_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1185 Scene *scene = (Scene *)ptr->id.data;
1188 for (base = scene->base.first; base; base = base->next)
1189 BKE_ptcache_object_reset(scene, base->object, PTCACHE_RESET_DEPSGRAPH);
1192 static void rna_Scene_editmesh_select_mode_set(PointerRNA *ptr, const int *value)
1194 Scene *scene = (Scene *)ptr->id.data;
1195 ToolSettings *ts = (ToolSettings *)ptr->data;
1196 int flag = (value[0] ? SCE_SELECT_VERTEX : 0) | (value[1] ? SCE_SELECT_EDGE : 0) | (value[2] ? SCE_SELECT_FACE : 0);
1199 ts->selectmode = flag;
1201 if (scene->basact) {
1202 Mesh *me = BKE_mesh_from_object(scene->basact->object);
1203 if (me && me->edit_btmesh && me->edit_btmesh->selectmode != flag) {
1204 me->edit_btmesh->selectmode = flag;
1205 EDBM_selectmode_set(me->edit_btmesh);
1211 static void rna_Scene_editmesh_select_mode_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
1215 if (scene->basact) {
1216 me = BKE_mesh_from_object(scene->basact->object);
1217 if (me && me->edit_btmesh == NULL)
1221 WM_main_add_notifier(NC_GEOM | ND_SELECT, me);
1222 WM_main_add_notifier(NC_SCENE | ND_TOOLSETTINGS, NULL);
1225 static void object_simplify_update(Object *ob)
1228 ParticleSystem *psys;
1230 for (md = ob->modifiers.first; md; md = md->next) {
1231 if (ELEM3(md->type, eModifierType_Subsurf, eModifierType_Multires, eModifierType_ParticleSystem)) {
1232 ob->recalc |= PSYS_RECALC_CHILD;
1233 DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
1237 for (psys = ob->particlesystem.first; psys; psys = psys->next)
1238 psys->recalc |= PSYS_RECALC_CHILD;
1240 if (ob->dup_group) {
1243 for (gob = ob->dup_group->gobject.first; gob; gob = gob->next)
1244 object_simplify_update(gob->ob);
1248 static void rna_Scene_use_simplify_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr))
1253 for (SETLOOPER(scene, sce_iter, base))
1254 object_simplify_update(base->object);
1256 DAG_ids_flush_update(bmain, 0);
1257 WM_main_add_notifier(NC_GEOM | ND_DATA, NULL);
1260 static void rna_Scene_simplify_update(Main *bmain, Scene *scene, PointerRNA *ptr)
1262 if (scene->r.mode & R_SIMPLIFY)
1263 rna_Scene_use_simplify_update(bmain, scene, ptr);
1266 static void rna_Scene_use_persistent_data_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr))
1268 if (!(scene->r.mode & R_PERSISTENT_DATA))
1269 RE_FreePersistentData();
1272 static int rna_Scene_use_audio_get(PointerRNA *ptr)
1274 Scene *scene = (Scene *)ptr->data;
1275 return scene->audio.flag & AUDIO_MUTE;
1278 static void rna_Scene_use_audio_set(PointerRNA *ptr, int value)
1280 Scene *scene = (Scene *)ptr->data;
1283 scene->audio.flag |= AUDIO_MUTE;
1285 scene->audio.flag &= ~AUDIO_MUTE;
1287 sound_mute_scene(scene, value);
1290 static int rna_Scene_sync_mode_get(PointerRNA *ptr)
1292 Scene *scene = (Scene *)ptr->data;
1293 if (scene->audio.flag & AUDIO_SYNC)
1295 return scene->flag & SCE_FRAME_DROP;
1298 static void rna_Scene_sync_mode_set(PointerRNA *ptr, int value)
1300 Scene *scene = (Scene *)ptr->data;
1302 if (value == AUDIO_SYNC) {
1303 scene->audio.flag |= AUDIO_SYNC;
1305 else if (value == SCE_FRAME_DROP) {
1306 scene->audio.flag &= ~AUDIO_SYNC;
1307 scene->flag |= SCE_FRAME_DROP;
1310 scene->audio.flag &= ~AUDIO_SYNC;
1311 scene->flag &= ~SCE_FRAME_DROP;
1315 static int rna_GameSettings_auto_start_get(PointerRNA *UNUSED(ptr))
1317 if (G.fileflags & G_FILE_AUTOPLAY)
1323 static void rna_GameSettings_auto_start_set(PointerRNA *UNUSED(ptr), int value)
1326 G.fileflags |= G_FILE_AUTOPLAY;
1328 G.fileflags &= ~G_FILE_AUTOPLAY;
1331 static void rna_GameSettings_exit_key_set(PointerRNA *ptr, int value)
1333 GameData *gm = (GameData *)ptr->data;
1335 if (ISKEYBOARD(value))
1336 gm->exitkey = value;
1339 static TimeMarker *rna_TimeLine_add(Scene *scene, const char name[])
1341 TimeMarker *marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker");
1342 marker->flag = SELECT;
1344 BLI_strncpy_utf8(marker->name, name, sizeof(marker->name));
1345 BLI_addtail(&scene->markers, marker);
1347 WM_main_add_notifier(NC_SCENE | ND_MARKERS, NULL);
1348 WM_main_add_notifier(NC_ANIMATION | ND_MARKERS, NULL);
1353 static void rna_TimeLine_remove(Scene *scene, ReportList *reports, PointerRNA *marker_ptr)
1355 TimeMarker *marker = marker_ptr->data;
1356 if (BLI_remlink_safe(&scene->markers, marker) == FALSE) {
1357 BKE_reportf(reports, RPT_ERROR, "Timeline marker '%s' not found in scene '%s'", marker->name, scene->id.name + 2);
1362 RNA_POINTER_INVALIDATE(marker_ptr);
1364 WM_main_add_notifier(NC_SCENE | ND_MARKERS, NULL);
1365 WM_main_add_notifier(NC_ANIMATION | ND_MARKERS, NULL);
1368 static void rna_TimeLine_clear(Scene *scene)
1370 BLI_freelistN(&scene->markers);
1372 WM_main_add_notifier(NC_SCENE | ND_MARKERS, NULL);
1373 WM_main_add_notifier(NC_ANIMATION | ND_MARKERS, NULL);
1376 static KeyingSet *rna_Scene_keying_set_new(Scene *sce, ReportList *reports, const char idname[], const char name[])
1378 KeyingSet *ks = NULL;
1380 /* call the API func, and set the active keyingset index */
1381 ks = BKE_keyingset_add(&sce->keyingsets, idname, name, KEYINGSET_ABSOLUTE, 0);
1384 sce->active_keyingset = BLI_countlist(&sce->keyingsets);
1388 BKE_report(reports, RPT_ERROR, "Keying set could not be added");
1393 static void rna_UnifiedPaintSettings_size_set(PointerRNA *ptr, int value)
1395 UnifiedPaintSettings *ups = ptr->data;
1397 /* scale unprojected radius so it stays consistent with brush size */
1398 BKE_brush_scale_unprojected_radius(&ups->unprojected_radius,
1403 static void rna_UnifiedPaintSettings_unprojected_radius_set(PointerRNA *ptr, float value)
1405 UnifiedPaintSettings *ups = ptr->data;
1407 /* scale brush size so it stays consistent with unprojected_radius */
1408 BKE_brush_scale_size(&ups->size, value, ups->unprojected_radius);
1409 ups->unprojected_radius = value;
1412 /* note: without this, when Multi-Paint is activated/deactivated, the colors
1413 * will not change right away when multiple bones are selected, this function
1414 * is not for general use and only for the few cases where changing scene
1415 * settings and NOT for general purpose updates, possibly this should be
1416 * given its own notifier. */
1417 static void rna_Scene_update_active_object_data(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
1421 DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
1422 WM_main_add_notifier(NC_OBJECT | ND_DRAW, &ob->id);
1426 static void rna_SceneCamera_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1428 Scene *scene = (Scene *)ptr->id.data;
1429 Object *camera = scene->camera;
1432 DAG_id_tag_update(&camera->id, 0);
1435 static void rna_SceneSequencer_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
1437 BKE_sequencer_cache_cleanup();
1438 BKE_sequencer_preprocessed_cache_cleanup();
1441 static PointerRNA rna_FreestyleLineSet_linestyle_get(PointerRNA *ptr)
1443 FreestyleLineSet *lineset= (FreestyleLineSet *)ptr->data;
1445 return rna_pointer_inherit_refine(ptr, &RNA_FreestyleLineStyle, lineset->linestyle);
1448 static void rna_FreestyleLineSet_linestyle_set(PointerRNA *ptr, PointerRNA value)
1450 FreestyleLineSet *lineset= (FreestyleLineSet*)ptr->data;
1452 lineset->linestyle->id.us--;
1453 lineset->linestyle = (FreestyleLineStyle *)value.data;
1454 lineset->linestyle->id.us++;
1457 static PointerRNA rna_FreestyleSettings_active_lineset_get(PointerRNA *ptr)
1459 FreestyleConfig *config= (FreestyleConfig *)ptr->data;
1460 FreestyleLineSet *lineset= FRS_get_active_lineset(config);
1461 return rna_pointer_inherit_refine(ptr, &RNA_FreestyleLineSet, lineset);
1464 static void rna_FreestyleSettings_active_lineset_index_range(PointerRNA *ptr, int *min, int *max)
1466 FreestyleConfig *config= (FreestyleConfig *)ptr->data;
1468 *max= BLI_countlist(&config->linesets)-1;
1469 *max= MAX2(0, *max);
1472 static int rna_FreestyleSettings_active_lineset_index_get(PointerRNA *ptr)
1474 FreestyleConfig *config= (FreestyleConfig *)ptr->data;
1475 return FRS_get_active_lineset_index(config);
1478 static void rna_FreestyleSettings_active_lineset_index_set(PointerRNA *ptr, int value)
1480 FreestyleConfig *config= (FreestyleConfig *)ptr->data;
1481 FRS_set_active_lineset_index(config, value);
1486 static void rna_def_transform_orientation(BlenderRNA *brna)
1491 const int matrix_dimsize[] = {3, 3};
1493 srna = RNA_def_struct(brna, "TransformOrientation", NULL);
1495 prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
1496 RNA_def_property_float_sdna(prop, NULL, "mat");
1497 RNA_def_property_multi_array(prop, 2, matrix_dimsize);
1498 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
1500 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1501 RNA_def_struct_name_property(srna, prop);
1502 RNA_def_property_ui_text(prop, "Name", "Name of the custom transform orientation");
1503 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
1506 static void rna_def_tool_settings(BlenderRNA *brna)
1511 static EnumPropertyItem uv_select_mode_items[] = {
1512 {UV_SELECT_VERTEX, "VERTEX", ICON_UV_VERTEXSEL, "Vertex", "Vertex selection mode"},
1513 {UV_SELECT_EDGE, "EDGE", ICON_UV_EDGESEL, "Edge", "Edge selection mode"},
1514 {UV_SELECT_FACE, "FACE", ICON_UV_FACESEL, "Face", "Face selection mode"},
1515 {UV_SELECT_ISLAND, "ISLAND", ICON_UV_ISLANDSEL, "Island", "Island selection mode"},
1516 {0, NULL, 0, NULL, NULL}
1519 /* the construction of this enum is quite special - everything is stored as bitflags,
1520 * with 1st position only for for on/off (and exposed as boolean), while others are mutually
1521 * exclusive options but which will only have any effect when autokey is enabled
1523 static EnumPropertyItem auto_key_items[] = {
1524 {AUTOKEY_MODE_NORMAL & ~AUTOKEY_ON, "ADD_REPLACE_KEYS", 0, "Add & Replace", ""},
1525 {AUTOKEY_MODE_EDITKEYS & ~AUTOKEY_ON, "REPLACE_KEYS", 0, "Replace", ""},
1526 {0, NULL, 0, NULL, NULL}
1529 static EnumPropertyItem retarget_roll_items[] = {
1530 {SK_RETARGET_ROLL_NONE, "NONE", 0, "None", "Don't adjust roll"},
1531 {SK_RETARGET_ROLL_VIEW, "VIEW", 0, "View", "Roll bones to face the view"},
1532 {SK_RETARGET_ROLL_JOINT, "JOINT", 0, "Joint", "Roll bone to original joint plane offset"},
1533 {0, NULL, 0, NULL, NULL}
1536 static EnumPropertyItem sketch_convert_items[] = {
1537 {SK_CONVERT_CUT_FIXED, "FIXED", 0, "Fixed", "Subdivide stroke in fixed number of bones"},
1538 {SK_CONVERT_CUT_LENGTH, "LENGTH", 0, "Length", "Subdivide stroke in bones of specific length"},
1539 {SK_CONVERT_CUT_ADAPTATIVE, "ADAPTIVE", 0, "Adaptive",
1540 "Subdivide stroke adaptively, with more subdivision in curvier parts"},
1541 {SK_CONVERT_RETARGET, "RETARGET", 0, "Retarget", "Retarget template bone chain to stroke"},
1542 {0, NULL, 0, NULL, NULL}
1545 static EnumPropertyItem edge_tag_items[] = {
1546 {EDGE_MODE_SELECT, "SELECT", 0, "Select", ""},
1547 {EDGE_MODE_TAG_SEAM, "SEAM", 0, "Tag Seam", ""},
1548 {EDGE_MODE_TAG_SHARP, "SHARP", 0, "Tag Sharp", ""},
1549 {EDGE_MODE_TAG_CREASE, "CREASE", 0, "Tag Crease", ""},
1550 {EDGE_MODE_TAG_BEVEL, "BEVEL", 0, "Tag Bevel", ""},
1551 {EDGE_MODE_TAG_FREESTYLE, "FREESTYLE", 0, "Tag Freestyle Edge Mark", ""},
1552 {0, NULL, 0, NULL, NULL}
1555 srna = RNA_def_struct(brna, "ToolSettings", NULL);
1556 RNA_def_struct_ui_text(srna, "Tool Settings", "");
1558 prop = RNA_def_property(srna, "sculpt", PROP_POINTER, PROP_NONE);
1559 RNA_def_property_struct_type(prop, "Sculpt");
1560 RNA_def_property_ui_text(prop, "Sculpt", "");
1562 prop = RNA_def_property(srna, "use_auto_normalize", PROP_BOOLEAN, PROP_NONE);
1563 RNA_def_property_boolean_sdna(prop, NULL, "auto_normalize", 1);
1564 RNA_def_property_ui_text(prop, "WPaint Auto-Normalize",
1565 "Ensure all bone-deforming vertex groups add up "
1566 "to 1.0 while weight painting");
1567 RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data");
1569 prop = RNA_def_property(srna, "use_multipaint", PROP_BOOLEAN, PROP_NONE);
1570 RNA_def_property_boolean_sdna(prop, NULL, "multipaint", 1);
1571 RNA_def_property_ui_text(prop, "WPaint Multi-Paint",
1572 "Paint across all selected bones while "
1574 RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data");
1576 prop = RNA_def_property(srna, "vertex_paint", PROP_POINTER, PROP_NONE);
1577 RNA_def_property_pointer_sdna(prop, NULL, "vpaint");
1578 RNA_def_property_ui_text(prop, "Vertex Paint", "");
1580 prop = RNA_def_property(srna, "weight_paint", PROP_POINTER, PROP_NONE);
1581 RNA_def_property_pointer_sdna(prop, NULL, "wpaint");
1582 RNA_def_property_ui_text(prop, "Weight Paint", "");
1584 prop = RNA_def_property(srna, "image_paint", PROP_POINTER, PROP_NONE);
1585 RNA_def_property_pointer_sdna(prop, NULL, "imapaint");
1586 RNA_def_property_ui_text(prop, "Image Paint", "");
1588 prop = RNA_def_property(srna, "uv_sculpt", PROP_POINTER, PROP_NONE);
1589 RNA_def_property_pointer_sdna(prop, NULL, "uvsculpt");
1590 RNA_def_property_ui_text(prop, "UV Sculpt", "");
1592 prop = RNA_def_property(srna, "particle_edit", PROP_POINTER, PROP_NONE);
1593 RNA_def_property_pointer_sdna(prop, NULL, "particle");
1594 RNA_def_property_ui_text(prop, "Particle Edit", "");
1596 prop = RNA_def_property(srna, "use_uv_sculpt", PROP_BOOLEAN, PROP_NONE);
1597 RNA_def_property_boolean_sdna(prop, NULL, "use_uv_sculpt", 1);
1598 RNA_def_property_ui_text(prop, "UV Sculpt", "Enable brush for UV sculpting");
1599 RNA_def_property_ui_icon(prop, ICON_TPAINT_HLT, 0);
1600 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, "rna_SpaceImageEditor_uv_sculpt_update");
1602 prop = RNA_def_property(srna, "uv_sculpt_lock_borders", PROP_BOOLEAN, PROP_NONE);
1603 RNA_def_property_boolean_sdna(prop, NULL, "uv_sculpt_settings", UV_SCULPT_LOCK_BORDERS);
1604 RNA_def_property_ui_text(prop, "Lock Borders", "Disable editing of boundary edges");
1606 prop = RNA_def_property(srna, "uv_sculpt_all_islands", PROP_BOOLEAN, PROP_NONE);
1607 RNA_def_property_boolean_sdna(prop, NULL, "uv_sculpt_settings", UV_SCULPT_ALL_ISLANDS);
1608 RNA_def_property_ui_text(prop, "Sculpt All Islands", "Brush operates on all islands");
1610 prop = RNA_def_property(srna, "uv_sculpt_tool", PROP_ENUM, PROP_NONE);
1611 RNA_def_property_enum_sdna(prop, NULL, "uv_sculpt_tool");
1612 RNA_def_property_enum_items(prop, uv_sculpt_tool_items);
1613 RNA_def_property_ui_text(prop, "UV Sculpt Tools", "Select Tools for the UV sculpt brushes");
1615 prop = RNA_def_property(srna, "uv_relax_method", PROP_ENUM, PROP_NONE);
1616 RNA_def_property_enum_sdna(prop, NULL, "uv_relax_method");
1617 RNA_def_property_enum_items(prop, uv_sculpt_relaxation_items);
1618 RNA_def_property_ui_text(prop, "Relaxation Method", "Algorithm used for UV relaxation");
1621 prop = RNA_def_property(srna, "proportional_edit", PROP_ENUM, PROP_NONE);
1622 RNA_def_property_enum_sdna(prop, NULL, "proportional");
1623 RNA_def_property_enum_items(prop, proportional_editing_items);
1624 RNA_def_property_ui_text(prop, "Proportional Editing",
1625 "Proportional Editing mode, allows transforms with distance fall-off");
1626 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1628 prop = RNA_def_property(srna, "use_proportional_edit_objects", PROP_BOOLEAN, PROP_NONE);
1629 RNA_def_property_boolean_sdna(prop, NULL, "proportional_objects", 0);
1630 RNA_def_property_ui_text(prop, "Proportional Editing Objects", "Proportional editing object 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, "use_proportional_edit_mask", PROP_BOOLEAN, PROP_NONE);
1635 RNA_def_property_boolean_sdna(prop, NULL, "proportional_mask", 0);
1636 RNA_def_property_ui_text(prop, "Proportional Editing Objects", "Proportional editing mask mode");
1637 RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1);
1638 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1640 prop = RNA_def_property(srna, "proportional_edit_falloff", PROP_ENUM, PROP_NONE);
1641 RNA_def_property_enum_sdna(prop, NULL, "prop_mode");
1642 RNA_def_property_enum_items(prop, proportional_falloff_items);
1643 RNA_def_property_ui_text(prop, "Proportional Editing Falloff", "Falloff type for proportional editing mode");
1644 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1646 prop = RNA_def_property(srna, "proportional_size", PROP_FLOAT, PROP_DISTANCE);
1647 RNA_def_property_float_sdna(prop, NULL, "proportional_size");
1648 RNA_def_property_ui_text(prop, "Proportional Size", "Display size for proportional editing circle");
1649 RNA_def_property_range(prop, 0.00001, 5000.0);
1651 prop = RNA_def_property(srna, "normal_size", PROP_FLOAT, PROP_DISTANCE);
1652 RNA_def_property_float_sdna(prop, NULL, "normalsize");
1653 RNA_def_property_ui_text(prop, "Normal Size", "Display size for normals in the 3D view");
1654 RNA_def_property_range(prop, 0.00001, 1000.0);
1655 RNA_def_property_ui_range(prop, 0.01, 10.0, 10.0, 2);
1656 RNA_def_property_update(prop, NC_GEOM | ND_DATA, NULL);
1658 prop = RNA_def_property(srna, "double_threshold", PROP_FLOAT, PROP_DISTANCE);
1659 RNA_def_property_float_sdna(prop, NULL, "doublimit");
1660 RNA_def_property_ui_text(prop, "Double Threshold", "Limit for removing duplicates and 'Auto Merge'");
1661 RNA_def_property_range(prop, 0.0, 1.0);
1662 RNA_def_property_ui_range(prop, 0.0, 0.1, 0.01, 6);
1664 prop = RNA_def_property(srna, "use_mesh_automerge", PROP_BOOLEAN, PROP_NONE);
1665 RNA_def_property_boolean_sdna(prop, NULL, "automerge", 0);
1666 RNA_def_property_ui_text(prop, "AutoMerge Editing", "Automatically merge vertices moved to the same location");
1668 prop = RNA_def_property(srna, "use_snap", PROP_BOOLEAN, PROP_NONE);
1669 RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP);
1670 RNA_def_property_ui_text(prop, "Snap", "Snap during transform");
1671 RNA_def_property_ui_icon(prop, ICON_SNAP_OFF, 1);
1672 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1674 prop = RNA_def_property(srna, "use_snap_align_rotation", PROP_BOOLEAN, PROP_NONE);
1675 RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_ROTATE);
1676 RNA_def_property_ui_text(prop, "Snap Align Rotation", "Align rotation with the snapping target");
1677 RNA_def_property_ui_icon(prop, ICON_SNAP_NORMAL, 0);
1678 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1680 prop = RNA_def_property(srna, "snap_element", PROP_ENUM, PROP_NONE);
1681 RNA_def_property_enum_sdna(prop, NULL, "snap_mode");
1682 RNA_def_property_enum_items(prop, snap_element_items);
1683 RNA_def_property_ui_text(prop, "Snap Element", "Type of element to snap to");
1684 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1686 /* node editor uses own set of snap modes */
1687 prop = RNA_def_property(srna, "snap_node_element", PROP_ENUM, PROP_NONE);
1688 RNA_def_property_enum_sdna(prop, NULL, "snap_node_mode");
1689 RNA_def_property_enum_items(prop, snap_node_element_items);
1690 RNA_def_property_ui_text(prop, "Snap Node Element", "Type of element to snap to");
1691 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1693 prop = RNA_def_property(srna, "snap_target", PROP_ENUM, PROP_NONE);
1694 RNA_def_property_enum_sdna(prop, NULL, "snap_target");
1695 RNA_def_property_enum_items(prop, snap_target_items);
1696 RNA_def_property_ui_text(prop, "Snap Target", "Which part to snap onto the target");
1697 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1699 prop = RNA_def_property(srna, "use_snap_peel_object", PROP_BOOLEAN, PROP_NONE);
1700 RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_PEEL_OBJECT);
1701 RNA_def_property_ui_text(prop, "Snap Peel Object", "Consider objects as whole when finding volume center");
1702 RNA_def_property_ui_icon(prop, ICON_SNAP_PEEL_OBJECT, 0);
1703 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1705 prop = RNA_def_property(srna, "use_snap_project", PROP_BOOLEAN, PROP_NONE);
1706 RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_PROJECT);
1707 RNA_def_property_ui_text(prop, "Project Individual Elements",
1708 "Project individual elements on the surface of other objects");
1709 RNA_def_property_ui_icon(prop, ICON_RETOPO, 0);
1710 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1712 prop = RNA_def_property(srna, "use_snap_self", PROP_BOOLEAN, PROP_NONE);
1713 RNA_def_property_boolean_negative_sdna(prop, NULL, "snap_flag", SCE_SNAP_NO_SELF);
1714 RNA_def_property_ui_text(prop, "Project to Self", "Snap onto itself (editmode)");
1715 RNA_def_property_ui_icon(prop, ICON_ORTHO, 0);
1716 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1719 prop = RNA_def_property(srna, "use_grease_pencil_sessions", PROP_BOOLEAN, PROP_NONE);
1720 RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_PAINTSESSIONS_ON);
1721 RNA_def_property_ui_text(prop, "Use Sketching Sessions",
1722 "Allow drawing multiple strokes at a time with Grease Pencil");
1723 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* xxx: need toolbar to be redrawn... */
1726 prop = RNA_def_property(srna, "use_keyframe_insert_auto", PROP_BOOLEAN, PROP_NONE);
1727 RNA_def_property_boolean_sdna(prop, NULL, "autokey_mode", AUTOKEY_ON);
1728 RNA_def_property_ui_text(prop, "Auto Keying", "Automatic keyframe insertion for Objects and Bones");
1729 RNA_def_property_ui_icon(prop, ICON_REC, 0);
1731 prop = RNA_def_property(srna, "auto_keying_mode", PROP_ENUM, PROP_NONE);
1732 RNA_def_property_enum_bitflag_sdna(prop, NULL, "autokey_mode");
1733 RNA_def_property_enum_items(prop, auto_key_items);
1734 RNA_def_property_ui_text(prop, "Auto-Keying Mode", "Mode of automatic keyframe insertion for Objects and Bones");
1736 prop = RNA_def_property(srna, "use_record_with_nla", PROP_BOOLEAN, PROP_NONE);
1737 RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", ANIMRECORD_FLAG_WITHNLA);
1738 RNA_def_property_ui_text(prop, "Layered",
1739 "Add a new NLA Track + Strip for every loop/pass made over the animation "
1740 "to allow non-destructive tweaking");
1742 prop = RNA_def_property(srna, "use_keyframe_insert_keyingset", PROP_BOOLEAN, PROP_NONE);
1743 RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_ONLYKEYINGSET);
1744 RNA_def_property_ui_text(prop, "Auto Keyframe Insert Keying Set",
1745 "Automatic keyframe insertion using active Keying Set only");
1746 RNA_def_property_ui_icon(prop, ICON_KEYINGSET, 0);
1749 prop = RNA_def_property(srna, "uv_select_mode", PROP_ENUM, PROP_NONE);
1750 RNA_def_property_enum_sdna(prop, NULL, "uv_selectmode");
1751 RNA_def_property_enum_items(prop, uv_select_mode_items);
1752 RNA_def_property_ui_text(prop, "UV Selection Mode", "UV selection and display mode");
1753 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
1755 prop = RNA_def_property(srna, "use_uv_select_sync", PROP_BOOLEAN, PROP_NONE);
1756 RNA_def_property_boolean_sdna(prop, NULL, "uv_flag", UV_SYNC_SELECTION);
1757 RNA_def_property_ui_text(prop, "UV Sync Selection", "Keep UV and edit mode mesh selection in sync");
1758 RNA_def_property_ui_icon(prop, ICON_EDIT, 0);
1759 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
1761 prop = RNA_def_property(srna, "show_uv_local_view", PROP_BOOLEAN, PROP_NONE);
1762 RNA_def_property_boolean_sdna(prop, NULL, "uv_flag", UV_SHOW_SAME_IMAGE);
1763 RNA_def_property_ui_text(prop, "UV Local View", "Draw only faces with the currently displayed image assigned");
1764 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
1767 prop = RNA_def_property(srna, "mesh_select_mode", PROP_BOOLEAN, PROP_NONE);
1768 RNA_def_property_boolean_sdna(prop, NULL, "selectmode", 1);
1769 RNA_def_property_array(prop, 3);
1770 RNA_def_property_boolean_funcs(prop, NULL, "rna_Scene_editmesh_select_mode_set");
1771 RNA_def_property_ui_text(prop, "Mesh Selection Mode", "Which mesh elements selection works on");
1772 RNA_def_property_update(prop, 0, "rna_Scene_editmesh_select_mode_update");
1774 prop = RNA_def_property(srna, "vertex_group_weight", PROP_FLOAT, PROP_FACTOR);
1775 RNA_def_property_float_sdna(prop, NULL, "vgroup_weight");
1776 RNA_def_property_ui_text(prop, "Vertex Group Weight", "Weight to assign in vertex groups");
1778 /* use with MESH_OT_select_shortest_path */
1779 prop = RNA_def_property(srna, "edge_path_mode", PROP_ENUM, PROP_NONE);
1780 RNA_def_property_enum_sdna(prop, NULL, "edge_mode");
1781 RNA_def_property_enum_items(prop, edge_tag_items);
1782 RNA_def_property_ui_text(prop, "Edge Tag Mode", "The edge flag to tag when selecting the shortest path");
1784 prop = RNA_def_property(srna, "edge_path_live_unwrap", PROP_BOOLEAN, PROP_NONE);
1785 RNA_def_property_boolean_sdna(prop, NULL, "edge_mode_live_unwrap", 1);
1786 RNA_def_property_ui_text(prop, "Live Unwrap", "Changing edges seam re-calculates UV unwrap");
1789 prop = RNA_def_property(srna, "use_bone_sketching", PROP_BOOLEAN, PROP_NONE);
1790 RNA_def_property_boolean_sdna(prop, NULL, "bone_sketching", BONE_SKETCHING);
1791 RNA_def_property_ui_text(prop, "Use Bone Sketching", "DOC BROKEN");
1792 /* RNA_def_property_ui_icon(prop, ICON_EDIT, 0); */
1794 prop = RNA_def_property(srna, "use_etch_quick", PROP_BOOLEAN, PROP_NONE);
1795 RNA_def_property_boolean_sdna(prop, NULL, "bone_sketching", BONE_SKETCHING_QUICK);
1796 RNA_def_property_ui_text(prop, "Quick Sketching", "DOC BROKEN");
1798 prop = RNA_def_property(srna, "use_etch_overdraw", PROP_BOOLEAN, PROP_NONE);
1799 RNA_def_property_boolean_sdna(prop, NULL, "bone_sketching", BONE_SKETCHING_ADJUST);
1800 RNA_def_property_ui_text(prop, "Overdraw Sketching", "DOC BROKEN");
1802 prop = RNA_def_property(srna, "use_etch_autoname", PROP_BOOLEAN, PROP_NONE);
1803 RNA_def_property_boolean_sdna(prop, NULL, "skgen_retarget_options", SK_RETARGET_AUTONAME);
1804 RNA_def_property_ui_text(prop, "Autoname", "DOC BROKEN");
1806 prop = RNA_def_property(srna, "etch_number", PROP_STRING, PROP_NONE);
1807 RNA_def_property_string_sdna(prop, NULL, "skgen_num_string");
1808 RNA_def_property_ui_text(prop, "Number", "DOC BROKEN");
1810 prop = RNA_def_property(srna, "etch_side", PROP_STRING, PROP_NONE);
1811 RNA_def_property_string_sdna(prop, NULL, "skgen_num_string");
1812 RNA_def_property_ui_text(prop, "Side", "DOC BROKEN");
1814 prop = RNA_def_property(srna, "etch_template", PROP_POINTER, PROP_NONE);
1815 RNA_def_property_pointer_sdna(prop, NULL, "skgen_template");
1816 RNA_def_property_flag(prop, PROP_EDITABLE);
1817 RNA_def_property_struct_type(prop, "Object");
1818 RNA_def_property_pointer_funcs(prop, NULL, "rna_Scene_skgen_etch_template_set", NULL, NULL);
1819 RNA_def_property_ui_text(prop, "Template", "Template armature that will be retargeted to the stroke");
1821 prop = RNA_def_property(srna, "etch_subdivision_number", PROP_INT, PROP_NONE);
1822 RNA_def_property_int_sdna(prop, NULL, "skgen_subdivision_number");
1823 RNA_def_property_range(prop, 1, 255);
1824 RNA_def_property_ui_text(prop, "Subdivisions", "Number of bones in the subdivided stroke");
1825 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
1827 prop = RNA_def_property(srna, "etch_adaptive_limit", PROP_FLOAT, PROP_FACTOR);
1828 RNA_def_property_float_sdna(prop, NULL, "skgen_correlation_limit");
1829 RNA_def_property_range(prop, 0.00001, 1.0);
1830 RNA_def_property_ui_range(prop, 0.01, 1.0, 0.01, 2);
1831 RNA_def_property_ui_text(prop, "Limit", "Number of bones in the subdivided stroke");
1832 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
1834 prop = RNA_def_property(srna, "etch_length_limit", PROP_FLOAT, PROP_DISTANCE);
1835 RNA_def_property_float_sdna(prop, NULL, "skgen_length_limit");
1836 RNA_def_property_range(prop, 0.00001, 100000.0);
1837 RNA_def_property_ui_range(prop, 0.001, 100.0, 0.1, 3);
1838 RNA_def_property_ui_text(prop, "Length", "Number of bones in the subdivided stroke");
1839 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
1841 prop = RNA_def_property(srna, "etch_roll_mode", PROP_ENUM, PROP_NONE);
1842 RNA_def_property_enum_bitflag_sdna(prop, NULL, "skgen_retarget_roll");
1843 RNA_def_property_enum_items(prop, retarget_roll_items);
1844 RNA_def_property_ui_text(prop, "Retarget roll mode", "Method used to adjust the roll of bones when retargeting");
1846 prop = RNA_def_property(srna, "etch_convert_mode", PROP_ENUM, PROP_NONE);
1847 RNA_def_property_enum_bitflag_sdna(prop, NULL, "bone_sketching_convert");
1848 RNA_def_property_enum_items(prop, sketch_convert_items);
1849 RNA_def_property_ui_text(prop, "Stroke conversion method", "Method used to convert stroke to bones");
1850 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
1852 /* Unified Paint Settings */
1853 prop = RNA_def_property(srna, "unified_paint_settings", PROP_POINTER, PROP_NONE);
1854 RNA_def_property_flag(prop, PROP_NEVER_NULL);
1855 RNA_def_property_struct_type(prop, "UnifiedPaintSettings");
1856 RNA_def_property_ui_text(prop, "Unified Paint Settings", NULL);
1859 static void rna_def_unified_paint_settings(BlenderRNA *brna)
1864 srna = RNA_def_struct(brna, "UnifiedPaintSettings", NULL);
1865 RNA_def_struct_ui_text(srna, "Unified Paint Settings", "Overrides for some of the active brush's settings");
1867 /* high-level flags to enable or disable unified paint settings */
1868 prop = RNA_def_property(srna, "use_unified_size", PROP_BOOLEAN, PROP_NONE);
1869 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_SIZE);
1870 RNA_def_property_ui_text(prop, "Use Unified Radius",
1871 "Instead of per-brush radius, the radius is shared across brushes");
1873 prop = RNA_def_property(srna, "use_unified_strength", PROP_BOOLEAN, PROP_NONE);
1874 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_ALPHA);
1875 RNA_def_property_ui_text(prop, "Use Unified Strength",
1876 "Instead of per-brush strength, the strength is shared across brushes");
1878 prop = RNA_def_property(srna, "use_unified_weight", PROP_BOOLEAN, PROP_NONE);
1879 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_WEIGHT);
1880 RNA_def_property_ui_text(prop, "Use Unified Weight",
1881 "Instead of per-brush weight, the weight is shared across brushes");
1883 /* unified paint settings that override the equivalent settings
1884 * from the active brush */
1885 prop = RNA_def_property(srna, "size", PROP_INT, PROP_DISTANCE);
1886 RNA_def_property_int_funcs(prop, NULL, "rna_UnifiedPaintSettings_size_set", NULL);
1887 RNA_def_property_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS * 10);
1888 RNA_def_property_ui_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS, 1, 0);
1889 RNA_def_property_ui_text(prop, "Radius", "Radius of the brush in pixels");
1891 prop = RNA_def_property(srna, "unprojected_radius", PROP_FLOAT, PROP_DISTANCE);
1892 RNA_def_property_float_funcs(prop, NULL, "rna_UnifiedPaintSettings_unprojected_radius_set", NULL);
1893 RNA_def_property_range(prop, 0.001, FLT_MAX);
1894 RNA_def_property_ui_range(prop, 0.001, 1, 0, 0);
1895 RNA_def_property_ui_text(prop, "Unprojected Radius", "Radius of brush in Blender units");
1897 prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
1898 RNA_def_property_float_sdna(prop, NULL, "alpha");
1899 RNA_def_property_float_default(prop, 0.5f);
1900 RNA_def_property_range(prop, 0.0f, 10.0f);
1901 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
1902 RNA_def_property_ui_text(prop, "Strength", "How powerful the effect of the brush is when applied");
1904 prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_FACTOR);
1905 RNA_def_property_float_sdna(prop, NULL, "weight");
1906 RNA_def_property_float_default(prop, 0.5f);
1907 RNA_def_property_range(prop, 0.0f, 1.0f);
1908 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
1909 RNA_def_property_ui_text(prop, "Weight", "Weight to assign in vertex groups");
1911 prop = RNA_def_property(srna, "use_pressure_size", PROP_BOOLEAN, PROP_NONE);
1912 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_BRUSH_SIZE_PRESSURE);
1913 RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
1914 RNA_def_property_ui_text(prop, "Size Pressure", "Enable tablet pressure sensitivity for size");
1916 prop = RNA_def_property(srna, "use_pressure_strength", PROP_BOOLEAN, PROP_NONE);
1917 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_BRUSH_ALPHA_PRESSURE);
1918 RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
1919 RNA_def_property_ui_text(prop, "Strength Pressure", "Enable tablet pressure sensitivity for strength");
1921 prop = RNA_def_property(srna, "use_locked_size", PROP_BOOLEAN, PROP_NONE);
1922 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_BRUSH_LOCK_SIZE);
1923 RNA_def_property_ui_text(prop, "Use Blender Units",
1924 "When locked brush stays same size relative to object; "
1925 "when unlocked brush size is given in pixels");
1928 static void rna_def_unit_settings(BlenderRNA *brna)
1933 static EnumPropertyItem unit_systems[] = {
1934 {USER_UNIT_NONE, "NONE", 0, "None", ""},
1935 {USER_UNIT_METRIC, "METRIC", 0, "Metric", ""},
1936 {USER_UNIT_IMPERIAL, "IMPERIAL", 0, "Imperial", ""},
1937 {0, NULL, 0, NULL, NULL}
1940 static EnumPropertyItem rotation_units[] = {
1941 {0, "DEGREES", 0, "Degrees", "Use degrees for measuring angles and rotations"},
1942 {USER_UNIT_ROT_RADIANS, "RADIANS", 0, "Radians", ""},
1943 {0, NULL, 0, NULL, NULL}
1946 srna = RNA_def_struct(brna, "UnitSettings", NULL);
1947 RNA_def_struct_ui_text(srna, "Unit Settings", "");
1950 prop = RNA_def_property(srna, "system", PROP_ENUM, PROP_NONE);
1951 RNA_def_property_enum_items(prop, unit_systems);
1952 RNA_def_property_ui_text(prop, "Unit System", "The unit system to use for button display");
1953 RNA_def_property_update(prop, NC_WINDOW, NULL);
1955 prop = RNA_def_property(srna, "system_rotation", PROP_ENUM, PROP_NONE);
1956 RNA_def_property_enum_items(prop, rotation_units);
1957 RNA_def_property_ui_text(prop, "Rotation Units", "Unit to use for displaying/editing rotation values");
1958 RNA_def_property_update(prop, NC_WINDOW, NULL);
1960 prop = RNA_def_property(srna, "scale_length", PROP_FLOAT, PROP_UNSIGNED);
1961 RNA_def_property_ui_text(prop, "Unit Scale", "Scale to use when converting between blender units and dimensions");
1962 RNA_def_property_range(prop, 0.00001, 100000.0);
1963 RNA_def_property_ui_range(prop, 0.001, 100.0, 0.1, 3);
1964 RNA_def_property_update(prop, NC_WINDOW, NULL);
1966 prop = RNA_def_property(srna, "use_separate", PROP_BOOLEAN, PROP_NONE);
1967 RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_UNIT_OPT_SPLIT);
1968 RNA_def_property_ui_text(prop, "Separate Units", "Display units in pairs (e.g. 1m 0cm)");
1969 RNA_def_property_update(prop, NC_WINDOW, NULL);
1972 void rna_def_render_layer_common(StructRNA *srna, int scene)
1976 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1977 if (scene) RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SceneRenderLayer_name_set");
1978 else RNA_def_property_string_sdna(prop, NULL, "name");
1979 RNA_def_property_ui_text(prop, "Name", "Render layer name");
1980 RNA_def_struct_name_property(srna, prop);
1981 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
1982 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1984 prop = RNA_def_property(srna, "material_override", PROP_POINTER, PROP_NONE);
1985 RNA_def_property_pointer_sdna(prop, NULL, "mat_override");
1986 RNA_def_property_struct_type(prop, "Material");
1987 RNA_def_property_flag(prop, PROP_EDITABLE);
1988 RNA_def_property_ui_text(prop, "Material Override",
1989 "Material to override all other materials in this render layer");
1990 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
1991 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1993 prop = RNA_def_property(srna, "light_override", PROP_POINTER, PROP_NONE);
1994 RNA_def_property_pointer_sdna(prop, NULL, "light_override");
1995 RNA_def_property_struct_type(prop, "Group");
1996 RNA_def_property_flag(prop, PROP_EDITABLE);
1997 RNA_def_property_ui_text(prop, "Light Override", "Group to override all other lights in this render layer");
1998 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
1999 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2002 prop = RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
2003 RNA_def_property_boolean_sdna(prop, NULL, "lay", 1);
2004 RNA_def_property_array(prop, 20);
2005 RNA_def_property_ui_text(prop, "Visible Layers", "Scene layers included in this render layer");
2006 if (scene) RNA_def_property_boolean_funcs(prop, NULL, "rna_SceneRenderLayer_layer_set");
2007 else RNA_def_property_boolean_funcs(prop, NULL, "rna_RenderLayer_layer_set");
2008 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
2009 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2011 prop = RNA_def_property(srna, "layers_zmask", PROP_BOOLEAN, PROP_LAYER);
2012 RNA_def_property_boolean_sdna(prop, NULL, "lay_zmask", 1);
2013 RNA_def_property_array(prop, 20);
2014 RNA_def_property_ui_text(prop, "Zmask Layers", "Zmask scene layers for solid faces");
2015 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
2016 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2018 prop = RNA_def_property(srna, "layers_exclude", PROP_BOOLEAN, PROP_LAYER);
2019 RNA_def_property_boolean_sdna(prop, NULL, "lay_exclude", 1);
2020 RNA_def_property_array(prop, 20);
2021 RNA_def_property_ui_text(prop, "Exclude Layers", "Exclude scene layers from having any influence");
2022 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
2023 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2026 prop = RNA_def_property(srna, "samples", PROP_INT, PROP_UNSIGNED);
2027 RNA_def_property_ui_text(prop, "Samples", "Override number of render samples for this render layer, 0 will use the scene setting");
2028 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2032 prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
2033 RNA_def_property_boolean_negative_sdna(prop, NULL, "layflag", SCE_LAY_DISABLE);
2034 RNA_def_property_ui_text(prop, "Enabled", "Disable or enable the render layer");
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, "use_zmask", PROP_BOOLEAN, PROP_NONE);
2039 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ZMASK);
2040 RNA_def_property_ui_text(prop, "Zmask", "Only render what's in front of the solid z values");
2041 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
2042 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2044 prop = RNA_def_property(srna, "invert_zmask", PROP_BOOLEAN, PROP_NONE);
2045 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_NEG_ZMASK);
2046 RNA_def_property_ui_text(prop, "Zmask Negate",
2047 "For Zmask, only render what is behind solid z values instead of in front");
2048 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
2049 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2051 prop = RNA_def_property(srna, "use_all_z", PROP_BOOLEAN, PROP_NONE);
2052 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ALL_Z);
2053 RNA_def_property_ui_text(prop, "All Z", "Fill in Z values for solid faces in invisible layers, for masking");
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_solid", PROP_BOOLEAN, PROP_NONE);
2058 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_SOLID);
2059 RNA_def_property_ui_text(prop, "Solid", "Render Solid faces in this Layer");
2060 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2061 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2063 prop = RNA_def_property(srna, "use_halo", PROP_BOOLEAN, PROP_NONE);
2064 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_HALO);
2065 RNA_def_property_ui_text(prop, "Halo", "Render Halos in this Layer (on top of Solid)");
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_ztransp", PROP_BOOLEAN, PROP_NONE);
2070 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ZTRA);
2071 RNA_def_property_ui_text(prop, "ZTransp", "Render Z-Transparent faces in this Layer (on top of Solid and Halos)");
2072 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2073 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2075 prop = RNA_def_property(srna, "use_sky", PROP_BOOLEAN, PROP_NONE);
2076 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_SKY);
2077 RNA_def_property_ui_text(prop, "Sky", "Render Sky in this Layer");
2078 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
2079 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2081 prop = RNA_def_property(srna, "use_edge_enhance", PROP_BOOLEAN, PROP_NONE);
2082 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_EDGE);
2083 RNA_def_property_ui_text(prop, "Edge", "Render Edge-enhance in this Layer (only works for Solid faces)");
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_strand", PROP_BOOLEAN, PROP_NONE);
2088 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_STRAND);
2089 RNA_def_property_ui_text(prop, "Strand", "Render Strands 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);
2093 prop= RNA_def_property(srna, "use_freestyle", PROP_BOOLEAN, PROP_NONE);
2094 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_FRS);
2095 RNA_def_property_ui_text(prop, "Freestyle", "Render stylized strokes in this Layer");
2096 if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
2097 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2100 prop = RNA_def_property(srna, "use_pass_combined", PROP_BOOLEAN, PROP_NONE);
2101 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_COMBINED);
2102 RNA_def_property_ui_text(prop, "Combined", "Deliver full combined RGBA buffer");
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_z", PROP_BOOLEAN, PROP_NONE);
2107 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_Z);
2108 RNA_def_property_ui_text(prop, "Z", "Deliver Z values 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_vector", PROP_BOOLEAN, PROP_NONE);
2113 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_VECTOR);
2114 RNA_def_property_ui_text(prop, "Vector", "Deliver speed vector 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_normal", PROP_BOOLEAN, PROP_NONE);
2119 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_NORMAL);
2120 RNA_def_property_ui_text(prop, "Normal", "Deliver normal 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_uv", PROP_BOOLEAN, PROP_NONE);
2125 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_UV);
2126 RNA_def_property_ui_text(prop, "UV", "Deliver texture UV pass");
2127 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2128 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2130 prop = RNA_def_property(srna, "use_pass_mist", PROP_BOOLEAN, PROP_NONE);
2131 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_MIST);
2132 RNA_def_property_ui_text(prop, "Mist", "Deliver mist factor pass (0.0-1.0)");
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_object_index", PROP_BOOLEAN, PROP_NONE);
2137 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_INDEXOB);
2138 RNA_def_property_ui_text(prop, "Object Index", "Deliver object 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_material_index", PROP_BOOLEAN, PROP_NONE);
2143 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_INDEXMA);
2144 RNA_def_property_ui_text(prop, "Material Index", "Deliver material index 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_color", PROP_BOOLEAN, PROP_NONE);
2149 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_RGBA);
2150 RNA_def_property_ui_text(prop, "Color", "Deliver shade-less color 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_diffuse", PROP_BOOLEAN, PROP_NONE);
2155 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE);
2156 RNA_def_property_ui_text(prop, "Diffuse", "Deliver diffuse 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_specular", PROP_BOOLEAN, PROP_NONE);
2161 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SPEC);
2162 RNA_def_property_ui_text(prop, "Specular", "Deliver specular 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_shadow", PROP_BOOLEAN, PROP_NONE);
2167 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SHADOW);
2168 RNA_def_property_ui_text(prop, "Shadow", "Deliver shadow 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_ambient_occlusion", PROP_BOOLEAN, PROP_NONE);
2173 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_AO);
2174 RNA_def_property_ui_text(prop, "AO", "Deliver AO 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_reflection", PROP_BOOLEAN, PROP_NONE);
2179 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_REFLECT);
2180 RNA_def_property_ui_text(prop, "Reflection", "Deliver raytraced reflection 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_refraction", PROP_BOOLEAN, PROP_NONE);
2185 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_REFRACT);
2186 RNA_def_property_ui_text(prop, "Refraction", "Deliver raytraced refraction 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_emit", PROP_BOOLEAN, PROP_NONE);
2191 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_EMIT);
2192 RNA_def_property_ui_text(prop, "Emit", "Deliver emission 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_environment", PROP_BOOLEAN, PROP_NONE);
2197 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_ENVIRONMENT);
2198 RNA_def_property_ui_text(prop, "Environment", "Deliver environment 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, "use_pass_indirect", PROP_BOOLEAN, PROP_NONE);
2203 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_INDIRECT);
2204 RNA_def_property_ui_text(prop, "Indirect", "Deliver indirect lighting pass");
2205 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2206 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2208 prop = RNA_def_property(srna, "exclude_specular", PROP_BOOLEAN, PROP_NONE);
2209 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_SPEC);
2210 RNA_def_property_ui_text(prop, "Specular Exclude", "Exclude specular pass from combined");
2211 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2212 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2213 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2215 prop = RNA_def_property(srna, "exclude_shadow", PROP_BOOLEAN, PROP_NONE);
2216 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_SHADOW);
2217 RNA_def_property_ui_text(prop, "Shadow Exclude", "Exclude shadow pass from combined");
2218 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2219 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2220 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2222 prop = RNA_def_property(srna, "exclude_ambient_occlusion", PROP_BOOLEAN, PROP_NONE);
2223 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_AO);
2224 RNA_def_property_ui_text(prop, "AO Exclude", "Exclude AO pass from combined");
2225 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2226 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2227 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2229 prop = RNA_def_property(srna, "exclude_reflection", PROP_BOOLEAN, PROP_NONE);
2230 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_REFLECT);
2231 RNA_def_property_ui_text(prop, "Reflection Exclude", "Exclude raytraced reflection pass from combined");
2232 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2233 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2234 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2236 prop = RNA_def_property(srna, "exclude_refraction", PROP_BOOLEAN, PROP_NONE);
2237 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_REFRACT);
2238 RNA_def_property_ui_text(prop, "Refraction Exclude", "Exclude raytraced refraction pass from combined");
2239 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2240 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2241 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2243 prop = RNA_def_property(srna, "exclude_emit", PROP_BOOLEAN, PROP_NONE);
2244 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_EMIT);
2245 RNA_def_property_ui_text(prop, "Emit Exclude", "Exclude emission pass from combined");
2246 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2247 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2248 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2250 prop = RNA_def_property(srna, "exclude_environment", PROP_BOOLEAN, PROP_NONE);
2251 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_ENVIRONMENT);
2252 RNA_def_property_ui_text(prop, "Environment Exclude", "Exclude environment pass from combined");
2253 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2254 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2255 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2257 prop = RNA_def_property(srna, "exclude_indirect", PROP_BOOLEAN, PROP_NONE);
2258 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_INDIRECT);
2259 RNA_def_property_ui_text(prop, "Indirect Exclude", "Exclude indirect pass from combined");
2260 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
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_direct", PROP_BOOLEAN, PROP_NONE);
2265 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE_DIRECT);
2266 RNA_def_property_ui_text(prop, "Diffuse Direct", "Deliver diffuse direct pass");
2267 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2268 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2270 prop = RNA_def_property(srna, "use_pass_diffuse_indirect", PROP_BOOLEAN, PROP_NONE);
2271 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE_INDIRECT);
2272 RNA_def_property_ui_text(prop, "Diffuse Indirect", "Deliver diffuse indirect pass");
2273 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2274 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2276 prop = RNA_def_property(srna, "use_pass_diffuse_color", PROP_BOOLEAN, PROP_NONE);
2277 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE_COLOR);
2278 RNA_def_property_ui_text(prop, "Diffuse Color", "Deliver diffuse color pass");
2279 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2280 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2282 prop = RNA_def_property(srna, "use_pass_glossy_direct", PROP_BOOLEAN, PROP_NONE);
2283 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_GLOSSY_DIRECT);
2284 RNA_def_property_ui_text(prop, "Glossy Direct", "Deliver glossy direct 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_indirect", PROP_BOOLEAN, PROP_NONE);
2289 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_GLOSSY_INDIRECT);
2290 RNA_def_property_ui_text(prop, "Glossy Indirect", "Deliver glossy indirect 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_glossy_color", PROP_BOOLEAN, PROP_NONE);
2295 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_GLOSSY_COLOR);
2296 RNA_def_property_ui_text(prop, "Glossy Color", "Deliver glossy color 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_direct", PROP_BOOLEAN, PROP_NONE);
2301 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_TRANSM_DIRECT);
2302 RNA_def_property_ui_text(prop, "Transmission Direct", "Deliver transmission direct 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_indirect", PROP_BOOLEAN, PROP_NONE);
2307 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_TRANSM_INDIRECT);
2308 RNA_def_property_ui_text(prop, "Transmission Indirect", "Deliver transmission indirect 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);
2312 prop = RNA_def_property(srna, "use_pass_transmission_color", PROP_BOOLEAN, PROP_NONE);
2313 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_TRANSM_COLOR);
2314 RNA_def_property_ui_text(prop, "Transmission Color", "Deliver transmission color pass");
2315 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2316 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2319 static void rna_def_freestyle_linesets(BlenderRNA *brna, PropertyRNA *cprop)
2324 RNA_def_property_srna(cprop, "Linesets");
2325 srna= RNA_def_struct(brna, "Linesets", NULL);
2326 RNA_def_struct_sdna(srna, "FreestyleSettings");
2327 RNA_def_struct_ui_text(srna, "Line Sets", "Line sets for associating lines and style parameters");
2329 prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
2330 RNA_def_property_struct_type(prop, "FreestyleLineSet");
2331 RNA_def_property_pointer_funcs(prop, "rna_FreestyleSettings_active_lineset_get", NULL, NULL, NULL);
2332 RNA_def_property_ui_text(prop, "Active Line Set", "Active line set being displayed");
2333 RNA_def_property_update(prop, NC_SCENE, NULL);
2335 prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
2336 RNA_def_property_int_funcs(prop, "rna_FreestyleSettings_active_lineset_index_get", "rna_FreestyleSettings_active_lineset_index_set", "rna_FreestyleSettings_active_lineset_index_range");
2337 RNA_def_property_ui_text(prop, "Active Line Set Index", "Index of active line set slot");
2338 RNA_def_property_update(prop, NC_SCENE, NULL);
2341 static void rna_def_freestyle_settings(BlenderRNA *brna)
2346 static EnumPropertyItem edge_type_negation_items[] = {
2347 {0, "INCLUSIVE", 0, "Inclusive", "Select feature edges satisfying the given edge type conditions"},
2348 {FREESTYLE_LINESET_FE_NOT, "EXCLUSIVE", 0, "Exclusive", "Select feature edges not satisfying the given edge type conditions"},
2349 {0, NULL, 0, NULL, NULL}};
2351 static EnumPropertyItem edge_type_combination_items[] = {
2352 {0, "OR", 0, "Logical OR", "Combine feature edge type conditions by logical OR (logical disjunction)"},
2353 {FREESTYLE_LINESET_FE_AND, "AND", 0, "Logical AND", "Combine feature edge type conditions by logical AND (logical conjunction)"},
2354 {0, NULL, 0, NULL, NULL}};
2356 static EnumPropertyItem group_negation_items[] = {
2357 {0, "INCLUSIVE", 0, "Inclusive", "Select feature edges belonging to some object in the group"},
2358 {FREESTYLE_LINESET_GR_NOT, "EXCLUSIVE", 0, "Exclusive", "Select feature edges not belonging to any object in the group"},
2359 {0, NULL, 0, NULL, NULL}};
2361 static EnumPropertyItem face_mark_negation_items[] = {
2362 {0, "INCLUSIVE", 0, "Inclusive", "Select feature edges satisfying the given face mark conditions"},
2363 {FREESTYLE_LINESET_FM_NOT, "EXCLUSIVE", 0, "Exclusive", "Select feature edges not satisfying the given face mark conditions"},
2364 {0, NULL, 0, NULL, NULL}};
2366 static EnumPropertyItem face_mark_condition_items[] = {
2367 {0, "ONE", 0, "One Face", "Select feature edges if one of faces on the right and left has a face mark"},
2368 {FREESTYLE_LINESET_FM_BOTH, "BOTH", 0, "Both Faces", "Select feature edges if both faces on the right and left faces have a face mark"},
2369 {0, NULL, 0, NULL, NULL}};
2371 static EnumPropertyItem freestyle_ui_mode_items[] = {
2372 {FREESTYLE_CONTROL_SCRIPT_MODE, "SCRIPT", 0, "Python Scripting Mode", "Advanced mode for using style modules in Python"},
2373 {FREESTYLE_CONTROL_EDITOR_MODE, "EDITOR", 0, "Parameter Editor Mode", "Basic mode for interactive style parameter editing"},
2374 {0, NULL, 0, NULL, NULL}};
2376 static EnumPropertyItem visibility_items[] ={
2377 {FREESTYLE_QI_VISIBLE, "VISIBLE", 0, "Visible", "Select visible feature edges"},
2378 {FREESTYLE_QI_HIDDEN, "HIDDEN", 0, "Hidden", "Select hidden feature edges"},
2379 {FREESTYLE_QI_RANGE, "RANGE", 0, "QI Range", "Select feature edges within a range of quantitative invisibility (QI) values"},
2380 {0, NULL, 0, NULL, NULL}};
2382 static EnumPropertyItem freestyle_raycasting_algorithm_items[] = {
2383 {FREESTYLE_ALGO_REGULAR, "REGULAR", 0, "Normal Ray Casting", "Consider all FEdges in each ViewEdge"},
2384 {FREESTYLE_ALGO_FAST, "FAST", 0, "Fast Ray Casting", "Sample some FEdges in each ViewEdge"},
2385 {FREESTYLE_ALGO_VERYFAST, "VERYFAST", 0, "Very Fast Ray Casting", "Sample one FEdge in each ViewEdge; do not save list of occluders"},
2386 {FREESTYLE_ALGO_CULLED_ADAPTIVE_TRADITIONAL, "CULLEDADAPTIVETRADITIONAL", 0, "Culled Traditional Visibility Detection", "Culled adaptive grid with heuristic density and traditional QI calculation"},
2387 {FREESTYLE_ALGO_ADAPTIVE_TRADITIONAL, "ADAPTIVETRADITIONAL", 0, "Unculled Traditional Visibility Detection", "Adaptive grid with heuristic density and traditional QI calculation"},
2388 {FREESTYLE_ALGO_CULLED_ADAPTIVE_CUMULATIVE, "CULLEDADAPTIVECUMULATIVE", 0, "Culled Cumulative Visibility Detection", "Culled adaptive grid with heuristic density and cumulative QI calculation"},
2389 {FREESTYLE_ALGO_ADAPTIVE_CUMULATIVE, "ADAPTIVECUMULATIVE", 0, "Unculled Cumulative Visibility Detection", "Adaptive grid with heuristic density and cumulative QI calculation"},
2390 {0, NULL, 0, NULL, NULL}};
2393 /* FreestyleLineSet */
2395 srna= RNA_def_struct(brna, "FreestyleLineSet", NULL);
2396 RNA_def_struct_ui_text(srna, "Freestyle Line Set", "Line set for associating lines and style parameters");
2398 /* access to line style settings is redirected through functions */
2399 /* to allow proper id-buttons functionality */
2400 prop= RNA_def_property(srna, "linestyle", PROP_POINTER, PROP_NONE);
2401 RNA_def_property_struct_type(prop, "FreestyleLineStyle");
2402 RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_NULL);
2403 RNA_def_property_pointer_funcs(prop, "rna_FreestyleLineSet_linestyle_get", "rna_FreestyleLineSet_linestyle_set", NULL, NULL);
2404 RNA_def_property_ui_text(prop, "Line Style", "Line style settings");
2405 RNA_def_property_update(prop, NC_SCENE, NULL);
2407 prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
2408 RNA_def_property_string_sdna(prop, NULL, "name");
2409 RNA_def_property_ui_text(prop, "Line Set Name", "Line set name");
2410 RNA_def_property_update(prop, NC_SCENE, NULL);
2411 RNA_def_struct_name_property(srna, prop);
2413 prop= RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
2414 RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_LINESET_ENABLED);
2415 RNA_def_property_ui_text(prop, "Use", "Enable or disable this line set during stroke rendering");
2416 RNA_def_property_update(prop, NC_SCENE, NULL);
2418 prop= RNA_def_property(srna, "select_by_visibility", PROP_BOOLEAN, PROP_NONE);
2419 RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_VISIBILITY);
2420 RNA_def_property_ui_text(prop, "Selection by Visibility", "Select feature edges based on visibility");
2421 RNA_def_property_update(prop, NC_SCENE, NULL);
2423 prop= RNA_def_property(srna, "select_by_edge_types", PROP_BOOLEAN, PROP_NONE);
2424 RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_EDGE_TYPES);
2425 RNA_def_property_ui_text(prop, "Selection by Edge Types", "Select feature edges based on edge types");
2426 RNA_def_property_update(prop, NC_SCENE, NULL);
2428 prop= RNA_def_property(srna, "select_by_group", PROP_BOOLEAN, PROP_NONE);
2429 RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_GROUP);
2430 RNA_def_property_ui_text(prop, "Selection by Group", "Select feature edges based on a group of objects");
2431 RNA_def_property_update(prop, NC_SCENE, NULL);
2433 prop= RNA_def_property(srna, "select_by_image_border", PROP_BOOLEAN, PROP_NONE);
2434 RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_IMAGE_BORDER);
2435 RNA_def_property_ui_text(prop, "Selection by Image Border", "Select feature edges by image border (less memory consumption)");
2436 RNA_def_property_update(prop, NC_SCENE, NULL);
2438 prop= RNA_def_property(srna, "select_by_face_marks", PROP_BOOLEAN, PROP_NONE);
2439 RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_FACE_MARK);
2440 RNA_def_property_ui_text(prop, "Selection by Face Marks", "Select feature edges by face marks");
2441 RNA_def_property_update(prop, NC_SCENE, NULL);
2443 prop= RNA_def_property(srna, "edge_type_negation", PROP_ENUM, PROP_NONE);
2444 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
2445 RNA_def_property_enum_items(prop, edge_type_negation_items);
2446 RNA_def_property_ui_text(prop, "Edge Type Negation", "Set the negation operation for conditions on feature edge types");
2447 RNA_def_property_update(prop, NC_SCENE, NULL);
2449 prop= RNA_def_property(srna, "edge_type_combination", PROP_ENUM, PROP_NONE);
2450 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
2451 RNA_def_property_enum_items(prop, edge_type_combination_items);
2452 RNA_def_property_ui_text(prop, "Edge Type Combination", "Set the combination operation for conditions on feature edge types");
2453 RNA_def_property_update(prop, NC_SCENE, NULL);
2455 prop= RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE);
2456 RNA_def_property_pointer_sdna(prop, NULL, "group");
2457 RNA_def_property_struct_type(prop, "Group");
2458 RNA_def_property_flag(prop, PROP_EDITABLE);
2459 RNA_def_property_ui_text(prop, "Group", "A group of objects based on which feature edges are selected");
2460 RNA_def_property_update(prop, NC_SCENE, NULL);
2462 prop= RNA_def_property(srna, "group_negation", PROP_ENUM, PROP_NONE);
2463 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
2464 RNA_def_property_enum_items(prop, group_negation_items);
2465 RNA_def_property_ui_text(prop, "Group Negation", "Set the negation operation for conditions on feature edge types");
2466 RNA_def_property_update(prop, NC_SCENE, NULL);
2468 prop= RNA_def_property(srna, "face_mark_negation", PROP_ENUM, PROP_NONE);
2469 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
2470 RNA_def_property_enum_items(prop, face_mark_negation_items);
2471 RNA_def_property_ui_text(prop, "Face Mark Negation", "Set the negation operation for the condition on face marks");
2472 RNA_def_property_update(prop, NC_SCENE, NULL);
2474 prop= RNA_def_property(srna, "face_mark_condition", PROP_ENUM, PROP_NONE);
2475 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
2476 RNA_def_property_enum_items(prop, face_mark_condition_items);
2477 RNA_def_property_ui_text(prop, "Face Mark Condition", "Set a feature edge selection condition on face marks");
2478 RNA_def_property_update(prop, NC_SCENE, NULL);
2480 prop= RNA_def_property(srna, "select_silhouette", PROP_BOOLEAN, PROP_NONE);
2481 RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_SILHOUETTE);
2482 RNA_def_property_ui_text(prop, "Silhouette", "Select silhouette edges");
2483 RNA_def_property_update(prop, NC_SCENE, NULL);
2485 prop= RNA_def_property(srna, "select_border", PROP_BOOLEAN, PROP_NONE);
2486 RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_BORDER);
2487 RNA_def_property_ui_text(prop, "Border", "Select border edges");
2488 RNA_def_property_update(prop, NC_SCENE, NULL);
2490 prop= RNA_def_property(srna, "select_crease", PROP_BOOLEAN, PROP_NONE);
2491 RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_CREASE);
2492 RNA_def_property_ui_text(prop, "Crease", "Select crease edges");
2493 RNA_def_property_update(prop, NC_SCENE, NULL);
2495 prop= RNA_def_property(srna, "select_ridge_valley", PROP_BOOLEAN, PROP_NONE);
2496 RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_RIDGE_VALLEY);
2497 RNA_def_property_ui_text(prop, "Ridge & Valley", "Select ridges and valleys");
2498 RNA_def_property_update(prop, NC_SCENE, NULL);
2500 prop= RNA_def_property(srna, "select_suggestive_contour", PROP_BOOLEAN, PROP_NONE);
2501 RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_SUGGESTIVE_CONTOUR);
2502 RNA_def_property_ui_text(prop, "Suggestive Contour", "Select suggestive contours");
2503 RNA_def_property_update(prop, NC_SCENE, NULL);
2505 prop= RNA_def_property(srna, "select_material_boundary", PROP_BOOLEAN, PROP_NONE);
2506 RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_MATERIAL_BOUNDARY);
2507 RNA_def_property_ui_text(prop, "Material Boundary", "Select edges at material boundaries");
2508 RNA_def_property_update(prop, NC_SCENE, NULL);
2510 prop= RNA_def_property(srna, "select_contour", PROP_BOOLEAN, PROP_NONE);
2511 RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_CONTOUR);
2512 RNA_def_property_ui_text(prop, "Contour", "Select contours");
2513 RNA_def_property_update(prop, NC_SCENE, NULL);
2515 prop= RNA_def_property(srna, "select_external_contour", PROP_BOOLEAN, PROP_NONE);
2516 RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_EXTERNAL_CONTOUR);
2517 RNA_def_property_ui_text(prop, "External Contour", "Select external contours");
2518 RNA_def_property_update(prop, NC_SCENE, NULL);
2520 prop= RNA_def_property(srna, "select_edge_mark", PROP_BOOLEAN, PROP_NONE);
2521 RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_EDGE_MARK);
2522 RNA_def_property_ui_text(prop, "Edge Mark", "Select edge marks");
2523 RNA_def_property_update(prop, NC_SCENE, NULL);
2525 prop= RNA_def_property(srna, "exclude_silhouette", PROP_BOOLEAN, PROP_NONE);
2526 RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_SILHOUETTE);
2527 RNA_def_property_ui_text(prop, "Silhouette", "Exclude silhouette 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_border", PROP_BOOLEAN, PROP_NONE);
2532 RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_BORDER);
2533 RNA_def_property_ui_text(prop, "Border", "Exclude border 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_crease", PROP_BOOLEAN, PROP_NONE);
2538 RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_CREASE);
2539 RNA_def_property_ui_text(prop, "Crease", "Exclude crease edges");
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_ridge_valley", PROP_BOOLEAN, PROP_NONE);
2544 RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_RIDGE_VALLEY);
2545 RNA_def_property_ui_text(prop, "Ridge & Valley", "Exclude ridges and valleys");
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_suggestive_contour", PROP_BOOLEAN, PROP_NONE);
2550 RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_SUGGESTIVE_CONTOUR);
2551 RNA_def_property_ui_text(prop, "Suggestive Contour", "Exclude suggestive contours");
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_material_boundary", PROP_BOOLEAN, PROP_NONE);
2556 RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_MATERIAL_BOUNDARY);
2557 RNA_def_property_ui_text(prop, "Material Boundary", "Exclude edges at material boundaries");
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_contour", PROP_BOOLEAN, PROP_NONE);
2562 RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_CONTOUR);
2563 RNA_def_property_ui_text(prop, "Contour", "Exclude 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_external_contour", PROP_BOOLEAN, PROP_NONE);
2568 RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_EXTERNAL_CONTOUR);
2569 RNA_def_property_ui_text(prop, "External Contour", "Exclude external contours");
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, "exclude_edge_mark", PROP_BOOLEAN, PROP_NONE);
2574 RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_EDGE_MARK);
2575 RNA_def_property_ui_text(prop, "Edge Mark", "Exclude edge marks");
2576 RNA_def_property_ui_icon(prop, ICON_X, 0);
2577 RNA_def_property_update(prop, NC_SCENE, NULL);
2579 prop= RNA_def_property(srna, "visibility", PROP_ENUM, PROP_NONE);
2580 RNA_def_property_enum_sdna(prop, NULL, "qi");
2581 RNA_def_property_enum_items(prop, visibility_items);
2582 RNA_def_property_ui_text(prop, "Visibility", "Determine how to use visibility for feature edge selection");
2583 RNA_def_property_update(prop, NC_SCENE, NULL);
2585 prop= RNA_def_property(srna, "qi_start", PROP_INT, PROP_UNSIGNED);
2586 RNA_def_property_int_sdna(prop, NULL, "qi_start");
2587 RNA_def_property_range(prop, 0, INT_MAX);
2588 RNA_def_property_ui_text(prop, "Start", "First QI value of the QI range");
2589 RNA_def_property_update(prop, NC_SCENE, NULL);
2591 prop= RNA_def_property(srna, "qi_end", PROP_INT, PROP_UNSIGNED);
2592 RNA_def_property_int_sdna(prop, NULL, "qi_end");
2593 RNA_def_property_range(prop, 0, INT_MAX);
2594 RNA_def_property_ui_text(prop, "End", "Last QI value of the QI range");
2595 RNA_def_property_update(prop, NC_SCENE, NULL);
2597 /* FreestyleModuleSettings */
2599 srna= RNA_def_struct(brna, "FreestyleModuleSettings", NULL);
2600 RNA_def_struct_sdna(srna, "FreestyleModuleConfig");
2601 RNA_def_struct_ui_text(srna, "Freestyle Module", "Style module configuration for specifying a style module");
2603 prop= RNA_def_property(srna, "module_path", PROP_STRING, PROP_FILEPATH);
2604 RNA_def_property_string_sdna(prop, NULL, "module_path");
2605 RNA_def_property_ui_text(prop, "Module Path", "Path to a style module file");
2606 RNA_def_property_update(prop, NC_SCENE, NULL);
2608 prop= RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
2609 RNA_def_property_boolean_sdna(prop, NULL, "is_displayed", 1);
2610 RNA_def_property_ui_text(prop, "Use", "Enable or disable this style module during stroke rendering");
2611 RNA_def_property_update(prop, NC_SCENE, NULL);
2613 /* FreestyleSettings */
2615 srna= RNA_def_struct(brna, "FreestyleSettings", NULL);
2616 RNA_def_struct_sdna(srna, "FreestyleConfig");
2617 RNA_def_struct_nested(brna, srna, "SceneRenderLayer");
2618 RNA_def_struct_ui_text(srna, "Frestyle Settings", "Freestyle settings for a SceneRenderLayer datablock");
2620 prop= RNA_def_property(srna, "modules", PROP_COLLECTION, PROP_NONE);
2621 RNA_def_property_collection_sdna(prop, NULL, "modules", NULL);
2622 RNA_def_property_struct_type(prop, "FreestyleModuleSettings");
2623 RNA_def_property_ui_text(prop, "Style modules", "A list of style modules (to be applied from top to bottom)");
2625 prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
2626 RNA_def_property_enum_sdna(prop, NULL, "mode");
2627 RNA_def_property_enum_items(prop, freestyle_ui_mode_items);
2628 RNA_def_property_ui_text(prop, "Control Mode", "Select the Freestyle control mode");
2629 RNA_def_property_update(prop, NC_SCENE, NULL);
2631 prop= RNA_def_property(srna, "raycasting_algorithm", PROP_ENUM, PROP_NONE);
2632 RNA_def_property_enum_sdna(prop, NULL, "raycasting_algorithm");
2633 RNA_def_property_enum_items(prop, freestyle_raycasting_algorithm_items);
2634 RNA_def_property_ui_text(prop, "Raycasting Algorithm", "Select the Freestyle raycasting algorithm");
2635 RNA_def_property_update(prop, NC_SCENE, NULL);
2637 prop= RNA_def_property(srna, "use_culling", PROP_BOOLEAN, PROP_NONE);
2638 RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_CULLING);
2639 RNA_def_property_ui_text(prop, "Culling", "If enabled, out-of-view edges are ignored");
2640 RNA_def_property_update(prop, NC_SCENE, NULL);
2642 prop= RNA_def_property(srna, "use_suggestive_contours", PROP_BOOLEAN, PROP_NONE);
2643 RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_SUGGESTIVE_CONTOURS_FLAG);
2644 RNA_def_property_ui_text(prop, "Suggestive Contours", "Enable suggestive contours");
2645 RNA_def_property_update(prop, NC_SCENE, NULL);
2647 prop= RNA_def_property(srna, "use_ridges_and_valleys", PROP_BOOLEAN, PROP_NONE);
2648 RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_RIDGES_AND_VALLEYS_FLAG);
2649 RNA_def_property_ui_text(prop, "Ridges and Valleys", "Enable ridges and valleys");
2650 RNA_def_property_update(prop, NC_SCENE, NULL);
2652 prop= RNA_def_property(srna, "use_material_boundaries", PROP_BOOLEAN, PROP_NONE);
2653 RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_MATERIAL_BOUNDARIES_FLAG);
2654 RNA_def_property_ui_text(prop, "Material Boundaries", "Enable material boundaries");
2655 RNA_def_property_update(prop, NC_SCENE, NULL);
2657 prop= RNA_def_property(srna, "use_smoothness", PROP_BOOLEAN, PROP_NONE);
2658 RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_FACE_SMOOTHNESS_FLAG);
2659 RNA_def_property_ui_text(prop, "Face Smoothness", "Take face smoothness into account in view map calculation");
2660 RNA_def_property_update(prop, NC_SCENE, NULL);
2662 prop= RNA_def_property(srna, "use_advanced_options", PROP_BOOLEAN, PROP_NONE);
2663 RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_ADVANCED_OPTIONS_FLAG);
2664 RNA_def_property_ui_text(prop, "Advanced Edge Detection Options", "Enable advanced edge detection options (sphere radius and Kr derivative epsilon)");
2665 RNA_def_property_update(prop, NC_SCENE, NULL);
2667 prop= RNA_def_property(srna, "sphere_radius", PROP_FLOAT, PROP_NONE);
2668 RNA_def_property_float_sdna(prop, NULL, "sphere_radius");
2669 RNA_def_property_range(prop, 0.0, 1000.0);
2670 RNA_def_property_ui_text(prop, "Sphere Radius", "Sphere radius for computing curvatures");
2671 RNA_def_property_update(prop, NC_SCENE, NULL);
2673 prop= RNA_def_property(srna, "kr_derivative_epsilon", PROP_FLOAT, PROP_NONE);
2674 RNA_def_property_float_sdna(prop, NULL, "dkr_epsilon");
2675 RNA_def_property_range(prop, -1000.0, 1000.0);
2676 RNA_def_property_ui_text(prop, "Kr Derivative Epsilon", "Kr derivative epsilon for computing suggestive contours");
2677 RNA_def_property_update(prop, NC_SCENE, NULL);
2679 prop= RNA_def_property(srna, "crease_angle", PROP_FLOAT, PROP_NONE);
2680 RNA_def_property_float_sdna(prop, NULL, "crease_angle");
2681 RNA_def_property_range(prop, 0.0, 180.0);
2682 RNA_def_property_ui_text(prop, "Crease Angle", "Angular threshold in degrees (between 0 and 180) for detecting crease edges");
2683 RNA_def_property_update(prop, NC_SCENE, NULL);
2685 prop= RNA_def_property(srna, "linesets", PROP_COLLECTION, PROP_NONE);
2686 RNA_def_property_collection_sdna(prop, NULL, "linesets", NULL);
2687 RNA_def_property_struct_type(prop, "FreestyleLineSet");
2688 RNA_def_property_ui_text(prop, "Line Sets", "");
2689 rna_def_freestyle_linesets(brna, prop);
2692 static void rna_def_scene_game_recast_data(BlenderRNA *brna)
2697 srna = RNA_def_struct(brna, "SceneGameRecastData", NULL);
2698 RNA_def_struct_sdna(srna, "RecastData");
2699 RNA_def_struct_nested(brna, srna, "Scene");
2700 RNA_def_struct_ui_text(srna, "Recast Data", "Recast data for a Game datablock");
2702 prop = RNA_def_property(srna, "cell_size", PROP_FLOAT, PROP_NONE);
2703 RNA_def_property_float_sdna(prop, NULL, "cellsize");
2704 RNA_def_property_ui_range(prop, 0.1, 1, 1, 2);
2705 RNA_def_property_ui_text(prop, "Cell Size", "Rasterized cell size");
2706 RNA_def_property_update(prop, NC_SCENE, NULL);
2708 prop = RNA_def_property(srna, "cell_height", PROP_FLOAT, PROP_NONE);
2709 RNA_def_property_float_sdna(prop, NULL, "cellheight");
2710 RNA_def_property_ui_range(prop, 0.1, 1, 1, 2);
2711 RNA_def_property_ui_text(prop, "Cell Height", "Rasterized cell height");
2712 RNA_def_property_update(prop, NC_SCENE, NULL);
2714 prop = RNA_def_property(srna, "agent_height", PROP_FLOAT, PROP_NONE);
2715 RNA_def_property_float_sdna(prop, NULL, "agentheight");
2716 RNA_def_property_ui_range(prop, 0.1, 5, 1, 2);
2717 RNA_def_property_ui_text(prop, "Agent Height", "Minimum height where the agent can still walk");
2718 RNA_def_property_update(prop, NC_SCENE, NULL);
2720 prop = RNA_def_property(srna, "agent_radius", PROP_FLOAT, PROP_NONE);
2721 RNA_def_property_float_sdna(prop, NULL, "agentradius");
2722 RNA_def_property_ui_range(prop, 0.1, 5, 1, 2);
2723 RNA_def_property_ui_text(prop, "Agent Radius", "Radius of the agent");
2724 RNA_def_property_update(prop, NC_SCENE, NULL);
2726 prop = RNA_def_property(srna, "climb_max", PROP_FLOAT, PROP_NONE);
2727 RNA_def_property_float_sdna(prop, NULL, "agentmaxclimb");
2728 RNA_def_property_ui_range(prop, 0.1, 5, 1, 2);
2729 RNA_def_property_ui_text(prop, "Max Climb", "Maximum height between grid cells the agent can climb");
2730 RNA_def_property_update(prop, NC_SCENE, NULL);
2732 prop = RNA_def_property(srna, "slope_max", PROP_FLOAT, PROP_ANGLE);
2733 RNA_def_property_float_sdna(prop, NULL, "agentmaxslope");
2734 RNA_def_property_range(prop, 0, M_PI / 2);
2735 RNA_def_property_ui_text(prop, "Max Slope", "Maximum walkable slope angle in degrees");
2736 RNA_def_property_update(prop, NC_SCENE, NULL);
2739 prop = RNA_def_property(srna, "region_min_size", PROP_FLOAT, PROP_NONE);
2740 RNA_def_property_float_sdna(prop, NULL, "regionminsize");
2741 RNA_def_property_ui_range(prop, 0, 150, 1, 2);
2742 RNA_def_property_ui_text(prop, "Min Region Size", "Minimum regions size (smaller regions will be deleted)");
2743 RNA_def_property_update(prop, NC_SCENE, NULL);
2745 prop = RNA_def_property(srna, "region_merge_size", PROP_FLOAT, PROP_NONE);
2746 RNA_def_property_float_sdna(prop, NULL, "regionmergesize");
2747 RNA_def_property_ui_range(prop, 0, 150, 1, 2);
2748 RNA_def_property_ui_text(prop, "Merged Region Size", "Minimum regions size (smaller regions will be merged)");
2749 RNA_def_property_update(prop, NC_SCENE, NULL);
2751 prop = RNA_def_property(srna, "edge_max_len", PROP_FLOAT, PROP_NONE);
2752 RNA_def_property_float_sdna(prop, NULL, "edgemaxlen");
2753 RNA_def_property_ui_range(prop, 0, 50, 1, 2);
2754 RNA_def_property_ui_text(prop, "Max Edge Length", "Maximum contour edge length");
2755 RNA_def_property_update(prop, NC_SCENE, NULL);
2757 prop = RNA_def_property(srna, "edge_max_error", PROP_FLOAT, PROP_NONE);
2758 RNA_def_property_float_sdna(prop, NULL, "edgemaxerror");
2759 RNA_def_property_ui_range(prop, 0.1, 3.0, 1, 2);
2760 RNA_def_property_ui_text(prop, "Max Edge Error", "Maximum distance error from contour to cells");
2761 RNA_def_property_update(prop, NC_SCENE, NULL);
2763 prop = RNA_def_property(srna, "verts_per_poly", PROP_INT, PROP_NONE);
2764 RNA_def_property_int_sdna(prop, NULL, "vertsperpoly");
2765 RNA_def_property_ui_range(prop, 3, 12, 1, 0);
2766 RNA_def_property_ui_text(prop, "Verts Per Poly", "Max number of vertices per polygon");
2767 RNA_def_property_update(prop, NC_SCENE, NULL);
2769 prop = RNA_def_property(srna, "sample_dist", PROP_FLOAT, PROP_NONE);
2770 RNA_def_property_float_sdna(prop, NULL, "detailsampledist");
2771 RNA_def_property_ui_range(prop, 0.0, 16.0, 1, 2);
2772 RNA_def_property_ui_text(prop, "Sample Distance", "Detail mesh sample spacing");
2773 RNA_def_property_update(prop, NC_SCENE, NULL);
2775 prop = RNA_def_property(srna, "sample_max_error", PROP_FLOAT, PROP_NONE);
2776 RNA_def_property_float_sdna(prop, NULL, "detailsamplemaxerror");
2777 RNA_def_property_ui_range(prop, 0.0, 16.0, 1, 2);
2778 RNA_def_property_ui_text(prop, "Max Sample Error", "Detail mesh simplification max sample error");
2779 RNA_def_property_update(prop, NC_SCENE, NULL);
2782 static void rna_def_scene_game_data(BlenderRNA *brna)
2787 static EnumPropertyItem aasamples_items[] = {
2788 {0, "SAMPLES_0", 0, "Off", ""},
2789 {2, "SAMPLES_2", 0, "2x", ""},
2790 {4, "SAMPLES_4", 0, "4x", ""},
2791 {8, "SAMPLES_8", 0, "8x", ""},
2792 {16, "SAMPLES_16", 0, "16x", ""},
2793 {0, NULL, 0, NULL, NULL}
2796 static EnumPropertyItem framing_types_items[] = {
2797 {SCE_GAMEFRAMING_BARS, "LETTERBOX", 0, "Letterbox",
2798 "Show the entire viewport in the display window, using bar horizontally or vertically"},
2799 {SCE_GAMEFRAMING_EXTEND, "EXTEND", 0, "Extend",
2800 "Show the entire viewport in the display window, viewing more horizontally "
2802 {SCE_GAMEFRAMING_SCALE, "SCALE", 0, "Scale", "Stretch or squeeze the viewport to fill the display window"},
2803 {0, NULL, 0, NULL, NULL}
2806 static EnumPropertyItem dome_modes_items[] = {
2807 {DOME_FISHEYE, "FISHEYE", 0, "Fisheye", ""},
2808 {DOME_TRUNCATED_FRONT, "TRUNCATED_FRONT", 0, "Front-Truncated", ""},
2809 {DOME_TRUNCATED_REAR, "TRUNCATED_REAR", 0, "Rear-Truncated", ""},
2810 {DOME_ENVMAP, "ENVMAP", 0, "Cube Map", ""},
2811 {DOME_PANORAM_SPH, "PANORAM_SPH", 0, "Spherical Panoramic", ""},
2812 {0, NULL, 0, NULL, NULL}
2815 static EnumPropertyItem stereo_modes_items[] = {
2816 {STEREO_QUADBUFFERED, "QUADBUFFERED", 0, "Quad-Buffer", ""},
2817 {STEREO_ABOVEBELOW, "ABOVEBELOW", 0, "Above-Below", ""},
2818 {STEREO_INTERLACED, "INTERLACED", 0, "Interlaced", ""},
2819 {STEREO_ANAGLYPH, "ANAGLYPH", 0, "Anaglyph", ""},
2820 {STEREO_SIDEBYSIDE, "SIDEBYSIDE", 0, "Side-by-side", ""},
2821 {STEREO_VINTERLACE, "VINTERLACE", 0, "Vinterlace", ""},
2822 {0, NULL, 0, NULL, NULL}
2825 static EnumPropertyItem stereo_items[] = {
2826 {STEREO_NOSTEREO, "NONE", 0, "None", "Disable Stereo and Dome environments"},
2827 {STEREO_ENABLED, "STEREO", 0, "Stereo", "Enable Stereo environment"},
2828 {STEREO_DOME, "DOME", 0, "Dome", "Enable Dome environment"},
2829 {0, NULL, 0, NULL, NULL}
2832 static EnumPropertyItem physics_engine_items[] = {
2833 {WOPHY_NONE, "NONE", 0, "None", "Don't use a physics engine"},
2834 /*{WOPHY_ENJI, "ENJI", 0, "Enji", ""}, */
2835 /*{WOPHY_SUMO, "SUMO", 0, "Sumo (Deprecated)", ""}, */
2836 /*{WOPHY_DYNAMO, "DYNAMO", 0, "Dynamo", ""}, */
2837 /*{WOPHY_ODE, "ODE", 0, "ODE", ""}, */
2838 {WOPHY_BULLET, "BULLET", 0, "Bullet", "Use the Bullet physics engine"},
2839 {0, NULL, 0, NULL, NULL}
2842 static EnumPropertyItem material_items[] = {
2843 {GAME_MAT_TEXFACE, "SINGLETEXTURE", 0, "Singletexture", "Singletexture face materials"},
2844 {GAME_MAT_MULTITEX, "MULTITEXTURE", 0, "Multitexture", "Multitexture materials"},
2845 {GAME_MAT_GLSL, "GLSL", 0, "GLSL", "OpenGL shading language shaders"},
2846 {0, NULL, 0, NULL, NULL}
2849 static EnumPropertyItem obstacle_simulation_items[] = {
2850 {OBSTSIMULATION_NONE, "NONE", 0, "None", ""},
2851 {OBSTSIMULATION_TOI_rays, "RVO_RAYS", 0, "RVO (rays)", ""},
2852 {OBSTSIMULATION_TOI_cells, "RVO_CELLS", 0, "RVO (cells)", ""},
2853 {0, NULL, 0, NULL, NULL}
2856 srna = RNA_def_struct(brna, "SceneGameData", NULL);
2857 RNA_def_struct_sdna(srna, "GameData");
2858 RNA_def_struct_nested(brna, srna, "Scene");
2859 RNA_def_struct_ui_text(srna, "Game Data", "Game data for a Scene datablock");
2861 prop = RNA_def_property(srna, "resolution_x", PROP_INT, PROP_NONE);
2862 RNA_def_property_int_sdna(prop, NULL, "xplay");
2863 RNA_def_property_range(prop, 4, 10000);
2864 RNA_def_property_ui_text(prop, "Resolution X", "Number of horizontal pixels in the screen");
2865 RNA_def_property_update(prop, NC_SCENE, NULL);
2867 prop = RNA_def_property(srna, "resolution_y", PROP_INT, PROP_NONE);
2868 RNA_def_property_int_sdna(prop, NULL, "yplay");
2869 RNA_def_property_range(prop, 4, 10000);
2870 RNA_def_property_ui_text(prop, "Resolution Y", "Number of vertical pixels in the screen");
2871 RNA_def_property_update(prop, NC_SCENE, NULL);
2873 prop = RNA_def_property(srna, "samples", PROP_ENUM, PROP_NONE);
2874 RNA_def_property_enum_sdna(prop, NULL, "aasamples");
2875 RNA_def_property_enum_items(prop, aasamples_items);
2876 RNA_def_property_ui_text(prop, "AA Samples", "The number of AA Samples to use for MSAA");
2878 prop = RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED);
2879 RNA_def_property_int_sdna(prop, NULL, "depth");
2880 RNA_def_property_range(prop, 8, 32);
2881 RNA_def_property_ui_text(prop, "Bits", "Display bit depth of full screen display");
2882 RNA_def_property_update(prop, NC_SCENE, NULL);
2884 prop = RNA_def_property(srna, "exit_key", PROP_ENUM, PROP_NONE);
2885 RNA_def_property_enum_sdna(prop, NULL, "exitkey");
2886 RNA_def_property_enum_items(prop, event_type_items);
2887 RNA_def_property_enum_funcs(prop, NULL, "rna_GameSettings_exit_key_set", NULL);
2888 RNA_def_property_ui_text(prop, "Exit Key", "The key that exits the Game Engine");
2889 RNA_def_property_update(prop, NC_SCENE, NULL);
2891 /* Do we need it here ? (since we already have it in World */
2892 prop = RNA_def_property(srna, "frequency", PROP_INT, PROP_NONE);
2893 RNA_def_property_int_sdna(prop, NULL, "freqplay");
2894 RNA_def_property_range(prop, 4, 2000);
2895 RNA_def_property_ui_text(prop, "Freq", "Display clock frequency of fullscreen display");
2896 RNA_def_property_update(prop, NC_SCENE, NULL);
2898 prop = RNA_def_property(srna, "show_fullscreen", PROP_BOOLEAN, PROP_NONE);
2899 RNA_def_property_boolean_sdna(prop, NULL, "playerflag", GAME_PLAYER_FULLSCREEN);
2900 RNA_def_property_ui_text(prop, "Fullscreen", "Start player in a new fullscreen display");
2901 RNA_def_property_update(prop, NC_SCENE, NULL);
2903 prop = RNA_def_property(srna, "use_desktop", PROP_BOOLEAN, PROP_NONE);
2904 RNA_def_property_boolean_sdna(prop, NULL, "playerflag", GAME_PLAYER_DESKTOP_RESOLUTION);
2905 RNA_def_property_ui_text(prop, "Desktop", "Use the current desktop resolution in fullscreen mode");
2906 RNA_def_property_update(prop, NC_SCENE, NULL);
2909 prop = RNA_def_property(srna, "frame_type", PROP_ENUM, PROP_NONE);
2910 RNA_def_property_enum_sdna(prop, NULL, "framing.type");
2911 RNA_def_property_enum_items(prop, framing_types_items);
2912 RNA_def_property_ui_text(prop, "Framing Types", "Select the type of Framing you want");
2913 RNA_def_property_update(prop, NC_SCENE, NULL);
2915 prop = RNA_def_property(srna, "frame_color", PROP_FLOAT, PROP_COLOR);
2916 RNA_def_property_float_sdna(prop, NULL, "framing.col");
2917 RNA_def_property_range(prop, 0.0f, 1.0f);
2918 RNA_def_property_array(prop, 3);
2919 RNA_def_property_ui_text(prop, "Framing Color", "Set color of the bars");
2920 RNA_def_property_update(prop, NC_SCENE, NULL);
2923 prop = RNA_def_property(srna, "stereo", PROP_ENUM, PROP_NONE);
2924 RNA_def_property_enum_sdna(prop, NULL, "stereoflag");
2925 RNA_def_property_enum_items(prop, stereo_items);
2926 RNA_def_property_ui_text(prop, "Stereo Options", "");
2927 RNA_def_property_update(prop, NC_SCENE, NULL);
2929 prop = RNA_def_property(srna, "stereo_mode", PROP_ENUM, PROP_NONE);
2930 RNA_def_property_enum_sdna(prop, NULL, "stereomode");
2931 RNA_def_property_enum_items(prop, stereo_modes_items);
2932 RNA_def_property_ui_text(prop, "Stereo Mode", "Stereographic techniques");
2933 RNA_def_property_update(prop, NC_SCENE, NULL);
2935 prop = RNA_def_property(srna, "stereo_eye_separation", PROP_FLOAT, PROP_NONE);
2936 RNA_def_property_float_sdna(prop, NULL, "eyeseparation");
2937 RNA_def_property_range(prop, 0.01, 5.0);
2938 RNA_def_property_ui_text(prop, "Eye Separation",
2939 "Set the distance between the eyes - the camera focal length/30 should be fine");
2940 RNA_def_property_update(prop, NC_SCENE, NULL);
2943 prop = RNA_def_property(srna, "dome_mode", PROP_ENUM, PROP_NONE);
2944 RNA_def_property_enum_sdna(prop, NULL, "dome.mode");
2945 RNA_def_property_enum_items(prop, dome_modes_items);
2946 RNA_def_property_ui_text(prop, "Dome Mode", "Dome physical configurations");
2947 RNA_def_property_update(prop, NC_SCENE, NULL);
2949 prop = RNA_def_property(srna, "dome_tessellation", PROP_INT, PROP_NONE);
2950 RNA_def_property_int_sdna(prop, NULL, "dome.res");
2951 RNA_def_property_ui_range(prop, 1, 8, 1, 1);
2952 RNA_def_property_ui_text(prop, "Tessellation", "Tessellation level - check the generated mesh in wireframe mode");
2953 RNA_def_property_update(prop, NC_SCENE, NULL);
2955 prop = RNA_def_property(srna, "dome_buffer_resolution", PROP_FLOAT, PROP_NONE);
2956 RNA_def_property_float_sdna(prop, NULL, "dome.resbuf");
2957 RNA_def_property_ui_range(prop, 0.1, 1.0, 0.1, 2);
2958 RNA_def_property_ui_text(prop, "Buffer Resolution", "Buffer Resolution - decrease it to increase speed");
2959 RNA_def_property_update(prop, NC_SCENE, NULL);
2961 prop = RNA_def_property(srna, "dome_angle", PROP_INT, PROP_NONE);
2962 RNA_def_property_int_sdna(prop, NULL, "dome.angle");
2963 RNA_def_property_ui_range(prop, 90, 250, 1, 1);
2964 RNA_def_property_ui_text(prop, "Angle", "Field of View of the Dome - it only works in mode Fisheye and Truncated");
2965 RNA_def_property_update(prop, NC_SCENE, NULL);
2967 prop = RNA_def_property(srna, "dome_tilt", PROP_INT, PROP_NONE);
2968 RNA_def_property_int_sdna(prop, NULL, "dome.tilt");
2969 RNA_def_property_ui_range(prop, -180, 180, 1, 1);
2970 RNA_def_property_ui_text(prop, "Tilt", "Camera rotation in horizontal axis");
2971 RNA_def_property_update(prop, NC_SCENE, NULL);
2973 prop = RNA_def_property(srna, "dome_text", PROP_POINTER, PROP_NONE);
2974 RNA_def_property_pointer_sdna(prop, NULL, "dome.warptext");
2975 RNA_def_property_struct_type(prop, "Text");
2976 RNA_def_property_flag(prop, PROP_EDITABLE);
2977 RNA_def_property_ui_text(prop, "Warp Data", "Custom Warp Mesh data file");
2978 RNA_def_property_update(prop, NC_SCENE, NULL);
2981 prop = RNA_def_property(srna, "physics_engine", PROP_ENUM, PROP_NONE);
2982 RNA_def_property_enum_sdna(prop, NULL, "physicsEngine");
2983 RNA_def_property_enum_items(prop, physics_engine_items);
2984 RNA_def_property_ui_text(prop, "Physics Engine", "Physics engine used for physics simulation in the game engine");
2985 RNA_def_property_update(prop, NC_SCENE, NULL);
2987 prop = RNA_def_property(srna, "physics_gravity", PROP_FLOAT, PROP_ACCELERATION);
2988 RNA_def_property_float_sdna(prop, NULL, "gravity");
2989 RNA_def_property_ui_range(prop, 0.0, 25.0, 1, 2);
2990 RNA_def_property_range(prop, 0.0, 10000.0);
2991 RNA_def_property_ui_text(prop, "Physics Gravity",
2992 "Gravitational constant used for physics simulation in the game engine");
2993 RNA_def_property_update(prop, NC_SCENE, NULL);
2995 prop = RNA_def_property(srna, "occlusion_culling_resolution", PROP_INT, PROP_NONE);
2996 RNA_def_property_int_sdna(prop, NULL, "occlusionRes");
2997 RNA_def_property_range(prop, 128.0, 1024.0);
2998 RNA_def_property_ui_text(prop, "Occlusion Resolution",
2999 "Size of the occlusion buffer in pixel, use higher value for better precision (slower)");
3000 RNA_def_property_update(prop, NC_SCENE, NULL);
3002 prop = RNA_def_property(srna, "fps", PROP_INT, PROP_NONE);
3003 RNA_def_property_int_sdna(prop, NULL, "ticrate");
3004 RNA_def_property_ui_range(prop, 1, 60, 1, 1);
3005 RNA_def_property_range(prop, 1, 250);
3006 RNA_def_property_ui_text(prop, "Frames Per Second",
3007 "Nominal number of game frames per second "
3008 "(physics fixed timestep = 1/fps, independently of actual frame rate)");
3009 RNA_def_property_update(prop, NC_SCENE, NULL);
3011 prop = RNA_def_property(srna, "logic_step_max", PROP_INT, PROP_NONE);
3012 RNA_def_property_int_sdna(prop, NULL, "maxlogicstep");
3013 RNA_def_property_ui_range(prop, 1, 5, 1, 1);
3014 RNA_def_property_range(prop, 1, 5);
3015 RNA_def_property_ui_text(prop, "Max Logic Steps",
3016 "Maximum number of logic frame per game frame if graphics slows down the game, "
3017 "higher value allows better synchronization with physics");
3018 RNA_def_property_update(prop, NC_SCENE, NULL);
3020 prop = RNA_def_property(srna, "physics_step_max", PROP_INT, PROP_NONE);
3021 RNA_def_property_int_sdna(prop, NULL, "maxphystep");
3022 RNA_def_property_ui_range(prop, 1, 5, 1, 1);
3023 RNA_def_property_range(prop, 1, 5);
3024 RNA_def_property_ui_text(prop, "Max Physics Steps",
3025 "Maximum number of physics step per game frame if graphics slows down the game, "
3026 "higher value allows physics to keep up with realtime");
3027 RNA_def_property_update(prop, NC_SCENE, NULL);
3029 prop = RNA_def_property(srna, "physics_step_sub", PROP_INT, PROP_NONE);
3030 RNA_def_property_int_sdna(prop, NULL, "physubstep");
3031 RNA_def_property_range(prop, 1, 50);
3032 RNA_def_property_ui_range(prop, 1, 5, 1, 1);
3033 RNA_def_property_ui_text(prop, "Physics Sub Steps",
3034 "Number of simulation substep per physic timestep, "
3035 "higher value give better physics precision");
3036 RNA_def_property_update(prop, NC_SCENE, NULL);
3038 prop = RNA_def_property(srna, "deactivation_linear_threshold", PROP_FLOAT, PROP_NONE);
3039 RNA_def_property_float_sdna(prop, NULL, "lineardeactthreshold");
3040 RNA_def_property_ui_range(prop, 0.001, 10000.0, 2, 3);
3041 RNA_def_property_range(prop, 0.001, 10000.0);
3042 RNA_def_property_ui_text(prop, "Deactivation Linear Threshold",
3043 "Linear velocity that an object must be below before the deactivation timer can start");
3044 RNA_def_property_update(prop, NC_SCENE, NULL);
3046 prop = RNA_def_property(srna, "deactivation_angular_threshold", PROP_FLOAT, PROP_NONE);
3047 RNA_def_property_float_sdna(prop, NULL, "angulardeactthreshold");
3048 RNA_def_property_ui_range(prop, 0.001, 10000.0, 2, 3);
3049 RNA_def_property_range(prop, 0.001, 10000.0);
3050 RNA_def_property_ui_text(prop, "Deactivation Angular Threshold",
3051 "Angular velocity that an object must be below before the deactivation timer can start");
3052 RNA_def_property_update(prop, NC_SCENE, NULL);
3054 prop = RNA_def_property(srna, "deactivation_time", PROP_FLOAT, PROP_NONE);
3055 RNA_def_property_float_sdna(prop, NULL, "deactivationtime");
3056 RNA_def_property_ui_range(prop, 0.0, 60.0, 1, 1);
3057 RNA_def_property_range(prop, 0.0, 60.0);
3058 RNA_def_property_ui_text(prop, "Deactivation Time",
3059 "Amount of time (in seconds) after which objects with a velocity less than the given "
3060 "threshold will deactivate (0.0 means no deactivation)");
3061 RNA_def_property_update(prop, NC_SCENE, NULL);
3064 prop = RNA_def_property(srna, "use_occlusion_culling", PROP_BOOLEAN, PROP_NONE);
3065 RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_DBVT_CULLING);
3066 RNA_def_property_ui_text(prop, "DBVT culling",
3067 "Use optimized Bullet DBVT tree for view frustum and occlusion culling");
3069 /* not used *//* deprecated !!!!!!!!!!!!! */
3070 prop = RNA_def_property(srna, "use_activity_culling", PROP_BOOLEAN, PROP_NONE);
3071 RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_ACTIVITY_CULLING);
3072 RNA_def_property_ui_text(prop, "Activity Culling", "Activity culling is enabled");
3074 /* not used *//* deprecated !!!!!!!!!!!!! */
3075 prop = RNA_def_property(srna, "activity_culling_box_radius", PROP_FLOAT, PROP_NONE);
3076 RNA_def_property_float_sdna(prop, NULL, "activityBoxRadius");
3077 RNA_def_property_range(prop, 0.0, 1000.0);
3078 RNA_def_property_ui_text(prop, "Box Radius",
3079 "Radius of the activity bubble, in Manhattan length "
3080 "(objects outside the box are activity-culled)");
3083 prop = RNA_def_property(srna, "show_debug_properties", PROP_BOOLEAN, PROP_NONE);
3084 RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_DEBUG_PROPS);
3085 RNA_def_property_ui_text(prop, "Show Debug Properties",
3086 "Show properties marked for debugging while the game runs");
3088 prop = RNA_def_property(srna, "show_framerate_profile", PROP_BOOLEAN, PROP_NONE);
3089 RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_FRAMERATE);
3090 RNA_def_property_ui_text(prop, "Show Framerate and Profile",
3091 "Show framerate and profiling information while the game runs");
3093 prop = RNA_def_property(srna, "show_physics_visualization", PROP_BOOLEAN, PROP_NONE);
3094 RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_PHYSICS);
3095 RNA_def_property_ui_text(prop, "Show Physics Visualization",
3096 "Show a visualization of physics bounds and interactions");
3098 prop = RNA_def_property(srna, "show_mouse", PROP_BOOLEAN, PROP_NONE);
3099 RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_MOUSE);
3100 RNA_def_property_ui_text(prop, "Show Mouse", "Start player with a visible mouse cursor");
3102 prop = RNA_def_property(srna, "use_frame_rate", PROP_BOOLEAN, PROP_NONE);
3103 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_ENABLE_ALL_FRAMES);
3104 RNA_def_property_ui_text(prop, "Use Frame Rate",
3105 "Respect the frame rate rather than rendering as many frames as possible");
3107 prop = RNA_def_property(srna, "use_display_lists", PROP_BOOLEAN, PROP_NONE);
3108 RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_DISPLAY_LISTS);
3109 RNA_def_property_ui_text(prop, "Display Lists",
3110 "Use display lists to speed up rendering by keeping geometry on the GPU");
3112 prop = RNA_def_property(srna, "use_deprecation_warnings", PROP_BOOLEAN, PROP_NONE);
3113 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_IGNORE_DEPRECATION_WARNINGS);
3114 RNA_def_property_ui_text(prop, "Deprecation Warnings",
3115 "Print warnings when using deprecated features in the python API");
3117 prop = RNA_def_property(srna, "use_animation_record", PROP_BOOLEAN, PROP_NONE);
3118 RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_ENABLE_ANIMATION_RECORD);
3119 RNA_def_property_ui_text(prop, "Record Animation", "Record animation to F-Curves");
3121 prop = RNA_def_property(srna, "use_auto_start", PROP_BOOLEAN, PROP_NONE);
3122 RNA_def_property_boolean_funcs(prop, "rna_GameSettings_auto_start_get", "rna_GameSettings_auto_start_set");
3123 RNA_def_property_ui_text(prop, "Auto Start", "Automatically start game at load time");
3125 prop = RNA_def_property(srna, "restrict_animation_updates", PROP_BOOLEAN, PROP_NONE);
3126 RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_RESTRICT_ANIM_UPDATES);
3127 RNA_def_property_ui_text(prop, "Restrict Animation Updates",
3128 "Restrict the number of animation updates to the animation FPS (this is "
3129 "better for performance, but can cause issues with smooth playback)");
3132 prop = RNA_def_property(srna, "material_mode", PROP_ENUM, PROP_NONE);
3133 RNA_def_property_enum_sdna(prop, NULL, "matmode");
3134 RNA_def_property_enum_items(prop, material_items);
3135 RNA_def_property_ui_text(prop, "Material Mode", "Material mode to use for rendering");
3136 RNA_def_property_update(prop, NC_SCENE | NA_EDITED, NULL);
3138 prop = RNA_def_property(srna, "use_glsl_lights", PROP_BOOLEAN, PROP_NONE);
3139 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_LIGHTS);