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.
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.
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.
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"
37 #include "IMB_imbuf_types.h"
39 #include "BLI_listbase.h"
42 #include "BLT_translation.h"
44 #include "BKE_armature.h"
45 #include "BKE_editmesh.h"
46 #include "BKE_paint.h"
47 #include "BKE_volume.h"
49 #include "ED_gpencil.h"
50 #include "ED_object.h"
52 #include "RNA_define.h"
53 #include "RNA_enum_types.h"
55 #include "rna_internal.h"
57 /* Include for Bake Options */
58 #include "RE_engine.h"
59 #include "RE_pipeline.h"
62 # include "BKE_writeffmpeg.h"
63 # include "ffmpeg_compat.h"
64 # include <libavcodec/avcodec.h>
65 # include <libavformat/avformat.h>
68 #include "ED_render.h"
69 #include "ED_transform.h"
74 #include "BLI_threads.h"
76 #include "DEG_depsgraph.h"
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},
96 static const EnumPropertyItem uv_sculpt_relaxation_items[] = {
97 {UV_SCULPT_TOOL_RELAX_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},
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},
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"},
121 ICON_INVERSESQUARECURVE,
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},
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},
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},
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},
158 const EnumPropertyItem rna_enum_snap_element_items[] = {
159 {SCE_SNAP_MODE_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,
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},
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,
189 "Snap to any node border"},
190 {0, NULL, 0, NULL, NULL},
194 static const EnumPropertyItem snap_uv_element_items[] = {
195 {SCE_SNAP_MODE_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},
204 static const EnumPropertyItem rna_enum_scene_display_aa_methods[] = {
209 "Scene will be rendering without any anti-aliasing"},
210 {SCE_DISPLAY_AA_FXAA,
213 "Single Pass Anti-Aliasing",
214 "Scene will be rendered using a single pass anti-aliasing method (FXAA)"},
215 {SCE_DISPLAY_AA_SAMPLES_5,
219 "Scene will be rendered using 5 anti-aliasing samples"},
220 {SCE_DISPLAY_AA_SAMPLES_8,
224 "Scene will be rendered using 8 anti-aliasing samples"},
225 {SCE_DISPLAY_AA_SAMPLES_11,
229 "Scene will be rendered using 11 anti-aliasing samples"},
230 {SCE_DISPLAY_AA_SAMPLES_16,
234 "Scene will be rendered using 16 anti-aliasing samples"},
235 {SCE_DISPLAY_AA_SAMPLES_32,
239 "Scene will be rendered using 32 anti-aliasing samples"},
240 {0, NULL, 0, NULL, NULL},
244 const EnumPropertyItem rna_enum_curve_fit_method_items[] = {
245 {CURVE_PAINT_FIT_METHOD_REFIT,
249 "Incrementally refit the curve (high quality)"},
250 {CURVE_PAINT_FIT_METHOD_SPLIT,
254 "Split the curve until the tolerance is met (fast)"},
255 {0, NULL, 0, NULL, NULL},
258 /* workaround for duplicate enums,
259 * have each enum line as a define then conditionally set it or not
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, \
277 "Output image in uncompressed Targa format"},
279 #if 0 /* UNUSED (so far) */
281 # define R_IMF_ENUM_DDS \
282 {R_IMF_IMTYPE_DDS, "DDS", ICON_FILE_IMAGE, "DDS", "Output image in DDS format"},
284 # define R_IMF_ENUM_DDS
289 # define R_IMF_ENUM_JPEG2K \
294 "Output image in JPEG 2000 format"},
296 # define R_IMF_ENUM_JPEG2K
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"},
305 # define R_IMF_ENUM_CINEON
306 # define R_IMF_ENUM_DPX
310 # define R_IMF_ENUM_EXR_MULTILAYER \
311 {R_IMF_IMTYPE_MULTILAYER, \
312 "OPEN_EXR_MULTILAYER", \
314 "OpenEXR MultiLayer", \
315 "Output image in multilayer OpenEXR format"},
316 # define R_IMF_ENUM_EXR \
317 {R_IMF_IMTYPE_OPENEXR, \
321 "Output image in OpenEXR format"},
323 # define R_IMF_ENUM_EXR_MULTILAYER
324 # define R_IMF_ENUM_EXR
328 # define R_IMF_ENUM_HDR \
329 {R_IMF_IMTYPE_RADHDR, \
333 "Output image in Radiance HDR format"},
335 # define R_IMF_ENUM_HDR
339 # define R_IMF_ENUM_TIFF \
340 {R_IMF_IMTYPE_TIFF, "TIFF", ICON_FILE_IMAGE, "TIFF", "Output image in TIFF format"},
342 # define R_IMF_ENUM_TIFF
345 #define IMAGE_TYPE_ITEMS_IMAGE_ONLY \
347 /* DDS save not supported yet R_IMF_ENUM_DDS */ \
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 \
358 static const EnumPropertyItem image_only_type_items[] = {
360 IMAGE_TYPE_ITEMS_IMAGE_ONLY
362 {0, NULL, 0, NULL, NULL},
366 const EnumPropertyItem rna_enum_image_type_items[] = {
367 {0, "", 0, N_("Image"), NULL},
369 IMAGE_TYPE_ITEMS_IMAGE_ONLY
371 {0, "", 0, N_("Movie"), NULL},
372 {R_IMF_IMTYPE_AVIJPEG,
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"},
379 {R_IMF_IMTYPE_FFMPEG,
383 "The most versatile way to output video files"},
385 {0, NULL, 0, NULL, NULL},
388 const EnumPropertyItem rna_enum_image_color_mode_items[] = {
393 "Images get saved in 8-bit grayscale (only PNG, JPEG, TGA, TIF)"},
394 {R_IMF_PLANES_RGB, "RGB", 0, "RGB", "Images are saved with RGB (color) data"},
399 "Images are saved with RGB and Alpha data (if supported)"},
400 {0, NULL, 0, NULL, NULL},
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]
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"},
416 {R_IMF_CHAN_DEPTH_32, "32", 0, "32", "32-bit color channels"},
417 {0, NULL, 0, NULL, NULL},
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},
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},
436 const EnumPropertyItem rna_enum_bake_target_items[] = {
437 {R_BAKE_TARGET_IMAGE_TEXTURES,
441 "Bake to image data-blocks associated with active image texture nodes in materials"},
442 {R_BAKE_TARGET_VERTEX_COLORS,
446 "Bake to active vertex color layer on meshes"},
447 {0, NULL, 0, NULL, NULL},
450 const EnumPropertyItem rna_enum_bake_save_mode_items[] = {
451 {R_BAKE_SAVE_INTERNAL,
455 "Save the baking map in an internal image data-block"},
456 {R_BAKE_SAVE_EXTERNAL, "EXTERNAL", 0, "External", "Save the baking map in an external file"},
457 {0, NULL, 0, NULL, NULL},
460 #define R_IMF_VIEWS_ENUM_IND \
461 {R_IMF_VIEWS_INDIVIDUAL, \
465 "Individual files for each view with the prefix as defined by the scene views"},
466 #define R_IMF_VIEWS_ENUM_S3D \
467 {R_IMF_VIEWS_STEREO_3D, "STEREO_3D", 0, "Stereo 3D", "Single file with an encoded stereo pair"},
468 #define R_IMF_VIEWS_ENUM_MV \
469 {R_IMF_VIEWS_MULTIVIEW, "MULTIVIEW", 0, "Multi-View", "Single file with all the views"},
471 const EnumPropertyItem rna_enum_views_format_items[] = {
472 R_IMF_VIEWS_ENUM_IND R_IMF_VIEWS_ENUM_S3D{0, NULL, 0, NULL, NULL},
475 const EnumPropertyItem rna_enum_views_format_multilayer_items[] = {
476 R_IMF_VIEWS_ENUM_IND R_IMF_VIEWS_ENUM_MV{0, NULL, 0, NULL, NULL},
479 const EnumPropertyItem rna_enum_views_format_multiview_items[] = {
480 R_IMF_VIEWS_ENUM_IND R_IMF_VIEWS_ENUM_S3D R_IMF_VIEWS_ENUM_MV{0, NULL, 0, NULL, NULL},
483 #undef R_IMF_VIEWS_ENUM_IND
484 #undef R_IMF_VIEWS_ENUM_S3D
485 #undef R_IMF_VIEWS_ENUM_MV
487 const EnumPropertyItem rna_enum_stereo3d_display_items[] = {
488 {S3D_DISPLAY_ANAGLYPH,
492 "Render views for left and right eyes as two differently filtered colors in a single image "
493 "(anaglyph glasses are required)"},
494 {S3D_DISPLAY_INTERLACE,
498 "Render views for left and right eyes interlaced in a single image (3D-ready monitor is "
500 {S3D_DISPLAY_PAGEFLIP,
504 "Render alternate eyes (also known as page flip, quad buffer support in the graphic card is "
506 {S3D_DISPLAY_SIDEBYSIDE,
510 "Render views for left and right eyes side-by-side"},
511 {S3D_DISPLAY_TOPBOTTOM,
515 "Render views for left and right eyes one above another"},
516 {0, NULL, 0, NULL, NULL},
519 const EnumPropertyItem rna_enum_stereo3d_anaglyph_type_items[] = {
520 {S3D_ANAGLYPH_REDCYAN, "RED_CYAN", 0, "Red-Cyan", ""},
521 {S3D_ANAGLYPH_GREENMAGENTA, "GREEN_MAGENTA", 0, "Green-Magenta", ""},
522 {S3D_ANAGLYPH_YELLOWBLUE, "YELLOW_BLUE", 0, "Yellow-Blue", ""},
523 {0, NULL, 0, NULL, NULL},
526 const EnumPropertyItem rna_enum_stereo3d_interlace_type_items[] = {
527 {S3D_INTERLACE_ROW, "ROW_INTERLEAVED", 0, "Row Interleaved", ""},
528 {S3D_INTERLACE_COLUMN, "COLUMN_INTERLEAVED", 0, "Column Interleaved", ""},
529 {S3D_INTERLACE_CHECKERBOARD, "CHECKERBOARD_INTERLEAVED", 0, "Checkerboard Interleaved", ""},
530 {0, NULL, 0, NULL, NULL},
533 const EnumPropertyItem rna_enum_bake_pass_filter_type_items[] = {
534 {R_BAKE_PASS_FILTER_NONE, "NONE", 0, "None", ""},
535 {R_BAKE_PASS_FILTER_AO, "AO", 0, "Ambient Occlusion", ""},
536 {R_BAKE_PASS_FILTER_EMIT, "EMIT", 0, "Emit", ""},
537 {R_BAKE_PASS_FILTER_DIRECT, "DIRECT", 0, "Direct", ""},
538 {R_BAKE_PASS_FILTER_INDIRECT, "INDIRECT", 0, "Indirect", ""},
539 {R_BAKE_PASS_FILTER_COLOR, "COLOR", 0, "Color", ""},
540 {R_BAKE_PASS_FILTER_DIFFUSE, "DIFFUSE", 0, "Diffuse", ""},
541 {R_BAKE_PASS_FILTER_GLOSSY, "GLOSSY", 0, "Glossy", ""},
542 {R_BAKE_PASS_FILTER_TRANSM, "TRANSMISSION", 0, "Transmission", ""},
543 {0, NULL, 0, NULL, NULL},
546 static const EnumPropertyItem rna_enum_view_layer_aov_type_items[] = {
547 {AOV_TYPE_COLOR, "COLOR", 0, "Color", ""},
548 {AOV_TYPE_VALUE, "VALUE", 0, "Value", ""},
549 {0, NULL, 0, NULL, NULL},
553 static const EnumPropertyItem rna_enum_gpencil_interpolation_mode_items[] = {
555 {0, "", 0, N_("Interpolation"), "Standard transitions between keyframes"},
560 "Straight-line interpolation between A and B (i.e. no ease in/out)"},
565 "Custom interpolation defined using a curve map"},
571 N_("Easing (by strength)"),
572 "Predefined inertial transitions, useful for motion graphics (from least to most "
578 "Sinusoidal easing (weakest, almost linear but with a slight curvature)"},
579 {GP_IPO_QUAD, "QUAD", ICON_IPO_QUAD, "Quadratic", "Quadratic easing"},
580 {GP_IPO_CUBIC, "CUBIC", ICON_IPO_CUBIC, "Cubic", "Cubic easing"},
581 {GP_IPO_QUART, "QUART", ICON_IPO_QUART, "Quartic", "Quartic easing"},
582 {GP_IPO_QUINT, "QUINT", ICON_IPO_QUINT, "Quintic", "Quintic easing"},
583 {GP_IPO_EXPO, "EXPO", ICON_IPO_EXPO, "Exponential", "Exponential easing (dramatic)"},
588 "Circular easing (strongest and most dynamic)"},
590 {0, "", 0, N_("Dynamic Effects"), "Simple physics-inspired easing effects"},
591 {GP_IPO_BACK, "BACK", ICON_IPO_BACK, "Back", "Cubic easing with overshoot and settle"},
596 "Exponentially decaying parabolic bounce, like when objects collide"},
601 "Exponentially decaying sine wave, like an elastic band"},
603 {0, NULL, 0, NULL, NULL},
608 const EnumPropertyItem rna_enum_transform_pivot_items_full[] = {
609 {V3D_AROUND_CENTER_BOUNDS,
610 "BOUNDING_BOX_CENTER",
612 "Bounding Box Center",
613 "Pivot around bounding box center of selected object(s)"},
614 {V3D_AROUND_CURSOR, "CURSOR", ICON_PIVOT_CURSOR, "3D Cursor", "Pivot around the 3D cursor"},
615 {V3D_AROUND_LOCAL_ORIGINS,
616 "INDIVIDUAL_ORIGINS",
617 ICON_PIVOT_INDIVIDUAL,
618 "Individual Origins",
619 "Pivot around each object's own origin"},
620 {V3D_AROUND_CENTER_MEDIAN,
624 "Pivot around the median point of selected objects"},
629 "Pivot around active object"},
630 {0, NULL, 0, NULL, NULL},
633 /* Icons could be made a consistent set of images. */
634 const EnumPropertyItem rna_enum_transform_orientation_items[] = {
637 ICON_ORIENTATION_GLOBAL,
639 "Align the transformation axes to world space"},
642 ICON_ORIENTATION_LOCAL,
644 "Align the transformation axes to the selected objects' local space"},
647 ICON_ORIENTATION_NORMAL,
649 "Align the transformation axes to average normal of selected elements "
650 "(bone Y axis for pose mode)"},
653 ICON_ORIENTATION_GIMBAL,
655 "Align each axis to the Euler rotation axis as used for input"},
658 ICON_ORIENTATION_VIEW,
660 "Align the transformation axes to the window"},
663 ICON_ORIENTATION_CURSOR,
665 "Align the transformation axes to the 3D cursor"},
666 // {V3D_ORIENT_CUSTOM, "CUSTOM", 0, "Custom", "Use a custom transform orientation"},
667 {0, NULL, 0, NULL, NULL},
672 # include "BLI_string_utils.h"
674 # include "DNA_anim_types.h"
675 # include "DNA_color_types.h"
676 # include "DNA_mesh_types.h"
677 # include "DNA_node_types.h"
678 # include "DNA_object_types.h"
679 # include "DNA_text_types.h"
680 # include "DNA_workspace_types.h"
682 # include "RNA_access.h"
684 # include "MEM_guardedalloc.h"
686 # include "BKE_animsys.h"
687 # include "BKE_brush.h"
688 # include "BKE_collection.h"
689 # include "BKE_colortools.h"
690 # include "BKE_context.h"
691 # include "BKE_freestyle.h"
692 # include "BKE_global.h"
693 # include "BKE_gpencil.h"
694 # include "BKE_idprop.h"
695 # include "BKE_image.h"
696 # include "BKE_layer.h"
697 # include "BKE_main.h"
698 # include "BKE_mesh.h"
699 # include "BKE_node.h"
700 # include "BKE_pointcache.h"
701 # include "BKE_scene.h"
702 # include "BKE_screen.h"
703 # include "BKE_unit.h"
705 # include "ED_image.h"
706 # include "ED_info.h"
707 # include "ED_keyframing.h"
708 # include "ED_mesh.h"
709 # include "ED_node.h"
710 # include "ED_scene.h"
711 # include "ED_view3d.h"
713 # include "DEG_depsgraph_build.h"
714 # include "DEG_depsgraph_query.h"
716 # include "SEQ_relations.h"
717 # include "SEQ_sequencer.h"
718 # include "SEQ_sound.h"
720 # ifdef WITH_FREESTYLE
721 # include "FRS_freestyle.h"
724 static void rna_ToolSettings_snap_mode_set(struct PointerRNA *ptr, int value)
726 ToolSettings *ts = (ToolSettings *)ptr->data;
728 ts->snap_mode = value;
732 /* Grease Pencil update cache */
733 static void rna_GPencil_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
735 ED_gpencil_tag_scene_gpencil(scene);
738 /* Grease Pencil Interpolation settings */
739 static char *rna_GPencilInterpolateSettings_path(PointerRNA *UNUSED(ptr))
741 return BLI_strdup("tool_settings.gpencil_interpolate");
744 static void rna_GPencilInterpolateSettings_type_set(PointerRNA *ptr, int value)
746 GP_Interpolate_Settings *settings = (GP_Interpolate_Settings *)ptr->data;
748 /* NOTE: This cast should be fine, as we have a small + finite set of values
749 * (#eGP_Interpolate_Type) that should fit well within a char.
751 settings->type = (char)value;
753 /* init custom interpolation curve here now the first time it's used */
754 if ((settings->type == GP_IPO_CURVEMAP) && (settings->custom_ipo == NULL)) {
755 settings->custom_ipo = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
759 static void rna_Gpencil_extend_selection(bContext *C, PointerRNA *UNUSED(ptr))
761 /* Extend selection to all points in all selected strokes. */
762 ViewLayer *view_layer = CTX_data_view_layer(C);
763 Object *ob = OBACT(view_layer);
764 if ((ob) && (ob->type == OB_GPENCIL)) {
765 bGPdata *gpd = (bGPdata *)ob->data;
766 CTX_DATA_BEGIN (C, bGPDstroke *, gps, editable_gpencil_strokes) {
767 if ((gps->flag & GP_STROKE_SELECT) && (gps->totpoints > 1)) {
769 for (int i = 0; i < gps->totpoints; i++) {
770 pt = &gps->points[i];
771 pt->flag |= GP_SPOINT_SELECT;
777 gpd->flag |= GP_DATA_CACHE_IS_DIRTY;
778 DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
782 static void rna_Gpencil_selectmode_update(bContext *C, PointerRNA *ptr)
784 ToolSettings *ts = (ToolSettings *)ptr->data;
785 /* If the mode is not Stroke, don't extend selection. */
786 if ((ts->gpencil_selectmode_edit & GP_SELECTMODE_STROKE) == 0) {
790 rna_Gpencil_extend_selection(C, ptr);
793 static void rna_Gpencil_mask_point_update(bContext *UNUSED(C), PointerRNA *ptr)
795 ToolSettings *ts = (ToolSettings *)ptr->data;
797 ts->gpencil_selectmode_sculpt &= ~GP_SCULPT_MASK_SELECTMODE_STROKE;
798 ts->gpencil_selectmode_sculpt &= ~GP_SCULPT_MASK_SELECTMODE_SEGMENT;
801 static void rna_Gpencil_mask_stroke_update(bContext *C, PointerRNA *ptr)
803 ToolSettings *ts = (ToolSettings *)ptr->data;
805 ts->gpencil_selectmode_sculpt &= ~GP_SCULPT_MASK_SELECTMODE_POINT;
806 ts->gpencil_selectmode_sculpt &= ~GP_SCULPT_MASK_SELECTMODE_SEGMENT;
808 rna_Gpencil_extend_selection(C, ptr);
811 static void rna_Gpencil_mask_segment_update(bContext *UNUSED(C), PointerRNA *ptr)
813 ToolSettings *ts = (ToolSettings *)ptr->data;
815 ts->gpencil_selectmode_sculpt &= ~GP_SCULPT_MASK_SELECTMODE_POINT;
816 ts->gpencil_selectmode_sculpt &= ~GP_SCULPT_MASK_SELECTMODE_STROKE;
819 static void rna_Gpencil_vertex_mask_point_update(bContext *C, PointerRNA *ptr)
821 ToolSettings *ts = (ToolSettings *)ptr->data;
823 ts->gpencil_selectmode_vertex &= ~GP_VERTEX_MASK_SELECTMODE_STROKE;
824 ts->gpencil_selectmode_vertex &= ~GP_VERTEX_MASK_SELECTMODE_SEGMENT;
826 ED_gpencil_tag_scene_gpencil(CTX_data_scene(C));
829 static void rna_Gpencil_vertex_mask_stroke_update(bContext *C, PointerRNA *ptr)
831 ToolSettings *ts = (ToolSettings *)ptr->data;
833 ts->gpencil_selectmode_vertex &= ~GP_VERTEX_MASK_SELECTMODE_POINT;
834 ts->gpencil_selectmode_vertex &= ~GP_VERTEX_MASK_SELECTMODE_SEGMENT;
836 rna_Gpencil_extend_selection(C, ptr);
838 ED_gpencil_tag_scene_gpencil(CTX_data_scene(C));
841 static void rna_Gpencil_vertex_mask_segment_update(bContext *C, PointerRNA *ptr)
843 ToolSettings *ts = (ToolSettings *)ptr->data;
845 ts->gpencil_selectmode_vertex &= ~GP_VERTEX_MASK_SELECTMODE_POINT;
846 ts->gpencil_selectmode_vertex &= ~GP_VERTEX_MASK_SELECTMODE_STROKE;
848 ED_gpencil_tag_scene_gpencil(CTX_data_scene(C));
851 /* Read-only Iterator of all the scene objects. */
853 static void rna_Scene_objects_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
855 Scene *scene = (Scene *)ptr->data;
856 iter->internal.custom = MEM_callocN(sizeof(BLI_Iterator), __func__);
858 ((BLI_Iterator *)iter->internal.custom)->valid = true;
859 BKE_scene_objects_iterator_begin(iter->internal.custom, (void *)scene);
860 iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid;
863 static void rna_Scene_objects_next(CollectionPropertyIterator *iter)
865 BKE_scene_objects_iterator_next(iter->internal.custom);
866 iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid;
869 static void rna_Scene_objects_end(CollectionPropertyIterator *iter)
871 BKE_scene_objects_iterator_end(iter->internal.custom);
872 MEM_freeN(iter->internal.custom);
875 static PointerRNA rna_Scene_objects_get(CollectionPropertyIterator *iter)
877 Object *ob = ((BLI_Iterator *)iter->internal.custom)->current;
878 return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, ob);
881 /* End of read-only Iterator of all the scene objects. */
883 static void rna_Scene_set_set(PointerRNA *ptr,
885 struct ReportList *UNUSED(reports))
887 Scene *scene = (Scene *)ptr->data;
888 Scene *set = (Scene *)value.data;
891 for (nested_set = set; nested_set; nested_set = nested_set->set) {
892 if (nested_set == scene) {
895 /* prevent eternal loops, set can point to next, and next to set, without problems usually */
896 if (nested_set->set == set) {
901 id_lib_extern((ID *)set);
905 void rna_Scene_set_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
907 Scene *scene = (Scene *)ptr->owner_id;
909 DEG_relations_tag_update(bmain);
910 DEG_id_tag_update_ex(bmain, &scene->id, 0);
911 if (scene->set != NULL) {
912 /* Objects which are pulled into main scene's depsgraph needs to have
913 * their base flags updated.
915 DEG_id_tag_update_ex(bmain, &scene->set->id, 0);
919 static void rna_Scene_camera_update(Main *bmain, Scene *UNUSED(scene_unused), PointerRNA *ptr)
921 wmWindowManager *wm = bmain->wm.first;
922 Scene *scene = (Scene *)ptr->data;
924 WM_windows_scene_data_sync(&wm->windows, scene);
925 DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE);
926 DEG_relations_tag_update(bmain);
929 static void rna_Scene_fps_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr))
931 DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_FPS | ID_RECALC_SEQUENCER_STRIPS);
932 /* NOTE: Tag via dependency graph will take care of all the updates ion the evaluated domain,
933 * however, changes in FPS actually modifies an original skip length,
934 * so this we take care about here. */
935 SEQ_sound_update_length(bmain, scene);
938 static void rna_Scene_listener_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
940 DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_LISTENER);
943 static void rna_Scene_volume_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
945 Scene *scene = (Scene *)ptr->owner_id;
946 DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_VOLUME | ID_RECALC_SEQUENCER_STRIPS);
949 static const char *rna_Scene_statistics_string_get(Scene *scene,
952 ViewLayer *view_layer)
954 if (!BKE_scene_has_view_layer(scene, view_layer)) {
957 "View Layer '%s' not found in scene '%s'",
963 return ED_info_statistics_string(bmain, scene, view_layer);
966 static void rna_Scene_framelen_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
968 scene->r.framelen = (float)scene->r.framapto / (float)scene->r.images;
971 static void rna_Scene_frame_current_set(PointerRNA *ptr, int value)
973 Scene *data = (Scene *)ptr->data;
975 /* if negative frames aren't allowed, then we can't use them */
976 FRAMENUMBER_MIN_CLAMP(value);
977 data->r.cfra = value;
980 static float rna_Scene_frame_float_get(PointerRNA *ptr)
982 Scene *data = (Scene *)ptr->data;
983 return (float)data->r.cfra + data->r.subframe;
986 static void rna_Scene_frame_float_set(PointerRNA *ptr, float value)
988 Scene *data = (Scene *)ptr->data;
989 /* if negative frames aren't allowed, then we can't use them */
990 FRAMENUMBER_MIN_CLAMP(value);
991 data->r.cfra = (int)value;
992 data->r.subframe = value - data->r.cfra;
995 static float rna_Scene_frame_current_final_get(PointerRNA *ptr)
997 Scene *scene = (Scene *)ptr->data;
999 return BKE_scene_frame_to_ctime(scene, (float)scene->r.cfra);
1002 static void rna_Scene_start_frame_set(PointerRNA *ptr, int value)
1004 Scene *data = (Scene *)ptr->data;
1005 /* MINFRAME not MINAFRAME, since some output formats can't taken negative frames */
1006 CLAMP(value, MINFRAME, MAXFRAME);
1007 data->r.sfra = value;
1009 if (value > data->r.efra) {
1010 data->r.efra = MIN2(value, MAXFRAME);
1014 static void rna_Scene_end_frame_set(PointerRNA *ptr, int value)
1016 Scene *data = (Scene *)ptr->data;
1017 CLAMP(value, MINFRAME, MAXFRAME);
1018 data->r.efra = value;
1020 if (data->r.sfra > value) {
1021 data->r.sfra = MAX2(value, MINFRAME);
1025 static void rna_Scene_use_preview_range_set(PointerRNA *ptr, bool value)
1027 Scene *data = (Scene *)ptr->data;
1030 /* copy range from scene if not set before */
1031 if ((data->r.psfra == data->r.pefra) && (data->r.psfra == 0)) {
1032 data->r.psfra = data->r.sfra;
1033 data->r.pefra = data->r.efra;
1036 data->r.flag |= SCER_PRV_RANGE;
1039 data->r.flag &= ~SCER_PRV_RANGE;
1043 static void rna_Scene_preview_range_start_frame_set(PointerRNA *ptr, int value)
1045 Scene *data = (Scene *)ptr->data;
1047 /* check if enabled already */
1048 if ((data->r.flag & SCER_PRV_RANGE) == 0) {
1049 /* set end of preview range to end frame, then clamp as per normal */
1050 /* TODO: or just refuse to set instead? */
1051 data->r.pefra = data->r.efra;
1053 CLAMP(value, MINAFRAME, MAXFRAME);
1054 data->r.psfra = value;
1056 if (value > data->r.pefra) {
1057 data->r.pefra = MIN2(value, MAXFRAME);
1061 static void rna_Scene_preview_range_end_frame_set(PointerRNA *ptr, int value)
1063 Scene *data = (Scene *)ptr->data;
1065 /* check if enabled already */
1066 if ((data->r.flag & SCER_PRV_RANGE) == 0) {
1067 /* set start of preview range to start frame, then clamp as per normal */
1068 /* TODO: or just refuse to set instead? */
1069 data->r.psfra = data->r.sfra;
1071 CLAMP(value, MINAFRAME, MAXFRAME);
1072 data->r.pefra = value;
1074 if (data->r.psfra > value) {
1075 data->r.psfra = MAX2(value, MINAFRAME);
1079 static void rna_Scene_show_subframe_update(Main *UNUSED(bmain),
1080 Scene *UNUSED(current_scene),
1083 Scene *scene = (Scene *)ptr->owner_id;
1084 scene->r.subframe = 0.0f;
1087 static void rna_Scene_frame_update(Main *UNUSED(bmain),
1088 Scene *UNUSED(current_scene),
1091 Scene *scene = (Scene *)ptr->owner_id;
1092 DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_SEEK);
1093 WM_main_add_notifier(NC_SCENE | ND_FRAME, scene);
1096 static PointerRNA rna_Scene_active_keying_set_get(PointerRNA *ptr)
1098 Scene *scene = (Scene *)ptr->data;
1099 return rna_pointer_inherit_refine(ptr, &RNA_KeyingSet, ANIM_scene_get_active_keyingset(scene));
1102 static void rna_Scene_active_keying_set_set(PointerRNA *ptr,
1104 struct ReportList *UNUSED(reports))
1106 Scene *scene = (Scene *)ptr->data;
1107 KeyingSet *ks = (KeyingSet *)value.data;
1109 scene->active_keyingset = ANIM_scene_get_keyingset_index(scene, ks);
1112 /* get KeyingSet index stuff for list of Keying Sets editing UI
1113 * - active_keyingset-1 since 0 is reserved for 'none'
1114 * - don't clamp, otherwise can never set builtin's types as active...
1116 static int rna_Scene_active_keying_set_index_get(PointerRNA *ptr)
1118 Scene *scene = (Scene *)ptr->data;
1119 return scene->active_keyingset - 1;
1122 /* get KeyingSet index stuff for list of Keying Sets editing UI
1123 * - value+1 since 0 is reserved for 'none'
1125 static void rna_Scene_active_keying_set_index_set(PointerRNA *ptr, int value)
1127 Scene *scene = (Scene *)ptr->data;
1128 scene->active_keyingset = value + 1;
1131 /* XXX: evil... builtin_keyingsets is defined in keyingsets.c! */
1132 /* TODO: make API function to retrieve this... */
1133 extern ListBase builtin_keyingsets;
1135 static void rna_Scene_all_keyingsets_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
1137 Scene *scene = (Scene *)ptr->data;
1139 /* start going over the scene KeyingSets first, while we still have pointer to it
1140 * but only if we have any Keying Sets to use...
1142 if (scene->keyingsets.first) {
1143 rna_iterator_listbase_begin(iter, &scene->keyingsets, NULL);
1146 rna_iterator_listbase_begin(iter, &builtin_keyingsets, NULL);
1150 static void rna_Scene_all_keyingsets_next(CollectionPropertyIterator *iter)
1152 ListBaseIterator *internal = &iter->internal.listbase;
1153 KeyingSet *ks = (KeyingSet *)internal->link;
1155 /* If we've run out of links in Scene list,
1156 * jump over to the builtins list unless we're there already. */
1157 if ((ks->next == NULL) && (ks != builtin_keyingsets.last)) {
1158 internal->link = (Link *)builtin_keyingsets.first;
1161 internal->link = (Link *)ks->next;
1164 iter->valid = (internal->link != NULL);
1167 static char *rna_SceneEEVEE_path(PointerRNA *UNUSED(ptr))
1169 return BLI_strdup("eevee");
1172 static char *rna_SceneGpencil_path(PointerRNA *UNUSED(ptr))
1174 return BLI_strdup("grease_pencil_settings");
1177 static int rna_RenderSettings_stereoViews_skip(CollectionPropertyIterator *iter,
1180 ListBaseIterator *internal = &iter->internal.listbase;
1181 SceneRenderView *srv = (SceneRenderView *)internal->link;
1183 if (STR_ELEM(srv->name, STEREO_LEFT_NAME, STEREO_RIGHT_NAME)) {
1190 static void rna_RenderSettings_stereoViews_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
1192 RenderData *rd = (RenderData *)ptr->data;
1193 rna_iterator_listbase_begin(iter, &rd->views, rna_RenderSettings_stereoViews_skip);
1196 static char *rna_RenderSettings_path(PointerRNA *UNUSED(ptr))
1198 return BLI_strdup("render");
1201 static char *rna_BakeSettings_path(PointerRNA *UNUSED(ptr))
1203 return BLI_strdup("render.bake");
1206 static char *rna_ImageFormatSettings_path(PointerRNA *ptr)
1208 ImageFormatData *imf = (ImageFormatData *)ptr->data;
1209 ID *id = ptr->owner_id;
1211 switch (GS(id->name)) {
1213 Scene *scene = (Scene *)id;
1215 if (&scene->r.im_format == imf) {
1216 return BLI_strdup("render.image_settings");
1218 else if (&scene->r.bake.im_format == imf) {
1219 return BLI_strdup("render.bake.image_settings");
1221 return BLI_strdup("..");
1224 bNodeTree *ntree = (bNodeTree *)id;
1227 for (node = ntree->nodes.first; node; node = node->next) {
1228 if (node->type == CMP_NODE_OUTPUT_FILE) {
1229 if (&((NodeImageMultiFile *)node->storage)->format == imf) {
1230 return BLI_sprintfN("nodes['%s'].format", node->name);
1235 for (sock = node->inputs.first; sock; sock = sock->next) {
1236 NodeImageMultiFileSocket *sockdata = sock->storage;
1237 if (&sockdata->format == imf) {
1238 return BLI_sprintfN(
1239 "nodes['%s'].file_slots['%s'].format", node->name, sockdata->path);
1245 return BLI_strdup("..");
1248 return BLI_strdup("..");
1252 static int rna_RenderSettings_threads_get(PointerRNA *ptr)
1254 RenderData *rd = (RenderData *)ptr->data;
1255 return BKE_render_num_threads(rd);
1258 static int rna_RenderSettings_threads_mode_get(PointerRNA *ptr)
1260 RenderData *rd = (RenderData *)ptr->data;
1261 int override = BLI_system_num_threads_override_get();
1264 return R_FIXED_THREADS;
1267 return (rd->mode & R_FIXED_THREADS);
1271 static bool rna_RenderSettings_is_movie_format_get(PointerRNA *ptr)
1273 RenderData *rd = (RenderData *)ptr->data;
1274 return BKE_imtype_is_movie(rd->im_format.imtype);
1277 static void rna_ImageFormatSettings_file_format_set(PointerRNA *ptr, int value)
1279 ImageFormatData *imf = (ImageFormatData *)ptr->data;
1280 ID *id = ptr->owner_id;
1281 imf->imtype = value;
1283 const bool is_render = (id && GS(id->name) == ID_SCE);
1284 /* see note below on why this is */
1285 const char chan_flag = BKE_imtype_valid_channels(imf->imtype, true) |
1286 (is_render ? IMA_CHAN_FLAG_BW : 0);
1288 /* ensure depth and color settings match */
1289 if (((imf->planes == R_IMF_PLANES_BW) && !(chan_flag & IMA_CHAN_FLAG_BW)) ||
1290 ((imf->planes == R_IMF_PLANES_RGBA) && !(chan_flag & IMA_CHAN_FLAG_ALPHA))) {
1291 imf->planes = R_IMF_PLANES_RGB;
1294 /* ensure usable depth */
1296 const int depth_ok = BKE_imtype_valid_depths(imf->imtype);
1297 if ((imf->depth & depth_ok) == 0) {
1298 /* set first available depth */
1300 R_IMF_CHAN_DEPTH_32,
1301 R_IMF_CHAN_DEPTH_24,
1302 R_IMF_CHAN_DEPTH_16,
1303 R_IMF_CHAN_DEPTH_12,
1304 R_IMF_CHAN_DEPTH_10,
1311 for (i = 0; depth_ls[i]; i++) {
1312 if (depth_ok & depth_ls[i]) {
1313 imf->depth = depth_ls[i];
1320 if (id && GS(id->name) == ID_SCE) {
1321 Scene *scene = (Scene *)ptr->owner_id;
1322 RenderData *rd = &scene->r;
1324 BKE_ffmpeg_image_type_verify(rd, imf);
1330 static const EnumPropertyItem *rna_ImageFormatSettings_file_format_itemf(bContext *UNUSED(C),
1332 PropertyRNA *UNUSED(prop),
1333 bool *UNUSED(r_free))
1335 ID *id = ptr->owner_id;
1336 if (id && GS(id->name) == ID_SCE) {
1337 return rna_enum_image_type_items;
1340 return image_only_type_items;
1344 static const EnumPropertyItem *rna_ImageFormatSettings_color_mode_itemf(bContext *UNUSED(C),
1346 PropertyRNA *UNUSED(prop),
1349 ImageFormatData *imf = (ImageFormatData *)ptr->data;
1350 ID *id = ptr->owner_id;
1351 const bool is_render = (id && GS(id->name) == ID_SCE);
1353 /* note, we need to act differently for render
1354 * where 'BW' will force grayscale even if the output format writes
1355 * as RGBA, this is age old blender convention and not sure how useful
1356 * it really is but keep it for now - campbell */
1357 char chan_flag = BKE_imtype_valid_channels(imf->imtype, true) |
1358 (is_render ? IMA_CHAN_FLAG_BW : 0);
1361 /* a WAY more crappy case than B&W flag: depending on codec, file format MIGHT support
1362 * alpha channel. for example MPEG format with h264 codec can't do alpha channel, but
1363 * the same MPEG format with QTRLE codec can easily handle alpha channel.
1364 * not sure how to deal with such cases in a nicer way (sergey) */
1366 Scene *scene = (Scene *)ptr->owner_id;
1367 RenderData *rd = &scene->r;
1369 if (BKE_ffmpeg_alpha_channel_is_supported(rd)) {
1370 chan_flag |= IMA_CHAN_FLAG_ALPHA;
1375 if (chan_flag == (IMA_CHAN_FLAG_BW | IMA_CHAN_FLAG_RGB | IMA_CHAN_FLAG_ALPHA)) {
1376 return rna_enum_image_color_mode_items;
1380 EnumPropertyItem *item = NULL;
1382 if (chan_flag & IMA_CHAN_FLAG_BW) {
1383 RNA_enum_item_add(&item, &totitem, &IMAGE_COLOR_MODE_BW);
1385 if (chan_flag & IMA_CHAN_FLAG_RGB) {
1386 RNA_enum_item_add(&item, &totitem, &IMAGE_COLOR_MODE_RGB);
1388 if (chan_flag & IMA_CHAN_FLAG_ALPHA) {
1389 RNA_enum_item_add(&item, &totitem, &IMAGE_COLOR_MODE_RGBA);
1392 RNA_enum_item_end(&item, &totitem);
1399 static const EnumPropertyItem *rna_ImageFormatSettings_color_depth_itemf(bContext *UNUSED(C),
1401 PropertyRNA *UNUSED(prop),
1404 ImageFormatData *imf = (ImageFormatData *)ptr->data;
1407 return rna_enum_image_color_depth_items;
1410 const int depth_ok = BKE_imtype_valid_depths(imf->imtype);
1411 const int is_float = ELEM(
1412 imf->imtype, R_IMF_IMTYPE_RADHDR, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER);
1414 const EnumPropertyItem *item_8bit = &rna_enum_image_color_depth_items[0];
1415 const EnumPropertyItem *item_10bit = &rna_enum_image_color_depth_items[1];
1416 const EnumPropertyItem *item_12bit = &rna_enum_image_color_depth_items[2];
1417 const EnumPropertyItem *item_16bit = &rna_enum_image_color_depth_items[3];
1418 const EnumPropertyItem *item_32bit = &rna_enum_image_color_depth_items[4];
1421 EnumPropertyItem *item = NULL;
1422 EnumPropertyItem tmp = {0, "", 0, "", ""};
1424 if (depth_ok & R_IMF_CHAN_DEPTH_8) {
1425 RNA_enum_item_add(&item, &totitem, item_8bit);
1428 if (depth_ok & R_IMF_CHAN_DEPTH_10) {
1429 RNA_enum_item_add(&item, &totitem, item_10bit);
1432 if (depth_ok & R_IMF_CHAN_DEPTH_12) {
1433 RNA_enum_item_add(&item, &totitem, item_12bit);
1436 if (depth_ok & R_IMF_CHAN_DEPTH_16) {
1439 tmp.name = "Float (Half)";
1440 RNA_enum_item_add(&item, &totitem, &tmp);
1443 RNA_enum_item_add(&item, &totitem, item_16bit);
1447 if (depth_ok & R_IMF_CHAN_DEPTH_32) {
1450 tmp.name = "Float (Full)";
1451 RNA_enum_item_add(&item, &totitem, &tmp);
1454 RNA_enum_item_add(&item, &totitem, item_32bit);
1458 RNA_enum_item_end(&item, &totitem);
1465 static const EnumPropertyItem *rna_ImageFormatSettings_views_format_itemf(
1466 bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
1468 ImageFormatData *imf = (ImageFormatData *)ptr->data;
1471 return rna_enum_views_format_items;
1473 else if (imf->imtype == R_IMF_IMTYPE_OPENEXR) {
1474 return rna_enum_views_format_multiview_items;
1476 else if (imf->imtype == R_IMF_IMTYPE_MULTILAYER) {
1477 return rna_enum_views_format_multilayer_items;
1480 return rna_enum_views_format_items;
1484 # ifdef WITH_OPENEXR
1487 static const EnumPropertyItem *rna_ImageFormatSettings_exr_codec_itemf(bContext *UNUSED(C),
1489 PropertyRNA *UNUSED(prop),
1492 ImageFormatData *imf = (ImageFormatData *)ptr->data;
1494 EnumPropertyItem *item = NULL;
1495 int i = 1, totitem = 0;
1497 if (imf->depth == 16) {
1498 return rna_enum_exr_codec_items; /* All compression types are defined for halfs */
1501 for (i = 0; i < R_IMF_EXR_CODEC_MAX; i++) {
1502 if ((i == R_IMF_EXR_CODEC_B44 || i == R_IMF_EXR_CODEC_B44A)) {
1503 continue; /* B44 and B44A are not defined for 32 bit floats */
1506 RNA_enum_item_add(&item, &totitem, &rna_enum_exr_codec_items[i]);
1509 RNA_enum_item_end(&item, &totitem);
1516 static int rna_SceneRender_file_ext_length(PointerRNA *ptr)
1518 RenderData *rd = (RenderData *)ptr->data;
1521 BKE_image_path_ensure_ext_from_imformat(ext, &rd->im_format);
1525 static void rna_SceneRender_file_ext_get(PointerRNA *ptr, char *str)
1527 RenderData *rd = (RenderData *)ptr->data;
1529 BKE_image_path_ensure_ext_from_imformat(str, &rd->im_format);
1533 static void rna_FFmpegSettings_lossless_output_set(PointerRNA *ptr, bool value)
1535 Scene *scene = (Scene *)ptr->owner_id;
1536 RenderData *rd = &scene->r;
1539 rd->ffcodecdata.flags |= FFMPEG_LOSSLESS_OUTPUT;
1542 rd->ffcodecdata.flags &= ~FFMPEG_LOSSLESS_OUTPUT;
1545 BKE_ffmpeg_codec_settings_verify(rd);
1548 static void rna_FFmpegSettings_codec_settings_update(Main *UNUSED(bmain),
1549 Scene *UNUSED(scene_unused),
1552 Scene *scene = (Scene *)ptr->owner_id;
1553 RenderData *rd = &scene->r;
1555 BKE_ffmpeg_codec_settings_verify(rd);
1559 static int rna_RenderSettings_active_view_index_get(PointerRNA *ptr)
1561 RenderData *rd = (RenderData *)ptr->data;
1565 static void rna_RenderSettings_active_view_index_set(PointerRNA *ptr, int value)
1567 RenderData *rd = (RenderData *)ptr->data;
1568 rd->actview = value;
1571 static void rna_RenderSettings_active_view_index_range(
1572 PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
1574 RenderData *rd = (RenderData *)ptr->data;
1577 *max = max_ii(0, BLI_listbase_count(&rd->views) - 1);
1580 static PointerRNA rna_RenderSettings_active_view_get(PointerRNA *ptr)
1582 RenderData *rd = (RenderData *)ptr->data;
1583 SceneRenderView *srv = BLI_findlink(&rd->views, rd->actview);
1585 return rna_pointer_inherit_refine(ptr, &RNA_SceneRenderView, srv);
1588 static void rna_RenderSettings_active_view_set(PointerRNA *ptr,
1590 struct ReportList *UNUSED(reports))
1592 RenderData *rd = (RenderData *)ptr->data;
1593 SceneRenderView *srv = (SceneRenderView *)value.data;
1594 const int index = BLI_findindex(&rd->views, srv);
1596 rd->actview = index;
1600 static SceneRenderView *rna_RenderView_new(ID *id, RenderData *UNUSED(rd), const char *name)
1602 Scene *scene = (Scene *)id;
1603 SceneRenderView *srv = BKE_scene_add_render_view(scene, name);
1605 WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
1610 static void rna_RenderView_remove(
1611 ID *id, RenderData *UNUSED(rd), Main *UNUSED(bmain), ReportList *reports, PointerRNA *srv_ptr)
1613 SceneRenderView *srv = srv_ptr->data;
1614 Scene *scene = (Scene *)id;
1616 if (!BKE_scene_remove_render_view(scene, srv)) {
1617 BKE_reportf(reports,
1619 "Render view '%s' could not be removed from scene '%s'",
1621 scene->id.name + 2);
1625 RNA_POINTER_INVALIDATE(srv_ptr);
1627 WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
1630 static void rna_RenderSettings_views_format_set(PointerRNA *ptr, int value)
1632 RenderData *rd = (RenderData *)ptr->data;
1634 if (rd->views_format == SCE_VIEWS_FORMAT_MULTIVIEW && value == SCE_VIEWS_FORMAT_STEREO_3D) {
1635 /* make sure the actview is visible */
1636 if (rd->actview > 1) {
1641 rd->views_format = value;
1644 static void rna_RenderSettings_engine_set(PointerRNA *ptr, int value)
1646 RenderData *rd = (RenderData *)ptr->data;
1647 RenderEngineType *type = BLI_findlink(&R_engines, value);
1650 BLI_strncpy_utf8(rd->engine, type->idname, sizeof(rd->engine));
1651 DEG_id_tag_update(ptr->owner_id, ID_RECALC_COPY_ON_WRITE);
1655 static const EnumPropertyItem *rna_RenderSettings_engine_itemf(bContext *UNUSED(C),
1656 PointerRNA *UNUSED(ptr),
1657 PropertyRNA *UNUSED(prop),
1660 RenderEngineType *type;
1661 EnumPropertyItem *item = NULL;
1662 EnumPropertyItem tmp = {0, "", 0, "", ""};
1663 int a = 0, totitem = 0;
1665 for (type = R_engines.first; type; type = type->next, a++) {
1667 tmp.identifier = type->idname;
1668 tmp.name = type->name;
1669 RNA_enum_item_add(&item, &totitem, &tmp);
1672 RNA_enum_item_end(&item, &totitem);
1678 static int rna_RenderSettings_engine_get(PointerRNA *ptr)
1680 RenderData *rd = (RenderData *)ptr->data;
1681 RenderEngineType *type;
1684 for (type = R_engines.first; type; type = type->next, a++) {
1685 if (STREQ(type->idname, rd->engine)) {
1693 static void rna_RenderSettings_engine_update(Main *bmain,
1694 Scene *UNUSED(unused),
1695 PointerRNA *UNUSED(ptr))
1697 ED_render_engine_changed(bmain, true);
1700 static bool rna_RenderSettings_multiple_engines_get(PointerRNA *UNUSED(ptr))
1702 return (BLI_listbase_count(&R_engines) > 1);
1705 static bool rna_RenderSettings_use_spherical_stereo_get(PointerRNA *ptr)
1707 Scene *scene = (Scene *)ptr->owner_id;
1708 return BKE_scene_use_spherical_stereo(scene);
1711 void rna_Scene_glsl_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1713 Scene *scene = (Scene *)ptr->owner_id;
1715 DEG_id_tag_update(&scene->id, 0);
1718 static void rna_Scene_world_update(Main *bmain, Scene *scene, PointerRNA *ptr)
1720 Scene *screen = (Scene *)ptr->owner_id;
1722 rna_Scene_glsl_update(bmain, scene, ptr);
1723 WM_main_add_notifier(NC_WORLD | ND_WORLD, &screen->id);
1724 DEG_relations_tag_update(bmain);
1727 static void rna_Scene_mesh_quality_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
1729 Scene *scene = (Scene *)ptr->owner_id;
1731 FOREACH_SCENE_OBJECT_BEGIN (scene, ob) {
1732 if (ELEM(ob->type, OB_MESH, OB_CURVE, OB_VOLUME, OB_MBALL)) {
1733 DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
1736 FOREACH_SCENE_OBJECT_END;
1738 rna_Scene_glsl_update(bmain, scene, ptr);
1741 void rna_Scene_freestyle_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1743 Scene *scene = (Scene *)ptr->owner_id;
1745 DEG_id_tag_update(&scene->id, 0);
1748 void rna_Scene_use_freestyle_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1750 Scene *scene = (Scene *)ptr->owner_id;
1752 DEG_id_tag_update(&scene->id, 0);
1754 if (scene->nodetree) {
1755 ntreeCompositUpdateRLayers(scene->nodetree);
1759 void rna_Scene_use_view_map_cache_update(Main *UNUSED(bmain),
1760 Scene *UNUSED(scene),
1761 PointerRNA *UNUSED(ptr))
1763 # ifdef WITH_FREESTYLE
1764 FRS_free_view_map_cache();
1768 void rna_ViewLayer_name_set(PointerRNA *ptr, const char *value)
1770 Scene *scene = (Scene *)ptr->owner_id;
1771 ViewLayer *view_layer = (ViewLayer *)ptr->data;
1772 BLI_assert(BKE_id_is_in_global_main(&scene->id));
1773 BKE_view_layer_rename(G_MAIN, scene, view_layer, value);
1776 static void rna_SceneRenderView_name_set(PointerRNA *ptr, const char *value)
1778 Scene *scene = (Scene *)ptr->owner_id;
1779 SceneRenderView *rv = (SceneRenderView *)ptr->data;
1780 BLI_strncpy_utf8(rv->name, value, sizeof(rv->name));
1781 BLI_uniquename(&scene->r.views,
1783 DATA_("RenderView"),
1785 offsetof(SceneRenderView, name),
1789 void rna_ViewLayer_material_override_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
1791 Scene *scene = (Scene *)ptr->owner_id;
1792 rna_Scene_glsl_update(bmain, scene, ptr);
1793 DEG_relations_tag_update(bmain);
1796 void rna_ViewLayer_pass_update(Main *bmain, Scene *activescene, PointerRNA *ptr)
1798 Scene *scene = (Scene *)ptr->owner_id;
1800 if (scene->nodetree) {
1801 ntreeCompositUpdateRLayers(scene->nodetree);
1804 ViewLayer *view_layer = NULL;
1805 if (ptr->type == &RNA_ViewLayer) {
1806 view_layer = (ViewLayer *)ptr->data;
1808 else if (ptr->type == &RNA_AOV) {
1809 ViewLayerAOV *aov = (ViewLayerAOV *)ptr->data;
1810 view_layer = BKE_view_layer_find_with_aov(scene, aov);
1814 RenderEngineType *engine_type = RE_engines_find(scene->r.engine);
1815 if (engine_type->update_render_passes) {
1816 RenderEngine *engine = RE_engine_create(engine_type);
1818 BKE_view_layer_verify_aov(engine, scene, view_layer);
1820 RE_engine_free(engine);
1825 rna_Scene_glsl_update(bmain, activescene, ptr);
1828 static char *rna_SceneRenderView_path(PointerRNA *ptr)
1830 SceneRenderView *srv = (SceneRenderView *)ptr->data;
1831 char srv_name_esc[sizeof(srv->name) * 2];
1832 BLI_str_escape(srv_name_esc, srv->name, sizeof(srv_name_esc));
1833 return BLI_sprintfN("render.views[\"%s\"]", srv_name_esc);
1836 static void rna_Scene_use_nodes_update(bContext *C, PointerRNA *ptr)
1838 Scene *scene = (Scene *)ptr->data;
1839 if (scene->use_nodes && scene->nodetree == NULL) {
1840 ED_node_composit_default(C, scene);
1842 DEG_relations_tag_update(CTX_data_main(C));
1845 static void rna_Physics_relations_update(Main *bmain,
1846 Scene *UNUSED(scene),
1847 PointerRNA *UNUSED(ptr))
1849 DEG_relations_tag_update(bmain);
1852 static void rna_Physics_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1854 Scene *scene = (Scene *)ptr->owner_id;
1855 FOREACH_SCENE_OBJECT_BEGIN (scene, ob) {
1856 BKE_ptcache_object_reset(scene, ob, PTCACHE_RESET_DEPSGRAPH);
1858 FOREACH_SCENE_OBJECT_END;
1860 DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE);
1863 static void rna_Scene_editmesh_select_mode_set(PointerRNA *ptr, const bool *value)
1865 ToolSettings *ts = (ToolSettings *)ptr->data;
1866 int flag = (value[0] ? SCE_SELECT_VERTEX : 0) | (value[1] ? SCE_SELECT_EDGE : 0) |
1867 (value[2] ? SCE_SELECT_FACE : 0);
1870 ts->selectmode = flag;
1872 /* Update select mode in all the workspaces in mesh edit mode. */
1873 wmWindowManager *wm = G_MAIN->wm.first;
1874 LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
1875 ViewLayer *view_layer = WM_window_get_active_view_layer(win);
1877 if (view_layer && view_layer->basact) {
1878 Mesh *me = BKE_mesh_from_object(view_layer->basact->object);
1879 if (me && me->edit_mesh && me->edit_mesh->selectmode != flag) {
1880 me->edit_mesh->selectmode = flag;
1881 EDBM_selectmode_set(me->edit_mesh);
1888 static void rna_Scene_editmesh_select_mode_update(bContext *C, PointerRNA *UNUSED(ptr))
1890 ViewLayer *view_layer = CTX_data_view_layer(C);
1893 if (view_layer->basact) {
1894 me = BKE_mesh_from_object(view_layer->basact->object);
1895 if (me && me->edit_mesh == NULL) {
1901 DEG_id_tag_update(&me->id, ID_RECALC_SELECT);
1902 WM_main_add_notifier(NC_SCENE | ND_TOOLSETTINGS, NULL);
1906 static void object_simplify_update(Object *ob)
1909 ParticleSystem *psys;
1911 if ((ob->id.tag & LIB_TAG_DOIT) == 0) {
1915 ob->id.tag &= ~LIB_TAG_DOIT;
1917 for (md = ob->modifiers.first; md; md = md->next) {
1919 eModifierType_Subsurf,
1920 eModifierType_Multires,
1921 eModifierType_ParticleSystem)) {
1922 DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
1926 for (psys = ob->particlesystem.first; psys; psys = psys->next) {
1927 psys->recalc |= ID_RECALC_PSYS_CHILD;
1930 if (ob->instance_collection) {
1931 FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (ob->instance_collection, ob_collection) {
1932 object_simplify_update(ob_collection);
1934 FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
1937 if (ob->type == OB_VOLUME) {
1938 DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
1942 static void rna_Scene_use_simplify_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
1944 Scene *sce = (Scene *)ptr->owner_id;
1948 BKE_main_id_tag_listbase(&bmain->objects, LIB_TAG_DOIT, true);
1949 FOREACH_SCENE_OBJECT_BEGIN (sce, ob) {
1950 object_simplify_update(ob);
1952 FOREACH_SCENE_OBJECT_END;
1954 for (SETLOOPER_SET_ONLY(sce, sce_iter, base)) {
1955 object_simplify_update(base->object);
1958 WM_main_add_notifier(NC_GEOM | ND_DATA, NULL);
1959 WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
1960 DEG_id_tag_update(&sce->id, 0);
1963 static void rna_Scene_simplify_update(Main *bmain, Scene *scene, PointerRNA *ptr)
1965 Scene *sce = (Scene *)ptr->owner_id;
1967 if (sce->r.mode & R_SIMPLIFY) {
1968 rna_Scene_use_simplify_update(bmain, scene, ptr);
1972 static void rna_Scene_use_persistent_data_update(Main *UNUSED(bmain),
1973 Scene *UNUSED(scene),
1976 Scene *sce = (Scene *)ptr->owner_id;
1978 if (!(sce->r.mode & R_PERSISTENT_DATA)) {
1979 RE_FreePersistentData();
1983 /* Scene.transform_orientation_slots */
1984 static void rna_Scene_transform_orientation_slots_begin(CollectionPropertyIterator *iter,
1987 Scene *scene = (Scene *)ptr->owner_id;
1988 TransformOrientationSlot *orient_slot = &scene->orientation_slots[0];
1989 rna_iterator_array_begin(
1990 iter, orient_slot, sizeof(*orient_slot), ARRAY_SIZE(scene->orientation_slots), 0, NULL);
1993 static int rna_Scene_transform_orientation_slots_length(PointerRNA *ptr)
1995 Scene *scene = (Scene *)ptr->owner_id;
1996 return ARRAY_SIZE(scene->orientation_slots);
1999 static bool rna_Scene_use_audio_get(PointerRNA *ptr)
2001 Scene *scene = (Scene *)ptr->data;
2002 return (scene->audio.flag & AUDIO_MUTE) != 0;
2005 static void rna_Scene_use_audio_set(PointerRNA *ptr, bool value)
2007 Scene *scene = (Scene *)ptr->data;
2010 scene->audio.flag |= AUDIO_MUTE;
2013 scene->audio.flag &= ~AUDIO_MUTE;
2017 static void rna_Scene_use_audio_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
2019 DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_MUTE);
2022 static int rna_Scene_sync_mode_get(PointerRNA *ptr)
2024 Scene *scene = (Scene *)ptr->data;
2025 if (scene->audio.flag & AUDIO_SYNC) {
2028 return scene->flag & SCE_FRAME_DROP;
2031 static void rna_Scene_sync_mode_set(PointerRNA *ptr, int value)
2033 Scene *scene = (Scene *)ptr->data;
2035 if (value == AUDIO_SYNC) {
2036 scene->audio.flag |= AUDIO_SYNC;
2038 else if (value == SCE_FRAME_DROP) {
2039 scene->audio.flag &= ~AUDIO_SYNC;
2040 scene->flag |= SCE_FRAME_DROP;
2043 scene->audio.flag &= ~AUDIO_SYNC;
2044 scene->flag &= ~SCE_FRAME_DROP;
2048 static void rna_View3DCursor_rotation_mode_set(PointerRNA *ptr, int value)
2050 View3DCursor *cursor = ptr->data;
2052 /* use API Method for conversions... */
2053 BKE_rotMode_change_values(cursor->rotation_quaternion,
2054 cursor->rotation_euler,
2055 cursor->rotation_axis,
2056 &cursor->rotation_angle,
2057 cursor->rotation_mode,
2060 /* finally, set the new rotation type */
2061 cursor->rotation_mode = value;
2064 static void rna_View3DCursor_rotation_axis_angle_get(PointerRNA *ptr, float *value)
2066 View3DCursor *cursor = ptr->data;
2067 value[0] = cursor->rotation_angle;
2068 copy_v3_v3(&value[1], cursor->rotation_axis);
2071 static void rna_View3DCursor_rotation_axis_angle_set(PointerRNA *ptr, const float *value)
2073 View3DCursor *cursor = ptr->data;
2074 cursor->rotation_angle = value[0];
2075 copy_v3_v3(cursor->rotation_axis, &value[1]);
2078 static void rna_View3DCursor_matrix_get(PointerRNA *ptr, float *values)
2080 const View3DCursor *cursor = ptr->data;
2081 BKE_scene_cursor_to_mat4(cursor, (float(*)[4])values);
2084 static void rna_View3DCursor_matrix_set(PointerRNA *ptr, const float *values)
2086 View3DCursor *cursor = ptr->data;
2087 float unit_mat[4][4];
2088 normalize_m4_m4(unit_mat, (const float(*)[4])values);
2089 BKE_scene_cursor_from_mat4(cursor, unit_mat, false);
2092 static char *rna_TransformOrientationSlot_path(PointerRNA *ptr)
2094 Scene *scene = (Scene *)ptr->owner_id;
2095 TransformOrientationSlot *orientation_slot = ptr->data;
2097 if (!ELEM(NULL, scene, orientation_slot)) {
2098 for (int i = 0; i < ARRAY_SIZE(scene->orientation_slots); i++) {
2099 if (&scene->orientation_slots[i] == orientation_slot) {
2100 return BLI_sprintfN("transform_orientation_slots[%d]", i);
2105 /* Should not happen, but in case, just return defqult path. */
2107 return BLI_strdup("transform_orientation_slots[0]");
2110 static char *rna_View3DCursor_path(PointerRNA *UNUSED(ptr))
2112 return BLI_strdup("cursor");
2115 static TimeMarker *rna_TimeLine_add(Scene *scene, const char name[], int frame)
2117 TimeMarker *marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker");
2118 marker->flag = SELECT;
2119 marker->frame = frame;
2120 BLI_strncpy_utf8(marker->name, name, sizeof(marker->name));
2121 BLI_addtail(&scene->markers, marker);
2123 WM_main_add_notifier(NC_SCENE | ND_MARKERS, NULL);
2124 WM_main_add_notifier(NC_ANIMATION | ND_MARKERS, NULL);
2129 static void rna_TimeLine_remove(Scene *scene, ReportList *reports, PointerRNA *marker_ptr)
2131 TimeMarker *marker = marker_ptr->data;
2132 if (BLI_remlink_safe(&scene->markers, marker) == false) {
2133 BKE_reportf(reports,
2135 "Timeline marker '%s' not found in scene '%s'",
2137 scene->id.name + 2);
2142 RNA_POINTER_INVALIDATE(marker_ptr);
2144 WM_main_add_notifier(NC_SCENE | ND_MARKERS, NULL);
2145 WM_main_add_notifier(NC_ANIMATION | ND_MARKERS, NULL);
2148 static void rna_TimeLine_clear(Scene *scene)
2150 BLI_freelistN(&scene->markers);
2152 WM_main_add_notifier(NC_SCENE | ND_MARKERS, NULL);
2153 WM_main_add_notifier(NC_ANIMATION | ND_MARKERS, NULL);
2156 static KeyingSet *rna_Scene_keying_set_new(Scene *sce,
2157 ReportList *reports,
2158 const char idname[],
2161 KeyingSet *ks = NULL;
2163 /* call the API func, and set the active keyingset index */
2164 ks = BKE_keyingset_add(&sce->keyingsets, idname, name, KEYINGSET_ABSOLUTE, 0);
2167 sce->active_keyingset = BLI_listbase_count(&sce->keyingsets);
2171 BKE_report(reports, RPT_ERROR, "Keying set could not be added");
2176 static void rna_UnifiedPaintSettings_update(bContext *C, PointerRNA *UNUSED(ptr))
2178 Scene *scene = CTX_data_scene(C);
2179 ViewLayer *view_layer = CTX_data_view_layer(C);
2180 Brush *br = BKE_paint_brush(BKE_paint_get_active(scene, view_layer));
2181 WM_main_add_notifier(NC_BRUSH | NA_EDITED, br);
2184 static void rna_UnifiedPaintSettings_size_set(PointerRNA *ptr, int value)
2186 UnifiedPaintSettings *ups = ptr->data;
2188 /* scale unprojected radius so it stays consistent with brush size */
2189 BKE_brush_scale_unprojected_radius(&ups->unprojected_radius, value, ups->size);
2193 static void rna_UnifiedPaintSettings_unprojected_radius_set(PointerRNA *ptr, float value)
2195 UnifiedPaintSettings *ups = ptr->data;
2197 /* scale brush size so it stays consistent with unprojected_radius */
2198 BKE_brush_scale_size(&ups->size, value, ups->unprojected_radius);
2199 ups->unprojected_radius = value;
2202 static void rna_UnifiedPaintSettings_radius_update(bContext *C, PointerRNA *ptr)
2204 /* changing the unified size should invalidate the overlay but also update the brush */
2205 BKE_paint_invalidate_overlay_all();
2206 rna_UnifiedPaintSettings_update(C, ptr);
2209 static char *rna_UnifiedPaintSettings_path(PointerRNA *UNUSED(ptr))
2211 return BLI_strdup("tool_settings.unified_paint_settings");
2214 static char *rna_CurvePaintSettings_path(PointerRNA *UNUSED(ptr))
2216 return BLI_strdup("tool_settings.curve_paint_settings");
2219 static char *rna_SequencerToolSettings_path(PointerRNA *UNUSED(ptr))
2221 return BLI_strdup("tool_settings.sequencer_tool_settings");
2224 /* generic function to recalc geometry */
2225 static void rna_EditMesh_update(bContext *C, PointerRNA *UNUSED(ptr))
2227 ViewLayer *view_layer = CTX_data_view_layer(C);
2230 if (view_layer->basact) {
2231 me = BKE_mesh_from_object(view_layer->basact->object);
2232 if (me && me->edit_mesh == NULL) {
2238 DEG_id_tag_update(&me->id, ID_RECALC_GEOMETRY);
2239 WM_main_add_notifier(NC_GEOM | ND_DATA, me);
2243 static char *rna_MeshStatVis_path(PointerRNA *UNUSED(ptr))
2245 return BLI_strdup("tool_settings.statvis");
2248 /* note: without this, when Multi-Paint is activated/deactivated, the colors
2249 * will not change right away when multiple bones are selected, this function
2250 * is not for general use and only for the few cases where changing scene
2251 * settings and NOT for general purpose updates, possibly this should be
2252 * given its own notifier. */
2253 static void rna_Scene_update_active_object_data(bContext *C, PointerRNA *UNUSED(ptr))
2255 ViewLayer *view_layer = CTX_data_view_layer(C);
2256 Object *ob = OBACT(view_layer);
2259 DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
2260 WM_main_add_notifier(NC_OBJECT | ND_DRAW, &ob->id);
2264 static void rna_SceneCamera_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
2266 Scene *scene = (Scene *)ptr->owner_id;
2267 Object *camera = scene->camera;
2269 SEQ_cache_cleanup(scene);
2271 if (camera && (camera->type == OB_CAMERA)) {
2272 DEG_id_tag_update(&camera->id, ID_RECALC_GEOMETRY);
2276 static void rna_SceneSequencer_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
2278 SEQ_cache_cleanup(scene);
2281 static char *rna_ToolSettings_path(PointerRNA *UNUSED(ptr))
2283 return BLI_strdup("tool_settings");
2286 PointerRNA rna_FreestyleLineSet_linestyle_get(PointerRNA *ptr)
2288 FreestyleLineSet *lineset = (FreestyleLineSet *)ptr->data;
2290 return rna_pointer_inherit_refine(ptr, &RNA_FreestyleLineStyle, lineset->linestyle);
2293 void rna_FreestyleLineSet_linestyle_set(PointerRNA *ptr,
2295 struct ReportList *UNUSED(reports))
2297 FreestyleLineSet *lineset = (FreestyleLineSet *)ptr->data;
2299 if (lineset->linestyle) {
2300 id_us_min(&lineset->linestyle->id);
2302 lineset->linestyle = (FreestyleLineStyle *)value.data;
2303 id_us_plus(&lineset->linestyle->id);
2306 FreestyleLineSet *rna_FreestyleSettings_lineset_add(ID *id,
2307 FreestyleSettings *config,
2311 Scene *scene = (Scene *)id;
2312 FreestyleLineSet *lineset = BKE_freestyle_lineset_add(bmain, (FreestyleConfig *)config, name);
2314 DEG_id_tag_update(&scene->id, 0);
2315 WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
2320 void rna_FreestyleSettings_lineset_remove(ID *id,
2321 FreestyleSettings *config,
2322 ReportList *reports,
2323 PointerRNA *lineset_ptr)
2325 FreestyleLineSet *lineset = lineset_ptr->data;
2326 Scene *scene = (Scene *)id;
2328 if (!BKE_freestyle_lineset_delete((FreestyleConfig *)config, lineset)) {
2329 BKE_reportf(reports, RPT_ERROR, "Line set '%s' could not be removed", lineset->name);
2333 RNA_POINTER_INVALIDATE(lineset_ptr);
2335 DEG_id_tag_update(&scene->id, 0);
2336 WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
2339 PointerRNA rna_FreestyleSettings_active_lineset_get(PointerRNA *ptr)
2341 FreestyleConfig *config = (FreestyleConfig *)ptr->data;
2342 FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(config);
2343 return rna_pointer_inherit_refine(ptr, &RNA_FreestyleLineSet, lineset);
2346 void rna_FreestyleSettings_active_lineset_index_range(
2347 PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
2349 FreestyleConfig *config = (FreestyleConfig *)ptr->data;
2352 *max = max_ii(0, BLI_listbase_count(&config->linesets) - 1);
2355 int rna_FreestyleSettings_active_lineset_index_get(PointerRNA *ptr)
2357 FreestyleConfig *config = (FreestyleConfig *)ptr->data;
2358 return BKE_freestyle_lineset_get_active_index(config);
2361 void rna_FreestyleSettings_active_lineset_index_set(PointerRNA *ptr, int value)
2363 FreestyleConfig *config = (FreestyleConfig *)ptr->data;
2364 BKE_freestyle_lineset_set_active_index(config, value);
2367 FreestyleModuleConfig *rna_FreestyleSettings_module_add(ID *id, FreestyleSettings *config)
2369 Scene *scene = (Scene *)id;
2370 FreestyleModuleConfig *module = BKE_freestyle_module_add((FreestyleConfig *)config);
2372 DEG_id_tag_update(&scene->id, 0);
2373 WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
2378 void rna_FreestyleSettings_module_remove(ID *id,
2379 FreestyleSettings *config,
2380 ReportList *reports,
2381 PointerRNA *module_ptr)
2383 Scene *scene = (Scene *)id;
2384 FreestyleModuleConfig *module = module_ptr->data;
2386 if (!BKE_freestyle_module_delete((FreestyleConfig *)config, module)) {
2387 if (module->script) {
2388 BKE_reportf(reports,
2390 "Style module '%s' could not be removed",
2391 module->script->id.name + 2);
2394 BKE_report(reports, RPT_ERROR, "Style module could not be removed");
2399 RNA_POINTER_INVALIDATE(module_ptr);
2401 DEG_id_tag_update(&scene->id, 0);
2402 WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
2405 static void rna_Stereo3dFormat_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
2407 ID *id = ptr->owner_id;
2409 if (id && GS(id->name) == ID_IM) {
2410 Image *ima = (Image *)id;
2414 if (!BKE_image_is_stereo(ima)) {
2418 ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
2421 BKE_image_signal(bmain, ima, NULL, IMA_SIGNAL_FREE);
2423 BKE_image_release_ibuf(ima, ibuf, lock);
2427 static ViewLayer *rna_ViewLayer_new(ID *id, Scene *UNUSED(sce), Main *bmain, const char *name)
2429 Scene *scene = (Scene *)id;
2430 ViewLayer *view_layer = BKE_view_layer_add(scene, name, NULL, VIEWLAYER_ADD_NEW);
2432 DEG_id_tag_update(&scene->id, 0);
2433 DEG_relations_tag_update(bmain);
2434 WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL);
2439 static void rna_ViewLayer_remove(
2440 ID *id, Scene *UNUSED(sce), Main *bmain, ReportList *reports, PointerRNA *sl_ptr)
2442 Scene *scene = (Scene *)id;
2443 ViewLayer *view_layer = sl_ptr->data;
2445 if (ED_scene_view_layer_delete(bmain, scene, view_layer, reports)) {
2446 RNA_POINTER_INVALIDATE(sl_ptr);
2450 void rna_ViewLayer_active_aov_index_range(
2451 PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
2453 ViewLayer *view_layer = (ViewLayer *)ptr->data;
2456 *max = max_ii(0, BLI_listbase_count(&view_layer->aovs) - 1);
2459 int rna_ViewLayer_active_aov_index_get(PointerRNA *ptr)
2461 ViewLayer *view_layer = (ViewLayer *)ptr->data;
2462 return BLI_findindex(&view_layer->aovs, view_layer->active_aov);
2465 void rna_ViewLayer_active_aov_index_set(PointerRNA *ptr, int value)
2467 ViewLayer *view_layer = (ViewLayer *)ptr->data;
2468 ViewLayerAOV *aov = BLI_findlink(&view_layer->aovs, value);
2469 view_layer->active_aov = aov;
2472 /* Fake value, used internally (not saved to DNA). */
2473 # define V3D_ORIENT_DEFAULT -1
2475 static int rna_TransformOrientationSlot_type_get(PointerRNA *ptr)
2477 Scene *scene = (Scene *)ptr->owner_id;
2478 TransformOrientationSlot *orient_slot = ptr->data;
2479 if (orient_slot != &scene->orientation_slots[SCE_ORIENT_DEFAULT]) {
2480 if ((orient_slot->flag & SELECT) == 0) {
2481 return V3D_ORIENT_DEFAULT;
2484 return BKE_scene_orientation_slot_get_index(orient_slot);
2487 void rna_TransformOrientationSlot_type_set(PointerRNA *ptr, int value)
2489 Scene *scene = (Scene *)ptr->owner_id;
2490 TransformOrientationSlot *orient_slot = ptr->data;
2492 if (orient_slot != &scene->orientation_slots[SCE_ORIENT_DEFAULT]) {
2493 if (value == V3D_ORIENT_DEFAULT) {
2494 orient_slot->flag &= ~SELECT;
2498 orient_slot->flag |= SELECT;
2502 BKE_scene_orientation_slot_set_index(orient_slot, value);
2505 static PointerRNA rna_TransformOrientationSlot_get(PointerRNA *ptr)
2507 Scene *scene = (Scene *)ptr->owner_id;
2508 TransformOrientationSlot *orient_slot = ptr->data;
2509 TransformOrientation *orientation;
2510 if (orient_slot->type < V3D_ORIENT_CUSTOM) {
2514 orientation = BKE_scene_transform_orientation_find(scene, orient_slot->index_custom);
2516 return rna_pointer_inherit_refine(ptr, &RNA_TransformOrientation, orientation);
2519 static const EnumPropertyItem *rna_TransformOrientation_impl_itemf(Scene *scene,
2520 const bool include_default,
2523 EnumPropertyItem tmp = {0, "", 0, "", ""};
2524 EnumPropertyItem *item = NULL;
2525 int i = V3D_ORIENT_CUSTOM, totitem = 0;
2527 if (include_default) {
2528 tmp.identifier = "DEFAULT";
2529 tmp.name = "Default";
2530 tmp.description = "Use the scene orientation";
2531 tmp.value = V3D_ORIENT_DEFAULT;
2532 tmp.icon = ICON_OBJECT_ORIGIN;
2533 RNA_enum_item_add(&item, &totitem, &tmp);
2536 RNA_enum_item_add_separator(&item, &totitem);
2539 RNA_enum_items_add(&item, &totitem, rna_enum_transform_orientation_items);
2541 const ListBase *transform_orientations = scene ? &scene->transform_spaces : NULL;
2543 if (transform_orientations && (BLI_listbase_is_empty(transform_orientations) == false)) {
2544 RNA_enum_item_add_separator(&item, &totitem);
2546 LISTBASE_FOREACH (TransformOrientation *, ts, transform_orientations) {
2547 tmp.identifier = ts->name;
2548 tmp.name = ts->name;
2550 RNA_enum_item_add(&item, &totitem, &tmp);
2554 RNA_enum_item_end(&item, &totitem);
2559 const EnumPropertyItem *rna_TransformOrientation_itemf(bContext *C,
2561 PropertyRNA *UNUSED(prop),
2565 if (ptr->owner_id && (GS(ptr->owner_id->name) == ID_SCE)) {
2566 scene = (Scene *)ptr->owner_id;
2569 scene = CTX_data_scene(C);
2571 return rna_TransformOrientation_impl_itemf(scene, false, r_free);
2574 const EnumPropertyItem *rna_TransformOrientation_with_scene_itemf(bContext *UNUSED(C),
2576 PropertyRNA *UNUSED(prop),
2579 Scene *scene = (Scene *)ptr->owner_id;
2580 TransformOrientationSlot *orient_slot = ptr->data;
2581 bool include_default = (orient_slot != &scene->orientation_slots[SCE_ORIENT_DEFAULT]);
2582 return rna_TransformOrientation_impl_itemf(scene, include_default, r_free);
2585 # undef V3D_ORIENT_DEFAULT
2587 static const EnumPropertyItem *rna_UnitSettings_itemf_wrapper(const int system,
2593 BKE_unit_system_get(system, type, &usys, &len);
2595 EnumPropertyItem *items = NULL;
2598 EnumPropertyItem adaptive = {0};
2599 adaptive.identifier = "ADAPTIVE";
2600 adaptive.name = "Adaptive";
2601 adaptive.value = USER_UNIT_ADAPTIVE;
2602 RNA_enum_item_add(&items, &totitem, &adaptive);
2604 for (int i = 0; i < len; i++) {
2605 if (!BKE_unit_is_suppressed(usys, i)) {
2606 EnumPropertyItem tmp = {0};
2607 tmp.identifier = BKE_unit_identifier_get(usys, i);
2608 tmp.name = BKE_unit_display_name_get(usys, i);
2610 RNA_enum_item_add(&items, &totitem, &tmp);
2614 RNA_enum_item_end(&items, &totitem);
2620 const EnumPropertyItem *rna_UnitSettings_length_unit_itemf(bContext *UNUSED(C),
2622 PropertyRNA *UNUSED(prop),
2625 UnitSettings *units = ptr->data;
2626 return rna_UnitSettings_itemf_wrapper(units->system, B_UNIT_LENGTH, r_free);
2629 const EnumPropertyItem *rna_UnitSettings_mass_unit_itemf(bContext *UNUSED(C),
2631 PropertyRNA *UNUSED(prop),
2634 UnitSettings *units = ptr->data;
2635 return rna_UnitSettings_itemf_wrapper(units->system, B_UNIT_MASS, r_free);
2638 const EnumPropertyItem *rna_UnitSettings_time_unit_itemf(bContext *UNUSED(C),
2640 PropertyRNA *UNUSED(prop),
2643 UnitSettings *units = ptr->data;
2644 return rna_UnitSettings_itemf_wrapper(units->system, B_UNIT_TIME, r_free);
2647 const EnumPropertyItem *rna_UnitSettings_temperature_unit_itemf(bContext *UNUSED(C),
2649 PropertyRNA *UNUSED(prop),
2652 UnitSettings *units = ptr->data;
2653 return rna_UnitSettings_itemf_wrapper(units->system, B_UNIT_TEMPERATURE, r_free);
2656 static void rna_UnitSettings_system_update(Main *UNUSED(bmain),
2658 PointerRNA *UNUSED(ptr))
2660 UnitSettings *unit = &scene->unit;
2661 if (unit->system == USER_UNIT_NONE) {
2662 unit->length_unit = USER_UNIT_ADAPTIVE;
2663 unit->mass_unit = USER_UNIT_ADAPTIVE;
2666 unit->length_unit = BKE_unit_base_of_type_get(unit->system, B_UNIT_LENGTH);
2667 unit->mass_unit = BKE_unit_base_of_type_get(unit->system, B_UNIT_MASS);
2671 static char *rna_UnitSettings_path(PointerRNA *UNUSED(ptr))
2673 return BLI_strdup("unit_settings");
2676 static char *rna_FFmpegSettings_path(PointerRNA *UNUSED(ptr))
2678 return BLI_strdup("render.ffmpeg");
2683 /* Grease Pencil Interpolation tool settings */
2684 static void rna_def_gpencil_interpolate(BlenderRNA *brna)
2689 srna = RNA_def_struct(brna, "GPencilInterpolateSettings", NULL);
2690 RNA_def_struct_sdna(srna, "GP_Interpolate_Settings");
2691 RNA_def_struct_path_func(srna, "rna_GPencilInterpolateSettings_path");
2692 RNA_def_struct_ui_text(srna,
2693 "Grease Pencil Interpolate Settings",
2694 "Settings for Grease Pencil interpolation tools");
2697 prop = RNA_def_property(srna, "interpolate_all_layers", PROP_BOOLEAN, PROP_NONE);
2698 RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_TOOLFLAG_INTERPOLATE_ALL_LAYERS);
2699 RNA_def_property_ui_text(
2700 prop, "Interpolate All Layers", "Interpolate all layers, not only active");
2701 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
2703 prop = RNA_def_property(srna, "interpolate_selected_only", PROP_BOOLEAN, PROP_NONE);
2704 RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_TOOLFLAG_INTERPOLATE_ONLY_SELECTED);
2705 RNA_def_property_ui_text(prop,
2706 "Interpolate Selected Strokes",
2707 "Interpolate only selected strokes in the original frame");
2708 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
2710 /* interpolation type */
2711 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
2712 RNA_def_property_enum_sdna(prop, NULL, "type");
2713 RNA_def_property_enum_items(prop, rna_enum_gpencil_interpolation_mode_items);
2714 RNA_def_property_enum_funcs(prop, NULL, "rna_GPencilInterpolateSettings_type_set", NULL);
2715 RNA_def_property_ui_text(
2716 prop, "Type", "Interpolation method to use the next time 'Interpolate Sequence' is run");
2717 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
2719 prop = RNA_def_property(srna, "step", PROP_INT, PROP_NONE);
2720 RNA_def_property_range(prop, 1, MAXFRAME);
2721 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2722 RNA_def_property_ui_text(prop, "Step", "Number of frames between generated interpolated frames");
2723 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
2726 prop = RNA_def_property(srna, "easing", PROP_ENUM, PROP_NONE);
2727 RNA_def_property_enum_sdna(prop, NULL, "easing");
2728 RNA_def_property_enum_items(prop, rna_enum_beztriple_interpolation_easing_items);
2729 RNA_def_property_ui_text(
2732 "Which ends of the segment between the preceding and following grease pencil frames "
2733 "easing interpolation is applied to");
2734 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
2736 /* easing options */
2737 prop = RNA_def_property(srna, "back", PROP_FLOAT, PROP_NONE);
2738 RNA_def_property_float_sdna(prop, NULL, "back");
2739 RNA_def_property_ui_text(prop, "Back", "Amount of overshoot for 'back' easing");
2740 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
2742 prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
2743 RNA_def_property_float_sdna(prop, NULL, "amplitude");
2744 RNA_def_property_range(prop, 0.0f, FLT_MAX); /* only positive values... */
2745 RNA_def_property_ui_text(
2746 prop, "Amplitude", "Amount to boost elastic bounces for 'elastic' easing");
2747 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
2749 prop = RNA_def_property(srna, "period", PROP_FLOAT, PROP_NONE);
2750 RNA_def_property_float_sdna(prop, NULL, "period");
2751 RNA_def_property_ui_text(prop, "Period", "Time between bounces for elastic easing");
2752 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
2754 /* custom curvemap */
2755 prop = RNA_def_property(srna, "interpolation_curve", PROP_POINTER, PROP_NONE);
2756 RNA_def_property_pointer_sdna(prop, NULL, "custom_ipo");
2757 RNA_def_property_struct_type(prop, "CurveMapping");
2758 RNA_def_property_ui_text(
2760 "Interpolation Curve",
2761 "Custom curve to control 'sequence' interpolation between Grease Pencil frames");
2762 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
2765 static void rna_def_transform_orientation(BlenderRNA *brna)
2770 srna = RNA_def_struct(brna, "TransformOrientation", NULL);
2772 prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
2773 RNA_def_property_float_sdna(prop, NULL, "mat");
2774 RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_3x3);
2775 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2777 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
2778 RNA_def_struct_name_property(srna, prop);
2779 RNA_def_property_ui_text(prop, "Name", "Name of the custom transform orientation");
2780 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2783 static void rna_def_transform_orientation_slot(BlenderRNA *brna)
2788 srna = RNA_def_struct(brna, "TransformOrientationSlot", NULL);
2789 RNA_def_struct_sdna(srna, "TransformOrientationSlot");
2790 RNA_def_struct_path_func(srna, "rna_TransformOrientationSlot_path");
2791 RNA_def_struct_ui_text(srna, "Orientation Slot", "");
2794 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
2795 RNA_def_property_enum_items(prop, rna_enum_transform_orientation_items);
2796 RNA_def_property_enum_funcs(prop,
2797 "rna_TransformOrientationSlot_type_get",
2798 "rna_TransformOrientationSlot_type_set",
2799 "rna_TransformOrientation_with_scene_itemf");
2800 RNA_def_property_ui_text(prop, "Orientation", "Transformation orientation");
2801 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2803 prop = RNA_def_property(srna, "custom_orientation", PROP_POINTER, PROP_NONE);
2804 RNA_def_property_struct_type(prop, "TransformOrientation");
2805 RNA_def_property_pointer_funcs(prop, "rna_TransformOrientationSlot_get", NULL, NULL, NULL);
2806 RNA_def_property_ui_text(prop, "Current Transform Orientation", "");
2809 prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
2810 RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
2811 RNA_def_property_ui_text(prop, "Use", "Use scene orientation instead of a custom setting");
2812 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
2815 static void rna_def_view3d_cursor(BlenderRNA *brna)
2820 srna = RNA_def_struct(brna, "View3DCursor", NULL);
2821 RNA_def_struct_sdna(srna, "View3DCursor");
2822 RNA_def_struct_path_func(srna, "rna_View3DCursor_path");
2823 RNA_def_struct_ui_text(srna, "3D Cursor", "");
2824 RNA_def_struct_ui_icon(srna, ICON_CURSOR);
2826 prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_XYZ_LENGTH);
2827 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2828 RNA_def_property_float_sdna(prop, NULL, "location");
2829 RNA_def_property_ui_text(prop, "Location", "");
2830 RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 4);
2831 RNA_def_property_update(prop, NC_WINDOW, NULL);
2833 prop = RNA_def_property(srna, "rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
2834 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2835 RNA_def_property_float_sdna(prop, NULL, "rotation_quaternion");
2836 RNA_def_property_ui_text(
2837 prop, "Quaternion Rotation", "Rotation in quaternions (keep normalized)");
2838 RNA_def_property_update(prop, NC_WINDOW, NULL);
2840 prop = RNA_def_property(srna, "rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
2841 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2842 RNA_def_property_array(prop, 4);
2843 RNA_def_property_float_funcs(prop,
2844 "rna_View3DCursor_rotation_axis_angle_get",
2845 "rna_View3DCursor_rotation_axis_angle_set",
2847 RNA_def_property_float_array_default(prop, rna_default_axis_angle);
2848 RNA_def_property_ui_text(
2849 prop, "Axis-Angle Rotation", "Angle of Rotation for Axis-Angle rotation representation");
2850 RNA_def_property_update(prop, NC_WINDOW, NULL);
2852 prop = RNA_def_property(srna, "rotation_euler", PROP_FLOAT, PROP_EULER);
2853 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2854 RNA_def_property_float_sdna(prop, NULL, "rotation_euler");
2855 RNA_def_property_ui_text(prop, "Euler Rotation", "3D rotation");
2856 RNA_def_property_update(prop, NC_WINDOW, NULL);
2858 prop = RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
2859 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2860 RNA_def_property_enum_sdna(prop, NULL, "rotation_mode");
2861 RNA_def_property_enum_items(prop, rna_enum_object_rotation_mode_items);
2862 RNA_def_property_enum_funcs(prop, NULL, "rna_View3DCursor_rotation_mode_set", NULL);
2863 RNA_def_property_ui_text(prop, "Rotation Mode", "");
2864 RNA_def_property_update(prop, NC_WINDOW, NULL);
2866 /* Matrix access to avoid having to check current rotation mode. */
2867 prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
2868 RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
2869 RNA_def_property_flag(prop, PROP_THICK_WRAP); /* no reference to original data */
2870 RNA_def_property_ui_text(
2871 prop, "Transform Matrix", "Matrix combining location and rotation of the cursor");
2872 RNA_def_property_float_funcs(
2873 prop, "rna_View3DCursor_matrix_get", "rna_View3DCursor_matrix_set", NULL);
2876 static void rna_def_tool_settings(BlenderRNA *brna)
2881 /* the construction of this enum is quite special - everything is stored as bitflags,
2882 * with 1st position only for on/off (and exposed as boolean), while others are mutually
2883 * exclusive options but which will only have any effect when autokey is enabled
2885 static const EnumPropertyItem auto_key_items[] = {
2886 {AUTOKEY_MODE_NORMAL & ~AUTOKEY_ON, "ADD_REPLACE_KEYS", 0, "Add & Replace", ""},
2887 {AUTOKEY_MODE_EDITKEYS & ~AUTOKEY_ON, "REPLACE_KEYS", 0, "Replace", ""},
2888 {0, NULL, 0, NULL, NULL},
2891 static const EnumPropertyItem draw_groupuser_items[] = {
2892 {OB_DRAW_GROUPUSER_NONE, "NONE", 0, "None", ""},
2893 {OB_DRAW_GROUPUSER_ACTIVE,
2897 "Show vertices with no weights in the active group"},
2898 {OB_DRAW_GROUPUSER_ALL, "ALL", 0, "All", "Show vertices with no weights in any group"},
2899 {0, NULL, 0, NULL, NULL},
2902 static const EnumPropertyItem vertex_group_select_items[] = {
2903 {WT_VGROUP_ALL, "ALL", 0, "All", "All Vertex Groups"},
2904 {WT_VGROUP_BONE_DEFORM,
2908 "Vertex Groups assigned to Deform Bones"},
2909 {WT_VGROUP_BONE_DEFORM_OFF,
2913 "Vertex Groups assigned to non Deform Bones"},
2914 {0, NULL, 0, NULL, NULL},
2917 static const EnumPropertyItem gpencil_stroke_placement_items[] = {
2918 {GP_PROJECT_VIEWSPACE,
2922 "Draw stroke at Object origin"},
2923 {GP_PROJECT_VIEWSPACE | GP_PROJECT_CURSOR,
2927 "Draw stroke at 3D cursor location"},
2928 {GP_PROJECT_VIEWSPACE | GP_PROJECT_DEPTH_VIEW,
2932 "Stick stroke to surfaces"},
2933 {GP_PROJECT_VIEWSPACE | GP_PROJECT_DEPTH_STROKE,
2937 "Stick stroke to other strokes"},
2938 {0, NULL, 0, NULL, NULL},
2941 static const EnumPropertyItem gpencil_stroke_snap_items[] = {
2942 {0, "NONE", 0, "All Points", "Snap to all points"},
2943 {GP_PROJECT_DEPTH_STROKE_ENDPOINTS,
2947 "Snap to first and last points and interpolate"},
2948 {GP_PROJECT_DEPTH_STROKE_FIRST, "FIRST", 0, "First Point", "Snap to first point"},
2949 {0, NULL, 0, NULL, NULL},
2952 static const EnumPropertyItem gpencil_selectmode_items[] = {
2953 {GP_SELECTMODE_POINT, "POINT", ICON_GP_SELECT_POINTS, "Point", "Select only points"},
2954 {GP_SELECTMODE_STROKE,
2956 ICON_GP_SELECT_STROKES,
2958 "Select all stroke points"},
2959 {GP_SELECTMODE_SEGMENT,
2961 ICON_GP_SELECT_BETWEEN_STROKES,
2963 "Select all stroke points between other strokes"},
2964 {0, NULL, 0, NULL, NULL},
2967 static const EnumPropertyItem annotation_stroke_placement_items[] = {
2968 {GP_PROJECT_VIEWSPACE | GP_PROJECT_CURSOR,
2972 "Draw stroke at 3D cursor location"},
2973 /* Weird, GP_PROJECT_VIEWALIGN is inverted. */
2974 {0, "VIEW", ICON_RESTRICT_VIEW_ON, "View", "Stick stroke to the view"},
2975 {GP_PROJECT_VIEWSPACE | GP_PROJECT_DEPTH_VIEW,
2979 "Stick stroke to surfaces"},
2980 {0, NULL, 0, NULL, NULL},
2983 srna = RNA_def_struct(brna, "ToolSettings", NULL);
2984 RNA_def_struct_path_func(srna, "rna_ToolSettings_path");
2985 RNA_def_struct_ui_text(srna, "Tool Settings", "");
2987 prop = RNA_def_property(srna, "sculpt", PROP_POINTER, PROP_NONE);
2988 RNA_def_property_struct_type(prop, "Sculpt");
2989 RNA_def_property_ui_text(prop, "Sculpt", "");
2991 prop = RNA_def_property(srna, "use_auto_normalize", PROP_BOOLEAN, PROP_NONE);
2992 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
2993 RNA_def_property_boolean_sdna(prop, NULL, "auto_normalize", 1);
2994 RNA_def_property_ui_text(prop,
2995 "WPaint Auto-Normalize",
2996 "Ensure all bone-deforming vertex groups add up "
2997 "to 1.0 while weight painting");
2998 RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data");
3000 prop = RNA_def_property(srna, "use_lock_relative", PROP_BOOLEAN, PROP_NONE);
3001 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3002 RNA_def_property_boolean_sdna(prop, NULL, "wpaint_lock_relative", 1);
3003 RNA_def_property_ui_text(prop,
3004 "WPaint Lock-Relative",
3005 "Display bone-deforming groups as if all locked deform groups "
3006 "were deleted, and the remaining ones were re-normalized");
3007 RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data");
3009 prop = RNA_def_property(srna, "use_multipaint", PROP_BOOLEAN, PROP_NONE);
3010 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3011 RNA_def_property_boolean_sdna(prop, NULL, "multipaint", 1);
3012 RNA_def_property_ui_text(prop,
3013 "WPaint Multi-Paint",
3014 "Paint across the weights of all selected bones, "
3015 "maintaining their relative influence");
3016 RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data");
3018 prop = RNA_def_property(srna, "vertex_group_user", PROP_ENUM, PROP_NONE);
3019 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3020 RNA_def_property_enum_sdna(prop, NULL, "weightuser");
3021 RNA_def_property_enum_items(prop, draw_groupuser_items);
3022 RNA_def_property_ui_text(prop, "Mask Non-Group Vertices", "Display unweighted vertices");
3023 RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data");
3025 prop = RNA_def_property(srna, "vertex_group_subset", PROP_ENUM, PROP_NONE);
3026 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3027 RNA_def_property_enum_sdna(prop, NULL, "vgroupsubset");
3028 RNA_def_property_enum_items(prop, vertex_group_select_items);
3029 RNA_def_property_ui_text(prop, "Subset", "Filter Vertex groups for Display");
3030 RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data");
3032 prop = RNA_def_property(srna, "vertex_paint", PROP_POINTER, PROP_NONE);
3033 RNA_def_property_pointer_sdna(prop, NULL, "vpaint");
3034 RNA_def_property_ui_text(prop, "Vertex Paint", "");
3036 prop = RNA_def_property(srna, "weight_paint", PROP_POINTER, PROP_NONE);
3037 RNA_def_property_pointer_sdna(prop, NULL, "wpaint");
3038 RNA_def_property_ui_text(prop, "Weight Paint", "");
3040 prop = RNA_def_property(srna, "image_paint", PROP_POINTER, PROP_NONE);
3041 RNA_def_property_pointer_sdna(prop, NULL, "imapaint");
3042 RNA_def_property_ui_text(prop, "Image Paint", "");
3044 prop = RNA_def_property(srna, "uv_sculpt", PROP_POINTER, PROP_NONE);
3045 RNA_def_property_pointer_sdna(prop, NULL, "uvsculpt");
3046 RNA_def_property_ui_text(prop, "UV Sculpt", "");
3048 prop = RNA_def_property(srna, "gpencil_paint", PROP_POINTER, PROP_NONE);
3049 RNA_def_property_pointer_sdna(prop, NULL, "gp_paint");
3050 RNA_def_property_ui_text(prop, "Grease Pencil Paint", "");
3052 prop = RNA_def_property(srna, "gpencil_vertex_paint", PROP_POINTER, PROP_NONE);
3053 RNA_def_property_pointer_sdna(prop, NULL, "gp_vertexpaint");
3054 RNA_def_property_ui_text(prop, "Grease Pencil Vertex Paint", "");
3056 prop = RNA_def_property(srna, "gpencil_sculpt_paint", PROP_POINTER, PROP_NONE);
3057 RNA_def_property_pointer_sdna(prop, NULL, "gp_sculptpaint");
3058 RNA_def_property_ui_text(prop, "Grease Pencil Sculpt Paint", "");
3060 prop = RNA_def_property(srna, "gpencil_weight_paint", PROP_POINTER, PROP_NONE);
3061 RNA_def_property_pointer_sdna(prop, NULL, "gp_weightpaint");
3062 RNA_def_property_ui_text(prop, "Grease Pencil Weight Paint", "");
3064 prop = RNA_def_property(srna, "particle_edit", PROP_POINTER, PROP_NONE);
3065 RNA_def_property_pointer_sdna(prop, NULL, "particle");
3066 RNA_def_property_ui_text(prop, "Particle Edit", "");
3068 prop = RNA_def_property(srna, "uv_sculpt_lock_borders", PROP_BOOLEAN, PROP_NONE);
3069 RNA_def_property_boolean_sdna(prop, NULL, "uv_sculpt_settings", UV_SCULPT_LOCK_BORDERS);
3070 RNA_def_property_ui_text(prop, "Lock Borders", "Disable editing of boundary edges");
3072 prop = RNA_def_property(srna, "uv_sculpt_all_islands", PROP_BOOLEAN, PROP_NONE);
3073 RNA_def_property_boolean_sdna(prop, NULL, "uv_sculpt_settings", UV_SCULPT_ALL_ISLANDS);
3074 RNA_def_property_ui_text(prop, "Sculpt All Islands", "Brush operates on all islands");
3076 prop = RNA_def_property(srna, "uv_relax_method", PROP_ENUM, PROP_NONE);
3077 RNA_def_property_enum_sdna(prop, NULL, "uv_relax_method");
3078 RNA_def_property_enum_items(prop, uv_sculpt_relaxation_items);
3079 RNA_def_property_ui_text(prop, "Relaxation Method", "Algorithm used for UV relaxation");
3081 prop = RNA_def_property(srna, "lock_object_mode", PROP_BOOLEAN, PROP_NONE);
3082 RNA_def_property_boolean_sdna(prop, NULL, "object_flag", SCE_OBJECT_MODE_LOCK);
3083 RNA_def_property_ui_text(prop, "Lock Object Modes", "Restrict select to the current mode");
3084 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
3086 static const EnumPropertyItem workspace_tool_items[] = {
3087 {SCE_WORKSPACE_TOOL_DEFAULT, "DEFAULT", 0, "Active Tool", ""},
3088 {SCE_WORKSPACE_TOOL_FALLBACK, "FALLBACK", 0, "Select", ""},
3089 {0, NULL, 0, NULL, NULL},
3092 prop = RNA_def_property(srna, "workspace_tool_type", PROP_ENUM, PROP_NONE);
3093 RNA_def_property_enum_sdna(prop, NULL, "workspace_tool_type");
3094 RNA_def_property_enum_items(prop, workspace_tool_items);
3095 RNA_def_property_ui_text(prop, "Drag", "Action when dragging in the viewport");
3098 prop = RNA_def_property(srna, "use_proportional_edit", PROP_BOOLEAN, PROP_NONE);
3099 RNA_def_property_boolean_sdna(prop, NULL, "proportional_edit", PROP_EDIT_USE);
3100 RNA_def_property_ui_text(prop, "Proportional Editing", "Proportional edit mode");
3101 RNA_def_property_ui_icon(prop, ICON_PROP_ON, 0);
3102 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3104 prop = RNA_def_property(srna, "use_proportional_edit_objects", PROP_BOOLEAN, PROP_NONE);
3105 RNA_def_property_boolean_sdna(prop, NULL, "proportional_objects", 0);
3106 RNA_def_property_ui_text(
3107 prop, "Proportional Editing Objects", "Proportional editing object mode");
3108 RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1);
3109 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3111 prop = RNA_def_property(srna, "use_proportional_projected", PROP_BOOLEAN, PROP_NONE);
3112 RNA_def_property_boolean_sdna(prop, NULL, "proportional_edit", PROP_EDIT_PROJECTED);
3113 RNA_def_property_ui_text(
3114 prop, "Projected from View", "Proportional Editing using screen space locations");
3115 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3117 prop = RNA_def_property(srna, "use_proportional_connected", PROP_BOOLEAN, PROP_NONE);
3118 RNA_def_property_boolean_sdna(prop, NULL, "proportional_edit", PROP_EDIT_CONNECTED);
3119 RNA_def_property_ui_text(
3120 prop, "Connected Only", "Proportional Editing using connected geometry only");
3121 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3123 prop = RNA_def_property(srna, "use_proportional_edit_mask", PROP_BOOLEAN, PROP_NONE);
3124 RNA_def_property_boolean_sdna(prop, NULL, "proportional_mask", 0);
3125 RNA_def_property_ui_text(prop, "Proportional Editing Objects", "Proportional editing mask mode");
3126 RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1);
3127 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3129 prop = RNA_def_property(srna, "use_proportional_action", PROP_BOOLEAN, PROP_NONE);
3130 RNA_def_property_boolean_sdna(prop, NULL, "proportional_action", 0);
3131 RNA_def_property_ui_text(
3132 prop, "Proportional Editing Actions", "Proportional editing in action editor");
3133 RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1);
3134 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3136 prop = RNA_def_property(srna, "use_proportional_fcurve", PROP_BOOLEAN, PROP_NONE);
3137 RNA_def_property_boolean_sdna(prop, NULL, "proportional_fcurve", 0);
3138 RNA_def_property_ui_text(
3139 prop, "Proportional Editing FCurves", "Proportional editing in FCurve editor");
3140 RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1);
3141 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3143 prop = RNA_def_property(srna, "lock_markers", PROP_BOOLEAN, PROP_NONE);
3144 RNA_def_property_boolean_sdna(prop, NULL, "lock_markers", 0);
3145 RNA_def_property_ui_text(prop, "Lock Markers", "Prevent marker editing");
3147 prop = RNA_def_property(srna, "proportional_edit_falloff", PROP_ENUM, PROP_NONE);
3148 RNA_def_property_enum_sdna(prop, NULL, "prop_mode");
3149 RNA_def_property_enum_items(prop, rna_enum_proportional_falloff_items);
3150 RNA_def_property_ui_text(
3151 prop, "Proportional Editing Falloff", "Falloff type for proportional editing mode");
3152 /* Abusing id_curve :/ */
3153 RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE);
3154 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3156 prop = RNA_def_property(srna, "proportional_size", PROP_FLOAT, PROP_DISTANCE);
3157 RNA_def_property_float_sdna(prop, NULL, "proportional_size");
3158 RNA_def_property_ui_text(
3159 prop, "Proportional Size", "Display size for proportional editing circle");
3160 RNA_def_property_range(prop, 0.00001, 5000.0);
3162 prop = RNA_def_property(srna, "double_threshold", PROP_FLOAT, PROP_DISTANCE);
3163 RNA_def_property_float_sdna(prop, NULL, "doublimit");
3164 RNA_def_property_ui_text(prop, "Merge Threshold", "Threshold distance for Auto Merge");
3165 RNA_def_property_range(prop, 0.0, 1.0);
3166 RNA_def_property_ui_range(prop, 0.0, 0.1, 0.01, 6);
3169 prop = RNA_def_property(srna, "transform_pivot_point", PROP_ENUM, PROP_NONE);
3170 RNA_def_property_enum_sdna(prop, NULL, "transform_pivot_point");
3171 RNA_def_property_enum_items(prop, rna_enum_transform_pivot_items_full);
3172 RNA_def_property_ui_text(prop, "Transform Pivot Point", "Pivot center for rotation/scaling");
3173 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
3175 prop = RNA_def_property(srna, "use_transform_pivot_point_align", PROP_BOOLEAN, PROP_NONE);
3176 RNA_def_property_boolean_sdna(prop, NULL, "transform_flag", SCE_XFORM_AXIS_ALIGN);
3177 RNA_def_property_ui_text(
3180 "Only transform object locations, without affecting rotation or scaling");
3181 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
3183 prop = RNA_def_property(srna, "use_transform_data_origin", PROP_BOOLEAN, PROP_NONE);
3184 RNA_def_property_boolean_sdna(prop, NULL, "transform_flag", SCE_XFORM_DATA_ORIGIN);
3185 RNA_def_property_ui_text(
3186 prop, "Transform Origins", "Transform object origins, while leaving the shape in place");
3187 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
3189 prop = RNA_def_property(srna, "use_transform_skip_children", PROP_BOOLEAN, PROP_NONE);
3190 RNA_def_property_boolean_sdna(prop, NULL, "transform_flag", SCE_XFORM_SKIP_CHILDREN);
3191 RNA_def_property_ui_text(
3192 prop, "Transform Parents", "Transform the parents, leaving the children in place");
3193 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
3195 prop = RNA_def_property(srna, "use_transform_correct_face_attributes", PROP_BOOLEAN, PROP_NONE);
3196 RNA_def_property_boolean_sdna(prop, NULL, "uvcalc_flag", UVCALC_TRANSFORM_CORRECT);
3197 RNA_def_property_ui_text(prop,
3198 "Correct Face Attributes",
3199 "Correct data such as UV's and vertex colors when transforming");
3200 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
3202 prop = RNA_def_property(srna, "use_transform_correct_keep_connected", PROP_BOOLEAN, PROP_NONE);
3203 RNA_def_property_boolean_sdna(
3204 prop, NULL, "uvcalc_flag", UVCALC_TRANSFORM_CORRECT_KEEP_CONNECTED);
3205 RNA_def_property_ui_text(
3208 "During the Face Attributes correction, merge attributes connected to the same vertex");
3209 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
3211 prop = RNA_def_property(srna, "use_mesh_automerge", PROP_BOOLEAN, PROP_NONE);
3212 RNA_def_property_boolean_sdna(prop, NULL, "automerge", AUTO_MERGE);
3213 RNA_def_property_ui_text(
3214 prop, "Auto Merge Vertices", "Automatically merge vertices moved to the same location");
3215 RNA_def_property_ui_icon(prop, ICON_AUTOMERGE_OFF, 1);
3216 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3218 prop = RNA_def_property(srna, "use_mesh_automerge_and_split", PROP_BOOLEAN, PROP_NONE);
3219 RNA_def_property_boolean_sdna(prop, NULL, "automerge", AUTO_MERGE_AND_SPLIT);
3220 RNA_def_property_ui_text(prop, "Split Edges & Faces", "Automatically split edges and faces");
3221 RNA_def_property_ui_icon(prop, ICON_AUTOMERGE_OFF, 1);
3222 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3224 prop = RNA_def_property(srna, "use_snap", PROP_BOOLEAN, PROP_NONE);
3225 RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP);
3226 RNA_def_property_ui_text(prop, "Snap", "Snap during transform");
3227 RNA_def_property_ui_icon(prop, ICON_SNAP_OFF, 1);
3228 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3230 prop = RNA_def_property(srna, "use_snap_align_rotation", PROP_BOOLEAN, PROP_NONE);
3231 RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_ROTATE);
3232 RNA_def_property_ui_text(
3233 prop, "Align Rotation to Target", "Align rotation with the snapping target");
3234 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3236 prop = RNA_def_property(srna, "use_snap_grid_absolute", PROP_BOOLEAN, PROP_NONE);
3237 RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_ABS_GRID);
3238 RNA_def_property_ui_text(
3240 "Absolute Grid Snap",
3241 "Absolute grid alignment while translating (based on the pivot center)");
3242 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3244 prop = RNA_def_property(srna, "snap_elements", PROP_ENUM, PROP_NONE);
3245 RNA_def_property_enum_bitflag_sdna(prop, NULL, "snap_mode");
3246 RNA_def_property_enum_items(prop, rna_enum_snap_element_items);
3247 RNA_def_property_enum_funcs(prop, NULL, "rna_ToolSettings_snap_mode_set", NULL);
3248 RNA_def_property_flag(prop, PROP_ENUM_FLAG);
3249 RNA_def_property_ui_text(prop, "Snap Element", "Type of element to snap to");
3250 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3252 /* node editor uses own set of snap modes */
3253 prop = RNA_def_property(srna, "snap_node_element", PROP_ENUM, PROP_NONE);
3254 RNA_def_property_enum_bitflag_sdna(prop, NULL, "snap_node_mode");
3255 RNA_def_property_enum_items(prop, rna_enum_snap_node_element_items);
3256 RNA_def_property_ui_text(prop, "Snap Node Element", "Type of element to snap to");
3257 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3259 /* image editor uses own set of snap modes */
3260 prop = RNA_def_property(srna, "snap_uv_element", PROP_ENUM, PROP_NONE);
3261 RNA_def_property_enum_bitflag_sdna(prop, NULL, "snap_uv_mode");
3262 RNA_def_property_enum_items(prop, snap_uv_element_items);
3263 RNA_def_property_ui_text(prop, "Snap UV Element", "Type of element to snap to");
3264 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3266 prop = RNA_def_property(srna, "snap_target", PROP_ENUM, PROP_NONE);
3267 RNA_def_property_enum_sdna(prop, NULL, "snap_target");
3268 RNA_def_property_enum_items(prop, rna_enum_snap_target_items);
3269 RNA_def_property_ui_text(prop, "Snap Target", "Which part to snap onto the target");
3270 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3272 prop = RNA_def_property(srna, "use_snap_peel_object", PROP_BOOLEAN, PROP_NONE);
3273 RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_PEEL_OBJECT);
3274 RNA_def_property_ui_text(
3275 prop, "Snap Peel Object", "Consider objects as whole when finding volume center");
3276 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3278 prop = RNA_def_property(srna, "use_snap_project", PROP_BOOLEAN, PROP_NONE);
3279 RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_PROJECT);
3280 RNA_def_property_ui_text(prop,
3281 "Project Individual Elements",
3282 "Project individual elements on the surface of other objects");
3283 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3285 prop = RNA_def_property(srna, "use_snap_backface_culling", PROP_BOOLEAN, PROP_NONE);
3286 RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_BACKFACE_CULLING);
3287 RNA_def_property_ui_text(prop, "Backface Culling", "Exclude back facing geometry from snapping");
3288 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3290 prop = RNA_def_property(srna, "use_snap_self", PROP_BOOLEAN, PROP_NONE);
3291 RNA_def_property_boolean_negative_sdna(prop, NULL, "snap_flag", SCE_SNAP_NO_SELF);
3292 RNA_def_property_ui_text(prop, "Project onto Self", "Snap onto itself (Edit Mode Only)");
3293 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3295 prop = RNA_def_property(srna, "use_snap_translate", PROP_BOOLEAN, PROP_NONE);
3296 RNA_def_property_boolean_sdna(
3297 prop, NULL, "snap_transform_mode_flag", SCE_SNAP_TRANSFORM_MODE_TRANSLATE);
3298 RNA_def_property_ui_text(
3299 prop, "Use Snap for Translation", "Move is affected by snapping settings");
3300 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3302 prop = RNA_def_property(srna, "use_snap_rotate", PROP_BOOLEAN, PROP_NONE);
3303 RNA_def_property_boolean_sdna(
3304 prop, NULL, "snap_transform_mode_flag", SCE_SNAP_TRANSFORM_MODE_ROTATE);
3305 RNA_def_property_boolean_default(prop, false);
3306 RNA_def_property_ui_text(
3307 prop, "Use Snap for Rotation", "Rotate is affected by the snapping settings");
3308 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3310 prop = RNA_def_property(srna, "use_snap_scale", PROP_BOOLEAN, PROP_NONE);
3311 RNA_def_property_boolean_sdna(
3312 prop, NULL, "snap_transform_mode_flag", SCE_SNAP_TRANSFORM_MODE_SCALE);
3313 RNA_def_property_boolean_default(prop, false);
3314 RNA_def_property_ui_text(prop, "Use Snap for Scale", "Scale is affected by snapping settings");
3315 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
3318 prop = RNA_def_property(srna, "use_gpencil_draw_additive", PROP_BOOLEAN, PROP_NONE);
3319 RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_RETAIN_LAST);
3320 RNA_def_property_ui_text(prop,
3321 "Use Additive Drawing",
3322 "When creating new frames, the strokes from the previous/active frame "
3323 "are included as the basis for the new one");
3324 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
3326 prop = RNA_def_property(srna, "use_gpencil_draw_onback", PROP_BOOLEAN, PROP_NONE);
3327 RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_PAINT_ONBACK);
3328 RNA_def_property_ui_text(
3330 "Draw Strokes on Back",
3331 "When draw new strokes, the new stroke is drawn below of all strokes in the layer");
3332 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
3334 prop = RNA_def_property(srna, "use_gpencil_thumbnail_list", PROP_BOOLEAN, PROP_NONE);
3335 RNA_def_property_boolean_negative_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_THUMBNAIL_LIST);
3336 RNA_def_property_ui_text(
3337 prop, "Compact List", "Show compact list of color instead of thumbnails");
3338 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
3340 prop = RNA_def_property(srna, "use_gpencil_weight_data_add", PROP_BOOLEAN, PROP_NONE);
3341 RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_CREATE_WEIGHTS);
3342 RNA_def_property_ui_text(prop,
3343 "Add weight data for new strokes",
3344 "When creating new strokes, the weight data is added according to the "
3345 "current vertex group and weight, "
3346 "if no vertex group selected, weight is not added");
3347 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
3349 prop = RNA_def_property(srna, "use_gpencil_automerge_strokes", PROP_BOOLEAN, PROP_NONE);
3350 RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_AUTOMERGE_STROKE);
3351 RNA_def_property_boolean_default(prop, false);
3352 RNA_def_property_ui_icon(prop, ICON_AUTOMERGE_OFF, 1);
3353 RNA_def_property_ui_text(
3356 "Join by distance last drawn stroke with previous strokes in the active layer");
3357 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3359 prop = RNA_def_property(srna, "gpencil_sculpt", PROP_POINTER, PROP_NONE);
3360 RNA_def_property_pointer_sdna(prop, NULL, "gp_sculpt");
3361 RNA_def_property_struct_type(prop, "GPencilSculptSettings");
3362 RNA_def_property_ui_text(
3363 prop, "Grease Pencil Sculpt", "Settings for stroke sculpting tools and brushes");
3365 prop = RNA_def_property(srna, "gpencil_interpolate", PROP_POINTER, PROP_NONE);
3366 RNA_def_property_pointer_sdna(prop, NULL, "gp_interpolate");
3367 RNA_def_property_struct_type(prop, "GPencilInterpolateSettings");
3368 RNA_def_property_ui_text(
3369 prop, "Grease Pencil Interpolate", "Settings for Grease Pencil Interpolation tools");
3371 /* Grease Pencil - 3D View Stroke Placement */
3372 prop = RNA_def_property(srna, "gpencil_stroke_placement_view3d", PROP_ENUM, PROP_NONE);
3373 RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_v3d_align");
3374 RNA_def_property_enum_items(prop, gpencil_stroke_placement_items);
3375 RNA_def_property_ui_text(prop, "Stroke Placement (3D View)", "");
3376 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
3378 prop = RNA_def_property(srna, "gpencil_stroke_snap_mode", PROP_ENUM, PROP_NONE);
3379 RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_v3d_align");
3380 RNA_def_property_enum_items(prop, gpencil_stroke_snap_items);
3381 RNA_def_property_ui_text(prop, "Stroke Snap", "");
3382 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
3384 prop = RNA_def_property(srna, "use_gpencil_stroke_endpoints", PROP_BOOLEAN, PROP_NONE);
3385 RNA_def_property_boolean_sdna(
3386 prop, NULL, "gpencil_v3d_align", GP_PROJECT_DEPTH_STROKE_ENDPOINTS);
3387 RNA_def_property_ui_text(
3388 prop, "Only Endpoints", "Only use the first and last parts of the stroke for snapping");
3389 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
3391 /* Grease Pencil - Select mode Edit */
3392 prop = RNA_def_property(srna, "gpencil_selectmode_edit", PROP_ENUM, PROP_NONE);
3393 RNA_def_property_enum_sdna(prop, NULL, "gpencil_selectmode_edit");
3394 RNA_def_property_enum_items(prop, gpencil_selectmode_items);
3395 RNA_def_property_ui_text(prop, "Select Mode", "");
3396 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3397 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3398 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_Gpencil_selectmode_update");
3400 /* Grease Pencil - Select mode Sculpt */
3401 prop = RNA_def_property(srna, "use_gpencil_select_mask_point", PROP_BOOLEAN, PROP_NONE);
3402 RNA_def_property_boolean_sdna(
3403 prop, NULL, "gpencil_selectmode_sculpt", GP_SCULPT_MASK_SELECTMODE_POINT);
3404 RNA_def_property_ui_text(prop, "Selection Mask", "Only sculpt selected stroke points");
3405 RNA_def_property_ui_icon(prop, ICON_GP_SELECT_POINTS, 0);
3406 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3407 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3408 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_Gpencil_mask_point_update");
3410 prop = RNA_def_property(srna, "use_gpencil_select_mask_stroke", PROP_BOOLEAN, PROP_NONE);
3411 RNA_def_property_boolean_sdna(
3412 prop, NULL, "gpencil_selectmode_sculpt", GP_SCULPT_MASK_SELECTMODE_STROKE);
3413 RNA_def_property_ui_text(prop, "Selection Mask", "Only sculpt selected stroke");
3414 RNA_def_property_ui_icon(prop, ICON_GP_SELECT_STROKES, 0);
3415 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3416 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3417 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_Gpencil_mask_stroke_update");
3419 prop = RNA_def_property(srna, "use_gpencil_select_mask_segment", PROP_BOOLEAN, PROP_NONE);
3420 RNA_def_property_boolean_sdna(
3421 prop, NULL, "gpencil_selectmode_sculpt", GP_SCULPT_MASK_SELECTMODE_SEGMENT);
3422 RNA_def_property_ui_text(
3423 prop, "Selection Mask", "Only sculpt selected stroke points between other strokes");
3424 RNA_def_property_ui_icon(prop, ICON_GP_SELECT_BETWEEN_STROKES, 0);
3425 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3426 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3427 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_Gpencil_mask_segment_update");
3429 /* Grease Pencil - Select mode Vertex Paint */
3430 prop = RNA_def_property(srna, "use_gpencil_vertex_select_mask_point", PROP_BOOLEAN, PROP_NONE);
3431 RNA_def_property_boolean_sdna(
3432 prop, NULL, "gpencil_selectmode_vertex", GP_VERTEX_MASK_SELECTMODE_POINT);
3433 RNA_def_property_ui_text(prop, "Selection Mask", "Only paint selected stroke points");
3434 RNA_def_property_ui_icon(prop, ICON_GP_SELECT_POINTS, 0);
3435 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3436 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3437 RNA_def_property_update(
3438 prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_Gpencil_vertex_mask_point_update");
3440 prop = RNA_def_property(srna, "use_gpencil_vertex_select_mask_stroke", PROP_BOOLEAN, PROP_NONE);
3441 RNA_def_property_boolean_sdna(
3442 prop, NULL, "gpencil_selectmode_vertex", GP_VERTEX_MASK_SELECTMODE_STROKE);
3443 RNA_def_property_ui_text(prop, "Selection Mask", "Only paint selected stroke");
3444 RNA_def_property_ui_icon(prop, ICON_GP_SELECT_STROKES, 0);
3445 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3446 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3447 RNA_def_property_update(
3448 prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_Gpencil_vertex_mask_stroke_update");
3450 prop = RNA_def_property(srna, "use_gpencil_vertex_select_mask_segment", PROP_BOOLEAN, PROP_NONE);
3451 RNA_def_property_boolean_sdna(
3452 prop, NULL, "gpencil_selectmode_vertex", GP_VERTEX_MASK_SELECTMODE_SEGMENT);
3453 RNA_def_property_ui_text(
3454 prop, "Selection Mask", "Only paint selected stroke points between other strokes");
3455 RNA_def_property_ui_icon(prop, ICON_GP_SELECT_BETWEEN_STROKES, 0);
3456 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
3457 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3458 RNA_def_property_update(
3459 prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_Gpencil_vertex_mask_segment_update");
3461 /* Annotations - 2D Views Stroke Placement */
3462 prop = RNA_def_property(srna, "annotation_stroke_placement_view2d", PROP_ENUM, PROP_NONE);
3463 RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_v2d_align");
3464 RNA_def_property_enum_items(prop, annotation_stroke_placement_items);
3465 RNA_def_property_ui_text(prop, "Stroke Placement (2D View)", "");
3466 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
3468 /* Annotations - Sequencer Preview Stroke Placement */
3469 prop = RNA_def_property(
3470 srna, "annotation_stroke_placement_sequencer_preview", PROP_ENUM, PROP_NONE);
3471 RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_seq_align");
3472 RNA_def_property_enum_items(prop, annotation_stroke_placement_items);
3473 RNA_def_property_ui_text(prop, "Stroke Placement (Sequencer Preview)", "");
3474 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
3476 /* Annotations - Image Editor Stroke Placement */
3477 prop = RNA_def_property(srna, "annotation_stroke_placement_image_editor", PROP_ENUM, PROP_NONE);
3478 RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_ima_align");
3479 RNA_def_property_enum_items(prop, annotation_stroke_placement_items);
3480 RNA_def_property_ui_text(prop, "Stroke Placement (Image Editor)", "");
3481 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
3483 /* Annotations - 3D View Stroke Placement */
3484 /* XXX: Do we need to decouple the stroke_endpoints setting too? */
3485 prop = RNA_def_property(srna, "annotation_stroke_placement_view3d", PROP_ENUM, PROP_NONE);
3486 RNA_def_property_enum_bitflag_sdna(prop, NULL, "annotate_v3d_align");
3487 RNA_def_property_enum_items(prop, annotation_stroke_placement_items);
3488 RNA_def_property_enum_default(prop, GP_PROJECT_VIEWSPACE | GP_PROJECT_CURSOR);
3489 RNA_def_property_ui_text(prop,
3490 "Annotation Stroke Placement (3D View)",
3491 "How annotation strokes are orientated in 3D space");
3492 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
3494 /* Annotations - Stroke Thickness */
3495 prop = RNA_def_property(srna, "annotation_thickness", PROP_INT, PROP_PIXEL);
3496 RNA_def_property_int_sdna(prop, NULL, "annotate_thickness");
3497 RNA_def_property_range(prop, 1, 10);
3498 RNA_def_property_ui_text(prop, "Annotation Stroke Thickness", "Thickness of annotation strokes");
3499 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
3502 prop = RNA_def_property(srna, "use_keyframe_insert_auto", PROP_BOOLEAN, PROP_NONE);
3503 RNA_def_property_boolean_sdna(prop, NULL, "autokey_mode", AUTOKEY_ON);
3504 RNA_def_property_ui_text(
3505 prop, "Auto Keying", "Automatic keyframe insertion for Objects, Bones and Masks");
3506 RNA_def_property_ui_icon(prop, ICON_REC, 0);
3508 prop = RNA_def_property(srna, "auto_keying_mode", PROP_ENUM, PROP_NONE);
3509 RNA_def_property_enum_bitflag_sdna(prop, NULL, "autokey_mode");
3510 RNA_def_property_enum_items(prop, auto_key_items);
3511 RNA_def_property_ui_text(prop,
3513 "Mode of automatic keyframe insertion for Objects, Bones and Masks");
3515 prop = RNA_def_property(srna, "use_record_with_nla", PROP_BOOLEAN, PROP_NONE);
3516 RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", ANIMRECORD_FLAG_WITHNLA);
3517 RNA_def_property_ui_text(
3520 "Add a new NLA Track + Strip for every loop/pass made over the animation "
3521 "to allow non-destructive tweaking");
3523 prop = RNA_def_property(srna, "use_keyframe_insert_keyingset", PROP_BOOLEAN, PROP_NONE);
3524 RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_ONLYKEYINGSET);
3525 RNA_def_property_ui_text(prop,
3526 "Auto Keyframe Insert Keying Set",
3527 "Automatic keyframe insertion using active Keying Set only");
3528 RNA_def_property_ui_icon(prop, ICON_KEYINGSET, 0);
3530 prop = RNA_def_property(srna, "use_keyframe_cycle_aware", PROP_BOOLEAN, PROP_NONE);
3531 RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_CYCLEAWARE);
3532 RNA_def_property_ui_text(
3534 "Cycle-Aware Keying",
3535 "For channels with cyclic extrapolation, keyframe insertion is automatically "
3536 "remapped inside the cycle time range, and keeps ends in sync");
3539 prop = RNA_def_property(srna, "keyframe_type", PROP_ENUM, PROP_NONE);
3540 RNA_def_property_enum_sdna(prop, NULL, "keyframe_type");
3541 RNA_def_property_enum_items(prop, rna_enum_beztriple_keyframe_type_items);
3542 RNA_def_property_ui_text(
3543 prop, "New Keyframe Type", "Type of keyframes to create when inserting keyframes");
3546 prop = RNA_def_property(srna, "uv_select_mode", PROP_ENUM, PROP_NONE);
3547 RNA_def_property_enum_sdna(prop, NULL, "uv_selectmode");
3548 RNA_def_property_enum_items(prop, rna_enum_mesh_select_mode_uv_items);
3549 RNA_def_property_ui_text(prop, "UV Selection Mode", "UV selection and display mode");
3550 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
3552 prop = RNA_def_property(srna, "use_uv_select_sync", PROP_BOOLEAN, PROP_NONE);
3553 RNA_def_property_boolean_sdna(prop, NULL, "uv_flag", UV_SYNC_SELECTION);
3554 RNA_def_property_ui_text(
3555 prop, "UV Sync Selection", "Keep UV and edit mode mesh selection in sync");
3556 RNA_def_property_ui_icon(prop, ICON_UV_SYNC_SELECT, 0);
3557 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
3559 prop = RNA_def_property(srna, "show_uv_local_view", PROP_BOOLEAN, PROP_NONE);
3560 RNA_def_property_boolean_sdna(prop, NULL, "uv_flag", UV_SHOW_SAME_IMAGE);
3561 RNA_def_property_ui_text(
3562 prop, "UV Local View", "Display only faces with the currently displayed image assigned");
3563 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
3566 prop = RNA_def_property(srna, "mesh_select_mode", PROP_BOOLEAN, PROP_NONE);
3567 RNA_def_property_boolean_sdna(prop, NULL, "selectmode", 1);
3568 RNA_def_property_array(prop, 3);
3569 RNA_def_property_boolean_funcs(prop, NULL, "rna_Scene_editmesh_select_mode_set");
3570 RNA_def_property_ui_text(prop, "Mesh Selection Mode", "Which mesh elements selection works on");
3571 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3572 RNA_def_property_update(prop, 0, "rna_Scene_editmesh_select_mode_update");
3574 prop = RNA_def_property(srna, "vertex_group_weight", PROP_FLOAT, PROP_FACTOR);
3575 RNA_def_property_float_sdna(prop, NULL, "vgroup_weight");
3576 RNA_def_property_ui_text(prop, "Vertex Group Weight", "Weight to assign in vertex groups");
3578 prop = RNA_def_property(srna, "use_edge_path_live_unwrap", PROP_BOOLEAN, PROP_NONE);
3579 RNA_def_property_boolean_sdna(prop, NULL, "edge_mode_live_unwrap", 1);
3580 RNA_def_property_ui_text(prop, "Live Unwrap", "Changing edge seams recalculates UV unwrap");
3582 prop = RNA_def_property(srna, "normal_vector", PROP_FLOAT, PROP_XYZ);
3583 RNA_def_property_ui_text(prop, "Normal Vector", "Normal Vector used to copy, add or multiply");
3584 RNA_def_property_ui_range(prop, -10000.0, 10000.0, 1, 3);
3586 /* Unified Paint Settings */
3587 prop = RNA_def_property(srna, "unified_paint_settings", PROP_POINTER, PROP_NONE);
3588 RNA_def_property_flag(prop, PROP_NEVER_NULL);
3589 RNA_def_property_struct_type(prop, "UnifiedPaintSettings");
3590 RNA_def_property_ui_text(prop, "Unified Paint Settings", NULL);
3592 /* Curve Paint Settings */
3593 prop = RNA_def_property(srna, "curve_paint_settings", PROP_POINTER, PROP_NONE);
3594 RNA_def_property_flag(prop, PROP_NEVER_NULL);
3595 RNA_def_property_struct_type(prop, "CurvePaintSettings");
3596 RNA_def_property_ui_text(prop, "Curve Paint Settings", NULL);
3598 /* Mesh Statistics */
3599 prop = RNA_def_property(srna, "statvis", PROP_POINTER, PROP_NONE);
3600 RNA_def_property_flag(prop, PROP_NEVER_NULL);
3601 RNA_def_property_struct_type(prop, "MeshStatVis");
3602 RNA_def_property_ui_text(prop, "Mesh Statistics Visualization", NULL);
3605 prop = RNA_def_property(srna, "custom_bevel_profile_preset", PROP_POINTER, PROP_NONE);
3606 RNA_def_property_pointer_sdna(prop, NULL, "custom_bevel_profile_preset");
3607 RNA_def_property_struct_type(prop, "CurveProfile");
3608 RNA_def_property_ui_text(prop, "Curve Profile Widget", "Used for defining a profile's path");
3610 /* Sequencer tool settings */
3611 prop = RNA_def_property(srna, "sequencer_tool_settings", PROP_POINTER, PROP_NONE);
3612 RNA_def_property_flag(prop, PROP_NEVER_NULL);
3613 RNA_def_property_struct_type(prop, "SequencerToolSettings");
3614 RNA_def_property_ui_text(prop, "Sequencer Tool Settings", NULL);
3617 static void rna_def_sequencer_tool_settings(BlenderRNA *brna)
3622 static const EnumPropertyItem scale_fit_methods[] = {
3623 {SEQ_SCALE_TO_FIT, "FIT", 0, "Scale to Fit", "Scale image to fit within the canvas"},
3624 {SEQ_SCALE_TO_FILL, "FILL", 0, "Scale to Fill", "Scale image to completely fill the canvas"},
3625 {SEQ_STRETCH_TO_FILL, "STRETCH", 0, "Stretch to Fill", "Stretch image to fill the canvas"},
3626 {SEQ_USE_ORIGINAL_SIZE,
3629 "Use Original Size",
3630 "Keep image at its original size"},
3631 {0, NULL, 0, NULL, NULL},
3634 srna = RNA_def_struct(brna, "SequencerToolSettings", NULL);
3635 RNA_def_struct_path_func(srna, "rna_SequencerToolSettings_path");
3636 RNA_def_struct_ui_text(srna, "Sequencer Tool Settings", "");
3638 prop = RNA_def_property(srna, "fit_method", PROP_ENUM, PROP_NONE);
3639 RNA_def_property_enum_items(prop, scale_fit_methods);
3640 RNA_def_property_ui_text(prop, "Fit Method", "Scale fit method");
3643 static void rna_def_unified_paint_settings(BlenderRNA *brna)
3648 static const EnumPropertyItem brush_size_unit_items[] = {
3649 {0, "VIEW", 0, "View", "Measure brush size relative to the view"},
3650 {UNIFIED_PAINT_BRUSH_LOCK_SIZE,
3654 "Measure brush size relative to the scene"},
3655 {0, NULL, 0, NULL, NULL},
3658 srna = RNA_def_struct(brna, "UnifiedPaintSettings", NULL);
3659 RNA_def_struct_path_func(srna, "rna_UnifiedPaintSettings_path");
3660 RNA_def_struct_ui_text(
3661 srna, "Unified Paint Settings", "Overrides for some of the active brush's settings");
3663 /* high-level flags to enable or disable unified paint settings */
3664 prop = RNA_def_property(srna, "use_unified_size", PROP_BOOLEAN, PROP_NONE);
3665 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_SIZE);
3666 RNA_def_property_ui_text(prop,
3667 "Use Unified Radius",
3668 "Instead of per-brush radius, the radius is shared across brushes");
3670 prop = RNA_def_property(srna, "use_unified_strength", PROP_BOOLEAN, PROP_NONE);
3671 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_ALPHA);
3672 RNA_def_property_ui_text(prop,
3673 "Use Unified Strength",
3674 "Instead of per-brush strength, the strength is shared across brushes");
3676 prop = RNA_def_property(srna, "use_unified_weight", PROP_BOOLEAN, PROP_NONE);
3677 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_WEIGHT);
3678 RNA_def_property_ui_text(prop,
3679 "Use Unified Weight",
3680 "Instead of per-brush weight, the weight is shared across brushes");
3682 prop = RNA_def_property(srna, "use_unified_color", PROP_BOOLEAN, PROP_NONE);
3683 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_COLOR);
3684 RNA_def_property_ui_text(
3685 prop, "Use Unified Color", "Instead of per-brush color, the color is shared across brushes");
3687 /* unified paint settings that override the equivalent settings
3688 * from the active brush */
3689 prop = RNA_def_property(srna, "size", PROP_INT, PROP_PIXEL);
3690 RNA_def_property_int_funcs(prop, NULL, "rna_UnifiedPaintSettings_size_set", NULL);
3691 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3692 RNA_def_property_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS * 10);
3693 RNA_def_property_ui_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS, 1, -1);
3694 RNA_def_property_ui_text(prop, "Radius", "Radius of the brush");
3695 RNA_def_property_update(prop, 0, "rna_UnifiedPaintSettings_radius_update");
3697 prop = RNA_def_property(srna, "unprojected_radius", PROP_FLOAT, PROP_DISTANCE);
3698 RNA_def_property_float_funcs(
3699 prop, NULL, "rna_UnifiedPaintSettings_unprojected_radius_set", NULL);
3700 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3701 RNA_def_property_range(prop, 0.001, FLT_MAX);
3702 RNA_def_property_ui_range(prop, 0.001, 1, 1, -1);
3703 RNA_def_property_ui_text(prop, "Unprojected Radius", "Radius of brush in Blender units");
3704 RNA_def_property_update(prop, 0, "rna_UnifiedPaintSettings_radius_update");
3706 prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
3707 RNA_def_property_float_sdna(prop, NULL, "alpha");
3708 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3709 RNA_def_property_float_default(prop, 0.5f);
3710 RNA_def_property_range(prop, 0.0f, 10.0f);
3711 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
3712 RNA_def_property_ui_text(
3713 prop, "Strength", "How powerful the effect of the brush is when applied");
3714 RNA_def_property_update(prop, 0, "rna_UnifiedPaintSettings_update");
3716 prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_FACTOR);
3717 RNA_def_property_float_sdna(prop, NULL, "weight");
3718 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3719 RNA_def_property_float_default(prop, 0.5f);
3720 RNA_def_property_range(prop, 0.0f, 1.0f);
3721 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
3722 RNA_def_property_ui_text(prop, "Weight", "Weight to assign in vertex groups");
3723 RNA_def_property_update(prop, 0, "rna_UnifiedPaintSettings_update");
3725 prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
3726 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3727 RNA_def_property_range(prop, 0.0, 1.0);
3728 RNA_def_property_float_sdna(prop, NULL, "rgb");
3729 RNA_def_property_ui_text(prop, "Color", "");
3730 RNA_def_property_update(prop, 0, "rna_UnifiedPaintSettings_update");
3732 prop = RNA_def_property(srna, "secondary_color", PROP_FLOAT, PROP_COLOR_GAMMA);
3733 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3734 RNA_def_property_range(prop, 0.0, 1.0);
3735 RNA_def_property_float_sdna(prop, NULL, "secondary_rgb");
3736 RNA_def_property_ui_text(prop, "Secondary Color", "");
3737 RNA_def_property_update(prop, 0, "rna_UnifiedPaintSettings_update");
3739 prop = RNA_def_property(srna, "use_locked_size", PROP_ENUM, PROP_NONE); /* as an enum */
3740 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
3741 RNA_def_property_enum_items(prop, brush_size_unit_items);
3742 RNA_def_property_ui_text(
3743 prop, "Radius Unit", "Measure brush size relative to the view or the scene");
3746 static void rna_def_curve_paint_settings(BlenderRNA *brna)
3751 srna = RNA_def_struct(brna, "CurvePaintSettings", NULL);
3752 RNA_def_struct_path_func(srna, "rna_CurvePaintSettings_path");
3753 RNA_def_struct_ui_text(srna, "Curve Paint Settings", "");
3755 static const EnumPropertyItem curve_type_items[] = {
3756 {CU_POLY, "POLY", 0, "Poly", ""},
3757 {CU_BEZIER, "BEZIER", 0, "Bezier", ""},
3758 {0, NULL, 0, NULL, NULL},
3761 prop = RNA_def_property(srna, "curve_type", PROP_ENUM, PROP_NONE);
3762 RNA_def_property_enum_sdna(prop, NULL, "curve_type");
3763 RNA_def_property_enum_items(prop, curve_type_items);
3764 RNA_def_property_ui_text(prop, "Type", "Type of curve to use for new strokes");
3766 prop = RNA_def_property(srna, "use_corners_detect", PROP_BOOLEAN, PROP_NONE);
3767 RNA_def_property_boolean_sdna(prop, NULL, "flag", CURVE_PAINT_FLAG_CORNERS_DETECT);
3768 RNA_def_property_ui_text(prop, "Detect Corners", "Detect corners and use non-aligned handles");
3770 prop = RNA_def_property(srna, "use_pressure_radius", PROP_BOOLEAN, PROP_NONE);
3771 RNA_def_property_boolean_sdna(prop, NULL, "flag", CURVE_PAINT_FLAG_PRESSURE_RADIUS);
3772 RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
3773 RNA_def_property_ui_text(prop, "Use Pressure", "Map tablet pressure to curve radius");
3775 prop = RNA_def_property(srna, "use_stroke_endpoints", PROP_BOOLEAN, PROP_NONE);
3776 RNA_def_property_boolean_sdna(prop, NULL, "flag", CURVE_PAINT_FLAG_DEPTH_STROKE_ENDPOINTS);
3777 RNA_def_property_ui_text(prop, "Only First", "Use the start of the stroke for the depth");
3779 prop = RNA_def_property(srna, "use_offset_absolute", PROP_BOOLEAN, PROP_NONE);
3780 RNA_def_property_boolean_sdna(prop, NULL, "flag", CURVE_PAINT_FLAG_DEPTH_STROKE_OFFSET_ABS);
3781 RNA_def_property_ui_text(
3782 prop, "Absolute Offset", "Apply a fixed offset (don't scale by the radius)");
3784 prop = RNA_def_property(srna, "error_threshold", PROP_INT, PROP_PIXEL);
3785 RNA_def_property_range(prop, 1, 100);
3786 RNA_def_property_ui_text(prop, "Tolerance", "Allow deviation for a smoother, less precise line");
3788 prop = RNA_def_property(srna, "fit_method", PROP_ENUM, PROP_PIXEL);
3789 RNA_def_property_enum_sdna(prop, NULL, "fit_method");
3790 RNA_def_property_enum_items(prop, rna_enum_curve_fit_method_items);
3791 RNA_def_property_ui_text(prop, "Method", "Curve fitting method");
3793 prop = RNA_def_property(srna, "corner_angle", PROP_FLOAT, PROP_ANGLE);
3794 RNA_def_property_range(prop, 0, M_PI);
3795 RNA_def_property_ui_text(prop, "Corner Angle", "Angles above this are considered corners");
3797 prop = RNA_def_property(srna, "radius_min", PROP_FLOAT, PROP_NONE);
3798 RNA_def_property_range(prop, 0.0, 100.0);
3799 RNA_def_property_ui_range(prop, 0.0f, 10.0, 10, 2);
3800 RNA_def_property_ui_text(
3803 "Minimum radius when the minimum pressure is applied (also the minimum when tapering)");
3805 prop = RNA_def_property(srna, "radius_max", PROP_FLOAT, PROP_NONE);
3806 RNA_def_property_range(prop, 0.0, 100.0);
3807 RNA_def_property_ui_range(prop, 0.0f, 10.0, 10, 2);
3808 RNA_def_property_ui_text(
3811 "Radius to use when the maximum pressure is applied (or when a tablet isn't used)");
3813 prop = RNA_def_property(srna, "radius_taper_start", PROP_FLOAT, PROP_NONE);
3814 RNA_def_property_range(prop, 0.0, 1.0);
3815 RNA_def_property_ui_range(prop, 0.0f, 1.0, 1, 2);
3816 RNA_def_property_ui_text(
3817 prop, "Radius Min", "Taper factor for the radius of each point along the curve");
3819 prop = RNA_def_property(srna, "radius_taper_end", PROP_FLOAT, PROP_NONE);
3820 RNA_def_property_range(prop, 0.0, 10.0);
3821 RNA_def_property_ui_range(prop, 0.0f, 1.0, 1, 2);
3822 RNA_def_property_ui_text(
3823 prop, "Radius Max", "Taper factor for the radius of each point along the curve");
3825 prop = RNA_def_property(srna, "surface_offset", PROP_FLOAT, PROP_NONE);
3826 RNA_def_property_range(prop, -10.0, 10.0);
3827 RNA_def_property_ui_range(prop, -1.0f, 1.0, 1, 2);
3828 RNA_def_property_ui_text(prop, "Offset", "Offset the stroke from the surface");
3830 static const EnumPropertyItem depth_mode_items[] = {
3831 {CURVE_PAINT_PROJECT_CURSOR, "CURSOR", 0, "Cursor", ""},
3832 {CURVE_PAINT_PROJECT_SURFACE, "SURFACE", 0, "Surface", ""},
3833 {0, NULL, 0, NULL, NULL},
3836 prop = RNA_def_property(srna, "depth_mode", PROP_ENUM, PROP_NONE);
3837 RNA_def_property_enum_sdna(prop, NULL, "depth_mode");
3838 RNA_def_property_enum_items(prop, depth_mode_items);
3839 RNA_def_property_ui_text(prop, "Depth", "Method of projecting depth");
3841 static const EnumPropertyItem surface_plane_items[] = {
3842 {CURVE_PAINT_SURFACE_PLANE_NORMAL_VIEW,
3846 "Display perpendicular to the surface"},
3847 {CURVE_PAINT_SURFACE_PLANE_NORMAL_SURFACE,
3851 "Display aligned to the surface"},
3852 {CURVE_PAINT_SURFACE_PLANE_VIEW, "VIEW", 0, "View", "Display aligned to the viewport"},
3853 {0, NULL, 0, NULL, NULL},
3856 prop = RNA_def_property(srna, "surface_plane", PROP_ENUM, PROP_NONE);
3857 RNA_def_property_enum_sdna(prop, NULL, "surface_plane");
3858 RNA_def_property_enum_items(prop, surface_plane_items);
3859 RNA_def_property_ui_text(prop, "Plane", "Plane for projected stroke");
3862 static void rna_def_statvis(BlenderRNA *brna)
3867 static const EnumPropertyItem stat_type[] = {
3868 {SCE_STATVIS_OVERHANG, "OVERHANG", 0, "Overhang", ""},
3869 {SCE_STATVIS_THICKNESS, "THICKNESS", 0, "Thickness", ""},
3870 {SCE_STATVIS_INTERSECT, "INTERSECT", 0, "Intersect", ""},
3871 {SCE_STATVIS_DISTORT, "DISTORT", 0, "Distortion", ""},
3872 {SCE_STATVIS_SHARP, "SHARP", 0, "Sharp", ""},
3873 {0, NULL, 0, NULL, NULL},
3876 srna = RNA_def_struct(brna, "MeshStatVis", NULL);
3877 RNA_def_struct_path_func(srna, "rna_MeshStatVis_path");
3878 RNA_def_struct_ui_text(srna, "Mesh Visualize Statistics", "");
3880 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
3881 RNA_def_property_enum_items(prop, stat_type);
3882 RNA_def_property_ui_text(prop, "Type", "Type of data to visualize/check");
3883 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3884 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
3887 prop = RNA_def_property(srna, "overhang_min", PROP_FLOAT, PROP_ANGLE);
3888 RNA_def_property_float_sdna(prop, NULL, "overhang_min");
3889 RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
3890 RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 10, 3);
3891 RNA_def_property_ui_text(prop, "Overhang Min", "Minimum angle to display");
3892 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3893 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
3895 prop = RNA_def_property(srna, "overhang_max", PROP_FLOAT, PROP_ANGLE);
3896 RNA_def_property_float_sdna(prop, NULL, "overhang_max");
3897 RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
3898 RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 10, 3);
3899 RNA_def_property_ui_text(prop, "Overhang Max", "Maximum angle to display");
3900 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3901 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
3903 prop = RNA_def_property(srna, "overhang_axis", PROP_ENUM, PROP_NONE);
3904 RNA_def_property_enum_sdna(prop, NULL, "overhang_axis");
3905 RNA_def_property_enum_items(prop, rna_enum_object_axis_items);
3906 RNA_def_property_ui_text(prop, "Axis", "");
3907 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3908 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
3911 prop = RNA_def_property(srna, "thickness_min", PROP_FLOAT, PROP_DISTANCE);
3912 RNA_def_property_float_sdna(prop, NULL, "thickness_min");
3913 RNA_def_property_range(prop, 0.0f, 1000.0);
3914 RNA_def_property_ui_range(prop, 0.0f, 100.0, 0.001, 3);
3915 RNA_def_property_ui_text(prop, "Thickness Min", "Minimum for measuring thickness");
3916 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3917 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
3919 prop = RNA_def_property(srna, "thickness_max", PROP_FLOAT, PROP_DISTANCE);
3920 RNA_def_property_float_sdna(prop, NULL, "thickness_max");
3921 RNA_def_property_range(prop, 0.0f, 1000.0);
3922 RNA_def_property_ui_range(prop, 0.0f, 100.0, 0.001, 3);
3923 RNA_def_property_ui_text(prop, "Thickness Max", "Maximum for measuring thickness");
3924 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3925 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
3927 prop = RNA_def_property(srna, "thickness_samples", PROP_INT, PROP_UNSIGNED);
3928 RNA_def_property_int_sdna(prop, NULL, "thickness_samples");
3929 RNA_def_property_range(prop, 1, 32);
3930 RNA_def_property_ui_text(prop, "Samples", "Number of samples to test per face");
3931 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3932 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
3935 prop = RNA_def_property(srna, "distort_min", PROP_FLOAT, PROP_ANGLE);
3936 RNA_def_property_float_sdna(prop, NULL, "distort_min");
3937 RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
3938 RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 10, 3);
3939 RNA_def_property_ui_text(prop, "Distort Min", "Minimum angle to display");
3940 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3941 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
3943 prop = RNA_def_property(srna, "distort_max", PROP_FLOAT, PROP_ANGLE);
3944 RNA_def_property_float_sdna(prop, NULL, "distort_max");
3945 RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
3946 RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 10, 3);
3947 RNA_def_property_ui_text(prop, "Distort Max", "Maximum angle to display");
3948 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3949 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
3952 prop = RNA_def_property(srna, "sharp_min", PROP_FLOAT, PROP_ANGLE);
3953 RNA_def_property_float_sdna(prop, NULL, "sharp_min");
3954 RNA_def_property_range(prop, -DEG2RADF(180.0f), DEG2RADF(180.0f));
3955 RNA_def_property_ui_range(prop, -DEG2RADF(180.0f), DEG2RADF(180.0f), 10, 3);
3956 RNA_def_property_ui_text(prop, "Distort Min", "Minimum angle to display");
3957 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3958 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
3960 prop = RNA_def_property(srna, "sharp_max", PROP_FLOAT, PROP_ANGLE);
3961 RNA_def_property_float_sdna(prop, NULL, "sharp_max");
3962 RNA_def_property_range(prop, -DEG2RADF(180.0f), DEG2RADF(180.0f));
3963 RNA_def_property_ui_range(prop, -DEG2RADF(180.0f), DEG2RADF(180.0f), 10, 3);
3964 RNA_def_property_ui_text(prop, "Distort Max", "Maximum angle to display");
3965 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3966 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
3969 static void rna_def_unit_settings(BlenderRNA *brna)
3974 static const EnumPropertyItem unit_systems[] = {
3975 {USER_UNIT_NONE, "NONE", 0, "None", ""},
3976 {USER_UNIT_METRIC, "METRIC", 0, "Metric", ""},
3977 {USER_UNIT_IMPERIAL, "IMPERIAL", 0, "Imperial", ""},
3978 {0, NULL, 0, NULL, NULL},
3981 static const EnumPropertyItem rotation_units[] = {
3982 {0, "DEGREES", 0, "Degrees", "Use degrees for measuring angles and rotations"},
3983 {USER_UNIT_ROT_RADIANS, "RADIANS", 0, "Radians", ""},
3984 {0, NULL, 0, NULL, NULL},
3987 srna = RNA_def_struct(brna, "UnitSettings", NULL);
3988 RNA_def_struct_ui_text(srna, "Unit Settings", "");
3989 RNA_def_struct_nested(brna, srna, "Scene");
3990 RNA_def_struct_path_func(srna, "rna_UnitSettings_path");
3993 prop = RNA_def_property(srna, "system", PROP_ENUM, PROP_NONE);
3994 RNA_def_property_enum_items(prop, unit_systems);
3995 RNA_def_property_ui_text(
3996 prop, "Unit System", "The unit system to use for user interface controls");
3997 RNA_def_property_update(prop, NC_WINDOW, "rna_UnitSettings_system_update");
3999 prop = RNA_def_property(srna, "system_rotation", PROP_ENUM, PROP_NONE);
4000 RNA_def_property_enum_items(prop, rotation_units);
4001 RNA_def_property_ui_text(
4002 prop, "Rotation Units", "Unit to use for displaying/editing rotation values");
4003 RNA_def_property_update(prop, NC_WINDOW, NULL);
4005 prop = RNA_def_property(srna, "scale_length", PROP_FLOAT, PROP_UNSIGNED);
4006 RNA_def_property_ui_text(
4009 "Scale to use when converting between blender units and dimensions."
4010 " When working at microscopic or astronomical scale, a small or large unit scale"
4011 " respectively can be used to avoid numerical precision problems");
4012 RNA_def_property_range(prop, 1e-9f, 1e+9f);
4013 RNA_def_property_ui_range(prop, 0.001, 100.0, 0.1, 6);
4014 RNA_def_property_update(prop, NC_WINDOW, NULL);
4016 prop = RNA_def_property(srna, "use_separate", PROP_BOOLEAN, PROP_NONE);
4017 RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_UNIT_OPT_SPLIT);
4018 RNA_def_property_ui_text(prop, "Separate Units", "Display units in pairs (e.g. 1m 0cm)");
4019 RNA_def_property_update(prop, NC_WINDOW, NULL);
4021 prop = RNA_def_property(srna, "length_unit", PROP_ENUM, PROP_NONE);
4022 RNA_def_property_enum_items(prop, DummyRNA_DEFAULT_items);
4023 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_UnitSettings_length_unit_itemf");
4024 RNA_def_property_ui_text(prop, "Length Unit", "Unit that will be used to display length values");
4025 RNA_def_property_update(prop, NC_WINDOW, NULL);
4027 prop = RNA_def_property(srna, "mass_unit", PROP_ENUM, PROP_NONE);
4028 RNA_def_property_enum_items(prop, DummyRNA_DEFAULT_items);
4029 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_UnitSettings_mass_unit_itemf");
4030 RNA_def_property_ui_text(prop, "Mass Unit", "Unit that will be used to display mass values");
4031 RNA_def_property_update(prop, NC_WINDOW, NULL);
4033 prop = RNA_def_property(srna, "time_unit", PROP_ENUM, PROP_NONE);
4034 RNA_def_property_enum_items(prop, DummyRNA_DEFAULT_items);
4035 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_UnitSettings_time_unit_itemf");
4036 RNA_def_property_ui_text(prop, "Time Unit", "Unit that will be used to display time values");
4037 RNA_def_property_update(prop, NC_WINDOW, NULL);
4039 prop = RNA_def_property(srna, "temperature_unit", PROP_ENUM, PROP_NONE);
4040 RNA_def_property_enum_items(prop, DummyRNA_DEFAULT_items);
4041 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_UnitSettings_temperature_unit_itemf");
4042 RNA_def_property_ui_text(
4043 prop, "Temperature Unit", "Unit that will be used to display temperature values");
4044 RNA_def_property_update(prop, NC_WINDOW, NULL);
4047 static void rna_def_view_layer_eevee(BlenderRNA *brna)
4051 srna = RNA_def_struct(brna, "ViewLayerEEVEE", NULL);
4052 RNA_def_struct_ui_text(srna, "Eevee Settings", "View layer settings for Eevee");
4054 prop = RNA_def_property(srna, "use_pass_volume_direct", PROP_BOOLEAN, PROP_NONE);
4055 RNA_def_property_boolean_sdna(prop, NULL, "render_passes", EEVEE_RENDER_PASS_VOLUME_LIGHT);
4056 RNA_def_property_ui_text(prop, "Volume Light", "Deliver volume direct light pass");
4057 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
4059 prop = RNA_def_property(srna, "use_pass_bloom", PROP_BOOLEAN, PROP_NONE);
4060 RNA_def_property_boolean_sdna(prop, NULL, "render_passes", EEVEE_RENDER_PASS_BLOOM);
4061 RNA_def_property_ui_text(prop, "Bloom", "Deliver bloom pass");
4062 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
4065 static void rna_def_view_layer_aov(BlenderRNA *brna)
4069 srna = RNA_def_struct(brna, "AOV", NULL);
4070 RNA_def_struct_sdna(srna, "ViewLayerAOV");
4071 RNA_def_struct_ui_text(srna, "Shader AOV", "");
4073 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
4074 RNA_def_property_string_sdna(prop, NULL, "name");
4075 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
4076 RNA_def_property_ui_text(prop, "Name", "Name of the AOV");
4077 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
4078 RNA_def_struct_name_property(srna, prop);
4080 prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
4081 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", AOV_CONFLICT);
4082 RNA_def_property_ui_text(prop, "Valid", "Is the name of the AOV conflicting");
4084 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
4085 RNA_def_property_enum_sdna(prop, NULL, "type");
4086 RNA_def_property_enum_items(prop, rna_enum_view_layer_aov_type_items);
4087 RNA_def_property_enum_default(prop, AOV_TYPE_COLOR);
4088 RNA_def_property_ui_text(prop, "Type", "Data type of the AOV");
4089 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
4092 void rna_def_view_layer_common(StructRNA *srna, const bool scene)
4096 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
4098 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ViewLayer_name_set");
4101 RNA_def_property_string_sdna(prop, NULL, "name");
4103 RNA_def_property_ui_text(prop, "Name", "View layer name");
4104 RNA_def_struct_name_property(srna, prop);
4106 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
4109 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
4113 prop = RNA_def_property(srna, "material_override", PROP_POINTER, PROP_NONE);
4114 RNA_def_property_pointer_sdna(prop, NULL, "mat_override");
4115 RNA_def_property_struct_type(prop, "Material");
4116 RNA_def_property_flag(prop, PROP_EDITABLE);
4117 RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
4118 RNA_def_property_ui_text(
4119 prop, "Material Override", "Material to override all other materials in this view layer");
4120 RNA_def_property_update(
4121 prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_material_override_update");
4123 prop = RNA_def_property(srna, "samples", PROP_INT, PROP_UNSIGNED);
4124 RNA_def_property_ui_text(prop,
4126 "Override number of render samples for this view layer, "
4127 "0 will use the scene setting");
4128 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
4130 prop = RNA_def_property(srna, "pass_alpha_threshold", PROP_FLOAT, PROP_FACTOR);
4131 RNA_def_property_ui_text(
4134 "Z, Index, normal, UV and vector passes are only affected by surfaces with "
4135 "alpha transparency equal to or higher than this threshold");