1 /*
2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU General Public License
4 * as published by the Free Software Foundation; either version 2
5 * of the License, or (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software Foundation,
14 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15 */
16
17 /** \file
18 * \ingroup RNA
19 */
20
21 #include <stdlib.h>
22
23 #include "DNA_brush_types.h"
24 #include "DNA_collection_types.h"
25 #include "DNA_gpencil_types.h"
26 #include "DNA_layer_types.h"
27 #include "DNA_linestyle_types.h"
28 #include "DNA_modifier_types.h"
29 #include "DNA_particle_types.h"
30 #include "DNA_rigidbody_types.h"
31 #include "DNA_scene_types.h"
32 #include "DNA_screen_types.h" /* TransformOrientation */
33 #include "DNA_userdef_types.h"
34 #include "DNA_view3d_types.h"
35 #include "DNA_world_types.h"
36
37 #include "IMB_imbuf_types.h"
38
39 #include "BLI_listbase.h"
40 #include "BLI_math.h"
41
42 #include "BLT_translation.h"
43
44 #include "BKE_armature.h"
45 #include "BKE_editmesh.h"
46 #include "BKE_paint.h"
47 #include "BKE_volume.h"
48
49 #include "ED_gpencil.h"
50 #include "ED_object.h"
51
52 #include "RNA_define.h"
53 #include "RNA_enum_types.h"
54
55 #include "rna_internal.h"
56
57 /* Include for Bake Options */
58 #include "RE_engine.h"
59 #include "RE_pipeline.h"
60
61 #ifdef WITH_FFMPEG
62 # include "BKE_writeffmpeg.h"
63 # include "ffmpeg_compat.h"
64 # include <libavcodec/avcodec.h>
65 # include <libavformat/avformat.h>
66 #endif
67
68 #include "ED_render.h"
69 #include "ED_transform.h"
70
71 #include "WM_api.h"
72 #include "WM_types.h"
73
74 #include "BLI_threads.h"
75
76 #include "DEG_depsgraph.h"
77
78 #ifdef WITH_OPENEXR
79 const EnumPropertyItem rna_enum_exr_codec_items[] = {
80 {R_IMF_EXR_CODEC_NONE, "NONE", 0, "None", ""},
81 {R_IMF_EXR_CODEC_PXR24, "PXR24", 0, "Pxr24 (lossy)", ""},
82 {R_IMF_EXR_CODEC_ZIP, "ZIP", 0, "ZIP (lossless)", ""},
83 {R_IMF_EXR_CODEC_PIZ, "PIZ", 0, "PIZ (lossless)", ""},
84 {R_IMF_EXR_CODEC_RLE, "RLE", 0, "RLE (lossless)", ""},
85 {R_IMF_EXR_CODEC_ZIPS, "ZIPS", 0, "ZIPS (lossless)", ""},
86 {R_IMF_EXR_CODEC_B44, "B44", 0, "B44 (lossy)", ""},
87 {R_IMF_EXR_CODEC_B44A, "B44A", 0, "B44A (lossy)", ""},
88 {R_IMF_EXR_CODEC_DWAA, "DWAA", 0, "DWAA (lossy)", ""},
89 /* NOTE: Commented out for until new OpenEXR is released, see T50673. */
90 /* {R_IMF_EXR_CODEC_DWAB, "DWAB", 0, "DWAB (lossy)", ""}, */
91 {0, NULL, 0, NULL, NULL},
92 };
93 #endif
94
95 #ifndef RNA_RUNTIME
96 static const EnumPropertyItem uv_sculpt_relaxation_items[] = {
97 {UV_SCULPT_TOOL_RELAX_LAPLACIAN,
98 "LAPLACIAN",
99 0,
100 "Laplacian",
101 "Use Laplacian method for relaxation"},
102 {UV_SCULPT_TOOL_RELAX_HC, "HC", 0, "HC", "Use HC method for relaxation"},
103 {0, NULL, 0, NULL, NULL},
104 };
105 #endif
106
107 const EnumPropertyItem rna_enum_snap_target_items[] = {
108 {SCE_SNAP_TARGET_CLOSEST, "CLOSEST", 0, "Closest", "Snap closest point onto target"},
109 {SCE_SNAP_TARGET_CENTER, "CENTER", 0, "Center", "Snap transformation center onto target"},
110 {SCE_SNAP_TARGET_MEDIAN, "MEDIAN", 0, "Median", "Snap median onto target"},
111 {SCE_SNAP_TARGET_ACTIVE, "ACTIVE", 0, "Active", "Snap active onto target"},
112 {0, NULL, 0, NULL, NULL},
113 };
114
115 const EnumPropertyItem rna_enum_proportional_falloff_items[] = {
116 {PROP_SMOOTH, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", "Smooth falloff"},
117 {PROP_SPHERE, "SPHERE", ICON_SPHERECURVE, "Sphere", "Spherical falloff"},
118 {PROP_ROOT, "ROOT", ICON_ROOTCURVE, "Root", "Root falloff"},
119 {PROP_INVSQUARE,
120 "INVERSE_SQUARE",
121 ICON_INVERSESQUARECURVE,
122 "Inverse Square",
123 "Inverse Square falloff"},
124 {PROP_SHARP, "SHARP", ICON_SHARPCURVE, "Sharp", "Sharp falloff"},
125 {PROP_LIN, "LINEAR", ICON_LINCURVE, "Linear", "Linear falloff"},
126 {PROP_CONST, "CONSTANT", ICON_NOCURVE, "Constant", "Constant falloff"},
127 {PROP_RANDOM, "RANDOM", ICON_RNDCURVE, "Random", "Random falloff"},
128 {0, NULL, 0, NULL, NULL},
129 };
130
131 /* subset of the enum - only curves, missing random and const */
132 const EnumPropertyItem rna_enum_proportional_falloff_curve_only_items[] = {
133 {PROP_SMOOTH, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", "Smooth falloff"},
134 {PROP_SPHERE, "SPHERE", ICON_SPHERECURVE, "Sphere", "Spherical falloff"},
135 {PROP_ROOT, "ROOT", ICON_ROOTCURVE, "Root", "Root falloff"},
136 {PROP_INVSQUARE, "INVERSE_SQUARE", ICON_ROOTCURVE, "Inverse Square", "Inverse Square falloff"},
137 {PROP_SHARP, "SHARP", ICON_SHARPCURVE, "Sharp", "Sharp falloff"},
138 {PROP_LIN, "LINEAR", ICON_LINCURVE, "Linear", "Linear falloff"},
139 {0, NULL, 0, NULL, NULL},
140 };
141
142 /* keep for operators, not used here */
143 const EnumPropertyItem rna_enum_mesh_select_mode_items[] = {
144 {SCE_SELECT_VERTEX, "VERT", ICON_VERTEXSEL, "Vertex", "Vertex selection mode"},
145 {SCE_SELECT_EDGE, "EDGE", ICON_EDGESEL, "Edge", "Edge selection mode"},
146 {SCE_SELECT_FACE, "FACE", ICON_FACESEL, "Face", "Face selection mode"},
147 {0, NULL, 0, NULL, NULL},
148 };
149
150 const EnumPropertyItem rna_enum_mesh_select_mode_uv_items[] = {
151 {UV_SELECT_VERTEX, "VERTEX", ICON_UV_VERTEXSEL, "Vertex", "Vertex selection mode"},
152 {UV_SELECT_EDGE, "EDGE", ICON_UV_EDGESEL, "Edge", "Edge selection mode"},
153 {UV_SELECT_FACE, "FACE", ICON_UV_FACESEL, "Face", "Face selection mode"},
154 {UV_SELECT_ISLAND, "ISLAND", ICON_UV_ISLANDSEL, "Island", "Island selection mode"},
155 {0, NULL, 0, NULL, NULL},
156 };
157
158 const EnumPropertyItem rna_enum_snap_element_items[] = {
159 {SCE_SNAP_MODE_INCREMENT,
160 "INCREMENT",
161 ICON_SNAP_INCREMENT,
162 "Increment",
163 "Snap to increments of grid"},
164 {SCE_SNAP_MODE_VERTEX, "VERTEX", ICON_SNAP_VERTEX, "Vertex", "Snap to vertices"},
165 {SCE_SNAP_MODE_EDGE, "EDGE", ICON_SNAP_EDGE, "Edge", "Snap to edges"},
166 {SCE_SNAP_MODE_FACE, "FACE", ICON_SNAP_FACE, "Face", "Snap to faces"},
167 {SCE_SNAP_MODE_VOLUME, "VOLUME", ICON_SNAP_VOLUME, "Volume", "Snap to volume"},
168 {SCE_SNAP_MODE_EDGE_MIDPOINT,
169 "EDGE_MIDPOINT",
170 ICON_SNAP_MIDPOINT,
171 "Edge Center",
172 "Snap to the middle of edges"},
173 {SCE_SNAP_MODE_EDGE_PERPENDICULAR,
174 "EDGE_PERPENDICULAR",
175 ICON_SNAP_PERPENDICULAR,
176 "Edge Perpendicular",
177 "Snap to the nearest point on an edge"},
178 {0, NULL, 0, NULL, NULL},
179 };
180
181 const EnumPropertyItem rna_enum_snap_node_element_items[] = {
182 {SCE_SNAP_MODE_GRID, "GRID", ICON_SNAP_GRID, "Grid", "Snap to grid"},
183 {SCE_SNAP_MODE_NODE_X, "NODE_X", ICON_NODE_SIDE, "Node X", "Snap to left/right node border"},
184 {SCE_SNAP_MODE_NODE_Y, "NODE_Y", ICON_NODE_TOP, "Node Y", "Snap to top/bottom node border"},
185 {SCE_SNAP_MODE_NODE_X | SCE_SNAP_MODE_NODE_Y,
186 "NODE_XY",
187 ICON_NODE_CORNER,
188 "Node X / Y",
189 "Snap to any node border"},
190 {0, NULL, 0, NULL, NULL},
191 };
192
193 #ifndef RNA_RUNTIME
194 static const EnumPropertyItem snap_uv_element_items[] = {
195 {SCE_SNAP_MODE_INCREMENT,
196 "INCREMENT",
197 ICON_SNAP_INCREMENT,
198 "Increment",
199 "Snap to increments of grid"},
200 {SCE_SNAP_MODE_VERTEX, "VERTEX", ICON_SNAP_VERTEX, "Vertex", "Snap to vertices"},
201 {0, NULL, 0, NULL, NULL},
202 };
203
204 static const EnumPropertyItem rna_enum_scene_display_aa_methods[] = {
205 {SCE_DISPLAY_AA_OFF,
206 "OFF",
207 0,
208 "No Anti-Aliasing",
209 "Scene will be rendering without any anti-aliasing"},
210 {SCE_DISPLAY_AA_FXAA,
211 "FXAA",
212 0,
213 "Single Pass Anti-Aliasing",
214 "Scene will be rendered using a single pass anti-aliasing method (FXAA)"},
215 {SCE_DISPLAY_AA_SAMPLES_5,
216 "5",
217 0,
218 "5 Samples",
219 "Scene will be rendered using 5 anti-aliasing samples"},
220 {SCE_DISPLAY_AA_SAMPLES_8,
221 "8",
222 0,
223 "8 Samples",
224 "Scene will be rendered using 8 anti-aliasing samples"},
225 {SCE_DISPLAY_AA_SAMPLES_11,
226 "11",
227 0,
228 "11 Samples",
229 "Scene will be rendered using 11 anti-aliasing samples"},
230 {SCE_DISPLAY_AA_SAMPLES_16,
231 "16",
232 0,
233 "16 Samples",
234 "Scene will be rendered using 16 anti-aliasing samples"},
235 {SCE_DISPLAY_AA_SAMPLES_32,
236 "32",
237 0,
238 "32 Samples",
239 "Scene will be rendered using 32 anti-aliasing samples"},
240 {0, NULL, 0, NULL, NULL},
241 };
242 #endif
243
244 const EnumPropertyItem rna_enum_curve_fit_method_items[] = {
245 {CURVE_PAINT_FIT_METHOD_REFIT,
246 "REFIT",
247 0,
248 "Refit",
249 "Incrementally re-fit the curve (high quality)"},
250 {CURVE_PAINT_FIT_METHOD_SPLIT,
251 "SPLIT",
252 0,
253 "Split",
254 "Split the curve until the tolerance is met (fast)"},
255 {0, NULL, 0, NULL, NULL},
256 };
257
258 /* workaround for duplicate enums,
259 * have each enum line as a define then conditionally set it or not
260 */
261
262 #define R_IMF_ENUM_BMP \
263 {R_IMF_IMTYPE_BMP, "BMP", ICON_FILE_IMAGE, "BMP", "Output image in bitmap format"},
264 #define R_IMF_ENUM_IRIS \
265 {R_IMF_IMTYPE_IRIS, "IRIS", ICON_FILE_IMAGE, "Iris", "Output image in (old!) SGI IRIS format"},
266 #define R_IMF_ENUM_PNG \
267 {R_IMF_IMTYPE_PNG, "PNG", ICON_FILE_IMAGE, "PNG", "Output image in PNG format"},
268 #define R_IMF_ENUM_JPEG \
269 {R_IMF_IMTYPE_JPEG90, "JPEG", ICON_FILE_IMAGE, "JPEG", "Output image in JPEG format"},
270 #define R_IMF_ENUM_TAGA \
271 {R_IMF_IMTYPE_TARGA, "TARGA", ICON_FILE_IMAGE, "Targa", "Output image in Targa format"},
272 #define R_IMF_ENUM_TAGA_RAW \
273 {R_IMF_IMTYPE_RAWTGA, \
274 "TARGA_RAW", \
275 ICON_FILE_IMAGE, \
276 "Targa Raw", \
277 "Output image in uncompressed Targa format"},
278
279 #if 0 /* UNUSED (so far) */
280 # ifdef WITH_DDS
281 # define R_IMF_ENUM_DDS \
282 {R_IMF_IMTYPE_DDS, "DDS", ICON_FILE_IMAGE, "DDS", "Output image in DDS format"},
283 # else
284 # define R_IMF_ENUM_DDS
285 # endif
286 #endif
287
288 #ifdef WITH_OPENJPEG
289 # define R_IMF_ENUM_JPEG2K \
290 {R_IMF_IMTYPE_JP2, \
291 "JPEG2000", \
292 ICON_FILE_IMAGE, \
293 "JPEG 2000", \
294 "Output image in JPEG 2000 format"},
295 #else
296 # define R_IMF_ENUM_JPEG2K
297 #endif
298
299 #ifdef WITH_CINEON
300 # define R_IMF_ENUM_CINEON \
301 {R_IMF_IMTYPE_CINEON, "CINEON", ICON_FILE_IMAGE, "Cineon", "Output image in Cineon format"},
302 # define R_IMF_ENUM_DPX \
303 {R_IMF_IMTYPE_DPX, "DPX", ICON_FILE_IMAGE, "DPX", "Output image in DPX format"},
304 #else
305 # define R_IMF_ENUM_CINEON
306 # define R_IMF_ENUM_DPX
307 #endif
308
309 #ifdef WITH_OPENEXR
310 # define R_IMF_ENUM_EXR_MULTILAYER \
311 {R_IMF_IMTYPE_MULTILAYER, \
312 "OPEN_EXR_MULTILAYER", \
313 ICON_FILE_IMAGE, \
314 "OpenEXR MultiLayer", \
315 "Output image in multilayer OpenEXR format"},
316 # define R_IMF_ENUM_EXR \
317 {R_IMF_IMTYPE_OPENEXR, \
318 "OPEN_EXR", \
319 ICON_FILE_IMAGE, \
320 "OpenEXR", \
321 "Output image in OpenEXR format"},
322 #else
323 # define R_IMF_ENUM_EXR_MULTILAYER
324 # define R_IMF_ENUM_EXR
325 #endif
326
327 #ifdef WITH_HDR
328 # define R_IMF_ENUM_HDR \
329 {R_IMF_IMTYPE_RADHDR, \
330 "HDR", \
331 ICON_FILE_IMAGE, \
332 "Radiance HDR", \
333 "Output image in Radiance HDR format"},
334 #else
335 # define R_IMF_ENUM_HDR
336 #endif
337
338 #ifdef WITH_TIFF
339 # define R_IMF_ENUM_TIFF \
340 {R_IMF_IMTYPE_TIFF, "TIFF", ICON_FILE_IMAGE, "TIFF", "Output image in TIFF format"},
341 #else
342 # define R_IMF_ENUM_TIFF
343 #endif
344
345 #define IMAGE_TYPE_ITEMS_IMAGE_ONLY \
346 R_IMF_ENUM_BMP \
347 /* DDS save not supported yet R_IMF_ENUM_DDS */ \
348 R_IMF_ENUM_IRIS \
349 R_IMF_ENUM_PNG \
350 R_IMF_ENUM_JPEG \
351 R_IMF_ENUM_JPEG2K \
352 R_IMF_ENUM_TAGA \
353 R_IMF_ENUM_TAGA_RAW{0, "", 0, " ", NULL}, \
354 R_IMF_ENUM_CINEON R_IMF_ENUM_DPX R_IMF_ENUM_EXR_MULTILAYER R_IMF_ENUM_EXR R_IMF_ENUM_HDR \
355 R_IMF_ENUM_TIFF
356
357 #ifdef RNA_RUNTIME
358 static const EnumPropertyItem image_only_type_items[] = {
359
360 IMAGE_TYPE_ITEMS_IMAGE_ONLY
361
362 {0, NULL, 0, NULL, NULL},
363 };
364 #endif
365
366 const EnumPropertyItem rna_enum_image_type_items[] = {
367 {0, "", 0, N_("Image"), NULL},
368
369 IMAGE_TYPE_ITEMS_IMAGE_ONLY
370
371 {0, "", 0, N_("Movie"), NULL},
372 {R_IMF_IMTYPE_AVIJPEG,
373 "AVI_JPEG",
374 ICON_FILE_MOVIE,
375 "AVI JPEG",
376 "Output video in AVI JPEG format"},
377 {R_IMF_IMTYPE_AVIRAW, "AVI_RAW", ICON_FILE_MOVIE, "AVI Raw", "Output video in AVI Raw format"},
378 #ifdef WITH_FFMPEG
379 {R_IMF_IMTYPE_FFMPEG,
380 "FFMPEG",
381 ICON_FILE_MOVIE,
382 "FFmpeg video",
383 "The most versatile way to output video files"},
384 #endif
385 {0, NULL, 0, NULL, NULL},
386 };
387
388 const EnumPropertyItem rna_enum_image_color_mode_items[] = {
389 {R_IMF_PLANES_BW,
390 "BW",
391 0,
392 "BW",
393 "Images get saved in 8 bits grayscale (only PNG, JPEG, TGA, TIF)"},
394 {R_IMF_PLANES_RGB, "RGB", 0, "RGB", "Images are saved with RGB (color) data"},
395 {R_IMF_PLANES_RGBA,
396 "RGBA",
397 0,
398 "RGBA",
399 "Images are saved with RGB and Alpha data (if supported)"},
400 {0, NULL, 0, NULL, NULL},
401 };
402
403 #ifdef RNA_RUNTIME
404 # define IMAGE_COLOR_MODE_BW rna_enum_image_color_mode_items[0]
405 # define IMAGE_COLOR_MODE_RGB rna_enum_image_color_mode_items[1]
406 # define IMAGE_COLOR_MODE_RGBA rna_enum_image_color_mode_items[2]
407 #endif
408
409 const EnumPropertyItem rna_enum_image_color_depth_items[] = {
410 /* 1 (monochrome) not used */
411 {R_IMF_CHAN_DEPTH_8, "8", 0, "8", "8 bit color channels"},
412 {R_IMF_CHAN_DEPTH_10, "10", 0, "10", "10 bit color channels"},
413 {R_IMF_CHAN_DEPTH_12, "12", 0, "12", "12 bit color channels"},
414 {R_IMF_CHAN_DEPTH_16, "16", 0, "16", "16 bit color channels"},
415 /* 24 not used */
416 {R_IMF_CHAN_DEPTH_32, "32", 0, "32", "32 bit color channels"},
417 {0, NULL, 0, NULL, NULL},
418 };
419
420 const EnumPropertyItem rna_enum_normal_space_items[] = {
421 {R_BAKE_SPACE_OBJECT, "OBJECT", 0, "Object", "Bake the normals in object space"},
422 {R_BAKE_SPACE_TANGENT, "TANGENT", 0, "Tangent", "Bake the normals in tangent space"},
423 {0, NULL, 0, NULL, NULL},
424 };
425
426 const EnumPropertyItem rna_enum_normal_swizzle_items[] = {
427 {R_BAKE_POSX, "POS_X", 0, "+X", ""},
428 {R_BAKE_POSY, "POS_Y", 0, "+Y", ""},
429 {R_BAKE_POSZ, "POS_Z", 0, "+Z", ""},
430 {R_BAKE_NEGX, "NEG_X", 0, "-X", ""},
431 {R_BAKE_NEGY, "NEG_Y", 0, "-Y", ""},
432 {R_BAKE_NEGZ, "NEG_Z", 0, "-Z", ""},
433 {0, NULL, 0, NULL, NULL},
434 };
435
436 const EnumPropertyItem rna_enum_bake_save_mode_items[] = {
437 {R_BAKE_SAVE_INTERNAL,
438 "INTERNAL",
439 0,
440 "Internal",
441 "Save the baking map in an internal image data-block"},
442 {R_BAKE_SAVE_EXTERNAL, "EXTERNAL", 0, "External", "Save the baking map in an external file"},
443 {0, NULL, 0, NULL, NULL},
444 };
445
446 #define R_IMF_VIEWS_ENUM_IND \
447 {R_IMF_VIEWS_INDIVIDUAL, \
448 "INDIVIDUAL", \
449 0, \
450 "Individual", \
451 "Individual files for each view with the prefix as defined by the scene views"},
452 #define R_IMF_VIEWS_ENUM_S3D \
453 {R_IMF_VIEWS_STEREO_3D, "STEREO_3D", 0, "Stereo 3D", "Single file with an encoded stereo pair"},
454 #define R_IMF_VIEWS_ENUM_MV \
455 {R_IMF_VIEWS_MULTIVIEW, "MULTIVIEW", 0, "Multi-View", "Single file with all the views"},
456
457 const EnumPropertyItem rna_enum_views_format_items[] = {
458 R_IMF_VIEWS_ENUM_IND R_IMF_VIEWS_ENUM_S3D{0, NULL, 0, NULL, NULL},
459 };
460
461 const EnumPropertyItem rna_enum_views_format_multilayer_items[] = {
462 R_IMF_VIEWS_ENUM_IND R_IMF_VIEWS_ENUM_MV{0, NULL, 0, NULL, NULL},
463 };
464
465 const EnumPropertyItem rna_enum_views_format_multiview_items[] = {
466 R_IMF_VIEWS_ENUM_IND R_IMF_VIEWS_ENUM_S3D R_IMF_VIEWS_ENUM_MV{0, NULL, 0, NULL, NULL},
467 };
468
469 #undef R_IMF_VIEWS_ENUM_IND
470 #undef R_IMF_VIEWS_ENUM_S3D
471 #undef R_IMF_VIEWS_ENUM_MV
472
473 const EnumPropertyItem rna_enum_stereo3d_display_items[] = {
474 {S3D_DISPLAY_ANAGLYPH,
475 "ANAGLYPH",
476 0,
477 "Anaglyph",
478 "Render views for left and right eyes as two differently filtered colors in a single image "
479 "(anaglyph glasses are required)"},
480 {S3D_DISPLAY_INTERLACE,
481 "INTERLACE",
482 0,
483 "Interlace",
484 "Render views for left and right eyes interlaced in a single image (3D-ready monitor is "
485 "required)"},
486 {S3D_DISPLAY_PAGEFLIP,
487 "TIMESEQUENTIAL",
488 0,
489 "Time Sequential",
490 "Render alternate eyes (also known as page flip, quad buffer support in the graphic card is "
491 "required)"},
492 {S3D_DISPLAY_SIDEBYSIDE,
493 "SIDEBYSIDE",
494 0,
495 "Side-by-Side",
496 "Render views for left and right eyes side-by-side"},
497 {S3D_DISPLAY_TOPBOTTOM,
498 "TOPBOTTOM",
499 0,
500 "Top-Bottom",
501 "Render views for left and right eyes one above another"},
502 {0, NULL, 0, NULL, NULL},
503 };
504
505 const EnumPropertyItem rna_enum_stereo3d_anaglyph_type_items[] = {
506 {S3D_ANAGLYPH_REDCYAN, "RED_CYAN", 0, "Red-Cyan", ""},
507 {S3D_ANAGLYPH_GREENMAGENTA, "GREEN_MAGENTA", 0, "Green-Magenta", ""},
508 {S3D_ANAGLYPH_YELLOWBLUE, "YELLOW_BLUE", 0, "Yellow-Blue", ""},
509 {0, NULL, 0, NULL, NULL},
510 };
511
512 const EnumPropertyItem rna_enum_stereo3d_interlace_type_items[] = {
513 {S3D_INTERLACE_ROW, "ROW_INTERLEAVED", 0, "Row Interleaved", ""},
514 {S3D_INTERLACE_COLUMN, "COLUMN_INTERLEAVED", 0, "Column Interleaved", ""},
515 {S3D_INTERLACE_CHECKERBOARD, "CHECKERBOARD_INTERLEAVED", 0, "Checkerboard Interleaved", ""},
516 {0, NULL, 0, NULL, NULL},
517 };
518
519 const EnumPropertyItem rna_enum_bake_pass_filter_type_items[] = {
520 {R_BAKE_PASS_FILTER_NONE, "NONE", 0, "None", ""},
521 {R_BAKE_PASS_FILTER_AO, "AO", 0, "Ambient Occlusion", ""},
522 {R_BAKE_PASS_FILTER_EMIT, "EMIT", 0, "Emit", ""},
523 {R_BAKE_PASS_FILTER_DIRECT, "DIRECT", 0, "Direct", ""},
524 {R_BAKE_PASS_FILTER_INDIRECT, "INDIRECT", 0, "Indirect", ""},
525 {R_BAKE_PASS_FILTER_COLOR, "COLOR", 0, "Color", ""},
526 {R_BAKE_PASS_FILTER_DIFFUSE, "DIFFUSE", 0, "Diffuse", ""},
527 {R_BAKE_PASS_FILTER_GLOSSY, "GLOSSY", 0, "Glossy", ""},
528 {R_BAKE_PASS_FILTER_TRANSM, "TRANSMISSION", 0, "Transmission", ""},
529 {0, NULL, 0, NULL, NULL},
530 };
531
532 #ifndef RNA_RUNTIME
533 static const EnumPropertyItem rna_enum_gpencil_interpolation_mode_items[] = {
534 /* interpolation */
535 {0, "", 0, N_("Interpolation"), "Standard transitions between keyframes"},
536 {GP_IPO_LINEAR,
537 "LINEAR",
538 ICON_IPO_LINEAR,
539 "Linear",
540 "Straight-line interpolation between A and B (i.e. no ease in/out)"},
541 {GP_IPO_CURVEMAP,
542 "CUSTOM",
543 ICON_IPO_BEZIER,
544 "Custom",
545 "Custom interpolation defined using a curve map"},
546
547 /* easing */
548 {0,
549 "",
550 0,
551 N_("Easing (by strength)"),
552 "Predefined inertial transitions, useful for motion graphics (from least to most "
553 "''dramatic'')"},
554 {GP_IPO_SINE,
555 "SINE",
556 ICON_IPO_SINE,
557 "Sinusoidal",
558 "Sinusoidal easing (weakest, almost linear but with a slight curvature)"},
559 {GP_IPO_QUAD, "QUAD", ICON_IPO_QUAD, "Quadratic", "Quadratic easing"},
560 {GP_IPO_CUBIC, "CUBIC", ICON_IPO_CUBIC, "Cubic", "Cubic easing"},
561 {GP_IPO_QUART, "QUART", ICON_IPO_QUART, "Quartic", "Quartic easing"},
562 {GP_IPO_QUINT, "QUINT", ICON_IPO_QUINT, "Quintic", "Quintic easing"},
563 {GP_IPO_EXPO, "EXPO", ICON_IPO_EXPO, "Exponential", "Exponential easing (dramatic)"},
564 {GP_IPO_CIRC,
565 "CIRC",
566 ICON_IPO_CIRC,
567 "Circular",
568 "Circular easing (strongest and most dynamic)"},
569
570 {0, "", 0, N_("Dynamic Effects"), "Simple physics-inspired easing effects"},
571 {GP_IPO_BACK, "BACK", ICON_IPO_BACK, "Back", "Cubic easing with overshoot and settle"},
572 {GP_IPO_BOUNCE,
573 "BOUNCE",
574 ICON_IPO_BOUNCE,
575 "Bounce",
576 "Exponentially decaying parabolic bounce, like when objects collide"},
577 {GP_IPO_ELASTIC,
578 "ELASTIC",
579 ICON_IPO_ELASTIC,
580 "Elastic",
581 "Exponentially decaying sine wave, like an elastic band"},
582
583 {0, NULL, 0, NULL, NULL},
584 };
585
586 #endif
587
588 const EnumPropertyItem rna_enum_transform_pivot_items_full[] = {
589 {V3D_AROUND_CENTER_BOUNDS,
590 "BOUNDING_BOX_CENTER",
591 ICON_PIVOT_BOUNDBOX,
592 "Bounding Box Center",
593 "Pivot around bounding box center of selected object(s)"},
594 {V3D_AROUND_CURSOR, "CURSOR", ICON_PIVOT_CURSOR, "3D Cursor", "Pivot around the 3D cursor"},
595 {V3D_AROUND_LOCAL_ORIGINS,
596 "INDIVIDUAL_ORIGINS",
597 ICON_PIVOT_INDIVIDUAL,
598 "Individual Origins",
599 "Pivot around each object's own origin"},
600 {V3D_AROUND_CENTER_MEDIAN,
601 "MEDIAN_POINT",
602 ICON_PIVOT_MEDIAN,
603 "Median Point",
604 "Pivot around the median point of selected objects"},
605 {V3D_AROUND_ACTIVE,
606 "ACTIVE_ELEMENT",
607 ICON_PIVOT_ACTIVE,
608 "Active Element",
609 "Pivot around active object"},
610 {0, NULL, 0, NULL, NULL},
611 };
612
613 /* Icons could be made a consistent set of images. */
614 const EnumPropertyItem rna_enum_transform_orientation_items[] = {
615 {V3D_ORIENT_GLOBAL,
616 "GLOBAL",
617 ICON_ORIENTATION_GLOBAL,
618 "Global",
619 "Align the transformation axes to world space"},
620 {V3D_ORIENT_LOCAL,
621 "LOCAL",
622 ICON_ORIENTATION_LOCAL,
623 "Local",
624 "Align the transformation axes to the selected objects' local space"},
625 {V3D_ORIENT_NORMAL,
626 "NORMAL",
627 ICON_ORIENTATION_NORMAL,
628 "Normal",
629 "Align the transformation axes to average normal of selected elements "
630 "(bone Y axis for pose mode)"},
631 {V3D_ORIENT_GIMBAL,
632 "GIMBAL",
633 ICON_ORIENTATION_GIMBAL,
634 "Gimbal",
635 "Align each axis to the Euler rotation axis as used for input"},
636 {V3D_ORIENT_VIEW,
637 "VIEW",
638 ICON_ORIENTATION_VIEW,
639 "View",
640 "Align the transformation axes to the window"},
641 {V3D_ORIENT_CURSOR,
642 "CURSOR",
643 ICON_ORIENTATION_CURSOR,
644 "Cursor",
645 "Align the transformation axes to the 3D cursor"},
646 // {V3D_ORIENT_CUSTOM, "CUSTOM", 0, "Custom", "Use a custom transform orientation"},
647 {0, NULL, 0, NULL, NULL},
648 };
649
650 #ifdef RNA_RUNTIME
651
652 # include "BLI_string_utils.h"
653
654 # include "DNA_anim_types.h"
655 # include "DNA_color_types.h"
656 # include "DNA_mesh_types.h"
657 # include "DNA_node_types.h"
658 # include "DNA_object_types.h"
659 # include "DNA_text_types.h"
660 # include "DNA_workspace_types.h"
661
662 # include "RNA_access.h"
663
664 # include "MEM_guardedalloc.h"
665
666 # include "BKE_animsys.h"
667 # include "BKE_brush.h"
668 # include "BKE_collection.h"
669 # include "BKE_colortools.h"
670 # include "BKE_context.h"
671 # include "BKE_freestyle.h"
672 # include "BKE_global.h"
673 # include "BKE_gpencil.h"
674 # include "BKE_idprop.h"
675 # include "BKE_image.h"
676 # include "BKE_layer.h"
677 # include "BKE_main.h"
678 # include "BKE_mesh.h"
679 # include "BKE_node.h"
680 # include "BKE_pointcache.h"
681 # include "BKE_scene.h"
682 # include "BKE_screen.h"
683 # include "BKE_sequencer.h"
684 # include "BKE_unit.h"
685
686 # include "ED_image.h"
687 # include "ED_info.h"
688 # include "ED_keyframing.h"
689 # include "ED_mesh.h"
690 # include "ED_node.h"
691 # include "ED_scene.h"
692 # include "ED_view3d.h"
693
694 # include "DEG_depsgraph_build.h"
695 # include "DEG_depsgraph_query.h"
696
697 # ifdef WITH_FREESTYLE
698 # include "FRS_freestyle.h"
699 # endif
700
rna_ToolSettings_snap_mode_set(struct PointerRNA * ptr,int value)701 static void rna_ToolSettings_snap_mode_set(struct PointerRNA *ptr, int value)
702 {
703 ToolSettings *ts = (ToolSettings *)ptr->data;
704 if (value != 0) {
705 ts->snap_mode = value;
706 }
707 }
708
709 /* Grease Pencil update cache */
rna_GPencil_update(Main * UNUSED (bmain),Scene * scene,PointerRNA * UNUSED (ptr))710 static void rna_GPencil_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
711 {
712 ED_gpencil_tag_scene_gpencil(scene);
713 }
714
715 /* Grease Pencil Interpolation settings */
rna_GPencilInterpolateSettings_path(PointerRNA * UNUSED (ptr))716 static char *rna_GPencilInterpolateSettings_path(PointerRNA *UNUSED(ptr))
717 {
718 return BLI_strdup("tool_settings.gpencil_interpolate");
719 }
720
rna_GPencilInterpolateSettings_type_set(PointerRNA * ptr,int value)721 static void rna_GPencilInterpolateSettings_type_set(PointerRNA *ptr, int value)
722 {
723 GP_Interpolate_Settings *settings = (GP_Interpolate_Settings *)ptr->data;
724
725 /* NOTE: This cast should be fine, as we have a small + finite set of values
726 * (#eGP_Interpolate_Type) that should fit well within a char.
727 */
728 settings->type = (char)value;
729
730 /* init custom interpolation curve here now the first time it's used */
731 if ((settings->type == GP_IPO_CURVEMAP) && (settings->custom_ipo == NULL)) {
732 settings->custom_ipo = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
733 }
734 }
735
rna_Gpencil_extend_selection(bContext * C,PointerRNA * UNUSED (ptr))736 static void rna_Gpencil_extend_selection(bContext *C, PointerRNA *UNUSED(ptr))
737 {
738 /* Extend selection to all points in all selected strokes. */
739 ViewLayer *view_layer = CTX_data_view_layer(C);
740 Object *ob = OBACT(view_layer);
741 if ((ob) && (ob->type == OB_GPENCIL)) {
742 bGPdata *gpd = (bGPdata *)ob->data;
743 CTX_DATA_BEGIN (C, bGPDstroke *, gps, editable_gpencil_strokes) {
744 if ((gps->flag & GP_STROKE_SELECT) && (gps->totpoints > 1)) {
745 bGPDspoint *pt;
746 for (int i = 0; i < gps->totpoints; i++) {
747 pt = &gps->points[i];
748 pt->flag |= GP_SPOINT_SELECT;
749 }
750 }
751 }
752 CTX_DATA_END;
753
754 gpd->flag |= GP_DATA_CACHE_IS_DIRTY;
755 DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
756 }
757 }
758
rna_Gpencil_selectmode_update(bContext * C,PointerRNA * ptr)759 static void rna_Gpencil_selectmode_update(bContext *C, PointerRNA *ptr)
760 {
761 ToolSettings *ts = (ToolSettings *)ptr->data;
762 /* If the mode is not Stroke, don't extend selection. */
763 if ((ts->gpencil_selectmode_edit & GP_SELECTMODE_STROKE) == 0) {
764 return;
765 }
766
767 rna_Gpencil_extend_selection(C, ptr);
768 }
769
rna_Gpencil_mask_point_update(bContext * UNUSED (C),PointerRNA * ptr)770 static void rna_Gpencil_mask_point_update(bContext *UNUSED(C), PointerRNA *ptr)
771 {
772 ToolSettings *ts = (ToolSettings *)ptr->data;
773
774 ts->gpencil_selectmode_sculpt &= ~GP_SCULPT_MASK_SELECTMODE_STROKE;
775 ts->gpencil_selectmode_sculpt &= ~GP_SCULPT_MASK_SELECTMODE_SEGMENT;
776 }
777
rna_Gpencil_mask_stroke_update(bContext * C,PointerRNA * ptr)778 static void rna_Gpencil_mask_stroke_update(bContext *C, PointerRNA *ptr)
779 {
780 ToolSettings *ts = (ToolSettings *)ptr->data;
781
782 ts->gpencil_selectmode_sculpt &= ~GP_SCULPT_MASK_SELECTMODE_POINT;
783 ts->gpencil_selectmode_sculpt &= ~GP_SCULPT_MASK_SELECTMODE_SEGMENT;
784
785 rna_Gpencil_extend_selection(C, ptr);
786 }
787
rna_Gpencil_mask_segment_update(bContext * UNUSED (C),PointerRNA * ptr)788 static void rna_Gpencil_mask_segment_update(bContext *UNUSED(C), PointerRNA *ptr)
789 {
790 ToolSettings *ts = (ToolSettings *)ptr->data;
791
792 ts->gpencil_selectmode_sculpt &= ~GP_SCULPT_MASK_SELECTMODE_POINT;
793 ts->gpencil_selectmode_sculpt &= ~GP_SCULPT_MASK_SELECTMODE_STROKE;
794 }
795
rna_Gpencil_vertex_mask_point_update(bContext * C,PointerRNA * ptr)796 static void rna_Gpencil_vertex_mask_point_update(bContext *C, PointerRNA *ptr)
797 {
798 ToolSettings *ts = (ToolSettings *)ptr->data;
799
800 ts->gpencil_selectmode_vertex &= ~GP_VERTEX_MASK_SELECTMODE_STROKE;
801 ts->gpencil_selectmode_vertex &= ~GP_VERTEX_MASK_SELECTMODE_SEGMENT;
802
803 ED_gpencil_tag_scene_gpencil(CTX_data_scene(C));
804 }
805
rna_Gpencil_vertex_mask_stroke_update(bContext * C,PointerRNA * ptr)806 static void rna_Gpencil_vertex_mask_stroke_update(bContext *C, PointerRNA *ptr)
807 {
808 ToolSettings *ts = (ToolSettings *)ptr->data;
809
810 ts->gpencil_selectmode_vertex &= ~GP_VERTEX_MASK_SELECTMODE_POINT;
811 ts->gpencil_selectmode_vertex &= ~GP_VERTEX_MASK_SELECTMODE_SEGMENT;
812
813 rna_Gpencil_extend_selection(C, ptr);
814
815 ED_gpencil_tag_scene_gpencil(CTX_data_scene(C));
816 }
817
rna_Gpencil_vertex_mask_segment_update(bContext * C,PointerRNA * ptr)818 static void rna_Gpencil_vertex_mask_segment_update(bContext *C, PointerRNA *ptr)
819 {
820 ToolSettings *ts = (ToolSettings *)ptr->data;
821
822 ts->gpencil_selectmode_vertex &= ~GP_VERTEX_MASK_SELECTMODE_POINT;
823 ts->gpencil_selectmode_vertex &= ~GP_VERTEX_MASK_SELECTMODE_STROKE;
824
825 ED_gpencil_tag_scene_gpencil(CTX_data_scene(C));
826 }
827
828 /* Read-only Iterator of all the scene objects. */
829
rna_Scene_objects_begin(CollectionPropertyIterator * iter,PointerRNA * ptr)830 static void rna_Scene_objects_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
831 {
832 Scene *scene = (Scene *)ptr->data;
833 iter->internal.custom = MEM_callocN(sizeof(BLI_Iterator), __func__);
834
835 ((BLI_Iterator *)iter->internal.custom)->valid = true;
836 BKE_scene_objects_iterator_begin(iter->internal.custom, (void *)scene);
837 iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid;
838 }
839
rna_Scene_objects_next(CollectionPropertyIterator * iter)840 static void rna_Scene_objects_next(CollectionPropertyIterator *iter)
841 {
842 BKE_scene_objects_iterator_next(iter->internal.custom);
843 iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid;
844 }
845
rna_Scene_objects_end(CollectionPropertyIterator * iter)846 static void rna_Scene_objects_end(CollectionPropertyIterator *iter)
847 {
848 BKE_scene_objects_iterator_end(iter->internal.custom);
849 MEM_freeN(iter->internal.custom);
850 }
851
rna_Scene_objects_get(CollectionPropertyIterator * iter)852 static PointerRNA rna_Scene_objects_get(CollectionPropertyIterator *iter)
853 {
854 Object *ob = ((BLI_Iterator *)iter->internal.custom)->current;
855 return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, ob);
856 }
857
858 /* End of read-only Iterator of all the scene objects. */
859
rna_Scene_set_set(PointerRNA * ptr,PointerRNA value,struct ReportList * UNUSED (reports))860 static void rna_Scene_set_set(PointerRNA *ptr,
861 PointerRNA value,
862 struct ReportList *UNUSED(reports))
863 {
864 Scene *scene = (Scene *)ptr->data;
865 Scene *set = (Scene *)value.data;
866 Scene *nested_set;
867
868 for (nested_set = set; nested_set; nested_set = nested_set->set) {
869 if (nested_set == scene) {
870 return;
871 }
872 /* prevent eternal loops, set can point to next, and next to set, without problems usually */
873 if (nested_set->set == set) {
874 return;
875 }
876 }
877
878 id_lib_extern((ID *)set);
879 scene->set = set;
880 }
881
rna_Scene_set_update(Main * bmain,Scene * UNUSED (scene),PointerRNA * ptr)882 void rna_Scene_set_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
883 {
884 Scene *scene = (Scene *)ptr->owner_id;
885
886 DEG_relations_tag_update(bmain);
887 DEG_id_tag_update_ex(bmain, &scene->id, 0);
888 if (scene->set != NULL) {
889 /* Objects which are pulled into main scene's depsgraph needs to have
890 * their base flags updated.
891 */
892 DEG_id_tag_update_ex(bmain, &scene->set->id, 0);
893 }
894 }
895
rna_Scene_camera_update(Main * bmain,Scene * UNUSED (scene_unused),PointerRNA * ptr)896 static void rna_Scene_camera_update(Main *bmain, Scene *UNUSED(scene_unused), PointerRNA *ptr)
897 {
898 wmWindowManager *wm = bmain->wm.first;
899 Scene *scene = (Scene *)ptr->data;
900
901 WM_windows_scene_data_sync(&wm->windows, scene);
902 DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE);
903 DEG_relations_tag_update(bmain);
904 }
905
rna_Scene_fps_update(Main * bmain,Scene * scene,PointerRNA * UNUSED (ptr))906 static void rna_Scene_fps_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr))
907 {
908 DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_FPS | ID_RECALC_SEQUENCER_STRIPS);
909 /* NOTE: Tag via dependency graph will take care of all the updates ion the evaluated domain,
910 * however, changes in FPS actually modifies an original skip length,
911 * so this we take care about here. */
912 BKE_sequencer_refresh_sound_length(bmain, scene);
913 }
914
rna_Scene_listener_update(Main * UNUSED (bmain),Scene * scene,PointerRNA * UNUSED (ptr))915 static void rna_Scene_listener_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
916 {
917 DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_LISTENER);
918 }
919
rna_Scene_volume_update(Main * UNUSED (bmain),Scene * UNUSED (scene),PointerRNA * ptr)920 static void rna_Scene_volume_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
921 {
922 Scene *scene = (Scene *)ptr->owner_id;
923 DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_VOLUME | ID_RECALC_SEQUENCER_STRIPS);
924 }
925
rna_Scene_statistics_string_get(Scene * scene,Main * bmain,ReportList * reports,ViewLayer * view_layer)926 static const char *rna_Scene_statistics_string_get(Scene *scene,
927 Main *bmain,
928 ReportList *reports,
929 ViewLayer *view_layer)
930 {
931 if (!BKE_scene_has_view_layer(scene, view_layer)) {
932 BKE_reportf(reports,
933 RPT_ERROR,
934 "View Layer '%s' not found in scene '%s'",
935 view_layer->name,
936 scene->id.name + 2);
937 return "";
938 }
939
940 return ED_info_statistics_string(bmain, scene, view_layer);
941 }
942
rna_Scene_framelen_update(Main * UNUSED (bmain),Scene * scene,PointerRNA * UNUSED (ptr))943 static void rna_Scene_framelen_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
944 {
945 scene->r.framelen = (float)scene->r.framapto / (float)scene->r.images;
946 }
947
rna_Scene_frame_current_set(PointerRNA * ptr,int value)948 static void rna_Scene_frame_current_set(PointerRNA *ptr, int value)
949 {
950 Scene *data = (Scene *)ptr->data;
951
952 /* if negative frames aren't allowed, then we can't use them */
953 FRAMENUMBER_MIN_CLAMP(value);
954 data->r.cfra = value;
955 }
956
rna_Scene_frame_float_get(PointerRNA * ptr)957 static float rna_Scene_frame_float_get(PointerRNA *ptr)
958 {
959 Scene *data = (Scene *)ptr->data;
960 return (float)data->r.cfra + data->r.subframe;
961 }
962
rna_Scene_frame_float_set(PointerRNA * ptr,float value)963 static void rna_Scene_frame_float_set(PointerRNA *ptr, float value)
964 {
965 Scene *data = (Scene *)ptr->data;
966 /* if negative frames aren't allowed, then we can't use them */
967 FRAMENUMBER_MIN_CLAMP(value);
968 data->r.cfra = (int)value;
969 data->r.subframe = value - data->r.cfra;
970 }
971
rna_Scene_frame_current_final_get(PointerRNA * ptr)972 static float rna_Scene_frame_current_final_get(PointerRNA *ptr)
973 {
974 Scene *scene = (Scene *)ptr->data;
975
976 return BKE_scene_frame_to_ctime(scene, (float)scene->r.cfra);
977 }
978
rna_Scene_start_frame_set(PointerRNA * ptr,int value)979 static void rna_Scene_start_frame_set(PointerRNA *ptr, int value)
980 {
981 Scene *data = (Scene *)ptr->data;
982 /* MINFRAME not MINAFRAME, since some output formats can't taken negative frames */
983 CLAMP(value, MINFRAME, MAXFRAME);
984 data->r.sfra = value;
985
986 if (value > data->r.efra) {
987 data->r.efra = MIN2(value, MAXFRAME);
988 }
989 }
990
rna_Scene_end_frame_set(PointerRNA * ptr,int value)991 static void rna_Scene_end_frame_set(PointerRNA *ptr, int value)
992 {
993 Scene *data = (Scene *)ptr->data;
994 CLAMP(value, MINFRAME, MAXFRAME);
995 data->r.efra = value;
996
997 if (data->r.sfra > value) {
998 data->r.sfra = MAX2(value, MINFRAME);
999 }
1000 }
1001
rna_Scene_use_preview_range_set(PointerRNA * ptr,bool value)1002 static void rna_Scene_use_preview_range_set(PointerRNA *ptr, bool value)
1003 {
1004 Scene *data = (Scene *)ptr->data;
1005
1006 if (value) {
1007 /* copy range from scene if not set before */
1008 if ((data->r.psfra == data->r.pefra) && (data->r.psfra == 0)) {
1009 data->r.psfra = data->r.sfra;
1010 data->r.pefra = data->r.efra;
1011 }
1012
1013 data->r.flag |= SCER_PRV_RANGE;
1014 }
1015 else {
1016 data->r.flag &= ~SCER_PRV_RANGE;
1017 }
1018 }
1019
rna_Scene_preview_range_start_frame_set(PointerRNA * ptr,int value)1020 static void rna_Scene_preview_range_start_frame_set(PointerRNA *ptr, int value)
1021 {
1022 Scene *data = (Scene *)ptr->data;
1023
1024 /* check if enabled already */
1025 if ((data->r.flag & SCER_PRV_RANGE) == 0) {
1026 /* set end of preview range to end frame, then clamp as per normal */
1027 /* TODO: or just refuse to set instead? */
1028 data->r.pefra = data->r.efra;
1029 }
1030 CLAMP(value, MINAFRAME, MAXFRAME);
1031 data->r.psfra = value;
1032
1033 if (value > data->r.pefra) {
1034 data->r.pefra = MIN2(value, MAXFRAME);
1035 }
1036 }
1037
rna_Scene_preview_range_end_frame_set(PointerRNA * ptr,int value)1038 static void rna_Scene_preview_range_end_frame_set(PointerRNA *ptr, int value)
1039 {
1040 Scene *data = (Scene *)ptr->data;
1041
1042 /* check if enabled already */
1043 if ((data->r.flag & SCER_PRV_RANGE) == 0) {
1044 /* set start of preview range to start frame, then clamp as per normal */
1045 /* TODO: or just refuse to set instead? */
1046 data->r.psfra = data->r.sfra;
1047 }
1048 CLAMP(value, MINAFRAME, MAXFRAME);
1049 data->r.pefra = value;
1050
1051 if (data->r.psfra > value) {
1052 data->r.psfra = MAX2(value, MINAFRAME);
1053 }
1054 }
1055
rna_Scene_show_subframe_update(Main * UNUSED (bmain),Scene * UNUSED (current_scene),PointerRNA * ptr)1056 static void rna_Scene_show_subframe_update(Main *UNUSED(bmain),
1057 Scene *UNUSED(current_scene),
1058 PointerRNA *ptr)
1059 {
1060 Scene *scene = (Scene *)ptr->owner_id;
1061 scene->r.subframe = 0.0f;
1062 }
1063
rna_Scene_frame_update(Main * UNUSED (bmain),Scene * UNUSED (current_scene),PointerRNA * ptr)1064 static void rna_Scene_frame_update(Main *UNUSED(bmain),
1065 Scene *UNUSED(current_scene),
1066 PointerRNA *ptr)
1067 {
1068 Scene *scene = (Scene *)ptr->owner_id;
1069 DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_SEEK);
1070 WM_main_add_notifier(NC_SCENE | ND_FRAME, scene);
1071 }
1072
rna_Scene_active_keying_set_get(PointerRNA * ptr)1073 static PointerRNA rna_Scene_active_keying_set_get(PointerRNA *ptr)
1074 {
1075 Scene *scene = (Scene *)ptr->data;
1076 return rna_pointer_inherit_refine(ptr, &RNA_KeyingSet, ANIM_scene_get_active_keyingset(scene));
1077 }
1078
rna_Scene_active_keying_set_set(PointerRNA * ptr,PointerRNA value,struct ReportList * UNUSED (reports))1079 static void rna_Scene_active_keying_set_set(PointerRNA *ptr,
1080 PointerRNA value,
1081 struct ReportList *UNUSED(reports))
1082 {
1083 Scene *scene = (Scene *)ptr->data;
1084 KeyingSet *ks = (KeyingSet *)value.data;
1085
1086 scene->active_keyingset = ANIM_scene_get_keyingset_index(scene, ks);
1087 }
1088
1089 /* get KeyingSet index stuff for list of Keying Sets editing UI
1090 * - active_keyingset-1 since 0 is reserved for 'none'
1091 * - don't clamp, otherwise can never set builtin's types as active...
1092 */
rna_Scene_active_keying_set_index_get(PointerRNA * ptr)1093 static int rna_Scene_active_keying_set_index_get(PointerRNA *ptr)
1094 {
1095 Scene *scene = (Scene *)ptr->data;
1096 return scene->active_keyingset - 1;
1097 }
1098
1099 /* get KeyingSet index stuff for list of Keying Sets editing UI
1100 * - value+1 since 0 is reserved for 'none'
1101 */
rna_Scene_active_keying_set_index_set(PointerRNA * ptr,int value)1102 static void rna_Scene_active_keying_set_index_set(PointerRNA *ptr, int value)
1103 {
1104 Scene *scene = (Scene *)ptr->data;
1105 scene->active_keyingset = value + 1;
1106 }
1107
1108 /* XXX: evil... builtin_keyingsets is defined in keyingsets.c! */
1109 /* TODO: make API function to retrieve this... */
1110 extern ListBase builtin_keyingsets;
1111
rna_Scene_all_keyingsets_begin(CollectionPropertyIterator * iter,PointerRNA * ptr)1112 static void rna_Scene_all_keyingsets_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
1113 {
1114 Scene *scene = (Scene *)ptr->data;
1115
1116 /* start going over the scene KeyingSets first, while we still have pointer to it
1117 * but only if we have any Keying Sets to use...
1118 */
1119 if (scene->keyingsets.first) {
1120 rna_iterator_listbase_begin(iter, &scene->keyingsets, NULL);
1121 }
1122 else {
1123 rna_iterator_listbase_begin(iter, &builtin_keyingsets, NULL);
1124 }
1125 }
1126
rna_Scene_all_keyingsets_next(CollectionPropertyIterator * iter)1127 static void rna_Scene_all_keyingsets_next(CollectionPropertyIterator *iter)
1128 {
1129 ListBaseIterator *internal = &iter->internal.listbase;
1130 KeyingSet *ks = (KeyingSet *)internal->link;
1131
1132 /* If we've run out of links in Scene list,
1133 * jump over to the builtins list unless we're there already. */
1134 if ((ks->next == NULL) && (ks != builtin_keyingsets.last)) {
1135 internal->link = (Link *)builtin_keyingsets.first;
1136 }
1137 else {
1138 internal->link = (Link *)ks->next;
1139 }
1140
1141 iter->valid = (internal->link != NULL);
1142 }
1143
rna_SceneEEVEE_path(PointerRNA * UNUSED (ptr))1144 static char *rna_SceneEEVEE_path(PointerRNA *UNUSED(ptr))
1145 {
1146 return BLI_strdup("eevee");
1147 }
1148
rna_SceneGpencil_path(PointerRNA * UNUSED (ptr))1149 static char *rna_SceneGpencil_path(PointerRNA *UNUSED(ptr))
1150 {
1151 return BLI_strdup("grease_pencil_settings");
1152 }
1153
rna_RenderSettings_stereoViews_skip(CollectionPropertyIterator * iter,void * UNUSED (data))1154 static int rna_RenderSettings_stereoViews_skip(CollectionPropertyIterator *iter,
1155 void *UNUSED(data))
1156 {
1157 ListBaseIterator *internal = &iter->internal.listbase;
1158 SceneRenderView *srv = (SceneRenderView *)internal->link;
1159
1160 if ((STREQ(srv->name, STEREO_LEFT_NAME)) || (STREQ(srv->name, STEREO_RIGHT_NAME))) {
1161 return 0;
1162 }
1163
1164 return 1;
1165 };
1166
rna_RenderSettings_stereoViews_begin(CollectionPropertyIterator * iter,PointerRNA * ptr)1167 static void rna_RenderSettings_stereoViews_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
1168 {
1169 RenderData *rd = (RenderData *)ptr->data;
1170 rna_iterator_listbase_begin(iter, &rd->views, rna_RenderSettings_stereoViews_skip);
1171 }
1172
rna_RenderSettings_path(PointerRNA * UNUSED (ptr))1173 static char *rna_RenderSettings_path(PointerRNA *UNUSED(ptr))
1174 {
1175 return BLI_strdup("render");
1176 }
1177
rna_BakeSettings_path(PointerRNA * UNUSED (ptr))1178 static char *rna_BakeSettings_path(PointerRNA *UNUSED(ptr))
1179 {
1180 return BLI_strdup("render.bake");
1181 }
1182
rna_ImageFormatSettings_path(PointerRNA * ptr)1183 static char *rna_ImageFormatSettings_path(PointerRNA *ptr)
1184 {
1185 ImageFormatData *imf = (ImageFormatData *)ptr->data;
1186 ID *id = ptr->owner_id;
1187
1188 switch (GS(id->name)) {
1189 case ID_SCE: {
1190 Scene *scene = (Scene *)id;
1191
1192 if (&scene->r.im_format == imf) {
1193 return BLI_strdup("render.image_settings");
1194 }
1195 else if (&scene->r.bake.im_format == imf) {
1196 return BLI_strdup("render.bake.image_settings");
1197 }
1198 return BLI_strdup("..");
1199 }
1200 case ID_NT: {
1201 bNodeTree *ntree = (bNodeTree *)id;
1202 bNode *node;
1203
1204 for (node = ntree->nodes.first; node; node = node->next) {
1205 if (node->type == CMP_NODE_OUTPUT_FILE) {
1206 if (&((NodeImageMultiFile *)node->storage)->format == imf) {
1207 return BLI_sprintfN("nodes['%s'].format", node->name);
1208 }
1209 else {
1210 bNodeSocket *sock;
1211
1212 for (sock = node->inputs.first; sock; sock = sock->next) {
1213 NodeImageMultiFileSocket *sockdata = sock->storage;
1214 if (&sockdata->format == imf) {
1215 return BLI_sprintfN(
1216 "nodes['%s'].file_slots['%s'].format", node->name, sockdata->path);
1217 }
1218 }
1219 }
1220 }
1221 }
1222 return BLI_strdup("..");
1223 }
1224 default:
1225 return BLI_strdup("..");
1226 }
1227 }
1228
rna_RenderSettings_threads_get(PointerRNA * ptr)1229 static int rna_RenderSettings_threads_get(PointerRNA *ptr)
1230 {
1231 RenderData *rd = (RenderData *)ptr->data;
1232 return BKE_render_num_threads(rd);
1233 }
1234
rna_RenderSettings_threads_mode_get(PointerRNA * ptr)1235 static int rna_RenderSettings_threads_mode_get(PointerRNA *ptr)
1236 {
1237 RenderData *rd = (RenderData *)ptr->data;
1238 int override = BLI_system_num_threads_override_get();
1239
1240 if (override > 0) {
1241 return R_FIXED_THREADS;
1242 }
1243 else {
1244 return (rd->mode & R_FIXED_THREADS);
1245 }
1246 }
1247
rna_RenderSettings_is_movie_format_get(PointerRNA * ptr)1248 static bool rna_RenderSettings_is_movie_format_get(PointerRNA *ptr)
1249 {
1250 RenderData *rd = (RenderData *)ptr->data;
1251 return BKE_imtype_is_movie(rd->im_format.imtype);
1252 }
1253
rna_ImageFormatSettings_file_format_set(PointerRNA * ptr,int value)1254 static void rna_ImageFormatSettings_file_format_set(PointerRNA *ptr, int value)
1255 {
1256 ImageFormatData *imf = (ImageFormatData *)ptr->data;
1257 ID *id = ptr->owner_id;
1258 imf->imtype = value;
1259
1260 const bool is_render = (id && GS(id->name) == ID_SCE);
1261 /* see note below on why this is */
1262 const char chan_flag = BKE_imtype_valid_channels(imf->imtype, true) |
1263 (is_render ? IMA_CHAN_FLAG_BW : 0);
1264
1265 /* ensure depth and color settings match */
1266 if (((imf->planes == R_IMF_PLANES_BW) && !(chan_flag & IMA_CHAN_FLAG_BW)) ||
1267 ((imf->planes == R_IMF_PLANES_RGBA) && !(chan_flag & IMA_CHAN_FLAG_ALPHA))) {
1268 imf->planes = R_IMF_PLANES_RGB;
1269 }
1270
1271 /* ensure usable depth */
1272 {
1273 const int depth_ok = BKE_imtype_valid_depths(imf->imtype);
1274 if ((imf->depth & depth_ok) == 0) {
1275 /* set first available depth */
1276 char depth_ls[] = {
1277 R_IMF_CHAN_DEPTH_32,
1278 R_IMF_CHAN_DEPTH_24,
1279 R_IMF_CHAN_DEPTH_16,
1280 R_IMF_CHAN_DEPTH_12,
1281 R_IMF_CHAN_DEPTH_10,
1282 R_IMF_CHAN_DEPTH_8,
1283 R_IMF_CHAN_DEPTH_1,
1284 0,
1285 };
1286 int i;
1287
1288 for (i = 0; depth_ls[i]; i++) {
1289 if (depth_ok & depth_ls[i]) {
1290 imf->depth = depth_ls[i];
1291 break;
1292 }
1293 }
1294 }
1295 }
1296
1297 if (id && GS(id->name) == ID_SCE) {
1298 Scene *scene = (Scene *)ptr->owner_id;
1299 RenderData *rd = &scene->r;
1300 # ifdef WITH_FFMPEG
1301 BKE_ffmpeg_image_type_verify(rd, imf);
1302 # endif
1303 (void)rd;
1304 }
1305 }
1306
rna_ImageFormatSettings_file_format_itemf(bContext * UNUSED (C),PointerRNA * ptr,PropertyRNA * UNUSED (prop),bool * UNUSED (r_free))1307 static const EnumPropertyItem *rna_ImageFormatSettings_file_format_itemf(bContext *UNUSED(C),
1308 PointerRNA *ptr,
1309 PropertyRNA *UNUSED(prop),
1310 bool *UNUSED(r_free))
1311 {
1312 ID *id = ptr->owner_id;
1313 if (id && GS(id->name) == ID_SCE) {
1314 return rna_enum_image_type_items;
1315 }
1316 else {
1317 return image_only_type_items;
1318 }
1319 }
1320
rna_ImageFormatSettings_color_mode_itemf(bContext * UNUSED (C),PointerRNA * ptr,PropertyRNA * UNUSED (prop),bool * r_free)1321 static const EnumPropertyItem *rna_ImageFormatSettings_color_mode_itemf(bContext *UNUSED(C),
1322 PointerRNA *ptr,
1323 PropertyRNA *UNUSED(prop),
1324 bool *r_free)
1325 {
1326 ImageFormatData *imf = (ImageFormatData *)ptr->data;
1327 ID *id = ptr->owner_id;
1328 const bool is_render = (id && GS(id->name) == ID_SCE);
1329
1330 /* note, we need to act differently for render
1331 * where 'BW' will force grayscale even if the output format writes
1332 * as RGBA, this is age old blender convention and not sure how useful
1333 * it really is but keep it for now - campbell */
1334 char chan_flag = BKE_imtype_valid_channels(imf->imtype, true) |
1335 (is_render ? IMA_CHAN_FLAG_BW : 0);
1336
1337 # ifdef WITH_FFMPEG
1338 /* a WAY more crappy case than B&W flag: depending on codec, file format MIGHT support
1339 * alpha channel. for example MPEG format with h264 codec can't do alpha channel, but
1340 * the same MPEG format with QTRLE codec can easily handle alpha channel.
1341 * not sure how to deal with such cases in a nicer way (sergey) */
1342 if (is_render) {
1343 Scene *scene = (Scene *)ptr->owner_id;
1344 RenderData *rd = &scene->r;
1345
1346 if (BKE_ffmpeg_alpha_channel_is_supported(rd)) {
1347 chan_flag |= IMA_CHAN_FLAG_ALPHA;
1348 }
1349 }
1350 # endif
1351
1352 if (chan_flag == (IMA_CHAN_FLAG_BW | IMA_CHAN_FLAG_RGB | IMA_CHAN_FLAG_ALPHA)) {
1353 return rna_enum_image_color_mode_items;
1354 }
1355 else {
1356 int totitem = 0;
1357 EnumPropertyItem *item = NULL;
1358
1359 if (chan_flag & IMA_CHAN_FLAG_BW) {
1360 RNA_enum_item_add(&item, &totitem, &IMAGE_COLOR_MODE_BW);
1361 }
1362 if (chan_flag & IMA_CHAN_FLAG_RGB) {
1363 RNA_enum_item_add(&item, &totitem, &IMAGE_COLOR_MODE_RGB);
1364 }
1365 if (chan_flag & IMA_CHAN_FLAG_ALPHA) {
1366 RNA_enum_item_add(&item, &totitem, &IMAGE_COLOR_MODE_RGBA);
1367 }
1368
1369 RNA_enum_item_end(&item, &totitem);
1370 *r_free = true;
1371
1372 return item;
1373 }
1374 }
1375
rna_ImageFormatSettings_color_depth_itemf(bContext * UNUSED (C),PointerRNA * ptr,PropertyRNA * UNUSED (prop),bool * r_free)1376 static const EnumPropertyItem *rna_ImageFormatSettings_color_depth_itemf(bContext *UNUSED(C),
1377 PointerRNA *ptr,
1378 PropertyRNA *UNUSED(prop),
1379 bool *r_free)
1380 {
1381 ImageFormatData *imf = (ImageFormatData *)ptr->data;
1382
1383 if (imf == NULL) {
1384 return rna_enum_image_color_depth_items;
1385 }
1386 else {
1387 const int depth_ok = BKE_imtype_valid_depths(imf->imtype);
1388 const int is_float = ELEM(
1389 imf->imtype, R_IMF_IMTYPE_RADHDR, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER);
1390
1391 const EnumPropertyItem *item_8bit = &rna_enum_image_color_depth_items[0];
1392 const EnumPropertyItem *item_10bit = &rna_enum_image_color_depth_items[1];
1393 const EnumPropertyItem *item_12bit = &rna_enum_image_color_depth_items[2];
1394 const EnumPropertyItem *item_16bit = &rna_enum_image_color_depth_items[3];
1395 const EnumPropertyItem *item_32bit = &rna_enum_image_color_depth_items[4];
1396
1397 int totitem = 0;
1398 EnumPropertyItem *item = NULL;
1399 EnumPropertyItem tmp = {0, "", 0, "", ""};
1400
1401 if (depth_ok & R_IMF_CHAN_DEPTH_8) {
1402 RNA_enum_item_add(&item, &totitem, item_8bit);
1403 }
1404
1405 if (depth_ok & R_IMF_CHAN_DEPTH_10) {
1406 RNA_enum_item_add(&item, &totitem, item_10bit);
1407 }
1408
1409 if (depth_ok & R_IMF_CHAN_DEPTH_12) {
1410 RNA_enum_item_add(&item, &totitem, item_12bit);
1411 }
1412
1413 if (depth_ok & R_IMF_CHAN_DEPTH_16) {
1414 if (is_float) {
1415 tmp = *item_16bit;
1416 tmp.name = "Float (Half)";
1417 RNA_enum_item_add(&item, &totitem, &tmp);
1418 }
1419 else {
1420 RNA_enum_item_add(&item, &totitem, item_16bit);
1421 }
1422 }
1423
1424 if (depth_ok & R_IMF_CHAN_DEPTH_32) {
1425 if (is_float) {
1426 tmp = *item_32bit;
1427 tmp.name = "Float (Full)";
1428 RNA_enum_item_add(&item, &totitem, &tmp);
1429 }
1430 else {
1431 RNA_enum_item_add(&item, &totitem, item_32bit);
1432 }
1433 }
1434
1435 RNA_enum_item_end(&item, &totitem);
1436 *r_free = true;
1437
1438 return item;
1439 }
1440 }
1441
rna_ImageFormatSettings_views_format_itemf(bContext * UNUSED (C),PointerRNA * ptr,PropertyRNA * UNUSED (prop),bool * UNUSED (r_free))1442 static const EnumPropertyItem *rna_ImageFormatSettings_views_format_itemf(
1443 bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
1444 {
1445 ImageFormatData *imf = (ImageFormatData *)ptr->data;
1446
1447 if (imf == NULL) {
1448 return rna_enum_views_format_items;
1449 }
1450 else if (imf->imtype == R_IMF_IMTYPE_OPENEXR) {
1451 return rna_enum_views_format_multiview_items;
1452 }
1453 else if (imf->imtype == R_IMF_IMTYPE_MULTILAYER) {
1454 return rna_enum_views_format_multilayer_items;
1455 }
1456 else {
1457 return rna_enum_views_format_items;
1458 }
1459 }
1460
1461 # ifdef WITH_OPENEXR
1462 /* OpenEXR */
1463
rna_ImageFormatSettings_exr_codec_itemf(bContext * UNUSED (C),PointerRNA * ptr,PropertyRNA * UNUSED (prop),bool * r_free)1464 static const EnumPropertyItem *rna_ImageFormatSettings_exr_codec_itemf(bContext *UNUSED(C),
1465 PointerRNA *ptr,
1466 PropertyRNA *UNUSED(prop),
1467 bool *r_free)
1468 {
1469 ImageFormatData *imf = (ImageFormatData *)ptr->data;
1470
1471 EnumPropertyItem *item = NULL;
1472 int i = 1, totitem = 0;
1473
1474 if (imf->depth == 16) {
1475 return rna_enum_exr_codec_items; /* All compression types are defined for halfs */
1476 }
1477
1478 for (i = 0; i < R_IMF_EXR_CODEC_MAX; i++) {
1479 if ((i == R_IMF_EXR_CODEC_B44 || i == R_IMF_EXR_CODEC_B44A)) {
1480 continue; /* B44 and B44A are not defined for 32 bit floats */
1481 }
1482
1483 RNA_enum_item_add(&item, &totitem, &rna_enum_exr_codec_items[i]);
1484 }
1485
1486 RNA_enum_item_end(&item, &totitem);
1487 *r_free = true;
1488
1489 return item;
1490 }
1491
1492 # endif
rna_SceneRender_file_ext_length(PointerRNA * ptr)1493 static int rna_SceneRender_file_ext_length(PointerRNA *ptr)
1494 {
1495 RenderData *rd = (RenderData *)ptr->data;
1496 char ext[8];
1497 ext[0] = '\0';
1498 BKE_image_path_ensure_ext_from_imformat(ext, &rd->im_format);
1499 return strlen(ext);
1500 }
1501
rna_SceneRender_file_ext_get(PointerRNA * ptr,char * str)1502 static void rna_SceneRender_file_ext_get(PointerRNA *ptr, char *str)
1503 {
1504 RenderData *rd = (RenderData *)ptr->data;
1505 str[0] = '\0';
1506 BKE_image_path_ensure_ext_from_imformat(str, &rd->im_format);
1507 }
1508
1509 # ifdef WITH_FFMPEG
rna_FFmpegSettings_lossless_output_set(PointerRNA * ptr,bool value)1510 static void rna_FFmpegSettings_lossless_output_set(PointerRNA *ptr, bool value)
1511 {
1512 Scene *scene = (Scene *)ptr->owner_id;
1513 RenderData *rd = &scene->r;
1514
1515 if (value) {
1516 rd->ffcodecdata.flags |= FFMPEG_LOSSLESS_OUTPUT;
1517 }
1518 else {
1519 rd->ffcodecdata.flags &= ~FFMPEG_LOSSLESS_OUTPUT;
1520 }
1521
1522 BKE_ffmpeg_codec_settings_verify(rd);
1523 }
1524
rna_FFmpegSettings_codec_settings_update(Main * UNUSED (bmain),Scene * UNUSED (scene_unused),PointerRNA * ptr)1525 static void rna_FFmpegSettings_codec_settings_update(Main *UNUSED(bmain),
1526 Scene *UNUSED(scene_unused),
1527 PointerRNA *ptr)
1528 {
1529 Scene *scene = (Scene *)ptr->owner_id;
1530 RenderData *rd = &scene->r;
1531
1532 BKE_ffmpeg_codec_settings_verify(rd);
1533 }
1534 # endif
1535
rna_RenderSettings_active_view_index_get(PointerRNA * ptr)1536 static int rna_RenderSettings_active_view_index_get(PointerRNA *ptr)
1537 {
1538 RenderData *rd = (RenderData *)ptr->data;
1539 return rd->actview;
1540 }
1541
rna_RenderSettings_active_view_index_set(PointerRNA * ptr,int value)1542 static void rna_RenderSettings_active_view_index_set(PointerRNA *ptr, int value)
1543 {
1544 RenderData *rd = (RenderData *)ptr->data;
1545 rd->actview = value;
1546 }
1547
rna_RenderSettings_active_view_index_range(PointerRNA * ptr,int * min,int * max,int * UNUSED (softmin),int * UNUSED (softmax))1548 static void rna_RenderSettings_active_view_index_range(
1549 PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
1550 {
1551 RenderData *rd = (RenderData *)ptr->data;
1552
1553 *min = 0;
1554 *max = max_ii(0, BLI_listbase_count(&rd->views) - 1);
1555 }
1556
rna_RenderSettings_active_view_get(PointerRNA * ptr)1557 static PointerRNA rna_RenderSettings_active_view_get(PointerRNA *ptr)
1558 {
1559 RenderData *rd = (RenderData *)ptr->data;
1560 SceneRenderView *srv = BLI_findlink(&rd->views, rd->actview);
1561
1562 return rna_pointer_inherit_refine(ptr, &RNA_SceneRenderView, srv);
1563 }
1564
rna_RenderSettings_active_view_set(PointerRNA * ptr,PointerRNA value,struct ReportList * UNUSED (reports))1565 static void rna_RenderSettings_active_view_set(PointerRNA *ptr,
1566 PointerRNA value,
1567 struct ReportList *UNUSED(reports))
1568 {
1569 RenderData *rd = (RenderData *)ptr->data;
1570 SceneRenderView *srv = (SceneRenderView *)value.data;
1571 const int index = BLI_findindex(&rd->views, srv);
1572 if (index != -1) {
1573 rd->actview = index;
1574 }
1575 }
1576
rna_RenderView_new(ID * id,RenderData * UNUSED (rd),const char * name)1577 static SceneRenderView *rna_RenderView_new(ID *id, RenderData *UNUSED(rd), const char *name)
1578 {
1579 Scene *scene = (Scene *)id;
1580 SceneRenderView *srv = BKE_scene_add_render_view(scene, name);
1581
1582 WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
1583
1584 return srv;
1585 }
1586
rna_RenderView_remove(ID * id,RenderData * UNUSED (rd),Main * UNUSED (bmain),ReportList * reports,PointerRNA * srv_ptr)1587 static void rna_RenderView_remove(
1588 ID *id, RenderData *UNUSED(rd), Main *UNUSED(bmain), ReportList *reports, PointerRNA *srv_ptr)
1589 {
1590 SceneRenderView *srv = srv_ptr->data;
1591 Scene *scene = (Scene *)id;
1592
1593 if (!BKE_scene_remove_render_view(scene, srv)) {
1594 BKE_reportf(reports,
1595 RPT_ERROR,
1596 "Render view '%s' could not be removed from scene '%s'",
1597 srv->name,
1598 scene->id.name + 2);
1599 return;
1600 }
1601
1602 RNA_POINTER_INVALIDATE(srv_ptr);
1603
1604 WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
1605 }
1606
rna_RenderSettings_views_format_set(PointerRNA * ptr,int value)1607 static void rna_RenderSettings_views_format_set(PointerRNA *ptr, int value)
1608 {
1609 RenderData *rd = (RenderData *)ptr->data;
1610
1611 if (rd->views_format == SCE_VIEWS_FORMAT_MULTIVIEW && value == SCE_VIEWS_FORMAT_STEREO_3D) {
1612 /* make sure the actview is visible */
1613 if (rd->actview > 1) {
1614 rd->actview = 1;
1615 }
1616 }
1617
1618 rd->views_format = value;
1619 }
1620
rna_RenderSettings_engine_set(PointerRNA * ptr,int value)1621 static void rna_RenderSettings_engine_set(PointerRNA *ptr, int value)
1622 {
1623 RenderData *rd = (RenderData *)ptr->data;
1624 RenderEngineType *type = BLI_findlink(&R_engines, value);
1625
1626 if (type) {
1627 BLI_strncpy_utf8(rd->engine, type->idname, sizeof(rd->engine));
1628 DEG_id_tag_update(ptr->owner_id, ID_RECALC_COPY_ON_WRITE);
1629 }
1630 }
1631
rna_RenderSettings_engine_itemf(bContext * UNUSED (C),PointerRNA * UNUSED (ptr),PropertyRNA * UNUSED (prop),bool * r_free)1632 static const EnumPropertyItem *rna_RenderSettings_engine_itemf(bContext *UNUSED(C),
1633 PointerRNA *UNUSED(ptr),
1634 PropertyRNA *UNUSED(prop),
1635 bool *r_free)
1636 {
1637 RenderEngineType *type;
1638 EnumPropertyItem *item = NULL;
1639 EnumPropertyItem tmp = {0, "", 0, "", ""};
1640 int a = 0, totitem = 0;
1641
1642 for (type = R_engines.first; type; type = type->next, a++) {
1643 tmp.value = a;
1644 tmp.identifier = type->idname;
1645 tmp.name = type->name;
1646 RNA_enum_item_add(&item, &totitem, &tmp);
1647 }
1648
1649 RNA_enum_item_end(&item, &totitem);
1650 *r_free = true;
1651
1652 return item;
1653 }
1654
rna_RenderSettings_engine_get(PointerRNA * ptr)1655 static int rna_RenderSettings_engine_get(PointerRNA *ptr)
1656 {
1657 RenderData *rd = (RenderData *)ptr->data;
1658 RenderEngineType *type;
1659 int a = 0;
1660
1661 for (type = R_engines.first; type; type = type->next, a++) {
1662 if (STREQ(type->idname, rd->engine)) {
1663 return a;
1664 }
1665 }
1666
1667 return 0;
1668 }
1669
rna_RenderSettings_engine_update(Main * bmain,Scene * UNUSED (unused),PointerRNA * UNUSED (ptr))1670 static void rna_RenderSettings_engine_update(Main *bmain,
1671 Scene *UNUSED(unused),
1672 PointerRNA *UNUSED(ptr))
1673 {
1674 ED_render_engine_changed(bmain, true);
1675 }
1676
rna_RenderSettings_multiple_engines_get(PointerRNA * UNUSED (ptr))1677 static bool rna_RenderSettings_multiple_engines_get(PointerRNA *UNUSED(ptr))
1678 {
1679 return (BLI_listbase_count(&R_engines) > 1);
1680 }
1681
rna_RenderSettings_use_spherical_stereo_get(PointerRNA * ptr)1682 static bool rna_RenderSettings_use_spherical_stereo_get(PointerRNA *ptr)
1683 {
1684 Scene *scene = (Scene *)ptr->owner_id;
1685 return BKE_scene_use_spherical_stereo(scene);
1686 }
1687
rna_Scene_glsl_update(Main * UNUSED (bmain),Scene * UNUSED (scene),PointerRNA * ptr)1688 void rna_Scene_glsl_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1689 {
1690 Scene *scene = (Scene *)ptr->owner_id;
1691
1692 DEG_id_tag_update(&scene->id, 0);
1693 }
1694
rna_Scene_world_update(Main * bmain,Scene * scene,PointerRNA * ptr)1695 static void rna_Scene_world_update(Main *bmain, Scene *scene, PointerRNA *ptr)
1696 {
1697 Scene *screen = (Scene *)ptr->owner_id;
1698
1699 rna_Scene_glsl_update(bmain, scene, ptr);
1700 WM_main_add_notifier(NC_WORLD | ND_WORLD, &screen->id);
1701 DEG_relations_tag_update(bmain);
1702 }
1703
rna_Scene_mesh_quality_update(Main * bmain,Scene * UNUSED (scene),PointerRNA * ptr)1704 static void rna_Scene_mesh_quality_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
1705 {
1706 Scene *scene = (Scene *)ptr->owner_id;
1707
1708 FOREACH_SCENE_OBJECT_BEGIN (scene, ob) {
1709 if (ob->type == OB_MESH) {
1710 DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
1711 }
1712 }
1713 FOREACH_SCENE_OBJECT_END;
1714
1715 rna_Scene_glsl_update(bmain, scene, ptr);
1716 }
1717
rna_Scene_freestyle_update(Main * UNUSED (bmain),Scene * UNUSED (scene),PointerRNA * ptr)1718 void rna_Scene_freestyle_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1719 {
1720 Scene *scene = (Scene *)ptr->owner_id;
1721
1722 DEG_id_tag_update(&scene->id, 0);
1723 }
1724
rna_Scene_use_freestyle_update(Main * UNUSED (bmain),Scene * UNUSED (scene),PointerRNA * ptr)1725 void rna_Scene_use_freestyle_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1726 {
1727 Scene *scene = (Scene *)ptr->owner_id;
1728
1729 DEG_id_tag_update(&scene->id, 0);
1730
1731 if (scene->nodetree) {
1732 ntreeCompositUpdateRLayers(scene->nodetree);
1733 }
1734 }
1735
rna_Scene_use_view_map_cache_update(Main * UNUSED (bmain),Scene * UNUSED (scene),PointerRNA * UNUSED (ptr))1736 void rna_Scene_use_view_map_cache_update(Main *UNUSED(bmain),
1737 Scene *UNUSED(scene),
1738 PointerRNA *UNUSED(ptr))
1739 {
1740 # ifdef WITH_FREESTYLE
1741 FRS_free_view_map_cache();
1742 # endif
1743 }
1744
rna_ViewLayer_name_set(PointerRNA * ptr,const char * value)1745 void rna_ViewLayer_name_set(PointerRNA *ptr, const char *value)
1746 {
1747 Scene *scene = (Scene *)ptr->owner_id;
1748 ViewLayer *view_layer = (ViewLayer *)ptr->data;
1749 BLI_assert(BKE_id_is_in_global_main(&scene->id));
1750 BKE_view_layer_rename(G_MAIN, scene, view_layer, value);
1751 }
1752
rna_SceneRenderView_name_set(PointerRNA * ptr,const char * value)1753 static void rna_SceneRenderView_name_set(PointerRNA *ptr, const char *value)
1754 {
1755 Scene *scene = (Scene *)ptr->owner_id;
1756 SceneRenderView *rv = (SceneRenderView *)ptr->data;
1757 BLI_strncpy_utf8(rv->name, value, sizeof(rv->name));
1758 BLI_uniquename(&scene->r.views,
1759 rv,
1760 DATA_("RenderView"),
1761 '.',
1762 offsetof(SceneRenderView, name),
1763 sizeof(rv->name));
1764 }
1765
rna_ViewLayer_material_override_update(Main * bmain,Scene * UNUSED (scene),PointerRNA * ptr)1766 void rna_ViewLayer_material_override_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
1767 {
1768 Scene *scene = (Scene *)ptr->owner_id;
1769 rna_Scene_glsl_update(bmain, scene, ptr);
1770 DEG_relations_tag_update(bmain);
1771 }
1772
rna_ViewLayer_pass_update(Main * bmain,Scene * activescene,PointerRNA * ptr)1773 void rna_ViewLayer_pass_update(Main *bmain, Scene *activescene, PointerRNA *ptr)
1774 {
1775 Scene *scene = (Scene *)ptr->owner_id;
1776
1777 if (scene->nodetree) {
1778 ntreeCompositUpdateRLayers(scene->nodetree);
1779 }
1780
1781 rna_Scene_glsl_update(bmain, activescene, ptr);
1782 }
1783
rna_SceneRenderView_path(PointerRNA * ptr)1784 static char *rna_SceneRenderView_path(PointerRNA *ptr)
1785 {
1786 SceneRenderView *srv = (SceneRenderView *)ptr->data;
1787 return BLI_sprintfN("render.views[\"%s\"]", srv->name);
1788 }
1789
rna_Scene_use_nodes_update(bContext * C,PointerRNA * ptr)1790 static void rna_Scene_use_nodes_update(bContext *C, PointerRNA *ptr)
1791 {
1792 Scene *scene = (Scene *)ptr->data;
1793 if (scene->use_nodes && scene->nodetree == NULL) {
1794 ED_node_composit_default(C, scene);
1795 }
1796 DEG_relations_tag_update(CTX_data_main(C));
1797 }
1798
rna_Physics_relations_update(Main * bmain,Scene * UNUSED (scene),PointerRNA * UNUSED (ptr))1799 static void rna_Physics_relations_update(Main *bmain,
1800 Scene *UNUSED(scene),
1801 PointerRNA *UNUSED(ptr))
1802 {
1803 DEG_relations_tag_update(bmain);
1804 }
1805
rna_Physics_update(Main * UNUSED (bmain),Scene * UNUSED (scene),PointerRNA * ptr)1806 static void rna_Physics_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1807 {
1808 Scene *scene = (Scene *)ptr->owner_id;
1809 FOREACH_SCENE_OBJECT_BEGIN (scene, ob) {
1810 BKE_ptcache_object_reset(scene, ob, PTCACHE_RESET_DEPSGRAPH);
1811 }
1812 FOREACH_SCENE_OBJECT_END;
1813
1814 DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE);
1815 }
1816
rna_Scene_editmesh_select_mode_set(PointerRNA * ptr,const bool * value)1817 static void rna_Scene_editmesh_select_mode_set(PointerRNA *ptr, const bool *value)
1818 {
1819 ToolSettings *ts = (ToolSettings *)ptr->data;
1820 int flag = (value[0] ? SCE_SELECT_VERTEX : 0) | (value[1] ? SCE_SELECT_EDGE : 0) |
1821 (value[2] ? SCE_SELECT_FACE : 0);
1822
1823 if (flag) {
1824 ts->selectmode = flag;
1825
1826 /* Update select mode in all the workspaces in mesh edit mode. */
1827 wmWindowManager *wm = G_MAIN->wm.first;
1828 LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
1829 ViewLayer *view_layer = WM_window_get_active_view_layer(win);
1830
1831 if (view_layer && view_layer->basact) {
1832 Mesh *me = BKE_mesh_from_object(view_layer->basact->object);
1833 if (me && me->edit_mesh && me->edit_mesh->selectmode != flag) {
1834 me->edit_mesh->selectmode = flag;
1835 EDBM_selectmode_set(me->edit_mesh);
1836 }
1837 }
1838 }
1839 }
1840 }
1841
rna_Scene_editmesh_select_mode_update(bContext * C,PointerRNA * UNUSED (ptr))1842 static void rna_Scene_editmesh_select_mode_update(bContext *C, PointerRNA *UNUSED(ptr))
1843 {
1844 ViewLayer *view_layer = CTX_data_view_layer(C);
1845 Mesh *me = NULL;
1846
1847 if (view_layer->basact) {
1848 me = BKE_mesh_from_object(view_layer->basact->object);
1849 if (me && me->edit_mesh == NULL) {
1850 me = NULL;
1851 }
1852 }
1853
1854 if (me) {
1855 DEG_id_tag_update(&me->id, ID_RECALC_SELECT);
1856 WM_main_add_notifier(NC_SCENE | ND_TOOLSETTINGS, NULL);
1857 }
1858 }
1859
object_simplify_update(Object * ob)1860 static void object_simplify_update(Object *ob)
1861 {
1862 ModifierData *md;
1863 ParticleSystem *psys;
1864
1865 if ((ob->id.tag & LIB_TAG_DOIT) == 0) {
1866 return;
1867 }
1868
1869 ob->id.tag &= ~LIB_TAG_DOIT;
1870
1871 for (md = ob->modifiers.first; md; md = md->next) {
1872 if (ELEM(md->type,
1873 eModifierType_Subsurf,
1874 eModifierType_Multires,
1875 eModifierType_ParticleSystem)) {
1876 DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
1877 }
1878 }
1879
1880 for (psys = ob->particlesystem.first; psys; psys = psys->next) {
1881 psys->recalc |= ID_RECALC_PSYS_CHILD;
1882 }
1883
1884 if (ob->instance_collection) {
1885 FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (ob->instance_collection, ob_collection) {
1886 object_simplify_update(ob_collection);
1887 }
1888 FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
1889 }
1890
1891 if (ob->type == OB_VOLUME) {
1892 DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
1893 }
1894 }
1895
rna_Scene_use_simplify_update(Main * bmain,Scene * UNUSED (scene),PointerRNA * ptr)1896 static void rna_Scene_use_simplify_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
1897 {
1898 Scene *sce = (Scene *)ptr->owner_id;
1899 Scene *sce_iter;
1900 Base *base;
1901
1902 BKE_main_id_tag_listbase(&bmain->objects, LIB_TAG_DOIT, true);
1903 FOREACH_SCENE_OBJECT_BEGIN (sce, ob) {
1904 object_simplify_update(ob);
1905 }
1906 FOREACH_SCENE_OBJECT_END;
1907
1908 for (SETLOOPER_SET_ONLY(sce, sce_iter, base)) {
1909 object_simplify_update(base->object);
1910 }
1911
1912 WM_main_add_notifier(NC_GEOM | ND_DATA, NULL);
1913 WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
1914 DEG_id_tag_update(&sce->id, 0);
1915 }
1916
rna_Scene_simplify_update(Main * bmain,Scene * scene,PointerRNA * ptr)1917 static void rna_Scene_simplify_update(Main *bmain, Scene *scene, PointerRNA *ptr)
1918 {
1919 Scene *sce = (Scene *)ptr->owner_id;
1920
1921 if (sce->r.mode & R_SIMPLIFY) {
1922 rna_Scene_use_simplify_update(bmain, scene, ptr);
1923 }
1924 }
1925
rna_Scene_use_persistent_data_update(Main * UNUSED (bmain),Scene * UNUSED (scene),PointerRNA * ptr)1926 static void rna_Scene_use_persistent_data_update(Main *UNUSED(bmain),
1927 Scene *UNUSED(scene),
1928 PointerRNA *ptr)
1929 {
1930 Scene *sce = (Scene *)ptr->owner_id;
1931
1932 if (!(sce->r.mode & R_PERSISTENT_DATA)) {
1933 RE_FreePersistentData();
1934 }
1935 }
1936
1937 /* Scene.transform_orientation_slots */
rna_Scene_transform_orientation_slots_begin(CollectionPropertyIterator * iter,PointerRNA * ptr)1938 static void rna_Scene_transform_orientation_slots_begin(CollectionPropertyIterator *iter,
1939 PointerRNA *ptr)
1940 {
1941 Scene *scene = (Scene *)ptr->owner_id;
1942 TransformOrientationSlot *orient_slot = &scene->orientation_slots[0];
1943 rna_iterator_array_begin(
1944 iter, orient_slot, sizeof(*orient_slot), ARRAY_SIZE(scene->orientation_slots), 0, NULL);
1945 }
1946
rna_Scene_transform_orientation_slots_length(PointerRNA * ptr)1947 static int rna_Scene_transform_orientation_slots_length(PointerRNA *ptr)
1948 {
1949 Scene *scene = (Scene *)ptr->owner_id;
1950 return ARRAY_SIZE(scene->orientation_slots);
1951 }
1952
rna_Scene_use_audio_get(PointerRNA * ptr)1953 static bool rna_Scene_use_audio_get(PointerRNA *ptr)
1954 {
1955 Scene *scene = (Scene *)ptr->data;
1956 return (scene->audio.flag & AUDIO_MUTE) != 0;
1957 }
1958
rna_Scene_use_audio_set(PointerRNA * ptr,bool value)1959 static void rna_Scene_use_audio_set(PointerRNA *ptr, bool value)
1960 {
1961 Scene *scene = (Scene *)ptr->data;
1962
1963 if (value) {
1964 scene->audio.flag |= AUDIO_MUTE;
1965 }
1966 else {
1967 scene->audio.flag &= ~AUDIO_MUTE;
1968 }
1969 }
1970
rna_Scene_use_audio_update(Main * UNUSED (bmain),Scene * scene,PointerRNA * UNUSED (ptr))1971 static void rna_Scene_use_audio_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
1972 {
1973 DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_MUTE);
1974 }
1975
rna_Scene_sync_mode_get(PointerRNA * ptr)1976 static int rna_Scene_sync_mode_get(PointerRNA *ptr)
1977 {
1978 Scene *scene = (Scene *)ptr->data;
1979 if (scene->audio.flag & AUDIO_SYNC) {
1980 return AUDIO_SYNC;
1981 }
1982 return scene->flag & SCE_FRAME_DROP;
1983 }
1984
rna_Scene_sync_mode_set(PointerRNA * ptr,int value)1985 static void rna_Scene_sync_mode_set(PointerRNA *ptr, int value)
1986 {
1987 Scene *scene = (Scene *)ptr->data;
1988
1989 if (value == AUDIO_SYNC) {
1990 scene->audio.flag |= AUDIO_SYNC;
1991 }
1992 else if (value == SCE_FRAME_DROP) {
1993 scene->audio.flag &= ~AUDIO_SYNC;
1994 scene->flag |= SCE_FRAME_DROP;
1995 }
1996 else {
1997 scene->audio.flag &= ~AUDIO_SYNC;
1998 scene->flag &= ~SCE_FRAME_DROP;
1999 }
2000 }
2001
rna_View3DCursor_rotation_mode_set(PointerRNA * ptr,int value)2002 static void rna_View3DCursor_rotation_mode_set(PointerRNA *ptr, int value)
2003 {
2004 View3DCursor *cursor = ptr->data;
2005
2006 /* use API Method for conversions... */
2007 BKE_rotMode_change_values(cursor->rotation_quaternion,
2008 cursor->rotation_euler,
2009 cursor->rotation_axis,
2010 &cursor->rotation_angle,
2011 cursor->rotation_mode,
2012 (short)value);
2013
2014 /* finally, set the new rotation type */
2015 cursor->rotation_mode = value;
2016 }
2017
rna_View3DCursor_rotation_axis_angle_get(PointerRNA * ptr,float * value)2018 static void rna_View3DCursor_rotation_axis_angle_get(PointerRNA *ptr, float *value)
2019 {
2020 View3DCursor *cursor = ptr->data;
2021 value[0] = cursor->rotation_angle;
2022 copy_v3_v3(&value[1], cursor->rotation_axis);
2023 }
2024
rna_View3DCursor_rotation_axis_angle_set(PointerRNA * ptr,const float * value)2025 static void rna_View3DCursor_rotation_axis_angle_set(PointerRNA *ptr, const float *value)
2026 {
2027 View3DCursor *cursor = ptr->data;
2028 cursor->rotation_angle = value[0];
2029 copy_v3_v3(cursor->rotation_axis, &value[1]);
2030 }
2031
rna_View3DCursor_matrix_get(PointerRNA * ptr,float * values)2032 static void rna_View3DCursor_matrix_get(PointerRNA *ptr, float *values)
2033 {
2034 const View3DCursor *cursor = ptr->data;
2035 BKE_scene_cursor_to_mat4(cursor, (float(*)[4])values);
2036 }
2037
rna_View3DCursor_matrix_set(PointerRNA * ptr,const float * values)2038 static void rna_View3DCursor_matrix_set(PointerRNA *ptr, const float *values)
2039 {
2040 View3DCursor *cursor = ptr->data;
2041 float unit_mat[4][4];
2042 normalize_m4_m4(unit_mat, (const float(*)[4])values);
2043 BKE_scene_cursor_from_mat4(cursor, unit_mat, false);
2044 }
2045
rna_TransformOrientationSlot_path(PointerRNA * ptr)2046 static char *rna_TransformOrientationSlot_path(PointerRNA *ptr)
2047 {
2048 Scene *scene = (Scene *)ptr->owner_id;
2049 TransformOrientationSlot *orientation_slot = ptr->data;
2050
2051 if (!ELEM(NULL, scene, orientation_slot)) {
2052 for (int i = 0; i < ARRAY_SIZE(scene->orientation_slots); i++) {
2053 if (&scene->orientation_slots[i] == orientation_slot) {
2054 return BLI_sprintfN("transform_orientation_slots[%d]", i);
2055 }
2056 }
2057 }
2058
2059 /* Should not happen, but in case, just return defqult path. */
2060 BLI_assert(0);
2061 return BLI_strdup("transform_orientation_slots[0]");
2062 }
2063
rna_View3DCursor_path(PointerRNA * UNUSED (ptr))2064 static char *rna_View3DCursor_path(PointerRNA *UNUSED(ptr))
2065 {
2066 return BLI_strdup("cursor");
2067 }
2068
rna_TimeLine_add(Scene * scene,const char name[],int frame)2069 static TimeMarker *rna_TimeLine_add(Scene *scene, const char name[], int frame)
2070 {
2071 TimeMarker *marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker");
2072 marker->flag = SELECT;
2073 marker->frame = frame;
2074 BLI_strncpy_utf8(marker->name, name, sizeof(marker->name));
2075 BLI_addtail(&scene->markers, marker);
2076
2077 WM_main_add_notifier(NC_SCENE | ND_MARKERS, NULL);
2078 WM_main_add_notifier(NC_ANIMATION | ND_MARKERS, NULL);
2079
2080 return marker;
2081 }
2082
rna_TimeLine_remove(Scene * scene,ReportList * reports,PointerRNA * marker_ptr)2083 static void rna_TimeLine_remove(Scene *scene, ReportList *reports, PointerRNA *marker_ptr)
2084 {
2085 TimeMarker *marker = marker_ptr->data;
2086 if (BLI_remlink_safe(&scene->markers, marker) == false) {
2087 BKE_reportf(reports,
2088 RPT_ERROR,
2089 "Timeline marker '%s' not found in scene '%s'",
2090 marker->name,
2091 scene->id.name + 2);
2092 return;
2093 }
2094
2095 MEM_freeN(marker);
2096 RNA_POINTER_INVALIDATE(marker_ptr);
2097
2098 WM_main_add_notifier(NC_SCENE | ND_MARKERS, NULL);
2099 WM_main_add_notifier(NC_ANIMATION | ND_MARKERS, NULL);
2100 }
2101
rna_TimeLine_clear(Scene * scene)2102 static void rna_TimeLine_clear(Scene *scene)
2103 {
2104 BLI_freelistN(&scene->markers);
2105
2106 WM_main_add_notifier(NC_SCENE | ND_MARKERS, NULL);
2107 WM_main_add_notifier(NC_ANIMATION | ND_MARKERS, NULL);
2108 }
2109
rna_Scene_keying_set_new(Scene * sce,ReportList * reports,const char idname[],const char name[])2110 static KeyingSet *rna_Scene_keying_set_new(Scene *sce,
2111 ReportList *reports,
2112 const char idname[],
2113 const char name[])
2114 {
2115 KeyingSet *ks = NULL;
2116
2117 /* call the API func, and set the active keyingset index */
2118 ks = BKE_keyingset_add(&sce->keyingsets, idname, name, KEYINGSET_ABSOLUTE, 0);
2119
2120 if (ks) {
2121 sce->active_keyingset = BLI_listbase_count(&sce->keyingsets);
2122 return ks;
2123 }
2124 else {
2125 BKE_report(reports, RPT_ERROR, "Keying set could not be added");
2126 return NULL;
2127 }
2128 }
2129
rna_UnifiedPaintSettings_update(bContext * C,PointerRNA * UNUSED (ptr))2130 static void rna_UnifiedPaintSettings_update(bContext *C, PointerRNA *UNUSED(ptr))
2131 {
2132 Scene *scene = CTX_data_scene(C);
2133 ViewLayer *view_layer = CTX_data_view_layer(C);
2134 Brush *br = BKE_paint_brush(BKE_paint_get_active(scene, view_layer));
2135 WM_main_add_notifier(NC_BRUSH | NA_EDITED, br);
2136 }
2137
rna_UnifiedPaintSettings_size_set(PointerRNA * ptr,int value)2138 static void rna_UnifiedPaintSettings_size_set(PointerRNA *ptr, int value)
2139 {
2140 UnifiedPaintSettings *ups = ptr->data;
2141
2142 /* scale unprojected radius so it stays consistent with brush size */
2143 BKE_brush_scale_unprojected_radius(&ups->unprojected_radius, value, ups->size);
2144 ups->size = value;
2145 }
2146
rna_UnifiedPaintSettings_unprojected_radius_set(PointerRNA * ptr,float value)2147 static void rna_UnifiedPaintSettings_unprojected_radius_set(PointerRNA *ptr, float value)
2148 {
2149 UnifiedPaintSettings *ups = ptr->data;
2150
2151 /* scale brush size so it stays consistent with unprojected_radius */
2152 BKE_brush_scale_size(&ups->size, value, ups->unprojected_radius);
2153 ups->unprojected_radius = value;
2154 }
2155
rna_UnifiedPaintSettings_radius_update(bContext * C,PointerRNA * ptr)2156 static void rna_UnifiedPaintSettings_radius_update(bContext *C, PointerRNA *ptr)
2157 {
2158 /* changing the unified size should invalidate the overlay but also update the brush */
2159 BKE_paint_invalidate_overlay_all();
2160 rna_UnifiedPaintSettings_update(C, ptr);
2161 }
2162
rna_UnifiedPaintSettings_path(PointerRNA * UNUSED (ptr))2163 static char *rna_UnifiedPaintSettings_path(PointerRNA *UNUSED(ptr))
2164 {
2165 return BLI_strdup("tool_settings.unified_paint_settings");
2166 }
2167
rna_CurvePaintSettings_path(PointerRNA * UNUSED (ptr))2168 static char *rna_CurvePaintSettings_path(PointerRNA *UNUSED(ptr))
2169 {
2170 return BLI_strdup("tool_settings.curve_paint_settings");
2171 }
2172
2173 /* generic function to recalc geometry */
rna_EditMesh_update(bContext * C,PointerRNA * UNUSED (ptr))2174 static void rna_EditMesh_update(bContext *C, PointerRNA *UNUSED(ptr))
2175 {
2176 ViewLayer *view_layer = CTX_data_view_layer(C);
2177 Mesh *me = NULL;
2178
2179 if (view_layer->basact) {
2180 me = BKE_mesh_from_object(view_layer->basact->object);
2181 if (me && me->edit_mesh == NULL) {
2182 me = NULL;
2183 }
2184 }
2185
2186 if (me) {
2187 DEG_id_tag_update(&me->id, ID_RECALC_GEOMETRY);
2188 WM_main_add_notifier(NC_GEOM | ND_DATA, me);
2189 }
2190 }
2191
rna_MeshStatVis_path(PointerRNA * UNUSED (ptr))2192 static char *rna_MeshStatVis_path(PointerRNA *UNUSED(ptr))
2193 {
2194 return BLI_strdup("tool_settings.statvis");
2195 }
2196
2197 /* note: without this, when Multi-Paint is activated/deactivated, the colors
2198 * will not change right away when multiple bones are selected, this function
2199 * is not for general use and only for the few cases where changing scene
2200 * settings and NOT for general purpose updates, possibly this should be
2201 * given its own notifier. */
rna_Scene_update_active_object_data(bContext * C,PointerRNA * UNUSED (ptr))2202 static void rna_Scene_update_active_object_data(bContext *C, PointerRNA *UNUSED(ptr))
2203 {
2204 ViewLayer *view_layer = CTX_data_view_layer(C);
2205 Object *ob = OBACT(view_layer);
2206
2207 if (ob) {
2208 DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
2209 WM_main_add_notifier(NC_OBJECT | ND_DRAW, &ob->id);
2210 }
2211 }
2212
rna_SceneCamera_update(Main * UNUSED (bmain),Scene * UNUSED (scene),PointerRNA * ptr)2213 static void rna_SceneCamera_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
2214 {
2215 Scene *scene = (Scene *)ptr->owner_id;
2216 Object *camera = scene->camera;
2217
2218 BKE_sequencer_cache_cleanup(scene);
2219
2220 if (camera && (camera->type == OB_CAMERA)) {
2221 DEG_id_tag_update(&camera->id, ID_RECALC_GEOMETRY);
2222 }
2223 }
2224
rna_SceneSequencer_update(Main * UNUSED (bmain),Scene * scene,PointerRNA * UNUSED (ptr))2225 static void rna_SceneSequencer_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
2226 {
2227 BKE_sequencer_cache_cleanup(scene);
2228 }
2229
rna_ToolSettings_path(PointerRNA * UNUSED (ptr))2230 static char *rna_ToolSettings_path(PointerRNA *UNUSED(ptr))
2231 {
2232 return BLI_strdup("tool_settings");
2233 }
2234
rna_FreestyleLineSet_linestyle_get(PointerRNA * ptr)2235 PointerRNA rna_FreestyleLineSet_linestyle_get(PointerRNA *ptr)
2236 {
2237 FreestyleLineSet *lineset = (FreestyleLineSet *)ptr->data;
2238
2239 return rna_pointer_inherit_refine(ptr, &RNA_FreestyleLineStyle, lineset->linestyle);
2240 }
2241
rna_FreestyleLineSet_linestyle_set(PointerRNA * ptr,PointerRNA value,struct ReportList * UNUSED (reports))2242 void rna_FreestyleLineSet_linestyle_set(PointerRNA *ptr,
2243 PointerRNA value,
2244 struct ReportList *UNUSED(reports))
2245 {
2246 FreestyleLineSet *lineset = (FreestyleLineSet *)ptr->data;
2247
2248 if (lineset->linestyle) {
2249 id_us_min(&lineset->linestyle->id);
2250 }
2251 lineset->linestyle = (FreestyleLineStyle *)value.data;
2252 id_us_plus(&lineset->linestyle->id);
2253 }
2254
rna_FreestyleSettings_lineset_add(ID * id,FreestyleSettings * config,Main * bmain,const char * name)2255 FreestyleLineSet *rna_FreestyleSettings_lineset_add(ID *id,
2256 FreestyleSettings *config,
2257 Main *bmain,
2258 const char *name)
2259 {
2260 Scene *scene = (Scene *)id;
2261 FreestyleLineSet *lineset = BKE_freestyle_lineset_add(bmain, (FreestyleConfig *)config, name);
2262
2263 DEG_id_tag_update(&scene->id, 0);
2264 WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
2265
2266 return lineset;
2267 }
2268
rna_FreestyleSettings_lineset_remove(ID * id,FreestyleSettings * config,ReportList * reports,PointerRNA * lineset_ptr)2269 void rna_FreestyleSettings_lineset_remove(ID *id,
2270 FreestyleSettings *config,
2271 ReportList *reports,
2272 PointerRNA *lineset_ptr)
2273 {
2274 FreestyleLineSet *lineset = lineset_ptr->data;
2275 Scene *scene = (Scene *)id;
2276
2277 if (!BKE_freestyle_lineset_delete((FreestyleConfig *)config, lineset)) {
2278 BKE_reportf(reports, RPT_ERROR, "Line set '%s' could not be removed", lineset->name);
2279 return;
2280 }
2281
2282 RNA_POINTER_INVALIDATE(lineset_ptr);
2283
2284 DEG_id_tag_update(&scene->id, 0);
2285 WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
2286 }
2287
rna_FreestyleSettings_active_lineset_get(PointerRNA * ptr)2288 PointerRNA rna_FreestyleSettings_active_lineset_get(PointerRNA *ptr)
2289 {
2290 FreestyleConfig *config = (FreestyleConfig *)ptr->data;
2291 FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(config);
2292 return rna_pointer_inherit_refine(ptr, &RNA_FreestyleLineSet, lineset);
2293 }
2294
rna_FreestyleSettings_active_lineset_index_range(PointerRNA * ptr,int * min,int * max,int * UNUSED (softmin),int * UNUSED (softmax))2295 void rna_FreestyleSettings_active_lineset_index_range(
2296 PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
2297 {
2298 FreestyleConfig *config = (FreestyleConfig *)ptr->data;
2299
2300 *min = 0;
2301 *max = max_ii(0, BLI_listbase_count(&config->linesets) - 1);
2302 }
2303
rna_FreestyleSettings_active_lineset_index_get(PointerRNA * ptr)2304 int rna_FreestyleSettings_active_lineset_index_get(PointerRNA *ptr)
2305 {
2306 FreestyleConfig *config = (FreestyleConfig *)ptr->data;
2307 return BKE_freestyle_lineset_get_active_index(config);
2308 }
2309
rna_FreestyleSettings_active_lineset_index_set(PointerRNA * ptr,int value)2310 void rna_FreestyleSettings_active_lineset_index_set(PointerRNA *ptr, int value)
2311 {
2312 FreestyleConfig *config = (FreestyleConfig *)ptr->data;
2313 BKE_freestyle_lineset_set_active_index(config, value);
2314 }
2315
rna_FreestyleSettings_module_add(ID * id,FreestyleSettings * config)2316 FreestyleModuleConfig *rna_FreestyleSettings_module_add(ID *id, FreestyleSettings *config)
2317 {
2318 Scene *scene = (Scene *)id;
2319 FreestyleModuleConfig *module = BKE_freestyle_module_add((FreestyleConfig *)config);
2320
2321 DEG_id_tag_update(&scene->id, 0);
2322 WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
2323
2324 return module;
2325 }
2326
rna_FreestyleSettings_module_remove(ID * id,FreestyleSettings * config,ReportList * reports,PointerRNA * module_ptr)2327 void rna_FreestyleSettings_module_remove(ID *id,
2328 FreestyleSettings *config,
2329 ReportList *reports,
2330 PointerRNA *module_ptr)
2331 {
2332 Scene *scene = (Scene *)id;
2333 FreestyleModuleConfig *module = module_ptr->data;
2334
2335 if (!BKE_freestyle_module_delete((FreestyleConfig *)config, module)) {
2336 if (module->script) {
2337 BKE_reportf(reports,
2338 RPT_ERROR,
2339 "Style module '%s' could not be removed",
2340 module->script->id.name + 2);
2341 }
2342 else {
2343 BKE_report(reports, RPT_ERROR, "Style module could not be removed");
2344 }
2345 return;
2346 }
2347
2348 RNA_POINTER_INVALIDATE(module_ptr);
2349
2350 DEG_id_tag_update(&scene->id, 0);
2351 WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
2352 }
2353
rna_Stereo3dFormat_update(Main * bmain,Scene * UNUSED (scene),PointerRNA * ptr)2354 static void rna_Stereo3dFormat_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
2355 {
2356 ID *id = ptr->owner_id;
2357
2358 if (id && GS(id->name) == ID_IM) {
2359 Image *ima = (Image *)id;
2360 ImBuf *ibuf;
2361 void *lock;
2362
2363 if (!BKE_image_is_stereo(ima)) {
2364 return;
2365 }
2366
2367 ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
2368
2369 if (ibuf) {
2370 BKE_image_signal(bmain, ima, NULL, IMA_SIGNAL_FREE);
2371 }
2372 BKE_image_release_ibuf(ima, ibuf, lock);
2373 }
2374 }
2375
rna_ViewLayer_new(ID * id,Scene * UNUSED (sce),Main * bmain,const char * name)2376 static ViewLayer *rna_ViewLayer_new(ID *id, Scene *UNUSED(sce), Main *bmain, const char *name)
2377 {
2378 Scene *scene = (Scene *)id;
2379 ViewLayer *view_layer = BKE_view_layer_add(scene, name, NULL, VIEWLAYER_ADD_NEW);
2380
2381 DEG_id_tag_update(&scene->id, 0);
2382 DEG_relations_tag_update(bmain);
2383 WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL);
2384
2385 return view_layer;
2386 }
2387
rna_ViewLayer_remove(ID * id,Scene * UNUSED (sce),Main * bmain,ReportList * reports,PointerRNA * sl_ptr)2388 static void rna_ViewLayer_remove(
2389 ID *id, Scene *UNUSED(sce), Main *bmain, ReportList *reports, PointerRNA *sl_ptr)
2390 {
2391 Scene *scene = (Scene *)id;
2392 ViewLayer *view_layer = sl_ptr->data;
2393
2394 if (ED_scene_view_layer_delete(bmain, scene, view_layer, reports)) {
2395 RNA_POINTER_INVALIDATE(sl_ptr);
2396 }
2397 }
2398
2399 /* Fake value, used internally (not saved to DNA). */
2400 # define V3D_ORIENT_DEFAULT -1
2401
rna_TransformOrientationSlot_type_get(PointerRNA * ptr)2402 static int rna_TransformOrientationSlot_type_get(PointerRNA *ptr)
2403 {
2404 Scene *scene = (Scene *)ptr->owner_id;
2405 TransformOrientationSlot *orient_slot = ptr->data;
2406 if (orient_slot != &scene->orientation_slots[SCE_ORIENT_DEFAULT]) {
2407 if ((orient_slot->flag & SELECT) == 0) {
2408 return V3D_ORIENT_DEFAULT;
2409 }
2410 }
2411 return BKE_scene_orientation_slot_get_index(orient_slot);
2412 }
2413
rna_TransformOrientationSlot_type_set(PointerRNA * ptr,int value)2414 void rna_TransformOrientationSlot_type_set(PointerRNA *ptr, int value)
2415 {
2416 Scene *scene = (Scene *)ptr->owner_id;
2417 TransformOrientationSlot *orient_slot = ptr->data;
2418
2419 if (orient_slot != &scene->orientation_slots[SCE_ORIENT_DEFAULT]) {
2420 if (value == V3D_ORIENT_DEFAULT) {
2421 orient_slot->flag &= ~SELECT;
2422 return;
2423 }
2424 else {
2425 orient_slot->flag |= SELECT;
2426 }
2427 }
2428
2429 BKE_scene_orientation_slot_set_index(orient_slot, value);
2430 }
2431
rna_TransformOrientationSlot_get(PointerRNA * ptr)2432 static PointerRNA rna_TransformOrientationSlot_get(PointerRNA *ptr)
2433 {
2434 Scene *scene = (Scene *)ptr->owner_id;
2435 TransformOrientationSlot *orient_slot = ptr->data;
2436 TransformOrientation *orientation;
2437 if (orient_slot->type < V3D_ORIENT_CUSTOM) {
2438 orientation = NULL;
2439 }
2440 else {
2441 orientation = BKE_scene_transform_orientation_find(scene, orient_slot->index_custom);
2442 }
2443 return rna_pointer_inherit_refine(ptr, &RNA_TransformOrientation, orientation);
2444 }
2445
rna_TransformOrientation_impl_itemf(Scene * scene,const bool include_default,bool * r_free)2446 static const EnumPropertyItem *rna_TransformOrientation_impl_itemf(Scene *scene,
2447 const bool include_default,
2448 bool *r_free)
2449 {
2450 EnumPropertyItem tmp = {0, "", 0, "", ""};
2451 EnumPropertyItem *item = NULL;
2452 int i = V3D_ORIENT_CUSTOM, totitem = 0;
2453
2454 if (include_default) {
2455 tmp.identifier = "DEFAULT";
2456 tmp.name = "Default";
2457 tmp.description = "Use the scene orientation";
2458 tmp.value = V3D_ORIENT_DEFAULT;
2459 tmp.icon = ICON_OBJECT_ORIGIN;
2460 RNA_enum_item_add(&item, &totitem, &tmp);
2461 tmp.icon = 0;
2462
2463 RNA_enum_item_add_separator(&item, &totitem);
2464 }
2465
2466 RNA_enum_items_add(&item, &totitem, rna_enum_transform_orientation_items);
2467
2468 const ListBase *transform_orientations = scene ? &scene->transform_spaces : NULL;
2469
2470 if (transform_orientations && (BLI_listbase_is_empty(transform_orientations) == false)) {
2471 RNA_enum_item_add_separator(&item, &totitem);
2472
2473 LISTBASE_FOREACH (TransformOrientation *, ts, transform_orientations) {
2474 tmp.identifier = ts->name;
2475 tmp.name = ts->name;
2476 tmp.value = i++;
2477 RNA_enum_item_add(&item, &totitem, &tmp);
2478 }
2479 }
2480
2481 RNA_enum_item_end(&item, &totitem);
2482 *r_free = true;
2483
2484 return item;
2485 }
rna_TransformOrientation_itemf(bContext * C,PointerRNA * ptr,PropertyRNA * UNUSED (prop),bool * r_free)2486 const EnumPropertyItem *rna_TransformOrientation_itemf(bContext *C,
2487 PointerRNA *ptr,
2488 PropertyRNA *UNUSED(prop),
2489 bool *r_free)
2490 {
2491 Scene *scene;
2492 if (ptr->owner_id && (GS(ptr->owner_id->name) == ID_SCE)) {
2493 scene = (Scene *)ptr->owner_id;
2494 }
2495 else {
2496 scene = CTX_data_scene(C);
2497 }
2498 return rna_TransformOrientation_impl_itemf(scene, false, r_free);
2499 }
2500
rna_TransformOrientation_with_scene_itemf(bContext * UNUSED (C),PointerRNA * ptr,PropertyRNA * UNUSED (prop),bool * r_free)2501 const EnumPropertyItem *rna_TransformOrientation_with_scene_itemf(bContext *UNUSED(C),
2502 PointerRNA *ptr,
2503 PropertyRNA *UNUSED(prop),
2504 bool *r_free)
2505 {
2506 Scene *scene = (Scene *)ptr->owner_id;
2507 TransformOrientationSlot *orient_slot = ptr->data;
2508 bool include_default = (orient_slot != &scene->orientation_slots[SCE_ORIENT_DEFAULT]);
2509 return rna_TransformOrientation_impl_itemf(scene, include_default, r_free);
2510 }
2511
2512 # undef V3D_ORIENT_DEFAULT
2513
rna_UnitSettings_itemf_wrapper(const int system,const int type,bool * r_free)2514 static const EnumPropertyItem *rna_UnitSettings_itemf_wrapper(const int system,
2515 const int type,
2516 bool *r_free)
2517 {
2518 const void *usys;
2519 int len;
2520 BKE_unit_system_get(system, type, &usys, &len);
2521
2522 EnumPropertyItem *items = NULL;
2523 int totitem = 0;
2524
2525 EnumPropertyItem adaptive = {0};
2526 adaptive.identifier = "ADAPTIVE";
2527 adaptive.name = "Adaptive";
2528 adaptive.value = USER_UNIT_ADAPTIVE;
2529 RNA_enum_item_add(&items, &totitem, &adaptive);
2530
2531 for (int i = 0; i < len; i++) {
2532 if (!BKE_unit_is_suppressed(usys, i)) {
2533 EnumPropertyItem tmp = {0};
2534 tmp.identifier = BKE_unit_identifier_get(usys, i);
2535 tmp.name = BKE_unit_display_name_get(usys, i);
2536 tmp.value = i;
2537 RNA_enum_item_add(&items, &totitem, &tmp);
2538 }
2539 }
2540
2541 RNA_enum_item_end(&items, &totitem);
2542 *r_free = true;
2543
2544 return items;
2545 }
2546
rna_UnitSettings_length_unit_itemf(bContext * UNUSED (C),PointerRNA * ptr,PropertyRNA * UNUSED (prop),bool * r_free)2547 const EnumPropertyItem *rna_UnitSettings_length_unit_itemf(bContext *UNUSED(C),
2548 PointerRNA *ptr,
2549 PropertyRNA *UNUSED(prop),
2550 bool *r_free)
2551 {
2552 UnitSettings *units = ptr->data;
2553 return rna_UnitSettings_itemf_wrapper(units->system, B_UNIT_LENGTH, r_free);
2554 }
2555
rna_UnitSettings_mass_unit_itemf(bContext * UNUSED (C),PointerRNA * ptr,PropertyRNA * UNUSED (prop),bool * r_free)2556 const EnumPropertyItem *rna_UnitSettings_mass_unit_itemf(bContext *UNUSED(C),
2557 PointerRNA *ptr,
2558 PropertyRNA *UNUSED(prop),
2559 bool *r_free)
2560 {
2561 UnitSettings *units = ptr->data;
2562 return rna_UnitSettings_itemf_wrapper(units->system, B_UNIT_MASS, r_free);
2563 }
2564
rna_UnitSettings_time_unit_itemf(bContext * UNUSED (C),PointerRNA * ptr,PropertyRNA * UNUSED (prop),bool * r_free)2565 const EnumPropertyItem *rna_UnitSettings_time_unit_itemf(bContext *UNUSED(C),
2566 PointerRNA *ptr,
2567 PropertyRNA *UNUSED(prop),
2568 bool *r_free)
2569 {
2570 UnitSettings *units = ptr->data;
2571 return rna_UnitSettings_itemf_wrapper(units->system, B_UNIT_TIME, r_free);
2572 }
2573
rna_UnitSettings_temperature_unit_itemf(bContext * UNUSED (C),PointerRNA * ptr,PropertyRNA * UNUSED (prop),bool * r_free)2574 const EnumPropertyItem *rna_UnitSettings_temperature_unit_itemf(bContext *UNUSED(C),
2575 PointerRNA *ptr,
2576 PropertyRNA *UNUSED(prop),
2577 bool *r_free)
2578 {
2579 UnitSettings *units = ptr->data;
2580 return rna_UnitSettings_itemf_wrapper(units->system, B_UNIT_TEMPERATURE, r_free);
2581 }
2582
rna_UnitSettings_system_update(Main * UNUSED (bmain),Scene * scene,PointerRNA * UNUSED (ptr))2583 static void rna_UnitSettings_system_update(Main *UNUSED(bmain),
2584 Scene *scene,
2585 PointerRNA *UNUSED(ptr))
2586 {
2587 UnitSettings *unit = &scene->unit;
2588 if (unit->system == USER_UNIT_NONE) {
2589 unit->length_unit = USER_UNIT_ADAPTIVE;
2590 unit->mass_unit = USER_UNIT_ADAPTIVE;
2591 }
2592 else {
2593 unit->length_unit = BKE_unit_base_of_type_get(unit->system, B_UNIT_LENGTH);
2594 unit->mass_unit = BKE_unit_base_of_type_get(unit->system, B_UNIT_MASS);
2595 }
2596 }
2597
rna_UnitSettings_path(PointerRNA * UNUSED (ptr))2598 static char *rna_UnitSettings_path(PointerRNA *UNUSED(ptr))
2599 {
2600 return BLI_strdup("unit_settings");
2601 }
2602
rna_FFmpegSettings_path(PointerRNA * UNUSED (ptr))2603 static char *rna_FFmpegSettings_path(PointerRNA *UNUSED(ptr))
2604 {
2605 return BLI_strdup("render.ffmpeg");
2606 }
2607
2608 #else
2609
2610 /* Grease Pencil Interpolation tool settings */
rna_def_gpencil_interpolate(BlenderRNA * brna)2611 static void rna_def_gpencil_interpolate(BlenderRNA *brna)
2612 {
2613 StructRNA *srna;
2614 PropertyRNA *prop;
2615
2616 srna = RNA_def_struct(brna, "GPencilInterpolateSettings", NULL);
2617 RNA_def_struct_sdna(srna, "GP_Interpolate_Settings");
2618 RNA_def_struct_path_func(srna, "rna_GPencilInterpolateSettings_path");
2619 RNA_def_struct_ui_text(srna,
2620 "Grease Pencil Interpolate Settings",
2621 "Settings for Grease Pencil interpolation tools");
2622
2623 /* flags */
2624 prop = RNA_def_property(srna, "interpolate_all_layers", PROP_BOOLEAN, PROP_NONE);
2625 RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_TOOLFLAG_INTERPOLATE_ALL_LAYERS);
2626 RNA_def_property_ui_text(
2627 prop, "Interpolate All Layers", "Interpolate all layers, not only active");
2628 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
2629
2630 prop = RNA_def_property(srna, "interpolate_selected_only", PROP_BOOLEAN, PROP_NONE);
2631 RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_TOOLFLAG_INTERPOLATE_ONLY_SELECTED);
2632 RNA_def_property_ui_text(prop,
2633 "Interpolate Selected Strokes",
2634 "Interpolate only selected strokes in the original frame");
2635 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
2636
2637 /* interpolation type */
2638 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
2639 RNA_def_property_enum_sdna(prop, NULL, "type");
2640 RNA_def_property_enum_items(prop, rna_enum_gpencil_interpolation_mode_items);
2641 RNA_def_property_enum_funcs(prop, NULL, "rna_GPencilInterpolateSettings_type_set", NULL);
2642 RNA_def_property_ui_text(
2643 prop, "Type", "Interpolation method to use the next time 'Interpolate Sequence' is run");
2644 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
2645
2646 prop = RNA_def_property(srna, "step", PROP_INT, PROP_NONE);
2647 RNA_def_property_range(prop, 1, MAXFRAME);
2648 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2649 RNA_def_property_ui_text(prop, "Step", "Number of frames between generated interpolated frames");
2650 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
2651
2652 /* easing */
2653 prop = RNA_def_property(srna, "easing", PROP_ENUM, PROP_NONE);
2654 RNA_def_property_enum_sdna(prop, NULL, "easing");
2655 RNA_def_property_enum_items(prop, rna_enum_beztriple_interpolation_easing_items);
2656 RNA_def_property_ui_text(
2657 prop,
2658 "Easing",
2659 "Which ends of the segment between the preceding and following grease pencil frames "
2660 "easing interpolation is applied to");
2661 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
2662
2663 /* easing options */
2664 prop = RNA_def_property(srna, "back", PROP_FLOAT, PROP_NONE);
2665 RNA_def_property_float_sdna(prop, NULL, "back");
2666 RNA_def_property_ui_text(prop, "Back", "Amount of overshoot for 'back' easing");
2667 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
2668
2669 prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
2670 RNA_def_property_float_sdna(prop, NULL, "amplitude");
2671 RNA_def_property_range(prop, 0.0f, FLT_MAX); /* only positive values... */
2672 RNA_def_property_ui_text(
2673 prop, "Amplitude", "Amount to boost elastic bounces for 'elastic' easing");
2674 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
2675
2676 prop = RNA_def_property(srna, "period", PROP_FLOAT, PROP_NONE);
2677 RNA_def_property_float_sdna(prop, NULL, "period");
2678 RNA_def_property_ui_text(prop, "Period", "Time between bounces for elastic easing");
2679 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
2680
2681 /* custom curvemap */
2682 prop = RNA_def_property(srna, "interpolation_curve", PROP_POINTER, PROP_NONE);
2683 RNA_def_property_pointer_sdna(prop, NULL, "custom_ipo");
2684 RNA_def_property_struct_type(prop, "CurveMapping");
2685 RNA_def_property_ui_text(
2686 prop,
2687 "Interpolation Curve",
2688 "Custom curve to control 'sequence' interpolation between Grease Pencil frames");
2689 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
2690 }
2691
rna_def_transform_orientation(BlenderRNA * brna)2692 static void rna_def_transform_orientation(BlenderRNA *brna)
2693 {
2694 StructRNA *srna;
2695 PropertyRNA *prop;
2696
2697 srna = RNA_def_struct(brna, "TransformOrientation", NULL);
2698
2699 prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
2700 RNA_def_property_float_sdna(prop, NULL, "mat");
2701 RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_3x3);
2702 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2703
2704 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
2705 RNA_def_struct_name_property(srna, prop);
2706 RNA_def_property_ui_text(prop, "Name", "Name of the custom transform orientation");
2707 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2708 }
2709
rna_def_transform_orientation_slot(BlenderRNA * brna)2710 static void rna_def_transform_orientation_slot(BlenderRNA *brna)
2711 {
2712 StructRNA *srna;
2713 PropertyRNA *prop;
2714
2715 srna = RNA_def_struct(brna, "TransformOrientationSlot", NULL);
2716 RNA_def_struct_sdna(srna, "TransformOrientationSlot");
2717 RNA_def_struct_path_func(srna, "rna_TransformOrientationSlot_path");
2718 RNA_def_struct_ui_text(srna, "Orientation Slot", "");
2719
2720 /* Orientations */
2721 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
2722 RNA_def_property_enum_items(prop, rna_enum_transform_orientation_items);
2723 RNA_def_property_enum_funcs(prop,
2724 "rna_TransformOrientationSlot_type_get",
2725 "rna_TransformOrientationSlot_type_set",
2726 "rna_TransformOrientation_with_scene_itemf");
2727 RNA_def_property_ui_text(prop, "Orientation", "Transformation orientation");
2728 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2729
2730 prop = RNA_def_property(srna, "custom_orientation", PROP_POINTER, PROP_NONE);
2731 RNA_def_property_struct_type(prop, "TransformOrientation");
2732 RNA_def_property_pointer_funcs(prop, "rna_TransformOrientationSlot_get", NULL, NULL, NULL);
2733 RNA_def_property_ui_text(prop, "Current Transform Orientation", "");
2734
2735 /* flag */
2736 prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
2737 RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
2738 RNA_def_property_ui_text(prop, "Use", "Use scene orientation instead of a custom setting");
2739 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
2740 }
2741
rna_def_view3d_cursor(BlenderRNA * brna)2742 static void rna_def_view3d_cursor(BlenderRNA *brna)
2743 {
2744 StructRNA *srna;
2745 PropertyRNA *prop;
2746
2747 srna = RNA_def_struct(brna, "View3DCursor", NULL);
2748 RNA_def_struct_sdna(srna, "View3DCursor");
2749 RNA_def_struct_path_func(srna, "rna_View3DCursor_path");
2750 RNA_def_struct_ui_text(srna, "3D Cursor", "");
2751
2752 prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_XYZ_LENGTH);
2753 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2754 RNA_def_property_float_sdna(prop, NULL, "location");
2755 RNA_def_property_ui_text(prop, "Location", "");
2756 RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 4);
2757 RNA_def_property_update(prop, NC_WINDOW, NULL);
2758
2759 prop = RNA_def_property(srna, "rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
2760 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2761 RNA_def_property_float_sdna(prop, NULL, "rotation_quaternion");
2762 RNA_def_property_ui_text(
2763 prop, "Quaternion Rotation", "Rotation in quaternions (keep normalized)");
2764 RNA_def_property_update(prop, NC_WINDOW, NULL);
2765
2766 prop = RNA_def_property(srna, "rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
2767 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2768 RNA_def_property_array(prop, 4);
2769 RNA_def_property_float_funcs(prop,
2770 "rna_View3DCursor_rotation_axis_angle_get",
2771 "rna_View3DCursor_rotation_axis_angle_set",
2772 NULL);
2773 RNA_def_property_float_array_default(prop, rna_default_axis_angle);
2774 RNA_def_property_ui_text(
2775 prop, "Axis-Angle Rotation", "Angle of Rotation for Axis-Angle rotation representation");
2776 RNA_def_property_update(prop, NC_WINDOW, NULL);
2777
2778 prop = RNA_def_property(srna, "rotation_euler", PROP_FLOAT, PROP_EULER);
2779 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2780 RNA_def_property_float_sdna(prop, NULL, "rotation_euler");
2781 RNA_def_property_ui_text(prop, "Euler Rotation", "3D rotation");
2782 RNA_def_property_update(prop, NC_WINDOW, NULL);
2783
2784 prop = RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
2785 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2786 RNA_def_property_enum_sdna(prop, NULL, "rotation_mode");
2787 RNA_def_property_enum_items(prop, rna_enum_object_rotation_mode_items);
2788 RNA_def_property_enum_funcs(prop, NULL, "rna_View3DCursor_rotation_mode_set", NULL);
2789 RNA_def_property_ui_text(prop, "Rotation Mode", "");
2790 RNA_def_property_update(prop, NC_WINDOW, NULL);
2791
2792 /* Matrix access to avoid having to check current rotation mode. */
2793 prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
2794 RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
2795 RNA_def_property_flag(prop, PROP_THICK_WRAP); /* no reference to original data */
2796 RNA_def_property_ui_text(prop, "Transform Matrix", "Matrix combining loc/rot of the cursor");
2797 RNA_def_property_float_funcs(
2798 prop, "rna_View3DCursor_matrix_get", "rna_View3DCursor_matrix_set", NULL);
2799 }
2800
rna_def_tool_settings(BlenderRNA * brna)2801 static void rna_def_tool_settings(BlenderRNA *brna)
2802 {
2803 StructRNA *srna;
2804 PropertyRNA *prop;
2805
2806 /* the construction of this enum is quite special - everything is stored as bitflags,
2807 * with 1st position only for on/off (and exposed as boolean), while others are mutually
2808 * exclusive options but which will only have any effect when autokey is enabled
2809 */
2810 static const EnumPropertyItem auto_key_items[] = {
2811 {AUTOKEY_MODE_NORMAL & ~AUTOKEY_ON, "ADD_REPLACE_KEYS", 0, "Add & Replace", ""},
2812 {AUTOKEY_MODE_EDITKEYS & ~AUTOKEY_ON, "REPLACE_KEYS", 0, "Replace", ""},
2813 {0, NULL, 0, NULL, NULL},
2814 };
2815
2816 static const EnumPropertyItem draw_groupuser_items[] = {
2817 {OB_DRAW_GROUPUSER_NONE, "NONE", 0, "None", ""},
2818 {OB_DRAW_GROUPUSER_ACTIVE,
2819 "ACTIVE",
2820 0,
2821 "Active",
2822 "Show vertices with no weights in the active group"},
2823 {OB_DRAW_GROUPUSER_ALL, "ALL", 0, "All", "Show vertices with no weights in any group"},
2824 {0, NULL, 0, NULL, NULL},
2825 };
2826
2827 static const EnumPropertyItem vertex_group_select_items[] = {
2828 {WT_VGROUP_ALL, "ALL", 0, "All", "All Vertex Groups"},
2829 {WT_VGROUP_BONE_DEFORM,
2830 "BONE_DEFORM",
2831 0,
2832 "Deform",
2833 "Vertex Groups assigned to Deform Bones"},
2834 {WT_VGROUP_BONE_DEFORM_OFF,
2835 "OTHER_DEFORM",
2836 0,
2837 "Other",
2838 "Vertex Groups assigned to non Deform Bones"},
2839 {0, NULL, 0, NULL, NULL},
2840 };
2841
2842 static const EnumPropertyItem gpencil_stroke_placement_items[] = {
2843 {GP_PROJECT_VIEWSPACE,
2844 "ORIGIN",
2845 ICON_OBJECT_ORIGIN,
2846 "Origin",
2847 "Draw stroke at Object origin"},
2848 {GP_PROJECT_VIEWSPACE | GP_PROJECT_CURSOR,
2849 "CURSOR",
2850 ICON_PIVOT_CURSOR,
2851 "3D Cursor",
2852 "Draw stroke at 3D cursor location"},
2853 {GP_PROJECT_VIEWSPACE | GP_PROJECT_DEPTH_VIEW,
2854 "SURFACE",
2855 ICON_SNAP_FACE,
2856 "Surface",
2857 "Stick stroke to surfaces"},
2858 {GP_PROJECT_VIEWSPACE | GP_PROJECT_DEPTH_STROKE,
2859 "STROKE",
2860 ICON_STROKE,
2861 "Stroke",
2862 "Stick stroke to other strokes"},
2863 {0, NULL, 0, NULL, NULL},
2864 };
2865
2866 static const EnumPropertyItem gpencil_stroke_snap_items[] = {
2867 {0, "NONE", 0, "All points", "Snap to all points"},
2868 {GP_PROJECT_DEPTH_STROKE_ENDPOINTS,
2869 "ENDS",
2870 0,
2871 "End points",
2872 "Snap to first and last points and interpolate"},
2873 {GP_PROJECT_DEPTH_STROKE_FIRST, "FIRST", 0, "First point", "Snap to first point"},
2874 {0, NULL, 0, NULL, NULL},
2875 };
2876
2877 static const EnumPropertyItem gpencil_selectmode_items[] = {
2878 {GP_SELECTMODE_POINT, "POINT", ICON_GP_SELECT_POINTS, "Point", "Select only points"},
2879 {GP_SELECTMODE_STROKE,
2880 "STROKE",
2881 ICON_GP_SELECT_STROKES,
2882 "Stroke",
2883 "Select all stroke points"},
2884 {GP_SELECTMODE_SEGMENT,
2885 "SEGMENT",
2886 ICON_GP_SELECT_BETWEEN_STROKES,
2887 "Segment",
2888 "Select all stroke points between other strokes"},
2889 {0, NULL, 0, NULL, NULL},
2890 };
2891
2892 static const EnumPropertyItem annotation_stroke_placement_items[] = {
2893 {GP_PROJECT_VIEWSPACE | GP_PROJECT_CURSOR,
2894 "CURSOR",
2895 ICON_PIVOT_CURSOR,
2896 "3D Cursor",
2897 "Draw stroke at 3D cursor location"},
2898 /* Weird, GP_PROJECT_VIEWALIGN is inverted. */
2899 {0, "VIEW", ICON_RESTRICT_VIEW_ON, "View", "Stick stroke to the view"},
2900 {GP_PROJECT_VIEWSPACE | GP_PROJECT_DEPTH_VIEW,
2901 "SURFACE",
2902 ICON_FACESEL,
2903 "Surface",
2904 "Stick stroke to surfaces"},
2905 {0, NULL, 0, NULL, NULL},
2906 };
2907
2908 srna = RNA_def_struct(brna, "ToolSettings", NULL);
2909 RNA_def_struct_path_func(srna, "rna_ToolSettings_path");
2910 RNA_def_struct_ui_text(srna, "Tool Settings", "");
2911
2912 prop = RNA_def_property(srna, "sculpt", PROP_POINTER, PROP_NONE);
2913 RNA_def_property_struct_type(prop, "Sculpt");
2914 RNA_def_property_ui_text(prop, "Sculpt", "");
2915
2916 prop = RNA_def_property(srna, "use_auto_normalize", PROP_BOOLEAN, PROP_NONE);
2917 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
2918 RNA_def_property_boolean_sdna(prop, NULL, "auto_normalize", 1);
2919 RNA_def_property_ui_text(prop,
2920 "WPaint Auto-Normalize",
2921 "Ensure all bone-deforming vertex groups add up "
2922 "to 1.0 while weight painting");
2923 RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data");
2924
2925 prop = RNA_def_property(srna, "use_lock_relative", PROP_BOOLEAN, PROP_NONE);
2926 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
2927 RNA_def_property_boolean_sdna(prop, NULL, "wpaint_lock_relative", 1);
2928 RNA_def_property_ui_text(prop,
2929 "WPaint Lock-Relative",
2930 "Display bone-deforming groups as if all locked deform groups "
2931 "were deleted, and the remaining ones were re-normalized");
2932 RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data");
2933
2934 prop = RNA_def_property(srna, "use_multipaint", PROP_BOOLEAN, PROP_NONE);
2935 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
2936 RNA_def_property_boolean_sdna(prop, NULL, "multipaint", 1);
2937 RNA_def_property_ui_text(prop,
2938 "WPaint Multi-Paint",
2939 "Paint across the weights of all selected bones, "
2940 "maintaining their relative influence");
2941 RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data");
2942
2943 prop = RNA_def_property(srna, "vertex_group_user", PROP_ENUM, PROP_NONE);
2944 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
2945 RNA_def_property_enum_sdna(prop, NULL, "weightuser");
2946 RNA_def_property_enum_items(prop, draw_groupuser_items);
2947 RNA_def_property_ui_text(prop, "Mask Non-Group Vertices", "Display unweighted vertices");
2948 RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data");
2949
2950 prop = RNA_def_property(srna, "vertex_group_subset", PROP_ENUM, PROP_NONE);
2951 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
2952 RNA_def_property_enum_sdna(prop, NULL, "vgroupsubset");
2953 RNA_def_property_enum_items(prop, vertex_group_select_items);
2954 RNA_def_property_ui_text(prop, "Subset", "Filter Vertex groups for Display");
2955 RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data");
2956
2957 prop = RNA_def_property(srna, "vertex_paint", PROP_POINTER, PROP_NONE);
2958 RNA_def_property_pointer_sdna(prop, NULL, "vpaint");
2959 RNA_def_property_ui_text(prop, "Vertex Paint", "");
2960
2961 prop = RNA_def_property(srna, "weight_paint", PROP_POINTER, PROP_NONE);
2962 RNA_def_property_pointer_sdna(prop, NULL, "wpaint");
2963 RNA_def_property_ui_text(prop, "Weight Paint", "");
2964
2965 prop = RNA_def_property(srna, "image_paint", PROP_POINTER, PROP_NONE);
2966 RNA_def_property_pointer_sdna(prop, NULL, "imapaint");
2967 RNA_def_property_ui_text(prop, "Image Paint", "");
2968
2969 prop = RNA_def_property(srna, "uv_sculpt", PROP_POINTER, PROP_NONE);
2970 RNA_def_property_pointer_sdna(prop, NULL, "uvsculpt");
2971 RNA_def_property_ui_text(prop, "UV Sculpt", "");
2972
2973 prop = RNA_def_property(srna, "gpencil_paint", PROP_POINTER, PROP_NONE);
2974 RNA_def_property_pointer_sdna(prop, NULL, "gp_paint");
2975 RNA_def_property_ui_text(prop, "Grease Pencil Paint", "");
2976
2977 prop = RNA_def_property(srna, "gpencil_vertex_paint", PROP_POINTER, PROP_NONE);
2978 RNA_def_property_pointer_sdna(prop, NULL, "gp_vertexpaint");
2979 RNA_def_property_ui_text(prop, "Grease Pencil Vertex Paint", "");
2980
2981 prop = RNA_def_property(srna, "gpencil_sculpt_paint", PROP_POINTER, PROP_NONE);
2982 RNA_def_property_pointer_sdna(prop, NULL, "gp_sculptpaint");
2983 RNA_def_property_ui_text(prop, "Grease Pencil Sculpt Paint", "");
2984
2985 prop = RNA_def_property(srna, "gpencil_weight_paint", PROP_POINTER, PROP_NONE);
2986 RNA_def_property_pointer_sdna(prop, NULL, "gp_weightpaint");
2987 RNA_def_property_ui_text(prop, "Grease Pencil Weight Paint", "");
2988
2989 prop = RNA_def_property(srna, "particle_edit", PROP_POINTER, PROP_NONE);
2990 RNA_def_property_pointer_sdna(prop, NULL, "particle");
2991 RNA_def_property_ui_text(prop, "Particle Edit", "");
2992
2993 prop = RNA_def_property(srna, "uv_sculpt_lock_borders", PROP_BOOLEAN, PROP_NONE);
2994 RNA_def_property_boolean_sdna(prop, NULL, "uv_sculpt_settings", UV_SCULPT_LOCK_BORDERS);
2995 RNA_def_property_ui_text(prop, "Lock Borders", "Disable editing of boundary edges");
2996
2997 prop = RNA_def_property(srna, "uv_sculpt_all_islands", PROP_BOOLEAN, PROP_NONE);
2998 RNA_def_property_boolean_sdna(prop, NULL, "uv_sculpt_settings", UV_SCULPT_ALL_ISLANDS);
2999 RNA_def_property_ui_text(prop, "Sculpt All Islands", "Brush operates on all islands");
3000
3001 prop = RNA_def_property(srna, "uv_relax_method", PROP_ENUM, PROP_NONE);
3002 RNA_def_property_enum_sdna(prop, NULL, "uv_relax_method");
3003 RNA_def_property_enum_items(prop, uv_sculpt_relaxation_items);
3004 RNA_def_property_ui_text(prop, "Relaxation Method", "Algorithm used for UV relaxation");
3005
3006 prop = RNA_def_property(srna, "lock_object_mode", PROP_BOOLEAN, PROP_NONE);
3007 RNA_def_property_boolean_sdna(prop, NULL, "object_flag", SCE_OBJECT_MODE_LOCK);
3008 RNA_def_property_ui_text(prop, "Lock Object Modes", "Restrict select to the current mode");
3009 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
3010
3011 static const EnumPropertyItem workspace_tool_items[] = {
3012 {SCE_WORKSPACE_TOOL_DEFAULT, "DEFAULT", 0, "Active Tool", ""},
3013 {SCE_WORKSPACE_TOOL_FALLBACK, "FALLBACK", 0, "Select", ""},
3014 {0, NULL, 0, NULL, NULL},
3015 };
3016
3017 prop = RNA_def_property(srna, "workspace_tool_type", PROP_ENUM, PROP_NONE);
3018 RNA_def_property_enum_sdna(prop, NULL, "workspace_tool_type");
3019 RNA_def_property_enum_items(prop, workspace_tool_items);
3020 RNA_def_property_ui_text(prop, "Drag", "Action when dragging in the viewport");
3021
3022 /* Transform */
3023 prop = RNA_def_property(srna, "use_proportional_edit", PROP_BOOLEAN, PROP_NONE);
3024 RNA_def_property_boolean_sdna(prop, NULL, "proportional_edit", PROP_EDIT_USE);
3025 RNA_def_property_ui_text(prop, "Proportional Editing", "Proportional edit mode");
3026 RNA_def_property_ui_icon(prop, ICON_PROP_ON, 0);
3027 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3028
3029 prop = RNA_def_property(srna, "use_proportional_edit_objects", PROP_BOOLEAN, PROP_NONE);
3030 RNA_def_property_boolean_sdna(prop, NULL, "proportional_objects", 0);
3031 RNA_def_property_ui_text(
3032 prop, "Proportional Editing Objects", "Proportional editing object mode");
3033 RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1);
3034 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3035
3036 prop = RNA_def_property(srna, "use_proportional_projected", PROP_BOOLEAN, PROP_NONE);
3037 RNA_def_property_boolean_sdna(prop, NULL, "proportional_edit", PROP_EDIT_PROJECTED);
3038 RNA_def_property_ui_text(
3039 prop, "Projected from View", "Proportional Editing using screen space locations");
3040 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3041
3042 prop = RNA_def_property(srna, "use_proportional_connected", PROP_BOOLEAN, PROP_NONE);
3043 RNA_def_property_boolean_sdna(prop, NULL, "proportional_edit", PROP_EDIT_CONNECTED);
3044 RNA_def_property_ui_text(
3045 prop, "Connected Only", "Proportional Editing using connected geometry only");
3046 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3047
3048 prop = RNA_def_property(srna, "use_proportional_edit_mask", PROP_BOOLEAN, PROP_NONE);
3049 RNA_def_property_boolean_sdna(prop, NULL, "proportional_mask", 0);
3050 RNA_def_property_ui_text(prop, "Proportional Editing Objects", "Proportional editing mask mode");
3051 RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1);
3052 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3053
3054 prop = RNA_def_property(srna, "use_proportional_action", PROP_BOOLEAN, PROP_NONE);
3055 RNA_def_property_boolean_sdna(prop, NULL, "proportional_action", 0);
3056 RNA_def_property_ui_text(
3057 prop, "Proportional Editing Actions", "Proportional editing in action editor");
3058 RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1);
3059 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3060
3061 prop = RNA_def_property(srna, "use_proportional_fcurve", PROP_BOOLEAN, PROP_NONE);
3062 RNA_def_property_boolean_sdna(prop, NULL, "proportional_fcurve", 0);
3063 RNA_def_property_ui_text(
3064 prop, "Proportional Editing FCurves", "Proportional editing in FCurve editor");
3065 RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1);
3066 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3067
3068 prop = RNA_def_property(srna, "lock_markers", PROP_BOOLEAN, PROP_NONE);
3069 RNA_def_property_boolean_sdna(prop, NULL, "lock_markers", 0);
3070 RNA_def_property_ui_text(prop, "Lock Markers", "Prevent marker editing");
3071
3072 prop = RNA_def_property(srna, "proportional_edit_falloff", PROP_ENUM, PROP_NONE);
3073 RNA_def_property_enum_sdna(prop, NULL, "prop_mode");
3074 RNA_def_property_enum_items(prop, rna_enum_proportional_falloff_items);
3075 RNA_def_property_ui_text(
3076 prop, "Proportional Editing Falloff", "Falloff type for proportional editing mode");
3077 /* Abusing id_curve :/ */
3078 RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE);
3079 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3080
3081 prop = RNA_def_property(srna, "proportional_size", PROP_FLOAT, PROP_DISTANCE);
3082 RNA_def_property_float_sdna(prop, NULL, "proportional_size");
3083 RNA_def_property_ui_text(
3084 prop, "Proportional Size", "Display size for proportional editing circle");
3085 RNA_def_property_range(prop, 0.00001, 5000.0);
3086
3087 prop = RNA_def_property(srna, "double_threshold", PROP_FLOAT, PROP_DISTANCE);
3088 RNA_def_property_float_sdna(prop, NULL, "doublimit");
3089 RNA_def_property_ui_text(prop, "Merge Threshold", "Threshold distance for Auto Merge");
3090 RNA_def_property_range(prop, 0.0, 1.0);
3091 RNA_def_property_ui_range(prop, 0.0, 0.1, 0.01, 6);
3092
3093 /* Pivot Point */
3094 prop = RNA_def_property(srna, "transform_pivot_point", PROP_ENUM, PROP_NONE);
3095 RNA_def_property_enum_sdna(prop, NULL, "transform_pivot_point");
3096 RNA_def_property_enum_items(prop, rna_enum_transform_pivot_items_full);
3097 RNA_def_property_ui_text(prop, "Transform Pivot Point", "Pivot center for rotation/scaling");
3098 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
3099
3100 prop = RNA_def_property(srna, "use_transform_pivot_point_align", PROP_BOOLEAN, PROP_NONE);
3101 RNA_def_property_boolean_sdna(prop, NULL, "transform_flag", SCE_XFORM_AXIS_ALIGN);
3102 RNA_def_property_ui_text(
3103 prop,
3104 "Only Locations",
3105 "Only transform object locations, without affecting rotation or scaling");
3106 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
3107
3108 prop = RNA_def_property(srna, "use_transform_data_origin", PROP_BOOLEAN, PROP_NONE);
3109 RNA_def_property_boolean_sdna(prop, NULL, "transform_flag", SCE_XFORM_DATA_ORIGIN);
3110 RNA_def_property_ui_text(
3111 prop, "Transform Origins", "Transform object origins, while leaving the shape in place");
3112 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
3113
3114 prop = RNA_def_property(srna, "use_transform_skip_children", PROP_BOOLEAN, PROP_NONE);
3115 RNA_def_property_boolean_sdna(prop, NULL, "transform_flag", SCE_XFORM_SKIP_CHILDREN);
3116 RNA_def_property_ui_text(
3117 prop, "Transform Parents", "Transform the parents, leaving the children in place");
3118 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
3119
3120 prop = RNA_def_property(srna, "use_transform_correct_face_attributes", PROP_BOOLEAN, PROP_NONE);
3121 RNA_def_property_boolean_sdna(prop, NULL, "uvcalc_flag", UVCALC_TRANSFORM_CORRECT);
3122 RNA_def_property_ui_text(prop,
3123 "Correct Face Attributes",
3124 "Correct data such as UV's and vertex colors when transforming");
3125 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
3126
3127 prop = RNA_def_property(srna, "use_transform_correct_keep_connected", PROP_BOOLEAN, PROP_NONE);
3128 RNA_def_property_boolean_sdna(
3129 prop, NULL, "uvcalc_flag", UVCALC_TRANSFORM_CORRECT_KEEP_CONNECTED);
3130 RNA_def_property_ui_text(
3131 prop,
3132 "Keep Connected",
3133 "During the Face Attributes correction, merge attributes connected to the same vertex");
3134 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
3135
3136 prop = RNA_def_property(srna, "use_mesh_automerge", PROP_BOOLEAN, PROP_NONE);
3137 RNA_def_property_boolean_sdna(prop, NULL, "automerge", AUTO_MERGE);
3138 RNA_def_property_ui_text(
3139 prop, "Auto Merge Vertices", "Automatically merge vertices moved to the same location");
3140 RNA_def_property_ui_icon(prop, ICON_AUTOMERGE_OFF, 1);
3141 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3142
3143 prop = RNA_def_property(srna, "use_mesh_automerge_and_split", PROP_BOOLEAN, PROP_NONE);
3144 RNA_def_property_boolean_sdna(prop, NULL, "automerge", AUTO_MERGE_AND_SPLIT);
3145 RNA_def_property_ui_text(prop, "Split Edges & Faces", "Automatically split edges and faces");
3146 RNA_def_property_ui_icon(prop, ICON_AUTOMERGE_OFF, 1);
3147 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3148
3149 prop = RNA_def_property(srna, "use_snap", PROP_BOOLEAN, PROP_NONE);
3150 RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP);
3151 RNA_def_property_ui_text(prop, "Snap", "Snap during transform");
3152 RNA_def_property_ui_icon(prop, ICON_SNAP_OFF, 1);
3153 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3154
3155 prop = RNA_def_property(srna, "use_snap_align_rotation", PROP_BOOLEAN, PROP_NONE);
3156 RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_ROTATE);
3157 RNA_def_property_ui_text(
3158 prop, "Align Rotation to Target", "Align rotation with the snapping target");
3159 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3160
3161 prop = RNA_def_property(srna, "use_snap_grid_absolute", PROP_BOOLEAN, PROP_NONE);
3162 RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_ABS_GRID);
3163 RNA_def_property_ui_text(
3164 prop,
3165 "Absolute Grid Snap",
3166 "Absolute grid alignment while translating (based on the pivot center)");
3167 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3168
3169 prop = RNA_def_property(srna, "snap_elements", PROP_ENUM, PROP_NONE);
3170 RNA_def_property_enum_bitflag_sdna(prop, NULL, "snap_mode");
3171 RNA_def_property_enum_items(prop, rna_enum_snap_element_items);
3172 RNA_def_property_enum_funcs(prop, NULL, "rna_ToolSettings_snap_mode_set", NULL);
3173 RNA_def_property_flag(prop, PROP_ENUM_FLAG);
3174 RNA_def_property_ui_text(prop, "Snap Element", "Type of element to snap to");
3175 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3176
3177 /* node editor uses own set of snap modes */
3178 prop = RNA_def_property(srna, "snap_node_element", PROP_ENUM, PROP_NONE);
3179 RNA_def_property_enum_bitflag_sdna(prop, NULL, "snap_node_mode");
3180 RNA_def_property_enum_items(prop, rna_enum_snap_node_element_items);
3181 RNA_def_property_ui_text(prop, "Snap Node Element", "Type of element to snap to");
3182 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3183
3184 /* image editor uses own set of snap modes */
3185 prop = RNA_def_property(srna, "snap_uv_element", PROP_ENUM, PROP_NONE);
3186 RNA_def_property_enum_bitflag_sdna(prop, NULL, "snap_uv_mode");
3187 RNA_def_property_enum_items(prop, snap_uv_element_items);
3188 RNA_def_property_ui_text(prop, "Snap UV Element", "Type of element to snap to");
3189 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3190
3191 prop = RNA_def_property(srna, "snap_target", PROP_ENUM, PROP_NONE);
3192 RNA_def_property_enum_sdna(prop, NULL, "snap_target");
3193 RNA_def_property_enum_items(prop, rna_enum_snap_target_items);
3194 RNA_def_property_ui_text(prop, "Snap Target", "Which part to snap onto the target");
3195 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3196
3197 prop = RNA_def_property(srna, "use_snap_peel_object", PROP_BOOLEAN, PROP_NONE);
3198 RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_PEEL_OBJECT);
3199 RNA_def_property_ui_text(
3200 prop, "Snap Peel Object", "Consider objects as whole when finding volume center");
3201 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3202
3203 prop = RNA_def_property(srna, "use_snap_project", PROP_BOOLEAN, PROP_NONE);
3204 RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_PROJECT);
3205 RNA_def_property_ui_text(prop,
3206 "Project Individual Elements",
3207 "Project individual elements on the surface of other objects");
3208 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3209
3210 prop = RNA_def_property(srna, "use_snap_backface_culling", PROP_BOOLEAN, PROP_NONE);
3211 RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_BACKFACE_CULLING);
3212 RNA_def_property_ui_text(prop, "Backface Culling", "Exclude back facing geometry from snapping");
3213 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3214
3215 prop = RNA_def_property(srna, "use_snap_self", PROP_BOOLEAN, PROP_NONE);
3216 RNA_def_property_boolean_negative_sdna(prop, NULL, "snap_flag", SCE_SNAP_NO_SELF);
3217 RNA_def_property_ui_text(prop, "Project onto Self", "Snap onto itself (Edit Mode Only)");
3218 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3219
3220 prop = RNA_def_property(srna, "use_snap_translate", PROP_BOOLEAN, PROP_NONE);
3221 RNA_def_property_boolean_sdna(
3222 prop, NULL, "snap_transform_mode_flag", SCE_SNAP_TRANSFORM_MODE_TRANSLATE);
3223 RNA_def_property_ui_text(
3224 prop, "Use Snap for Translation", "Move is affected by snapping settings");
3225 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3226
3227 prop = RNA_def_property(srna, "use_snap_rotate", PROP_BOOLEAN, PROP_NONE);
3228 RNA_def_property_boolean_sdna(
3229 prop, NULL, "snap_transform_mode_flag", SCE_SNAP_TRANSFORM_MODE_ROTATE);
3230 RNA_def_property_boolean_default(prop, false);
3231 RNA_def_property_ui_text(
3232 prop, "Use Snap for Rotation", "Rotate is affected by the snapping settings");
3233 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3234
3235 prop = RNA_def_property(srna, "use_snap_scale", PROP_BOOLEAN, PROP_NONE);
3236 RNA_def_property_boolean_sdna(
3237 prop, NULL, "snap_transform_mode_flag", SCE_SNAP_TRANSFORM_MODE_SCALE);
3238 RNA_def_property_boolean_default(prop, false);
3239 RNA_def_property_ui_text(prop, "Use Snap for Scale", "Scale is affected by snapping settings");
3240 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3241
3242 /* Grease Pencil */
3243 prop = RNA_def_property(srna, "use_gpencil_draw_additive", PROP_BOOLEAN, PROP_NONE);
3244 RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_RETAIN_LAST);
3245 RNA_def_property_ui_text(prop,
3246 "Use Additive Drawing",
3247 "When creating new frames, the strokes from the previous/active frame "
3248 "are included as the basis for the new one");
3249 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
3250
3251 prop = RNA_def_property(srna, "use_gpencil_draw_onback", PROP_BOOLEAN, PROP_NONE);
3252 RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_PAINT_ONBACK);
3253 RNA_def_property_ui_text(
3254 prop,
3255 "Draw Strokes on Back",
3256 "When draw new strokes, the new stroke is drawn below of all strokes in the layer");
3257 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
3258
3259 prop = RNA_def_property(srna, "use_gpencil_thumbnail_list", PROP_BOOLEAN, PROP_NONE);
3260 RNA_def_property_boolean_negative_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_THUMBNAIL_LIST);
3261 RNA_def_property_ui_text(
3262 prop, "Compact List", "Show compact list of color instead of thumbnails");
3263 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
3264
3265 prop = RNA_def_property(srna, "use_gpencil_weight_data_add", PROP_BOOLEAN, PROP_NONE);
3266 RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_CREATE_WEIGHTS);
3267 RNA_def_property_ui_text(prop,
3268 "Add weight data for new strokes",
3269 "When creating new strokes, the weight data is added according to the "
3270 "current vertex group and weight, "
3271 "if no vertex group selected, weight is not added");
3272 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
3273
3274 prop = RNA_def_property(srna, "gpencil_sculpt", PROP_POINTER, PROP_NONE);
3275 RNA_def_property_pointer_sdna(prop, NULL, "gp_sculpt");
3276 RNA_def_property_struct_type(prop, "GPencilSculptSettings");
3277 RNA_def_property_ui_text(
3278 prop, "Grease Pencil Sculpt", "Settings for stroke sculpting tools and brushes");
3279
3280 prop = RNA_def_property(srna, "gpencil_interpolate", PROP_POINTER, PROP_NONE);
3281 RNA_def_property_pointer_sdna(prop, NULL, "gp_interpolate");
3282 RNA_def_property_struct_type(prop, "GPencilInterpolateSettings");
3283 RNA_def_property_ui_text(
3284 prop, "Grease Pencil Interpolate", "Settings for Grease Pencil Interpolation tools");
3285
3286 /* Grease Pencil - 3D View Stroke Placement */
3287 prop = RNA_def_property(srna, "gpencil_stroke_placement_view3d", PROP_ENUM, PROP_NONE);
3288 RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_v3d_align");
3289 RNA_def_property_enum_items(prop, gpencil_stroke_placement_items);
3290 RNA_def_property_ui_text(prop, "Stroke Placement (3D View)", "");
3291 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
3292
3293 prop = RNA_def_property(srna, "gpencil_stroke_snap_mode", PROP_ENUM, PROP_NONE);
3294 RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_v3d_align");
3295 RNA_def_property_enum_items(prop, gpencil_stroke_snap_items);
3296 RNA_def_property_ui_text(prop, "Stroke Snap", "");
3297 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
3298
3299 prop = RNA_def_property(srna, "use_gpencil_stroke_endpoints", PROP_BOOLEAN, PROP_NONE);
3300 RNA_def_property_boolean_sdna(
3301 prop, NULL, "gpencil_v3d_align", GP_PROJECT_DEPTH_STROKE_ENDPOINTS);
3302 RNA_def_property_ui_text(
3303 prop, "Only Endpoints", "Only use the first and last parts of the stroke for snapping");
3304 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
3305
3306 /* Grease Pencil - Select mode Edit */
3307 prop = RNA_def_property(srna, "gpencil_selectmode_edit", PROP_ENUM, PROP_NONE);
3308 RNA_def_property_enum_sdna(prop, NULL, "gpencil_selectmode_edit");
3309 RNA_def_property_enum_items(prop, gpencil_selectmode_items);
3310 RNA_def_property_ui_text(prop, "Select Mode", "");
3311 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3312 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3313 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_Gpencil_selectmode_update");
3314
3315 /* Grease Pencil - Select mode Sculpt */
3316 prop = RNA_def_property(srna, "use_gpencil_select_mask_point", PROP_BOOLEAN, PROP_NONE);
3317 RNA_def_property_boolean_sdna(
3318 prop, NULL, "gpencil_selectmode_sculpt", GP_SCULPT_MASK_SELECTMODE_POINT);
3319 RNA_def_property_ui_text(prop, "Selection Mask", "Only sculpt selected stroke points");
3320 RNA_def_property_ui_icon(prop, ICON_GP_SELECT_POINTS, 0);
3321 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3322 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3323 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_Gpencil_mask_point_update");
3324
3325 prop = RNA_def_property(srna, "use_gpencil_select_mask_stroke", PROP_BOOLEAN, PROP_NONE);
3326 RNA_def_property_boolean_sdna(
3327 prop, NULL, "gpencil_selectmode_sculpt", GP_SCULPT_MASK_SELECTMODE_STROKE);
3328 RNA_def_property_ui_text(prop, "Selection Mask", "Only sculpt selected stroke");
3329 RNA_def_property_ui_icon(prop, ICON_GP_SELECT_STROKES, 0);
3330 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3331 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3332 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_Gpencil_mask_stroke_update");
3333
3334 prop = RNA_def_property(srna, "use_gpencil_select_mask_segment", PROP_BOOLEAN, PROP_NONE);
3335 RNA_def_property_boolean_sdna(
3336 prop, NULL, "gpencil_selectmode_sculpt", GP_SCULPT_MASK_SELECTMODE_SEGMENT);
3337 RNA_def_property_ui_text(
3338 prop, "Selection Mask", "Only sculpt selected stroke points between other strokes");
3339 RNA_def_property_ui_icon(prop, ICON_GP_SELECT_BETWEEN_STROKES, 0);
3340 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3341 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3342 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_Gpencil_mask_segment_update");
3343
3344 /* Grease Pencil - Select mode Vertex Paint */
3345 prop = RNA_def_property(srna, "use_gpencil_vertex_select_mask_point", PROP_BOOLEAN, PROP_NONE);
3346 RNA_def_property_boolean_sdna(
3347 prop, NULL, "gpencil_selectmode_vertex", GP_VERTEX_MASK_SELECTMODE_POINT);
3348 RNA_def_property_ui_text(prop, "Selection Mask", "Only paint selected stroke points");
3349 RNA_def_property_ui_icon(prop, ICON_GP_SELECT_POINTS, 0);
3350 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3351 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3352 RNA_def_property_update(
3353 prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_Gpencil_vertex_mask_point_update");
3354
3355 prop = RNA_def_property(srna, "use_gpencil_vertex_select_mask_stroke", PROP_BOOLEAN, PROP_NONE);
3356 RNA_def_property_boolean_sdna(
3357 prop, NULL, "gpencil_selectmode_vertex", GP_VERTEX_MASK_SELECTMODE_STROKE);
3358 RNA_def_property_ui_text(prop, "Selection Mask", "Only paint selected stroke");
3359 RNA_def_property_ui_icon(prop, ICON_GP_SELECT_STROKES, 0);
3360 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3361 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3362 RNA_def_property_update(
3363 prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_Gpencil_vertex_mask_stroke_update");
3364
3365 prop = RNA_def_property(srna, "use_gpencil_vertex_select_mask_segment", PROP_BOOLEAN, PROP_NONE);
3366 RNA_def_property_boolean_sdna(
3367 prop, NULL, "gpencil_selectmode_vertex", GP_VERTEX_MASK_SELECTMODE_SEGMENT);
3368 RNA_def_property_ui_text(
3369 prop, "Selection Mask", "Only paint selected stroke points between other strokes");
3370 RNA_def_property_ui_icon(prop, ICON_GP_SELECT_BETWEEN_STROKES, 0);
3371 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3372 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3373 RNA_def_property_update(
3374 prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_Gpencil_vertex_mask_segment_update");
3375
3376 /* Annotations - 2D Views Stroke Placement */
3377 prop = RNA_def_property(srna, "annotation_stroke_placement_view2d", PROP_ENUM, PROP_NONE);
3378 RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_v2d_align");
3379 RNA_def_property_enum_items(prop, annotation_stroke_placement_items);
3380 RNA_def_property_ui_text(prop, "Stroke Placement (2D View)", "");
3381 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
3382
3383 /* Annotations - Sequencer Preview Stroke Placement */
3384 prop = RNA_def_property(
3385 srna, "annotation_stroke_placement_sequencer_preview", PROP_ENUM, PROP_NONE);
3386 RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_seq_align");
3387 RNA_def_property_enum_items(prop, annotation_stroke_placement_items);
3388 RNA_def_property_ui_text(prop, "Stroke Placement (Sequencer Preview)", "");
3389 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
3390
3391 /* Annotations - Image Editor Stroke Placement */
3392 prop = RNA_def_property(srna, "annotation_stroke_placement_image_editor", PROP_ENUM, PROP_NONE);
3393 RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_ima_align");
3394 RNA_def_property_enum_items(prop, annotation_stroke_placement_items);
3395 RNA_def_property_ui_text(prop, "Stroke Placement (Image Editor)", "");
3396 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
3397
3398 /* Annotations - 3D View Stroke Placement */
3399 /* XXX: Do we need to decouple the stroke_endpoints setting too? */
3400 prop = RNA_def_property(srna, "annotation_stroke_placement_view3d", PROP_ENUM, PROP_NONE);
3401 RNA_def_property_enum_bitflag_sdna(prop, NULL, "annotate_v3d_align");
3402 RNA_def_property_enum_items(prop, annotation_stroke_placement_items);
3403 RNA_def_property_enum_default(prop, GP_PROJECT_VIEWSPACE | GP_PROJECT_CURSOR);
3404 RNA_def_property_ui_text(prop,
3405 "Annotation Stroke Placement (3D View)",
3406 "How annotation strokes are orientated in 3D space");
3407 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
3408
3409 /* Annotations - Stroke Thickness */
3410 prop = RNA_def_property(srna, "annotation_thickness", PROP_INT, PROP_PIXEL);
3411 RNA_def_property_int_sdna(prop, NULL, "annotate_thickness");
3412 RNA_def_property_range(prop, 1, 10);
3413 RNA_def_property_ui_text(prop, "Annotation Stroke Thickness", "Thickness of annotation strokes");
3414 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
3415
3416 /* Auto Keying */
3417 prop = RNA_def_property(srna, "use_keyframe_insert_auto", PROP_BOOLEAN, PROP_NONE);
3418 RNA_def_property_boolean_sdna(prop, NULL, "autokey_mode", AUTOKEY_ON);
3419 RNA_def_property_ui_text(
3420 prop, "Auto Keying", "Automatic keyframe insertion for Objects, Bones and Masks");
3421 RNA_def_property_ui_icon(prop, ICON_REC, 0);
3422
3423 prop = RNA_def_property(srna, "auto_keying_mode", PROP_ENUM, PROP_NONE);
3424 RNA_def_property_enum_bitflag_sdna(prop, NULL, "autokey_mode");
3425 RNA_def_property_enum_items(prop, auto_key_items);
3426 RNA_def_property_ui_text(prop,
3427 "Auto-Keying Mode",
3428 "Mode of automatic keyframe insertion for Objects, Bones and Masks");
3429
3430 prop = RNA_def_property(srna, "use_record_with_nla", PROP_BOOLEAN, PROP_NONE);
3431 RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", ANIMRECORD_FLAG_WITHNLA);
3432 RNA_def_property_ui_text(
3433 prop,
3434 "Layered",
3435 "Add a new NLA Track + Strip for every loop/pass made over the animation "
3436 "to allow non-destructive tweaking");
3437
3438 prop = RNA_def_property(srna, "use_keyframe_insert_keyingset", PROP_BOOLEAN, PROP_NONE);
3439 RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_ONLYKEYINGSET);
3440 RNA_def_property_ui_text(prop,
3441 "Auto Keyframe Insert Keying Set",
3442 "Automatic keyframe insertion using active Keying Set only");
3443 RNA_def_property_ui_icon(prop, ICON_KEYINGSET, 0);
3444
3445 prop = RNA_def_property(srna, "use_keyframe_cycle_aware", PROP_BOOLEAN, PROP_NONE);
3446 RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_CYCLEAWARE);
3447 RNA_def_property_ui_text(
3448 prop,
3449 "Cycle-Aware Keying",
3450 "For channels with cyclic extrapolation, keyframe insertion is automatically "
3451 "remapped inside the cycle time range, and keeps ends in sync");
3452
3453 /* Keyframing */
3454 prop = RNA_def_property(srna, "keyframe_type", PROP_ENUM, PROP_NONE);
3455 RNA_def_property_enum_sdna(prop, NULL, "keyframe_type");
3456 RNA_def_property_enum_items(prop, rna_enum_beztriple_keyframe_type_items);
3457 RNA_def_property_ui_text(
3458 prop, "New Keyframe Type", "Type of keyframes to create when inserting keyframes");
3459
3460 /* UV */
3461 prop = RNA_def_property(srna, "uv_select_mode", PROP_ENUM, PROP_NONE);
3462 RNA_def_property_enum_sdna(prop, NULL, "uv_selectmode");
3463 RNA_def_property_enum_items(prop, rna_enum_mesh_select_mode_uv_items);
3464 RNA_def_property_ui_text(prop, "UV Selection Mode", "UV selection and display mode");
3465 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
3466
3467 prop = RNA_def_property(srna, "use_uv_select_sync", PROP_BOOLEAN, PROP_NONE);
3468 RNA_def_property_boolean_sdna(prop, NULL, "uv_flag", UV_SYNC_SELECTION);
3469 RNA_def_property_ui_text(
3470 prop, "UV Sync Selection", "Keep UV and edit mode mesh selection in sync");
3471 RNA_def_property_ui_icon(prop, ICON_UV_SYNC_SELECT, 0);
3472 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
3473
3474 prop = RNA_def_property(srna, "show_uv_local_view", PROP_BOOLEAN, PROP_NONE);
3475 RNA_def_property_boolean_sdna(prop, NULL, "uv_flag", UV_SHOW_SAME_IMAGE);
3476 RNA_def_property_ui_text(
3477 prop, "UV Local View", "Display only faces with the currently displayed image assigned");
3478 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
3479
3480 /* Mesh */
3481 prop = RNA_def_property(srna, "mesh_select_mode", PROP_BOOLEAN, PROP_NONE);
3482 RNA_def_property_boolean_sdna(prop, NULL, "selectmode", 1);
3483 RNA_def_property_array(prop, 3);
3484 RNA_def_property_boolean_funcs(prop, NULL, "rna_Scene_editmesh_select_mode_set");
3485 RNA_def_property_ui_text(prop, "Mesh Selection Mode", "Which mesh elements selection works on");
3486 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3487 RNA_def_property_update(prop, 0, "rna_Scene_editmesh_select_mode_update");
3488
3489 prop = RNA_def_property(srna, "vertex_group_weight", PROP_FLOAT, PROP_FACTOR);
3490 RNA_def_property_float_sdna(prop, NULL, "vgroup_weight");
3491 RNA_def_property_ui_text(prop, "Vertex Group Weight", "Weight to assign in vertex groups");
3492
3493 prop = RNA_def_property(srna, "use_edge_path_live_unwrap", PROP_BOOLEAN, PROP_NONE);
3494 RNA_def_property_boolean_sdna(prop, NULL, "edge_mode_live_unwrap", 1);
3495 RNA_def_property_ui_text(prop, "Live Unwrap", "Changing edge seams recalculates UV unwrap");
3496
3497 prop = RNA_def_property(srna, "normal_vector", PROP_FLOAT, PROP_XYZ);
3498 RNA_def_property_ui_text(prop, "Normal Vector", "Normal Vector used to copy, add or multiply");
3499 RNA_def_property_ui_range(prop, -10000.0, 10000.0, 1, 3);
3500
3501 /* Unified Paint Settings */
3502 prop = RNA_def_property(srna, "unified_paint_settings", PROP_POINTER, PROP_NONE);
3503 RNA_def_property_flag(prop, PROP_NEVER_NULL);
3504 RNA_def_property_struct_type(prop, "UnifiedPaintSettings");
3505 RNA_def_property_ui_text(prop, "Unified Paint Settings", NULL);
3506
3507 /* Curve Paint Settings */
3508 prop = RNA_def_property(srna, "curve_paint_settings", PROP_POINTER, PROP_NONE);
3509 RNA_def_property_flag(prop, PROP_NEVER_NULL);
3510 RNA_def_property_struct_type(prop, "CurvePaintSettings");
3511 RNA_def_property_ui_text(prop, "Curve Paint Settings", NULL);
3512
3513 /* Mesh Statistics */
3514 prop = RNA_def_property(srna, "statvis", PROP_POINTER, PROP_NONE);
3515 RNA_def_property_flag(prop, PROP_NEVER_NULL);
3516 RNA_def_property_struct_type(prop, "MeshStatVis");
3517 RNA_def_property_ui_text(prop, "Mesh Statistics Visualization", NULL);
3518
3519 /* CurveProfile */
3520 prop = RNA_def_property(srna, "custom_bevel_profile_preset", PROP_POINTER, PROP_NONE);
3521 RNA_def_property_pointer_sdna(prop, NULL, "custom_bevel_profile_preset");
3522 RNA_def_property_struct_type(prop, "CurveProfile");
3523 RNA_def_property_ui_text(prop, "Curve Profile Widget", "Used for defining a profile's path");
3524 }
3525
rna_def_unified_paint_settings(BlenderRNA * brna)3526 static void rna_def_unified_paint_settings(BlenderRNA *brna)
3527 {
3528 StructRNA *srna;
3529 PropertyRNA *prop;
3530
3531 static const EnumPropertyItem brush_size_unit_items[] = {
3532 {0, "VIEW", 0, "View", "Measure brush size relative to the view"},
3533 {UNIFIED_PAINT_BRUSH_LOCK_SIZE,
3534 "SCENE",
3535 0,
3536 "Scene",
3537 "Measure brush size relative to the scene"},
3538 {0, NULL, 0, NULL, NULL},
3539 };
3540
3541 srna = RNA_def_struct(brna, "UnifiedPaintSettings", NULL);
3542 RNA_def_struct_path_func(srna, "rna_UnifiedPaintSettings_path");
3543 RNA_def_struct_ui_text(
3544 srna, "Unified Paint Settings", "Overrides for some of the active brush's settings");
3545
3546 /* high-level flags to enable or disable unified paint settings */
3547 prop = RNA_def_property(srna, "use_unified_size", PROP_BOOLEAN, PROP_NONE);
3548 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_SIZE);
3549 RNA_def_property_ui_text(prop,
3550 "Use Unified Radius",
3551 "Instead of per-brush radius, the radius is shared across brushes");
3552
3553 prop = RNA_def_property(srna, "use_unified_strength", PROP_BOOLEAN, PROP_NONE);
3554 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_ALPHA);
3555 RNA_def_property_ui_text(prop,
3556 "Use Unified Strength",
3557 "Instead of per-brush strength, the strength is shared across brushes");
3558
3559 prop = RNA_def_property(srna, "use_unified_weight", PROP_BOOLEAN, PROP_NONE);
3560 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_WEIGHT);
3561 RNA_def_property_ui_text(prop,
3562 "Use Unified Weight",
3563 "Instead of per-brush weight, the weight is shared across brushes");
3564
3565 prop = RNA_def_property(srna, "use_unified_color", PROP_BOOLEAN, PROP_NONE);
3566 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_COLOR);
3567 RNA_def_property_ui_text(
3568 prop, "Use Unified Color", "Instead of per-brush color, the color is shared across brushes");
3569
3570 /* unified paint settings that override the equivalent settings
3571 * from the active brush */
3572 prop = RNA_def_property(srna, "size", PROP_INT, PROP_PIXEL);
3573 RNA_def_property_int_funcs(prop, NULL, "rna_UnifiedPaintSettings_size_set", NULL);
3574 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3575 RNA_def_property_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS * 10);
3576 RNA_def_property_ui_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS, 1, -1);
3577 RNA_def_property_ui_text(prop, "Radius", "Radius of the brush");
3578 RNA_def_property_update(prop, 0, "rna_UnifiedPaintSettings_radius_update");
3579
3580 prop = RNA_def_property(srna, "unprojected_radius", PROP_FLOAT, PROP_DISTANCE);
3581 RNA_def_property_float_funcs(
3582 prop, NULL, "rna_UnifiedPaintSettings_unprojected_radius_set", NULL);
3583 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3584 RNA_def_property_range(prop, 0.001, FLT_MAX);
3585 RNA_def_property_ui_range(prop, 0.001, 1, 1, -1);
3586 RNA_def_property_ui_text(prop, "Unprojected Radius", "Radius of brush in Blender units");
3587 RNA_def_property_update(prop, 0, "rna_UnifiedPaintSettings_radius_update");
3588
3589 prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
3590 RNA_def_property_float_sdna(prop, NULL, "alpha");
3591 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3592 RNA_def_property_float_default(prop, 0.5f);
3593 RNA_def_property_range(prop, 0.0f, 10.0f);
3594 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
3595 RNA_def_property_ui_text(
3596 prop, "Strength", "How powerful the effect of the brush is when applied");
3597 RNA_def_property_update(prop, 0, "rna_UnifiedPaintSettings_update");
3598
3599 prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_FACTOR);
3600 RNA_def_property_float_sdna(prop, NULL, "weight");
3601 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3602 RNA_def_property_float_default(prop, 0.5f);
3603 RNA_def_property_range(prop, 0.0f, 1.0f);
3604 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
3605 RNA_def_property_ui_text(prop, "Weight", "Weight to assign in vertex groups");
3606 RNA_def_property_update(prop, 0, "rna_UnifiedPaintSettings_update");
3607
3608 prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
3609 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3610 RNA_def_property_range(prop, 0.0, 1.0);
3611 RNA_def_property_float_sdna(prop, NULL, "rgb");
3612 RNA_def_property_ui_text(prop, "Color", "");
3613 RNA_def_property_update(prop, 0, "rna_UnifiedPaintSettings_update");
3614
3615 prop = RNA_def_property(srna, "secondary_color", PROP_FLOAT, PROP_COLOR_GAMMA);
3616 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3617 RNA_def_property_range(prop, 0.0, 1.0);
3618 RNA_def_property_float_sdna(prop, NULL, "secondary_rgb");
3619 RNA_def_property_ui_text(prop, "Secondary Color", "");
3620 RNA_def_property_update(prop, 0, "rna_UnifiedPaintSettings_update");
3621
3622 prop = RNA_def_property(srna, "use_locked_size", PROP_ENUM, PROP_NONE); /* as an enum */
3623 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
3624 RNA_def_property_enum_items(prop, brush_size_unit_items);
3625 RNA_def_property_ui_text(
3626 prop, "Radius Unit", "Measure brush size relative to the view or the scene");
3627 }
3628
rna_def_curve_paint_settings(BlenderRNA * brna)3629 static void rna_def_curve_paint_settings(BlenderRNA *brna)
3630 {
3631 StructRNA *srna;
3632 PropertyRNA *prop;
3633
3634 srna = RNA_def_struct(brna, "CurvePaintSettings", NULL);
3635 RNA_def_struct_path_func(srna, "rna_CurvePaintSettings_path");
3636 RNA_def_struct_ui_text(srna, "Curve Paint Settings", "");
3637
3638 static const EnumPropertyItem curve_type_items[] = {
3639 {CU_POLY, "POLY", 0, "Poly", ""},
3640 {CU_BEZIER, "BEZIER", 0, "Bezier", ""},
3641 {0, NULL, 0, NULL, NULL},
3642 };
3643
3644 prop = RNA_def_property(srna, "curve_type", PROP_ENUM, PROP_NONE);
3645 RNA_def_property_enum_sdna(prop, NULL, "curve_type");
3646 RNA_def_property_enum_items(prop, curve_type_items);
3647 RNA_def_property_ui_text(prop, "Type", "Type of curve to use for new strokes");
3648
3649 prop = RNA_def_property(srna, "use_corners_detect", PROP_BOOLEAN, PROP_NONE);
3650 RNA_def_property_boolean_sdna(prop, NULL, "flag", CURVE_PAINT_FLAG_CORNERS_DETECT);
3651 RNA_def_property_ui_text(prop, "Detect Corners", "Detect corners and use non-aligned handles");
3652
3653 prop = RNA_def_property(srna, "use_pressure_radius", PROP_BOOLEAN, PROP_NONE);
3654 RNA_def_property_boolean_sdna(prop, NULL, "flag", CURVE_PAINT_FLAG_PRESSURE_RADIUS);
3655 RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
3656 RNA_def_property_ui_text(prop, "Use Pressure", "Map tablet pressure to curve radius");
3657
3658 prop = RNA_def_property(srna, "use_stroke_endpoints", PROP_BOOLEAN, PROP_NONE);
3659 RNA_def_property_boolean_sdna(prop, NULL, "flag", CURVE_PAINT_FLAG_DEPTH_STROKE_ENDPOINTS);
3660 RNA_def_property_ui_text(prop, "Only First", "Use the start of the stroke for the depth");
3661
3662 prop = RNA_def_property(srna, "use_offset_absolute", PROP_BOOLEAN, PROP_NONE);
3663 RNA_def_property_boolean_sdna(prop, NULL, "flag", CURVE_PAINT_FLAG_DEPTH_STROKE_OFFSET_ABS);
3664 RNA_def_property_ui_text(
3665 prop, "Absolute Offset", "Apply a fixed offset (don't scale by the radius)");
3666
3667 prop = RNA_def_property(srna, "error_threshold", PROP_INT, PROP_PIXEL);
3668 RNA_def_property_range(prop, 1, 100);
3669 RNA_def_property_ui_text(prop, "Tolerance", "Allow deviation for a smoother, less precise line");
3670
3671 prop = RNA_def_property(srna, "fit_method", PROP_ENUM, PROP_PIXEL);
3672 RNA_def_property_enum_sdna(prop, NULL, "fit_method");
3673 RNA_def_property_enum_items(prop, rna_enum_curve_fit_method_items);
3674 RNA_def_property_ui_text(prop, "Method", "Curve fitting method");
3675
3676 prop = RNA_def_property(srna, "corner_angle", PROP_FLOAT, PROP_ANGLE);
3677 RNA_def_property_range(prop, 0, M_PI);
3678 RNA_def_property_ui_text(prop, "Corner Angle", "Angles above this are considered corners");
3679
3680 prop = RNA_def_property(srna, "radius_min", PROP_FLOAT, PROP_NONE);
3681 RNA_def_property_range(prop, 0.0, 100.0);
3682 RNA_def_property_ui_range(prop, 0.0f, 10.0, 10, 2);
3683 RNA_def_property_ui_text(
3684 prop,
3685 "Radius Min",
3686 "Minimum radius when the minimum pressure is applied (also the minimum when tapering)");
3687
3688 prop = RNA_def_property(srna, "radius_max", PROP_FLOAT, PROP_NONE);
3689 RNA_def_property_range(prop, 0.0, 100.0);
3690 RNA_def_property_ui_range(prop, 0.0f, 10.0, 10, 2);
3691 RNA_def_property_ui_text(
3692 prop,
3693 "Radius Max",
3694 "Radius to use when the maximum pressure is applied (or when a tablet isn't used)");
3695
3696 prop = RNA_def_property(srna, "radius_taper_start", PROP_FLOAT, PROP_NONE);
3697 RNA_def_property_range(prop, 0.0, 1.0);
3698 RNA_def_property_ui_range(prop, 0.0f, 1.0, 1, 2);
3699 RNA_def_property_ui_text(
3700 prop, "Radius Min", "Taper factor for the radius of each point along the curve");
3701
3702 prop = RNA_def_property(srna, "radius_taper_end", PROP_FLOAT, PROP_NONE);
3703 RNA_def_property_range(prop, 0.0, 10.0);
3704 RNA_def_property_ui_range(prop, 0.0f, 1.0, 1, 2);
3705 RNA_def_property_ui_text(
3706 prop, "Radius Max", "Taper factor for the radius of each point along the curve");
3707
3708 prop = RNA_def_property(srna, "surface_offset", PROP_FLOAT, PROP_NONE);
3709 RNA_def_property_range(prop, -10.0, 10.0);
3710 RNA_def_property_ui_range(prop, -1.0f, 1.0, 1, 2);
3711 RNA_def_property_ui_text(prop, "Offset", "Offset the stroke from the surface");
3712
3713 static const EnumPropertyItem depth_mode_items[] = {
3714 {CURVE_PAINT_PROJECT_CURSOR, "CURSOR", 0, "Cursor", ""},
3715 {CURVE_PAINT_PROJECT_SURFACE, "SURFACE", 0, "Surface", ""},
3716 {0, NULL, 0, NULL, NULL},
3717 };
3718
3719 prop = RNA_def_property(srna, "depth_mode", PROP_ENUM, PROP_NONE);
3720 RNA_def_property_enum_sdna(prop, NULL, "depth_mode");
3721 RNA_def_property_enum_items(prop, depth_mode_items);
3722 RNA_def_property_ui_text(prop, "Depth", "Method of projecting depth");
3723
3724 static const EnumPropertyItem surface_plane_items[] = {
3725 {CURVE_PAINT_SURFACE_PLANE_NORMAL_VIEW,
3726 "NORMAL_VIEW",
3727 0,
3728 "Normal/View",
3729 "Display perpendicular to the surface"},
3730 {CURVE_PAINT_SURFACE_PLANE_NORMAL_SURFACE,
3731 "NORMAL_SURFACE",
3732 0,
3733 "Normal/Surface",
3734 "Display aligned to the surface"},
3735 {CURVE_PAINT_SURFACE_PLANE_VIEW, "VIEW", 0, "View", "Display aligned to the viewport"},
3736 {0, NULL, 0, NULL, NULL},
3737 };
3738
3739 prop = RNA_def_property(srna, "surface_plane", PROP_ENUM, PROP_NONE);
3740 RNA_def_property_enum_sdna(prop, NULL, "surface_plane");
3741 RNA_def_property_enum_items(prop, surface_plane_items);
3742 RNA_def_property_ui_text(prop, "Plane", "Plane for projected stroke");
3743 }
3744
rna_def_statvis(BlenderRNA * brna)3745 static void rna_def_statvis(BlenderRNA *brna)
3746 {
3747 StructRNA *srna;
3748 PropertyRNA *prop;
3749
3750 static const EnumPropertyItem stat_type[] = {
3751 {SCE_STATVIS_OVERHANG, "OVERHANG", 0, "Overhang", ""},
3752 {SCE_STATVIS_THICKNESS, "THICKNESS", 0, "Thickness", ""},
3753 {SCE_STATVIS_INTERSECT, "INTERSECT", 0, "Intersect", ""},
3754 {SCE_STATVIS_DISTORT, "DISTORT", 0, "Distortion", ""},
3755 {SCE_STATVIS_SHARP, "SHARP", 0, "Sharp", ""},
3756 {0, NULL, 0, NULL, NULL},
3757 };
3758
3759 srna = RNA_def_struct(brna, "MeshStatVis", NULL);
3760 RNA_def_struct_path_func(srna, "rna_MeshStatVis_path");
3761 RNA_def_struct_ui_text(srna, "Mesh Visualize Statistics", "");
3762
3763 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
3764 RNA_def_property_enum_items(prop, stat_type);
3765 RNA_def_property_ui_text(prop, "Type", "Type of data to visualize/check");
3766 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3767 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
3768
3769 /* overhang */
3770 prop = RNA_def_property(srna, "overhang_min", PROP_FLOAT, PROP_ANGLE);
3771 RNA_def_property_float_sdna(prop, NULL, "overhang_min");
3772 RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
3773 RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 10, 3);
3774 RNA_def_property_ui_text(prop, "Overhang Min", "Minimum angle to display");
3775 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3776 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
3777
3778 prop = RNA_def_property(srna, "overhang_max", PROP_FLOAT, PROP_ANGLE);
3779 RNA_def_property_float_sdna(prop, NULL, "overhang_max");
3780 RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
3781 RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 10, 3);
3782 RNA_def_property_ui_text(prop, "Overhang Max", "Maximum angle to display");
3783 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3784 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
3785
3786 prop = RNA_def_property(srna, "overhang_axis", PROP_ENUM, PROP_NONE);
3787 RNA_def_property_enum_sdna(prop, NULL, "overhang_axis");
3788 RNA_def_property_enum_items(prop, rna_enum_object_axis_items);
3789 RNA_def_property_ui_text(prop, "Axis", "");
3790 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3791 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
3792
3793 /* thickness */
3794 prop = RNA_def_property(srna, "thickness_min", PROP_FLOAT, PROP_DISTANCE);
3795 RNA_def_property_float_sdna(prop, NULL, "thickness_min");
3796 RNA_def_property_range(prop, 0.0f, 1000.0);
3797 RNA_def_property_ui_range(prop, 0.0f, 100.0, 0.001, 3);
3798 RNA_def_property_ui_text(prop, "Thickness Min", "Minimum for measuring thickness");
3799 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3800 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
3801
3802 prop = RNA_def_property(srna, "thickness_max", PROP_FLOAT, PROP_DISTANCE);
3803 RNA_def_property_float_sdna(prop, NULL, "thickness_max");
3804 RNA_def_property_range(prop, 0.0f, 1000.0);
3805 RNA_def_property_ui_range(prop, 0.0f, 100.0, 0.001, 3);
3806 RNA_def_property_ui_text(prop, "Thickness Max", "Maximum for measuring thickness");
3807 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3808 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
3809
3810 prop = RNA_def_property(srna, "thickness_samples", PROP_INT, PROP_UNSIGNED);
3811 RNA_def_property_int_sdna(prop, NULL, "thickness_samples");
3812 RNA_def_property_range(prop, 1, 32);
3813 RNA_def_property_ui_text(prop, "Samples", "Number of samples to test per face");
3814 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3815 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
3816
3817 /* distort */
3818 prop = RNA_def_property(srna, "distort_min", PROP_FLOAT, PROP_ANGLE);
3819 RNA_def_property_float_sdna(prop, NULL, "distort_min");
3820 RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
3821 RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 10, 3);
3822 RNA_def_property_ui_text(prop, "Distort Min", "Minimum angle to display");
3823 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3824 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
3825
3826 prop = RNA_def_property(srna, "distort_max", PROP_FLOAT, PROP_ANGLE);
3827 RNA_def_property_float_sdna(prop, NULL, "distort_max");
3828 RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
3829 RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 10, 3);
3830 RNA_def_property_ui_text(prop, "Distort Max", "Maximum angle to display");
3831 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3832 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
3833
3834 /* sharp */
3835 prop = RNA_def_property(srna, "sharp_min", PROP_FLOAT, PROP_ANGLE);
3836 RNA_def_property_float_sdna(prop, NULL, "sharp_min");
3837 RNA_def_property_range(prop, -DEG2RADF(180.0f), DEG2RADF(180.0f));
3838 RNA_def_property_ui_range(prop, -DEG2RADF(180.0f), DEG2RADF(180.0f), 10, 3);
3839 RNA_def_property_ui_text(prop, "Distort Min", "Minimum angle to display");
3840 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3841 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
3842
3843 prop = RNA_def_property(srna, "sharp_max", PROP_FLOAT, PROP_ANGLE);
3844 RNA_def_property_float_sdna(prop, NULL, "sharp_max");
3845 RNA_def_property_range(prop, -DEG2RADF(180.0f), DEG2RADF(180.0f));
3846 RNA_def_property_ui_range(prop, -DEG2RADF(180.0f), DEG2RADF(180.0f), 10, 3);
3847 RNA_def_property_ui_text(prop, "Distort Max", "Maximum angle to display");
3848 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3849 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
3850 }
3851
rna_def_unit_settings(BlenderRNA * brna)3852 static void rna_def_unit_settings(BlenderRNA *brna)
3853 {
3854 StructRNA *srna;
3855 PropertyRNA *prop;
3856
3857 static const EnumPropertyItem unit_systems[] = {
3858 {USER_UNIT_NONE, "NONE", 0, "None", ""},
3859 {USER_UNIT_METRIC, "METRIC", 0, "Metric", ""},
3860 {USER_UNIT_IMPERIAL, "IMPERIAL", 0, "Imperial", ""},
3861 {0, NULL, 0, NULL, NULL},
3862 };
3863
3864 static const EnumPropertyItem rotation_units[] = {
3865 {0, "DEGREES", 0, "Degrees", "Use degrees for measuring angles and rotations"},
3866 {USER_UNIT_ROT_RADIANS, "RADIANS", 0, "Radians", ""},
3867 {0, NULL, 0, NULL, NULL},
3868 };
3869
3870 srna = RNA_def_struct(brna, "UnitSettings", NULL);
3871 RNA_def_struct_ui_text(srna, "Unit Settings", "");
3872 RNA_def_struct_nested(brna, srna, "Scene");
3873 RNA_def_struct_path_func(srna, "rna_UnitSettings_path");
3874
3875 /* Units */
3876 prop = RNA_def_property(srna, "system", PROP_ENUM, PROP_NONE);
3877 RNA_def_property_enum_items(prop, unit_systems);
3878 RNA_def_property_ui_text(
3879 prop, "Unit System", "The unit system to use for user interface controls");
3880 RNA_def_property_update(prop, NC_WINDOW, "rna_UnitSettings_system_update");
3881
3882 prop = RNA_def_property(srna, "system_rotation", PROP_ENUM, PROP_NONE);
3883 RNA_def_property_enum_items(prop, rotation_units);
3884 RNA_def_property_ui_text(
3885 prop, "Rotation Units", "Unit to use for displaying/editing rotation values");
3886 RNA_def_property_update(prop, NC_WINDOW, NULL);
3887
3888 prop = RNA_def_property(srna, "scale_length", PROP_FLOAT, PROP_UNSIGNED);
3889 RNA_def_property_ui_text(
3890 prop,
3891 "Unit Scale",
3892 "Scale to use when converting between blender units and dimensions."
3893 " When working at microscopic or astronomical scale, a small or large unit scale"
3894 " respectively can be used to avoid numerical precision problems");
3895 RNA_def_property_range(prop, 1e-9f, 1e+9f);
3896 RNA_def_property_ui_range(prop, 0.001, 100.0, 0.1, 6);
3897 RNA_def_property_update(prop, NC_WINDOW, NULL);
3898
3899 prop = RNA_def_property(srna, "use_separate", PROP_BOOLEAN, PROP_NONE);
3900 RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_UNIT_OPT_SPLIT);
3901 RNA_def_property_ui_text(prop, "Separate Units", "Display units in pairs (e.g. 1m 0cm)");
3902 RNA_def_property_update(prop, NC_WINDOW, NULL);
3903
3904 prop = RNA_def_property(srna, "length_unit", PROP_ENUM, PROP_NONE);
3905 RNA_def_property_enum_items(prop, DummyRNA_DEFAULT_items);
3906 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_UnitSettings_length_unit_itemf");
3907 RNA_def_property_ui_text(prop, "Length Unit", "Unit that will be used to display length values");
3908 RNA_def_property_update(prop, NC_WINDOW, NULL);
3909
3910 prop = RNA_def_property(srna, "mass_unit", PROP_ENUM, PROP_NONE);
3911 RNA_def_property_enum_items(prop, DummyRNA_DEFAULT_items);
3912 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_UnitSettings_mass_unit_itemf");
3913 RNA_def_property_ui_text(prop, "Mass Unit", "Unit that will be used to display mass values");
3914 RNA_def_property_update(prop, NC_WINDOW, NULL);
3915
3916 prop = RNA_def_property(srna, "time_unit", PROP_ENUM, PROP_NONE);
3917 RNA_def_property_enum_items(prop, DummyRNA_DEFAULT_items);
3918 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_UnitSettings_time_unit_itemf");
3919 RNA_def_property_ui_text(prop, "Time Unit", "Unit that will be used to display time values");
3920 RNA_def_property_update(prop, NC_WINDOW, NULL);
3921
3922 prop = RNA_def_property(srna, "temperature_unit", PROP_ENUM, PROP_NONE);
3923 RNA_def_property_enum_items(prop, DummyRNA_DEFAULT_items);
3924 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_UnitSettings_temperature_unit_itemf");
3925 RNA_def_property_ui_text(
3926 prop, "Temperature Unit", "Unit that will be used to display temperature values");
3927 RNA_def_property_update(prop, NC_WINDOW, NULL);
3928 }
3929
rna_def_view_layer_eevee(BlenderRNA * brna)3930 static void rna_def_view_layer_eevee(BlenderRNA *brna)
3931 {
3932 StructRNA *srna;
3933 PropertyRNA *prop;
3934 srna = RNA_def_struct(brna, "ViewLayerEEVEE", NULL);
3935 RNA_def_struct_ui_text(srna, "EEVEE Settings", "View layer settings for EEVEE");
3936
3937 prop = RNA_def_property(srna, "use_pass_volume_scatter", PROP_BOOLEAN, PROP_NONE);
3938 RNA_def_property_boolean_sdna(prop, NULL, "render_passes", EEVEE_RENDER_PASS_VOLUME_SCATTER);
3939 RNA_def_property_ui_text(prop, "Volume Scatter", "Deliver volume scattering pass");
3940 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
3941
3942 prop = RNA_def_property(srna, "use_pass_volume_transmittance", PROP_BOOLEAN, PROP_NONE);
3943 RNA_def_property_boolean_sdna(
3944 prop, NULL, "render_passes", EEVEE_RENDER_PASS_VOLUME_TRANSMITTANCE);
3945 RNA_def_property_ui_text(prop, "Volume Transmittance", "Deliver volume transmittance pass");
3946 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
3947
3948 prop = RNA_def_property(srna, "use_pass_bloom", PROP_BOOLEAN, PROP_NONE);
3949 RNA_def_property_boolean_sdna(prop, NULL, "render_passes", EEVEE_RENDER_PASS_BLOOM);
3950 RNA_def_property_ui_text(prop, "Bloom", "Deliver bloom pass");
3951 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
3952 }
3953
rna_def_view_layer_common(StructRNA * srna,const bool scene)3954 void rna_def_view_layer_common(StructRNA *srna, const bool scene)
3955 {
3956 PropertyRNA *prop;
3957
3958 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
3959 if (scene) {
3960 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ViewLayer_name_set");
3961 }
3962 else {
3963 RNA_def_property_string_sdna(prop, NULL, "name");
3964 }
3965 RNA_def_property_ui_text(prop, "Name", "View layer name");
3966 RNA_def_struct_name_property(srna, prop);
3967 if (scene) {
3968 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
3969 }
3970 else {
3971 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
3972 }
3973
3974 if (scene) {
3975 prop = RNA_def_property(srna, "material_override", PROP_POINTER, PROP_NONE);
3976 RNA_def_property_pointer_sdna(prop, NULL, "mat_override");
3977 RNA_def_property_struct_type(prop, "Material");
3978 RNA_def_property_flag(prop, PROP_EDITABLE);
3979 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
3980 RNA_def_property_ui_text(
3981 prop, "Material Override", "Material to override all other materials in this view layer");
3982 RNA_def_property_update(
3983 prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_material_override_update");
3984
3985 prop = RNA_def_property(srna, "samples", PROP_INT, PROP_UNSIGNED);
3986 RNA_def_property_ui_text(prop,
3987 "Samples",
3988 "Override number of render samples for this view layer, "
3989 "0 will use the scene setting");
3990 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
3991
3992 prop = RNA_def_property(srna, "pass_alpha_threshold", PROP_FLOAT, PROP_FACTOR);
3993 RNA_def_property_ui_text(
3994 prop,
3995 "Alpha Threshold",
3996 "Z, Index, normal, UV and vector passes are only affected by surfaces with "
3997 "alpha transparency equal to or higher than this threshold");
3998 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
3999
4000 prop = RNA_def_property(srna, "eevee", PROP_POINTER, PROP_NONE);
4001 RNA_def_property_flag(prop, PROP_NEVER_NULL);
4002 RNA_def_property_struct_type(prop, "ViewLayerEEVEE");
4003 RNA_def_property_ui_text(prop, "EEVEE Settings", "View layer settings for EEVEE");
4004 }
4005
4006 /* layer options */
4007 prop = RNA_def_property(srna, "use_zmask", PROP_BOOLEAN, PROP_NONE);
4008 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ZMASK);
4009 RNA_def_property_ui_text(prop, "Zmask", "Only render what's in front of the solid z values");
4010 if (scene) {
4011 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
4012 }
4013 else {
4014 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
4015 }
4016
4017 prop = RNA_def_property(srna, "invert_zmask", PROP_BOOLEAN, PROP_NONE);
4018 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_NEG_ZMASK);
4019 RNA_def_property_ui_text(
4020 prop,
4021 "Zmask Negate",
4022 "For Zmask, only render what is behind solid z values instead of in front");
4023 if (scene) {
4024 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
4025 }
4026 else {
4027 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
4028 }
4029
4030 prop = RNA_def_property(srna, "use_all_z", PROP_BOOLEAN, PROP_NONE);
4031 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ALL_Z);
4032 RNA_def_property_ui_text(
4033 prop, "All Z", "Fill in Z values for solid faces in invisible layers, for masking");
4034 if (scene) {
4035 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
4036 }
4037 else {
4038 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
4039 }
4040
4041 prop = RNA_def_property(srna, "use_solid", PROP_BOOLEAN, PROP_NONE);
4042 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_SOLID);
4043 RNA_def_property_ui_text(prop, "Solid", "Render Solid faces in this Layer");
4044 if (scene) {
4045 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
4046 }
4047 else {
4048 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
4049 }
4050
4051 prop = RNA_def_property(srna, "use_halo", PROP_BOOLEAN, PROP_NONE);
4052 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_HALO);
4053 RNA_def_property_ui_text(prop, "Halo", "Render Halos in this Layer (on top of Solid)");
4054 if (scene) {
4055 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
4056 }
4057 else {
4058 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
4059 }
4060
4061 prop = RNA_def_property(srna, "use_ztransp", PROP_BOOLEAN, PROP_NONE);
4062 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ZTRA);
4063 RNA_def_property_ui_text(
4064 prop, "ZTransp", "Render Z-Transparent faces in this Layer (on top of Solid and Halos)");
4065 if (scene) {
4066 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
4067 }
4068 else {
4069 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
4070 }
4071
4072 prop = RNA_def_property(srna, "use_sky", PROP_BOOLEAN, PROP_NONE);
4073 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_SKY);
4074 RNA_def_property_ui_text(prop, "Sky", "Render Sky in this Layer");
4075 if (scene) {
4076 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
4077 }
4078 else {
4079 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
4080 }
4081
4082 prop = RNA_def_property(srna, "use_ao", PROP_BOOLEAN, PROP_NONE);
4083 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_AO);
4084 RNA_def_property_ui_text(prop, "Ambient Occlusion", "Render Ambient Occlusion in this Layer");
4085 if (scene) {
4086 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
4087 }
4088 else {
4089 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
4090 }
4091
4092 prop = RNA_def_property(srna, "use_edge_enhance", PROP_BOOLEAN, PROP_NONE);
4093 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_EDGE);
4094 RNA_def_property_ui_text(
4095 prop, "Edge", "Render Edge-enhance in this Layer (only works for Solid faces)");
4096 if (scene) {
4097 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
4098 }
4099 else {
4100 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
4101 }
4102
4103 prop = RNA_def_property(srna, "use_strand", PROP_BOOLEAN, PROP_NONE);
4104 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_STRAND);
4105 RNA_def_property_ui_text(prop, "Strand", "Render Strands in this Layer");
4106 if (scene) {
4107 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
4108 }
4109 else {
4110 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
4111 }
4112
4113 prop = RNA_def_property(srna, "use_volumes", PROP_BOOLEAN, PROP_NONE);
4114 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_VOLUMES);
4115 RNA_def_property_ui_text(prop, "Volumes", "Render volumes in this Layer");
4116 if (scene) {
4117 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
4118 }
4119 else {
4120 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
4121 }
4122
4123 /* passes */
4124 prop = RNA_def_property(srna, "use_pass_combined", PROP_BOOLEAN, PROP_NONE);
4125 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_COMBINED);
4126 RNA_def_property_ui_text(prop, "Combined", "Deliver full combined RGBA buffer");
4127 if (scene) {
4128 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
4129 }
4130 else {
4131 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
4132 }
4133
4134 prop = RNA_def_property(srna, "use_pass_z", PROP_BOOLEAN, PROP_NONE);
4135 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_Z);
4136 RNA_def_property_ui_text(prop, "Z", "Deliver Z values pass");
4137 if (scene) {
4138 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
4139 }
4140 else {
4141 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
4142 }
4143
4144 prop = RNA_def_property(srna, "use_pass_vector", PROP_BOOLEAN, PROP_NONE);
4145 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_VECTOR);
4146 RNA_def_property_ui_text(prop, "Vector", "Deliver speed vector pass");
4147 if (scene) {
4148 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
4149 }
4150 else {
4151 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
4152 }
4153
4154 prop = RNA_def_property(srna, "use_pass_normal", PROP_BOOLEAN, PROP_NONE);
4155 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_NORMAL);
4156 RNA_def_property_ui_text(prop, "Normal", "Deliver normal pass");
4157 if (scene) {
4158 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
4159 }
4160 else {
4161 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
4162 }
4163
4164 prop = RNA_def_property(srna, "use_pass_uv", PROP_BOOLEAN, PROP_NONE);
4165 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_UV);
4166 RNA_def_property_ui_text(prop, "UV", "Deliver texture UV pass");
4167 if (scene) {
4168 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
4169 }
4170 else {
4171 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
4172 }
4173
4174 prop = RNA_def_property(srna, "use_pass_mist", PROP_BOOLEAN, PROP_NONE);
4175 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_MIST);
4176 RNA_def_property_ui_text(prop, "Mist", "Deliver mist factor pass (0.0-1.0)");
4177 if (scene) {
4178 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
4179 }
4180 else {
4181 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
4182 }
4183
4184 prop = RNA_def_property(srna, "use_pass_object_index", PROP_BOOLEAN, PROP_NONE);
4185 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_INDEXOB);
4186 RNA_def_property_ui_text(prop, "Object Index", "Deliver object index pass");
4187 if (scene) {
4188 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
4189 }
4190 else {
4191 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
4192 }
4193
4194 prop = RNA_def_property(srna, "use_pass_material_index", PROP_BOOLEAN, PROP_NONE);
4195 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_INDEXMA);
4196 RNA_def_property_ui_text(prop, "Material Index", "Deliver material index pass");
4197 if (scene) {
4198 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
4199 }
4200 else {
4201 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
4202 }
4203
4204 prop = RNA_def_property(srna, "use_pass_shadow", PROP_BOOLEAN, PROP_NONE);
4205 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SHADOW);
4206 RNA_def_property_ui_text(prop, "Shadow", "Deliver shadow pass");
4207 if (scene) {
4208 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
4209 }
4210 else {
4211 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
4212 }
4213
4214 prop = RNA_def_property(srna, "use_pass_ambient_occlusion", PROP_BOOLEAN, PROP_NONE);
4215 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_AO);
4216 RNA_def_property_ui_text(prop, "Ambient Occlusion", "Deliver Ambient Occlusion pass");
4217 if (scene) {
4218 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
4219 }
4220 else {
4221 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
4222 }
4223
4224 prop = RNA_def_property(srna, "use_pass_emit", PROP_BOOLEAN, PROP_NONE);
4225 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_EMIT);
4226 RNA_def_property_ui_text(prop, "Emit", "Deliver emission pass");
4227 if (scene) {
4228 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
4229 }
4230 else {
4231 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
4232 }
4233
4234 prop = RNA_def_property(srna, "use_pass_environment", PROP_BOOLEAN, PROP_NONE);
4235 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_ENVIRONMENT);
4236 RNA_def_property_ui_text(prop, "Environment", "Deliver environment lighting pass");
4237 if (scene) {
4238 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
4239 }
4240 else {
4241 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
4242 }
4243
4244 prop = RNA_def_property(srna, "use_pass_diffuse_direct", PROP_BOOLEAN, PROP_NONE);
4245 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE_DIRECT);
4246 RNA_def_property_ui_text(prop, "Diffuse Direct", "Deliver diffuse direct pass");
4247 if (scene) {
4248 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
4249 }
4250 else {
4251 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
4252 }
4253
4254 prop = RNA_def_property(srna, "use_pass_diffuse_indirect", PROP_BOOLEAN, PROP_NONE);
4255 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE_INDIRECT);
4256 RNA_def_property_ui_text(prop, "Diffuse Indirect", "Deliver diffuse indirect pass");
4257 if (scene) {
4258 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
4259 }
4260 else {
4261 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
4262 }
4263
4264 prop = RNA_def_property(srna, "use_pass_diffuse_color", PROP_BOOLEAN, PROP_NONE);
4265 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE_COLOR);
4266 RNA_def_property_ui_text(prop, "Diffuse Color", "Deliver diffuse color pass");
4267 if (scene) {
4268 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
4269 }
4270 else {
4271 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
4272 }
4273
4274 prop = RNA_def_property(srna, "use_pass_glossy_direct", PROP_BOOLEAN, PROP_NONE);
4275 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_GLOSSY_DIRECT);
4276 RNA_def_property_ui_text(prop, "Glossy Direct", "Deliver glossy direct pass");
4277 if (scene) {
4278 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
4279 }
4280 else {
4281 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
4282 }
4283
4284 prop = RNA_def_property(srna, "use_pass_glossy_indirect", PROP_BOOLEAN, PROP_NONE);
4285 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_GLOSSY_INDIRECT);
4286 RNA_def_property_ui_text(prop, "Glossy Indirect", "Deliver glossy indirect pass");
4287 if (scene) {
4288 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
4289 }
4290 else {
4291 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
4292 }
4293
4294 prop = RNA_def_property(srna, "use_pass_glossy_color", PROP_BOOLEAN, PROP_NONE);
4295 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_GLOSSY_COLOR);
4296 RNA_def_property_ui_text(prop, "Glossy Color", "Deliver glossy color pass");
4297 if (scene) {
4298 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
4299 }
4300 else {
4301 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
4302 }
4303
4304 prop = RNA_def_property(srna, "use_pass_transmission_direct", PROP_BOOLEAN, PROP_NONE);
4305 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_TRANSM_DIRECT);
4306 RNA_def_property_ui_text(prop, "Transmission Direct", "Deliver transmission direct pass");
4307 if (scene) {
4308 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
4309 }
4310 else {
4311 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
4312 }
4313
4314 prop = RNA_def_property(srna, "use_pass_transmission_indirect", PROP_BOOLEAN, PROP_NONE);
4315 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_TRANSM_INDIRECT);
4316 RNA_def_property_ui_text(prop, "Transmission Indirect", "Deliver transmission indirect pass");
4317 if (scene) {
4318 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
4319 }
4320 else {
4321 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
4322 }
4323
4324 prop = RNA_def_property(srna, "use_pass_transmission_color", PROP_BOOLEAN, PROP_NONE);
4325 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_TRANSM_COLOR);
4326 RNA_def_property_ui_text(prop, "Transmission Color", "Deliver transmission color pass");
4327 if (scene) {
4328 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
4329 }
4330 else {
4331 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
4332 }
4333
4334 prop = RNA_def_property(srna, "use_pass_subsurface_direct", PROP_BOOLEAN, PROP_NONE);
4335 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SUBSURFACE_DIRECT);
4336 RNA_def_property_ui_text(prop, "Subsurface Direct", "Deliver subsurface direct pass");
4337 if (scene) {
4338 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
4339 }
4340 else {
4341 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
4342 }
4343
4344 prop = RNA_def_property(srna, "use_pass_subsurface_indirect", PROP_BOOLEAN, PROP_NONE);
4345 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SUBSURFACE_INDIRECT);
4346 RNA_def_property_ui_text(prop, "Subsurface Indirect", "Deliver subsurface indirect pass");
4347 if (scene) {
4348 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
4349 }
4350 else {
4351 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
4352 }
4353
4354 prop = RNA_def_property(srna, "use_pass_subsurface_color", PROP_BOOLEAN, PROP_NONE);
4355 RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SUBSURFACE_COLOR);
4356 RNA_def_property_ui_text(prop, "Subsurface Color", "Deliver subsurface color pass");
4357 if (scene) {
4358 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
4359 }
4360 else {
4361 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
4362 }
4363 }
4364
rna_def_freestyle_modules(BlenderRNA * brna,PropertyRNA * cprop)4365 static void rna_def_freestyle_modules(BlenderRNA *brna, PropertyRNA *cprop)
4366 {
4367 StructRNA *srna;
4368 FunctionRNA *func;
4369 PropertyRNA *parm;
4370
4371 RNA_def_property_srna(cprop, "FreestyleModules");
4372 srna = RNA_def_struct(brna, "FreestyleModules", NULL);
4373 RNA_def_struct_sdna(srna, "FreestyleSettings");
4374 RNA_def_struct_ui_text(
4375 srna, "Style Modules", "A list of style modules (to be applied from top to bottom)");
4376
4377 func = RNA_def_function(srna, "new", "rna_FreestyleSettings_module_add");
4378 RNA_def_function_ui_description(func,
4379 "Add a style module to scene render layer Freestyle settings");
4380 RNA_def_function_flag(func, FUNC_USE_SELF_ID);
4381 parm = RNA_def_pointer(
4382 func, "module", "FreestyleModuleSettings", "", "Newly created style module");
4383 RNA_def_function_return(func, parm);
4384
4385 func = RNA_def_function(srna, "remove", "rna_FreestyleSettings_module_remove");
4386 RNA_def_function_ui_description(
4387 func, "Remove a style module from scene render layer Freestyle settings");
4388 RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS);
4389 parm = RNA_def_pointer(func, "module", "FreestyleModuleSettings", "", "Style module to remove");
4390 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
4391 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
4392 }
4393
rna_def_freestyle_linesets(BlenderRNA * brna,PropertyRNA * cprop)4394 static void rna_def_freestyle_linesets(BlenderRNA *brna, PropertyRNA *cprop)
4395 {
4396 StructRNA *srna;
4397 PropertyRNA *prop;
4398 FunctionRNA *func;
4399 PropertyRNA *parm;
4400
4401 RNA_def_property_srna(cprop, "Linesets");
4402 srna = RNA_def_struct(brna, "Linesets", NULL);
4403 RNA_def_struct_sdna(srna, "FreestyleSettings");
4404 RNA_def_struct_ui_text(
4405 srna, "Line Sets", "Line sets for associating lines and style parameters");
4406
4407 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
4408 RNA_def_property_struct_type(prop, "FreestyleLineSet");
4409 RNA_def_property_pointer_funcs(
4410 prop, "rna_FreestyleSettings_active_lineset_get", NULL, NULL, NULL);
4411 RNA_def_property_ui_text(prop, "Active Line Set", "Active line set being displayed");
4412 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
4413
4414 prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
4415 RNA_def_property_int_funcs(prop,
4416 "rna_FreestyleSettings_active_lineset_index_get",
4417 "rna_FreestyleSettings_active_lineset_index_set",
4418 "rna_FreestyleSettings_active_lineset_index_range");
4419 RNA_def_property_ui_text(prop, "Active Line Set Index", "Index of active line set slot");
4420 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
4421
4422 func = RNA_def_function(srna, "new", "rna_FreestyleSettings_lineset_add");
4423 RNA_def_function_ui_description(func, "Add a line set to scene render layer Freestyle settings");
4424 RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_SELF_ID);
4425 parm = RNA_def_string(func, "name", "LineSet", 0, "", "New name for the line set (not unique)");
4426 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
4427 parm = RNA_def_pointer(func, "lineset", "FreestyleLineSet", "", "Newly created line set");
4428 RNA_def_function_return(func, parm);
4429
4430 func = RNA_def_function(srna, "remove", "rna_FreestyleSettings_lineset_remove");
4431 RNA_def_function_ui_description(func,
4432 "Remove a line set from scene render layer Freestyle settings");
4433 RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS);
4434 parm = RNA_def_pointer(func, "lineset", "FreestyleLineSet", "", "Line set to remove");
4435 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
4436 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
4437 }
4438
rna_def_freestyle_settings(BlenderRNA * brna)4439 void rna_def_freestyle_settings(BlenderRNA *brna)
4440 {
4441 StructRNA *srna;
4442 PropertyRNA *prop;
4443
4444 static const EnumPropertyItem edge_type_negation_items[] = {
4445 {0,
4446 "INCLUSIVE",
4447 0,
4448 "Inclusive",
4449 "Select feature edges satisfying the given edge type conditions"},
4450 {FREESTYLE_LINESET_FE_NOT,
4451 "EXCLUSIVE",
4452 0,
4453 "Exclusive",
4454 "Select feature edges not satisfying the given edge type conditions"},
4455 {0, NULL, 0, NULL, NULL},
4456 };
4457
4458 static const EnumPropertyItem edge_type_combination_items[] = {
4459 {0,
4460 "OR",
4461 0,
4462 "Logical OR",
4463 "Select feature edges satisfying at least one of edge type conditions"},
4464 {FREESTYLE_LINESET_FE_AND,
4465 "AND",
4466 0,
4467 "Logical AND",
4468 "Select feature edges satisfying all edge type conditions"},
4469 {0, NULL, 0, NULL, NULL},
4470 };
4471
4472 static const EnumPropertyItem collection_negation_items[] = {
4473 {0,
4474 "INCLUSIVE",
4475 0,
4476 "Inclusive",
4477 "Select feature edges belonging to some object in the group"},
4478 {FREESTYLE_LINESET_GR_NOT,
4479 "EXCLUSIVE",
4480 0,
4481 "Exclusive",
4482 "Select feature edges not belonging to any object in the group"},
4483 {0, NULL, 0, NULL, NULL},
4484 };
4485
4486 static const EnumPropertyItem face_mark_negation_items[] = {
4487 {0,
4488 "INCLUSIVE",
4489 0,
4490 "Inclusive",
4491 "Select feature edges satisfying the given face mark conditions"},
4492 {FREESTYLE_LINESET_FM_NOT,
4493 "EXCLUSIVE",
4494 0,
4495 "Exclusive",
4496 "Select feature edges not satisfying the given face mark conditions"},
4497 {0, NULL, 0, NULL, NULL},
4498 };
4499
4500 static const EnumPropertyItem face_mark_condition_items[] = {
4501 {0, "ONE", 0, "One Face", "Select a feature edge if either of its adjacent faces is marked"},
4502 {FREESTYLE_LINESET_FM_BOTH,
4503 "BOTH",
4504 0,
4505 "Both Faces",
4506 "Select a feature edge if both of its adjacent faces are marked"},
4507 {0, NULL, 0, NULL, NULL},
4508 };
4509
4510 static const EnumPropertyItem freestyle_ui_mode_items[] = {
4511 {FREESTYLE_CONTROL_SCRIPT_MODE,
4512 "SCRIPT",
4513 0,
4514 "Python Scripting Mode",
4515 "Advanced mode for using style modules written in Python"},
4516 {FREESTYLE_CONTROL_EDITOR_MODE,
4517 "EDITOR",
4518 0,
4519 "Parameter Editor Mode",
4520 "Basic mode for interactive style parameter editing"},
4521 {0, NULL, 0, NULL, NULL},
4522 };
4523
4524 static const EnumPropertyItem visibility_items[] = {
4525 {FREESTYLE_QI_VISIBLE, "VISIBLE", 0, "Visible", "Select visible feature edges"},
4526 {FREESTYLE_QI_HIDDEN, "HIDDEN", 0, "Hidden", "Select hidden feature edges"},
4527 {FREESTYLE_QI_RANGE,
4528 "RANGE",
4529 0,
4530 "QI Range",
4531 "Select feature edges within a range of quantitative invisibility (QI) values"},
4532 {0, NULL, 0, NULL, NULL},
4533 };
4534
4535 /* FreestyleLineSet */
4536
4537 srna = RNA_def_struct(brna, "FreestyleLineSet", NULL);
4538 RNA_def_struct_ui_text(
4539 srna, "Freestyle Line Set", "Line set for associating lines and style parameters");
4540
4541 /* access to line style settings is redirected through functions
4542 * to allow proper id-buttons functionality
4543 */
4544 prop = RNA_def_property(srna, "linestyle", PROP_POINTER, PROP_NONE);
4545 RNA_def_property_struct_type(prop, "FreestyleLineStyle");
4546 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
4547 RNA_def_property_pointer_funcs(prop,
4548 "rna_FreestyleLineSet_linestyle_get",
4549 "rna_FreestyleLineSet_linestyle_set",
4550 NULL,
4551 NULL);
4552 RNA_def_property_ui_text(prop, "Line Style", "Line style settings");
4553 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4554
4555 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
4556 RNA_def_property_string_sdna(prop, NULL, "name");
4557 RNA_def_property_ui_text(prop, "Line Set Name", "Line set name");
4558 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
4559 RNA_def_struct_name_property(srna, prop);
4560
4561 prop = RNA_def_property(srna, "show_render", PROP_BOOLEAN, PROP_NONE);
4562 RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_LINESET_ENABLED);
4563 RNA_def_property_ui_text(
4564 prop, "Render", "Enable or disable this line set during stroke rendering");
4565 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4566
4567 prop = RNA_def_property(srna, "select_by_visibility", PROP_BOOLEAN, PROP_NONE);
4568 RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_VISIBILITY);
4569 RNA_def_property_ui_text(
4570 prop, "Selection by Visibility", "Select feature edges based on visibility");
4571 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4572
4573 prop = RNA_def_property(srna, "select_by_edge_types", PROP_BOOLEAN, PROP_NONE);
4574 RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_EDGE_TYPES);
4575 RNA_def_property_ui_text(
4576 prop, "Selection by Edge Types", "Select feature edges based on edge types");
4577 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4578
4579 prop = RNA_def_property(srna, "select_by_collection", PROP_BOOLEAN, PROP_NONE);
4580 RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_GROUP);
4581 RNA_def_property_ui_text(
4582 prop, "Selection by Collection", "Select feature edges based on a collection of objects");
4583 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4584
4585 prop = RNA_def_property(srna, "select_by_image_border", PROP_BOOLEAN, PROP_NONE);
4586 RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_IMAGE_BORDER);
4587 RNA_def_property_ui_text(prop,
4588 "Selection by Image Border",
4589 "Select feature edges by image border (less memory consumption)");
4590 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4591
4592 prop = RNA_def_property(srna, "select_by_face_marks", PROP_BOOLEAN, PROP_NONE);
4593 RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_FACE_MARK);
4594 RNA_def_property_ui_text(prop, "Selection by Face Marks", "Select feature edges by face marks");
4595 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4596
4597 prop = RNA_def_property(srna, "edge_type_negation", PROP_ENUM, PROP_NONE);
4598 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
4599 RNA_def_property_enum_items(prop, edge_type_negation_items);
4600 RNA_def_property_ui_text(
4601 prop,
4602 "Edge Type Negation",
4603 "Specify either inclusion or exclusion of feature edges selected by edge types");
4604 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4605
4606 prop = RNA_def_property(srna, "edge_type_combination", PROP_ENUM, PROP_NONE);
4607 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
4608 RNA_def_property_enum_items(prop, edge_type_combination_items);
4609 RNA_def_property_ui_text(
4610 prop,
4611 "Edge Type Combination",
4612 "Specify a logical combination of selection conditions on feature edge types");
4613 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4614
4615 prop = RNA_def_property(srna, "collection", PROP_POINTER, PROP_NONE);
4616 RNA_def_property_pointer_sdna(prop, NULL, "group");
4617 RNA_def_property_struct_type(prop, "Collection");
4618 RNA_def_property_flag(prop, PROP_EDITABLE);
4619 RNA_def_property_ui_text(
4620 prop, "Collection", "A collection of objects based on which feature edges are selected");
4621 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4622
4623 prop = RNA_def_property(srna, "collection_negation", PROP_ENUM, PROP_NONE);
4624 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
4625 RNA_def_property_enum_items(prop, collection_negation_items);
4626 RNA_def_property_ui_text(prop,
4627 "Collection Negation",
4628 "Specify either inclusion or exclusion of feature edges belonging to a "
4629 "collection of objects");
4630 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4631
4632 prop = RNA_def_property(srna, "face_mark_negation", PROP_ENUM, PROP_NONE);
4633 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
4634 RNA_def_property_enum_items(prop, face_mark_negation_items);
4635 RNA_def_property_ui_text(
4636 prop,
4637 "Face Mark Negation",
4638 "Specify either inclusion or exclusion of feature edges selected by face marks");
4639 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4640
4641 prop = RNA_def_property(srna, "face_mark_condition", PROP_ENUM, PROP_NONE);
4642 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
4643 RNA_def_property_enum_items(prop, face_mark_condition_items);
4644 RNA_def_property_ui_text(prop,
4645 "Face Mark Condition",
4646 "Specify a feature edge selection condition based on face marks");
4647 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4648
4649 prop = RNA_def_property(srna, "select_silhouette", PROP_BOOLEAN, PROP_NONE);
4650 RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_SILHOUETTE);
4651 RNA_def_property_ui_text(
4652 prop,
4653 "Silhouette",
4654 "Select silhouettes (edges at the boundary of visible and hidden faces)");
4655 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4656
4657 prop = RNA_def_property(srna, "select_border", PROP_BOOLEAN, PROP_NONE);
4658 RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_BORDER);
4659 RNA_def_property_ui_text(prop, "Border", "Select border edges (open mesh edges)");
4660 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4661
4662 prop = RNA_def_property(srna, "select_crease", PROP_BOOLEAN, PROP_NONE);
4663 RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_CREASE);
4664 RNA_def_property_ui_text(prop,
4665 "Crease",
4666 "Select crease edges (those between two faces making an angle smaller "
4667 "than the Crease Angle)");
4668 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4669
4670 prop = RNA_def_property(srna, "select_ridge_valley", PROP_BOOLEAN, PROP_NONE);
4671 RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_RIDGE_VALLEY);
4672 RNA_def_property_ui_text(
4673 prop,
4674 "Ridge & Valley",
4675 "Select ridges and valleys (boundary lines between convex and concave areas of surface)");
4676 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4677
4678 prop = RNA_def_property(srna, "select_suggestive_contour", PROP_BOOLEAN, PROP_NONE);
4679 RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_SUGGESTIVE_CONTOUR);
4680 RNA_def_property_ui_text(
4681 prop, "Suggestive Contour", "Select suggestive contours (almost silhouette/contour edges)");
4682 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4683
4684 prop = RNA_def_property(srna, "select_material_boundary", PROP_BOOLEAN, PROP_NONE);
4685 RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_MATERIAL_BOUNDARY);
4686 RNA_def_property_ui_text(prop, "Material Boundary", "Select edges at material boundaries");
4687 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4688
4689 prop = RNA_def_property(srna, "select_contour", PROP_BOOLEAN, PROP_NONE);
4690 RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_CONTOUR);
4691 RNA_def_property_ui_text(prop, "Contour", "Select contours (outer silhouettes of each object)");
4692 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4693
4694 prop = RNA_def_property(srna, "select_external_contour", PROP_BOOLEAN, PROP_NONE);
4695 RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_EXTERNAL_CONTOUR);
4696 RNA_def_property_ui_text(
4697 prop,
4698 "External Contour",
4699 "Select external contours (outer silhouettes of occluding and occluded objects)");
4700 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4701
4702 prop = RNA_def_property(srna, "select_edge_mark", PROP_BOOLEAN, PROP_NONE);
4703 RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_EDGE_MARK);
4704 RNA_def_property_ui_text(
4705 prop, "Edge Mark", "Select edge marks (edges annotated by Freestyle edge marks)");
4706 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4707
4708 prop = RNA_def_property(srna, "exclude_silhouette", PROP_BOOLEAN, PROP_NONE);
4709 RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_SILHOUETTE);
4710 RNA_def_property_ui_text(prop, "Silhouette", "Exclude silhouette edges");
4711 RNA_def_property_ui_icon(prop, ICON_X, 0);
4712 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4713
4714 prop = RNA_def_property(srna, "exclude_border", PROP_BOOLEAN, PROP_NONE);
4715 RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_BORDER);
4716 RNA_def_property_ui_text(prop, "Border", "Exclude border edges");
4717 RNA_def_property_ui_icon(prop, ICON_X, 0);
4718 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4719
4720 prop = RNA_def_property(srna, "exclude_crease", PROP_BOOLEAN, PROP_NONE);
4721 RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_CREASE);
4722 RNA_def_property_ui_text(prop, "Crease", "Exclude crease edges");
4723 RNA_def_property_ui_icon(prop, ICON_X, 0);
4724 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4725
4726 prop = RNA_def_property(srna, "exclude_ridge_valley", PROP_BOOLEAN, PROP_NONE);
4727 RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_RIDGE_VALLEY);
4728 RNA_def_property_ui_text(prop, "Ridge & Valley", "Exclude ridges and valleys");
4729 RNA_def_property_ui_icon(prop, ICON_X, 0);
4730 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4731
4732 prop = RNA_def_property(srna, "exclude_suggestive_contour", PROP_BOOLEAN, PROP_NONE);
4733 RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_SUGGESTIVE_CONTOUR);
4734 RNA_def_property_ui_text(prop, "Suggestive Contour", "Exclude suggestive contours");
4735 RNA_def_property_ui_icon(prop, ICON_X, 0);
4736 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4737
4738 prop = RNA_def_property(srna, "exclude_material_boundary", PROP_BOOLEAN, PROP_NONE);
4739 RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_MATERIAL_BOUNDARY);
4740 RNA_def_property_ui_text(prop, "Material Boundary", "Exclude edges at material boundaries");
4741 RNA_def_property_ui_icon(prop, ICON_X, 0);
4742 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4743
4744 prop = RNA_def_property(srna, "exclude_contour", PROP_BOOLEAN, PROP_NONE);
4745 RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_CONTOUR);
4746 RNA_def_property_ui_text(prop, "Contour", "Exclude contours");
4747 RNA_def_property_ui_icon(prop, ICON_X, 0);
4748 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4749
4750 prop = RNA_def_property(srna, "exclude_external_contour", PROP_BOOLEAN, PROP_NONE);
4751 RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_EXTERNAL_CONTOUR);
4752 RNA_def_property_ui_text(prop, "External Contour", "Exclude external contours");
4753 RNA_def_property_ui_icon(prop, ICON_X, 0);
4754 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4755
4756 prop = RNA_def_property(srna, "exclude_edge_mark", PROP_BOOLEAN, PROP_NONE);
4757 RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_EDGE_MARK);
4758 RNA_def_property_ui_text(prop, "Edge Mark", "Exclude edge marks");
4759 RNA_def_property_ui_icon(prop, ICON_X, 0);
4760 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4761
4762 prop = RNA_def_property(srna, "visibility", PROP_ENUM, PROP_NONE);
4763 RNA_def_property_enum_sdna(prop, NULL, "qi");
4764 RNA_def_property_enum_items(prop, visibility_items);
4765 RNA_def_property_ui_text(
4766 prop, "Visibility", "Determine how to use visibility for feature edge selection");
4767 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4768
4769 prop = RNA_def_property(srna, "qi_start", PROP_INT, PROP_UNSIGNED);
4770 RNA_def_property_int_sdna(prop, NULL, "qi_start");
4771 RNA_def_property_range(prop, 0, INT_MAX);
4772 RNA_def_property_ui_text(prop, "Start", "First QI value of the QI range");
4773 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4774
4775 prop = RNA_def_property(srna, "qi_end", PROP_INT, PROP_UNSIGNED);
4776 RNA_def_property_int_sdna(prop, NULL, "qi_end");
4777 RNA_def_property_range(prop, 0, INT_MAX);
4778 RNA_def_property_ui_text(prop, "End", "Last QI value of the QI range");
4779 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4780
4781 /* FreestyleModuleSettings */
4782
4783 srna = RNA_def_struct(brna, "FreestyleModuleSettings", NULL);
4784 RNA_def_struct_sdna(srna, "FreestyleModuleConfig");
4785 RNA_def_struct_ui_text(
4786 srna, "Freestyle Module", "Style module configuration for specifying a style module");
4787
4788 prop = RNA_def_property(srna, "script", PROP_POINTER, PROP_NONE);
4789 RNA_def_property_struct_type(prop, "Text");
4790 RNA_def_property_flag(prop, PROP_EDITABLE);
4791 RNA_def_property_ui_text(prop, "Style Module", "Python script to define a style module");
4792 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4793
4794 prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
4795 RNA_def_property_boolean_sdna(prop, NULL, "is_displayed", 1);
4796 RNA_def_property_ui_text(
4797 prop, "Use", "Enable or disable this style module during stroke rendering");
4798 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4799
4800 /* FreestyleSettings */
4801
4802 srna = RNA_def_struct(brna, "FreestyleSettings", NULL);
4803 RNA_def_struct_sdna(srna, "FreestyleConfig");
4804 RNA_def_struct_nested(brna, srna, "ViewLayer");
4805 RNA_def_struct_ui_text(
4806 srna, "Freestyle Settings", "Freestyle settings for a ViewLayer data-block");
4807
4808 prop = RNA_def_property(srna, "modules", PROP_COLLECTION, PROP_NONE);
4809 RNA_def_property_collection_sdna(prop, NULL, "modules", NULL);
4810 RNA_def_property_struct_type(prop, "FreestyleModuleSettings");
4811 RNA_def_property_ui_text(
4812 prop, "Style Modules", "A list of style modules (to be applied from top to bottom)");
4813 rna_def_freestyle_modules(brna, prop);
4814
4815 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
4816 RNA_def_property_enum_sdna(prop, NULL, "mode");
4817 RNA_def_property_enum_items(prop, freestyle_ui_mode_items);
4818 RNA_def_property_ui_text(prop, "Control Mode", "Select the Freestyle control mode");
4819 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4820
4821 prop = RNA_def_property(srna, "use_culling", PROP_BOOLEAN, PROP_NONE);
4822 RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_CULLING);
4823 RNA_def_property_ui_text(prop, "Culling", "If enabled, out-of-view edges are ignored");
4824 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4825
4826 prop = RNA_def_property(srna, "use_suggestive_contours", PROP_BOOLEAN, PROP_NONE);
4827 RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_SUGGESTIVE_CONTOURS_FLAG);
4828 RNA_def_property_ui_text(prop, "Suggestive Contours", "Enable suggestive contours");
4829 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4830
4831 prop = RNA_def_property(srna, "use_ridges_and_valleys", PROP_BOOLEAN, PROP_NONE);
4832 RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_RIDGES_AND_VALLEYS_FLAG);
4833 RNA_def_property_ui_text(prop, "Ridges and Valleys", "Enable ridges and valleys");
4834 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4835
4836 prop = RNA_def_property(srna, "use_material_boundaries", PROP_BOOLEAN, PROP_NONE);
4837 RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_MATERIAL_BOUNDARIES_FLAG);
4838 RNA_def_property_ui_text(prop, "Material Boundaries", "Enable material boundaries");
4839 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4840
4841 prop = RNA_def_property(srna, "use_smoothness", PROP_BOOLEAN, PROP_NONE);
4842 RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_FACE_SMOOTHNESS_FLAG);
4843 RNA_def_property_ui_text(
4844 prop, "Face Smoothness", "Take face smoothness into account in view map calculation");
4845 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4846
4847 prop = RNA_def_property(srna, "use_advanced_options", PROP_BOOLEAN, PROP_NONE);
4848 RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_ADVANCED_OPTIONS_FLAG);
4849 RNA_def_property_ui_text(
4850 prop,
4851 "Advanced Options",
4852 "Enable advanced edge detection options (sphere radius and Kr derivative epsilon)");
4853 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4854
4855 prop = RNA_def_property(srna, "use_view_map_cache", PROP_BOOLEAN, PROP_NONE);
4856 RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_VIEW_MAP_CACHE);
4857 RNA_def_property_ui_text(
4858 prop,
4859 "View Map Cache",
4860 "Keep the computed view map and avoid recalculating it if mesh geometry is unchanged");
4861 RNA_def_property_update(
4862 prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_use_view_map_cache_update");
4863
4864 prop = RNA_def_property(srna, "as_render_pass", PROP_BOOLEAN, PROP_NONE);
4865 RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_AS_RENDER_PASS);
4866 RNA_def_property_ui_text(
4867 prop,
4868 "As Render Pass",
4869 "Renders Freestyle output to a separate pass instead of overlaying it on the Combined pass");
4870 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
4871
4872 prop = RNA_def_property(srna, "sphere_radius", PROP_FLOAT, PROP_NONE);
4873 RNA_def_property_float_sdna(prop, NULL, "sphere_radius");
4874 RNA_def_property_range(prop, 0.0, 1000.0);
4875 RNA_def_property_ui_text(prop, "Sphere Radius", "Sphere radius for computing curvatures");
4876 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4877
4878 prop = RNA_def_property(srna, "kr_derivative_epsilon", PROP_FLOAT, PROP_NONE);
4879 RNA_def_property_float_sdna(prop, NULL, "dkr_epsilon");
4880 RNA_def_property_range(prop, -1000.0, 1000.0);
4881 RNA_def_property_ui_text(
4882 prop, "Kr Derivative Epsilon", "Kr derivative epsilon for computing suggestive contours");
4883 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4884
4885 prop = RNA_def_property(srna, "crease_angle", PROP_FLOAT, PROP_ANGLE);
4886 RNA_def_property_float_sdna(prop, NULL, "crease_angle");
4887 RNA_def_property_range(prop, 0.0, DEG2RAD(180.0));
4888 RNA_def_property_ui_text(prop, "Crease Angle", "Angular threshold for detecting crease edges");
4889 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
4890
4891 prop = RNA_def_property(srna, "linesets", PROP_COLLECTION, PROP_NONE);
4892 RNA_def_property_collection_sdna(prop, NULL, "linesets", NULL);
4893 RNA_def_property_struct_type(prop, "FreestyleLineSet");
4894 RNA_def_property_ui_text(prop, "Line Sets", "");
4895 rna_def_freestyle_linesets(brna, prop);
4896 }
4897
rna_def_bake_data(BlenderRNA * brna)4898 static void rna_def_bake_data(BlenderRNA *brna)
4899 {
4900 StructRNA *srna;
4901 PropertyRNA *prop;
4902
4903 srna = RNA_def_struct(brna, "BakeSettings", NULL);
4904 RNA_def_struct_sdna(srna, "BakeData");
4905 RNA_def_struct_nested(brna, srna, "RenderSettings");
4906 RNA_def_struct_ui_text(srna, "Bake Data", "Bake data for a Scene data-block");
4907 RNA_def_struct_path_func(srna, "rna_BakeSettings_path");
4908
4909 prop = RNA_def_property(srna, "cage_object", PROP_POINTER, PROP_NONE);
4910 RNA_def_property_ui_text(
4911 prop,
4912 "Cage Object",
4913 "Object to use as cage "
4914 "instead of calculating the cage from the active object with cage extrusion");
4915 RNA_def_property_flag(prop, PROP_EDITABLE);
4916 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
4917
4918 prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
4919 RNA_def_property_ui_text(prop, "File Path", "Image filepath to use when saving externally");
4920 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
4921
4922 prop = RNA_def_property(srna, "width", PROP_INT, PROP_PIXEL);
4923 RNA_def_property_range(prop, 4, 10000);
4924 RNA_def_property_ui_text(prop, "Width", "Horizontal dimension of the baking map");
4925 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
4926
4927 prop = RNA_def_property(srna, "height", PROP_INT, PROP_PIXEL);
4928 RNA_def_property_range(prop, 4, 10000);
4929 RNA_def_property_ui_text(prop, "Height", "Vertical dimension of the baking map");
4930 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
4931
4932 prop = RNA_def_property(srna, "margin", PROP_INT, PROP_PIXEL);
4933 RNA_def_property_range(prop, 0, SHRT_MAX);
4934 RNA_def_property_ui_range(prop, 0, 64, 1, 1);
4935 RNA_def_property_ui_text(prop, "Margin", "Extends the baked result as a post process filter");
4936 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
4937
4938 prop = RNA_def_property(srna, "max_ray_distance", PROP_FLOAT, PROP_DISTANCE);
4939 RNA_def_property_range(prop, 0.0, FLT_MAX);
4940 RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 3);
4941 RNA_def_property_ui_text(prop,
4942 "Max Ray Distance",
4943 "The maximum ray distance for matching points between the active and "
4944 "selected objects. If zero, there is no limit");
4945 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
4946
4947 prop = RNA_def_property(srna, "cage_extrusion", PROP_FLOAT, PROP_DISTANCE);
4948 RNA_def_property_range(prop, 0.0, FLT_MAX);
4949 RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 3);
4950 RNA_def_property_ui_text(
4951 prop,
4952 "Cage Extrusion",
4953 "Inflate the active object by the specified distance for baking. This helps matching to "
4954 "points nearer to the outside of the selected object meshes");
4955 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
4956
4957 prop = RNA_def_property(srna, "normal_space", PROP_ENUM, PROP_NONE);
4958 RNA_def_property_enum_bitflag_sdna(prop, NULL, "normal_space");
4959 RNA_def_property_enum_items(prop, rna_enum_normal_space_items);
4960 RNA_def_property_ui_text(prop, "Normal Space", "Choose normal space for baking");
4961 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
4962
4963 prop = RNA_def_property(srna, "normal_r", PROP_ENUM, PROP_NONE);
4964 RNA_def_property_enum_bitflag_sdna(prop, NULL, "normal_swizzle[0]");
4965 RNA_def_property_enum_items(prop, rna_enum_normal_swizzle_items);
4966 RNA_def_property_ui_text(prop, "Normal Space", "Axis to bake in red channel");
4967 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
4968
4969 prop = RNA_def_property(srna, "normal_g", PROP_ENUM, PROP_NONE);
4970 RNA_def_property_enum_bitflag_sdna(prop, NULL, "normal_swizzle[1]");
4971 RNA_def_property_enum_items(prop, rna_enum_normal_swizzle_items);
4972 RNA_def_property_ui_text(prop, "Normal Space", "Axis to bake in green channel");
4973 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
4974
4975 prop = RNA_def_property(srna, "normal_b", PROP_ENUM, PROP_NONE);
4976 RNA_def_property_enum_bitflag_sdna(prop, NULL, "normal_swizzle[2]");
4977 RNA_def_property_enum_items(prop, rna_enum_normal_swizzle_items);
4978 RNA_def_property_ui_text(prop, "Normal Space", "Axis to bake in blue channel");
4979 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
4980
4981 prop = RNA_def_property(srna, "image_settings", PROP_POINTER, PROP_NONE);
4982 RNA_def_property_flag(prop, PROP_NEVER_NULL);
4983 RNA_def_property_pointer_sdna(prop, NULL, "im_format");
4984 RNA_def_property_struct_type(prop, "ImageFormatSettings");
4985 RNA_def_property_ui_text(prop, "Image Format", "");
4986
4987 prop = RNA_def_property(srna, "save_mode", PROP_ENUM, PROP_NONE);
4988 RNA_def_property_enum_bitflag_sdna(prop, NULL, "save_mode");
4989 RNA_def_property_enum_items(prop, rna_enum_bake_save_mode_items);
4990 RNA_def_property_ui_text(prop, "Save Mode", "Choose how to save the baking map");
4991 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
4992
4993 /* flags */
4994 prop = RNA_def_property(srna, "use_selected_to_active", PROP_BOOLEAN, PROP_NONE);
4995 RNA_def_property_boolean_sdna(prop, NULL, "flag", R_BAKE_TO_ACTIVE);
4996 RNA_def_property_ui_text(prop,
4997 "Selected to Active",
4998 "Bake shading on the surface of selected objects to the active object");
4999 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5000
5001 prop = RNA_def_property(srna, "use_clear", PROP_BOOLEAN, PROP_NONE);
5002 RNA_def_property_boolean_sdna(prop, NULL, "flag", R_BAKE_CLEAR);
5003 RNA_def_property_ui_text(prop, "Clear", "Clear Images before baking (internal only)");
5004 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5005
5006 prop = RNA_def_property(srna, "use_split_materials", PROP_BOOLEAN, PROP_NONE);
5007 RNA_def_property_boolean_sdna(prop, NULL, "flag", R_BAKE_SPLIT_MAT);
5008 RNA_def_property_ui_text(
5009 prop, "Split Materials", "Split external images per material (external only)");
5010 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5011
5012 prop = RNA_def_property(srna, "use_automatic_name", PROP_BOOLEAN, PROP_NONE);
5013 RNA_def_property_boolean_sdna(prop, NULL, "flag", R_BAKE_AUTO_NAME);
5014 RNA_def_property_ui_text(
5015 prop,
5016 "Automatic Name",
5017 "Automatically name the output file with the pass type (external only)");
5018 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5019
5020 prop = RNA_def_property(srna, "use_cage", PROP_BOOLEAN, PROP_NONE);
5021 RNA_def_property_boolean_sdna(prop, NULL, "flag", R_BAKE_CAGE);
5022 RNA_def_property_ui_text(prop, "Cage", "Cast rays to active object from a cage");
5023 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5024
5025 /* custom passes flags */
5026 prop = RNA_def_property(srna, "use_pass_ambient_occlusion", PROP_BOOLEAN, PROP_NONE);
5027 RNA_def_property_boolean_sdna(prop, NULL, "pass_filter", R_BAKE_PASS_FILTER_AO);
5028 RNA_def_property_ui_text(prop, "Ambient Occlusion", "Add ambient occlusion contribution");
5029
5030 prop = RNA_def_property(srna, "use_pass_emit", PROP_BOOLEAN, PROP_NONE);
5031 RNA_def_property_boolean_sdna(prop, NULL, "pass_filter", R_BAKE_PASS_FILTER_EMIT);
5032 RNA_def_property_ui_text(prop, "Emit", "Add emission contribution");
5033
5034 prop = RNA_def_property(srna, "use_pass_direct", PROP_BOOLEAN, PROP_NONE);
5035 RNA_def_property_boolean_sdna(prop, NULL, "pass_filter", R_BAKE_PASS_FILTER_DIRECT);
5036 RNA_def_property_ui_text(prop, "Direct", "Add direct lighting contribution");
5037 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5038
5039 prop = RNA_def_property(srna, "use_pass_indirect", PROP_BOOLEAN, PROP_NONE);
5040 RNA_def_property_boolean_sdna(prop, NULL, "pass_filter", R_BAKE_PASS_FILTER_INDIRECT);
5041 RNA_def_property_ui_text(prop, "Indirect", "Add indirect lighting contribution");
5042 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5043
5044 prop = RNA_def_property(srna, "use_pass_color", PROP_BOOLEAN, PROP_NONE);
5045 RNA_def_property_boolean_sdna(prop, NULL, "pass_filter", R_BAKE_PASS_FILTER_COLOR);
5046 RNA_def_property_ui_text(prop, "Color", "Color the pass");
5047 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5048
5049 prop = RNA_def_property(srna, "use_pass_diffuse", PROP_BOOLEAN, PROP_NONE);
5050 RNA_def_property_boolean_sdna(prop, NULL, "pass_filter", R_BAKE_PASS_FILTER_DIFFUSE);
5051 RNA_def_property_ui_text(prop, "Diffuse", "Add diffuse contribution");
5052 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5053
5054 prop = RNA_def_property(srna, "use_pass_glossy", PROP_BOOLEAN, PROP_NONE);
5055 RNA_def_property_boolean_sdna(prop, NULL, "pass_filter", R_BAKE_PASS_FILTER_GLOSSY);
5056 RNA_def_property_ui_text(prop, "Glossy", "Add glossy contribution");
5057 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5058
5059 prop = RNA_def_property(srna, "use_pass_transmission", PROP_BOOLEAN, PROP_NONE);
5060 RNA_def_property_boolean_sdna(prop, NULL, "pass_filter", R_BAKE_PASS_FILTER_TRANSM);
5061 RNA_def_property_ui_text(prop, "Transmission", "Add transmission contribution");
5062 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5063
5064 prop = RNA_def_property(srna, "pass_filter", PROP_ENUM, PROP_NONE);
5065 RNA_def_property_enum_sdna(prop, NULL, "pass_filter");
5066 RNA_def_property_enum_items(prop, rna_enum_bake_pass_filter_type_items);
5067 RNA_def_property_flag(prop, PROP_ENUM_FLAG);
5068 RNA_def_property_ui_text(prop, "Pass Filter", "Passes to include in the active baking pass");
5069 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
5070 }
5071
rna_def_view_layers(BlenderRNA * brna,PropertyRNA * cprop)5072 static void rna_def_view_layers(BlenderRNA *brna, PropertyRNA *cprop)
5073 {
5074 StructRNA *srna;
5075 FunctionRNA *func;
5076 PropertyRNA *parm;
5077
5078 RNA_def_property_srna(cprop, "ViewLayers");
5079 srna = RNA_def_struct(brna, "ViewLayers", NULL);
5080 RNA_def_struct_sdna(srna, "Scene");
5081 RNA_def_struct_ui_text(srna, "Render Layers", "Collection of render layers");
5082
5083 func = RNA_def_function(srna, "new", "rna_ViewLayer_new");
5084 RNA_def_function_ui_description(func, "Add a view layer to scene");
5085 RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
5086 parm = RNA_def_string(
5087 func, "name", "ViewLayer", 0, "", "New name for the view layer (not unique)");
5088 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
5089 parm = RNA_def_pointer(func, "result", "ViewLayer", "", "Newly created view layer");
5090 RNA_def_function_return(func, parm);
5091
5092 func = RNA_def_function(srna, "remove", "rna_ViewLayer_remove");
5093 RNA_def_function_ui_description(func, "Remove a view layer");
5094 RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS);
5095 parm = RNA_def_pointer(func, "layer", "ViewLayer", "", "View layer to remove");
5096 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
5097 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
5098 }
5099
5100 /* Render Views - MultiView */
rna_def_scene_render_view(BlenderRNA * brna)5101 static void rna_def_scene_render_view(BlenderRNA *brna)
5102 {
5103 StructRNA *srna;
5104 PropertyRNA *prop;
5105
5106 srna = RNA_def_struct(brna, "SceneRenderView", NULL);
5107 RNA_def_struct_ui_text(
5108 srna, "Scene Render View", "Render viewpoint for 3D stereo and multiview rendering");
5109 RNA_def_struct_ui_icon(srna, ICON_RESTRICT_RENDER_OFF);
5110 RNA_def_struct_path_func(srna, "rna_SceneRenderView_path");
5111
5112 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
5113 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SceneRenderView_name_set");
5114 RNA_def_property_ui_text(prop, "Name", "Render view name");
5115 RNA_def_struct_name_property(srna, prop);
5116 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5117
5118 prop = RNA_def_property(srna, "file_suffix", PROP_STRING, PROP_NONE);
5119 RNA_def_property_string_sdna(prop, NULL, "suffix");
5120 RNA_def_property_ui_text(prop, "File Suffix", "Suffix added to the render images for this view");
5121 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5122
5123 prop = RNA_def_property(srna, "camera_suffix", PROP_STRING, PROP_NONE);
5124 RNA_def_property_string_sdna(prop, NULL, "suffix");
5125 RNA_def_property_ui_text(
5126 prop,
5127 "Camera Suffix",
5128 "Suffix to identify the cameras to use, and added to the render images for this view");
5129 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5130
5131 prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
5132 RNA_def_property_boolean_negative_sdna(prop, NULL, "viewflag", SCE_VIEW_DISABLE);
5133 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
5134 RNA_def_property_ui_text(prop, "Enabled", "Disable or enable the render view");
5135 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5136 }
5137
rna_def_render_views(BlenderRNA * brna,PropertyRNA * cprop)5138 static void rna_def_render_views(BlenderRNA *brna, PropertyRNA *cprop)
5139 {
5140 StructRNA *srna;
5141 PropertyRNA *prop;
5142
5143 FunctionRNA *func;
5144 PropertyRNA *parm;
5145
5146 RNA_def_property_srna(cprop, "RenderViews");
5147 srna = RNA_def_struct(brna, "RenderViews", NULL);
5148 RNA_def_struct_sdna(srna, "RenderData");
5149 RNA_def_struct_ui_text(srna, "Render Views", "Collection of render views");
5150
5151 prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
5152 RNA_def_property_int_sdna(prop, NULL, "actview");
5153 RNA_def_property_int_funcs(prop,
5154 "rna_RenderSettings_active_view_index_get",
5155 "rna_RenderSettings_active_view_index_set",
5156 "rna_RenderSettings_active_view_index_range");
5157 RNA_def_property_ui_text(prop, "Active View Index", "Active index in render view array");
5158 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5159
5160 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
5161 RNA_def_property_struct_type(prop, "SceneRenderView");
5162 RNA_def_property_pointer_funcs(prop,
5163 "rna_RenderSettings_active_view_get",
5164 "rna_RenderSettings_active_view_set",
5165 NULL,
5166 NULL);
5167 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
5168 RNA_def_property_ui_text(prop, "Active Render View", "Active Render View");
5169 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5170
5171 func = RNA_def_function(srna, "new", "rna_RenderView_new");
5172 RNA_def_function_ui_description(func, "Add a render view to scene");
5173 RNA_def_function_flag(func, FUNC_USE_SELF_ID);
5174 parm = RNA_def_string(func, "name", "RenderView", 0, "", "New name for the marker (not unique)");
5175 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
5176 parm = RNA_def_pointer(func, "result", "SceneRenderView", "", "Newly created render view");
5177 RNA_def_function_return(func, parm);
5178
5179 func = RNA_def_function(srna, "remove", "rna_RenderView_remove");
5180 RNA_def_function_ui_description(func, "Remove a render view");
5181 RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
5182 parm = RNA_def_pointer(func, "view", "SceneRenderView", "", "Render view to remove");
5183 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
5184 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
5185 }
5186
rna_def_image_format_stereo3d_format(BlenderRNA * brna)5187 static void rna_def_image_format_stereo3d_format(BlenderRNA *brna)
5188 {
5189 StructRNA *srna;
5190 PropertyRNA *prop;
5191
5192 /* rna_enum_stereo3d_display_items, without (S3D_DISPLAY_PAGEFLIP) */
5193 static const EnumPropertyItem stereo3d_display_items[] = {
5194 {S3D_DISPLAY_ANAGLYPH,
5195 "ANAGLYPH",
5196 0,
5197 "Anaglyph",
5198 "Render views for left and right eyes as two differently filtered colors in a single image "
5199 "(anaglyph glasses are required)"},
5200 {S3D_DISPLAY_INTERLACE,
5201 "INTERLACE",
5202 0,
5203 "Interlace",
5204 "Render views for left and right eyes interlaced in a single image (3D-ready monitor is "
5205 "required)"},
5206 {S3D_DISPLAY_SIDEBYSIDE,
5207 "SIDEBYSIDE",
5208 0,
5209 "Side-by-Side",
5210 "Render views for left and right eyes side-by-side"},
5211 {S3D_DISPLAY_TOPBOTTOM,
5212 "TOPBOTTOM",
5213 0,
5214 "Top-Bottom",
5215 "Render views for left and right eyes one above another"},
5216 {0, NULL, 0, NULL, NULL},
5217 };
5218
5219 srna = RNA_def_struct(brna, "Stereo3dFormat", NULL);
5220 RNA_def_struct_sdna(srna, "Stereo3dFormat");
5221 RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
5222 RNA_def_struct_ui_text(srna, "Stereo Output", "Settings for stereo output");
5223
5224 prop = RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE);
5225 RNA_def_property_enum_sdna(prop, NULL, "display_mode");
5226 RNA_def_property_enum_items(prop, stereo3d_display_items);
5227 RNA_def_property_ui_text(prop, "Stereo Mode", "");
5228 RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Stereo3dFormat_update");
5229
5230 prop = RNA_def_property(srna, "anaglyph_type", PROP_ENUM, PROP_NONE);
5231 RNA_def_property_enum_items(prop, rna_enum_stereo3d_anaglyph_type_items);
5232 RNA_def_property_ui_text(prop, "Anaglyph Type", "");
5233 RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Stereo3dFormat_update");
5234
5235 prop = RNA_def_property(srna, "interlace_type", PROP_ENUM, PROP_NONE);
5236 RNA_def_property_enum_items(prop, rna_enum_stereo3d_interlace_type_items);
5237 RNA_def_property_ui_text(prop, "Interlace Type", "");
5238 RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Stereo3dFormat_update");
5239
5240 prop = RNA_def_property(srna, "use_interlace_swap", PROP_BOOLEAN, PROP_BOOLEAN);
5241 RNA_def_property_boolean_sdna(prop, NULL, "flag", S3D_INTERLACE_SWAP);
5242 RNA_def_property_ui_text(prop, "Swap Left/Right", "Swap left and right stereo channels");
5243 RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Stereo3dFormat_update");
5244
5245 prop = RNA_def_property(srna, "use_sidebyside_crosseyed", PROP_BOOLEAN, PROP_BOOLEAN);
5246 RNA_def_property_boolean_sdna(prop, NULL, "flag", S3D_SIDEBYSIDE_CROSSEYED);
5247 RNA_def_property_ui_text(prop, "Cross-Eyed", "Right eye should see left image and vice-versa");
5248 RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Stereo3dFormat_update");
5249
5250 prop = RNA_def_property(srna, "use_squeezed_frame", PROP_BOOLEAN, PROP_BOOLEAN);
5251 RNA_def_property_boolean_sdna(prop, NULL, "flag", S3D_SQUEEZED_FRAME);
5252 RNA_def_property_ui_text(prop, "Squeezed Frame", "Combine both views in a squeezed image");
5253 RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Stereo3dFormat_update");
5254 }
5255
5256 /* use for render output and image save operator,
5257 * note: there are some cases where the members act differently when this is
5258 * used from a scene, video formats can only be selected for render output
5259 * for example, this is checked by seeing if the ptr->owner_id is a Scene id */
5260
rna_def_scene_image_format_data(BlenderRNA * brna)5261 static void rna_def_scene_image_format_data(BlenderRNA *brna)
5262 {
5263
5264 # ifdef WITH_OPENJPEG
5265 static const EnumPropertyItem jp2_codec_items[] = {
5266 {R_IMF_JP2_CODEC_JP2, "JP2", 0, "JP2", ""},
5267 {R_IMF_JP2_CODEC_J2K, "J2K", 0, "J2K", ""},
5268 {0, NULL, 0, NULL, NULL},
5269 };
5270 # endif
5271
5272 # ifdef WITH_TIFF
5273 static const EnumPropertyItem tiff_codec_items[] = {
5274 {R_IMF_TIFF_CODEC_NONE, "NONE", 0, "None", ""},
5275 {R_IMF_TIFF_CODEC_DEFLATE, "DEFLATE", 0, "Deflate", ""},
5276 {R_IMF_TIFF_CODEC_LZW, "LZW", 0, "LZW", ""},
5277 {R_IMF_TIFF_CODEC_PACKBITS, "PACKBITS", 0, "Pack Bits", ""},
5278 {0, NULL, 0, NULL, NULL},
5279 };
5280 # endif
5281
5282 StructRNA *srna;
5283 PropertyRNA *prop;
5284
5285 rna_def_image_format_stereo3d_format(brna);
5286
5287 srna = RNA_def_struct(brna, "ImageFormatSettings", NULL);
5288 RNA_def_struct_sdna(srna, "ImageFormatData");
5289 RNA_def_struct_nested(brna, srna, "Scene");
5290 RNA_def_struct_path_func(srna, "rna_ImageFormatSettings_path");
5291 RNA_def_struct_ui_text(srna, "Image Format", "Settings for image formats");
5292
5293 prop = RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE);
5294 RNA_def_property_enum_sdna(prop, NULL, "imtype");
5295 RNA_def_property_enum_items(prop, rna_enum_image_type_items);
5296 RNA_def_property_enum_funcs(prop,
5297 NULL,
5298 "rna_ImageFormatSettings_file_format_set",
5299 "rna_ImageFormatSettings_file_format_itemf");
5300 RNA_def_property_ui_text(prop, "File Format", "File format to save the rendered images as");
5301 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5302
5303 prop = RNA_def_property(srna, "color_mode", PROP_ENUM, PROP_NONE);
5304 RNA_def_property_enum_bitflag_sdna(prop, NULL, "planes");
5305 RNA_def_property_enum_items(prop, rna_enum_image_color_mode_items);
5306 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_ImageFormatSettings_color_mode_itemf");
5307 RNA_def_property_ui_text(
5308 prop,
5309 "Color Mode",
5310 "Choose BW for saving grayscale images, RGB for saving red, green and blue channels, "
5311 "and RGBA for saving red, green, blue and alpha channels");
5312 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5313
5314 prop = RNA_def_property(srna, "color_depth", PROP_ENUM, PROP_NONE);
5315 RNA_def_property_enum_bitflag_sdna(prop, NULL, "depth");
5316 RNA_def_property_enum_items(prop, rna_enum_image_color_depth_items);
5317 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_ImageFormatSettings_color_depth_itemf");
5318 RNA_def_property_ui_text(prop, "Color Depth", "Bit depth per channel");
5319 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5320
5321 /* was 'file_quality' */
5322 prop = RNA_def_property(srna, "quality", PROP_INT, PROP_PERCENTAGE);
5323 RNA_def_property_int_sdna(prop, NULL, "quality");
5324 RNA_def_property_range(prop, 0, 100); /* 0 is needed for compression. */
5325 RNA_def_property_ui_text(
5326 prop, "Quality", "Quality for image formats that support lossy compression");
5327 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5328
5329 /* was shared with file_quality */
5330 prop = RNA_def_property(srna, "compression", PROP_INT, PROP_PERCENTAGE);
5331 RNA_def_property_int_sdna(prop, NULL, "compress");
5332 RNA_def_property_range(prop, 0, 100); /* 0 is needed for compression. */
5333 RNA_def_property_ui_text(prop,
5334 "Compression",
5335 "Amount of time to determine best compression: "
5336 "0 = no compression with fast file output, "
5337 "100 = maximum lossless compression with slow file output");
5338 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5339
5340 /* flag */
5341 prop = RNA_def_property(srna, "use_zbuffer", PROP_BOOLEAN, PROP_NONE);
5342 RNA_def_property_boolean_sdna(prop, NULL, "flag", R_IMF_FLAG_ZBUF);
5343 RNA_def_property_ui_text(
5344 prop, "Z Buffer", "Save the z-depth per pixel (32 bit unsigned int z-buffer)");
5345 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5346
5347 prop = RNA_def_property(srna, "use_preview", PROP_BOOLEAN, PROP_NONE);
5348 RNA_def_property_boolean_sdna(prop, NULL, "flag", R_IMF_FLAG_PREVIEW_JPG);
5349 RNA_def_property_ui_text(
5350 prop, "Preview", "When rendering animations, save JPG preview images in same directory");
5351 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5352
5353 /* format specific */
5354
5355 # ifdef WITH_OPENEXR
5356 /* OpenEXR */
5357
5358 prop = RNA_def_property(srna, "exr_codec", PROP_ENUM, PROP_NONE);
5359 RNA_def_property_enum_sdna(prop, NULL, "exr_codec");
5360 RNA_def_property_enum_items(prop, rna_enum_exr_codec_items);
5361 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_ImageFormatSettings_exr_codec_itemf");
5362 RNA_def_property_ui_text(prop, "Codec", "Codec settings for OpenEXR");
5363 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5364 # endif
5365
5366 # ifdef WITH_OPENJPEG
5367 /* Jpeg 2000 */
5368 prop = RNA_def_property(srna, "use_jpeg2k_ycc", PROP_BOOLEAN, PROP_NONE);
5369 RNA_def_property_boolean_sdna(prop, NULL, "jp2_flag", R_IMF_JP2_FLAG_YCC);
5370 RNA_def_property_ui_text(
5371 prop, "YCC", "Save luminance-chrominance-chrominance channels instead of RGB colors");
5372 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5373
5374 prop = RNA_def_property(srna, "use_jpeg2k_cinema_preset", PROP_BOOLEAN, PROP_NONE);
5375 RNA_def_property_boolean_sdna(prop, NULL, "jp2_flag", R_IMF_JP2_FLAG_CINE_PRESET);
5376 RNA_def_property_ui_text(prop, "Cinema", "Use Openjpeg Cinema Preset");
5377 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5378
5379 prop = RNA_def_property(srna, "use_jpeg2k_cinema_48", PROP_BOOLEAN, PROP_NONE);
5380 RNA_def_property_boolean_sdna(prop, NULL, "jp2_flag", R_IMF_JP2_FLAG_CINE_48);
5381 RNA_def_property_ui_text(prop, "Cinema (48)", "Use Openjpeg Cinema Preset (48fps)");
5382 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5383
5384 prop = RNA_def_property(srna, "jpeg2k_codec", PROP_ENUM, PROP_NONE);
5385 RNA_def_property_enum_sdna(prop, NULL, "jp2_codec");
5386 RNA_def_property_enum_items(prop, jp2_codec_items);
5387 RNA_def_property_ui_text(prop, "Codec", "Codec settings for Jpeg2000");
5388 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5389 # endif
5390
5391 # ifdef WITH_TIFF
5392 /* TIFF */
5393 prop = RNA_def_property(srna, "tiff_codec", PROP_ENUM, PROP_NONE);
5394 RNA_def_property_enum_sdna(prop, NULL, "tiff_codec");
5395 RNA_def_property_enum_items(prop, tiff_codec_items);
5396 RNA_def_property_ui_text(prop, "Compression", "Compression mode for TIFF");
5397 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5398 # endif
5399
5400 /* Cineon and DPX */
5401
5402 prop = RNA_def_property(srna, "use_cineon_log", PROP_BOOLEAN, PROP_NONE);
5403 RNA_def_property_boolean_sdna(prop, NULL, "cineon_flag", R_IMF_CINEON_FLAG_LOG);
5404 RNA_def_property_ui_text(prop, "Log", "Convert to logarithmic color space");
5405 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5406
5407 prop = RNA_def_property(srna, "cineon_black", PROP_INT, PROP_NONE);
5408 RNA_def_property_int_sdna(prop, NULL, "cineon_black");
5409 RNA_def_property_range(prop, 0, 1024);
5410 RNA_def_property_ui_text(prop, "B", "Log conversion reference blackpoint");
5411 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5412
5413 prop = RNA_def_property(srna, "cineon_white", PROP_INT, PROP_NONE);
5414 RNA_def_property_int_sdna(prop, NULL, "cineon_white");
5415 RNA_def_property_range(prop, 0, 1024);
5416 RNA_def_property_ui_text(prop, "W", "Log conversion reference whitepoint");
5417 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5418
5419 prop = RNA_def_property(srna, "cineon_gamma", PROP_FLOAT, PROP_NONE);
5420 RNA_def_property_float_sdna(prop, NULL, "cineon_gamma");
5421 RNA_def_property_range(prop, 0.0f, 10.0f);
5422 RNA_def_property_ui_text(prop, "G", "Log conversion gamma");
5423 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5424
5425 /* multiview */
5426 prop = RNA_def_property(srna, "views_format", PROP_ENUM, PROP_NONE);
5427 RNA_def_property_enum_sdna(prop, NULL, "views_format");
5428 RNA_def_property_enum_items(prop, rna_enum_views_format_items);
5429 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_ImageFormatSettings_views_format_itemf");
5430 RNA_def_property_ui_text(prop, "Views Format", "Format of multiview media");
5431 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5432
5433 prop = RNA_def_property(srna, "stereo_3d_format", PROP_POINTER, PROP_NONE);
5434 RNA_def_property_pointer_sdna(prop, NULL, "stereo3d_format");
5435 RNA_def_property_flag(prop, PROP_NEVER_NULL);
5436 RNA_def_property_struct_type(prop, "Stereo3dFormat");
5437 RNA_def_property_ui_text(prop, "Stereo 3D Format", "Settings for stereo 3d");
5438
5439 /* color management */
5440 prop = RNA_def_property(srna, "view_settings", PROP_POINTER, PROP_NONE);
5441 RNA_def_property_pointer_sdna(prop, NULL, "view_settings");
5442 RNA_def_property_struct_type(prop, "ColorManagedViewSettings");
5443 RNA_def_property_ui_text(
5444 prop, "View Settings", "Color management settings applied on image before saving");
5445
5446 prop = RNA_def_property(srna, "display_settings", PROP_POINTER, PROP_NONE);
5447 RNA_def_property_pointer_sdna(prop, NULL, "display_settings");
5448 RNA_def_property_struct_type(prop, "ColorManagedDisplaySettings");
5449 RNA_def_property_ui_text(
5450 prop, "Display Settings", "Settings of device saved image would be displayed on");
5451 }
5452
rna_def_scene_ffmpeg_settings(BlenderRNA * brna)5453 static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna)
5454 {
5455 StructRNA *srna;
5456 PropertyRNA *prop;
5457
5458 # ifdef WITH_FFMPEG
5459 /* Container types */
5460 static const EnumPropertyItem ffmpeg_format_items[] = {
5461 {FFMPEG_MPEG1, "MPEG1", 0, "MPEG-1", ""},
5462 {FFMPEG_MPEG2, "MPEG2", 0, "MPEG-2", ""},
5463 {FFMPEG_MPEG4, "MPEG4", 0, "MPEG-4", ""},
5464 {FFMPEG_AVI, "AVI", 0, "AVI", ""},
5465 {FFMPEG_MOV, "QUICKTIME", 0, "Quicktime", ""},
5466 {FFMPEG_DV, "DV", 0, "DV", ""},
5467 {FFMPEG_OGG, "OGG", 0, "Ogg", ""},
5468 {FFMPEG_MKV, "MKV", 0, "Matroska", ""},
5469 {FFMPEG_FLV, "FLASH", 0, "Flash", ""},
5470 {FFMPEG_WEBM, "WEBM", 0, "WebM", ""},
5471 {0, NULL, 0, NULL, NULL},
5472 };
5473
5474 static const EnumPropertyItem ffmpeg_codec_items[] = {
5475 {AV_CODEC_ID_NONE, "NONE", 0, "No Video", "Disables video output, for audio-only renders"},
5476 {AV_CODEC_ID_DNXHD, "DNXHD", 0, "DNxHD", ""},
5477 {AV_CODEC_ID_DVVIDEO, "DV", 0, "DV", ""},
5478 {AV_CODEC_ID_FFV1, "FFV1", 0, "FFmpeg video codec #1", ""},
5479 {AV_CODEC_ID_FLV1, "FLASH", 0, "Flash Video", ""},
5480 {AV_CODEC_ID_H264, "H264", 0, "H.264", ""},
5481 {AV_CODEC_ID_HUFFYUV, "HUFFYUV", 0, "HuffYUV", ""},
5482 {AV_CODEC_ID_MPEG1VIDEO, "MPEG1", 0, "MPEG-1", ""},
5483 {AV_CODEC_ID_MPEG2VIDEO, "MPEG2", 0, "MPEG-2", ""},
5484 {AV_CODEC_ID_MPEG4, "MPEG4", 0, "MPEG-4 (divx)", ""},
5485 {AV_CODEC_ID_PNG, "PNG", 0, "PNG", ""},
5486 {AV_CODEC_ID_QTRLE, "QTRLE", 0, "QT rle / QT Animation", ""},
5487 {AV_CODEC_ID_THEORA, "THEORA", 0, "Theora", ""},
5488 {AV_CODEC_ID_VP9, "WEBM", 0, "WEBM / VP9", ""},
5489 {0, NULL, 0, NULL, NULL},
5490 };
5491
5492 /* Recommendations come from the FFmpeg wiki, https://trac.ffmpeg.org/wiki/Encode/VP9.
5493 * The label for BEST has been changed to "Slowest" so that it fits the "Encoding Speed"
5494 * property label in the UI. */
5495 static const EnumPropertyItem ffmpeg_preset_items[] = {
5496 {FFM_PRESET_BEST,
5497 "BEST",
5498 0,
5499 "Slowest",
5500 "Recommended if you have lots of time and want the best compression efficiency"},
5501 {FFM_PRESET_GOOD, "GOOD", 0, "Good", "The default and recommended for most applications"},
5502 {FFM_PRESET_REALTIME, "REALTIME", 0, "Realtime", "Recommended for fast encoding"},
5503 {0, NULL, 0, NULL, NULL},
5504 };
5505
5506 static const EnumPropertyItem ffmpeg_crf_items[] = {
5507 {FFM_CRF_NONE,
5508 "NONE",
5509 0,
5510 "Constant Bitrate",
5511 "Configure constant bit rate, rather than constant output quality"},
5512 {FFM_CRF_LOSSLESS, "LOSSLESS", 0, "Lossless", ""},
5513 {FFM_CRF_PERC_LOSSLESS, "PERC_LOSSLESS", 0, "Perceptually lossless", ""},
5514 {FFM_CRF_HIGH, "HIGH", 0, "High quality", ""},
5515 {FFM_CRF_MEDIUM, "MEDIUM", 0, "Medium quality", ""},
5516 {FFM_CRF_LOW, "LOW", 0, "Low quality", ""},
5517 {FFM_CRF_VERYLOW, "VERYLOW", 0, "Very low quality", ""},
5518 {FFM_CRF_LOWEST, "LOWEST", 0, "Lowest quality", ""},
5519 {0, NULL, 0, NULL, NULL},
5520 };
5521
5522 static const EnumPropertyItem ffmpeg_audio_codec_items[] = {
5523 {AV_CODEC_ID_NONE, "NONE", 0, "No Audio", "Disables audio output, for video-only renders"},
5524 {AV_CODEC_ID_AAC, "AAC", 0, "AAC", ""},
5525 {AV_CODEC_ID_AC3, "AC3", 0, "AC3", ""},
5526 {AV_CODEC_ID_FLAC, "FLAC", 0, "FLAC", ""},
5527 {AV_CODEC_ID_MP2, "MP2", 0, "MP2", ""},
5528 {AV_CODEC_ID_MP3, "MP3", 0, "MP3", ""},
5529 {AV_CODEC_ID_OPUS, "OPUS", 0, "Opus", ""},
5530 {AV_CODEC_ID_PCM_S16LE, "PCM", 0, "PCM", ""},
5531 {AV_CODEC_ID_VORBIS, "VORBIS", 0, "Vorbis", ""},
5532 {0, NULL, 0, NULL, NULL},
5533 };
5534 # endif
5535
5536 static const EnumPropertyItem audio_channel_items[] = {
5537 {FFM_CHANNELS_MONO, "MONO", 0, "Mono", "Set audio channels to mono"},
5538 {FFM_CHANNELS_STEREO, "STEREO", 0, "Stereo", "Set audio channels to stereo"},
5539 {FFM_CHANNELS_SURROUND4, "SURROUND4", 0, "4 Channels", "Set audio channels to 4 channels"},
5540 {FFM_CHANNELS_SURROUND51,
5541 "SURROUND51",
5542 0,
5543 "5.1 Surround",
5544 "Set audio channels to 5.1 surround sound"},
5545 {FFM_CHANNELS_SURROUND71,
5546 "SURROUND71",
5547 0,
5548 "7.1 Surround",
5549 "Set audio channels to 7.1 surround sound"},
5550 {0, NULL, 0, NULL, NULL},
5551 };
5552
5553 srna = RNA_def_struct(brna, "FFmpegSettings", NULL);
5554 RNA_def_struct_sdna(srna, "FFMpegCodecData");
5555 RNA_def_struct_path_func(srna, "rna_FFmpegSettings_path");
5556 RNA_def_struct_ui_text(srna, "FFmpeg Settings", "FFmpeg related settings for the scene");
5557
5558 # ifdef WITH_FFMPEG
5559 prop = RNA_def_property(srna, "format", PROP_ENUM, PROP_NONE);
5560 RNA_def_property_enum_bitflag_sdna(prop, NULL, "type");
5561 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
5562 RNA_def_property_enum_items(prop, ffmpeg_format_items);
5563 RNA_def_property_enum_default(prop, FFMPEG_MKV);
5564 RNA_def_property_ui_text(prop, "Container", "Output file container");
5565 RNA_def_property_update(
5566 prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_FFmpegSettings_codec_settings_update");
5567
5568 prop = RNA_def_property(srna, "codec", PROP_ENUM, PROP_NONE);
5569 RNA_def_property_enum_bitflag_sdna(prop, NULL, "codec");
5570 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
5571 RNA_def_property_enum_items(prop, ffmpeg_codec_items);
5572 RNA_def_property_enum_default(prop, AV_CODEC_ID_H264);
5573 RNA_def_property_ui_text(prop, "Video Codec", "FFmpeg codec to use for video output");
5574 RNA_def_property_update(
5575 prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_FFmpegSettings_codec_settings_update");
5576
5577 prop = RNA_def_property(srna, "video_bitrate", PROP_INT, PROP_NONE);
5578 RNA_def_property_int_sdna(prop, NULL, "video_bitrate");
5579 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
5580 RNA_def_property_ui_text(prop, "Bitrate", "Video bitrate (kb/s)");
5581 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5582
5583 prop = RNA_def_property(srna, "minrate", PROP_INT, PROP_NONE);
5584 RNA_def_property_int_sdna(prop, NULL, "rc_min_rate");
5585 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
5586 RNA_def_property_ui_text(prop, "Min Rate", "Rate control: min rate (kb/s)");
5587 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5588
5589 prop = RNA_def_property(srna, "maxrate", PROP_INT, PROP_NONE);
5590 RNA_def_property_int_sdna(prop, NULL, "rc_max_rate");
5591 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
5592 RNA_def_property_ui_text(prop, "Max Rate", "Rate control: max rate (kb/s)");
5593 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5594
5595 prop = RNA_def_property(srna, "muxrate", PROP_INT, PROP_NONE);
5596 RNA_def_property_int_sdna(prop, NULL, "mux_rate");
5597 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
5598 RNA_def_property_range(prop, 0, 100000000);
5599 RNA_def_property_ui_text(prop, "Mux Rate", "Mux rate (bits/s(!))");
5600 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5601
5602 prop = RNA_def_property(srna, "gopsize", PROP_INT, PROP_NONE);
5603 RNA_def_property_int_sdna(prop, NULL, "gop_size");
5604 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
5605 RNA_def_property_range(prop, 0, 500);
5606 RNA_def_property_int_default(prop, 25);
5607 RNA_def_property_ui_text(prop,
5608 "Keyframe Interval",
5609 "Distance between key frames, also known as GOP size; "
5610 "influences file size and seekability");
5611 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5612
5613 prop = RNA_def_property(srna, "max_b_frames", PROP_INT, PROP_NONE);
5614 RNA_def_property_int_sdna(prop, NULL, "max_b_frames");
5615 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
5616 RNA_def_property_range(prop, 0, 16);
5617 RNA_def_property_ui_text(
5618 prop,
5619 "Max B-Frames",
5620 "Maximum number of B-frames between non-B-frames; influences file size and seekability");
5621 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5622
5623 prop = RNA_def_property(srna, "use_max_b_frames", PROP_BOOLEAN, PROP_NONE);
5624 RNA_def_property_boolean_sdna(prop, NULL, "flags", FFMPEG_USE_MAX_B_FRAMES);
5625 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
5626 RNA_def_property_ui_text(prop, "Use Max B-Frames", "Set a maximum number of B-frames");
5627 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5628
5629 prop = RNA_def_property(srna, "buffersize", PROP_INT, PROP_NONE);
5630 RNA_def_property_int_sdna(prop, NULL, "rc_buffer_size");
5631 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
5632 RNA_def_property_range(prop, 0, 2000);
5633 RNA_def_property_ui_text(prop, "Buffersize", "Rate control: buffer size (kb)");
5634 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5635
5636 prop = RNA_def_property(srna, "packetsize", PROP_INT, PROP_NONE);
5637 RNA_def_property_int_sdna(prop, NULL, "mux_packet_size");
5638 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
5639 RNA_def_property_range(prop, 0, 16384);
5640 RNA_def_property_ui_text(prop, "Mux Packet Size", "Mux packet size (byte)");
5641 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5642
5643 prop = RNA_def_property(srna, "constant_rate_factor", PROP_ENUM, PROP_NONE);
5644 RNA_def_property_enum_sdna(prop, NULL, "constant_rate_factor");
5645 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
5646 RNA_def_property_enum_items(prop, ffmpeg_crf_items);
5647 RNA_def_property_enum_default(prop, FFM_CRF_MEDIUM);
5648 RNA_def_property_ui_text(
5649 prop,
5650 "Output Quality",
5651 "Constant Rate Factor (CRF); tradeoff between video quality and file size");
5652 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5653
5654 prop = RNA_def_property(srna, "ffmpeg_preset", PROP_ENUM, PROP_NONE);
5655 RNA_def_property_enum_bitflag_sdna(prop, NULL, "ffmpeg_preset");
5656 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
5657 RNA_def_property_enum_items(prop, ffmpeg_preset_items);
5658 RNA_def_property_enum_default(prop, FFM_PRESET_GOOD);
5659 RNA_def_property_ui_text(
5660 prop, "Encoding Speed", "Tradeoff between encoding speed and compression ratio");
5661 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5662
5663 prop = RNA_def_property(srna, "use_autosplit", PROP_BOOLEAN, PROP_NONE);
5664 RNA_def_property_boolean_sdna(prop, NULL, "flags", FFMPEG_AUTOSPLIT_OUTPUT);
5665 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
5666 RNA_def_property_ui_text(prop, "Autosplit Output", "Autosplit output at 2GB boundary");
5667 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5668
5669 prop = RNA_def_property(srna, "use_lossless_output", PROP_BOOLEAN, PROP_NONE);
5670 RNA_def_property_boolean_sdna(prop, NULL, "flags", FFMPEG_LOSSLESS_OUTPUT);
5671 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
5672 RNA_def_property_boolean_funcs(prop, NULL, "rna_FFmpegSettings_lossless_output_set");
5673 RNA_def_property_ui_text(prop, "Lossless Output", "Use lossless output for video streams");
5674 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5675
5676 /* FFMPEG Audio*/
5677 prop = RNA_def_property(srna, "audio_codec", PROP_ENUM, PROP_NONE);
5678 RNA_def_property_enum_bitflag_sdna(prop, NULL, "audio_codec");
5679 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
5680 RNA_def_property_enum_items(prop, ffmpeg_audio_codec_items);
5681 RNA_def_property_ui_text(prop, "Audio Codec", "FFmpeg audio codec to use");
5682 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5683
5684 prop = RNA_def_property(srna, "audio_bitrate", PROP_INT, PROP_NONE);
5685 RNA_def_property_int_sdna(prop, NULL, "audio_bitrate");
5686 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
5687 RNA_def_property_range(prop, 32, 384);
5688 RNA_def_property_ui_text(prop, "Bitrate", "Audio bitrate (kb/s)");
5689 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5690
5691 prop = RNA_def_property(srna, "audio_volume", PROP_FLOAT, PROP_NONE);
5692 RNA_def_property_float_sdna(prop, NULL, "audio_volume");
5693 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
5694 RNA_def_property_range(prop, 0.0f, 1.0f);
5695 RNA_def_property_ui_text(prop, "Volume", "Audio volume");
5696 RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND);
5697 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5698 # endif
5699
5700 /* the following two "ffmpeg" settings are general audio settings */
5701 prop = RNA_def_property(srna, "audio_mixrate", PROP_INT, PROP_NONE);
5702 RNA_def_property_int_sdna(prop, NULL, "audio_mixrate");
5703 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
5704 RNA_def_property_range(prop, 8000, 192000);
5705 RNA_def_property_ui_text(prop, "Samplerate", "Audio samplerate(samples/s)");
5706 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5707
5708 prop = RNA_def_property(srna, "audio_channels", PROP_ENUM, PROP_NONE);
5709 RNA_def_property_enum_sdna(prop, NULL, "audio_channels");
5710 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
5711 RNA_def_property_enum_items(prop, audio_channel_items);
5712 RNA_def_property_ui_text(prop, "Audio Channels", "Audio channel count");
5713 }
5714
rna_def_scene_render_data(BlenderRNA * brna)5715 static void rna_def_scene_render_data(BlenderRNA *brna)
5716 {
5717 StructRNA *srna;
5718 PropertyRNA *prop;
5719
5720 /* Bake */
5721 static const EnumPropertyItem bake_mode_items[] = {
5722 //{RE_BAKE_AO, "AO", 0, "Ambient Occlusion", "Bake ambient occlusion"},
5723 {RE_BAKE_NORMALS, "NORMALS", 0, "Normals", "Bake normals"},
5724 {RE_BAKE_DISPLACEMENT, "DISPLACEMENT", 0, "Displacement", "Bake displacement"},
5725 {0, NULL, 0, NULL, NULL},
5726 };
5727
5728 static const EnumPropertyItem pixel_size_items[] = {
5729 {0, "AUTO", 0, "Automatic", "Automatic pixel size, depends on the user interface scale"},
5730 {1, "1", 0, "1x", "Render at full resolution"},
5731 {2, "2", 0, "2x", "Render at 50% resolution"},
5732 {4, "4", 0, "4x", "Render at 25% resolution"},
5733 {8, "8", 0, "8x", "Render at 12.5% resolution"},
5734 {0, NULL, 0, NULL, NULL},
5735 };
5736
5737 static const EnumPropertyItem threads_mode_items[] = {
5738 {0,
5739 "AUTO",
5740 0,
5741 "Auto-detect",
5742 "Automatically determine the number of threads, based on CPUs"},
5743 {R_FIXED_THREADS, "FIXED", 0, "Fixed", "Manually determine the number of threads"},
5744 {0, NULL, 0, NULL, NULL},
5745 };
5746
5747 static const EnumPropertyItem engine_items[] = {
5748 {0, "BLENDER_EEVEE", 0, "Eevee", ""},
5749 {0, NULL, 0, NULL, NULL},
5750 };
5751
5752 static const EnumPropertyItem freestyle_thickness_items[] = {
5753 {R_LINE_THICKNESS_ABSOLUTE,
5754 "ABSOLUTE",
5755 0,
5756 "Absolute",
5757 "Specify unit line thickness in pixels"},
5758 {R_LINE_THICKNESS_RELATIVE,
5759 "RELATIVE",
5760 0,
5761 "Relative",
5762 "Unit line thickness is scaled by the proportion of the present vertical image "
5763 "resolution to 480 pixels"},
5764 {0, NULL, 0, NULL, NULL},
5765 };
5766
5767 static const EnumPropertyItem views_format_items[] = {
5768 {SCE_VIEWS_FORMAT_STEREO_3D,
5769 "STEREO_3D",
5770 0,
5771 "Stereo 3D",
5772 "Single stereo camera system, adjust the stereo settings in the camera panel"},
5773 {SCE_VIEWS_FORMAT_MULTIVIEW,
5774 "MULTIVIEW",
5775 0,
5776 "Multi-View",
5777 "Multi camera system, adjust the cameras individually"},
5778 {0, NULL, 0, NULL, NULL},
5779 };
5780
5781 static const EnumPropertyItem hair_shape_type_items[] = {
5782 {SCE_HAIR_SHAPE_STRAND, "STRAND", 0, "Strand", ""},
5783 {SCE_HAIR_SHAPE_STRIP, "STRIP", 0, "Strip", ""},
5784 {0, NULL, 0, NULL, NULL},
5785 };
5786
5787 static const EnumPropertyItem meta_input_items[] = {
5788 {0, "SCENE", 0, "Scene", "Use metadata from the current scene"},
5789 {R_STAMP_STRIPMETA,
5790 "STRIPS",
5791 0,
5792 "Sequencer Strips",
5793 "Use metadata from the strips in the sequencer"},
5794 {0, NULL, 0, NULL, NULL},
5795 };
5796
5797 rna_def_scene_ffmpeg_settings(brna);
5798
5799 srna = RNA_def_struct(brna, "RenderSettings", NULL);
5800 RNA_def_struct_sdna(srna, "RenderData");
5801 RNA_def_struct_nested(brna, srna, "Scene");
5802 RNA_def_struct_path_func(srna, "rna_RenderSettings_path");
5803 RNA_def_struct_ui_text(srna, "Render Data", "Rendering settings for a Scene data-block");
5804
5805 /* Render Data */
5806 prop = RNA_def_property(srna, "image_settings", PROP_POINTER, PROP_NONE);
5807 RNA_def_property_flag(prop, PROP_NEVER_NULL);
5808 RNA_def_property_pointer_sdna(prop, NULL, "im_format");
5809 RNA_def_property_struct_type(prop, "ImageFormatSettings");
5810 RNA_def_property_ui_text(prop, "Image Format", "");
5811
5812 prop = RNA_def_property(srna, "resolution_x", PROP_INT, PROP_PIXEL);
5813 RNA_def_property_int_sdna(prop, NULL, "xsch");
5814 RNA_def_property_flag(prop, PROP_PROPORTIONAL);
5815 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
5816 RNA_def_property_range(prop, 4, 65536);
5817 RNA_def_property_ui_text(
5818 prop, "Resolution X", "Number of horizontal pixels in the rendered image");
5819 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneCamera_update");
5820
5821 prop = RNA_def_property(srna, "resolution_y", PROP_INT, PROP_PIXEL);
5822 RNA_def_property_int_sdna(prop, NULL, "ysch");
5823 RNA_def_property_flag(prop, PROP_PROPORTIONAL);
5824 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
5825 RNA_def_property_range(prop, 4, 65536);
5826 RNA_def_property_ui_text(
5827 prop, "Resolution Y", "Number of vertical pixels in the rendered image");
5828 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneCamera_update");
5829
5830 prop = RNA_def_property(srna, "resolution_percentage", PROP_INT, PROP_PERCENTAGE);
5831 RNA_def_property_int_sdna(prop, NULL, "size");
5832 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
5833 RNA_def_property_range(prop, 1, SHRT_MAX);
5834 RNA_def_property_ui_range(prop, 1, 100, 10, 1);
5835 RNA_def_property_ui_text(prop, "Resolution %", "Percentage scale for render resolution");
5836 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneSequencer_update");
5837
5838 prop = RNA_def_property(srna, "tile_x", PROP_INT, PROP_PIXEL);
5839 RNA_def_property_int_sdna(prop, NULL, "tilex");
5840 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
5841 RNA_def_property_range(prop, 8, 65536);
5842 RNA_def_property_ui_text(prop, "Tile X", "Horizontal tile size to use while rendering");
5843 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5844
5845 prop = RNA_def_property(srna, "tile_y", PROP_INT, PROP_PIXEL);
5846 RNA_def_property_int_sdna(prop, NULL, "tiley");
5847 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
5848 RNA_def_property_range(prop, 8, 65536);
5849 RNA_def_property_ui_text(prop, "Tile Y", "Vertical tile size to use while rendering");
5850 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5851
5852 prop = RNA_def_property(srna, "preview_start_resolution", PROP_INT, PROP_NONE);
5853 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
5854 RNA_def_property_range(prop, 8, 16384);
5855 RNA_def_property_ui_text(prop,
5856 "Start Resolution",
5857 "Resolution to start rendering preview at, "
5858 "progressively increasing it to the full viewport size");
5859 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5860
5861 prop = RNA_def_property(srna, "preview_pixel_size", PROP_ENUM, PROP_NONE);
5862 RNA_def_property_enum_sdna(prop, NULL, "preview_pixel_size");
5863 RNA_def_property_enum_items(prop, pixel_size_items);
5864 RNA_def_property_ui_text(prop, "Pixel Size", "Pixel size for viewport rendering");
5865 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5866
5867 prop = RNA_def_property(srna, "pixel_aspect_x", PROP_FLOAT, PROP_NONE);
5868 RNA_def_property_float_sdna(prop, NULL, "xasp");
5869 RNA_def_property_flag(prop, PROP_PROPORTIONAL);
5870 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
5871 RNA_def_property_range(prop, 1.0f, 200.0f);
5872 RNA_def_property_ui_text(prop,
5873 "Pixel Aspect X",
5874 "Horizontal aspect ratio - for anamorphic or non-square pixel output");
5875 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneCamera_update");
5876
5877 prop = RNA_def_property(srna, "pixel_aspect_y", PROP_FLOAT, PROP_NONE);
5878 RNA_def_property_float_sdna(prop, NULL, "yasp");
5879 RNA_def_property_flag(prop, PROP_PROPORTIONAL);
5880 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
5881 RNA_def_property_range(prop, 1.0f, 200.0f);
5882 RNA_def_property_ui_text(
5883 prop, "Pixel Aspect Y", "Vertical aspect ratio - for anamorphic or non-square pixel output");
5884 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneCamera_update");
5885
5886 prop = RNA_def_property(srna, "ffmpeg", PROP_POINTER, PROP_NONE);
5887 RNA_def_property_struct_type(prop, "FFmpegSettings");
5888 RNA_def_property_pointer_sdna(prop, NULL, "ffcodecdata");
5889 RNA_def_property_flag(prop, PROP_NEVER_UNLINK);
5890 RNA_def_property_ui_text(prop, "FFmpeg Settings", "FFmpeg related settings for the scene");
5891
5892 prop = RNA_def_property(srna, "fps", PROP_INT, PROP_NONE);
5893 RNA_def_property_int_sdna(prop, NULL, "frs_sec");
5894 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
5895 RNA_def_property_range(prop, 1, SHRT_MAX);
5896 RNA_def_property_ui_range(prop, 1, 120, 1, -1);
5897 RNA_def_property_ui_text(prop, "FPS", "Framerate, expressed in frames per second");
5898 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_fps_update");
5899
5900 prop = RNA_def_property(srna, "fps_base", PROP_FLOAT, PROP_NONE);
5901 RNA_def_property_float_sdna(prop, NULL, "frs_sec_base");
5902 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
5903 RNA_def_property_range(prop, 1e-5f, 1e6f);
5904 /* Important to show at least 3 decimal points because multiple presets set this to 1.001. */
5905 RNA_def_property_ui_range(prop, 0.1f, 120.0f, 2, 3);
5906 RNA_def_property_ui_text(prop, "FPS Base", "Framerate base");
5907 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_fps_update");
5908
5909 /* frame mapping */
5910 prop = RNA_def_property(srna, "frame_map_old", PROP_INT, PROP_NONE);
5911 RNA_def_property_int_sdna(prop, NULL, "framapto");
5912 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
5913 RNA_def_property_range(prop, 1, 900);
5914 RNA_def_property_ui_text(prop, "Frame Map Old", "Old mapping value in frames");
5915 RNA_def_property_update(prop, NC_SCENE | ND_FRAME, "rna_Scene_framelen_update");
5916
5917 prop = RNA_def_property(srna, "frame_map_new", PROP_INT, PROP_NONE);
5918 RNA_def_property_int_sdna(prop, NULL, "images");
5919 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
5920 RNA_def_property_range(prop, 1, 900);
5921 RNA_def_property_ui_text(prop, "Frame Map New", "How many frames the Map Old will last");
5922 RNA_def_property_update(prop, NC_SCENE | ND_FRAME, "rna_Scene_framelen_update");
5923
5924 prop = RNA_def_property(srna, "dither_intensity", PROP_FLOAT, PROP_NONE);
5925 RNA_def_property_float_sdna(prop, NULL, "dither_intensity");
5926 RNA_def_property_range(prop, 0.0, FLT_MAX);
5927 RNA_def_property_ui_range(prop, 0.0, 2.0, 0.1, 2);
5928 RNA_def_property_ui_text(
5929 prop,
5930 "Dither Intensity",
5931 "Amount of dithering noise added to the rendered image to break up banding");
5932 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5933
5934 prop = RNA_def_property(srna, "filter_size", PROP_FLOAT, PROP_PIXEL);
5935 RNA_def_property_float_sdna(prop, NULL, "gauss");
5936 RNA_def_property_range(prop, 0.0f, 500.0f);
5937 RNA_def_property_ui_range(prop, 0.01f, 10.0f, 1, 2);
5938 RNA_def_property_ui_text(
5939 prop, "Filter Size", "Width over which the reconstruction filter combines samples");
5940 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5941
5942 prop = RNA_def_property(srna, "film_transparent", PROP_BOOLEAN, PROP_NONE);
5943 RNA_def_property_boolean_sdna(prop, NULL, "alphamode", R_ALPHAPREMUL);
5944 RNA_def_property_ui_text(
5945 prop,
5946 "Transparent",
5947 "World background is transparent, for compositing the render over another background");
5948 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
5949
5950 prop = RNA_def_property(srna, "use_freestyle", PROP_BOOLEAN, PROP_NONE);
5951 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
5952 RNA_def_property_boolean_sdna(prop, NULL, "mode", R_EDGE_FRS);
5953 RNA_def_property_ui_text(prop, "Edge", "Draw stylized strokes using Freestyle");
5954 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_use_freestyle_update");
5955
5956 /* threads */
5957 prop = RNA_def_property(srna, "threads", PROP_INT, PROP_NONE);
5958 RNA_def_property_int_sdna(prop, NULL, "threads");
5959 RNA_def_property_range(prop, 1, BLENDER_MAX_THREADS);
5960 RNA_def_property_int_funcs(prop, "rna_RenderSettings_threads_get", NULL, NULL);
5961 RNA_def_property_ui_text(prop,
5962 "Threads",
5963 "Maximum number of CPU cores to use simultaneously while rendering "
5964 "(for multi-core/CPU systems)");
5965 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5966
5967 prop = RNA_def_property(srna, "threads_mode", PROP_ENUM, PROP_NONE);
5968 RNA_def_property_enum_bitflag_sdna(prop, NULL, "mode");
5969 RNA_def_property_enum_items(prop, threads_mode_items);
5970 RNA_def_property_enum_funcs(prop, "rna_RenderSettings_threads_mode_get", NULL, NULL);
5971 RNA_def_property_ui_text(prop, "Threads Mode", "Determine the amount of render threads used");
5972 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
5973
5974 /* motion blur */
5975 prop = RNA_def_property(srna, "use_motion_blur", PROP_BOOLEAN, PROP_NONE);
5976 RNA_def_property_boolean_sdna(prop, NULL, "mode", R_MBLUR);
5977 RNA_def_property_ui_text(prop, "Motion Blur", "Use multi-sampled 3D scene motion blur");
5978 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
5979 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
5980
5981 prop = RNA_def_property(srna, "motion_blur_shutter", PROP_FLOAT, PROP_FACTOR);
5982 RNA_def_property_float_sdna(prop, NULL, "blurfac");
5983 RNA_def_property_range(prop, 0.0f, FLT_MAX);
5984 RNA_def_property_ui_range(prop, 0.01f, 1.0f, 1, 2);
5985 RNA_def_property_ui_text(prop, "Shutter", "Time taken in frames between shutter open and close");
5986 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
5987
5988 prop = RNA_def_property(srna, "motion_blur_shutter_curve", PROP_POINTER, PROP_NONE);
5989 RNA_def_property_pointer_sdna(prop, NULL, "mblur_shutter_curve");
5990 RNA_def_property_struct_type(prop, "CurveMapping");
5991 RNA_def_property_ui_text(
5992 prop, "Shutter Curve", "Curve defining the shutter's openness over time");
5993
5994 /* Hairs */
5995 prop = RNA_def_property(srna, "hair_type", PROP_ENUM, PROP_NONE);
5996 RNA_def_property_enum_items(prop, hair_shape_type_items);
5997 RNA_def_property_ui_text(prop, "Hair Shape Type", "Hair shape type");
5998 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
5999
6000 prop = RNA_def_property(srna, "hair_subdiv", PROP_INT, PROP_NONE);
6001 RNA_def_property_range(prop, 0, 3);
6002 RNA_def_property_ui_text(prop, "Additional Subdiv", "Additional subdivision along the hair");
6003 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
6004
6005 /* Performance */
6006 prop = RNA_def_property(srna, "use_high_quality_normals", PROP_BOOLEAN, PROP_NONE);
6007 RNA_def_property_boolean_sdna(prop, NULL, "perf_flag", SCE_PERF_HQ_NORMALS);
6008 RNA_def_property_ui_text(prop,
6009 "High Quality Normals",
6010 "Use high quality tangent space at the cost of lower performance");
6011 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_mesh_quality_update");
6012
6013 /* border */
6014 prop = RNA_def_property(srna, "use_border", PROP_BOOLEAN, PROP_NONE);
6015 RNA_def_property_boolean_sdna(prop, NULL, "mode", R_BORDER);
6016 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
6017 RNA_def_property_ui_text(
6018 prop, "Render Region", "Render a user-defined render region, within the frame size");
6019 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6020
6021 prop = RNA_def_property(srna, "border_min_x", PROP_FLOAT, PROP_NONE);
6022 RNA_def_property_float_sdna(prop, NULL, "border.xmin");
6023 RNA_def_property_range(prop, 0.0f, 1.0f);
6024 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
6025 RNA_def_property_ui_text(prop, "Region Minimum X", "Minimum X value for the render region");
6026 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6027
6028 prop = RNA_def_property(srna, "border_min_y", PROP_FLOAT, PROP_NONE);
6029 RNA_def_property_float_sdna(prop, NULL, "border.ymin");
6030 RNA_def_property_range(prop, 0.0f, 1.0f);
6031 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
6032 RNA_def_property_ui_text(prop, "Region Minimum Y", "Minimum Y value for the render region");
6033 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6034
6035 prop = RNA_def_property(srna, "border_max_x", PROP_FLOAT, PROP_NONE);
6036 RNA_def_property_float_sdna(prop, NULL, "border.xmax");
6037 RNA_def_property_range(prop, 0.0f, 1.0f);
6038 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
6039 RNA_def_property_ui_text(prop, "Region Maximum X", "Maximum X value for the render region");
6040 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6041
6042 prop = RNA_def_property(srna, "border_max_y", PROP_FLOAT, PROP_NONE);
6043 RNA_def_property_float_sdna(prop, NULL, "border.ymax");
6044 RNA_def_property_range(prop, 0.0f, 1.0f);
6045 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
6046 RNA_def_property_ui_text(prop, "Region Maximum Y", "Maximum Y value for the render region");
6047 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6048
6049 prop = RNA_def_property(srna, "use_crop_to_border", PROP_BOOLEAN, PROP_NONE);
6050 RNA_def_property_boolean_sdna(prop, NULL, "mode", R_CROP);
6051 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
6052 RNA_def_property_ui_text(
6053 prop, "Crop to Render Region", "Crop the rendered frame to the defined render region size");
6054 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6055
6056 prop = RNA_def_property(srna, "use_placeholder", PROP_BOOLEAN, PROP_NONE);
6057 RNA_def_property_boolean_sdna(prop, NULL, "mode", R_TOUCH);
6058 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
6059 RNA_def_property_ui_text(
6060 prop,
6061 "Placeholders",
6062 "Create empty placeholder files while rendering frames (similar to Unix 'touch')");
6063 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6064
6065 prop = RNA_def_property(srna, "use_overwrite", PROP_BOOLEAN, PROP_NONE);
6066 RNA_def_property_boolean_negative_sdna(prop, NULL, "mode", R_NO_OVERWRITE);
6067 RNA_def_property_ui_text(prop, "Overwrite", "Overwrite existing files while rendering");
6068 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6069
6070 prop = RNA_def_property(srna, "use_compositing", PROP_BOOLEAN, PROP_NONE);
6071 RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_DOCOMP);
6072 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
6073 RNA_def_property_ui_text(prop,
6074 "Compositing",
6075 "Process the render result through the compositing pipeline, "
6076 "if compositing nodes are enabled");
6077 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6078
6079 prop = RNA_def_property(srna, "use_sequencer", PROP_BOOLEAN, PROP_NONE);
6080 RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_DOSEQ);
6081 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
6082 RNA_def_property_ui_text(prop,
6083 "Sequencer",
6084 "Process the render (and composited) result through the video sequence "
6085 "editor pipeline, if sequencer strips exist");
6086 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6087
6088 prop = RNA_def_property(srna, "use_file_extension", PROP_BOOLEAN, PROP_NONE);
6089 RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_EXTENSION);
6090 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
6091 RNA_def_property_ui_text(
6092 prop,
6093 "File Extensions",
6094 "Add the file format extensions to the rendered file name (eg: filename + .jpg)");
6095 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6096
6097 # if 0 /* moved */
6098 prop = RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE);
6099 RNA_def_property_enum_sdna(prop, NULL, "imtype");
6100 RNA_def_property_enum_items(prop, rna_enum_image_type_items);
6101 RNA_def_property_enum_funcs(prop, NULL, "rna_RenderSettings_file_format_set", NULL);
6102 RNA_def_property_ui_text(prop, "File Format", "File format to save the rendered images as");
6103 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6104 # endif
6105
6106 prop = RNA_def_property(srna, "file_extension", PROP_STRING, PROP_NONE);
6107 RNA_def_property_string_funcs(
6108 prop, "rna_SceneRender_file_ext_get", "rna_SceneRender_file_ext_length", NULL);
6109 RNA_def_property_ui_text(prop, "Extension", "The file extension used for saving renders");
6110 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
6111
6112 prop = RNA_def_property(srna, "is_movie_format", PROP_BOOLEAN, PROP_NONE);
6113 RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_is_movie_format_get", NULL);
6114 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
6115 RNA_def_property_ui_text(prop, "Movie Format", "When true the format is a movie");
6116
6117 prop = RNA_def_property(srna, "use_save_buffers", PROP_BOOLEAN, PROP_NONE);
6118 RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_EXR_TILE_FILE);
6119 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
6120 RNA_def_property_ui_text(
6121 prop,
6122 "Save Buffers",
6123 "Save tiles for all RenderLayers and SceneNodes to files in the temp directory "
6124 "(saves memory, required for Full Sample)");
6125 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6126
6127 prop = RNA_def_property(srna, "use_full_sample", PROP_BOOLEAN, PROP_NONE);
6128 RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_FULL_SAMPLE);
6129 RNA_def_property_ui_text(prop,
6130 "Full Sample",
6131 "Save for every anti-aliasing sample the entire RenderLayer results "
6132 "(this solves anti-aliasing issues with compositing)");
6133 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6134
6135 prop = RNA_def_property(srna, "use_lock_interface", PROP_BOOLEAN, PROP_NONE);
6136 RNA_def_property_boolean_sdna(prop, NULL, "use_lock_interface", 1);
6137 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
6138 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, true);
6139 RNA_def_property_ui_text(
6140 prop,
6141 "Lock Interface",
6142 "Lock interface during rendering in favor of giving more memory to the renderer");
6143 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6144
6145 prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
6146 RNA_def_property_string_sdna(prop, NULL, "pic");
6147 RNA_def_property_ui_text(prop,
6148 "Output Path",
6149 "Directory/name to save animations, # characters defines the position "
6150 "and length of frame numbers");
6151 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6152
6153 /* Render result EXR cache. */
6154 prop = RNA_def_property(srna, "use_render_cache", PROP_BOOLEAN, PROP_NONE);
6155 RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_EXR_CACHE_FILE);
6156 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
6157 RNA_def_property_ui_text(prop,
6158 "Cache Result",
6159 "Save render cache to EXR files (useful for heavy compositing, "
6160 "Note: affects indirectly rendered scenes)");
6161 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6162
6163 /* Bake */
6164
6165 prop = RNA_def_property(srna, "bake_type", PROP_ENUM, PROP_NONE);
6166 RNA_def_property_enum_bitflag_sdna(prop, NULL, "bake_mode");
6167 RNA_def_property_enum_items(prop, bake_mode_items);
6168 RNA_def_property_ui_text(prop, "Bake Type", "Choose shading information to bake into the image");
6169 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6170
6171 prop = RNA_def_property(srna, "use_bake_selected_to_active", PROP_BOOLEAN, PROP_NONE);
6172 RNA_def_property_boolean_sdna(prop, NULL, "bake_flag", R_BAKE_TO_ACTIVE);
6173 RNA_def_property_ui_text(prop,
6174 "Selected to Active",
6175 "Bake shading on the surface of selected objects to the active object");
6176 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6177
6178 prop = RNA_def_property(srna, "use_bake_clear", PROP_BOOLEAN, PROP_NONE);
6179 RNA_def_property_boolean_sdna(prop, NULL, "bake_flag", R_BAKE_CLEAR);
6180 RNA_def_property_ui_text(prop, "Clear", "Clear Images before baking");
6181 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6182
6183 prop = RNA_def_property(srna, "bake_margin", PROP_INT, PROP_PIXEL);
6184 RNA_def_property_int_sdna(prop, NULL, "bake_filter");
6185 RNA_def_property_range(prop, 0, 64);
6186 RNA_def_property_ui_text(prop, "Margin", "Extends the baked result as a post process filter");
6187 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6188
6189 prop = RNA_def_property(srna, "bake_bias", PROP_FLOAT, PROP_NONE);
6190 RNA_def_property_float_sdna(prop, NULL, "bake_biasdist");
6191 RNA_def_property_range(prop, 0.0, 1000.0);
6192 RNA_def_property_ui_text(
6193 prop, "Bias", "Bias towards faces further away from the object (in blender units)");
6194 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6195
6196 prop = RNA_def_property(srna, "use_bake_multires", PROP_BOOLEAN, PROP_NONE);
6197 RNA_def_property_boolean_sdna(prop, NULL, "bake_flag", R_BAKE_MULTIRES);
6198 RNA_def_property_ui_text(prop, "Bake from Multires", "Bake directly from multires object");
6199 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6200
6201 prop = RNA_def_property(srna, "use_bake_lores_mesh", PROP_BOOLEAN, PROP_NONE);
6202 RNA_def_property_boolean_sdna(prop, NULL, "bake_flag", R_BAKE_LORES_MESH);
6203 RNA_def_property_ui_text(
6204 prop, "Low Resolution Mesh", "Calculate heights against unsubdivided low resolution mesh");
6205 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6206
6207 prop = RNA_def_property(srna, "bake_samples", PROP_INT, PROP_NONE);
6208 RNA_def_property_int_sdna(prop, NULL, "bake_samples");
6209 RNA_def_property_range(prop, 64, 1024);
6210 RNA_def_property_ui_text(
6211 prop, "Samples", "Number of samples used for ambient occlusion baking from multires");
6212 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6213
6214 prop = RNA_def_property(srna, "use_bake_user_scale", PROP_BOOLEAN, PROP_NONE);
6215 RNA_def_property_boolean_sdna(prop, NULL, "bake_flag", R_BAKE_USERSCALE);
6216 RNA_def_property_ui_text(prop, "User Scale", "Use a user scale for the derivative map");
6217
6218 prop = RNA_def_property(srna, "bake_user_scale", PROP_FLOAT, PROP_NONE);
6219 RNA_def_property_float_sdna(prop, NULL, "bake_user_scale");
6220 RNA_def_property_range(prop, 0.0, 1000.0);
6221 RNA_def_property_ui_text(prop,
6222 "Scale",
6223 "Instead of automatically normalizing to 0..1, "
6224 "apply a user scale to the derivative map");
6225
6226 /* stamp */
6227
6228 prop = RNA_def_property(srna, "use_stamp_time", PROP_BOOLEAN, PROP_NONE);
6229 RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_TIME);
6230 RNA_def_property_ui_text(
6231 prop, "Stamp Time", "Include the rendered frame timecode as HH:MM:SS.FF in image metadata");
6232 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6233
6234 prop = RNA_def_property(srna, "use_stamp_date", PROP_BOOLEAN, PROP_NONE);
6235 RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_DATE);
6236 RNA_def_property_ui_text(prop, "Stamp Date", "Include the current date in image/video metadata");
6237 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6238
6239 prop = RNA_def_property(srna, "use_stamp_frame", PROP_BOOLEAN, PROP_NONE);
6240 RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_FRAME);
6241 RNA_def_property_ui_text(prop, "Stamp Frame", "Include the frame number in image metadata");
6242 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6243
6244 prop = RNA_def_property(srna, "use_stamp_frame_range", PROP_BOOLEAN, PROP_NONE);
6245 RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_FRAME_RANGE);
6246 RNA_def_property_ui_text(
6247 prop, "Stamp Frame", "Include the rendered frame range in image/video metadata");
6248 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6249
6250 prop = RNA_def_property(srna, "use_stamp_camera", PROP_BOOLEAN, PROP_NONE);
6251 RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_CAMERA);
6252 RNA_def_property_ui_text(
6253 prop, "Stamp Camera", "Include the name of the active camera in image metadata");
6254 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6255
6256 prop = RNA_def_property(srna, "use_stamp_lens", PROP_BOOLEAN, PROP_NONE);
6257 RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_CAMERALENS);
6258 RNA_def_property_ui_text(
6259 prop, "Stamp Lens", "Include the active camera's lens in image metadata");
6260 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6261
6262 prop = RNA_def_property(srna, "use_stamp_scene", PROP_BOOLEAN, PROP_NONE);
6263 RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_SCENE);
6264 RNA_def_property_ui_text(
6265 prop, "Stamp Scene", "Include the name of the active scene in image/video metadata");
6266 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6267
6268 prop = RNA_def_property(srna, "use_stamp_note", PROP_BOOLEAN, PROP_NONE);
6269 RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_NOTE);
6270 RNA_def_property_ui_text(prop, "Stamp Note", "Include a custom note in image/video metadata");
6271 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6272
6273 prop = RNA_def_property(srna, "use_stamp_marker", PROP_BOOLEAN, PROP_NONE);
6274 RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_MARKER);
6275 RNA_def_property_ui_text(
6276 prop, "Stamp Marker", "Include the name of the last marker in image metadata");
6277 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6278
6279 prop = RNA_def_property(srna, "use_stamp_filename", PROP_BOOLEAN, PROP_NONE);
6280 RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_FILENAME);
6281 RNA_def_property_ui_text(
6282 prop, "Stamp Filename", "Include the .blend filename in image/video metadata");
6283 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6284
6285 prop = RNA_def_property(srna, "use_stamp_sequencer_strip", PROP_BOOLEAN, PROP_NONE);
6286 RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_SEQSTRIP);
6287 RNA_def_property_ui_text(prop,
6288 "Stamp Sequence Strip",
6289 "Include the name of the foreground sequence strip in image metadata");
6290 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6291
6292 prop = RNA_def_property(srna, "use_stamp_render_time", PROP_BOOLEAN, PROP_NONE);
6293 RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_RENDERTIME);
6294 RNA_def_property_ui_text(prop, "Stamp Render Time", "Include the render time in image metadata");
6295 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6296
6297 prop = RNA_def_property(srna, "stamp_note_text", PROP_STRING, PROP_NONE);
6298 RNA_def_property_string_sdna(prop, NULL, "stamp_udata");
6299 RNA_def_property_ui_text(prop, "Stamp Note Text", "Custom text to appear in the stamp note");
6300 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6301
6302 prop = RNA_def_property(srna, "use_stamp", PROP_BOOLEAN, PROP_NONE);
6303 RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_DRAW);
6304 RNA_def_property_ui_text(
6305 prop, "Stamp Output", "Render the stamp info text in the rendered image");
6306 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6307
6308 prop = RNA_def_property(srna, "use_stamp_labels", PROP_BOOLEAN, PROP_NONE);
6309 RNA_def_property_boolean_negative_sdna(prop, NULL, "stamp", R_STAMP_HIDE_LABELS);
6310 RNA_def_property_ui_text(
6311 prop, "Stamp Labels", "Display stamp labels (\"Camera\" in front of camera name, etc.)");
6312 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6313
6314 prop = RNA_def_property(srna, "metadata_input", PROP_ENUM, PROP_NONE); /* as an enum */
6315 RNA_def_property_enum_bitflag_sdna(prop, NULL, "stamp");
6316 RNA_def_property_enum_items(prop, meta_input_items);
6317 RNA_def_property_ui_text(prop, "Metadata Input", "Where to take the metadata from");
6318 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6319
6320 prop = RNA_def_property(srna, "use_stamp_memory", PROP_BOOLEAN, PROP_NONE);
6321 RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_MEMORY);
6322 RNA_def_property_ui_text(
6323 prop, "Stamp Peak Memory", "Include the peak memory usage in image metadata");
6324 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6325
6326 prop = RNA_def_property(srna, "use_stamp_hostname", PROP_BOOLEAN, PROP_NONE);
6327 RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_HOSTNAME);
6328 RNA_def_property_ui_text(
6329 prop, "Stamp Hostname", "Include the hostname of the machine that rendered the frame");
6330 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6331
6332 prop = RNA_def_property(srna, "stamp_font_size", PROP_INT, PROP_PIXEL);
6333 RNA_def_property_int_sdna(prop, NULL, "stamp_font_id");
6334 RNA_def_property_range(prop, 8, 64);
6335 RNA_def_property_ui_text(prop, "Font Size", "Size of the font used when rendering stamp text");
6336 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6337
6338 prop = RNA_def_property(srna, "stamp_foreground", PROP_FLOAT, PROP_COLOR);
6339 RNA_def_property_float_sdna(prop, NULL, "fg_stamp");
6340 RNA_def_property_array(prop, 4);
6341 RNA_def_property_range(prop, 0.0, 1.0);
6342 RNA_def_property_ui_text(prop, "Text Color", "Color to use for stamp text");
6343 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6344
6345 prop = RNA_def_property(srna, "stamp_background", PROP_FLOAT, PROP_COLOR);
6346 RNA_def_property_float_sdna(prop, NULL, "bg_stamp");
6347 RNA_def_property_array(prop, 4);
6348 RNA_def_property_range(prop, 0.0, 1.0);
6349 RNA_def_property_ui_text(prop, "Background", "Color to use behind stamp text");
6350 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6351
6352 /* sequencer draw options */
6353
6354 # if 0 /* see R_SEQ_GL_REND comment */
6355 prop = RNA_def_property(srna, "use_sequencer_gl_render", PROP_BOOLEAN, PROP_NONE);
6356 RNA_def_property_boolean_sdna(prop, NULL, "seq_flag", R_SEQ_GL_REND);
6357 RNA_def_property_ui_text(prop, "Sequencer OpenGL", "");
6358 # endif
6359
6360 prop = RNA_def_property(srna, "sequencer_gl_preview", PROP_ENUM, PROP_NONE);
6361 RNA_def_property_enum_sdna(prop, NULL, "seq_prev_type");
6362 RNA_def_property_enum_items(prop, rna_enum_shading_type_items);
6363 RNA_def_property_ui_text(
6364 prop, "Sequencer Preview Shading", "Method to draw in the sequencer view");
6365 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SceneSequencer_update");
6366
6367 # if 0 /* UNUSED, see R_SEQ_GL_REND comment */
6368 prop = RNA_def_property(srna, "sequencer_gl_render", PROP_ENUM, PROP_NONE);
6369 RNA_def_property_enum_sdna(prop, NULL, "seq_rend_type");
6370 RNA_def_property_enum_items(prop, rna_enum_shading_type_items);
6371 /* XXX Label and tooltips are obviously wrong! */
6372 RNA_def_property_ui_text(
6373 prop, "Sequencer Preview Shading", "Method to draw in the sequencer view");
6374 # endif
6375
6376 prop = RNA_def_property(srna, "use_sequencer_override_scene_strip", PROP_BOOLEAN, PROP_NONE);
6377 RNA_def_property_boolean_sdna(prop, NULL, "seq_flag", R_SEQ_OVERRIDE_SCENE_SETTINGS);
6378 RNA_def_property_ui_text(prop,
6379 "Override Scene Settings",
6380 "Use workbench render settings from the sequencer scene, instead of "
6381 "each individual scene used in the strip");
6382 RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SceneSequencer_update");
6383
6384 prop = RNA_def_property(srna, "use_single_layer", PROP_BOOLEAN, PROP_NONE);
6385 RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_SINGLE_LAYER);
6386 RNA_def_property_ui_text(prop,
6387 "Render Single Layer",
6388 "Only render the active layer. Only affects rendering from the "
6389 "interface, ignored for rendering from command line");
6390 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
6391 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6392
6393 /* views (stereoscopy et al) */
6394 prop = RNA_def_property(srna, "views", PROP_COLLECTION, PROP_NONE);
6395 RNA_def_property_struct_type(prop, "SceneRenderView");
6396 RNA_def_property_ui_text(prop, "Render Views", "");
6397 rna_def_render_views(brna, prop);
6398
6399 prop = RNA_def_property(srna, "stereo_views", PROP_COLLECTION, PROP_NONE);
6400 RNA_def_property_collection_sdna(prop, NULL, "views", NULL);
6401 RNA_def_property_collection_funcs(prop,
6402 "rna_RenderSettings_stereoViews_begin",
6403 "rna_iterator_listbase_next",
6404 "rna_iterator_listbase_end",
6405 "rna_iterator_listbase_get",
6406 NULL,
6407 NULL,
6408 NULL,
6409 NULL);
6410 RNA_def_property_struct_type(prop, "SceneRenderView");
6411 RNA_def_property_ui_text(prop, "Render Views", "");
6412
6413 prop = RNA_def_property(srna, "use_multiview", PROP_BOOLEAN, PROP_NONE);
6414 RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_MULTIVIEW);
6415 RNA_def_property_ui_text(prop, "Multiple Views", "Use multiple views in the scene");
6416 RNA_def_property_update(prop, NC_WINDOW, NULL);
6417
6418 prop = RNA_def_property(srna, "views_format", PROP_ENUM, PROP_NONE);
6419 RNA_def_property_enum_items(prop, views_format_items);
6420 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
6421 RNA_def_property_ui_text(prop, "Setup Stereo Mode", "");
6422 RNA_def_property_enum_funcs(prop, NULL, "rna_RenderSettings_views_format_set", NULL);
6423 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
6424
6425 /* engine */
6426 prop = RNA_def_property(srna, "engine", PROP_ENUM, PROP_NONE);
6427 RNA_def_property_enum_items(prop, engine_items);
6428 RNA_def_property_enum_funcs(prop,
6429 "rna_RenderSettings_engine_get",
6430 "rna_RenderSettings_engine_set",
6431 "rna_RenderSettings_engine_itemf");
6432 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
6433 RNA_def_property_ui_text(prop, "Engine", "Engine to use for rendering");
6434 RNA_def_property_update(prop, NC_WINDOW, "rna_RenderSettings_engine_update");
6435
6436 prop = RNA_def_property(srna, "has_multiple_engines", PROP_BOOLEAN, PROP_NONE);
6437 RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_multiple_engines_get", NULL);
6438 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
6439 RNA_def_property_ui_text(
6440 prop, "Multiple Engines", "More than one rendering engine is available");
6441
6442 prop = RNA_def_property(srna, "use_spherical_stereo", PROP_BOOLEAN, PROP_NONE);
6443 RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_use_spherical_stereo_get", NULL);
6444 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
6445 RNA_def_property_ui_text(
6446 prop, "Use Spherical Stereo", "Active render engine supports spherical stereo rendering");
6447
6448 /* simplify */
6449 prop = RNA_def_property(srna, "use_simplify", PROP_BOOLEAN, PROP_NONE);
6450 RNA_def_property_boolean_sdna(prop, NULL, "mode", R_SIMPLIFY);
6451 RNA_def_property_ui_text(
6452 prop, "Use Simplify", "Enable simplification of scene for quicker preview renders");
6453 RNA_def_property_update(prop, 0, "rna_Scene_use_simplify_update");
6454
6455 prop = RNA_def_property(srna, "simplify_subdivision", PROP_INT, PROP_UNSIGNED);
6456 RNA_def_property_int_sdna(prop, NULL, "simplify_subsurf");
6457 RNA_def_property_ui_range(prop, 0, 6, 1, -1);
6458 RNA_def_property_ui_text(prop, "Simplify Subdivision", "Global maximum subdivision level");
6459 RNA_def_property_update(prop, 0, "rna_Scene_simplify_update");
6460
6461 prop = RNA_def_property(srna, "simplify_child_particles", PROP_FLOAT, PROP_FACTOR);
6462 RNA_def_property_float_sdna(prop, NULL, "simplify_particles");
6463 RNA_def_property_ui_text(prop, "Simplify Child Particles", "Global child particles percentage");
6464 RNA_def_property_update(prop, 0, "rna_Scene_simplify_update");
6465
6466 prop = RNA_def_property(srna, "simplify_subdivision_render", PROP_INT, PROP_UNSIGNED);
6467 RNA_def_property_int_sdna(prop, NULL, "simplify_subsurf_render");
6468 RNA_def_property_ui_range(prop, 0, 6, 1, -1);
6469 RNA_def_property_ui_text(
6470 prop, "Simplify Subdivision", "Global maximum subdivision level during rendering");
6471 RNA_def_property_update(prop, 0, "rna_Scene_simplify_update");
6472
6473 prop = RNA_def_property(srna, "simplify_child_particles_render", PROP_FLOAT, PROP_FACTOR);
6474 RNA_def_property_float_sdna(prop, NULL, "simplify_particles_render");
6475 RNA_def_property_ui_text(
6476 prop, "Simplify Child Particles", "Global child particles percentage during rendering");
6477 RNA_def_property_update(prop, 0, "rna_Scene_simplify_update");
6478
6479 prop = RNA_def_property(srna, "simplify_volumes", PROP_FLOAT, PROP_FACTOR);
6480 RNA_def_property_range(prop, 0.0, 1.0f);
6481 RNA_def_property_ui_text(
6482 prop, "Simplify Volumes", "Resolution percentage of volume objects in viewport");
6483 RNA_def_property_update(prop, 0, "rna_Scene_simplify_update");
6484
6485 /* Grease Pencil - Simplify Options */
6486 prop = RNA_def_property(srna, "simplify_gpencil", PROP_BOOLEAN, PROP_NONE);
6487 RNA_def_property_boolean_sdna(prop, NULL, "simplify_gpencil", SIMPLIFY_GPENCIL_ENABLE);
6488 RNA_def_property_ui_text(prop, "Simplify", "Simplify Grease Pencil drawing");
6489 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
6490
6491 prop = RNA_def_property(srna, "simplify_gpencil_onplay", PROP_BOOLEAN, PROP_NONE);
6492 RNA_def_property_boolean_sdna(prop, NULL, "simplify_gpencil", SIMPLIFY_GPENCIL_ON_PLAY);
6493 RNA_def_property_ui_text(
6494 prop, "Playback Only", "Simplify Grease Pencil only during animation playback");
6495 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
6496
6497 prop = RNA_def_property(srna, "simplify_gpencil_antialiasing", PROP_BOOLEAN, PROP_NONE);
6498 RNA_def_property_boolean_negative_sdna(prop, NULL, "simplify_gpencil", SIMPLIFY_GPENCIL_AA);
6499 RNA_def_property_ui_text(prop, "Antialiasing", "Use Antialiasing to smooth stroke edges");
6500 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
6501
6502 prop = RNA_def_property(srna, "simplify_gpencil_view_fill", PROP_BOOLEAN, PROP_NONE);
6503 RNA_def_property_boolean_negative_sdna(prop, NULL, "simplify_gpencil", SIMPLIFY_GPENCIL_FILL);
6504 RNA_def_property_ui_text(prop, "Fill", "Display fill strokes in the viewport");
6505 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
6506
6507 prop = RNA_def_property(srna, "simplify_gpencil_modifier", PROP_BOOLEAN, PROP_NONE);
6508 RNA_def_property_boolean_negative_sdna(
6509 prop, NULL, "simplify_gpencil", SIMPLIFY_GPENCIL_MODIFIER);
6510 RNA_def_property_ui_text(prop, "Modifiers", "Display modifiers");
6511 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
6512
6513 prop = RNA_def_property(srna, "simplify_gpencil_shader_fx", PROP_BOOLEAN, PROP_NONE);
6514 RNA_def_property_boolean_negative_sdna(prop, NULL, "simplify_gpencil", SIMPLIFY_GPENCIL_FX);
6515 RNA_def_property_ui_text(prop, "Shader Effects", "Display Shader Effects");
6516 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
6517
6518 prop = RNA_def_property(srna, "simplify_gpencil_tint", PROP_BOOLEAN, PROP_NONE);
6519 RNA_def_property_boolean_negative_sdna(prop, NULL, "simplify_gpencil", SIMPLIFY_GPENCIL_TINT);
6520 RNA_def_property_ui_text(prop, "Layers Tinting", "Display layer tint");
6521 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
6522
6523 /* persistent data */
6524 prop = RNA_def_property(srna, "use_persistent_data", PROP_BOOLEAN, PROP_NONE);
6525 RNA_def_property_boolean_sdna(prop, NULL, "mode", R_PERSISTENT_DATA);
6526 RNA_def_property_ui_text(
6527 prop, "Persistent Data", "Keep render data around for faster re-renders");
6528 RNA_def_property_update(prop, 0, "rna_Scene_use_persistent_data_update");
6529
6530 /* Freestyle line thickness options */
6531 prop = RNA_def_property(srna, "line_thickness_mode", PROP_ENUM, PROP_NONE);
6532 RNA_def_property_enum_sdna(prop, NULL, "line_thickness_mode");
6533 RNA_def_property_enum_items(prop, freestyle_thickness_items);
6534 RNA_def_property_ui_text(
6535 prop, "Line Thickness Mode", "Line thickness mode for Freestyle line drawing");
6536 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
6537
6538 prop = RNA_def_property(srna, "line_thickness", PROP_FLOAT, PROP_PIXEL);
6539 RNA_def_property_float_sdna(prop, NULL, "unit_line_thickness");
6540 RNA_def_property_range(prop, 0.f, 10000.f);
6541 RNA_def_property_ui_text(prop, "Line Thickness", "Line thickness in pixels");
6542 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
6543
6544 /* Bake Settings */
6545 prop = RNA_def_property(srna, "bake", PROP_POINTER, PROP_NONE);
6546 RNA_def_property_flag(prop, PROP_NEVER_NULL);
6547 RNA_def_property_pointer_sdna(prop, NULL, "bake");
6548 RNA_def_property_struct_type(prop, "BakeSettings");
6549 RNA_def_property_ui_text(prop, "Bake Data", "");
6550
6551 /* Nestled Data */
6552 /* *** Non-Animated *** */
6553 RNA_define_animate_sdna(false);
6554 rna_def_bake_data(brna);
6555 RNA_define_animate_sdna(true);
6556
6557 /* *** Animated *** */
6558
6559 /* Scene API */
6560 RNA_api_scene_render(srna);
6561 }
6562
6563 /* scene.objects */
rna_def_scene_objects(BlenderRNA * brna,PropertyRNA * cprop)6564 static void rna_def_scene_objects(BlenderRNA *brna, PropertyRNA *cprop)
6565 {
6566 StructRNA *srna;
6567
6568 RNA_def_property_srna(cprop, "SceneObjects");
6569 srna = RNA_def_struct(brna, "SceneObjects", NULL);
6570 RNA_def_struct_sdna(srna, "Scene");
6571 RNA_def_struct_ui_text(srna, "Scene Objects", "All of the scene objects");
6572 }
6573
6574 /* scene.timeline_markers */
rna_def_timeline_markers(BlenderRNA * brna,PropertyRNA * cprop)6575 static void rna_def_timeline_markers(BlenderRNA *brna, PropertyRNA *cprop)
6576 {
6577 StructRNA *srna;
6578
6579 FunctionRNA *func;
6580 PropertyRNA *parm;
6581
6582 RNA_def_property_srna(cprop, "TimelineMarkers");
6583 srna = RNA_def_struct(brna, "TimelineMarkers", NULL);
6584 RNA_def_struct_sdna(srna, "Scene");
6585 RNA_def_struct_ui_text(srna, "Timeline Markers", "Collection of timeline markers");
6586
6587 func = RNA_def_function(srna, "new", "rna_TimeLine_add");
6588 RNA_def_function_ui_description(func, "Add a keyframe to the curve");
6589 parm = RNA_def_string(func, "name", "Marker", 0, "", "New name for the marker (not unique)");
6590 RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
6591 parm = RNA_def_int(func,
6592 "frame",
6593 1,
6594 -MAXFRAME,
6595 MAXFRAME,
6596 "",
6597 "The frame for the new marker",
6598 -MAXFRAME,
6599 MAXFRAME);
6600 parm = RNA_def_pointer(func, "marker", "TimelineMarker", "", "Newly created timeline marker");
6601 RNA_def_function_return(func, parm);
6602
6603 func = RNA_def_function(srna, "remove", "rna_TimeLine_remove");
6604 RNA_def_function_ui_description(func, "Remove a timeline marker");
6605 RNA_def_function_flag(func, FUNC_USE_REPORTS);
6606 parm = RNA_def_pointer(func, "marker", "TimelineMarker", "", "Timeline marker to remove");
6607 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
6608 RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
6609
6610 func = RNA_def_function(srna, "clear", "rna_TimeLine_clear");
6611 RNA_def_function_ui_description(func, "Remove all timeline markers");
6612 }
6613
6614 /* scene.keying_sets */
rna_def_scene_keying_sets(BlenderRNA * brna,PropertyRNA * cprop)6615 static void rna_def_scene_keying_sets(BlenderRNA *brna, PropertyRNA *cprop)
6616 {
6617 StructRNA *srna;
6618 PropertyRNA *prop;
6619
6620 FunctionRNA *func;
6621 PropertyRNA *parm;
6622
6623 RNA_def_property_srna(cprop, "KeyingSets");
6624 srna = RNA_def_struct(brna, "KeyingSets", NULL);
6625 RNA_def_struct_sdna(srna, "Scene");
6626 RNA_def_struct_ui_text(srna, "Keying Sets", "Scene keying sets");
6627
6628 /* Add Keying Set */
6629 func = RNA_def_function(srna, "new", "rna_Scene_keying_set_new");
6630 RNA_def_function_ui_description(func, "Add a new Keying Set to Scene");
6631 RNA_def_function_flag(func, FUNC_USE_REPORTS);
6632 /* name */
6633 RNA_def_string(func, "idname", "KeyingSet", 64, "IDName", "Internal identifier of Keying Set");
6634 RNA_def_string(func, "name", "KeyingSet", 64, "Name", "User visible name of Keying Set");
6635 /* returns the new KeyingSet */
6636 parm = RNA_def_pointer(func, "keyingset", "KeyingSet", "", "Newly created Keying Set");
6637 RNA_def_function_return(func, parm);
6638
6639 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
6640 RNA_def_property_struct_type(prop, "KeyingSet");
6641 RNA_def_property_flag(prop, PROP_EDITABLE);
6642 RNA_def_property_pointer_funcs(
6643 prop, "rna_Scene_active_keying_set_get", "rna_Scene_active_keying_set_set", NULL, NULL);
6644 RNA_def_property_ui_text(
6645 prop, "Active Keying Set", "Active Keying Set used to insert/delete keyframes");
6646 RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET, NULL);
6647
6648 prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
6649 RNA_def_property_int_sdna(prop, NULL, "active_keyingset");
6650 RNA_def_property_int_funcs(prop,
6651 "rna_Scene_active_keying_set_index_get",
6652 "rna_Scene_active_keying_set_index_set",
6653 NULL);
6654 RNA_def_property_ui_text(
6655 prop,
6656 "Active Keying Set Index",
6657 "Current Keying Set index (negative for 'builtin' and positive for 'absolute')");
6658 RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET, NULL);
6659 }
6660
rna_def_scene_keying_sets_all(BlenderRNA * brna,PropertyRNA * cprop)6661 static void rna_def_scene_keying_sets_all(BlenderRNA *brna, PropertyRNA *cprop)
6662 {
6663 StructRNA *srna;
6664 PropertyRNA *prop;
6665
6666 RNA_def_property_srna(cprop, "KeyingSetsAll");
6667 srna = RNA_def_struct(brna, "KeyingSetsAll", NULL);
6668 RNA_def_struct_sdna(srna, "Scene");
6669 RNA_def_struct_ui_text(srna, "Keying Sets All", "All available keying sets");
6670
6671 /* NOTE: no add/remove available here, without screwing up this amalgamated list... */
6672
6673 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
6674 RNA_def_property_struct_type(prop, "KeyingSet");
6675 RNA_def_property_flag(prop, PROP_EDITABLE);
6676 RNA_def_property_pointer_funcs(
6677 prop, "rna_Scene_active_keying_set_get", "rna_Scene_active_keying_set_set", NULL, NULL);
6678 RNA_def_property_ui_text(
6679 prop, "Active Keying Set", "Active Keying Set used to insert/delete keyframes");
6680 RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET, NULL);
6681
6682 prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
6683 RNA_def_property_int_sdna(prop, NULL, "active_keyingset");
6684 RNA_def_property_int_funcs(prop,
6685 "rna_Scene_active_keying_set_index_get",
6686 "rna_Scene_active_keying_set_index_set",
6687 NULL);
6688 RNA_def_property_ui_text(
6689 prop,
6690 "Active Keying Set Index",
6691 "Current Keying Set index (negative for 'builtin' and positive for 'absolute')");
6692 RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET, NULL);
6693 }
6694
6695 /* Runtime property, used to remember uv indices, used only in UV stitch for now.
6696 */
rna_def_selected_uv_element(BlenderRNA * brna)6697 static void rna_def_selected_uv_element(BlenderRNA *brna)
6698 {
6699 StructRNA *srna;
6700 PropertyRNA *prop;
6701
6702 srna = RNA_def_struct(brna, "SelectedUvElement", "PropertyGroup");
6703 RNA_def_struct_ui_text(srna, "Selected UV Element", "");
6704
6705 /* store the index to the UV element selected */
6706 prop = RNA_def_property(srna, "element_index", PROP_INT, PROP_UNSIGNED);
6707 RNA_def_property_flag(prop, PROP_IDPROPERTY);
6708 RNA_def_property_ui_text(prop, "Element Index", "");
6709
6710 prop = RNA_def_property(srna, "face_index", PROP_INT, PROP_UNSIGNED);
6711 RNA_def_property_flag(prop, PROP_IDPROPERTY);
6712 RNA_def_property_ui_text(prop, "Face Index", "");
6713 }
6714
rna_def_display_safe_areas(BlenderRNA * brna)6715 static void rna_def_display_safe_areas(BlenderRNA *brna)
6716 {
6717 StructRNA *srna;
6718 PropertyRNA *prop;
6719
6720 srna = RNA_def_struct(brna, "DisplaySafeAreas", NULL);
6721 RNA_def_struct_ui_text(srna, "Safe Areas", "Safe areas used in 3D view and the sequencer");
6722 RNA_def_struct_sdna(srna, "DisplaySafeAreas");
6723
6724 /* SAFE AREAS */
6725 prop = RNA_def_property(srna, "title", PROP_FLOAT, PROP_XYZ);
6726 RNA_def_property_float_sdna(prop, NULL, "title");
6727 RNA_def_property_array(prop, 2);
6728 RNA_def_property_range(prop, 0.0f, 1.0f);
6729 RNA_def_property_ui_text(prop, "Title Safe Margins", "Safe area for text and graphics");
6730 RNA_def_property_update(prop, NC_SCENE | ND_DRAW_RENDER_VIEWPORT, NULL);
6731
6732 prop = RNA_def_property(srna, "action", PROP_FLOAT, PROP_XYZ);
6733 RNA_def_property_float_sdna(prop, NULL, "action");
6734 RNA_def_property_array(prop, 2);
6735 RNA_def_property_range(prop, 0.0f, 1.0f);
6736 RNA_def_property_ui_text(prop, "Action Safe Margins", "Safe area for general elements");
6737 RNA_def_property_update(prop, NC_SCENE | ND_DRAW_RENDER_VIEWPORT, NULL);
6738
6739 prop = RNA_def_property(srna, "title_center", PROP_FLOAT, PROP_XYZ);
6740 RNA_def_property_float_sdna(prop, NULL, "title_center");
6741 RNA_def_property_array(prop, 2);
6742 RNA_def_property_range(prop, 0.0f, 1.0f);
6743 RNA_def_property_ui_text(prop,
6744 "Center Title Safe Margins",
6745 "Safe area for text and graphics in a different aspect ratio");
6746 RNA_def_property_update(prop, NC_SCENE | ND_DRAW_RENDER_VIEWPORT, NULL);
6747
6748 prop = RNA_def_property(srna, "action_center", PROP_FLOAT, PROP_XYZ);
6749 RNA_def_property_float_sdna(prop, NULL, "action_center");
6750 RNA_def_property_array(prop, 2);
6751 RNA_def_property_range(prop, 0.0f, 1.0f);
6752 RNA_def_property_ui_text(prop,
6753 "Center Action Safe Margins",
6754 "Safe area for general elements in a different aspect ratio");
6755 RNA_def_property_update(prop, NC_SCENE | ND_DRAW_RENDER_VIEWPORT, NULL);
6756 }
6757
rna_def_scene_display(BlenderRNA * brna)6758 static void rna_def_scene_display(BlenderRNA *brna)
6759 {
6760 StructRNA *srna;
6761 PropertyRNA *prop;
6762
6763 srna = RNA_def_struct(brna, "SceneDisplay", NULL);
6764 RNA_def_struct_ui_text(srna, "Scene Display", "Scene display settings for 3d viewport");
6765 RNA_def_struct_sdna(srna, "SceneDisplay");
6766
6767 prop = RNA_def_property(srna, "light_direction", PROP_FLOAT, PROP_DIRECTION);
6768 RNA_def_property_float_sdna(prop, NULL, "light_direction");
6769 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
6770 RNA_def_property_array(prop, 3);
6771 RNA_def_property_ui_text(
6772 prop, "Light Direction", "Direction of the light for shadows and highlights");
6773 RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_set_update");
6774
6775 prop = RNA_def_property(srna, "shadow_shift", PROP_FLOAT, PROP_ANGLE);
6776 RNA_def_property_ui_text(prop, "Shadow Shift", "Shadow termination angle");
6777 RNA_def_property_range(prop, 0.0f, 1.0f);
6778 RNA_def_property_ui_range(prop, 0.00f, 1.0f, 1, 2);
6779 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
6780 RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_set_update");
6781
6782 prop = RNA_def_property(srna, "shadow_focus", PROP_FLOAT, PROP_FACTOR);
6783 RNA_def_property_float_default(prop, 0.0);
6784 RNA_def_property_ui_text(prop, "Shadow Focus", "Shadow factor hardness");
6785 RNA_def_property_range(prop, 0.0f, 1.0f);
6786 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 2);
6787 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
6788 RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_set_update");
6789
6790 prop = RNA_def_property(srna, "matcap_ssao_distance", PROP_FLOAT, PROP_NONE);
6791 RNA_def_property_ui_text(
6792 prop, "Distance", "Distance of object that contribute to the Cavity/Edge effect");
6793 RNA_def_property_range(prop, 0.0f, 100000.0f);
6794 RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
6795
6796 prop = RNA_def_property(srna, "matcap_ssao_attenuation", PROP_FLOAT, PROP_NONE);
6797 RNA_def_property_ui_text(prop, "Attenuation", "Attenuation constant");
6798 RNA_def_property_range(prop, 1.0f, 100000.0f);
6799 RNA_def_property_ui_range(prop, 1.0f, 100.0f, 1, 3);
6800
6801 prop = RNA_def_property(srna, "matcap_ssao_samples", PROP_INT, PROP_NONE);
6802 RNA_def_property_ui_text(prop, "Samples", "Number of samples");
6803 RNA_def_property_range(prop, 1, 500);
6804
6805 prop = RNA_def_property(srna, "render_aa", PROP_ENUM, PROP_NONE);
6806 RNA_def_property_enum_items(prop, rna_enum_scene_display_aa_methods);
6807 RNA_def_property_ui_text(
6808 prop, "Render Anti-Aliasing", "Method of anti-aliasing when rendering final image");
6809 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
6810
6811 prop = RNA_def_property(srna, "viewport_aa", PROP_ENUM, PROP_NONE);
6812 RNA_def_property_enum_items(prop, rna_enum_scene_display_aa_methods);
6813 RNA_def_property_ui_text(
6814 prop, "Viewport Anti-Aliasing", "Method of anti-aliasing when rendering 3d viewport");
6815 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
6816
6817 /* OpenGL render engine settings. */
6818 prop = RNA_def_property(srna, "shading", PROP_POINTER, PROP_NONE);
6819 RNA_def_property_ui_text(prop, "Shading Settings", "Shading settings for OpenGL render engine");
6820 }
6821
rna_def_scene_eevee(BlenderRNA * brna)6822 static void rna_def_scene_eevee(BlenderRNA *brna)
6823 {
6824 StructRNA *srna;
6825 PropertyRNA *prop;
6826
6827 static const EnumPropertyItem eevee_shadow_size_items[] = {
6828 {64, "64", 0, "64 px", ""},
6829 {128, "128", 0, "128 px", ""},
6830 {256, "256", 0, "256 px", ""},
6831 {512, "512", 0, "512 px", ""},
6832 {1024, "1024", 0, "1024 px", ""},
6833 {2048, "2048", 0, "2048 px", ""},
6834 {4096, "4096", 0, "4096 px", ""},
6835 {0, NULL, 0, NULL, NULL},
6836 };
6837
6838 static const EnumPropertyItem eevee_gi_visibility_size_items[] = {
6839 {8, "8", 0, "8 px", ""},
6840 {16, "16", 0, "16 px", ""},
6841 {32, "32", 0, "32 px", ""},
6842 {64, "64", 0, "64 px", ""},
6843 {0, NULL, 0, NULL, NULL},
6844 };
6845
6846 static const EnumPropertyItem eevee_volumetric_tile_size_items[] = {
6847 {2, "2", 0, "2 px", ""},
6848 {4, "4", 0, "4 px", ""},
6849 {8, "8", 0, "8 px", ""},
6850 {16, "16", 0, "16 px", ""},
6851 {0, NULL, 0, NULL, NULL},
6852 };
6853
6854 static const EnumPropertyItem eevee_motion_blur_position_items[] = {
6855 {SCE_EEVEE_MB_START, "START", 0, "Start on Frame", "The shutter opens at the current frame"},
6856 {SCE_EEVEE_MB_CENTER,
6857 "CENTER",
6858 0,
6859 "Center on Frame",
6860 "The shutter is open during the current frame"},
6861 {SCE_EEVEE_MB_END, "END", 0, "End on Frame", "The shutter closes at the current frame"},
6862 {0, NULL, 0, NULL, NULL},
6863 };
6864
6865 srna = RNA_def_struct(brna, "SceneEEVEE", NULL);
6866 RNA_def_struct_path_func(srna, "rna_SceneEEVEE_path");
6867 RNA_def_struct_ui_text(srna, "Scene Display", "Scene display settings for 3d viewport");
6868
6869 /* Indirect Lighting */
6870 prop = RNA_def_property(srna, "gi_diffuse_bounces", PROP_INT, PROP_NONE);
6871 RNA_def_property_ui_text(prop,
6872 "Diffuse Bounces",
6873 "Number of time the light is reinjected inside light grids, "
6874 "0 disable indirect diffuse light");
6875 RNA_def_property_range(prop, 0, INT_MAX);
6876 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
6877
6878 prop = RNA_def_property(srna, "gi_cubemap_resolution", PROP_ENUM, PROP_NONE);
6879 RNA_def_property_enum_items(prop, eevee_shadow_size_items);
6880 RNA_def_property_ui_text(prop, "Cubemap Size", "Size of every cubemaps");
6881 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
6882
6883 prop = RNA_def_property(srna, "gi_visibility_resolution", PROP_ENUM, PROP_NONE);
6884 RNA_def_property_enum_items(prop, eevee_gi_visibility_size_items);
6885 RNA_def_property_ui_text(prop,
6886 "Irradiance Visibility Size",
6887 "Size of the shadow map applied to each irradiance sample");
6888 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
6889
6890 prop = RNA_def_property(srna, "gi_irradiance_smoothing", PROP_FLOAT, PROP_FACTOR);
6891 RNA_def_property_range(prop, 0.0f, FLT_MAX);
6892 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 5, 2);
6893 RNA_def_property_ui_text(prop,
6894 "Irradiance Smoothing",
6895 "Smoother irradiance interpolation but introduce light bleeding");
6896 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
6897 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6898
6899 prop = RNA_def_property(srna, "gi_glossy_clamp", PROP_FLOAT, PROP_NONE);
6900 RNA_def_property_ui_text(prop,
6901 "Clamp Glossy",
6902 "Clamp pixel intensity to reduce noise inside glossy reflections "
6903 "from reflection cubemaps (0 to disabled)");
6904 RNA_def_property_range(prop, 0.0f, FLT_MAX);
6905 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
6906
6907 prop = RNA_def_property(srna, "gi_filter_quality", PROP_FLOAT, PROP_NONE);
6908 RNA_def_property_ui_text(
6909 prop, "Filter Quality", "Take more samples during cubemap filtering to remove artifacts");
6910 RNA_def_property_range(prop, 1.0f, 8.0f);
6911 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
6912
6913 prop = RNA_def_property(srna, "gi_show_irradiance", PROP_BOOLEAN, PROP_NONE);
6914 RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_SHOW_IRRADIANCE);
6915 RNA_def_property_ui_icon(prop, ICON_HIDE_ON, 1);
6916 RNA_def_property_ui_text(
6917 prop, "Show Irradiance Cache", "Display irradiance samples in the viewport");
6918 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
6919 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6920
6921 prop = RNA_def_property(srna, "gi_show_cubemaps", PROP_BOOLEAN, PROP_NONE);
6922 RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_SHOW_CUBEMAPS);
6923 RNA_def_property_ui_icon(prop, ICON_HIDE_ON, 1);
6924 RNA_def_property_ui_text(
6925 prop, "Show Cubemap Cache", "Display captured cubemaps in the viewport");
6926 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
6927 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6928
6929 prop = RNA_def_property(srna, "gi_irradiance_display_size", PROP_FLOAT, PROP_DISTANCE);
6930 RNA_def_property_float_sdna(prop, NULL, "gi_irradiance_draw_size");
6931 RNA_def_property_range(prop, 0.05f, 10.0f);
6932 RNA_def_property_ui_text(prop,
6933 "Irradiance Display Size",
6934 "Size of the irradiance sample spheres to debug captured light");
6935 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6936
6937 prop = RNA_def_property(srna, "gi_cubemap_display_size", PROP_FLOAT, PROP_DISTANCE);
6938 RNA_def_property_float_sdna(prop, NULL, "gi_cubemap_draw_size");
6939 RNA_def_property_range(prop, 0.05f, 10.0f);
6940 RNA_def_property_ui_text(
6941 prop, "Cubemap Display Size", "Size of the cubemap spheres to debug captured light");
6942 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6943
6944 prop = RNA_def_property(srna, "gi_auto_bake", PROP_BOOLEAN, PROP_NONE);
6945 RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_GI_AUTOBAKE);
6946 RNA_def_property_ui_text(prop, "Auto Bake", "Auto bake indirect lighting when editing probes");
6947
6948 prop = RNA_def_property(srna, "gi_cache_info", PROP_STRING, PROP_NONE);
6949 RNA_def_property_string_sdna(prop, NULL, "light_cache_info");
6950 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
6951 RNA_def_property_ui_text(prop, "Light Cache Info", "Info on current cache status");
6952
6953 /* Temporal Anti-Aliasing (super sampling) */
6954 prop = RNA_def_property(srna, "taa_samples", PROP_INT, PROP_NONE);
6955 RNA_def_property_ui_text(prop, "Viewport Samples", "Number of samples, unlimited if 0");
6956 RNA_def_property_range(prop, 0, INT_MAX);
6957 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
6958 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6959
6960 prop = RNA_def_property(srna, "taa_render_samples", PROP_INT, PROP_NONE);
6961 RNA_def_property_ui_text(prop, "Render Samples", "Number of samples per pixels for rendering");
6962 RNA_def_property_range(prop, 1, INT_MAX);
6963 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
6964 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6965
6966 prop = RNA_def_property(srna, "use_taa_reprojection", PROP_BOOLEAN, PROP_NONE);
6967 RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_TAA_REPROJECTION);
6968 RNA_def_property_ui_text(prop,
6969 "Viewport Denoising",
6970 "Denoise image using temporal reprojection "
6971 "(can leave some ghosting)");
6972 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
6973 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6974
6975 /* Screen Space Subsurface Scattering */
6976 prop = RNA_def_property(srna, "sss_samples", PROP_INT, PROP_NONE);
6977 RNA_def_property_ui_text(prop, "Samples", "Number of samples to compute the scattering effect");
6978 RNA_def_property_range(prop, 1, 32);
6979 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
6980 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6981
6982 prop = RNA_def_property(srna, "sss_jitter_threshold", PROP_FLOAT, PROP_FACTOR);
6983 RNA_def_property_ui_text(
6984 prop, "Jitter Threshold", "Rotate samples that are below this threshold");
6985 RNA_def_property_range(prop, 0.0f, 1.0f);
6986 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
6987 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6988
6989 /* Screen Space Reflection */
6990 prop = RNA_def_property(srna, "use_ssr", PROP_BOOLEAN, PROP_NONE);
6991 RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_SSR_ENABLED);
6992 RNA_def_property_ui_text(prop, "Screen Space Reflections", "Enable screen space reflection");
6993 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
6994 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
6995
6996 prop = RNA_def_property(srna, "use_ssr_refraction", PROP_BOOLEAN, PROP_NONE);
6997 RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_SSR_REFRACTION);
6998 RNA_def_property_ui_text(prop, "Screen Space Refractions", "Enable screen space Refractions");
6999 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7000 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7001
7002 prop = RNA_def_property(srna, "use_ssr_halfres", PROP_BOOLEAN, PROP_NONE);
7003 RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_SSR_HALF_RESOLUTION);
7004 RNA_def_property_ui_text(prop, "Half Res Trace", "Raytrace at a lower resolution");
7005 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7006 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7007
7008 prop = RNA_def_property(srna, "ssr_quality", PROP_FLOAT, PROP_FACTOR);
7009 RNA_def_property_ui_text(prop, "Trace Precision", "Precision of the screen space raytracing");
7010 RNA_def_property_range(prop, 0.0f, 1.0f);
7011 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7012 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7013
7014 prop = RNA_def_property(srna, "ssr_max_roughness", PROP_FLOAT, PROP_FACTOR);
7015 RNA_def_property_ui_text(
7016 prop, "Max Roughness", "Do not raytrace reflections for roughness above this value");
7017 RNA_def_property_range(prop, 0.0f, 1.0f);
7018 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7019 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7020
7021 prop = RNA_def_property(srna, "ssr_thickness", PROP_FLOAT, PROP_DISTANCE);
7022 RNA_def_property_ui_text(prop, "Thickness", "Pixel thickness used to detect intersection");
7023 RNA_def_property_range(prop, 1e-6f, FLT_MAX);
7024 RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 5, 3);
7025 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7026 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7027
7028 prop = RNA_def_property(srna, "ssr_border_fade", PROP_FLOAT, PROP_FACTOR);
7029 RNA_def_property_ui_text(prop, "Edge Fading", "Screen percentage used to fade the SSR");
7030 RNA_def_property_range(prop, 0.0f, 0.5f);
7031 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7032 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7033
7034 prop = RNA_def_property(srna, "ssr_firefly_fac", PROP_FLOAT, PROP_NONE);
7035 RNA_def_property_ui_text(prop, "Clamp", "Clamp pixel intensity to remove noise (0 to disabled)");
7036 RNA_def_property_range(prop, 0.0f, FLT_MAX);
7037 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7038 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7039
7040 /* Volumetrics */
7041 prop = RNA_def_property(srna, "volumetric_start", PROP_FLOAT, PROP_DISTANCE);
7042 RNA_def_property_ui_text(prop, "Start", "Start distance of the volumetric effect");
7043 RNA_def_property_range(prop, 1e-6f, FLT_MAX);
7044 RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3);
7045 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7046 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7047
7048 prop = RNA_def_property(srna, "volumetric_end", PROP_FLOAT, PROP_DISTANCE);
7049 RNA_def_property_ui_text(prop, "End", "End distance of the volumetric effect");
7050 RNA_def_property_range(prop, 1e-6f, FLT_MAX);
7051 RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3);
7052 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7053 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7054
7055 prop = RNA_def_property(srna, "volumetric_tile_size", PROP_ENUM, PROP_NONE);
7056 RNA_def_property_enum_items(prop, eevee_volumetric_tile_size_items);
7057 RNA_def_property_ui_text(prop,
7058 "Tile Size",
7059 "Control the quality of the volumetric effects "
7060 "(lower size increase vram usage and quality)");
7061 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7062 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7063
7064 prop = RNA_def_property(srna, "volumetric_samples", PROP_INT, PROP_NONE);
7065 RNA_def_property_ui_text(prop, "Samples", "Number of samples to compute volumetric effects");
7066 RNA_def_property_range(prop, 1, 256);
7067 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7068 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7069
7070 prop = RNA_def_property(srna, "volumetric_sample_distribution", PROP_FLOAT, PROP_FACTOR);
7071 RNA_def_property_ui_text(
7072 prop, "Exponential Sampling", "Distribute more samples closer to the camera");
7073 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7074 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7075
7076 prop = RNA_def_property(srna, "use_volumetric_lights", PROP_BOOLEAN, PROP_NONE);
7077 RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_VOLUMETRIC_LIGHTS);
7078 RNA_def_property_ui_text(
7079 prop, "Volumetric Lighting", "Enable scene light interactions with volumetrics");
7080 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7081 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7082
7083 prop = RNA_def_property(srna, "volumetric_light_clamp", PROP_FLOAT, PROP_NONE);
7084 RNA_def_property_range(prop, 0.0f, FLT_MAX);
7085 RNA_def_property_ui_text(prop, "Clamp", "Maximum light contribution, reducing noise");
7086 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7087 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7088
7089 prop = RNA_def_property(srna, "use_volumetric_shadows", PROP_BOOLEAN, PROP_NONE);
7090 RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_VOLUMETRIC_SHADOWS);
7091 RNA_def_property_ui_text(
7092 prop, "Volumetric Shadows", "Generate shadows from volumetric material (Very expensive)");
7093 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7094 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7095
7096 prop = RNA_def_property(srna, "volumetric_shadow_samples", PROP_INT, PROP_NONE);
7097 RNA_def_property_range(prop, 1, 128);
7098 RNA_def_property_ui_text(
7099 prop, "Volumetric Shadow Samples", "Number of samples to compute volumetric shadowing");
7100 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7101 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7102
7103 /* Ambient Occlusion */
7104 prop = RNA_def_property(srna, "use_gtao", PROP_BOOLEAN, PROP_NONE);
7105 RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_GTAO_ENABLED);
7106 RNA_def_property_ui_text(prop,
7107 "Ambient Occlusion",
7108 "Enable ambient occlusion to simulate medium scale indirect shadowing");
7109 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7110 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7111
7112 prop = RNA_def_property(srna, "use_gtao_bent_normals", PROP_BOOLEAN, PROP_NONE);
7113 RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_GTAO_BENT_NORMALS);
7114 RNA_def_property_ui_text(
7115 prop, "Bent Normals", "Compute main non occluded direction to sample the environment");
7116 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7117 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7118
7119 prop = RNA_def_property(srna, "use_gtao_bounce", PROP_BOOLEAN, PROP_NONE);
7120 RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_GTAO_BOUNCE);
7121 RNA_def_property_ui_text(prop,
7122 "Bounces Approximation",
7123 "An approximation to simulate light bounces "
7124 "giving less occlusion on brighter objects");
7125 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7126 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7127
7128 prop = RNA_def_property(srna, "gtao_factor", PROP_FLOAT, PROP_FACTOR);
7129 RNA_def_property_ui_text(prop, "Factor", "Factor for ambient occlusion blending");
7130 RNA_def_property_range(prop, 0.0f, FLT_MAX);
7131 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1f, 2);
7132 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7133 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7134
7135 prop = RNA_def_property(srna, "gtao_quality", PROP_FLOAT, PROP_FACTOR);
7136 RNA_def_property_ui_text(prop, "Trace Precision", "Precision of the horizon search");
7137 RNA_def_property_range(prop, 0.0f, 1.0f);
7138 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7139 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7140
7141 prop = RNA_def_property(srna, "gtao_distance", PROP_FLOAT, PROP_DISTANCE);
7142 RNA_def_property_ui_text(
7143 prop, "Distance", "Distance of object that contribute to the ambient occlusion effect");
7144 RNA_def_property_range(prop, 0.0f, 100000.0f);
7145 RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
7146 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7147 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7148
7149 /* Depth of Field */
7150 prop = RNA_def_property(srna, "bokeh_max_size", PROP_FLOAT, PROP_PIXEL);
7151 RNA_def_property_ui_text(
7152 prop, "Max Size", "Max size of the bokeh shape for the depth of field (lower is faster)");
7153 RNA_def_property_range(prop, 0.0f, 2000.0f);
7154 RNA_def_property_ui_range(prop, 2.0f, 200.0f, 1, 3);
7155 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7156
7157 prop = RNA_def_property(srna, "bokeh_threshold", PROP_FLOAT, PROP_FACTOR);
7158 RNA_def_property_ui_text(
7159 prop, "Sprite Threshold", "Brightness threshold for using sprite base depth of field");
7160 RNA_def_property_range(prop, 0.0f, 100000.0f);
7161 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
7162 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7163 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7164
7165 /* Bloom */
7166 prop = RNA_def_property(srna, "use_bloom", PROP_BOOLEAN, PROP_NONE);
7167 RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_BLOOM_ENABLED);
7168 RNA_def_property_ui_text(prop, "Bloom", "High brightness pixels generate a glowing effect");
7169 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7170 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7171
7172 prop = RNA_def_property(srna, "bloom_threshold", PROP_FLOAT, PROP_FACTOR);
7173 RNA_def_property_ui_text(prop, "Threshold", "Filters out pixels under this level of brightness");
7174 RNA_def_property_range(prop, 0.0f, 100000.0f);
7175 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
7176 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7177 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7178
7179 prop = RNA_def_property(srna, "bloom_color", PROP_FLOAT, PROP_COLOR);
7180 RNA_def_property_array(prop, 3);
7181 RNA_def_property_ui_text(prop, "Color", "Color applied to the bloom effect");
7182 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7183 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7184
7185 prop = RNA_def_property(srna, "bloom_knee", PROP_FLOAT, PROP_FACTOR);
7186 RNA_def_property_ui_text(prop, "Knee", "Makes transition between under/over-threshold gradual");
7187 RNA_def_property_range(prop, 0.0f, 1.0f);
7188 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7189 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7190
7191 prop = RNA_def_property(srna, "bloom_radius", PROP_FLOAT, PROP_FACTOR);
7192 RNA_def_property_ui_text(prop, "Radius", "Bloom spread distance");
7193 RNA_def_property_range(prop, 0.0f, 100.0f);
7194 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
7195 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7196 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7197
7198 prop = RNA_def_property(srna, "bloom_clamp", PROP_FLOAT, PROP_FACTOR);
7199 RNA_def_property_ui_text(
7200 prop, "Clamp", "Maximum intensity a bloom pixel can have (0 to disabled)");
7201 RNA_def_property_range(prop, 0.0f, 100000.0f);
7202 RNA_def_property_ui_range(prop, 0.0f, 1000.0f, 1, 3);
7203 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7204 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7205
7206 prop = RNA_def_property(srna, "bloom_intensity", PROP_FLOAT, PROP_FACTOR);
7207 RNA_def_property_ui_text(prop, "Intensity", "Blend factor");
7208 RNA_def_property_range(prop, 0.0f, 10000.0f);
7209 RNA_def_property_ui_range(prop, 0.0f, 0.1f, 1, 3);
7210 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7211 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7212
7213 /* Motion blur */
7214 prop = RNA_def_property(srna, "use_motion_blur", PROP_BOOLEAN, PROP_NONE);
7215 RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_MOTION_BLUR_ENABLED);
7216 RNA_def_property_ui_text(prop, "Motion Blur", "Enable motion blur effect (only in camera view)");
7217 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7218 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7219
7220 prop = RNA_def_property(srna, "motion_blur_shutter", PROP_FLOAT, PROP_FACTOR);
7221 RNA_def_property_ui_text(prop, "Shutter", "Time taken in frames between shutter open and close");
7222 RNA_def_property_range(prop, 0.0f, FLT_MAX);
7223 RNA_def_property_ui_range(prop, 0.01f, 1.0f, 1, 2);
7224 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7225 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7226
7227 prop = RNA_def_property(srna, "motion_blur_depth_scale", PROP_FLOAT, PROP_NONE);
7228 RNA_def_property_ui_text(prop,
7229 "Background Separation",
7230 "Lower values will reduce background"
7231 " bleeding onto foreground elements");
7232 RNA_def_property_range(prop, 0.0f, FLT_MAX);
7233 RNA_def_property_ui_range(prop, 0.01f, 1000.0f, 1, 2);
7234 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7235 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7236
7237 prop = RNA_def_property(srna, "motion_blur_max", PROP_INT, PROP_PIXEL);
7238 RNA_def_property_ui_text(prop, "Max Blur", "Maximum blur distance a pixel can spread over");
7239 RNA_def_property_range(prop, 0, 2048);
7240 RNA_def_property_ui_range(prop, 0, 512, 1, -1);
7241 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7242 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7243
7244 prop = RNA_def_property(srna, "motion_blur_steps", PROP_INT, PROP_NONE);
7245 RNA_def_property_ui_text(prop,
7246 "Motion steps",
7247 "Controls accuracy of motion blur, "
7248 "more steps means longer render time");
7249 RNA_def_property_range(prop, 1, INT_MAX);
7250 RNA_def_property_ui_range(prop, 1, 64, 1, -1);
7251 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7252 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7253
7254 prop = RNA_def_property(srna, "motion_blur_position", PROP_ENUM, PROP_NONE);
7255 RNA_def_property_enum_items(prop, eevee_motion_blur_position_items);
7256 RNA_def_property_ui_text(prop,
7257 "Motion Blur Position",
7258 "Offset for the shutter's time interval, "
7259 "allows to change the motion blur trails");
7260 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7261 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7262
7263 /* Shadows */
7264 prop = RNA_def_property(srna, "shadow_cube_size", PROP_ENUM, PROP_NONE);
7265 RNA_def_property_enum_items(prop, eevee_shadow_size_items);
7266 RNA_def_property_ui_text(
7267 prop, "Cube Shadows Resolution", "Size of point and area light shadow maps");
7268 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7269 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7270
7271 prop = RNA_def_property(srna, "shadow_cascade_size", PROP_ENUM, PROP_NONE);
7272 RNA_def_property_enum_items(prop, eevee_shadow_size_items);
7273 RNA_def_property_ui_text(
7274 prop, "Directional Shadows Resolution", "Size of sun light shadow maps");
7275 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7276 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7277
7278 prop = RNA_def_property(srna, "use_shadow_high_bitdepth", PROP_BOOLEAN, PROP_NONE);
7279 RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_SHADOW_HIGH_BITDEPTH);
7280 RNA_def_property_ui_text(prop, "High Bitdepth", "Use 32bit shadows");
7281 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7282 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7283
7284 prop = RNA_def_property(srna, "use_soft_shadows", PROP_BOOLEAN, PROP_NONE);
7285 RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_SHADOW_SOFT);
7286 RNA_def_property_ui_text(
7287 prop, "Soft Shadows", "Randomize shadowmaps origin to create soft shadows");
7288 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7289 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7290
7291 prop = RNA_def_property(srna, "light_threshold", PROP_FLOAT, PROP_UNSIGNED);
7292 RNA_def_property_ui_text(prop,
7293 "Light Threshold",
7294 "Minimum light intensity for a light to contribute to the lighting");
7295 RNA_def_property_range(prop, 0.0f, FLT_MAX);
7296 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
7297 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7298 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7299
7300 /* Overscan */
7301 prop = RNA_def_property(srna, "use_overscan", PROP_BOOLEAN, PROP_NONE);
7302 RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_OVERSCAN);
7303 RNA_def_property_ui_text(prop,
7304 "Overscan",
7305 "Internally render past the image border to avoid "
7306 "screen-space effects disappearing");
7307 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7308
7309 prop = RNA_def_property(srna, "overscan_size", PROP_FLOAT, PROP_PERCENTAGE);
7310 RNA_def_property_float_sdna(prop, NULL, "overscan");
7311 RNA_def_property_ui_text(prop,
7312 "Overscan Size",
7313 "Percentage of render size to add as overscan to the "
7314 "internal render buffers");
7315 RNA_def_property_range(prop, 0.0f, 50.0f);
7316 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 2);
7317 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7318 }
7319
rna_def_scene_gpencil(BlenderRNA * brna)7320 static void rna_def_scene_gpencil(BlenderRNA *brna)
7321 {
7322 StructRNA *srna;
7323 PropertyRNA *prop;
7324
7325 srna = RNA_def_struct(brna, "SceneGpencil", NULL);
7326 RNA_def_struct_path_func(srna, "rna_SceneGpencil_path");
7327 RNA_def_struct_ui_text(srna, "Grease Pencil Render", "Render settings");
7328
7329 prop = RNA_def_property(srna, "antialias_threshold", PROP_FLOAT, PROP_NONE);
7330 RNA_def_property_float_sdna(prop, NULL, "smaa_threshold");
7331 RNA_def_property_float_default(prop, 1.0f);
7332 RNA_def_property_range(prop, 0.0f, FLT_MAX);
7333 RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
7334 RNA_def_property_ui_text(prop,
7335 "Anti-Aliasing Threshold",
7336 "Threshold for edge detection algorithm (higher values might over-blur "
7337 "some part of the image)");
7338 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7339 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7340 }
7341
RNA_def_scene(BlenderRNA * brna)7342 void RNA_def_scene(BlenderRNA *brna)
7343 {
7344 StructRNA *srna;
7345 PropertyRNA *prop;
7346
7347 FunctionRNA *func;
7348 PropertyRNA *parm;
7349
7350 static const EnumPropertyItem audio_distance_model_items[] = {
7351 {0, "NONE", 0, "None", "No distance attenuation"},
7352 {1, "INVERSE", 0, "Inverse", "Inverse distance model"},
7353 {2, "INVERSE_CLAMPED", 0, "Inverse Clamped", "Inverse distance model with clamping"},
7354 {3, "LINEAR", 0, "Linear", "Linear distance model"},
7355 {4, "LINEAR_CLAMPED", 0, "Linear Clamped", "Linear distance model with clamping"},
7356 {5, "EXPONENT", 0, "Exponent", "Exponent distance model"},
7357 {6, "EXPONENT_CLAMPED", 0, "Exponent Clamped", "Exponent distance model with clamping"},
7358 {0, NULL, 0, NULL, NULL},
7359 };
7360
7361 static const EnumPropertyItem sync_mode_items[] = {
7362 {0, "NONE", 0, "No Sync", "Do not sync, play every frame"},
7363 {SCE_FRAME_DROP, "FRAME_DROP", 0, "Frame Dropping", "Drop frames if playback is too slow"},
7364 {AUDIO_SYNC, "AUDIO_SYNC", 0, "AV-sync", "Sync to audio playback, dropping frames"},
7365 {0, NULL, 0, NULL, NULL},
7366 };
7367
7368 /* Struct definition */
7369 srna = RNA_def_struct(brna, "Scene", "ID");
7370 RNA_def_struct_ui_text(srna,
7371 "Scene",
7372 "Scene data-block, consisting in objects and "
7373 "defining time and render related settings");
7374 RNA_def_struct_ui_icon(srna, ICON_SCENE_DATA);
7375 RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT);
7376
7377 /* Global Settings */
7378 prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
7379 RNA_def_property_flag(prop, PROP_EDITABLE);
7380 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7381 RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Camera_object_poll");
7382 RNA_def_property_ui_text(prop, "Camera", "Active camera, used for rendering the scene");
7383 RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_camera_update");
7384
7385 prop = RNA_def_property(srna, "background_set", PROP_POINTER, PROP_NONE);
7386 RNA_def_property_pointer_sdna(prop, NULL, "set");
7387 RNA_def_property_struct_type(prop, "Scene");
7388 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
7389 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7390 RNA_def_property_pointer_funcs(prop, NULL, "rna_Scene_set_set", NULL, NULL);
7391 RNA_def_property_ui_text(prop, "Background Scene", "Background set scene");
7392 RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_set_update");
7393
7394 prop = RNA_def_property(srna, "world", PROP_POINTER, PROP_NONE);
7395 RNA_def_property_flag(prop, PROP_EDITABLE);
7396 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7397 RNA_def_property_ui_text(prop, "World", "World used for rendering the scene");
7398 RNA_def_property_update(prop, NC_SCENE | ND_WORLD, "rna_Scene_world_update");
7399
7400 prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);
7401 RNA_def_property_struct_type(prop, "Object");
7402 RNA_def_property_ui_text(prop, "Objects", "");
7403 RNA_def_property_collection_funcs(prop,
7404 "rna_Scene_objects_begin",
7405 "rna_Scene_objects_next",
7406 "rna_Scene_objects_end",
7407 "rna_Scene_objects_get",
7408 NULL,
7409 NULL,
7410 NULL,
7411 NULL);
7412 rna_def_scene_objects(brna, prop);
7413
7414 /* Frame Range Stuff */
7415 prop = RNA_def_property(srna, "frame_current", PROP_INT, PROP_TIME);
7416 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
7417 RNA_def_property_int_sdna(prop, NULL, "r.cfra");
7418 RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
7419 RNA_def_property_int_funcs(prop, NULL, "rna_Scene_frame_current_set", NULL);
7420 RNA_def_property_ui_text(
7421 prop,
7422 "Current Frame",
7423 "Current Frame, to update animation data from python frame_set() instead");
7424 RNA_def_property_update(prop, NC_SCENE | ND_FRAME, "rna_Scene_frame_update");
7425
7426 prop = RNA_def_property(srna, "frame_subframe", PROP_FLOAT, PROP_TIME);
7427 RNA_def_property_float_sdna(prop, NULL, "r.subframe");
7428 RNA_def_property_ui_text(prop, "Current Sub-Frame", "");
7429 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
7430 RNA_def_property_range(prop, 0.0f, 1.0f);
7431 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.01, 2);
7432 RNA_def_property_update(prop, NC_SCENE | ND_FRAME, "rna_Scene_frame_update");
7433
7434 prop = RNA_def_property(srna, "frame_float", PROP_FLOAT, PROP_TIME);
7435 RNA_def_property_ui_text(prop, "Current Sub-Frame", "");
7436 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
7437 RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
7438 RNA_def_property_ui_range(prop, MINAFRAME, MAXFRAME, 0.1, 2);
7439 RNA_def_property_float_funcs(
7440 prop, "rna_Scene_frame_float_get", "rna_Scene_frame_float_set", NULL);
7441 RNA_def_property_update(prop, NC_SCENE | ND_FRAME, "rna_Scene_frame_update");
7442
7443 prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
7444 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
7445 RNA_def_property_int_sdna(prop, NULL, "r.sfra");
7446 RNA_def_property_int_funcs(prop, NULL, "rna_Scene_start_frame_set", NULL);
7447 RNA_def_property_range(prop, MINFRAME, MAXFRAME);
7448 RNA_def_property_ui_text(prop, "Start Frame", "First frame of the playback/rendering range");
7449 RNA_def_property_update(prop, NC_SCENE | ND_FRAME_RANGE, NULL);
7450
7451 prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
7452 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
7453 RNA_def_property_int_sdna(prop, NULL, "r.efra");
7454 RNA_def_property_int_funcs(prop, NULL, "rna_Scene_end_frame_set", NULL);
7455 RNA_def_property_range(prop, MINFRAME, MAXFRAME);
7456 RNA_def_property_ui_text(prop, "End Frame", "Final frame of the playback/rendering range");
7457 RNA_def_property_update(prop, NC_SCENE | ND_FRAME_RANGE, NULL);
7458
7459 prop = RNA_def_property(srna, "frame_step", PROP_INT, PROP_TIME);
7460 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
7461 RNA_def_property_int_sdna(prop, NULL, "r.frame_step");
7462 RNA_def_property_range(prop, 0, MAXFRAME);
7463 RNA_def_property_ui_range(prop, 1, 100, 1, -1);
7464 RNA_def_property_ui_text(
7465 prop,
7466 "Frame Step",
7467 "Number of frames to skip forward while rendering/playing back each frame");
7468 RNA_def_property_update(prop, NC_SCENE | ND_FRAME, NULL);
7469
7470 prop = RNA_def_property(srna, "frame_current_final", PROP_FLOAT, PROP_TIME);
7471 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
7472 RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
7473 RNA_def_property_float_funcs(prop, "rna_Scene_frame_current_final_get", NULL, NULL);
7474 RNA_def_property_ui_text(
7475 prop, "Current Frame Final", "Current frame with subframe and time remapping applied");
7476
7477 prop = RNA_def_property(srna, "lock_frame_selection_to_range", PROP_BOOLEAN, PROP_NONE);
7478 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
7479 RNA_def_property_boolean_sdna(prop, NULL, "r.flag", SCER_LOCK_FRAME_SELECTION);
7480 RNA_def_property_ui_text(prop,
7481 "Lock Frame Selection",
7482 "Don't allow frame to be selected with mouse outside of frame range");
7483 RNA_def_property_update(prop, NC_SCENE | ND_FRAME, NULL);
7484
7485 /* Preview Range (frame-range for UI playback) */
7486 prop = RNA_def_property(srna, "use_preview_range", PROP_BOOLEAN, PROP_NONE);
7487 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
7488 RNA_def_property_boolean_sdna(prop, NULL, "r.flag", SCER_PRV_RANGE);
7489 RNA_def_property_boolean_funcs(prop, NULL, "rna_Scene_use_preview_range_set");
7490 RNA_def_property_ui_text(
7491 prop,
7492 "Use Preview Range",
7493 "Use an alternative start/end frame range for animation playback and view renders");
7494 RNA_def_property_update(prop, NC_SCENE | ND_FRAME, NULL);
7495 RNA_def_property_ui_icon(prop, ICON_PREVIEW_RANGE, 0);
7496
7497 prop = RNA_def_property(srna, "frame_preview_start", PROP_INT, PROP_TIME);
7498 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
7499 RNA_def_property_int_sdna(prop, NULL, "r.psfra");
7500 RNA_def_property_int_funcs(prop, NULL, "rna_Scene_preview_range_start_frame_set", NULL);
7501 RNA_def_property_ui_text(
7502 prop, "Preview Range Start Frame", "Alternative start frame for UI playback");
7503 RNA_def_property_update(prop, NC_SCENE | ND_FRAME, NULL);
7504
7505 prop = RNA_def_property(srna, "frame_preview_end", PROP_INT, PROP_TIME);
7506 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
7507 RNA_def_property_int_sdna(prop, NULL, "r.pefra");
7508 RNA_def_property_int_funcs(prop, NULL, "rna_Scene_preview_range_end_frame_set", NULL);
7509 RNA_def_property_ui_text(
7510 prop, "Preview Range End Frame", "Alternative end frame for UI playback");
7511 RNA_def_property_update(prop, NC_SCENE | ND_FRAME, NULL);
7512
7513 /* Subframe for moblur debug. */
7514 prop = RNA_def_property(srna, "show_subframe", PROP_BOOLEAN, PROP_NONE);
7515 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
7516 RNA_def_property_boolean_sdna(prop, NULL, "r.flag", SCER_SHOW_SUBFRAME);
7517 RNA_def_property_ui_text(
7518 prop, "Show Subframe", "Show current scene subframe and allow set it using interface tools");
7519 RNA_def_property_update(prop, NC_SCENE | ND_FRAME, "rna_Scene_show_subframe_update");
7520
7521 /* Timeline / Time Navigation settings */
7522 prop = RNA_def_property(srna, "show_keys_from_selected_only", PROP_BOOLEAN, PROP_NONE);
7523 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SCE_KEYS_NO_SELONLY);
7524 RNA_def_property_ui_text(prop,
7525 "Only Keyframes from Selected Channels",
7526 "Consider keyframes for active Object and/or its selected bones only "
7527 "(in timeline and when jumping between keyframes)");
7528 RNA_def_property_update(prop, NC_SCENE | ND_FRAME, NULL);
7529
7530 /* Stamp */
7531 prop = RNA_def_property(srna, "use_stamp_note", PROP_STRING, PROP_NONE);
7532 RNA_def_property_string_sdna(prop, NULL, "r.stamp_udata");
7533 RNA_def_property_ui_text(prop, "Stamp Note", "User defined note for the render stamping");
7534 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
7535
7536 /* Animation Data (for Scene) */
7537 rna_def_animdata_common(srna);
7538
7539 /* Readonly Properties */
7540 prop = RNA_def_property(srna, "is_nla_tweakmode", PROP_BOOLEAN, PROP_NONE);
7541 RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_NLA_EDIT_ON);
7542 RNA_def_property_clear_flag(prop,
7543 PROP_EDITABLE); /* DO NOT MAKE THIS EDITABLE, OR NLA EDITOR BREAKS */
7544 RNA_def_property_ui_text(
7545 prop,
7546 "NLA TweakMode",
7547 "Whether there is any action referenced by NLA being edited (strictly read-only)");
7548 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
7549
7550 /* Frame dropping flag for playback and sync enum */
7551 # if 0 /* XXX: Is this actually needed? */
7552 prop = RNA_def_property(srna, "use_frame_drop", PROP_BOOLEAN, PROP_NONE);
7553 RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_FRAME_DROP);
7554 RNA_def_property_ui_text(
7555 prop, "Frame Dropping", "Play back dropping frames if frame display is too slow");
7556 RNA_def_property_update(prop, NC_SCENE, NULL);
7557 # endif
7558
7559 prop = RNA_def_property(srna, "sync_mode", PROP_ENUM, PROP_NONE);
7560 RNA_def_property_enum_funcs(prop, "rna_Scene_sync_mode_get", "rna_Scene_sync_mode_set", NULL);
7561 RNA_def_property_enum_items(prop, sync_mode_items);
7562 RNA_def_property_enum_default(prop, AUDIO_SYNC);
7563 RNA_def_property_ui_text(prop, "Sync Mode", "How to sync playback");
7564 RNA_def_property_update(prop, NC_SCENE, NULL);
7565
7566 /* Nodes (Compositing) */
7567 prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
7568 RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
7569 RNA_def_property_clear_flag(prop, PROP_PTR_NO_OWNERSHIP);
7570 RNA_def_property_ui_text(prop, "Node Tree", "Compositing node tree");
7571
7572 prop = RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE);
7573 RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1);
7574 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
7575 RNA_def_property_ui_text(prop, "Use Nodes", "Enable the compositing node tree");
7576 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_use_nodes_update");
7577
7578 /* Sequencer */
7579 prop = RNA_def_property(srna, "sequence_editor", PROP_POINTER, PROP_NONE);
7580 RNA_def_property_pointer_sdna(prop, NULL, "ed");
7581 RNA_def_property_struct_type(prop, "SequenceEditor");
7582 RNA_def_property_ui_text(prop, "Sequence Editor", "");
7583
7584 /* Keying Sets */
7585 prop = RNA_def_property(srna, "keying_sets", PROP_COLLECTION, PROP_NONE);
7586 RNA_def_property_collection_sdna(prop, NULL, "keyingsets", NULL);
7587 RNA_def_property_struct_type(prop, "KeyingSet");
7588 RNA_def_property_ui_text(prop, "Absolute Keying Sets", "Absolute Keying Sets for this Scene");
7589 RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET, NULL);
7590 rna_def_scene_keying_sets(brna, prop);
7591
7592 prop = RNA_def_property(srna, "keying_sets_all", PROP_COLLECTION, PROP_NONE);
7593 RNA_def_property_collection_funcs(prop,
7594 "rna_Scene_all_keyingsets_begin",
7595 "rna_Scene_all_keyingsets_next",
7596 "rna_iterator_listbase_end",
7597 "rna_iterator_listbase_get",
7598 NULL,
7599 NULL,
7600 NULL,
7601 NULL);
7602 RNA_def_property_struct_type(prop, "KeyingSet");
7603 RNA_def_property_ui_text(
7604 prop,
7605 "All Keying Sets",
7606 "All Keying Sets available for use (Builtins and Absolute Keying Sets for this Scene)");
7607 RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET, NULL);
7608 rna_def_scene_keying_sets_all(brna, prop);
7609
7610 /* Rigid Body Simulation */
7611 prop = RNA_def_property(srna, "rigidbody_world", PROP_POINTER, PROP_NONE);
7612 RNA_def_property_pointer_sdna(prop, NULL, "rigidbody_world");
7613 RNA_def_property_struct_type(prop, "RigidBodyWorld");
7614 RNA_def_property_ui_text(prop, "Rigid Body World", "");
7615 RNA_def_property_update(prop, NC_SCENE, "rna_Physics_relations_update");
7616
7617 /* Tool Settings */
7618 prop = RNA_def_property(srna, "tool_settings", PROP_POINTER, PROP_NONE);
7619 RNA_def_property_flag(prop, PROP_NEVER_NULL);
7620 RNA_def_property_pointer_sdna(prop, NULL, "toolsettings");
7621 RNA_def_property_struct_type(prop, "ToolSettings");
7622 RNA_def_property_ui_text(prop, "Tool Settings", "");
7623
7624 /* Unit Settings */
7625 prop = RNA_def_property(srna, "unit_settings", PROP_POINTER, PROP_NONE);
7626 RNA_def_property_flag(prop, PROP_NEVER_NULL);
7627 RNA_def_property_pointer_sdna(prop, NULL, "unit");
7628 RNA_def_property_struct_type(prop, "UnitSettings");
7629 RNA_def_property_ui_text(prop, "Unit Settings", "Unit editing settings");
7630
7631 /* Physics Settings */
7632 prop = RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_ACCELERATION);
7633 RNA_def_property_float_sdna(prop, NULL, "physics_settings.gravity");
7634 RNA_def_property_array(prop, 3);
7635 RNA_def_property_ui_range(prop, -200.0f, 200.0f, 1, 2);
7636 RNA_def_property_ui_text(prop, "Gravity", "Constant acceleration in a given direction");
7637 RNA_def_property_update(prop, 0, "rna_Physics_update");
7638
7639 prop = RNA_def_property(srna, "use_gravity", PROP_BOOLEAN, PROP_NONE);
7640 RNA_def_property_boolean_sdna(prop, NULL, "physics_settings.flag", PHYS_GLOBAL_GRAVITY);
7641 RNA_def_property_ui_text(prop, "Global Gravity", "Use global gravity for all dynamics");
7642 RNA_def_property_update(prop, 0, "rna_Physics_update");
7643
7644 /* Render Data */
7645 prop = RNA_def_property(srna, "render", PROP_POINTER, PROP_NONE);
7646 RNA_def_property_flag(prop, PROP_NEVER_NULL);
7647 RNA_def_property_pointer_sdna(prop, NULL, "r");
7648 RNA_def_property_struct_type(prop, "RenderSettings");
7649 RNA_def_property_ui_text(prop, "Render Data", "");
7650
7651 /* Safe Areas */
7652 prop = RNA_def_property(srna, "safe_areas", PROP_POINTER, PROP_NONE);
7653 RNA_def_property_pointer_sdna(prop, NULL, "safe_areas");
7654 RNA_def_property_flag(prop, PROP_NEVER_NULL);
7655 RNA_def_property_struct_type(prop, "DisplaySafeAreas");
7656 RNA_def_property_ui_text(prop, "Safe Areas", "");
7657
7658 /* Markers */
7659 prop = RNA_def_property(srna, "timeline_markers", PROP_COLLECTION, PROP_NONE);
7660 RNA_def_property_collection_sdna(prop, NULL, "markers", NULL);
7661 RNA_def_property_struct_type(prop, "TimelineMarker");
7662 RNA_def_property_ui_text(
7663 prop, "Timeline Markers", "Markers used in all timelines for the current scene");
7664 rna_def_timeline_markers(brna, prop);
7665
7666 /* Transform Orientations */
7667 prop = RNA_def_property(srna, "transform_orientation_slots", PROP_COLLECTION, PROP_NONE);
7668 RNA_def_property_collection_funcs(prop,
7669 "rna_Scene_transform_orientation_slots_begin",
7670 "rna_iterator_array_next",
7671 "rna_iterator_array_end",
7672 "rna_iterator_array_get",
7673 "rna_Scene_transform_orientation_slots_length",
7674 NULL,
7675 NULL,
7676 NULL);
7677 RNA_def_property_struct_type(prop, "TransformOrientationSlot");
7678 RNA_def_property_ui_text(prop, "Transform Orientation Slots", "");
7679
7680 /* 3D View Cursor */
7681 prop = RNA_def_property(srna, "cursor", PROP_POINTER, PROP_NONE);
7682 RNA_def_property_flag(prop, PROP_NEVER_NULL);
7683 RNA_def_property_pointer_sdna(prop, NULL, "cursor");
7684 RNA_def_property_struct_type(prop, "View3DCursor");
7685 RNA_def_property_ui_text(prop, "3D Cursor", "");
7686
7687 /* Audio Settings */
7688 prop = RNA_def_property(srna, "use_audio", PROP_BOOLEAN, PROP_NONE);
7689 RNA_def_property_boolean_funcs(prop, "rna_Scene_use_audio_get", "rna_Scene_use_audio_set");
7690 RNA_def_property_ui_text(
7691 prop, "Audio Muted", "Play back of audio from Sequence Editor will be muted");
7692 RNA_def_property_update(prop, NC_SCENE, "rna_Scene_use_audio_update");
7693
7694 # if 0 /* XXX: Is this actually needed? */
7695 prop = RNA_def_property(srna, "use_audio_sync", PROP_BOOLEAN, PROP_NONE);
7696 RNA_def_property_boolean_sdna(prop, NULL, "audio.flag", AUDIO_SYNC);
7697 RNA_def_property_ui_text(
7698 prop,
7699 "Audio Sync",
7700 "Play back and sync with audio clock, dropping frames if frame display is too slow");
7701 RNA_def_property_update(prop, NC_SCENE, NULL);
7702 # endif
7703
7704 prop = RNA_def_property(srna, "use_audio_scrub", PROP_BOOLEAN, PROP_NONE);
7705 RNA_def_property_boolean_sdna(prop, NULL, "audio.flag", AUDIO_SCRUB);
7706 RNA_def_property_ui_text(
7707 prop, "Audio Scrubbing", "Play audio from Sequence Editor while scrubbing");
7708 RNA_def_property_update(prop, NC_SCENE, NULL);
7709
7710 prop = RNA_def_property(srna, "audio_doppler_speed", PROP_FLOAT, PROP_NONE);
7711 RNA_def_property_float_sdna(prop, NULL, "audio.speed_of_sound");
7712 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
7713 RNA_def_property_range(prop, 0.01f, FLT_MAX);
7714 RNA_def_property_ui_text(
7715 prop, "Speed of Sound", "Speed of sound for Doppler effect calculation");
7716 RNA_def_property_update(prop, NC_SCENE, "rna_Scene_listener_update");
7717
7718 prop = RNA_def_property(srna, "audio_doppler_factor", PROP_FLOAT, PROP_NONE);
7719 RNA_def_property_float_sdna(prop, NULL, "audio.doppler_factor");
7720 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
7721 RNA_def_property_range(prop, 0.0, FLT_MAX);
7722 RNA_def_property_ui_text(prop, "Doppler Factor", "Pitch factor for Doppler effect calculation");
7723 RNA_def_property_update(prop, NC_SCENE, "rna_Scene_listener_update");
7724
7725 prop = RNA_def_property(srna, "audio_distance_model", PROP_ENUM, PROP_NONE);
7726 RNA_def_property_enum_bitflag_sdna(prop, NULL, "audio.distance_model");
7727 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
7728 RNA_def_property_enum_items(prop, audio_distance_model_items);
7729 RNA_def_property_ui_text(
7730 prop, "Distance Model", "Distance model for distance attenuation calculation");
7731 RNA_def_property_update(prop, NC_SCENE, "rna_Scene_listener_update");
7732
7733 prop = RNA_def_property(srna, "audio_volume", PROP_FLOAT, PROP_NONE);
7734 RNA_def_property_float_sdna(prop, NULL, "audio.volume");
7735 RNA_def_property_range(prop, 0.0f, 100.0f);
7736 RNA_def_property_ui_text(prop, "Volume", "Audio volume");
7737 RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND);
7738 RNA_def_property_update(prop, NC_SCENE, NULL);
7739 RNA_def_property_update(prop, NC_SCENE, "rna_Scene_volume_update");
7740
7741 /* Statistics */
7742 func = RNA_def_function(srna, "statistics", "rna_Scene_statistics_string_get");
7743 RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
7744 parm = RNA_def_pointer(func, "view_layer", "ViewLayer", "View Layer", "");
7745 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
7746 parm = RNA_def_string(func, "statistics", NULL, 0, "Statistics", "");
7747 RNA_def_function_return(func, parm);
7748
7749 /* Grease Pencil */
7750 prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
7751 RNA_def_property_pointer_sdna(prop, NULL, "gpd");
7752 RNA_def_property_struct_type(prop, "GreasePencil");
7753 RNA_def_property_pointer_funcs(
7754 prop, NULL, NULL, NULL, "rna_GPencil_datablocks_annotations_poll");
7755 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
7756 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
7757 RNA_def_property_ui_text(
7758 prop, "Annotations", "Grease Pencil data-block used for annotations in the 3D view");
7759 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
7760
7761 /* active MovieClip */
7762 prop = RNA_def_property(srna, "active_clip", PROP_POINTER, PROP_NONE);
7763 RNA_def_property_pointer_sdna(prop, NULL, "clip");
7764 RNA_def_property_flag(prop, PROP_EDITABLE);
7765 RNA_def_property_struct_type(prop, "MovieClip");
7766 RNA_def_property_ui_text(
7767 prop, "Active Movie Clip", "Active movie clip used for constraints and viewport drawing");
7768 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
7769
7770 /* color management */
7771 prop = RNA_def_property(srna, "view_settings", PROP_POINTER, PROP_NONE);
7772 RNA_def_property_pointer_sdna(prop, NULL, "view_settings");
7773 RNA_def_property_struct_type(prop, "ColorManagedViewSettings");
7774 RNA_def_property_ui_text(
7775 prop, "View Settings", "Color management settings applied on image before saving");
7776
7777 prop = RNA_def_property(srna, "display_settings", PROP_POINTER, PROP_NONE);
7778 RNA_def_property_pointer_sdna(prop, NULL, "display_settings");
7779 RNA_def_property_struct_type(prop, "ColorManagedDisplaySettings");
7780 RNA_def_property_ui_text(
7781 prop, "Display Settings", "Settings of device saved image would be displayed on");
7782
7783 prop = RNA_def_property(srna, "sequencer_colorspace_settings", PROP_POINTER, PROP_NONE);
7784 RNA_def_property_pointer_sdna(prop, NULL, "sequencer_colorspace_settings");
7785 RNA_def_property_struct_type(prop, "ColorManagedSequencerColorspaceSettings");
7786 RNA_def_property_ui_text(
7787 prop, "Sequencer Color Space Settings", "Settings of color space sequencer is working in");
7788
7789 /* Layer and Collections */
7790 prop = RNA_def_property(srna, "view_layers", PROP_COLLECTION, PROP_NONE);
7791 RNA_def_property_collection_sdna(prop, NULL, "view_layers", NULL);
7792 RNA_def_property_struct_type(prop, "ViewLayer");
7793 RNA_def_property_ui_text(prop, "View Layers", "");
7794 rna_def_view_layers(brna, prop);
7795
7796 prop = RNA_def_property(srna, "collection", PROP_POINTER, PROP_NONE);
7797 RNA_def_property_flag(prop, PROP_NEVER_NULL);
7798 RNA_def_property_pointer_sdna(prop, NULL, "master_collection");
7799 RNA_def_property_struct_type(prop, "Collection");
7800 RNA_def_property_clear_flag(prop, PROP_PTR_NO_OWNERSHIP);
7801 RNA_def_property_ui_text(
7802 prop,
7803 "Collection",
7804 "Scene master collection that objects and other collections in the scene");
7805
7806 /* Scene Display */
7807 prop = RNA_def_property(srna, "display", PROP_POINTER, PROP_NONE);
7808 RNA_def_property_pointer_sdna(prop, NULL, "display");
7809 RNA_def_property_struct_type(prop, "SceneDisplay");
7810 RNA_def_property_ui_text(prop, "Scene Display", "Scene display settings for 3d viewport");
7811
7812 /* EEVEE */
7813 prop = RNA_def_property(srna, "eevee", PROP_POINTER, PROP_NONE);
7814 RNA_def_property_struct_type(prop, "SceneEEVEE");
7815 RNA_def_property_ui_text(prop, "EEVEE", "EEVEE settings for the scene");
7816
7817 /* Grease Pencil */
7818 prop = RNA_def_property(srna, "grease_pencil_settings", PROP_POINTER, PROP_NONE);
7819 RNA_def_property_struct_type(prop, "SceneGpencil");
7820 RNA_def_property_ui_text(prop, "Grease Pencil", "Grease Pencil settings for the scene");
7821
7822 /* Nestled Data */
7823 /* *** Non-Animated *** */
7824 RNA_define_animate_sdna(false);
7825 rna_def_tool_settings(brna);
7826 rna_def_gpencil_interpolate(brna);
7827 rna_def_unified_paint_settings(brna);
7828 rna_def_curve_paint_settings(brna);
7829 rna_def_statvis(brna);
7830 rna_def_unit_settings(brna);
7831 rna_def_scene_image_format_data(brna);
7832 rna_def_transform_orientation(brna);
7833 rna_def_transform_orientation_slot(brna);
7834 rna_def_view3d_cursor(brna);
7835 rna_def_selected_uv_element(brna);
7836 rna_def_display_safe_areas(brna);
7837 rna_def_scene_display(brna);
7838 rna_def_scene_eevee(brna);
7839 rna_def_view_layer_eevee(brna);
7840 rna_def_scene_gpencil(brna);
7841 RNA_define_animate_sdna(true);
7842 /* *** Animated *** */
7843 rna_def_scene_render_data(brna);
7844 rna_def_scene_render_view(brna);
7845
7846 /* Scene API */
7847 RNA_api_scene(srna);
7848 }
7849
7850 #endif
7851