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 "DNA_brush_types.h"
30 #include "DNA_group_types.h"
31 #include "DNA_modifier_types.h"
32 #include "DNA_particle_types.h"
33 #include "DNA_rigidbody_types.h"
34 #include "DNA_scene_types.h"
35 #include "DNA_linestyle_types.h"
36 #include "DNA_userdef_types.h"
37 #include "DNA_world_types.h"
41 #include "BLF_translation.h"
43 #include "BKE_freestyle.h"
44 #include "BKE_editmesh.h"
45 #include "BKE_paint.h"
47 #include "RNA_define.h"
48 #include "RNA_enum_types.h"
50 #include "rna_internal.h"
52 /* Include for Bake Options */
53 #include "RE_engine.h"
54 #include "RE_pipeline.h"
57 #include "quicktime_export.h"
58 # ifdef WITH_AUDASPACE
59 # include "AUD_Space.h"
64 #include "BKE_writeffmpeg.h"
65 #include <libavcodec/avcodec.h>
66 #include <libavformat/avformat.h>
69 #include "ED_render.h"
74 #include "BLI_threads.h"
76 EnumPropertyItem uv_sculpt_relaxation_items[] = {
77 {UV_SCULPT_TOOL_RELAX_LAPLACIAN, "LAPLACIAN", 0, "Laplacian", "Use Laplacian method for relaxation"},
78 {UV_SCULPT_TOOL_RELAX_HC, "HC", 0, "HC", "Use HC method for relaxation"},
79 {0, NULL, 0, NULL, NULL}
82 EnumPropertyItem uv_sculpt_tool_items[] = {
83 {UV_SCULPT_TOOL_PINCH, "PINCH", 0, "Pinch", "Pinch UVs"},
84 {UV_SCULPT_TOOL_RELAX, "RELAX", 0, "Relax", "Relax UVs"},
85 {UV_SCULPT_TOOL_GRAB, "GRAB", 0, "Grab", "Grab UVs"},
86 {0, NULL, 0, NULL, NULL}
90 EnumPropertyItem snap_target_items[] = {
91 {SCE_SNAP_TARGET_CLOSEST, "CLOSEST", 0, "Closest", "Snap closest point onto target"},
92 {SCE_SNAP_TARGET_CENTER, "CENTER", 0, "Center", "Snap center onto target"},
93 {SCE_SNAP_TARGET_MEDIAN, "MEDIAN", 0, "Median", "Snap median onto target"},
94 {SCE_SNAP_TARGET_ACTIVE, "ACTIVE", 0, "Active", "Snap active onto target"},
95 {0, NULL, 0, NULL, NULL}
98 EnumPropertyItem proportional_falloff_items[] = {
99 {PROP_SMOOTH, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", "Smooth falloff"},
100 {PROP_SPHERE, "SPHERE", ICON_SPHERECURVE, "Sphere", "Spherical falloff"},
101 {PROP_ROOT, "ROOT", ICON_ROOTCURVE, "Root", "Root falloff"},
102 {PROP_SHARP, "SHARP", ICON_SHARPCURVE, "Sharp", "Sharp falloff"},
103 {PROP_LIN, "LINEAR", ICON_LINCURVE, "Linear", "Linear falloff"},
104 {PROP_CONST, "CONSTANT", ICON_NOCURVE, "Constant", "Constant falloff"},
105 {PROP_RANDOM, "RANDOM", ICON_RNDCURVE, "Random", "Random falloff"},
106 {0, NULL, 0, NULL, NULL}
109 /* subset of the enum - only curves, missing random and const */
110 EnumPropertyItem proportional_falloff_curve_only_items[] = {
111 {PROP_SMOOTH, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", "Smooth falloff"},
112 {PROP_SPHERE, "SPHERE", ICON_SPHERECURVE, "Sphere", "Spherical falloff"},
113 {PROP_ROOT, "ROOT", ICON_ROOTCURVE, "Root", "Root falloff"},
114 {PROP_SHARP, "SHARP", ICON_SHARPCURVE, "Sharp", "Sharp falloff"},
115 {PROP_LIN, "LINEAR", ICON_LINCURVE, "Linear", "Linear falloff"},
116 {0, NULL, 0, NULL, NULL}
120 EnumPropertyItem proportional_editing_items[] = {
121 {PROP_EDIT_OFF, "DISABLED", ICON_PROP_OFF, "Disable", "Proportional Editing disabled"},
122 {PROP_EDIT_ON, "ENABLED", ICON_PROP_ON, "Enable", "Proportional Editing enabled"},
123 {PROP_EDIT_PROJECTED, "PROJECTED", ICON_PROP_ON, "Projected (2D)",
124 "Proportional Editing using screen space locations"},
125 {PROP_EDIT_CONNECTED, "CONNECTED", ICON_PROP_CON, "Connected",
126 "Proportional Editing using connected geometry only"},
127 {0, NULL, 0, NULL, NULL}
130 /* keep for operators, not used here */
131 EnumPropertyItem mesh_select_mode_items[] = {
132 {SCE_SELECT_VERTEX, "VERTEX", ICON_VERTEXSEL, "Vertex", "Vertex selection mode"},
133 {SCE_SELECT_EDGE, "EDGE", ICON_EDGESEL, "Edge", "Edge selection mode"},
134 {SCE_SELECT_FACE, "FACE", ICON_FACESEL, "Face", "Face selection mode"},
135 {0, NULL, 0, NULL, NULL}
138 EnumPropertyItem snap_element_items[] = {
139 {SCE_SNAP_MODE_INCREMENT, "INCREMENT", ICON_SNAP_INCREMENT, "Increment", "Snap to increments of grid"},
140 {SCE_SNAP_MODE_VERTEX, "VERTEX", ICON_SNAP_VERTEX, "Vertex", "Snap to vertices"},
141 {SCE_SNAP_MODE_EDGE, "EDGE", ICON_SNAP_EDGE, "Edge", "Snap to edges"},
142 {SCE_SNAP_MODE_FACE, "FACE", ICON_SNAP_FACE, "Face", "Snap to faces"},
143 {SCE_SNAP_MODE_VOLUME, "VOLUME", ICON_SNAP_VOLUME, "Volume", "Snap to volume"},
144 {0, NULL, 0, NULL, NULL}
147 EnumPropertyItem snap_node_element_items[] = {
148 {SCE_SNAP_MODE_INCREMENT, "INCREMENT", ICON_SNAP_INCREMENT, "Increment", "Snap to increments of grid"},
149 {SCE_SNAP_MODE_NODE_X, "NODE_X", ICON_SNAP_EDGE, "Node X", "Snap to left/right node border"},
150 {SCE_SNAP_MODE_NODE_Y, "NODE_Y", ICON_SNAP_EDGE, "Node Y", "Snap to top/bottom node border"},
151 {SCE_SNAP_MODE_NODE_XY, "NODE_XY", ICON_SNAP_EDGE, "Node X / Y", "Snap to any node border"},
152 {0, NULL, 0, NULL, NULL}
155 EnumPropertyItem snap_uv_element_items[] = {
156 {SCE_SNAP_MODE_INCREMENT, "INCREMENT", ICON_SNAP_INCREMENT, "Increment", "Snap to increments of grid"},
157 {SCE_SNAP_MODE_VERTEX, "VERTEX", ICON_SNAP_VERTEX, "Vertex", "Snap to vertices"},
158 {0, NULL, 0, NULL, NULL}
161 /* workaround for duplicate enums,
162 * have each enum line as a defne then conditionally set it or not
165 #define R_IMF_ENUM_BMP {R_IMF_IMTYPE_BMP, "BMP", ICON_FILE_IMAGE, "BMP", "Output image in bitmap format"},
166 #define R_IMF_ENUM_IRIS {R_IMF_IMTYPE_IRIS, "IRIS", ICON_FILE_IMAGE, "Iris", \
167 "Output image in (old!) SGI IRIS format"},
168 #define R_IMF_ENUM_PNG {R_IMF_IMTYPE_PNG, "PNG", ICON_FILE_IMAGE, "PNG", "Output image in PNG format"},
169 #define R_IMF_ENUM_JPEG {R_IMF_IMTYPE_JPEG90, "JPEG", ICON_FILE_IMAGE, "JPEG", "Output image in JPEG format"},
170 #define R_IMF_ENUM_TAGA {R_IMF_IMTYPE_TARGA, "TARGA", ICON_FILE_IMAGE, "Targa", "Output image in Targa format"},
171 #define R_IMF_ENUM_TAGA_RAW {R_IMF_IMTYPE_RAWTGA, "TARGA_RAW", ICON_FILE_IMAGE, "Targa Raw", \
172 "Output image in uncompressed Targa format"},
174 #if 0 /* UNUSED (so far) */
176 # define R_IMF_ENUM_DDS {R_IMF_IMTYPE_DDS, "DDS", ICON_FILE_IMAGE, "DDS", "Output image in DDS format"},
178 # define R_IMF_ENUM_DDS
183 # define R_IMF_ENUM_JPEG2K {R_IMF_IMTYPE_JP2, "JPEG2000", ICON_FILE_IMAGE, "JPEG 2000", \
184 "Output image in JPEG 2000 format"},
186 # define R_IMF_ENUM_JPEG2K
190 # define R_IMF_ENUM_CINEON {R_IMF_IMTYPE_CINEON, "CINEON", ICON_FILE_IMAGE, "Cineon", \
191 "Output image in Cineon format"},
192 # define R_IMF_ENUM_DPX {R_IMF_IMTYPE_DPX, "DPX", ICON_FILE_IMAGE, "DPX", "Output image in DPX format"},
194 # define R_IMF_ENUM_CINEON
195 # define R_IMF_ENUM_DPX
199 # define R_IMF_ENUM_EXR_MULTI {R_IMF_IMTYPE_MULTILAYER, "OPEN_EXR_MULTILAYER", ICON_FILE_IMAGE, \
200 "OpenEXR MultiLayer", \
201 "Output image in multilayer OpenEXR format"},
202 # define R_IMF_ENUM_EXR {R_IMF_IMTYPE_OPENEXR, "OPEN_EXR", ICON_FILE_IMAGE, "OpenEXR", \
203 "Output image in OpenEXR format"},
205 # define R_IMF_ENUM_EXR_MULTI
206 # define R_IMF_ENUM_EXR
210 # define R_IMF_ENUM_HDR {R_IMF_IMTYPE_RADHDR, "HDR", ICON_FILE_IMAGE, "Radiance HDR", \
211 "Output image in Radiance HDR format"},
213 # define R_IMF_ENUM_HDR
217 # define R_IMF_ENUM_TIFF {R_IMF_IMTYPE_TIFF, "TIFF", ICON_FILE_IMAGE, "TIFF", "Output image in TIFF format"},
219 # define R_IMF_ENUM_TIFF
223 # define R_IMF_ENUM_PSD {R_IMF_IMTYPE_PSD, "PSD", ICON_FILE_IMAGE, "Photosp PSD", \
224 "Output image in Photoshop PSD format"},
226 # define R_IMF_ENUM_PSD
230 #define IMAGE_TYPE_ITEMS_IMAGE_ONLY \
232 /* DDS save not supported yet R_IMF_ENUM_DDS */ \
238 R_IMF_ENUM_TAGA_RAW \
239 {0, "", 0, " ", NULL}, \
242 R_IMF_ENUM_EXR_MULTI \
249 EnumPropertyItem image_only_type_items[] = {
251 IMAGE_TYPE_ITEMS_IMAGE_ONLY
253 {0, NULL, 0, NULL, NULL}
256 EnumPropertyItem image_type_items[] = {
257 {0, "", 0, N_("Image"), NULL},
259 IMAGE_TYPE_ITEMS_IMAGE_ONLY
261 {0, "", 0, N_("Movie"), NULL},
262 {R_IMF_IMTYPE_AVIJPEG, "AVI_JPEG", ICON_FILE_MOVIE, "AVI JPEG", "Output video in AVI JPEG format"},
263 {R_IMF_IMTYPE_AVIRAW, "AVI_RAW", ICON_FILE_MOVIE, "AVI Raw", "Output video in AVI Raw format"},
264 #ifdef WITH_FRAMESERVER
265 {R_IMF_IMTYPE_FRAMESERVER, "FRAMESERVER", ICON_FILE_SCRIPT, "Frame Server", "Output image to a frameserver"},
268 {R_IMF_IMTYPE_H264, "H264", ICON_FILE_MOVIE, "H.264", "Output video in H.264 format"},
269 {R_IMF_IMTYPE_FFMPEG, "FFMPEG", ICON_FILE_MOVIE, "MPEG", "Output video in MPEG format"},
270 {R_IMF_IMTYPE_THEORA, "THEORA", ICON_FILE_MOVIE, "Ogg Theora", "Output video in Ogg format"},
272 #ifdef WITH_QUICKTIME
274 {R_IMF_IMTYPE_QUICKTIME, "QUICKTIME_QTKIT", ICON_FILE_MOVIE, "QuickTime", "Output video in Quicktime format"},
276 {R_IMF_IMTYPE_QUICKTIME, "QUICKTIME_CARBON", ICON_FILE_MOVIE, "QuickTime", "Output video in Quicktime format"},
280 {R_IMF_IMTYPE_XVID, "XVID", ICON_FILE_MOVIE, "Xvid", "Output video in Xvid format"},
282 {0, NULL, 0, NULL, NULL}
285 EnumPropertyItem image_color_mode_items[] = {
286 {R_IMF_PLANES_BW, "BW", 0, "BW", "Images get saved in 8 bits grayscale (only PNG, JPEG, TGA, TIF)"},
287 {R_IMF_PLANES_RGB, "RGB", 0, "RGB", "Images are saved with RGB (color) data"},
288 {R_IMF_PLANES_RGBA, "RGBA", 0, "RGBA", "Images are saved with RGB and Alpha data (if supported)"},
289 {0, NULL, 0, NULL, NULL}
293 #define IMAGE_COLOR_MODE_BW image_color_mode_items[0]
294 #define IMAGE_COLOR_MODE_RGB image_color_mode_items[1]
295 #define IMAGE_COLOR_MODE_RGBA image_color_mode_items[2]
298 EnumPropertyItem image_color_depth_items[] = {
299 /* 1 (monochrome) not used */
300 {R_IMF_CHAN_DEPTH_8, "8", 0, "8", "8 bit color channels"},
301 {R_IMF_CHAN_DEPTH_10, "10", 0, "10", "10 bit color channels"},
302 {R_IMF_CHAN_DEPTH_12, "12", 0, "12", "12 bit color channels"},
303 {R_IMF_CHAN_DEPTH_16, "16", 0, "16", "16 bit color channels"},
305 {R_IMF_CHAN_DEPTH_32, "32", 0, "32", "32 bit color channels"},
306 {0, NULL, 0, NULL, NULL}
311 #include "DNA_anim_types.h"
312 #include "DNA_node_types.h"
313 #include "DNA_object_types.h"
314 #include "DNA_mesh_types.h"
316 #include "RNA_access.h"
318 #include "MEM_guardedalloc.h"
320 #include "BLI_threads.h"
322 #include "BKE_brush.h"
323 #include "BKE_context.h"
324 #include "BKE_global.h"
325 #include "BKE_image.h"
326 #include "BKE_main.h"
327 #include "BKE_node.h"
328 #include "BKE_pointcache.h"
329 #include "BKE_scene.h"
330 #include "BKE_depsgraph.h"
331 #include "BKE_image.h"
332 #include "BKE_mesh.h"
333 #include "BKE_sound.h"
334 #include "BKE_screen.h"
335 #include "BKE_sequencer.h"
336 #include "BKE_animsys.h"
342 #include "ED_view3d.h"
344 #include "ED_keyframing.h"
345 #include "ED_image.h"
347 #include "RE_engine.h"
349 static void rna_SpaceImageEditor_uv_sculpt_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr))
351 ED_space_image_uv_sculpt_update(bmain->wm.first, scene->toolsettings);
354 static int rna_Scene_object_bases_lookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr)
356 Scene *scene = (Scene *)ptr->data;
359 for (base = scene->base.first; base; base = base->next) {
360 if (strncmp(base->object->id.name + 2, key, sizeof(base->object->id.name) - 2) == 0) {
361 *r_ptr = rna_pointer_inherit_refine(ptr, &RNA_ObjectBase, base);
369 static PointerRNA rna_Scene_objects_get(CollectionPropertyIterator *iter)
371 ListBaseIterator *internal = iter->internal;
373 /* we are actually iterating a Base list, so override get */
374 return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, ((Base *)internal->link)->object);
377 static Base *rna_Scene_object_link(Scene *scene, bContext *C, ReportList *reports, Object *ob)
379 Scene *scene_act = CTX_data_scene(C);
382 if (BKE_scene_base_find(scene, ob)) {
383 BKE_reportf(reports, RPT_ERROR, "Object '%s' is already in scene '%s'", ob->id.name + 2, scene->id.name + 2);
387 base = BKE_scene_base_add(scene, ob);
390 /* this is similar to what object_add_type and BKE_object_add do */
391 base->lay = scene->lay;
393 /* when linking to an inactive scene don't touch the layer */
394 if (scene == scene_act)
397 DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
399 /* slows down importers too much, run scene.update() */
400 /* DAG_srelations_tag_update(G.main); */
402 WM_main_add_notifier(NC_SCENE | ND_OB_ACTIVE, scene);
407 static void rna_Scene_object_unlink(Scene *scene, ReportList *reports, Object *ob)
409 Base *base = BKE_scene_base_find(scene, ob);
411 BKE_reportf(reports, RPT_ERROR, "Object '%s' is not in this scene '%s'", ob->id.name + 2, scene->id.name + 2);
414 if (base == scene->basact && ob->mode != OB_MODE_OBJECT) {
415 BKE_reportf(reports, RPT_ERROR, "Object '%s' must be in object mode to unlink", ob->id.name + 2);
418 if (scene->basact == base) {
419 scene->basact = NULL;
422 BKE_scene_base_unlink(scene, base);
427 /* needed otherwise the depgraph will contain freed objects which can crash, see [#20958] */
428 DAG_relations_tag_update(G.main);
430 WM_main_add_notifier(NC_SCENE | ND_OB_ACTIVE, scene);
433 static void rna_Scene_skgen_etch_template_set(PointerRNA *ptr, PointerRNA value)
435 ToolSettings *ts = (ToolSettings *)ptr->data;
436 if (value.data && ((Object *)value.data)->type == OB_ARMATURE)
437 ts->skgen_template = value.data;
439 ts->skgen_template = NULL;
442 static PointerRNA rna_Scene_active_object_get(PointerRNA *ptr)
444 Scene *scene = (Scene *)ptr->data;
445 return rna_pointer_inherit_refine(ptr, &RNA_Object, scene->basact ? scene->basact->object : NULL);
448 static void rna_Scene_active_object_set(PointerRNA *ptr, PointerRNA value)
450 Scene *scene = (Scene *)ptr->data;
452 scene->basact = BKE_scene_base_find(scene, (Object *)value.data);
454 scene->basact = NULL;
457 static void rna_Scene_set_set(PointerRNA *ptr, PointerRNA value)
459 Scene *scene = (Scene *)ptr->data;
460 Scene *set = (Scene *)value.data;
463 for (nested_set = set; nested_set; nested_set = nested_set->set) {
464 if (nested_set == scene)
466 /* prevent eternal loops, set can point to next, and next to set, without problems usually */
467 if (nested_set->set == set)
474 static void rna_Scene_layer_set(PointerRNA *ptr, const int *values)
476 Scene *scene = (Scene *)ptr->data;
478 scene->lay = ED_view3d_scene_layer_set(scene->lay, values, &scene->layact);
481 static int rna_Scene_active_layer_get(PointerRNA *ptr)
483 Scene *scene = (Scene *)ptr->data;
485 return (int)(log(scene->layact) / M_LN2);
488 static void rna_Scene_view3d_update(Main *bmain, Scene *UNUSED(scene_unused), PointerRNA *ptr)
490 Scene *scene = (Scene *)ptr->data;
492 BKE_screen_view3d_main_sync(&bmain->screen, scene);
495 static void rna_Scene_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
497 rna_Scene_view3d_update(bmain, scene, ptr);
498 /* XXX We would need do_time=true here, else we can have update issues like [#36289]...
499 * However, this has too much drawbacks (like slower layer switch, undesired updates...).
500 * That's TODO for future DAG updates.
502 DAG_on_visible_update(bmain, false);
505 static void rna_Scene_fps_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
507 sound_update_fps(scene);
508 BKE_sequencer_update_sound_bounds_all(scene);
511 static void rna_Scene_listener_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
513 sound_update_scene_listener(scene);
516 static void rna_Scene_volume_set(PointerRNA *ptr, float value)
518 Scene *scene = (Scene *)(ptr->data);
520 scene->audio.volume = value;
521 if (scene->sound_scene)
522 sound_set_scene_volume(scene, value);
525 static void rna_Scene_framelen_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
527 scene->r.framelen = (float)scene->r.framapto / (float)scene->r.images;
531 static void rna_Scene_frame_current_set(PointerRNA *ptr, int value)
533 Scene *data = (Scene *)ptr->data;
535 /* if negative frames aren't allowed, then we can't use them */
536 FRAMENUMBER_MIN_CLAMP(value);
537 data->r.cfra = value;
540 static float rna_Scene_frame_current_final_get(PointerRNA *ptr)
542 Scene *scene = (Scene *)ptr->data;
544 return BKE_scene_frame_get_from_ctime(scene, (float)scene->r.cfra);
547 static void rna_Scene_start_frame_set(PointerRNA *ptr, int value)
549 Scene *data = (Scene *)ptr->data;
550 /* MINFRAME not MINAFRAME, since some output formats can't taken negative frames */
551 CLAMP(value, MINFRAME, MAXFRAME);
552 data->r.sfra = value;
554 if (data->r.sfra >= data->r.efra) {
555 data->r.efra = MIN2(data->r.sfra, MAXFRAME);
559 static void rna_Scene_end_frame_set(PointerRNA *ptr, int value)
561 Scene *data = (Scene *)ptr->data;
562 CLAMP(value, MINFRAME, MAXFRAME);
563 data->r.efra = value;
565 if (data->r.sfra >= data->r.efra) {
566 data->r.sfra = MAX2(data->r.efra, MINFRAME);
570 static void rna_Scene_use_preview_range_set(PointerRNA *ptr, int value)
572 Scene *data = (Scene *)ptr->data;
575 /* copy range from scene if not set before */
576 if ((data->r.psfra == data->r.pefra) && (data->r.psfra == 0)) {
577 data->r.psfra = data->r.sfra;
578 data->r.pefra = data->r.efra;
581 data->r.flag |= SCER_PRV_RANGE;
584 data->r.flag &= ~SCER_PRV_RANGE;
588 static void rna_Scene_preview_range_start_frame_set(PointerRNA *ptr, int value)
590 Scene *data = (Scene *)ptr->data;
592 /* check if enabled already */
593 if ((data->r.flag & SCER_PRV_RANGE) == 0) {
594 /* set end of preview range to end frame, then clamp as per normal */
595 /* TODO: or just refuse to set instead? */
596 data->r.pefra = data->r.efra;
599 /* now set normally */
600 CLAMP(value, MINAFRAME, data->r.pefra);
601 data->r.psfra = value;
604 static void rna_Scene_preview_range_end_frame_set(PointerRNA *ptr, int value)
606 Scene *data = (Scene *)ptr->data;
608 /* check if enabled already */
609 if ((data->r.flag & SCER_PRV_RANGE) == 0) {
610 /* set start of preview range to start frame, then clamp as per normal */
611 /* TODO: or just refuse to set instead? */
612 data->r.psfra = data->r.sfra;
615 /* now set normally */
616 CLAMP(value, data->r.psfra, MAXFRAME);
617 data->r.pefra = value;
620 static void rna_Scene_frame_update(Main *bmain, Scene *UNUSED(current_scene), PointerRNA *ptr)
622 Scene *scene = (Scene *)ptr->id.data;
623 sound_seek_scene(bmain, scene);
626 static PointerRNA rna_Scene_active_keying_set_get(PointerRNA *ptr)
628 Scene *scene = (Scene *)ptr->data;
629 return rna_pointer_inherit_refine(ptr, &RNA_KeyingSet, ANIM_scene_get_active_keyingset(scene));
632 static void rna_Scene_active_keying_set_set(PointerRNA *ptr, PointerRNA value)
634 Scene *scene = (Scene *)ptr->data;
635 KeyingSet *ks = (KeyingSet *)value.data;
637 scene->active_keyingset = ANIM_scene_get_keyingset_index(scene, ks);
640 /* get KeyingSet index stuff for list of Keying Sets editing UI
641 * - active_keyingset-1 since 0 is reserved for 'none'
642 * - don't clamp, otherwise can never set builtins types as active...
644 static int rna_Scene_active_keying_set_index_get(PointerRNA *ptr)
646 Scene *scene = (Scene *)ptr->data;
647 return scene->active_keyingset - 1;
650 /* get KeyingSet index stuff for list of Keying Sets editing UI
651 * - value+1 since 0 is reserved for 'none'
653 static void rna_Scene_active_keying_set_index_set(PointerRNA *ptr, int value)
655 Scene *scene = (Scene *)ptr->data;
656 scene->active_keyingset = value + 1;
659 /* XXX: evil... builtin_keyingsets is defined in keyingsets.c! */
660 /* TODO: make API function to retrieve this... */
661 extern ListBase builtin_keyingsets;
663 static void rna_Scene_all_keyingsets_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
665 Scene *scene = (Scene *)ptr->data;
667 /* start going over the scene KeyingSets first, while we still have pointer to it
668 * but only if we have any Keying Sets to use...
670 if (scene->keyingsets.first)
671 rna_iterator_listbase_begin(iter, &scene->keyingsets, NULL);
673 rna_iterator_listbase_begin(iter, &builtin_keyingsets, NULL);
676 static void rna_Scene_all_keyingsets_next(CollectionPropertyIterator *iter)
678 ListBaseIterator *internal = iter->internal;
679 KeyingSet *ks = (KeyingSet *)internal->link;
681 /* if we've run out of links in Scene list, jump over to the builtins list unless we're there already */
682 if ((ks->next == NULL) && (ks != builtin_keyingsets.last))
683 internal->link = (Link *)builtin_keyingsets.first;
685 internal->link = (Link *)ks->next;
687 iter->valid = (internal->link != NULL);
690 static char *rna_RenderSettings_path(PointerRNA *UNUSED(ptr))
692 return BLI_sprintfN("render");
695 static int rna_RenderSettings_threads_get(PointerRNA *ptr)
697 RenderData *rd = (RenderData *)ptr->data;
698 return BKE_render_num_threads(rd);
701 static int rna_RenderSettings_threads_mode_get(PointerRNA *ptr)
703 RenderData *rd = (RenderData *)ptr->data;
704 int override = BLI_system_num_threads_override_get();
707 return R_FIXED_THREADS;
709 return (rd->mode & R_FIXED_THREADS);
712 static int rna_RenderSettings_is_movie_fomat_get(PointerRNA *ptr)
714 RenderData *rd = (RenderData *)ptr->data;
715 return BKE_imtype_is_movie(rd->im_format.imtype);
718 static int rna_RenderSettings_save_buffers_get(PointerRNA *ptr)
720 RenderData *rd = (RenderData *)ptr->data;
721 Scene *scene = (Scene *)ptr->id.data;
723 if (rd->mode & R_BORDER)
725 else if (!BKE_scene_use_new_shading_nodes(scene))
726 return (rd->scemode & (R_EXR_TILE_FILE | R_FULL_SAMPLE)) != 0;
728 return (rd->scemode & R_EXR_TILE_FILE);
731 static int rna_RenderSettings_full_sample_get(PointerRNA *ptr)
733 RenderData *rd = (RenderData *)ptr->data;
735 return (rd->scemode & R_FULL_SAMPLE) && !(rd->mode & R_BORDER);
738 static void rna_ImageFormatSettings_file_format_set(PointerRNA *ptr, int value)
740 ImageFormatData *imf = (ImageFormatData *)ptr->data;
741 ID *id = ptr->id.data;
742 const char is_render = (id && GS(id->name) == ID_SCE);
743 /* see note below on why this is */
744 const char chan_flag = BKE_imtype_valid_channels(imf->imtype) | (is_render ? IMA_CHAN_FLAG_BW : 0);
748 /* ensure depth and color settings match */
749 if ( ((imf->planes == R_IMF_PLANES_BW) && !(chan_flag & IMA_CHAN_FLAG_BW)) ||
750 ((imf->planes == R_IMF_PLANES_RGBA) && !(chan_flag & IMA_CHAN_FLAG_ALPHA)))
752 imf->planes = R_IMF_PLANES_RGB;
755 /* ensure usable depth */
757 const int depth_ok = BKE_imtype_valid_depths(imf->imtype);
758 if ((imf->depth & depth_ok) == 0) {
759 /* set first available depth */
760 char depth_ls[] = {R_IMF_CHAN_DEPTH_32,
770 for (i = 0; depth_ls[i]; i++) {
771 if (depth_ok & depth_ls[i]) {
772 imf->depth = depth_ls[i];
779 if (id && GS(id->name) == ID_SCE) {
780 Scene *scene = ptr->id.data;
781 RenderData *rd = &scene->r;
783 BKE_ffmpeg_image_type_verify(rd, imf);
785 #ifdef WITH_QUICKTIME
786 quicktime_verify_image_type(rd, imf);
792 static EnumPropertyItem *rna_ImageFormatSettings_file_format_itemf(bContext *UNUSED(C), PointerRNA *ptr,
793 PropertyRNA *UNUSED(prop), int *UNUSED(free))
795 ID *id = ptr->id.data;
796 if (id && GS(id->name) == ID_SCE) {
797 return image_type_items;
800 return image_only_type_items;
804 static EnumPropertyItem *rna_ImageFormatSettings_color_mode_itemf(bContext *UNUSED(C), PointerRNA *ptr,
805 PropertyRNA *UNUSED(prop), int *free)
807 ImageFormatData *imf = (ImageFormatData *)ptr->data;
808 ID *id = ptr->id.data;
809 const char is_render = (id && GS(id->name) == ID_SCE);
811 /* note, we need to act differently for render
812 * where 'BW' will force grayscale even if the output format writes
813 * as RGBA, this is age old blender convention and not sure how useful
814 * it really is but keep it for now - campbell */
815 char chan_flag = BKE_imtype_valid_channels(imf->imtype) | (is_render ? IMA_CHAN_FLAG_BW : 0);
818 /* a WAY more crappy case than B&W flag: depending on codec, file format MIGHT support
819 * alpha channel. for example MPEG format with h264 codec can't do alpha channel, but
820 * the same MPEG format with QTRLE codec can easily handle alpha channel.
821 * not sure how to deal with such cases in a nicer way (sergey) */
823 Scene *scene = ptr->id.data;
824 RenderData *rd = &scene->r;
826 if (BKE_ffmpeg_alpha_channel_is_supported(rd))
827 chan_flag |= IMA_CHAN_FLAG_ALPHA;
831 if (chan_flag == (IMA_CHAN_FLAG_BW | IMA_CHAN_FLAG_RGB | IMA_CHAN_FLAG_ALPHA)) {
832 return image_color_mode_items;
836 EnumPropertyItem *item = NULL;
838 if (chan_flag & IMA_CHAN_FLAG_BW) RNA_enum_item_add(&item, &totitem, &IMAGE_COLOR_MODE_BW);
839 if (chan_flag & IMA_CHAN_FLAG_RGB) RNA_enum_item_add(&item, &totitem, &IMAGE_COLOR_MODE_RGB);
840 if (chan_flag & IMA_CHAN_FLAG_ALPHA) RNA_enum_item_add(&item, &totitem, &IMAGE_COLOR_MODE_RGBA);
842 RNA_enum_item_end(&item, &totitem);
849 static EnumPropertyItem *rna_ImageFormatSettings_color_depth_itemf(bContext *UNUSED(C), PointerRNA *ptr,
850 PropertyRNA *UNUSED(prop), int *free)
852 ImageFormatData *imf = (ImageFormatData *)ptr->data;
855 return image_color_depth_items;
858 const int depth_ok = BKE_imtype_valid_depths(imf->imtype);
859 const int is_float = ELEM3(imf->imtype, R_IMF_IMTYPE_RADHDR, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER);
861 EnumPropertyItem *item_8bit = &image_color_depth_items[0];
862 EnumPropertyItem *item_10bit = &image_color_depth_items[1];
863 EnumPropertyItem *item_12bit = &image_color_depth_items[2];
864 EnumPropertyItem *item_16bit = &image_color_depth_items[3];
865 EnumPropertyItem *item_32bit = &image_color_depth_items[4];
868 EnumPropertyItem *item = NULL;
869 EnumPropertyItem tmp = {0, "", 0, "", ""};
871 if (depth_ok & R_IMF_CHAN_DEPTH_8) {
872 RNA_enum_item_add(&item, &totitem, item_8bit);
875 if (depth_ok & R_IMF_CHAN_DEPTH_10) {
876 RNA_enum_item_add(&item, &totitem, item_10bit);
879 if (depth_ok & R_IMF_CHAN_DEPTH_12) {
880 RNA_enum_item_add(&item, &totitem, item_12bit);
883 if (depth_ok & R_IMF_CHAN_DEPTH_16) {
886 tmp.name = "Float (Half)";
887 RNA_enum_item_add(&item, &totitem, &tmp);
890 RNA_enum_item_add(&item, &totitem, item_16bit);
894 if (depth_ok & R_IMF_CHAN_DEPTH_32) {
897 tmp.name = "Float (Full)";
898 RNA_enum_item_add(&item, &totitem, &tmp);
901 RNA_enum_item_add(&item, &totitem, item_32bit);
905 RNA_enum_item_end(&item, &totitem);
912 static int rna_SceneRender_file_ext_length(PointerRNA *ptr)
914 RenderData *rd = (RenderData *)ptr->data;
917 BKE_add_image_extension(ext, &rd->im_format);
921 static void rna_SceneRender_file_ext_get(PointerRNA *ptr, char *str)
923 RenderData *rd = (RenderData *)ptr->data;
925 BKE_add_image_extension(str, &rd->im_format);
928 #ifdef WITH_QUICKTIME
929 static int rna_RenderSettings_qtcodecsettings_codecType_get(PointerRNA *ptr)
931 QuicktimeCodecSettings *settings = (QuicktimeCodecSettings *)ptr->data;
933 return quicktime_rnatmpvalue_from_videocodectype(settings->codecType);
936 static void rna_RenderSettings_qtcodecsettings_codecType_set(PointerRNA *ptr, int value)
938 QuicktimeCodecSettings *settings = (QuicktimeCodecSettings *)ptr->data;
940 settings->codecType = quicktime_videocodecType_from_rnatmpvalue(value);
943 static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_codecType_itemf(bContext *C, PointerRNA *ptr,
944 PropertyRNA *UNUSED(prop), int *free)
946 EnumPropertyItem *item = NULL;
947 EnumPropertyItem tmp = {0, "", 0, "", ""};
948 QuicktimeCodecTypeDesc *codecTypeDesc;
949 int i = 1, totitem = 0;
951 for (i = 0; i < quicktime_get_num_videocodecs(); i++) {
952 codecTypeDesc = quicktime_get_videocodecType_desc(i);
953 if (!codecTypeDesc) break;
955 tmp.value = codecTypeDesc->rnatmpvalue;
956 tmp.identifier = codecTypeDesc->codecName;
957 tmp.name = codecTypeDesc->codecName;
958 RNA_enum_item_add(&item, &totitem, &tmp);
961 RNA_enum_item_end(&item, &totitem);
968 static int rna_RenderSettings_qtcodecsettings_audiocodecType_get(PointerRNA *ptr)
970 QuicktimeCodecSettings *settings = (QuicktimeCodecSettings *)ptr->data;
972 return quicktime_rnatmpvalue_from_audiocodectype(settings->audiocodecType);
975 static void rna_RenderSettings_qtcodecsettings_audiocodecType_set(PointerRNA *ptr, int value)
977 QuicktimeCodecSettings *settings = (QuicktimeCodecSettings *)ptr->data;
979 settings->audiocodecType = quicktime_audiocodecType_from_rnatmpvalue(value);
982 static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_audiocodecType_itemf(bContext *C, PointerRNA *ptr,
983 PropertyRNA *UNUSED(prop), int *free)
985 EnumPropertyItem *item = NULL;
986 EnumPropertyItem tmp = {0, "", 0, "", ""};
987 QuicktimeCodecTypeDesc *codecTypeDesc;
988 int i = 1, totitem = 0;
990 for (i = 0; i < quicktime_get_num_audiocodecs(); i++) {
991 codecTypeDesc = quicktime_get_audiocodecType_desc(i);
992 if (!codecTypeDesc) break;
994 tmp.value = codecTypeDesc->rnatmpvalue;
995 tmp.identifier = codecTypeDesc->codecName;
996 tmp.name = codecTypeDesc->codecName;
997 RNA_enum_item_add(&item, &totitem, &tmp);
1000 RNA_enum_item_end(&item, &totitem);
1009 static void rna_FFmpegSettings_lossless_output_set(PointerRNA *ptr, int value)
1011 Scene *scene = (Scene *) ptr->id.data;
1012 RenderData *rd = &scene->r;
1015 rd->ffcodecdata.flags |= FFMPEG_LOSSLESS_OUTPUT;
1017 rd->ffcodecdata.flags &= ~FFMPEG_LOSSLESS_OUTPUT;
1019 BKE_ffmpeg_codec_settings_verify(rd);
1022 static void rna_FFmpegSettings_codec_settings_update(Main *UNUSED(bmain), Scene *UNUSED(scene_unused), PointerRNA *ptr)
1024 Scene *scene = (Scene *) ptr->id.data;
1025 RenderData *rd = &scene->r;
1027 BKE_ffmpeg_codec_settings_verify(rd);
1031 static int rna_RenderSettings_active_layer_index_get(PointerRNA *ptr)
1033 RenderData *rd = (RenderData *)ptr->data;
1037 static void rna_RenderSettings_active_layer_index_set(PointerRNA *ptr, int value)
1039 RenderData *rd = (RenderData *)ptr->data;
1043 static void rna_RenderSettings_active_layer_index_range(PointerRNA *ptr, int *min, int *max,
1044 int *UNUSED(softmin), int *UNUSED(softmax))
1046 RenderData *rd = (RenderData *)ptr->data;
1049 *max = max_ii(0, BLI_countlist(&rd->layers) - 1);
1052 static PointerRNA rna_RenderSettings_active_layer_get(PointerRNA *ptr)
1054 RenderData *rd = (RenderData *)ptr->data;
1055 SceneRenderLayer *srl = BLI_findlink(&rd->layers, rd->actlay);
1057 return rna_pointer_inherit_refine(ptr, &RNA_SceneRenderLayer, srl);
1060 static void rna_RenderSettings_active_layer_set(PointerRNA *ptr, PointerRNA value)
1062 RenderData *rd = (RenderData *)ptr->data;
1063 SceneRenderLayer *srl = (SceneRenderLayer *)value.data;
1064 const int index = BLI_findindex(&rd->layers, srl);
1065 if (index != -1) rd->actlay = index;
1068 static SceneRenderLayer *rna_RenderLayer_new(ID *id, RenderData *UNUSED(rd), const char *name)
1070 Scene *scene = (Scene *)id;
1071 SceneRenderLayer *srl = BKE_scene_add_render_layer(scene, name);
1073 WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
1078 static void rna_RenderLayer_remove(ID *id, RenderData *UNUSED(rd), Main *bmain, ReportList *reports,
1079 PointerRNA *srl_ptr)
1081 SceneRenderLayer *srl = srl_ptr->data;
1082 Scene *scene = (Scene *)id;
1084 if (!BKE_scene_remove_render_layer(bmain, scene, srl)) {
1085 BKE_reportf(reports, RPT_ERROR, "Render layer '%s' could not be removed from scene '%s'",
1086 srl->name, scene->id.name + 2);
1090 RNA_POINTER_INVALIDATE(srl_ptr);
1092 WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
1095 static void rna_RenderSettings_engine_set(PointerRNA *ptr, int value)
1097 RenderData *rd = (RenderData *)ptr->data;
1098 RenderEngineType *type = BLI_findlink(&R_engines, value);
1101 BLI_strncpy_utf8(rd->engine, type->idname, sizeof(rd->engine));
1104 static EnumPropertyItem *rna_RenderSettings_engine_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr),
1105 PropertyRNA *UNUSED(prop), int *free)
1107 RenderEngineType *type;
1108 EnumPropertyItem *item = NULL;
1109 EnumPropertyItem tmp = {0, "", 0, "", ""};
1110 int a = 0, totitem = 0;
1112 for (type = R_engines.first; type; type = type->next, a++) {
1114 tmp.identifier = type->idname;
1115 tmp.name = type->name;
1116 RNA_enum_item_add(&item, &totitem, &tmp);
1119 RNA_enum_item_end(&item, &totitem);
1125 static int rna_RenderSettings_engine_get(PointerRNA *ptr)
1127 RenderData *rd = (RenderData *)ptr->data;
1128 RenderEngineType *type;
1131 for (type = R_engines.first; type; type = type->next, a++)
1132 if (strcmp(type->idname, rd->engine) == 0)
1138 static void rna_RenderSettings_engine_update(Main *bmain, Scene *UNUSED(unused), PointerRNA *UNUSED(ptr))
1140 ED_render_engine_changed(bmain);
1143 static void rna_Scene_glsl_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1145 Scene *scene = (Scene *)ptr->id.data;
1147 DAG_id_tag_update(&scene->id, 0);
1150 static void rna_SceneRenderLayer_name_set(PointerRNA *ptr, const char *value)
1152 Scene *scene = (Scene *)ptr->id.data;
1153 SceneRenderLayer *rl = (SceneRenderLayer *)ptr->data;
1154 char oldname[sizeof(rl->name)];
1156 BLI_strncpy(oldname, rl->name, sizeof(rl->name));
1158 BLI_strncpy_utf8(rl->name, value, sizeof(rl->name));
1159 BLI_uniquename(&scene->r.layers, rl, DATA_("RenderLayer"), '.', offsetof(SceneRenderLayer, name), sizeof(rl->name));
1161 if (scene->nodetree) {
1163 int index = BLI_findindex(&scene->r.layers, rl);
1165 for (node = scene->nodetree->nodes.first; node; node = node->next) {
1166 if (node->type == CMP_NODE_R_LAYERS && node->id == NULL) {
1167 if (node->custom1 == index)
1168 BLI_strncpy(node->name, rl->name, NODE_MAXSTR);
1173 /* fix all the animation data which may link to this */
1174 BKE_all_animdata_fix_paths_rename(NULL, "render.layers", oldname, rl->name);
1177 static char *rna_SceneRenderLayer_path(PointerRNA *ptr)
1179 SceneRenderLayer *srl = (SceneRenderLayer *)ptr->data;
1180 char name_esc[sizeof(srl->name) * 2];
1182 BLI_strescape(name_esc, srl->name, sizeof(name_esc));
1183 return BLI_sprintfN("render.layers[\"%s\"]", name_esc);
1186 static int rna_RenderSettings_multiple_engines_get(PointerRNA *UNUSED(ptr))
1188 return (BLI_countlist(&R_engines) > 1);
1191 static int rna_RenderSettings_use_shading_nodes_get(PointerRNA *ptr)
1193 Scene *scene = (Scene *)ptr->id.data;
1194 return BKE_scene_use_new_shading_nodes(scene);
1197 static int rna_RenderSettings_use_game_engine_get(PointerRNA *ptr)
1199 RenderData *rd = (RenderData *)ptr->data;
1200 RenderEngineType *type;
1202 for (type = R_engines.first; type; type = type->next)
1203 if (strcmp(type->idname, rd->engine) == 0)
1204 return (type->flag & RE_GAME);
1209 static void rna_SceneRenderLayer_layer_set(PointerRNA *ptr, const int *values)
1211 SceneRenderLayer *rl = (SceneRenderLayer *)ptr->data;
1212 rl->lay = ED_view3d_scene_layer_set(rl->lay, values, NULL);
1215 static void rna_SceneRenderLayer_pass_update(Main *bmain, Scene *activescene, PointerRNA *ptr)
1217 Scene *scene = (Scene *)ptr->id.data;
1219 if (scene->nodetree)
1220 ntreeCompositForceHidden(scene->nodetree);
1222 rna_Scene_glsl_update(bmain, activescene, ptr);
1225 static void rna_Scene_use_nodes_update(bContext *C, PointerRNA *ptr)
1227 Scene *scene = (Scene *)ptr->data;
1229 if (scene->use_nodes && scene->nodetree == NULL)
1230 ED_node_composit_default(C, scene);
1233 static void rna_Physics_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1235 Scene *scene = (Scene *)ptr->id.data;
1238 for (base = scene->base.first; base; base = base->next)
1239 BKE_ptcache_object_reset(scene, base->object, PTCACHE_RESET_DEPSGRAPH);
1242 static void rna_Scene_editmesh_select_mode_set(PointerRNA *ptr, const int *value)
1244 Scene *scene = (Scene *)ptr->id.data;
1245 ToolSettings *ts = (ToolSettings *)ptr->data;
1246 int flag = (value[0] ? SCE_SELECT_VERTEX : 0) | (value[1] ? SCE_SELECT_EDGE : 0) | (value[2] ? SCE_SELECT_FACE : 0);
1249 ts->selectmode = flag;
1251 if (scene->basact) {
1252 Mesh *me = BKE_mesh_from_object(scene->basact->object);
1253 if (me && me->edit_btmesh && me->edit_btmesh->selectmode != flag) {
1254 me->edit_btmesh->selectmode = flag;
1255 EDBM_selectmode_set(me->edit_btmesh);
1261 static void rna_Scene_editmesh_select_mode_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
1265 if (scene->basact) {
1266 me = BKE_mesh_from_object(scene->basact->object);
1267 if (me && me->edit_btmesh == NULL)
1271 WM_main_add_notifier(NC_GEOM | ND_SELECT, me);
1272 WM_main_add_notifier(NC_SCENE | ND_TOOLSETTINGS, NULL);
1275 static void object_simplify_update(Object *ob)
1278 ParticleSystem *psys;
1280 if ((ob->id.flag & LIB_DOIT) == 0) {
1284 ob->id.flag &= ~LIB_DOIT;
1286 for (md = ob->modifiers.first; md; md = md->next) {
1287 if (ELEM3(md->type, eModifierType_Subsurf, eModifierType_Multires, eModifierType_ParticleSystem)) {
1288 ob->recalc |= PSYS_RECALC_CHILD;
1289 DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
1293 for (psys = ob->particlesystem.first; psys; psys = psys->next)
1294 psys->recalc |= PSYS_RECALC_CHILD;
1296 if (ob->dup_group) {
1299 for (gob = ob->dup_group->gobject.first; gob; gob = gob->next)
1300 object_simplify_update(gob->ob);
1304 static void rna_Scene_use_simplify_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
1306 Scene *sce = ptr->id.data;
1310 tag_main_lb(&bmain->object, TRUE);
1311 for (SETLOOPER(sce, sce_iter, base))
1312 object_simplify_update(base->object);
1314 WM_main_add_notifier(NC_GEOM | ND_DATA, NULL);
1317 static void rna_Scene_simplify_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
1319 Scene *sce = ptr->id.data;
1321 if (sce->r.mode & R_SIMPLIFY)
1322 rna_Scene_use_simplify_update(bmain, sce, ptr);
1325 static void rna_Scene_use_persistent_data_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1327 Scene *sce = ptr->id.data;
1329 if (!(sce->r.mode & R_PERSISTENT_DATA))
1330 RE_FreePersistentData();
1333 static int rna_Scene_use_audio_get(PointerRNA *ptr)
1335 Scene *scene = (Scene *)ptr->data;
1336 return scene->audio.flag & AUDIO_MUTE;
1339 static void rna_Scene_use_audio_set(PointerRNA *ptr, int value)
1341 Scene *scene = (Scene *)ptr->data;
1344 scene->audio.flag |= AUDIO_MUTE;
1346 scene->audio.flag &= ~AUDIO_MUTE;
1348 sound_mute_scene(scene, value);
1351 static int rna_Scene_sync_mode_get(PointerRNA *ptr)
1353 Scene *scene = (Scene *)ptr->data;
1354 if (scene->audio.flag & AUDIO_SYNC)
1356 return scene->flag & SCE_FRAME_DROP;
1359 static void rna_Scene_sync_mode_set(PointerRNA *ptr, int value)
1361 Scene *scene = (Scene *)ptr->data;
1363 if (value == AUDIO_SYNC) {
1364 scene->audio.flag |= AUDIO_SYNC;
1366 else if (value == SCE_FRAME_DROP) {
1367 scene->audio.flag &= ~AUDIO_SYNC;
1368 scene->flag |= SCE_FRAME_DROP;
1371 scene->audio.flag &= ~AUDIO_SYNC;
1372 scene->flag &= ~SCE_FRAME_DROP;
1376 static int rna_GameSettings_auto_start_get(PointerRNA *UNUSED(ptr))
1378 if (G.fileflags & G_FILE_AUTOPLAY)
1384 static void rna_GameSettings_auto_start_set(PointerRNA *UNUSED(ptr), int value)
1387 G.fileflags |= G_FILE_AUTOPLAY;
1389 G.fileflags &= ~G_FILE_AUTOPLAY;
1392 static void rna_GameSettings_exit_key_set(PointerRNA *ptr, int value)
1394 GameData *gm = (GameData *)ptr->data;
1396 if (ISKEYBOARD(value))
1397 gm->exitkey = value;
1400 static TimeMarker *rna_TimeLine_add(Scene *scene, const char name[])
1402 TimeMarker *marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker");
1403 marker->flag = SELECT;
1405 BLI_strncpy_utf8(marker->name, name, sizeof(marker->name));
1406 BLI_addtail(&scene->markers, marker);
1408 WM_main_add_notifier(NC_SCENE | ND_MARKERS, NULL);
1409 WM_main_add_notifier(NC_ANIMATION | ND_MARKERS, NULL);
1414 static void rna_TimeLine_remove(Scene *scene, ReportList *reports, PointerRNA *marker_ptr)
1416 TimeMarker *marker = marker_ptr->data;
1417 if (BLI_remlink_safe(&scene->markers, marker) == FALSE) {
1418 BKE_reportf(reports, RPT_ERROR, "Timeline marker '%s' not found in scene '%s'",
1419 marker->name, scene->id.name + 2);
1424 RNA_POINTER_INVALIDATE(marker_ptr);
1426 WM_main_add_notifier(NC_SCENE | ND_MARKERS, NULL);
1427 WM_main_add_notifier(NC_ANIMATION | ND_MARKERS, NULL);
1430 static void rna_TimeLine_clear(Scene *scene)
1432 BLI_freelistN(&scene->markers);
1434 WM_main_add_notifier(NC_SCENE | ND_MARKERS, NULL);
1435 WM_main_add_notifier(NC_ANIMATION | ND_MARKERS, NULL);
1438 static KeyingSet *rna_Scene_keying_set_new(Scene *sce, ReportList *reports, const char idname[], const char name[])
1440 KeyingSet *ks = NULL;
1442 /* call the API func, and set the active keyingset index */
1443 ks = BKE_keyingset_add(&sce->keyingsets, idname, name, KEYINGSET_ABSOLUTE, 0);
1446 sce->active_keyingset = BLI_countlist(&sce->keyingsets);
1450 BKE_report(reports, RPT_ERROR, "Keying set could not be added");
1455 static void rna_UnifiedPaintSettings_size_set(PointerRNA *ptr, int value)
1457 UnifiedPaintSettings *ups = ptr->data;
1459 /* scale unprojected radius so it stays consistent with brush size */
1460 BKE_brush_scale_unprojected_radius(&ups->unprojected_radius,
1465 static void rna_UnifiedPaintSettings_unprojected_radius_set(PointerRNA *ptr, float value)
1467 UnifiedPaintSettings *ups = ptr->data;
1469 /* scale brush size so it stays consistent with unprojected_radius */
1470 BKE_brush_scale_size(&ups->size, value, ups->unprojected_radius);
1471 ups->unprojected_radius = value;
1474 static void rna_UnifiedPaintSettings_radius_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
1476 /* changing the unified size should invalidate */
1477 BKE_paint_invalidate_overlay_all();
1480 static char *rna_UnifiedPaintSettings_path(PointerRNA *UNUSED(ptr))
1482 return BLI_strdup("tool_settings.unified_paint_settings");
1485 /* generic function to recalc geometry */
1486 static void rna_EditMesh_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
1490 if (scene->basact) {
1491 me = BKE_mesh_from_object(scene->basact->object);
1492 if (me && me->edit_btmesh == NULL)
1497 DAG_id_tag_update(&me->id, OB_RECALC_DATA);
1498 WM_main_add_notifier(NC_GEOM | ND_DATA, me);
1502 static char *rna_MeshStatVis_path(PointerRNA *UNUSED(ptr))
1504 return BLI_strdup("tool_settings.statvis");
1507 /* note: without this, when Multi-Paint is activated/deactivated, the colors
1508 * will not change right away when multiple bones are selected, this function
1509 * is not for general use and only for the few cases where changing scene
1510 * settings and NOT for general purpose updates, possibly this should be
1511 * given its own notifier. */
1512 static void rna_Scene_update_active_object_data(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
1516 DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
1517 WM_main_add_notifier(NC_OBJECT | ND_DRAW, &ob->id);
1521 static void rna_SceneCamera_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1523 Scene *scene = (Scene *)ptr->id.data;
1524 Object *camera = scene->camera;
1527 DAG_id_tag_update(&camera->id, 0);
1530 static void rna_SceneSequencer_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
1532 BKE_sequencer_cache_cleanup();
1533 BKE_sequencer_preprocessed_cache_cleanup();
1536 static char *rna_ToolSettings_path(PointerRNA *UNUSED(ptr))
1538 return BLI_strdup("tool_settings");
1541 static PointerRNA rna_FreestyleLineSet_linestyle_get(PointerRNA *ptr)
1543 FreestyleLineSet *lineset = (FreestyleLineSet *)ptr->data;
1545 return rna_pointer_inherit_refine(ptr, &RNA_FreestyleLineStyle, lineset->linestyle);
1548 static void rna_FreestyleLineSet_linestyle_set(PointerRNA *ptr, PointerRNA value)
1550 FreestyleLineSet *lineset = (FreestyleLineSet *)ptr->data;
1552 if (lineset->linestyle)
1553 lineset->linestyle->id.us--;
1554 lineset->linestyle = (FreestyleLineStyle *)value.data;
1555 lineset->linestyle->id.us++;
1558 static PointerRNA rna_FreestyleSettings_active_lineset_get(PointerRNA *ptr)
1560 FreestyleConfig *config = (FreestyleConfig *)ptr->data;
1561 FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(config);
1562 return rna_pointer_inherit_refine(ptr, &RNA_FreestyleLineSet, lineset);
1565 static void rna_FreestyleSettings_active_lineset_index_range(PointerRNA *ptr, int *min, int *max,
1566 int *UNUSED(softmin), int *UNUSED(softmax))
1568 FreestyleConfig *config = (FreestyleConfig *)ptr->data;
1571 *max = max_ii(0, BLI_countlist(&config->linesets) - 1);
1574 static int rna_FreestyleSettings_active_lineset_index_get(PointerRNA *ptr)
1576 FreestyleConfig *config = (FreestyleConfig *)ptr->data;
1577 return BKE_freestyle_lineset_get_active_index(config);
1580 static void rna_FreestyleSettings_active_lineset_index_set(PointerRNA *ptr, int value)
1582 FreestyleConfig *config = (FreestyleConfig *)ptr->data;
1583 BKE_freestyle_lineset_set_active_index(config, value);
1588 static void rna_def_transform_orientation(BlenderRNA *brna)
1593 const int matrix_dimsize[] = {3, 3};
1595 srna = RNA_def_struct(brna, "TransformOrientation", NULL);
1597 prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
1598 RNA_def_property_float_sdna(prop, NULL, "mat");
1599 RNA_def_property_multi_array(prop, 2, matrix_dimsize);
1600 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
1602 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1603 RNA_def_struct_name_property(srna, prop);
1604 RNA_def_property_ui_text(prop, "Name", "Name of the custom transform orientation");
1605 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
1608 static void rna_def_tool_settings(BlenderRNA *brna)
1613 static EnumPropertyItem uv_select_mode_items[] = {
1614 {UV_SELECT_VERTEX, "VERTEX", ICON_UV_VERTEXSEL, "Vertex", "Vertex selection mode"},
1615 {UV_SELECT_EDGE, "EDGE", ICON_UV_EDGESEL, "Edge", "Edge selection mode"},
1616 {UV_SELECT_FACE, "FACE", ICON_UV_FACESEL, "Face", "Face selection mode"},
1617 {UV_SELECT_ISLAND, "ISLAND", ICON_UV_ISLANDSEL, "Island", "Island selection mode"},
1618 {0, NULL, 0, NULL, NULL}
1621 /* the construction of this enum is quite special - everything is stored as bitflags,
1622 * with 1st position only for for on/off (and exposed as boolean), while others are mutually
1623 * exclusive options but which will only have any effect when autokey is enabled
1625 static EnumPropertyItem auto_key_items[] = {
1626 {AUTOKEY_MODE_NORMAL & ~AUTOKEY_ON, "ADD_REPLACE_KEYS", 0, "Add & Replace", ""},
1627 {AUTOKEY_MODE_EDITKEYS & ~AUTOKEY_ON, "REPLACE_KEYS", 0, "Replace", ""},
1628 {0, NULL, 0, NULL, NULL}
1631 static EnumPropertyItem retarget_roll_items[] = {
1632 {SK_RETARGET_ROLL_NONE, "NONE", 0, "None", "Don't adjust roll"},
1633 {SK_RETARGET_ROLL_VIEW, "VIEW", 0, "View", "Roll bones to face the view"},
1634 {SK_RETARGET_ROLL_JOINT, "JOINT", 0, "Joint", "Roll bone to original joint plane offset"},
1635 {0, NULL, 0, NULL, NULL}
1638 static EnumPropertyItem sketch_convert_items[] = {
1639 {SK_CONVERT_CUT_FIXED, "FIXED", 0, "Fixed", "Subdivide stroke in fixed number of bones"},
1640 {SK_CONVERT_CUT_LENGTH, "LENGTH", 0, "Length", "Subdivide stroke in bones of specific length"},
1641 {SK_CONVERT_CUT_ADAPTATIVE, "ADAPTIVE", 0, "Adaptive",
1642 "Subdivide stroke adaptively, with more subdivision in curvier parts"},
1643 {SK_CONVERT_RETARGET, "RETARGET", 0, "Retarget", "Retarget template bone chain to stroke"},
1644 {0, NULL, 0, NULL, NULL}
1647 static EnumPropertyItem edge_tag_items[] = {
1648 {EDGE_MODE_SELECT, "SELECT", 0, "Select", ""},
1649 {EDGE_MODE_TAG_SEAM, "SEAM", 0, "Tag Seam", ""},
1650 {EDGE_MODE_TAG_SHARP, "SHARP", 0, "Tag Sharp", ""},
1651 {EDGE_MODE_TAG_CREASE, "CREASE", 0, "Tag Crease", ""},
1652 {EDGE_MODE_TAG_BEVEL, "BEVEL", 0, "Tag Bevel", ""},
1653 {EDGE_MODE_TAG_FREESTYLE, "FREESTYLE", 0, "Tag Freestyle Edge Mark", ""},
1654 {0, NULL, 0, NULL, NULL}
1657 static EnumPropertyItem draw_groupuser_items[] = {
1658 {OB_DRAW_GROUPUSER_NONE, "NONE", 0, "None", ""},
1659 {OB_DRAW_GROUPUSER_ACTIVE, "ACTIVE", 0, "Active", "Show vertices with no weights in the active group"},
1660 {OB_DRAW_GROUPUSER_ALL, "ALL", 0, "All", "Show vertices with no weights in any group"},
1661 {0, NULL, 0, NULL, NULL}
1664 static EnumPropertyItem vertex_group_select_items[] = {
1665 {WT_VGROUP_ALL, "ALL", 0, "All", "All Vertex Groups"},
1666 {WT_VGROUP_BONE_DEFORM, "BONE_DEFORM", 0, "Deform", "Vertex Groups assigned to Deform Bones"},
1667 {WT_VGROUP_BONE_DEFORM_OFF, "OTHER_DEFORM", 0, "Other", "Vertex Groups assigned to non Deform Bones"},
1668 {0, NULL, 0, NULL, NULL}
1672 srna = RNA_def_struct(brna, "ToolSettings", NULL);
1673 RNA_def_struct_path_func(srna, "rna_ToolSettings_path");
1674 RNA_def_struct_ui_text(srna, "Tool Settings", "");
1676 prop = RNA_def_property(srna, "sculpt", PROP_POINTER, PROP_NONE);
1677 RNA_def_property_struct_type(prop, "Sculpt");
1678 RNA_def_property_ui_text(prop, "Sculpt", "");
1680 prop = RNA_def_property(srna, "use_auto_normalize", PROP_BOOLEAN, PROP_NONE);
1681 RNA_def_property_boolean_sdna(prop, NULL, "auto_normalize", 1);
1682 RNA_def_property_ui_text(prop, "WPaint Auto-Normalize",
1683 "Ensure all bone-deforming vertex groups add up "
1684 "to 1.0 while weight painting");
1685 RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data");
1687 prop = RNA_def_property(srna, "use_multipaint", PROP_BOOLEAN, PROP_NONE);
1688 RNA_def_property_boolean_sdna(prop, NULL, "multipaint", 1);
1689 RNA_def_property_ui_text(prop, "WPaint Multi-Paint",
1690 "Paint across all selected bones while "
1692 RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data");
1694 prop = RNA_def_property(srna, "vertex_group_user", PROP_ENUM, PROP_NONE);
1695 RNA_def_property_enum_sdna(prop, NULL, "weightuser");
1696 RNA_def_property_enum_items(prop, draw_groupuser_items);
1697 RNA_def_property_ui_text(prop, "Mask Non-Group Vertices", "Display unweighted vertices (multi-paint overrides)");
1698 RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data");
1700 prop = RNA_def_property(srna, "vertex_group_subset", PROP_ENUM, PROP_NONE);
1701 RNA_def_property_enum_sdna(prop, NULL, "vgroupsubset");
1702 RNA_def_property_enum_items(prop, vertex_group_select_items);
1703 RNA_def_property_ui_text(prop, "Subset", "Filter Vertex groups for Display");
1704 RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data");
1706 prop = RNA_def_property(srna, "vertex_paint", PROP_POINTER, PROP_NONE);
1707 RNA_def_property_pointer_sdna(prop, NULL, "vpaint"); RNA_def_property_ui_text(prop, "Vertex Paint", "");
1709 prop = RNA_def_property(srna, "weight_paint", PROP_POINTER, PROP_NONE);
1710 RNA_def_property_pointer_sdna(prop, NULL, "wpaint");
1711 RNA_def_property_ui_text(prop, "Weight Paint", "");
1713 prop = RNA_def_property(srna, "image_paint", PROP_POINTER, PROP_NONE);
1714 RNA_def_property_pointer_sdna(prop, NULL, "imapaint");
1715 RNA_def_property_ui_text(prop, "Image Paint", "");
1717 prop = RNA_def_property(srna, "uv_sculpt", PROP_POINTER, PROP_NONE);
1718 RNA_def_property_pointer_sdna(prop, NULL, "uvsculpt");
1719 RNA_def_property_ui_text(prop, "UV Sculpt", "");
1721 prop = RNA_def_property(srna, "particle_edit", PROP_POINTER, PROP_NONE);
1722 RNA_def_property_pointer_sdna(prop, NULL, "particle");
1723 RNA_def_property_ui_text(prop, "Particle Edit", "");
1725 prop = RNA_def_property(srna, "use_uv_sculpt", PROP_BOOLEAN, PROP_NONE);
1726 RNA_def_property_boolean_sdna(prop, NULL, "use_uv_sculpt", 1);
1727 RNA_def_property_ui_text(prop, "UV Sculpt", "Enable brush for UV sculpting");
1728 RNA_def_property_ui_icon(prop, ICON_TPAINT_HLT, 0);
1729 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, "rna_SpaceImageEditor_uv_sculpt_update");
1731 prop = RNA_def_property(srna, "uv_sculpt_lock_borders", PROP_BOOLEAN, PROP_NONE);
1732 RNA_def_property_boolean_sdna(prop, NULL, "uv_sculpt_settings", UV_SCULPT_LOCK_BORDERS);
1733 RNA_def_property_ui_text(prop, "Lock Borders", "Disable editing of boundary edges");
1735 prop = RNA_def_property(srna, "uv_sculpt_all_islands", PROP_BOOLEAN, PROP_NONE);
1736 RNA_def_property_boolean_sdna(prop, NULL, "uv_sculpt_settings", UV_SCULPT_ALL_ISLANDS);
1737 RNA_def_property_ui_text(prop, "Sculpt All Islands", "Brush operates on all islands");
1739 prop = RNA_def_property(srna, "uv_sculpt_tool", PROP_ENUM, PROP_NONE);
1740 RNA_def_property_enum_sdna(prop, NULL, "uv_sculpt_tool");
1741 RNA_def_property_enum_items(prop, uv_sculpt_tool_items);
1742 RNA_def_property_ui_text(prop, "UV Sculpt Tools", "Select Tools for the UV sculpt brushes");
1744 prop = RNA_def_property(srna, "uv_relax_method", PROP_ENUM, PROP_NONE);
1745 RNA_def_property_enum_sdna(prop, NULL, "uv_relax_method");
1746 RNA_def_property_enum_items(prop, uv_sculpt_relaxation_items);
1747 RNA_def_property_ui_text(prop, "Relaxation Method", "Algorithm used for UV relaxation");
1750 prop = RNA_def_property(srna, "proportional_edit", PROP_ENUM, PROP_NONE);
1751 RNA_def_property_enum_sdna(prop, NULL, "proportional");
1752 RNA_def_property_enum_items(prop, proportional_editing_items);
1753 RNA_def_property_ui_text(prop, "Proportional Editing",
1754 "Proportional Editing mode, allows transforms with distance fall-off");
1755 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1757 prop = RNA_def_property(srna, "use_proportional_edit_objects", PROP_BOOLEAN, PROP_NONE);
1758 RNA_def_property_boolean_sdna(prop, NULL, "proportional_objects", 0);
1759 RNA_def_property_ui_text(prop, "Proportional Editing Objects", "Proportional editing object mode");
1760 RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1);
1761 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1763 prop = RNA_def_property(srna, "use_proportional_edit_mask", PROP_BOOLEAN, PROP_NONE);
1764 RNA_def_property_boolean_sdna(prop, NULL, "proportional_mask", 0);
1765 RNA_def_property_ui_text(prop, "Proportional Editing Objects", "Proportional editing mask mode");
1766 RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1);
1767 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1769 prop = RNA_def_property(srna, "proportional_edit_falloff", PROP_ENUM, PROP_NONE);
1770 RNA_def_property_enum_sdna(prop, NULL, "prop_mode");
1771 RNA_def_property_enum_items(prop, proportional_falloff_items);
1772 RNA_def_property_ui_text(prop, "Proportional Editing Falloff", "Falloff type for proportional editing mode");
1773 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1775 prop = RNA_def_property(srna, "proportional_size", PROP_FLOAT, PROP_DISTANCE);
1776 RNA_def_property_float_sdna(prop, NULL, "proportional_size");
1777 RNA_def_property_ui_text(prop, "Proportional Size", "Display size for proportional editing circle");
1778 RNA_def_property_range(prop, 0.00001, 5000.0);
1780 prop = RNA_def_property(srna, "normal_size", PROP_FLOAT, PROP_DISTANCE);
1781 RNA_def_property_float_sdna(prop, NULL, "normalsize");
1782 RNA_def_property_ui_text(prop, "Normal Size", "Display size for normals in the 3D view");
1783 RNA_def_property_range(prop, 0.00001, 1000.0);
1784 RNA_def_property_ui_range(prop, 0.01, 10.0, 10.0, 2);
1785 RNA_def_property_update(prop, NC_GEOM | ND_DATA, NULL);
1787 prop = RNA_def_property(srna, "double_threshold", PROP_FLOAT, PROP_DISTANCE);
1788 RNA_def_property_float_sdna(prop, NULL, "doublimit");
1789 RNA_def_property_ui_text(prop, "Double Threshold", "Limit for removing duplicates and 'Auto Merge'");
1790 RNA_def_property_range(prop, 0.0, 1.0);
1791 RNA_def_property_ui_range(prop, 0.0, 0.1, 0.01, 6);
1793 prop = RNA_def_property(srna, "use_mesh_automerge", PROP_BOOLEAN, PROP_NONE);
1794 RNA_def_property_boolean_sdna(prop, NULL, "automerge", 0);
1795 RNA_def_property_ui_text(prop, "AutoMerge Editing", "Automatically merge vertices moved to the same location");
1796 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1798 prop = RNA_def_property(srna, "use_snap", PROP_BOOLEAN, PROP_NONE);
1799 RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP);
1800 RNA_def_property_ui_text(prop, "Snap", "Snap during transform");
1801 RNA_def_property_ui_icon(prop, ICON_SNAP_OFF, 1);
1802 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1804 prop = RNA_def_property(srna, "use_snap_align_rotation", PROP_BOOLEAN, PROP_NONE);
1805 RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_ROTATE);
1806 RNA_def_property_ui_text(prop, "Snap Align Rotation", "Align rotation with the snapping target");
1807 RNA_def_property_ui_icon(prop, ICON_SNAP_NORMAL, 0);
1808 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1810 prop = RNA_def_property(srna, "snap_element", PROP_ENUM, PROP_NONE);
1811 RNA_def_property_enum_sdna(prop, NULL, "snap_mode");
1812 RNA_def_property_enum_items(prop, snap_element_items);
1813 RNA_def_property_ui_text(prop, "Snap Element", "Type of element to snap to");
1814 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1816 /* node editor uses own set of snap modes */
1817 prop = RNA_def_property(srna, "snap_node_element", PROP_ENUM, PROP_NONE);
1818 RNA_def_property_enum_sdna(prop, NULL, "snap_node_mode");
1819 RNA_def_property_enum_items(prop, snap_node_element_items);
1820 RNA_def_property_ui_text(prop, "Snap Node Element", "Type of element to snap to");
1821 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1823 /* image editor uses own set of snap modes */
1824 prop = RNA_def_property(srna, "snap_uv_element", PROP_ENUM, PROP_NONE);
1825 RNA_def_property_enum_sdna(prop, NULL, "snap_uv_mode");
1826 RNA_def_property_enum_items(prop, snap_uv_element_items);
1827 RNA_def_property_ui_text(prop, "Snap UV Element", "Type of element to snap to");
1828 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1830 prop = RNA_def_property(srna, "snap_target", PROP_ENUM, PROP_NONE);
1831 RNA_def_property_enum_sdna(prop, NULL, "snap_target");
1832 RNA_def_property_enum_items(prop, snap_target_items);
1833 RNA_def_property_ui_text(prop, "Snap Target", "Which part to snap onto the target");
1834 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1836 prop = RNA_def_property(srna, "use_snap_peel_object", PROP_BOOLEAN, PROP_NONE);
1837 RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_PEEL_OBJECT);
1838 RNA_def_property_ui_text(prop, "Snap Peel Object", "Consider objects as whole when finding volume center");
1839 RNA_def_property_ui_icon(prop, ICON_SNAP_PEEL_OBJECT, 0);
1840 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1842 prop = RNA_def_property(srna, "use_snap_project", PROP_BOOLEAN, PROP_NONE);
1843 RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_PROJECT);
1844 RNA_def_property_ui_text(prop, "Project Individual Elements",
1845 "Project individual elements on the surface of other objects");
1846 RNA_def_property_ui_icon(prop, ICON_RETOPO, 0);
1847 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1849 prop = RNA_def_property(srna, "use_snap_self", PROP_BOOLEAN, PROP_NONE);
1850 RNA_def_property_boolean_negative_sdna(prop, NULL, "snap_flag", SCE_SNAP_NO_SELF);
1851 RNA_def_property_ui_text(prop, "Project to Self", "Snap onto itself (editmode)");
1852 RNA_def_property_ui_icon(prop, ICON_ORTHO, 0);
1853 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
1856 prop = RNA_def_property(srna, "use_grease_pencil_sessions", PROP_BOOLEAN, PROP_NONE);
1857 RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_PAINTSESSIONS_ON);
1858 RNA_def_property_ui_text(prop, "Use Sketching Sessions",
1859 "Allow drawing multiple strokes at a time with Grease Pencil");
1860 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* xxx: need toolbar to be redrawn... */
1863 prop = RNA_def_property(srna, "use_keyframe_insert_auto", PROP_BOOLEAN, PROP_NONE);
1864 RNA_def_property_boolean_sdna(prop, NULL, "autokey_mode", AUTOKEY_ON);
1865 RNA_def_property_ui_text(prop, "Auto Keying", "Automatic keyframe insertion for Objects and Bones");
1866 RNA_def_property_ui_icon(prop, ICON_REC, 0);
1868 prop = RNA_def_property(srna, "auto_keying_mode", PROP_ENUM, PROP_NONE);
1869 RNA_def_property_enum_bitflag_sdna(prop, NULL, "autokey_mode");
1870 RNA_def_property_enum_items(prop, auto_key_items);
1871 RNA_def_property_ui_text(prop, "Auto-Keying Mode", "Mode of automatic keyframe insertion for Objects and Bones");
1873 prop = RNA_def_property(srna, "use_record_with_nla", PROP_BOOLEAN, PROP_NONE);
1874 RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", ANIMRECORD_FLAG_WITHNLA);
1875 RNA_def_property_ui_text(prop, "Layered",
1876 "Add a new NLA Track + Strip for every loop/pass made over the animation "
1877 "to allow non-destructive tweaking");
1879 prop = RNA_def_property(srna, "use_keyframe_insert_keyingset", PROP_BOOLEAN, PROP_NONE);
1880 RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_ONLYKEYINGSET);
1881 RNA_def_property_ui_text(prop, "Auto Keyframe Insert Keying Set",
1882 "Automatic keyframe insertion using active Keying Set only");
1883 RNA_def_property_ui_icon(prop, ICON_KEYINGSET, 0);
1886 prop = RNA_def_property(srna, "uv_select_mode", PROP_ENUM, PROP_NONE);
1887 RNA_def_property_enum_sdna(prop, NULL, "uv_selectmode");
1888 RNA_def_property_enum_items(prop, uv_select_mode_items);
1889 RNA_def_property_ui_text(prop, "UV Selection Mode", "UV selection and display mode");
1890 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
1892 prop = RNA_def_property(srna, "use_uv_select_sync", PROP_BOOLEAN, PROP_NONE);
1893 RNA_def_property_boolean_sdna(prop, NULL, "uv_flag", UV_SYNC_SELECTION);
1894 RNA_def_property_ui_text(prop, "UV Sync Selection", "Keep UV and edit mode mesh selection in sync");
1895 RNA_def_property_ui_icon(prop, ICON_EDIT, 0);
1896 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
1898 prop = RNA_def_property(srna, "show_uv_local_view", PROP_BOOLEAN, PROP_NONE);
1899 RNA_def_property_boolean_sdna(prop, NULL, "uv_flag", UV_SHOW_SAME_IMAGE);
1900 RNA_def_property_ui_text(prop, "UV Local View", "Draw only faces with the currently displayed image assigned");
1901 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
1904 prop = RNA_def_property(srna, "mesh_select_mode", PROP_BOOLEAN, PROP_NONE);
1905 RNA_def_property_boolean_sdna(prop, NULL, "selectmode", 1);
1906 RNA_def_property_array(prop, 3);
1907 RNA_def_property_boolean_funcs(prop, NULL, "rna_Scene_editmesh_select_mode_set");
1908 RNA_def_property_ui_text(prop, "Mesh Selection Mode", "Which mesh elements selection works on");
1909 RNA_def_property_update(prop, 0, "rna_Scene_editmesh_select_mode_update");
1911 prop = RNA_def_property(srna, "vertex_group_weight", PROP_FLOAT, PROP_FACTOR);
1912 RNA_def_property_float_sdna(prop, NULL, "vgroup_weight");
1913 RNA_def_property_ui_text(prop, "Vertex Group Weight", "Weight to assign in vertex groups");
1915 /* use with MESH_OT_shortest_path_pick */
1916 prop = RNA_def_property(srna, "edge_path_mode", PROP_ENUM, PROP_NONE);
1917 RNA_def_property_enum_sdna(prop, NULL, "edge_mode");
1918 RNA_def_property_enum_items(prop, edge_tag_items);
1919 RNA_def_property_ui_text(prop, "Edge Tag Mode", "The edge flag to tag when selecting the shortest path");
1921 prop = RNA_def_property(srna, "edge_path_live_unwrap", PROP_BOOLEAN, PROP_NONE);
1922 RNA_def_property_boolean_sdna(prop, NULL, "edge_mode_live_unwrap", 1);
1923 RNA_def_property_ui_text(prop, "Live Unwrap", "Changing edges seam re-calculates UV unwrap");
1926 prop = RNA_def_property(srna, "use_bone_sketching", PROP_BOOLEAN, PROP_NONE);
1927 RNA_def_property_boolean_sdna(prop, NULL, "bone_sketching", BONE_SKETCHING);
1928 RNA_def_property_ui_text(prop, "Use Bone Sketching", "Use sketching to create and edit bones");
1929 /* RNA_def_property_ui_icon(prop, ICON_EDIT, 0); */
1930 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
1932 prop = RNA_def_property(srna, "use_etch_quick", PROP_BOOLEAN, PROP_NONE);
1933 RNA_def_property_boolean_sdna(prop, NULL, "bone_sketching", BONE_SKETCHING_QUICK);
1934 RNA_def_property_ui_text(prop, "Quick Sketching", "Automatically convert and delete on stroke end");
1936 prop = RNA_def_property(srna, "use_etch_overdraw", PROP_BOOLEAN, PROP_NONE);
1937 RNA_def_property_boolean_sdna(prop, NULL, "bone_sketching", BONE_SKETCHING_ADJUST);
1938 RNA_def_property_ui_text(prop, "Overdraw Sketching", "Adjust strokes by drawing near them");
1940 prop = RNA_def_property(srna, "use_etch_autoname", PROP_BOOLEAN, PROP_NONE);
1941 RNA_def_property_boolean_sdna(prop, NULL, "skgen_retarget_options", SK_RETARGET_AUTONAME);
1942 RNA_def_property_ui_text(prop, "Autoname Bones", "Automatically generate values to replace &N and &S suffix placeholders in template names");
1944 prop = RNA_def_property(srna, "etch_number", PROP_STRING, PROP_NONE);
1945 RNA_def_property_string_sdna(prop, NULL, "skgen_num_string");
1946 RNA_def_property_ui_text(prop, "Number", "Text to replace &N with (e.g. 'Finger.&N' -> 'Finger.1' or 'Finger.One')");
1948 prop = RNA_def_property(srna, "etch_side", PROP_STRING, PROP_NONE);
1949 RNA_def_property_string_sdna(prop, NULL, "skgen_num_string");
1950 RNA_def_property_ui_text(prop, "Side", "Text to replace &S with (e.g. 'Arm.&S' -> 'Arm.R' or 'Arm.Right')");
1952 prop = RNA_def_property(srna, "etch_template", PROP_POINTER, PROP_NONE);
1953 RNA_def_property_pointer_sdna(prop, NULL, "skgen_template");
1954 RNA_def_property_flag(prop, PROP_EDITABLE);
1955 RNA_def_property_struct_type(prop, "Object");
1956 RNA_def_property_pointer_funcs(prop, NULL, "rna_Scene_skgen_etch_template_set", NULL, NULL);
1957 RNA_def_property_ui_text(prop, "Template", "Template armature that will be retargeted to the stroke");
1959 prop = RNA_def_property(srna, "etch_subdivision_number", PROP_INT, PROP_NONE);
1960 RNA_def_property_int_sdna(prop, NULL, "skgen_subdivision_number");
1961 RNA_def_property_range(prop, 1, 255);
1962 RNA_def_property_ui_text(prop, "Subdivisions", "Number of bones in the subdivided stroke");
1963 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
1965 prop = RNA_def_property(srna, "etch_adaptive_limit", PROP_FLOAT, PROP_FACTOR);
1966 RNA_def_property_float_sdna(prop, NULL, "skgen_correlation_limit");
1967 RNA_def_property_range(prop, 0.00001, 1.0);
1968 RNA_def_property_ui_range(prop, 0.01, 1.0, 0.01, 2);
1969 RNA_def_property_ui_text(prop, "Limit", "Correlation threshold for number of bones in the subdivided stroke");
1970 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
1972 prop = RNA_def_property(srna, "etch_length_limit", PROP_FLOAT, PROP_DISTANCE);
1973 RNA_def_property_float_sdna(prop, NULL, "skgen_length_limit");
1974 RNA_def_property_range(prop, 0.00001, 100000.0);
1975 RNA_def_property_ui_range(prop, 0.001, 100.0, 0.1, 3);
1976 RNA_def_property_ui_text(prop, "Length", "Maximum length of the subdivided bones");
1977 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
1979 prop = RNA_def_property(srna, "etch_roll_mode", PROP_ENUM, PROP_NONE);
1980 RNA_def_property_enum_bitflag_sdna(prop, NULL, "skgen_retarget_roll");
1981 RNA_def_property_enum_items(prop, retarget_roll_items);
1982 RNA_def_property_ui_text(prop, "Retarget roll mode", "Method used to adjust the roll of bones when retargeting");
1984 prop = RNA_def_property(srna, "etch_convert_mode", PROP_ENUM, PROP_NONE);
1985 RNA_def_property_enum_bitflag_sdna(prop, NULL, "bone_sketching_convert");
1986 RNA_def_property_enum_items(prop, sketch_convert_items);
1987 RNA_def_property_ui_text(prop, "Stroke conversion method", "Method used to convert stroke to bones");
1988 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
1990 /* Unified Paint Settings */
1991 prop = RNA_def_property(srna, "unified_paint_settings", PROP_POINTER, PROP_NONE);
1992 RNA_def_property_flag(prop, PROP_NEVER_NULL);
1993 RNA_def_property_struct_type(prop, "UnifiedPaintSettings");
1994 RNA_def_property_ui_text(prop, "Unified Paint Settings", NULL);
1996 /* Mesh Statistics */
1997 prop = RNA_def_property(srna, "statvis", PROP_POINTER, PROP_NONE);
1998 RNA_def_property_flag(prop, PROP_NEVER_NULL);
1999 RNA_def_property_struct_type(prop, "MeshStatVis");
2000 RNA_def_property_ui_text(prop, "Mesh Statistics Visualization", NULL);
2003 static void rna_def_unified_paint_settings(BlenderRNA *brna)
2008 srna = RNA_def_struct(brna, "UnifiedPaintSettings", NULL);
2009 RNA_def_struct_path_func(srna, "rna_UnifiedPaintSettings_path");
2010 RNA_def_struct_ui_text(srna, "Unified Paint Settings", "Overrides for some of the active brush's settings");
2012 /* high-level flags to enable or disable unified paint settings */
2013 prop = RNA_def_property(srna, "use_unified_size", PROP_BOOLEAN, PROP_NONE);
2014 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_SIZE);
2015 RNA_def_property_ui_text(prop, "Use Unified Radius",
2016 "Instead of per-brush radius, the radius is shared across brushes");
2018 prop = RNA_def_property(srna, "use_unified_strength", PROP_BOOLEAN, PROP_NONE);
2019 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_ALPHA);
2020 RNA_def_property_ui_text(prop, "Use Unified Strength",
2021 "Instead of per-brush strength, the strength is shared across brushes");
2023 prop = RNA_def_property(srna, "use_unified_weight", PROP_BOOLEAN, PROP_NONE);
2024 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_WEIGHT);
2025 RNA_def_property_ui_text(prop, "Use Unified Weight",
2026 "Instead of per-brush weight, the weight is shared across brushes");
2028 /* unified paint settings that override the equivalent settings
2029 * from the active brush */
2030 prop = RNA_def_property(srna, "size", PROP_INT, PROP_NONE);
2031 RNA_def_property_int_funcs(prop, NULL, "rna_UnifiedPaintSettings_size_set", NULL);
2032 RNA_def_property_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS * 10);
2033 RNA_def_property_ui_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS, 1, -1);
2034 RNA_def_property_ui_text(prop, "Radius", "Radius of the brush in pixels");
2035 RNA_def_property_update(prop, 0, "rna_UnifiedPaintSettings_radius_update");
2037 prop = RNA_def_property(srna, "unprojected_radius", PROP_FLOAT, PROP_DISTANCE);
2038 RNA_def_property_float_funcs(prop, NULL, "rna_UnifiedPaintSettings_unprojected_radius_set", NULL);
2039 RNA_def_property_range(prop, 0.001, FLT_MAX);
2040 RNA_def_property_ui_range(prop, 0.001, 1, 0, -1);
2041 RNA_def_property_ui_text(prop, "Unprojected Radius", "Radius of brush in Blender units");
2042 RNA_def_property_update(prop, 0, "rna_UnifiedPaintSettings_radius_update");
2044 prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
2045 RNA_def_property_float_sdna(prop, NULL, "alpha");
2046 RNA_def_property_float_default(prop, 0.5f);
2047 RNA_def_property_range(prop, 0.0f, 10.0f);
2048 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
2049 RNA_def_property_ui_text(prop, "Strength", "How powerful the effect of the brush is when applied");
2051 prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_FACTOR);
2052 RNA_def_property_float_sdna(prop, NULL, "weight");
2053 RNA_def_property_float_default(prop, 0.5f);
2054 RNA_def_property_range(prop, 0.0f, 1.0f);
2055 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
2056 RNA_def_property_ui_text(prop, "Weight", "Weight to assign in vertex groups");
2058 prop = RNA_def_property(srna, "use_pressure_size", PROP_BOOLEAN, PROP_NONE);
2059 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_BRUSH_SIZE_PRESSURE);
2060 RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
2061 RNA_def_property_ui_text(prop, "Size Pressure", "Enable tablet pressure sensitivity for size");
2063 prop = RNA_def_property(srna, "use_pressure_strength", PROP_BOOLEAN, PROP_NONE);
2064 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_BRUSH_ALPHA_PRESSURE);
2065 RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
2066 RNA_def_property_ui_text(prop, "Strength Pressure", "Enable tablet pressure sensitivity for strength");
2068 prop = RNA_def_property(srna, "use_locked_size", PROP_BOOLEAN, PROP_NONE);
2069 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_BRUSH_LOCK_SIZE);
2070 RNA_def_property_ui_text(prop, "Use Blender Units",
2071 "When locked brush stays same size relative to object; "
2072 "when unlocked brush size is given in pixels");
2075 static void rna_def_statvis(BlenderRNA *brna)
2080 static EnumPropertyItem stat_type[] = {
2081 {SCE_STATVIS_OVERHANG, "OVERHANG", 0, "Overhang", ""},
2082 {SCE_STATVIS_THICKNESS, "THICKNESS", 0, "Thickness", ""},
2083 {SCE_STATVIS_INTERSECT, "INTERSECT", 0, "Intersect", ""},
2084 {SCE_STATVIS_DISTORT, "DISTORT", 0, "Distortion", ""},
2085 {SCE_STATVIS_SHARP, "SHARP", 0, "Sharp", ""},
2086 {0, NULL, 0, NULL, NULL}};
2088 srna = RNA_def_struct(brna, "MeshStatVis", NULL);
2089 RNA_def_struct_path_func(srna, "rna_MeshStatVis_path");
2090 RNA_def_struct_ui_text(srna, "Mesh Visualize Statistics", "");
2092 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
2093 RNA_def_property_enum_items(prop, stat_type);
2094 RNA_def_property_ui_text(prop, "Type", "XXX");
2095 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
2099 prop = RNA_def_property(srna, "overhang_min", PROP_FLOAT, PROP_ANGLE);
2100 RNA_def_property_float_sdna(prop, NULL, "overhang_min");
2101 RNA_def_property_float_default(prop, 0.5f);
2102 RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
2103 RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 0.001, 3);
2104 RNA_def_property_ui_text(prop, "Overhang Min", "Minimum angle to display");
2105 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
2107 prop = RNA_def_property(srna, "overhang_max", PROP_FLOAT, PROP_ANGLE);
2108 RNA_def_property_float_sdna(prop, NULL, "overhang_max");
2109 RNA_def_property_float_default(prop, 0.5f);
2110 RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
2111 RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 0.001, 3);
2112 RNA_def_property_ui_text(prop, "Overhang Max", "Maximum angle to display");
2113 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
2115 prop = RNA_def_property(srna, "overhang_axis", PROP_ENUM, PROP_NONE);
2116 RNA_def_property_enum_sdna(prop, NULL, "overhang_axis");
2117 RNA_def_property_enum_items(prop, object_axis_items);
2118 RNA_def_property_ui_text(prop, "Axis", "");
2119 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
2123 prop = RNA_def_property(srna, "thickness_min", PROP_FLOAT, PROP_DISTANCE);
2124 RNA_def_property_float_sdna(prop, NULL, "thickness_min");
2125 RNA_def_property_float_default(prop, 0.5f);
2126 RNA_def_property_range(prop, 0.0f, 1000.0);
2127 RNA_def_property_ui_range(prop, 0.0f, 100.0, 0.001, 3);
2128 RNA_def_property_ui_text(prop, "Thickness Min", "Minimum for measuring thickness");
2129 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
2131 prop = RNA_def_property(srna, "thickness_max", PROP_FLOAT, PROP_DISTANCE);
2132 RNA_def_property_float_sdna(prop, NULL, "thickness_max");
2133 RNA_def_property_float_default(prop, 0.5f);
2134 RNA_def_property_range(prop, 0.0f, 1000.0);
2135 RNA_def_property_ui_range(prop, 0.0f, 100.0, 0.001, 3);
2136 RNA_def_property_ui_text(prop, "Thickness Max", "Maximum for measuring thickness");
2137 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
2139 prop = RNA_def_property(srna, "thickness_samples", PROP_INT, PROP_UNSIGNED);
2140 RNA_def_property_int_sdna(prop, NULL, "thickness_samples");
2141 RNA_def_property_range(prop, 1, 32);
2142 RNA_def_property_ui_text(prop, "Samples", "Number of samples to test per face");
2143 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
2146 prop = RNA_def_property(srna, "distort_min", PROP_FLOAT, PROP_ANGLE);
2147 RNA_def_property_float_sdna(prop, NULL, "distort_min");
2148 RNA_def_property_float_default(prop, 0.5f);
2149 RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
2150 RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 0.001, 3);
2151 RNA_def_property_ui_text(prop, "Distort Min", "Minimum angle to display");
2152 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
2154 prop = RNA_def_property(srna, "distort_max", PROP_FLOAT, PROP_ANGLE);
2155 RNA_def_property_float_sdna(prop, NULL, "distort_max");
2156 RNA_def_property_float_default(prop, 0.5f);
2157 RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
2158 RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 0.001, 3);
2159 RNA_def_property_ui_text(prop, "Distort Max", "Maximum angle to display");
2160 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
2163 prop = RNA_def_property(srna, "sharp_min", PROP_FLOAT, PROP_ANGLE);
2164 RNA_def_property_float_sdna(prop, NULL, "sharp_min");
2165 RNA_def_property_float_default(prop, 0.5f);
2166 RNA_def_property_range(prop, -DEG2RADF(180.0f), DEG2RADF(180.0f));
2167 RNA_def_property_ui_range(prop, -DEG2RADF(180.0f), DEG2RADF(180.0f), 0.001, 3);
2168 RNA_def_property_ui_text(prop, "Distort Min", "Minimum angle to display");
2169 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
2171 prop = RNA_def_property(srna, "sharp_max", PROP_FLOAT, PROP_ANGLE);
2172 RNA_def_property_float_sdna(prop, NULL, "sharp_max");
2173 RNA_def_property_float_default(prop, 0.5f);
2174 RNA_def_property_range(prop, -DEG2RADF(180.0f), DEG2RADF(180.0f));
2175 RNA_def_property_ui_range(prop, -DEG2RADF(180.0f), DEG2RADF(180.0f), 0.001, 3);
2176 RNA_def_property_ui_text(prop, "Distort Max", "Maximum angle to display");
2177 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
2180 static void rna_def_unit_settings(BlenderRNA *brna)
2185 static EnumPropertyItem unit_systems[] = {
2186 {USER_UNIT_NONE, "NONE", 0, "None", ""},
2187 {USER_UNIT_METRIC, "METRIC", 0, "Metric", ""},
2188 {USER_UNIT_IMPERIAL, "IMPERIAL", 0, "Imperial", ""},
2189 {0, NULL, 0, NULL, NULL}
2192 static EnumPropertyItem rotation_units[] = {
2193 {0, "DEGREES", 0, "Degrees", "Use degrees for measuring angles and rotations"},
2194 {USER_UNIT_ROT_RADIANS, "RADIANS", 0, "Radians", ""},
2195 {0, NULL, 0, NULL, NULL}
2198 srna = RNA_def_struct(brna, "UnitSettings", NULL);
2199 RNA_def_struct_ui_text(srna, "Unit Settings", "");
2202 prop = RNA_def_property(srna, "system", PROP_ENUM, PROP_NONE);
2203 RNA_def_property_enum_items(prop, unit_systems);
2204 RNA_def_property_ui_text(prop, "Unit System", "The unit system to use for button display");
2205 RNA_def_property_update(prop, NC_WINDOW, NULL);
2207 prop = RNA_def_property(srna, "system_rotation", PROP_ENUM, PROP_NONE);
2208 RNA_def_property_enum_items(prop, rotation_units);
2209 RNA_def_property_ui_text(prop, "Rotation Units", "Unit to use for displaying/editing rotation values");
2210 RNA_def_property_update(prop, NC_WINDOW, NULL);
2212 prop = RNA_def_property(srna, "scale_length", PROP_FLOAT, PROP_UNSIGNED);
2213 RNA_def_property_ui_text(prop, "Unit Scale", "Scale to use when converting between blender units and dimensions");
2214 RNA_def_property_range(prop, 0.00001, 100000.0);
2215 RNA_def_property_ui_range(prop, 0.001, 100.0, 0.1, 3);
2216 RNA_def_property_update(prop, NC_WINDOW, NULL);
2218 prop = RNA_def_property(srna, "use_separate", PROP_BOOLEAN, PROP_NONE);
2219 RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_UNIT_OPT_SPLIT);
2220 RNA_def_property_ui_text(prop, "Separate Units", "Display units in pairs (e.g. 1m 0cm)");
2221 RNA_def_property_update(prop, NC_WINDOW, NULL);
2224 void rna_def_render_layer_common(StructRNA *srna, int scene)
2228 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
2229 if (scene) RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SceneRenderLayer_name_set");
2230 else RNA_def_property_string_sdna(prop, NULL, "name");
2231 RNA_def_property_ui_text(prop, "Name", "Render layer name");
2232 RNA_def_struct_name_property(srna, prop);
2233 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2234 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2236 prop = RNA_def_property(srna, "material_override", PROP_POINTER, PROP_NONE);
2237 RNA_def_property_pointer_sdna(prop, NULL, "mat_override");
2238 RNA_def_property_struct_type(prop, "Material");
2239 RNA_def_property_flag(prop, PROP_EDITABLE);
2240 RNA_def_property_ui_text(prop, "Material Override",
2241 "Material to override all other materials in this render layer");
2242 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2243 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2245 prop = RNA_def_property(srna, "light_override", PROP_POINTER, PROP_NONE);
2246 RNA_def_property_pointer_sdna(prop, NULL, "light_override");
2247 RNA_def_property_struct_type(prop, "Group");
2248 RNA_def_property_flag(prop, PROP_EDITABLE);
2249 RNA_def_property_ui_text(prop, "Light Override", "Group to override all other lights in this render layer");
2250 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2251 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2254 prop = RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
2255 RNA_def_property_boolean_sdna(prop, NULL, "lay", 1);
2256 RNA_def_property_array(prop, 20);
2257 RNA_def_property_ui_text(prop, "Visible Layers", "Scene layers included in this render layer");
2258 if (scene) RNA_def_property_boolean_funcs(prop, NULL, "rna_SceneRenderLayer_layer_set");
2259 else RNA_def_property_boolean_funcs(prop, NULL, "rna_RenderLayer_layer_set");
2260 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
2261 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2263 prop = RNA_def_property(srna, "layers_zmask", PROP_BOOLEAN, PROP_LAYER);
2264 RNA_def_property_boolean_sdna(prop, NULL, "lay_zmask", 1);
2265 RNA_def_property_array(prop, 20);
2266 RNA_def_property_ui_text(prop, "Zmask Layers", "Zmask scene layers for solid faces");
2267 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
2268 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2270 prop = RNA_def_property(srna, "layers_exclude", PROP_BOOLEAN, PROP_LAYER);
2271 RNA_def_property_boolean_sdna(prop, NULL, "lay_exclude", 1);
2272 RNA_def_property_array(prop, 20);
2273 RNA_def_property_ui_text(prop, "Exclude Layers", "Exclude scene layers from having any influence");
2274 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
2275 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2278 prop = RNA_def_property(srna, "samples", PROP_INT, PROP_UNSIGNED);
2279 RNA_def_property_ui_text(prop, "Samples", "Override number of render samples for this render layer, "
2280 "0 will use the scene setting");
2281 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2285 prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
2286 RNA_def_property_boolean_negative_sdna(prop, NULL, "layflag", SCE_LAY_DISABLE);
2287 RNA_def_property_ui_text(prop, "Enabled", "Disable or enable the render layer");
2288 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
2289 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2291 prop = RNA_def_property(srna, "use_zmask", PROP_BOOLEAN, PROP_NONE);
2292 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ZMASK);
2293 RNA_def_property_ui_text(prop, "Zmask", "Only render what's in front of the solid z values");
2294 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
2295 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2297 prop = RNA_def_property(srna, "invert_zmask", PROP_BOOLEAN, PROP_NONE);
2298 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_NEG_ZMASK);
2299 RNA_def_property_ui_text(prop, "Zmask Negate",
2300 "For Zmask, only render what is behind solid z values instead of in front");
2301 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
2302 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2304 prop = RNA_def_property(srna, "use_all_z", PROP_BOOLEAN, PROP_NONE);
2305 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ALL_Z);
2306 RNA_def_property_ui_text(prop, "All Z", "Fill in Z values for solid faces in invisible layers, for masking");
2307 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2308 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2310 prop = RNA_def_property(srna, "use_solid", PROP_BOOLEAN, PROP_NONE);
2311 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_SOLID);
2312 RNA_def_property_ui_text(prop, "Solid", "Render Solid faces in this Layer");
2313 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2314 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2316 prop = RNA_def_property(srna, "use_halo", PROP_BOOLEAN, PROP_NONE);
2317 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_HALO);
2318 RNA_def_property_ui_text(prop, "Halo", "Render Halos in this Layer (on top of Solid)");
2319 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2320 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2322 prop = RNA_def_property(srna, "use_ztransp", PROP_BOOLEAN, PROP_NONE);
2323 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ZTRA);
2324 RNA_def_property_ui_text(prop, "ZTransp", "Render Z-Transparent faces in this Layer (on top of Solid and Halos)");
2325 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2326 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2328 prop = RNA_def_property(srna, "use_sky", PROP_BOOLEAN, PROP_NONE);
2329 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_SKY);
2330 RNA_def_property_ui_text(prop, "Sky", "Render Sky in this Layer");
2331 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
2332 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2334 prop = RNA_def_property(srna, "use_edge_enhance", PROP_BOOLEAN, PROP_NONE);
2335 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_EDGE);
2336 RNA_def_property_ui_text(prop, "Edge", "Render Edge-enhance in this Layer (only works for Solid faces)");
2337 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2338 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2340 prop = RNA_def_property(srna, "use_strand", PROP_BOOLEAN, PROP_NONE);
2341 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_STRAND);
2342 RNA_def_property_ui_text(prop, "Strand", "Render Strands in this Layer");
2343 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2344 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2346 prop = RNA_def_property(srna, "use_freestyle", PROP_BOOLEAN, PROP_NONE);
2347 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_FRS);
2348 RNA_def_property_ui_text(prop, "Freestyle", "Render stylized strokes in this Layer");
2350 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2352 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2355 prop = RNA_def_property(srna, "use_pass_combined", PROP_BOOLEAN, PROP_NONE);
2356 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_COMBINED);
2357 RNA_def_property_ui_text(prop, "Combined", "Deliver full combined RGBA buffer");
2358 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2359 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2361 prop = RNA_def_property(srna, "use_pass_z", PROP_BOOLEAN, PROP_NONE);
2362 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_Z);
2363 RNA_def_property_ui_text(prop, "Z", "Deliver Z values pass");
2364 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2365 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2367 prop = RNA_def_property(srna, "use_pass_vector", PROP_BOOLEAN, PROP_NONE);
2368 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_VECTOR);
2369 RNA_def_property_ui_text(prop, "Vector", "Deliver speed vector pass");
2370 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2371 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2373 prop = RNA_def_property(srna, "use_pass_normal", PROP_BOOLEAN, PROP_NONE);
2374 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_NORMAL);
2375 RNA_def_property_ui_text(prop, "Normal", "Deliver normal pass");
2376 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2377 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2379 prop = RNA_def_property(srna, "use_pass_uv", PROP_BOOLEAN, PROP_NONE);
2380 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_UV);
2381 RNA_def_property_ui_text(prop, "UV", "Deliver texture UV pass");
2382 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2383 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2385 prop = RNA_def_property(srna, "use_pass_mist", PROP_BOOLEAN, PROP_NONE);
2386 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_MIST);
2387 RNA_def_property_ui_text(prop, "Mist", "Deliver mist factor pass (0.0-1.0)");
2388 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2389 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2391 prop = RNA_def_property(srna, "use_pass_object_index", PROP_BOOLEAN, PROP_NONE);
2392 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_INDEXOB);
2393 RNA_def_property_ui_text(prop, "Object Index", "Deliver object index pass");
2394 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2395 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2397 prop = RNA_def_property(srna, "use_pass_material_index", PROP_BOOLEAN, PROP_NONE);
2398 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_INDEXMA);
2399 RNA_def_property_ui_text(prop, "Material Index", "Deliver material index pass");
2400 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2401 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2403 prop = RNA_def_property(srna, "use_pass_color", PROP_BOOLEAN, PROP_NONE);
2404 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_RGBA);
2405 RNA_def_property_ui_text(prop, "Color", "Deliver shade-less color pass");
2406 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2407 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2409 prop = RNA_def_property(srna, "use_pass_diffuse", PROP_BOOLEAN, PROP_NONE);
2410 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE);
2411 RNA_def_property_ui_text(prop, "Diffuse", "Deliver diffuse pass");
2412 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2413 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2415 prop = RNA_def_property(srna, "use_pass_specular", PROP_BOOLEAN, PROP_NONE);
2416 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SPEC);
2417 RNA_def_property_ui_text(prop, "Specular", "Deliver specular pass");
2418 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2419 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2421 prop = RNA_def_property(srna, "use_pass_shadow", PROP_BOOLEAN, PROP_NONE);
2422 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SHADOW);
2423 RNA_def_property_ui_text(prop, "Shadow", "Deliver shadow pass");
2424 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2425 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2427 prop = RNA_def_property(srna, "use_pass_ambient_occlusion", PROP_BOOLEAN, PROP_NONE);
2428 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_AO);
2429 RNA_def_property_ui_text(prop, "AO", "Deliver AO pass");
2430 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2431 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2433 prop = RNA_def_property(srna, "use_pass_reflection", PROP_BOOLEAN, PROP_NONE);
2434 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_REFLECT);
2435 RNA_def_property_ui_text(prop, "Reflection", "Deliver raytraced reflection pass");
2436 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2437 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2439 prop = RNA_def_property(srna, "use_pass_refraction", PROP_BOOLEAN, PROP_NONE);
2440 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_REFRACT);
2441 RNA_def_property_ui_text(prop, "Refraction", "Deliver raytraced refraction pass");
2442 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2443 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2445 prop = RNA_def_property(srna, "use_pass_emit", PROP_BOOLEAN, PROP_NONE);
2446 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_EMIT);
2447 RNA_def_property_ui_text(prop, "Emit", "Deliver emission pass");
2448 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2449 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2451 prop = RNA_def_property(srna, "use_pass_environment", PROP_BOOLEAN, PROP_NONE);
2452 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_ENVIRONMENT);
2453 RNA_def_property_ui_text(prop, "Environment", "Deliver environment lighting pass");
2454 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2455 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2457 prop = RNA_def_property(srna, "use_pass_indirect", PROP_BOOLEAN, PROP_NONE);
2458 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_INDIRECT);
2459 RNA_def_property_ui_text(prop, "Indirect", "Deliver indirect lighting pass");
2460 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2461 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2463 prop = RNA_def_property(srna, "exclude_specular", PROP_BOOLEAN, PROP_NONE);
2464 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_SPEC);
2465 RNA_def_property_ui_text(prop, "Specular Exclude", "Exclude specular pass from combined");
2466 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2467 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2468 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2470 prop = RNA_def_property(srna, "exclude_shadow", PROP_BOOLEAN, PROP_NONE);
2471 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_SHADOW);
2472 RNA_def_property_ui_text(prop, "Shadow Exclude", "Exclude shadow pass from combined");
2473 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2474 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2475 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2477 prop = RNA_def_property(srna, "exclude_ambient_occlusion", PROP_BOOLEAN, PROP_NONE);
2478 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_AO);
2479 RNA_def_property_ui_text(prop, "AO Exclude", "Exclude AO pass from combined");
2480 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2481 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2482 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2484 prop = RNA_def_property(srna, "exclude_reflection", PROP_BOOLEAN, PROP_NONE);
2485 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_REFLECT);
2486 RNA_def_property_ui_text(prop, "Reflection Exclude", "Exclude raytraced reflection pass from combined");
2487 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2488 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2489 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2491 prop = RNA_def_property(srna, "exclude_refraction", PROP_BOOLEAN, PROP_NONE);
2492 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_REFRACT);
2493 RNA_def_property_ui_text(prop, "Refraction Exclude", "Exclude raytraced refraction pass from combined");
2494 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2495 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2496 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2498 prop = RNA_def_property(srna, "exclude_emit", PROP_BOOLEAN, PROP_NONE);
2499 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_EMIT);
2500 RNA_def_property_ui_text(prop, "Emit Exclude", "Exclude emission pass from combined");
2501 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2502 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2503 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2505 prop = RNA_def_property(srna, "exclude_environment", PROP_BOOLEAN, PROP_NONE);
2506 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_ENVIRONMENT);
2507 RNA_def_property_ui_text(prop, "Environment Exclude", "Exclude environment pass from combined");
2508 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2509 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2510 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2512 prop = RNA_def_property(srna, "exclude_indirect", PROP_BOOLEAN, PROP_NONE);
2513 RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_INDIRECT);
2514 RNA_def_property_ui_text(prop, "Indirect Exclude", "Exclude indirect pass from combined");
2515 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2516 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2517 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2519 prop = RNA_def_property(srna, "use_pass_diffuse_direct", PROP_BOOLEAN, PROP_NONE);
2520 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE_DIRECT);
2521 RNA_def_property_ui_text(prop, "Diffuse Direct", "Deliver diffuse direct pass");
2522 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2523 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2525 prop = RNA_def_property(srna, "use_pass_diffuse_indirect", PROP_BOOLEAN, PROP_NONE);
2526 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE_INDIRECT);
2527 RNA_def_property_ui_text(prop, "Diffuse Indirect", "Deliver diffuse indirect pass");
2528 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2529 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2531 prop = RNA_def_property(srna, "use_pass_diffuse_color", PROP_BOOLEAN, PROP_NONE);
2532 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE_COLOR);
2533 RNA_def_property_ui_text(prop, "Diffuse Color", "Deliver diffuse color pass");
2534 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2535 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2537 prop = RNA_def_property(srna, "use_pass_glossy_direct", PROP_BOOLEAN, PROP_NONE);
2538 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_GLOSSY_DIRECT);
2539 RNA_def_property_ui_text(prop, "Glossy Direct", "Deliver glossy direct pass");
2540 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2541 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2543 prop = RNA_def_property(srna, "use_pass_glossy_indirect", PROP_BOOLEAN, PROP_NONE);
2544 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_GLOSSY_INDIRECT);
2545 RNA_def_property_ui_text(prop, "Glossy Indirect", "Deliver glossy indirect pass");
2546 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2547 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2549 prop = RNA_def_property(srna, "use_pass_glossy_color", PROP_BOOLEAN, PROP_NONE);
2550 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_GLOSSY_COLOR);
2551 RNA_def_property_ui_text(prop, "Glossy Color", "Deliver glossy color pass");
2552 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2553 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2555 prop = RNA_def_property(srna, "use_pass_transmission_direct", PROP_BOOLEAN, PROP_NONE);
2556 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_TRANSM_DIRECT);
2557 RNA_def_property_ui_text(prop, "Transmission Direct", "Deliver transmission direct pass");
2558 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2559 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2561 prop = RNA_def_property(srna, "use_pass_transmission_indirect", PROP_BOOLEAN, PROP_NONE);
2562 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_TRANSM_INDIRECT);
2563 RNA_def_property_ui_text(prop, "Transmission Indirect", "Deliver transmission indirect pass");
2564 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2565 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2567 prop = RNA_def_property(srna, "use_pass_transmission_color", PROP_BOOLEAN, PROP_NONE);
2568 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_TRANSM_COLOR);
2569 RNA_def_property_ui_text(prop, "Transmission Color", "Deliver transmission color pass");
2570 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2571 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2573 prop = RNA_def_property(srna, "use_pass_subsurface_direct", PROP_BOOLEAN, PROP_NONE);
2574 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SUBSURFACE_DIRECT);
2575 RNA_def_property_ui_text(prop, "Subsurface Direct", "Deliver subsurface direct pass");
2576 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2577 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2579 prop = RNA_def_property(srna, "use_pass_subsurface_indirect", PROP_BOOLEAN, PROP_NONE);
2580 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SUBSURFACE_INDIRECT);
2581 RNA_def_property_ui_text(prop, "Subsurface Indirect", "Deliver subsurface indirect pass");
2582 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2583 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2585 prop = RNA_def_property(srna, "use_pass_subsurface_color", PROP_BOOLEAN, PROP_NONE);
2586 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SUBSURFACE_COLOR);
2587 RNA_def_property_ui_text(prop, "Subsurface Color", "Deliver subsurface color pass");
2588 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
2589 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2592 static void rna_def_freestyle_linesets(BlenderRNA *brna, PropertyRNA *cprop)
2597 RNA_def_property_srna(cprop, "Linesets");
2598 srna = RNA_def_struct(brna, "Linesets", NULL);
2599 RNA_def_struct_sdna(srna, "FreestyleSettings");
2600 RNA_def_struct_ui_text(srna, "Line Sets", "Line sets for associating lines and style parameters");
2602 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
2603 RNA_def_property_struct_type(prop, "FreestyleLineSet");
2604 RNA_def_property_pointer_funcs(prop, "rna_FreestyleSettings_active_lineset_get", NULL, NULL, NULL);
2605 RNA_def_property_ui_text(prop, "Active Line Set", "Active line set being displayed");
2606 RNA_def_property_update(prop, NC_SCENE, NULL);
2608 prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
2609 RNA_def_property_int_funcs(prop, "rna_FreestyleSettings_active_lineset_index_get",
2610 "rna_FreestyleSettings_active_lineset_index_set",
2611 "rna_FreestyleSettings_active_lineset_index_range");
2612 RNA_def_property_ui_text(prop, "Active Line Set Index", "Index of active line set slot");
2613 RNA_def_property_update(prop, NC_SCENE, NULL);
2616 static void rna_def_freestyle_settings(BlenderRNA *brna)
2621 static EnumPropertyItem edge_type_negation_items[] = {
2622 {0, "INCLUSIVE", 0, "Inclusive", "Select feature edges satisfying the given edge type conditions"},
2623 {FREESTYLE_LINESET_FE_NOT, "EXCLUSIVE", 0, "Exclusive",
2624 "Select feature edges not satisfying the given edge type conditions"},
2625 {0, NULL, 0, NULL, NULL}
2628 static EnumPropertyItem edge_type_combination_items[] = {
2629 {0, "OR", 0, "Logical OR", "Combine feature edge type conditions by logical OR (logical disjunction)"},
2630 {FREESTYLE_LINESET_FE_AND, "AND", 0, "Logical AND",
2631 "Combine feature edge type conditions by logical AND (logical conjunction)"},
2632 {0, NULL, 0, NULL, NULL}
2635 static EnumPropertyItem group_negation_items[] = {
2636 {0, "INCLUSIVE", 0, "Inclusive", "Select feature edges belonging to some object in the group"},
2637 {FREESTYLE_LINESET_GR_NOT, "EXCLUSIVE", 0, "Exclusive",
2638 "Select feature edges not belonging to any object in the group"},
2639 {0, NULL, 0, NULL, NULL}
2642 static EnumPropertyItem face_mark_negation_items[] = {
2643 {0, "INCLUSIVE", 0, "Inclusive", "Select feature edges satisfying the given face mark conditions"},
2644 {FREESTYLE_LINESET_FM_NOT, "EXCLUSIVE", 0, "Exclusive",
2645 "Select feature edges not satisfying the given face mark conditions"},
2646 {0, NULL, 0, NULL, NULL}
2649 static EnumPropertyItem face_mark_condition_items[] = {
2650 {0, "ONE", 0, "One Face", "Select feature edges if one of faces on the right and left has a face mark"},
2651 {FREESTYLE_LINESET_FM_BOTH, "BOTH", 0, "Both Faces",
2652 "Select feature edges if both faces on the right and left faces have a face mark"},
2653 {0, NULL, 0, NULL, NULL}
2656 static EnumPropertyItem freestyle_ui_mode_items[] = {
2657 {FREESTYLE_CONTROL_SCRIPT_MODE, "SCRIPT", 0, "Python Scripting Mode",
2658 "Advanced mode for using style modules in Python"},
2659 {FREESTYLE_CONTROL_EDITOR_MODE, "EDITOR", 0, "Parameter Editor Mode",
2660 "Basic mode for interactive style parameter editing"},
2661 {0, NULL, 0, NULL, NULL}
2664 static EnumPropertyItem visibility_items[] = {
2665 {FREESTYLE_QI_VISIBLE, "VISIBLE", 0, "Visible", "Select visible feature edges"},
2666 {FREESTYLE_QI_HIDDEN, "HIDDEN", 0, "Hidden", "Select hidden feature edges"},
2667 {FREESTYLE_QI_RANGE, "RANGE", 0, "QI Range",
2668 "Select feature edges within a range of quantitative invisibility (QI) values"},
2669 {0, NULL, 0, NULL, NULL}
2672 static EnumPropertyItem freestyle_raycasting_algorithm_items[] = {
2673 {FREESTYLE_ALGO_REGULAR, "REGULAR", 0, "Normal Ray Casting", "Consider all FEdges in each ViewEdge"},
2674 {FREESTYLE_ALGO_FAST, "FAST", 0, "Fast Ray Casting", "Sample some FEdges in each ViewEdge"},
2675 {FREESTYLE_ALGO_VERYFAST, "VERYFAST", 0, "Very Fast Ray Casting",
2676 "Sample one FEdge in each ViewEdge; do not save list of occluders"},
2677 {FREESTYLE_ALGO_CULLED_ADAPTIVE_TRADITIONAL, "CULLEDADAPTIVETRADITIONAL", 0,
2678 "Culled Traditional Visibility Detection",
2679 "Culled adaptive grid with heuristic density and "
2680 "traditional QI calculation"},
2681 {FREESTYLE_ALGO_ADAPTIVE_TRADITIONAL, "ADAPTIVETRADITIONAL", 0, "Unculled Traditional Visibility Detection",
2682 "Adaptive grid with heuristic density and traditional QI calculation"},
2683 {FREESTYLE_ALGO_CULLED_ADAPTIVE_CUMULATIVE, "CULLEDADAPTIVECUMULATIVE", 0,
2684 "Culled Cumulative Visibility Detection",
2685 "Culled adaptive grid with heuristic density and "
2686 "cumulative QI calculation"},
2687 {FREESTYLE_ALGO_ADAPTIVE_CUMULATIVE, "ADAPTIVECUMULATIVE", 0, "Unculled Cumulative Visibility Detection",
2688 "Adaptive grid with heuristic density and cumulative QI calculation"},
2689 {0, NULL, 0, NULL, NULL}
2693 /* FreestyleLineSet */
2695 srna = RNA_def_struct(brna, "FreestyleLineSet", NULL);
2696 RNA_def_struct_ui_text(srna, "Freestyle Line Set", "Line set for associating lines and style parameters");
2698 /* access to line style settings is redirected through functions
2699 * to allow proper id-buttons functionality
2701 prop = RNA_def_property(srna, "linestyle", PROP_POINTER, PROP_NONE);
2702 RNA_def_property_struct_type(prop, "FreestyleLineStyle");
2703 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
2704 RNA_def_property_pointer_funcs(prop, "rna_FreestyleLineSet_linestyle_get",
2705 "rna_FreestyleLineSet_linestyle_set", NULL, NULL);
2706 RNA_def_property_ui_text(prop, "Line Style", "Line style settings");
2707 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2709 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
2710 RNA_def_property_string_sdna(prop, NULL, "name");
2711 RNA_def_property_ui_text(prop, "Line Set Name", "Line set name");
2712 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2713 RNA_def_struct_name_property(srna, prop);
2715 prop = RNA_def_property(srna, "show_render", PROP_BOOLEAN, PROP_NONE);
2716 RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_LINESET_ENABLED);
2717 RNA_def_property_ui_text(prop, "Render", "Enable or disable this line set during stroke rendering");
2718 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2720 prop = RNA_def_property(srna, "select_by_visibility", PROP_BOOLEAN, PROP_NONE);
2721 RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_VISIBILITY);
2722 RNA_def_property_ui_text(prop, "Selection by Visibility", "Select feature edges based on visibility");
2723 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2725 prop = RNA_def_property(srna, "select_by_edge_types", PROP_BOOLEAN, PROP_NONE);
2726 RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_EDGE_TYPES);
2727 RNA_def_property_ui_text(prop, "Selection by Edge Types", "Select feature edges based on edge types");
2728 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2730 prop = RNA_def_property(srna, "select_by_group", PROP_BOOLEAN, PROP_NONE);
2731 RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_GROUP);
2732 RNA_def_property_ui_text(prop, "Selection by Group", "Select feature edges based on a group of objects");
2733 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2735 prop = RNA_def_property(srna, "select_by_image_border", PROP_BOOLEAN, PROP_NONE);
2736 RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_IMAGE_BORDER);
2737 RNA_def_property_ui_text(prop, "Selection by Image Border",
2738 "Select feature edges by image border (less memory consumption)");
2739 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2741 prop = RNA_def_property(srna, "select_by_face_marks", PROP_BOOLEAN, PROP_NONE);
2742 RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_FACE_MARK);
2743 RNA_def_property_ui_text(prop, "Selection by Face Marks", "Select feature edges by face marks");
2744 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2746 prop = RNA_def_property(srna, "edge_type_negation", PROP_ENUM, PROP_NONE);
2747 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
2748 RNA_def_property_enum_items(prop, edge_type_negation_items);
2749 RNA_def_property_ui_text(prop, "Edge Type Negation",
2750 "Set the negation operation for conditions on feature edge types");
2751 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2753 prop = RNA_def_property(srna, "edge_type_combination", PROP_ENUM, PROP_NONE);
2754 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
2755 RNA_def_property_enum_items(prop, edge_type_combination_items);
2756 RNA_def_property_ui_text(prop, "Edge Type Combination",
2757 "Set the combination operation for conditions on feature edge types");
2758 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2760 prop = RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE);
2761 RNA_def_property_pointer_sdna(prop, NULL, "group");
2762 RNA_def_property_struct_type(prop, "Group");
2763 RNA_def_property_flag(prop, PROP_EDITABLE);
2764 RNA_def_property_ui_text(prop, "Group", "A group of objects based on which feature edges are selected");
2765 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2767 prop = RNA_def_property(srna, "group_negation", PROP_ENUM, PROP_NONE);
2768 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
2769 RNA_def_property_enum_items(prop, group_negation_items);
2770 RNA_def_property_ui_text(prop, "Group Negation",
2771 "Set the negation operation for conditions on feature edge types");
2772 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2774 prop = RNA_def_property(srna, "face_mark_negation", PROP_ENUM, PROP_NONE);
2775 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
2776 RNA_def_property_enum_items(prop, face_mark_negation_items);
2777 RNA_def_property_ui_text(prop, "Face Mark Negation",
2778 "Set the negation operation for the condition on face marks");
2779 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2781 prop = RNA_def_property(srna, "face_mark_condition", PROP_ENUM, PROP_NONE);
2782 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
2783 RNA_def_property_enum_items(prop, face_mark_condition_items);
2784 RNA_def_property_ui_text(prop, "Face Mark Condition", "Set a feature edge selection condition on face marks");
2785 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2787 prop = RNA_def_property(srna, "select_silhouette", PROP_BOOLEAN, PROP_NONE);
2788 RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_SILHOUETTE);
2789 RNA_def_property_ui_text(prop, "Silhouette", "Select silhouette edges");
2790 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2792 prop = RNA_def_property(srna, "select_border", PROP_BOOLEAN, PROP_NONE);
2793 RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_BORDER);
2794 RNA_def_property_ui_text(prop, "Border", "Select border edges");
2795 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2797 prop = RNA_def_property(srna, "select_crease", PROP_BOOLEAN, PROP_NONE);
2798 RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_CREASE);
2799 RNA_def_property_ui_text(prop, "Crease", "Select crease edges");
2800 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2802 prop = RNA_def_property(srna, "select_ridge_valley", PROP_BOOLEAN, PROP_NONE);
2803 RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_RIDGE_VALLEY);
2804 RNA_def_property_ui_text(prop, "Ridge & Valley", "Select ridges and valleys");
2805 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2807 prop = RNA_def_property(srna, "select_suggestive_contour", PROP_BOOLEAN, PROP_NONE);
2808 RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_SUGGESTIVE_CONTOUR);
2809 RNA_def_property_ui_text(prop, "Suggestive Contour", "Select suggestive contours");
2810 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2812 prop = RNA_def_property(srna, "select_material_boundary", PROP_BOOLEAN, PROP_NONE);
2813 RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_MATERIAL_BOUNDARY);
2814 RNA_def_property_ui_text(prop, "Material Boundary", "Select edges at material boundaries");
2815 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2817 prop = RNA_def_property(srna, "select_contour", PROP_BOOLEAN, PROP_NONE);
2818 RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_CONTOUR);
2819 RNA_def_property_ui_text(prop, "Contour", "Select contours");
2820 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2822 prop = RNA_def_property(srna, "select_external_contour", PROP_BOOLEAN, PROP_NONE);
2823 RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_EXTERNAL_CONTOUR);
2824 RNA_def_property_ui_text(prop, "External Contour", "Select external contours");
2825 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2827 prop = RNA_def_property(srna, "select_edge_mark", PROP_BOOLEAN, PROP_NONE);
2828 RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_EDGE_MARK);
2829 RNA_def_property_ui_text(prop, "Edge Mark", "Select edge marks");
2830 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2832 prop = RNA_def_property(srna, "exclude_silhouette", PROP_BOOLEAN, PROP_NONE);
2833 RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_SILHOUETTE);
2834 RNA_def_property_ui_text(prop, "Silhouette", "Exclude silhouette edges");
2835 RNA_def_property_ui_icon(prop, ICON_X, 0);
2836 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2838 prop = RNA_def_property(srna, "exclude_border", PROP_BOOLEAN, PROP_NONE);
2839 RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_BORDER);
2840 RNA_def_property_ui_text(prop, "Border", "Exclude border edges");
2841 RNA_def_property_ui_icon(prop, ICON_X, 0);
2842 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2844 prop = RNA_def_property(srna, "exclude_crease", PROP_BOOLEAN, PROP_NONE);
2845 RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_CREASE);
2846 RNA_def_property_ui_text(prop, "Crease", "Exclude crease edges");
2847 RNA_def_property_ui_icon(prop, ICON_X, 0);
2848 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2850 prop = RNA_def_property(srna, "exclude_ridge_valley", PROP_BOOLEAN, PROP_NONE);
2851 RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_RIDGE_VALLEY);
2852 RNA_def_property_ui_text(prop, "Ridge & Valley", "Exclude ridges and valleys");
2853 RNA_def_property_ui_icon(prop, ICON_X, 0);
2854 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2856 prop = RNA_def_property(srna, "exclude_suggestive_contour", PROP_BOOLEAN, PROP_NONE);
2857 RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_SUGGESTIVE_CONTOUR);
2858 RNA_def_property_ui_text(prop, "Suggestive Contour", "Exclude suggestive contours");
2859 RNA_def_property_ui_icon(prop, ICON_X, 0);
2860 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2862 prop = RNA_def_property(srna, "exclude_material_boundary", PROP_BOOLEAN, PROP_NONE);
2863 RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_MATERIAL_BOUNDARY);
2864 RNA_def_property_ui_text(prop, "Material Boundary", "Exclude edges at material boundaries");
2865 RNA_def_property_ui_icon(prop, ICON_X, 0);
2866 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2868 prop = RNA_def_property(srna, "exclude_contour", PROP_BOOLEAN, PROP_NONE);
2869 RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_CONTOUR);
2870 RNA_def_property_ui_text(prop, "Contour", "Exclude contours");
2871 RNA_def_property_ui_icon(prop, ICON_X, 0);
2872 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2874 prop = RNA_def_property(srna, "exclude_external_contour", PROP_BOOLEAN, PROP_NONE);
2875 RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_EXTERNAL_CONTOUR);
2876 RNA_def_property_ui_text(prop, "External Contour", "Exclude external contours");
2877 RNA_def_property_ui_icon(prop, ICON_X, 0);
2878 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2880 prop = RNA_def_property(srna, "exclude_edge_mark", PROP_BOOLEAN, PROP_NONE);
2881 RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_EDGE_MARK);
2882 RNA_def_property_ui_text(prop, "Edge Mark", "Exclude edge marks");
2883 RNA_def_property_ui_icon(prop, ICON_X, 0);
2884 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2886 prop = RNA_def_property(srna, "visibility", PROP_ENUM, PROP_NONE);
2887 RNA_def_property_enum_sdna(prop, NULL, "qi");
2888 RNA_def_property_enum_items(prop, visibility_items);
2889 RNA_def_property_ui_text(prop, "Visibility", "Determine how to use visibility for feature edge selection");
2890 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2892 prop = RNA_def_property(srna, "qi_start", PROP_INT, PROP_UNSIGNED);
2893 RNA_def_property_int_sdna(prop, NULL, "qi_start");
2894 RNA_def_property_range(prop, 0, INT_MAX);
2895 RNA_def_property_ui_text(prop, "Start", "First QI value of the QI range");
2896 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2898 prop = RNA_def_property(srna, "qi_end", PROP_INT, PROP_UNSIGNED);
2899 RNA_def_property_int_sdna(prop, NULL, "qi_end");
2900 RNA_def_property_range(prop, 0, INT_MAX);
2901 RNA_def_property_ui_text(prop, "End", "Last QI value of the QI range");
2902 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2904 /* FreestyleModuleSettings */
2906 srna = RNA_def_struct(brna, "FreestyleModuleSettings", NULL);
2907 RNA_def_struct_sdna(srna, "FreestyleModuleConfig");
2908 RNA_def_struct_ui_text(srna, "Freestyle Module", "Style module configuration for specifying a style module");
2910 prop = RNA_def_property(srna, "script", PROP_POINTER, PROP_NONE);
2911 RNA_def_property_struct_type(prop, "Text");
2912 RNA_def_property_flag(prop, PROP_EDITABLE);
2913 RNA_def_property_ui_text(prop, "Style Module", "Python script to define a style module");
2914 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2916 prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
2917 RNA_def_property_boolean_sdna(prop, NULL, "is_displayed", 1);
2918 RNA_def_property_ui_text(prop, "Use", "Enable or disable this style module during stroke rendering");
2919 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2921 /* FreestyleSettings */
2923 srna = RNA_def_struct(brna, "FreestyleSettings", NULL);
2924 RNA_def_struct_sdna(srna, "FreestyleConfig");
2925 RNA_def_struct_nested(brna, srna, "SceneRenderLayer");
2926 RNA_def_struct_ui_text(srna, "Freestyle Settings", "Freestyle settings for a SceneRenderLayer datablock");
2928 prop = RNA_def_property(srna, "modules", PROP_COLLECTION, PROP_NONE);
2929 RNA_def_property_collection_sdna(prop, NULL, "modules", NULL);
2930 RNA_def_property_struct_type(prop, "FreestyleModuleSettings");
2931 RNA_def_property_ui_text(prop, "Style modules", "A list of style modules (to be applied from top to bottom)");
2933 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
2934 RNA_def_property_enum_sdna(prop, NULL, "mode");
2935 RNA_def_property_enum_items(prop, freestyle_ui_mode_items);
2936 RNA_def_property_ui_text(prop, "Control Mode", "Select the Freestyle control mode");
2937 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2939 prop = RNA_def_property(srna, "raycasting_algorithm", PROP_ENUM, PROP_NONE);
2940 RNA_def_property_enum_sdna(prop, NULL, "raycasting_algorithm");
2941 RNA_def_property_enum_items(prop, freestyle_raycasting_algorithm_items);
2942 RNA_def_property_ui_text(prop, "Raycasting Algorithm", "Select the Freestyle raycasting algorithm");
2943 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2945 prop = RNA_def_property(srna, "use_culling", PROP_BOOLEAN, PROP_NONE);
2946 RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_CULLING);
2947 RNA_def_property_ui_text(prop, "Culling", "If enabled, out-of-view edges are ignored");
2948 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2950 prop = RNA_def_property(srna, "use_suggestive_contours", PROP_BOOLEAN, PROP_NONE);
2951 RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_SUGGESTIVE_CONTOURS_FLAG);
2952 RNA_def_property_ui_text(prop, "Suggestive Contours", "Enable suggestive contours");
2953 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2955 prop = RNA_def_property(srna, "use_ridges_and_valleys", PROP_BOOLEAN, PROP_NONE);
2956 RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_RIDGES_AND_VALLEYS_FLAG);
2957 RNA_def_property_ui_text(prop, "Ridges and Valleys", "Enable ridges and valleys");
2958 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2960 prop = RNA_def_property(srna, "use_material_boundaries", PROP_BOOLEAN, PROP_NONE);
2961 RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_MATERIAL_BOUNDARIES_FLAG);
2962 RNA_def_property_ui_text(prop, "Material Boundaries", "Enable material boundaries");
2963 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2965 prop = RNA_def_property(srna, "use_smoothness", PROP_BOOLEAN, PROP_NONE);
2966 RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_FACE_SMOOTHNESS_FLAG);
2967 RNA_def_property_ui_text(prop, "Face Smoothness", "Take face smoothness into account in view map calculation");
2968 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2970 prop = RNA_def_property(srna, "use_advanced_options", PROP_BOOLEAN, PROP_NONE);
2971 RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_ADVANCED_OPTIONS_FLAG);
2972 RNA_def_property_ui_text(prop, "Advanced Options",
2973 "Enable advanced edge detection options (sphere radius and Kr derivative epsilon)");
2974 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2976 prop = RNA_def_property(srna, "sphere_radius", PROP_FLOAT, PROP_NONE);
2977 RNA_def_property_float_sdna(prop, NULL, "sphere_radius");
2978 RNA_def_property_range(prop, 0.0, 1000.0);
2979 RNA_def_property_ui_text(prop, "Sphere Radius", "Sphere radius for computing curvatures");
2980 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2982 prop = RNA_def_property(srna, "kr_derivative_epsilon", PROP_FLOAT, PROP_NONE);
2983 RNA_def_property_float_sdna(prop, NULL, "dkr_epsilon");
2984 RNA_def_property_range(prop, -1000.0, 1000.0);
2985 RNA_def_property_ui_text(prop, "Kr Derivative Epsilon", "Kr derivative epsilon for computing suggestive contours");
2986 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2988 prop = RNA_def_property(srna, "crease_angle", PROP_FLOAT, PROP_ANGLE);
2989 RNA_def_property_float_sdna(prop, NULL, "crease_angle");
2990 RNA_def_property_range(prop, 0.0, DEG2RAD(180.0));
2991 RNA_def_property_ui_text(prop, "Crease Angle", "Angular threshold for detecting crease edges");
2992 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
2994 prop = RNA_def_property(srna, "linesets", PROP_COLLECTION, PROP_NONE);
2995 RNA_def_property_collection_sdna(prop, NULL, "linesets", NULL);
2996 RNA_def_property_struct_type(prop, "FreestyleLineSet");
2997 RNA_def_property_ui_text(prop, "Line Sets", "");
2998 rna_def_freestyle_linesets(brna, prop);
3001 static void rna_def_scene_game_recast_data(BlenderRNA *brna)
3006 srna = RNA_def_struct(brna, "SceneGameRecastData", NULL);
3007 RNA_def_struct_sdna(srna, "RecastData");
3008 RNA_def_struct_nested(brna, srna, "Scene");
3009 RNA_def_struct_ui_text(srna, "Recast Data", "Recast data for a Game datablock");
3011 prop = RNA_def_property(srna, "cell_size", PROP_FLOAT, PROP_NONE);
3012 RNA_def_property_float_sdna(prop, NULL, "cellsize");
3013 RNA_def_property_ui_range(prop, 0.1, 1, 1, 2);
3014 RNA_def_property_ui_text(prop, "Cell Size", "Rasterized cell size");
3015 RNA_def_property_update(prop, NC_SCENE, NULL);
3017 prop = RNA_def_property(srna, "cell_height", PROP_FLOAT, PROP_NONE);
3018 RNA_def_property_float_sdna(prop, NULL, "cellheight");
3019 RNA_def_property_ui_range(prop, 0.1, 1, 1, 2);
3020 RNA_def_property_ui_text(prop, "Cell Height", "Rasterized cell height");
3021 RNA_def_property_update(prop, NC_SCENE, NULL);
3023 prop = RNA_def_property(srna, "agent_height", PROP_FLOAT, PROP_NONE);
3024 RNA_def_property_float_sdna(prop, NULL, "agentheight");
3025 RNA_def_property_ui_range(prop, 0.1, 5, 1, 2);
3026 RNA_def_property_ui_text(prop, "Agent Height", "Minimum height where the agent can still walk");
3027 RNA_def_property_update(prop, NC_SCENE, NULL);
3029 prop = RNA_def_property(srna, "agent_radius", PROP_FLOAT, PROP_NONE);
3030 RNA_def_property_float_sdna(prop, NULL, "agentradius");
3031 RNA_def_property_ui_range(prop, 0.1, 5, 1, 2);
3032 RNA_def_property_ui_text(prop, "Agent Radius", "Radius of the agent");
3033 RNA_def_property_update(prop, NC_SCENE, NULL);
3035 prop = RNA_def_property(srna, "climb_max", PROP_FLOAT, PROP_NONE);
3036 RNA_def_property_float_sdna(prop, NULL, "agentmaxclimb");
3037 RNA_def_property_ui_range(prop, 0.1, 5, 1, 2);
3038 RNA_def_property_ui_text(prop, "Max Climb", "Maximum height between grid cells the agent can climb");
3039 RNA_def_property_update(prop, NC_SCENE, NULL);
3041 prop = RNA_def_property(srna, "slope_max", PROP_FLOAT, PROP_ANGLE);
3042 RNA_def_property_float_sdna(prop, NULL, "agentmaxslope");
3043 RNA_def_property_range(prop, 0, M_PI / 2);
3044 RNA_def_property_ui_text(prop, "Max Slope", "Maximum walkable slope angle");
3045 RNA_def_property_update(prop, NC_SCENE, NULL);
3048 prop = RNA_def_property(srna, "region_min_size", PROP_FLOAT, PROP_NONE);
3049 RNA_def_property_float_sdna(prop, NULL, "regionminsize");
3050 RNA_def_property_ui_range(prop, 0, 150, 1, 2);
3051 RNA_def_property_ui_text(prop, "Min Region Size", "Minimum regions size (smaller regions will be deleted)");
3052 RNA_def_property_update(prop, NC_SCENE, NULL);
3054 prop = RNA_def_property(srna, "region_merge_size", PROP_FLOAT, PROP_NONE);
3055 RNA_def_property_float_sdna(prop, NULL, "regionmergesize");
3056 RNA_def_property_ui_range(prop, 0, 150, 1, 2);
3057 RNA_def_property_ui_text(prop, "Merged Region Size", "Minimum regions size (smaller regions will be merged)");
3058 RNA_def_property_update(prop, NC_SCENE, NULL);
3060 prop = RNA_def_property(srna, "edge_max_len", PROP_FLOAT, PROP_NONE);
3061 RNA_def_property_float_sdna(prop, NULL, "edgemaxlen");
3062 RNA_def_property_ui_range(prop, 0, 50, 1, 2);
3063 RNA_def_property_ui_text(prop, "Max Edge Length", "Maximum contour edge length");
3064 RNA_def_property_update(prop, NC_SCENE, NULL);
3066 prop = RNA_def_property(srna, "edge_max_error", PROP_FLOAT, PROP_NONE);
3067 RNA_def_property_float_sdna(prop, NULL, "edgemaxerror");
3068 RNA_def_property_ui_range(prop, 0.1, 3.0, 1, 2);
3069 RNA_def_property_ui_text(prop, "Max Edge Error", "Maximum distance error from contour to cells");
3070 RNA_def_property_update(prop, NC_SCENE, NULL);
3072 prop = RNA_def_property(srna, "verts_per_poly", PROP_INT, PROP_NONE);
3073 RNA_def_property_int_sdna(prop, NULL, "vertsperpoly");
3074 RNA_def_property_ui_range(prop, 3, 12, 1, -1);
3075 RNA_def_property_ui_text(prop, "Verts Per Poly", "Max number of vertices per polygon");
3076 RNA_def_property_update(prop, NC_SCENE, NULL);
3078 prop = RNA_def_property(srna, "sample_dist", PROP_FLOAT, PROP_NONE);
3079 RNA_def_property_float_sdna(prop, NULL, "detailsampledist");
3080 RNA_def_property_ui_range(prop, 0.0, 16.0, 1, 2);
3081 RNA_def_property_ui_text(prop, "Sample Distance", "Detail mesh sample spacing");
3082 RNA_def_property_update(prop, NC_SCENE, NULL);
3084 prop = RNA_def_property(srna, "sample_max_error", PROP_FLOAT, PROP_NONE);
3085 RNA_def_property_float_sdna(prop, NULL, "detailsamplemaxerror");
3086 RNA_def_property_ui_range(prop, 0.0, 16.0, 1, 2);
3087 RNA_def_property_ui_text(prop, "Max Sample Error", "Detail mesh simplification max sample error");
3088 RNA_def_property_update(prop, NC_SCENE, NULL);
3091 static void rna_def_scene_game_data(BlenderRNA *brna)
3096 static EnumPropertyItem aasamples_items[] = {
3097 {0, "SAMPLES_0", 0, "Off", ""},
3098 {2, "SAMPLES_2", 0, "2x", ""},
3099 {4, "SAMPLES_4", 0, "4x", ""},
3100 {8, "SAMPLES_8", 0, "8x", ""},
3101 {16, "SAMPLES_16", 0, "16x", ""},
3102 {0, NULL, 0, NULL, NULL}
3105 static EnumPropertyItem framing_types_items[] = {
3106 {SCE_GAMEFRAMING_BARS, "LETTERBOX", 0, "Letterbox",
3107 "Show the entire viewport in the display window, using bar horizontally or vertically"},
3108 {SCE_GAMEFRAMING_EXTEND, "EXTEND", 0, "Extend",
3109 "Show the entire viewport in the display window, viewing more horizontally "
3111 {SCE_GAMEFRAMING_SCALE, "SCALE", 0, "Scale", "Stretch or squeeze the viewport to fill the display window"},
3112 {0, NULL, 0, NULL, NULL}
3115 static EnumPropertyItem dome_modes_items[] = {
3116 {DOME_FISHEYE, "FISHEYE", 0, "Fisheye", ""},
3117 {DOME_TRUNCATED_FRONT, "TRUNCATED_FRONT", 0, "Front-Truncated", ""},
3118 {DOME_TRUNCATED_REAR, "TRUNCATED_REAR", 0, "Rear-Truncated", ""},
3119 {DOME_ENVMAP, "ENVMAP", 0, "Cube Map", ""},
3120 {DOME_PANORAM_SPH, "PANORAM_SPH", 0, "Spherical Panoramic", ""},
3121 {0, NULL, 0, NULL, NULL}
3124 static EnumPropertyItem stereo_modes_items[] = {
3125 {STEREO_QUADBUFFERED, "QUADBUFFERED", 0, "Quad-Buffer", ""},
3126 {STEREO_ABOVEBELOW, "ABOVEBELOW", 0, "Above-Below", ""},
3127 {STEREO_INTERLACED, "INTERLACED", 0, "Interlaced", ""},
3128 {STEREO_ANAGLYPH, "ANAGLYPH", 0, "Anaglyph", ""},
3129 {STEREO_SIDEBYSIDE, "SIDEBYSIDE", 0, "Side-by-side", ""},
3130 {STEREO_VINTERLACE, "VINTERLACE", 0, "Vinterlace", ""},
3131 {0, NULL, 0, NULL, NULL}
3134 static EnumPropertyItem stereo_items[] = {
3135 {STEREO_NOSTEREO, "NONE", 0, "None", "Disable Stereo and Dome environments"},
3136 {STEREO_ENABLED, "STEREO", 0, "Stereo", "Enable Stereo environment"},
3137 {STEREO_DOME, "DOME", 0, "Dome", "Enable Dome environment"},
3138 {0, NULL, 0, NULL, NULL}
3141 static EnumPropertyItem physics_engine_items[] = {
3142 {WOPHY_NONE, "NONE", 0, "None", "Don't use a physics engine"},
3143 {WOPHY_BULLET, "BULLET", 0, "Bullet", "Use the Bullet physics engine"},
3144 {0, NULL, 0, NULL, NULL}