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.
17 /** \file \ingroup RNA
22 #include "DNA_brush_types.h"
23 #include "DNA_collection_types.h"
24 #include "DNA_modifier_types.h"
25 #include "DNA_particle_types.h"
26 #include "DNA_rigidbody_types.h"
27 #include "DNA_scene_types.h"
28 #include "DNA_layer_types.h"
29 #include "DNA_linestyle_types.h"
30 #include "DNA_userdef_types.h"
31 #include "DNA_world_types.h"
32 #include "DNA_gpencil_types.h"
33 #include "DNA_view3d_types.h"
34 #include "DNA_screen_types.h" /* TransformOrientation */
36 #include "IMB_imbuf_types.h"
40 #include "BLT_translation.h"
42 #include "BKE_editmesh.h"
43 #include "BKE_paint.h"
45 #include "ED_object.h"
46 #include "ED_gpencil.h"
48 #include "GPU_extensions.h"
50 #include "DRW_engine.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 <libavcodec/avcodec.h>
64 # include <libavformat/avformat.h>
65 # include "ffmpeg_compat.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, "LAPLACIAN", 0, "Laplacian", "Use Laplacian method for relaxation"},
98 {UV_SCULPT_TOOL_RELAX_HC, "HC", 0, "HC", "Use HC method for relaxation"},
99 {0, NULL, 0, NULL, NULL},
103 const EnumPropertyItem rna_enum_uv_sculpt_tool_items[] = {
104 {UV_SCULPT_TOOL_PINCH, "PINCH", 0, "Pinch", "Pinch UVs"},
105 {UV_SCULPT_TOOL_RELAX, "RELAX", 0, "Relax", "Relax UVs"},
106 {UV_SCULPT_TOOL_GRAB, "GRAB", 0, "Grab", "Grab UVs"},
107 {0, NULL, 0, NULL, NULL},
111 const EnumPropertyItem rna_enum_snap_target_items[] = {
112 {SCE_SNAP_TARGET_CLOSEST, "CLOSEST", 0, "Closest", "Snap closest point onto target"},
113 {SCE_SNAP_TARGET_CENTER, "CENTER", 0, "Center", "Snap transformation center onto target"},
114 {SCE_SNAP_TARGET_MEDIAN, "MEDIAN", 0, "Median", "Snap median onto target"},
115 {SCE_SNAP_TARGET_ACTIVE, "ACTIVE", 0, "Active", "Snap active onto target"},
116 {0, NULL, 0, NULL, NULL},
119 const EnumPropertyItem rna_enum_proportional_falloff_items[] = {
120 {PROP_SMOOTH, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", "Smooth falloff"},
121 {PROP_SPHERE, "SPHERE", ICON_SPHERECURVE, "Sphere", "Spherical falloff"},
122 {PROP_ROOT, "ROOT", ICON_ROOTCURVE, "Root", "Root falloff"},
123 {PROP_INVSQUARE, "INVERSE_SQUARE", ICON_ROOTCURVE, "Inverse Square", "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},
143 const EnumPropertyItem rna_enum_proportional_editing_items[] = {
144 {PROP_EDIT_OFF, "DISABLED", ICON_PROP_OFF, "Disable", "Proportional Editing disabled"},
145 {PROP_EDIT_ON, "ENABLED", ICON_PROP_ON, "Enable", "Proportional Editing enabled"},
146 {PROP_EDIT_PROJECTED, "PROJECTED", ICON_PROP_ON, "Projected (2D)",
147 "Proportional Editing using screen space locations"},
148 {PROP_EDIT_CONNECTED, "CONNECTED", ICON_PROP_CON, "Connected",
149 "Proportional Editing using connected geometry only"},
150 {0, NULL, 0, NULL, NULL},
153 /* keep for operators, not used here */
154 const EnumPropertyItem rna_enum_mesh_select_mode_items[] = {
155 {SCE_SELECT_VERTEX, "VERTEX", ICON_VERTEXSEL, "Vertex", "Vertex selection mode"},
156 {SCE_SELECT_EDGE, "EDGE", ICON_EDGESEL, "Edge", "Edge selection mode"},
157 {SCE_SELECT_FACE, "FACE", ICON_FACESEL, "Face", "Face selection mode"},
158 {0, NULL, 0, NULL, NULL},
161 const EnumPropertyItem rna_enum_mesh_select_mode_uv_items[] = {
162 {UV_SELECT_VERTEX, "VERTEX", ICON_UV_VERTEXSEL, "Vertex", "Vertex selection mode"},
163 {UV_SELECT_EDGE, "EDGE", ICON_UV_EDGESEL, "Edge", "Edge selection mode"},
164 {UV_SELECT_FACE, "FACE", ICON_UV_FACESEL, "Face", "Face selection mode"},
165 {UV_SELECT_ISLAND, "ISLAND", ICON_UV_ISLANDSEL, "Island", "Island selection mode"},
166 {0, NULL, 0, NULL, NULL},
169 const EnumPropertyItem rna_enum_snap_element_items[] = {
170 {SCE_SNAP_MODE_INCREMENT, "INCREMENT", ICON_SNAP_INCREMENT, "Increment", "Snap to increments of grid"},
171 {SCE_SNAP_MODE_VERTEX, "VERTEX", ICON_SNAP_VERTEX, "Vertex", "Snap to vertices"},
172 {SCE_SNAP_MODE_EDGE, "EDGE", ICON_SNAP_EDGE, "Edge", "Snap to edges"},
173 {SCE_SNAP_MODE_FACE, "FACE", ICON_SNAP_FACE, "Face", "Snap to faces"},
174 {SCE_SNAP_MODE_VOLUME, "VOLUME", ICON_SNAP_VOLUME, "Volume", "Snap to volume"},
175 {0, NULL, 0, NULL, NULL},
178 const EnumPropertyItem rna_enum_snap_node_element_items[] = {
179 {SCE_SNAP_MODE_GRID, "GRID", ICON_SNAP_GRID, "Grid", "Snap to grid"},
180 {SCE_SNAP_MODE_NODE_X, "NODE_X", ICON_NODE_SIDE, "Node X", "Snap to left/right node border"},
181 {SCE_SNAP_MODE_NODE_Y, "NODE_Y", ICON_NODE_TOP, "Node Y", "Snap to top/bottom node border"},
182 {SCE_SNAP_MODE_NODE_X | SCE_SNAP_MODE_NODE_Y, "NODE_XY", ICON_NODE_CORNER, "Node X / Y", "Snap to any node border"},
183 {0, NULL, 0, NULL, NULL},
187 static const EnumPropertyItem snap_uv_element_items[] = {
188 {SCE_SNAP_MODE_INCREMENT, "INCREMENT", ICON_SNAP_INCREMENT, "Increment", "Snap to increments of grid"},
189 {SCE_SNAP_MODE_VERTEX, "VERTEX", ICON_SNAP_VERTEX, "Vertex", "Snap to vertices"},
190 {0, NULL, 0, NULL, NULL},
194 const EnumPropertyItem rna_enum_curve_fit_method_items[] = {
195 {CURVE_PAINT_FIT_METHOD_REFIT, "REFIT", 0, "Refit", "Incrementally re-fit the curve (high quality)"},
196 {CURVE_PAINT_FIT_METHOD_SPLIT, "SPLIT", 0, "Split", "Split the curve until the tolerance is met (fast)"},
197 {0, NULL, 0, NULL, NULL},
200 /* workaround for duplicate enums,
201 * have each enum line as a define then conditionally set it or not
204 #define R_IMF_ENUM_BMP {R_IMF_IMTYPE_BMP, "BMP", ICON_FILE_IMAGE, "BMP", "Output image in bitmap format"},
205 #define R_IMF_ENUM_IRIS {R_IMF_IMTYPE_IRIS, "IRIS", ICON_FILE_IMAGE, "Iris", \
206 "Output image in (old!) SGI IRIS format"},
207 #define R_IMF_ENUM_PNG {R_IMF_IMTYPE_PNG, "PNG", ICON_FILE_IMAGE, "PNG", "Output image in PNG format"},
208 #define R_IMF_ENUM_JPEG {R_IMF_IMTYPE_JPEG90, "JPEG", ICON_FILE_IMAGE, "JPEG", "Output image in JPEG format"},
209 #define R_IMF_ENUM_TAGA {R_IMF_IMTYPE_TARGA, "TARGA", ICON_FILE_IMAGE, "Targa", "Output image in Targa format"},
210 #define R_IMF_ENUM_TAGA_RAW {R_IMF_IMTYPE_RAWTGA, "TARGA_RAW", ICON_FILE_IMAGE, "Targa Raw", \
211 "Output image in uncompressed Targa format"},
213 #if 0 /* UNUSED (so far) */
215 # define R_IMF_ENUM_DDS {R_IMF_IMTYPE_DDS, "DDS", ICON_FILE_IMAGE, "DDS", "Output image in DDS format"},
217 # define R_IMF_ENUM_DDS
222 # define R_IMF_ENUM_JPEG2K {R_IMF_IMTYPE_JP2, "JPEG2000", ICON_FILE_IMAGE, "JPEG 2000", \
223 "Output image in JPEG 2000 format"},
225 # define R_IMF_ENUM_JPEG2K
229 # define R_IMF_ENUM_CINEON {R_IMF_IMTYPE_CINEON, "CINEON", ICON_FILE_IMAGE, "Cineon", \
230 "Output image in Cineon format"},
231 # define R_IMF_ENUM_DPX {R_IMF_IMTYPE_DPX, "DPX", ICON_FILE_IMAGE, "DPX", "Output image in DPX format"},
233 # define R_IMF_ENUM_CINEON
234 # define R_IMF_ENUM_DPX
238 # define R_IMF_ENUM_EXR_MULTILAYER {R_IMF_IMTYPE_MULTILAYER, "OPEN_EXR_MULTILAYER", ICON_FILE_IMAGE, \
239 "OpenEXR MultiLayer", \
240 "Output image in multilayer OpenEXR format"},
241 # define R_IMF_ENUM_EXR {R_IMF_IMTYPE_OPENEXR, "OPEN_EXR", ICON_FILE_IMAGE, "OpenEXR", \
242 "Output image in OpenEXR format"},
244 # define R_IMF_ENUM_EXR_MULTILAYER
245 # define R_IMF_ENUM_EXR
249 # define R_IMF_ENUM_HDR {R_IMF_IMTYPE_RADHDR, "HDR", ICON_FILE_IMAGE, "Radiance HDR", \
250 "Output image in Radiance HDR format"},
252 # define R_IMF_ENUM_HDR
256 # define R_IMF_ENUM_TIFF {R_IMF_IMTYPE_TIFF, "TIFF", ICON_FILE_IMAGE, "TIFF", "Output image in TIFF format"},
258 # define R_IMF_ENUM_TIFF
261 #define IMAGE_TYPE_ITEMS_IMAGE_ONLY \
263 /* DDS save not supported yet R_IMF_ENUM_DDS */ \
269 R_IMF_ENUM_TAGA_RAW \
270 {0, "", 0, " ", NULL}, \
273 R_IMF_ENUM_EXR_MULTILAYER \
280 static const EnumPropertyItem image_only_type_items[] = {
282 IMAGE_TYPE_ITEMS_IMAGE_ONLY
284 {0, NULL, 0, NULL, NULL},
288 const EnumPropertyItem rna_enum_image_type_items[] = {
289 {0, "", 0, N_("Image"), NULL},
291 IMAGE_TYPE_ITEMS_IMAGE_ONLY
293 {0, "", 0, N_("Movie"), NULL},
294 {R_IMF_IMTYPE_AVIJPEG, "AVI_JPEG", ICON_FILE_MOVIE, "AVI JPEG", "Output video in AVI JPEG format"},
295 {R_IMF_IMTYPE_AVIRAW, "AVI_RAW", ICON_FILE_MOVIE, "AVI Raw", "Output video in AVI Raw format"},
297 {R_IMF_IMTYPE_FFMPEG, "FFMPEG", ICON_FILE_MOVIE, "FFmpeg video", "The most versatile way to output video files"},
299 {0, NULL, 0, NULL, NULL},
302 const EnumPropertyItem rna_enum_image_color_mode_items[] = {
303 {R_IMF_PLANES_BW, "BW", 0, "BW", "Images get saved in 8 bits grayscale (only PNG, JPEG, TGA, TIF)"},
304 {R_IMF_PLANES_RGB, "RGB", 0, "RGB", "Images are saved with RGB (color) data"},
305 {R_IMF_PLANES_RGBA, "RGBA", 0, "RGBA", "Images are saved with RGB and Alpha data (if supported)"},
306 {0, NULL, 0, NULL, NULL},
310 #define IMAGE_COLOR_MODE_BW rna_enum_image_color_mode_items[0]
311 #define IMAGE_COLOR_MODE_RGB rna_enum_image_color_mode_items[1]
312 #define IMAGE_COLOR_MODE_RGBA rna_enum_image_color_mode_items[2]
315 const EnumPropertyItem rna_enum_image_color_depth_items[] = {
316 /* 1 (monochrome) not used */
317 {R_IMF_CHAN_DEPTH_8, "8", 0, "8", "8 bit color channels"},
318 {R_IMF_CHAN_DEPTH_10, "10", 0, "10", "10 bit color channels"},
319 {R_IMF_CHAN_DEPTH_12, "12", 0, "12", "12 bit color channels"},
320 {R_IMF_CHAN_DEPTH_16, "16", 0, "16", "16 bit color channels"},
322 {R_IMF_CHAN_DEPTH_32, "32", 0, "32", "32 bit color channels"},
323 {0, NULL, 0, NULL, NULL},
326 const EnumPropertyItem rna_enum_normal_space_items[] = {
327 {R_BAKE_SPACE_OBJECT, "OBJECT", 0, "Object", "Bake the normals in object space"},
328 {R_BAKE_SPACE_TANGENT, "TANGENT", 0, "Tangent", "Bake the normals in tangent space"},
329 {0, NULL, 0, NULL, NULL},
332 const EnumPropertyItem rna_enum_normal_swizzle_items[] = {
333 {R_BAKE_POSX, "POS_X", 0, "+X", ""},
334 {R_BAKE_POSY, "POS_Y", 0, "+Y", ""},
335 {R_BAKE_POSZ, "POS_Z", 0, "+Z", ""},
336 {R_BAKE_NEGX, "NEG_X", 0, "-X", ""},
337 {R_BAKE_NEGY, "NEG_Y", 0, "-Y", ""},
338 {R_BAKE_NEGZ, "NEG_Z", 0, "-Z", ""},
339 {0, NULL, 0, NULL, NULL},
342 const EnumPropertyItem rna_enum_bake_save_mode_items[] = {
343 {R_BAKE_SAVE_INTERNAL, "INTERNAL", 0, "Internal", "Save the baking map in an internal image data-block"},
344 {R_BAKE_SAVE_EXTERNAL, "EXTERNAL", 0, "External", "Save the baking map in an external file"},
345 {0, NULL, 0, NULL, NULL},
348 #define R_IMF_VIEWS_ENUM_IND {R_IMF_VIEWS_INDIVIDUAL, "INDIVIDUAL", 0, "Individual", \
349 "Individual files for each view with the prefix as defined by the scene views"},
350 #define R_IMF_VIEWS_ENUM_S3D {R_IMF_VIEWS_STEREO_3D, "STEREO_3D", 0, "Stereo 3D", \
351 "Single file with an encoded stereo pair"},
352 #define R_IMF_VIEWS_ENUM_MV {R_IMF_VIEWS_MULTIVIEW, "MULTIVIEW", 0, "Multi-View", "Single file with all the views"},
354 const EnumPropertyItem rna_enum_views_format_items[] = {
357 {0, NULL, 0, NULL, NULL},
360 const EnumPropertyItem rna_enum_views_format_multilayer_items[] = {
363 {0, NULL, 0, NULL, NULL},
366 const EnumPropertyItem rna_enum_views_format_multiview_items[] = {
370 {0, NULL, 0, NULL, NULL},
373 #undef R_IMF_VIEWS_ENUM_IND
374 #undef R_IMF_VIEWS_ENUM_S3D
375 #undef R_IMF_VIEWS_ENUM_MV
377 const EnumPropertyItem rna_enum_stereo3d_display_items[] = {
378 {S3D_DISPLAY_ANAGLYPH, "ANAGLYPH", 0, "Anaglyph",
379 "Render views for left and right eyes as two differently filtered colors in a single image "
380 "(anaglyph glasses are required)"},
381 {S3D_DISPLAY_INTERLACE, "INTERLACE", 0, "Interlace",
382 "Render views for left and right eyes interlaced in a single image (3D-ready monitor is required)"},
383 {S3D_DISPLAY_PAGEFLIP, "TIMESEQUENTIAL", 0, "Time Sequential",
384 "Render alternate eyes (also known as page flip, quad buffer support in the graphic card is required)"},
385 {S3D_DISPLAY_SIDEBYSIDE, "SIDEBYSIDE", 0, "Side-by-Side", "Render views for left and right eyes side-by-side"},
386 {S3D_DISPLAY_TOPBOTTOM, "TOPBOTTOM", 0, "Top-Bottom", "Render views for left and right eyes one above another"},
387 {0, NULL, 0, NULL, NULL},
390 const EnumPropertyItem rna_enum_stereo3d_anaglyph_type_items[] = {
391 {S3D_ANAGLYPH_REDCYAN, "RED_CYAN", 0, "Red-Cyan", ""},
392 {S3D_ANAGLYPH_GREENMAGENTA, "GREEN_MAGENTA", 0, "Green-Magenta", ""},
393 {S3D_ANAGLYPH_YELLOWBLUE, "YELLOW_BLUE", 0, "Yellow-Blue", ""},
394 {0, NULL, 0, NULL, NULL},
397 const EnumPropertyItem rna_enum_stereo3d_interlace_type_items[] = {
398 {S3D_INTERLACE_ROW, "ROW_INTERLEAVED", 0, "Row Interleaved", ""},
399 {S3D_INTERLACE_COLUMN, "COLUMN_INTERLEAVED", 0, "Column Interleaved", ""},
400 {S3D_INTERLACE_CHECKERBOARD, "CHECKERBOARD_INTERLEAVED", 0, "Checkerboard Interleaved", ""},
401 {0, NULL, 0, NULL, NULL},
404 const EnumPropertyItem rna_enum_bake_pass_filter_type_items[] = {
405 {R_BAKE_PASS_FILTER_NONE, "NONE", 0, "None", ""},
406 {R_BAKE_PASS_FILTER_AO, "AO", 0, "Ambient Occlusion", ""},
407 {R_BAKE_PASS_FILTER_EMIT, "EMIT", 0, "Emit", ""},
408 {R_BAKE_PASS_FILTER_DIRECT, "DIRECT", 0, "Direct", ""},
409 {R_BAKE_PASS_FILTER_INDIRECT, "INDIRECT", 0, "Indirect", ""},
410 {R_BAKE_PASS_FILTER_COLOR, "COLOR", 0, "Color", ""},
411 {R_BAKE_PASS_FILTER_DIFFUSE, "DIFFUSE", 0, "Diffuse", ""},
412 {R_BAKE_PASS_FILTER_GLOSSY, "GLOSSY", 0, "Glossy", ""},
413 {R_BAKE_PASS_FILTER_TRANSM, "TRANSMISSION", 0, "Transmission", ""},
414 {R_BAKE_PASS_FILTER_SUBSURFACE, "SUBSURFACE", 0, "Subsurface", ""},
415 {0, NULL, 0, NULL, NULL},
418 static const EnumPropertyItem rna_enum_gizmo_items[] = {
419 {SCE_GIZMO_SHOW_TRANSLATE, "TRANSLATE", 0, "Move", ""},
420 {SCE_GIZMO_SHOW_ROTATE, "ROTATE", 0, "Rotate", ""},
421 {SCE_GIZMO_SHOW_SCALE, "SCALE", 0, "Scale", ""},
422 {0, NULL, 0, NULL, NULL},
426 static const EnumPropertyItem rna_enum_gpencil_interpolation_mode_items[] = {
428 {0, "", 0, N_("Interpolation"), "Standard transitions between keyframes"},
429 {GP_IPO_LINEAR, "LINEAR", ICON_IPO_LINEAR, "Linear", "Straight-line interpolation between A and B (i.e. no ease in/out)"},
430 {GP_IPO_CURVEMAP, "CUSTOM", ICON_IPO_BEZIER, "Custom", "Custom interpolation defined using a curve map"},
433 {0, "", 0, N_("Easing (by strength)"), "Predefined inertial transitions, useful for motion graphics (from least to most ''dramatic'')"},
434 {GP_IPO_SINE, "SINE", ICON_IPO_SINE, "Sinusoidal", "Sinusoidal easing (weakest, almost linear but with a slight curvature)"},
435 {GP_IPO_QUAD, "QUAD", ICON_IPO_QUAD, "Quadratic", "Quadratic easing"},
436 {GP_IPO_CUBIC, "CUBIC", ICON_IPO_CUBIC, "Cubic", "Cubic easing"},
437 {GP_IPO_QUART, "QUART", ICON_IPO_QUART, "Quartic", "Quartic easing"},
438 {GP_IPO_QUINT, "QUINT", ICON_IPO_QUINT, "Quintic", "Quintic easing"},
439 {GP_IPO_EXPO, "EXPO", ICON_IPO_EXPO, "Exponential", "Exponential easing (dramatic)"},
440 {GP_IPO_CIRC, "CIRC", ICON_IPO_CIRC, "Circular", "Circular easing (strongest and most dynamic)"},
442 {0, "", 0, N_("Dynamic Effects"), "Simple physics-inspired easing effects"},
443 {GP_IPO_BACK, "BACK", ICON_IPO_BACK, "Back", "Cubic easing with overshoot and settle"},
444 {GP_IPO_BOUNCE, "BOUNCE", ICON_IPO_BOUNCE, "Bounce", "Exponentially decaying parabolic bounce, like when objects collide"},
445 {GP_IPO_ELASTIC, "ELASTIC", ICON_IPO_ELASTIC, "Elastic", "Exponentially decaying sine wave, like an elastic band"},
447 {0, NULL, 0, NULL, NULL},
452 const EnumPropertyItem rna_enum_transform_pivot_items_full[] = {
453 {V3D_AROUND_CENTER_BOUNDS, "BOUNDING_BOX_CENTER", ICON_PIVOT_BOUNDBOX, "Bounding Box Center",
454 "Pivot around bounding box center of selected object(s)"},
455 {V3D_AROUND_CURSOR, "CURSOR", ICON_PIVOT_CURSOR, "3D Cursor", "Pivot around the 3D cursor"},
456 {V3D_AROUND_LOCAL_ORIGINS, "INDIVIDUAL_ORIGINS", ICON_PIVOT_INDIVIDUAL,
457 "Individual Origins", "Pivot around each object's own origin"},
458 {V3D_AROUND_CENTER_MEDIAN, "MEDIAN_POINT", ICON_PIVOT_MEDIAN, "Median Point",
459 "Pivot around the median point of selected objects"},
460 {V3D_AROUND_ACTIVE, "ACTIVE_ELEMENT", ICON_PIVOT_ACTIVE, "Active Element", "Pivot around active object"},
461 {0, NULL, 0, NULL, NULL},
464 /* Icons could be made a consistent set of images. */
465 const EnumPropertyItem rna_enum_transform_orientation_items[] = {
466 {V3D_ORIENT_GLOBAL, "GLOBAL", ICON_ORIENTATION_GLOBAL, "Global", "Align the transformation axes to world space"},
467 {V3D_ORIENT_LOCAL, "LOCAL", ICON_ORIENTATION_LOCAL, "Local", "Align the transformation axes to the selected objects' local space"},
468 {V3D_ORIENT_NORMAL, "NORMAL", ICON_ORIENTATION_NORMAL, "Normal",
469 "Align the transformation axes to average normal of selected elements "
470 "(bone Y axis for pose mode)"},
471 {V3D_ORIENT_GIMBAL, "GIMBAL", ICON_ORIENTATION_GIMBAL, "Gimbal", "Align each axis to the Euler rotation axis as used for input"},
472 {V3D_ORIENT_VIEW, "VIEW", ICON_ORIENTATION_VIEW, "View", "Align the transformation axes to the window"},
473 {V3D_ORIENT_CURSOR, "CURSOR", ICON_PIVOT_CURSOR, "Cursor", "Align the transformation axes to the 3D cursor"},
474 // {V3D_ORIENT_CUSTOM, "CUSTOM", 0, "Custom", "Use a custom transform orientation"},
475 {0, NULL, 0, NULL, NULL},
480 #include "BLI_string_utils.h"
482 #include "DNA_anim_types.h"
483 #include "DNA_color_types.h"
484 #include "DNA_node_types.h"
485 #include "DNA_object_types.h"
486 #include "DNA_mesh_types.h"
487 #include "DNA_text_types.h"
488 #include "DNA_workspace_types.h"
490 #include "RNA_access.h"
492 #include "MEM_guardedalloc.h"
494 #include "BKE_brush.h"
495 #include "BKE_collection.h"
496 #include "BKE_colortools.h"
497 #include "BKE_context.h"
498 #include "BKE_global.h"
499 #include "BKE_idprop.h"
500 #include "BKE_image.h"
501 #include "BKE_layer.h"
502 #include "BKE_main.h"
503 #include "BKE_node.h"
504 #include "BKE_pointcache.h"
505 #include "BKE_scene.h"
506 #include "BKE_mesh.h"
507 #include "BKE_sound.h"
508 #include "BKE_screen.h"
509 #include "BKE_sequencer.h"
510 #include "BKE_animsys.h"
511 #include "BKE_freestyle.h"
512 #include "BKE_gpencil.h"
513 #include "BKE_unit.h"
517 #include "ED_view3d.h"
519 #include "ED_keyframing.h"
520 #include "ED_image.h"
521 #include "ED_scene.h"
523 #include "DEG_depsgraph_build.h"
524 #include "DEG_depsgraph_query.h"
526 #ifdef WITH_FREESTYLE
527 #include "FRS_freestyle.h"
530 static void rna_ToolSettings_snap_mode_set(struct PointerRNA *ptr, int value)
532 ToolSettings *ts = (ToolSettings *)ptr->data;
534 ts->snap_mode = value;
538 /* Grease Pencil update cache */
539 static void rna_GPencil_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
541 /* mark all grease pencil datablocks of the scene */
542 FOREACH_SCENE_COLLECTION_BEGIN(scene, collection)
544 FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(collection, ob)
546 if (ob->type == OB_GPENCIL) {
547 bGPdata *gpd = (bGPdata *)ob->data;
548 gpd->flag |= GP_DATA_CACHE_IS_DIRTY;
549 DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
552 FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
554 FOREACH_SCENE_COLLECTION_END;
556 WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
559 /* Grease Pencil Interpolation settings */
560 static char *rna_GPencilInterpolateSettings_path(PointerRNA *UNUSED(ptr))
562 return BLI_strdup("tool_settings.gpencil_interpolate");
565 static void rna_GPencilInterpolateSettings_type_set(PointerRNA *ptr, int value)
567 GP_Interpolate_Settings *settings = (GP_Interpolate_Settings *)ptr->data;
569 /* NOTE: This cast should be fine, as we have a small + finite set of values (eGP_Interpolate_Type)
570 * that should fit well within a char
572 settings->type = (char)value;
574 /* init custom interpolation curve here now the first time it's used */
575 if ((settings->type == GP_IPO_CURVEMAP) &&
576 (settings->custom_ipo == NULL))
578 settings->custom_ipo = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
582 static void rna_ToolSettings_gizmo_flag_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
584 ToolSettings *ts = scene->toolsettings;
585 if ((ts->gizmo_flag & (SCE_GIZMO_SHOW_TRANSLATE | SCE_GIZMO_SHOW_ROTATE | SCE_GIZMO_SHOW_SCALE)) == 0) {
586 ts->gizmo_flag |= SCE_GIZMO_SHOW_TRANSLATE;
590 static void rna_SpaceImageEditor_uv_sculpt_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr))
592 ED_space_image_uv_sculpt_update(bmain, bmain->wm.first, scene);
596 /* Read-only Iterator of all the scene objects. */
598 static void rna_Scene_objects_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
600 Scene *scene = (Scene *)ptr->data;
601 iter->internal.custom = MEM_callocN(sizeof(BLI_Iterator), __func__);
603 ((BLI_Iterator *)iter->internal.custom)->valid = true;
604 BKE_scene_objects_iterator_begin(iter->internal.custom, (void *)scene);
605 iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid;
608 static void rna_Scene_objects_next(CollectionPropertyIterator *iter)
610 BKE_scene_objects_iterator_next(iter->internal.custom);
611 iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid;
614 static void rna_Scene_objects_end(CollectionPropertyIterator *iter)
616 BKE_scene_objects_iterator_end(iter->internal.custom);
617 MEM_freeN(iter->internal.custom);
620 static PointerRNA rna_Scene_objects_get(CollectionPropertyIterator *iter)
622 Object *ob = ((BLI_Iterator *)iter->internal.custom)->current;
623 return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, ob);
626 /* End of read-only Iterator of all the scene objects. */
628 static void rna_Scene_set_set(PointerRNA *ptr, PointerRNA value)
630 Scene *scene = (Scene *)ptr->data;
631 Scene *set = (Scene *)value.data;
634 for (nested_set = set; nested_set; nested_set = nested_set->set) {
635 if (nested_set == scene)
637 /* prevent eternal loops, set can point to next, and next to set, without problems usually */
638 if (nested_set->set == set)
642 id_lib_extern((ID *)set);
646 void rna_Scene_set_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
648 Scene *scene = (Scene *)ptr->id.data;
650 DEG_relations_tag_update(bmain);
651 DEG_id_tag_update_ex(bmain, &scene->id, 0);
652 if (scene->set != NULL) {
653 /* Objects which are pulled into main scene's depsgraph needs to have
654 * their base flags updated.
656 DEG_id_tag_update_ex(bmain, &scene->set->id, 0);
660 static void rna_Scene_view3d_update(Main *bmain, Scene *UNUSED(scene_unused), PointerRNA *ptr)
662 wmWindowManager *wm = bmain->wm.first;
663 Scene *scene = (Scene *)ptr->data;
665 WM_windows_scene_data_sync(&wm->windows, scene);
668 static void rna_Scene_fps_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
670 BKE_sound_update_fps(scene);
671 BKE_sequencer_update_sound_bounds_all(scene);
674 static void rna_Scene_listener_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
676 BKE_sound_update_scene_listener(scene);
679 static void rna_Scene_volume_set(PointerRNA *ptr, float value)
681 Scene *scene = (Scene *)(ptr->data);
683 scene->audio.volume = value;
684 if (scene->sound_scene)
685 BKE_sound_set_scene_volume(scene, value);
688 static const char *rna_Scene_statistics_string_get(Scene *scene, Main *bmain, ViewLayer *view_layer)
690 return ED_info_stats_string(bmain, scene, view_layer);
693 static void rna_Scene_framelen_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
695 scene->r.framelen = (float)scene->r.framapto / (float)scene->r.images;
699 static void rna_Scene_frame_current_set(PointerRNA *ptr, int value)
701 Scene *data = (Scene *)ptr->data;
703 /* if negative frames aren't allowed, then we can't use them */
704 FRAMENUMBER_MIN_CLAMP(value);
705 data->r.cfra = value;
708 static float rna_Scene_frame_float_get(PointerRNA *ptr)
710 Scene *data = (Scene *)ptr->data;
711 return (float)data->r.cfra + data->r.subframe;
714 static void rna_Scene_frame_float_set(PointerRNA *ptr, float value)
716 Scene *data = (Scene *)ptr->data;
717 /* if negative frames aren't allowed, then we can't use them */
718 FRAMENUMBER_MIN_CLAMP(value);
719 data->r.cfra = (int)value;
720 data->r.subframe = value - data->r.cfra;
723 static float rna_Scene_frame_current_final_get(PointerRNA *ptr)
725 Scene *scene = (Scene *)ptr->data;
727 return BKE_scene_frame_get_from_ctime(scene, (float)scene->r.cfra);
730 static void rna_Scene_start_frame_set(PointerRNA *ptr, int value)
732 Scene *data = (Scene *)ptr->data;
733 /* MINFRAME not MINAFRAME, since some output formats can't taken negative frames */
734 CLAMP(value, MINFRAME, MAXFRAME);
735 data->r.sfra = value;
737 if (data->r.sfra >= data->r.efra) {
738 data->r.efra = MIN2(data->r.sfra, MAXFRAME);
742 static void rna_Scene_end_frame_set(PointerRNA *ptr, int value)
744 Scene *data = (Scene *)ptr->data;
745 CLAMP(value, MINFRAME, MAXFRAME);
746 data->r.efra = value;
748 if (data->r.sfra >= data->r.efra) {
749 data->r.sfra = MAX2(data->r.efra, MINFRAME);
753 static void rna_Scene_use_preview_range_set(PointerRNA *ptr, bool value)
755 Scene *data = (Scene *)ptr->data;
758 /* copy range from scene if not set before */
759 if ((data->r.psfra == data->r.pefra) && (data->r.psfra == 0)) {
760 data->r.psfra = data->r.sfra;
761 data->r.pefra = data->r.efra;
764 data->r.flag |= SCER_PRV_RANGE;
767 data->r.flag &= ~SCER_PRV_RANGE;
771 static void rna_Scene_preview_range_start_frame_set(PointerRNA *ptr, int value)
773 Scene *data = (Scene *)ptr->data;
775 /* check if enabled already */
776 if ((data->r.flag & SCER_PRV_RANGE) == 0) {
777 /* set end of preview range to end frame, then clamp as per normal */
778 /* TODO: or just refuse to set instead? */
779 data->r.pefra = data->r.efra;
782 /* now set normally */
783 CLAMP(value, MINAFRAME, data->r.pefra);
784 data->r.psfra = value;
787 static void rna_Scene_preview_range_end_frame_set(PointerRNA *ptr, int value)
789 Scene *data = (Scene *)ptr->data;
791 /* check if enabled already */
792 if ((data->r.flag & SCER_PRV_RANGE) == 0) {
793 /* set start of preview range to start frame, then clamp as per normal */
794 /* TODO: or just refuse to set instead? */
795 data->r.psfra = data->r.sfra;
798 /* now set normally */
799 CLAMP(value, data->r.psfra, MAXFRAME);
800 data->r.pefra = value;
803 static void rna_Scene_show_subframe_update(Main *UNUSED(bmain), Scene *UNUSED(current_scene), PointerRNA *ptr)
805 Scene *scene = (Scene *)ptr->id.data;
806 scene->r.subframe = 0.0f;
809 static void rna_Scene_frame_update(Main *bmain, Scene *UNUSED(current_scene), PointerRNA *ptr)
811 Scene *scene = (Scene *)ptr->id.data;
812 BKE_sound_seek_scene(bmain, scene);
813 WM_main_add_notifier(NC_SCENE | ND_FRAME, scene);
816 static PointerRNA rna_Scene_active_keying_set_get(PointerRNA *ptr)
818 Scene *scene = (Scene *)ptr->data;
819 return rna_pointer_inherit_refine(ptr, &RNA_KeyingSet, ANIM_scene_get_active_keyingset(scene));
822 static void rna_Scene_active_keying_set_set(PointerRNA *ptr, PointerRNA value)
824 Scene *scene = (Scene *)ptr->data;
825 KeyingSet *ks = (KeyingSet *)value.data;
827 scene->active_keyingset = ANIM_scene_get_keyingset_index(scene, ks);
830 /* get KeyingSet index stuff for list of Keying Sets editing UI
831 * - active_keyingset-1 since 0 is reserved for 'none'
832 * - don't clamp, otherwise can never set builtins types as active...
834 static int rna_Scene_active_keying_set_index_get(PointerRNA *ptr)
836 Scene *scene = (Scene *)ptr->data;
837 return scene->active_keyingset - 1;
840 /* get KeyingSet index stuff for list of Keying Sets editing UI
841 * - value+1 since 0 is reserved for 'none'
843 static void rna_Scene_active_keying_set_index_set(PointerRNA *ptr, int value)
845 Scene *scene = (Scene *)ptr->data;
846 scene->active_keyingset = value + 1;
849 /* XXX: evil... builtin_keyingsets is defined in keyingsets.c! */
850 /* TODO: make API function to retrieve this... */
851 extern ListBase builtin_keyingsets;
853 static void rna_Scene_all_keyingsets_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
855 Scene *scene = (Scene *)ptr->data;
857 /* start going over the scene KeyingSets first, while we still have pointer to it
858 * but only if we have any Keying Sets to use...
860 if (scene->keyingsets.first)
861 rna_iterator_listbase_begin(iter, &scene->keyingsets, NULL);
863 rna_iterator_listbase_begin(iter, &builtin_keyingsets, NULL);
866 static void rna_Scene_all_keyingsets_next(CollectionPropertyIterator *iter)
868 ListBaseIterator *internal = &iter->internal.listbase;
869 KeyingSet *ks = (KeyingSet *)internal->link;
871 /* if we've run out of links in Scene list, jump over to the builtins list unless we're there already */
872 if ((ks->next == NULL) && (ks != builtin_keyingsets.last))
873 internal->link = (Link *)builtin_keyingsets.first;
875 internal->link = (Link *)ks->next;
877 iter->valid = (internal->link != NULL);
880 static char *rna_SceneEEVEE_path(PointerRNA *UNUSED(ptr))
882 return BLI_strdup("eevee");
885 static int rna_RenderSettings_stereoViews_skip(CollectionPropertyIterator *iter, void *UNUSED(data))
887 ListBaseIterator *internal = &iter->internal.listbase;
888 SceneRenderView *srv = (SceneRenderView *)internal->link;
890 if ((STREQ(srv->name, STEREO_LEFT_NAME)) ||
891 (STREQ(srv->name, STEREO_RIGHT_NAME)))
899 static void rna_RenderSettings_stereoViews_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
901 RenderData *rd = (RenderData *)ptr->data;
902 rna_iterator_listbase_begin(iter, &rd->views, rna_RenderSettings_stereoViews_skip);
905 static char *rna_RenderSettings_path(PointerRNA *UNUSED(ptr))
907 return BLI_sprintfN("render");
910 static char *rna_BakeSettings_path(PointerRNA *UNUSED(ptr))
912 return BLI_sprintfN("render.bake");
915 static char *rna_ImageFormatSettings_path(PointerRNA *ptr)
917 ImageFormatData *imf = (ImageFormatData *)ptr->data;
918 ID *id = ptr->id.data;
920 switch (GS(id->name)) {
923 Scene *scene = (Scene *)id;
925 if (&scene->r.im_format == imf) {
926 return BLI_sprintfN("render.image_settings");
928 else if (&scene->r.bake.im_format == imf) {
929 return BLI_sprintfN("render.bake.image_settings");
931 return BLI_sprintfN("..");
935 bNodeTree *ntree = (bNodeTree *)id;
938 for (node = ntree->nodes.first; node; node = node->next) {
939 if (node->type == CMP_NODE_OUTPUT_FILE) {
940 if (&((NodeImageMultiFile *)node->storage)->format == imf) {
941 return BLI_sprintfN("nodes['%s'].format", node->name);
946 for (sock = node->inputs.first; sock; sock = sock->next) {
947 NodeImageMultiFileSocket *sockdata = sock->storage;
948 if (&sockdata->format == imf) {
949 return BLI_sprintfN("nodes['%s'].file_slots['%s'].format", node->name, sockdata->path);
955 return BLI_sprintfN("..");
958 return BLI_sprintfN("..");
962 static int rna_RenderSettings_threads_get(PointerRNA *ptr)
964 RenderData *rd = (RenderData *)ptr->data;
965 return BKE_render_num_threads(rd);
968 static int rna_RenderSettings_threads_mode_get(PointerRNA *ptr)
970 RenderData *rd = (RenderData *)ptr->data;
971 int override = BLI_system_num_threads_override_get();
974 return R_FIXED_THREADS;
976 return (rd->mode & R_FIXED_THREADS);
979 static bool rna_RenderSettings_is_movie_format_get(PointerRNA *ptr)
981 RenderData *rd = (RenderData *)ptr->data;
982 return BKE_imtype_is_movie(rd->im_format.imtype);
985 static void rna_ImageFormatSettings_file_format_set(PointerRNA *ptr, int value)
987 ImageFormatData *imf = (ImageFormatData *)ptr->data;
988 ID *id = ptr->id.data;
989 const bool is_render = (id && GS(id->name) == ID_SCE);
990 /* see note below on why this is */
991 const char chan_flag = BKE_imtype_valid_channels(imf->imtype, true) | (is_render ? IMA_CHAN_FLAG_BW : 0);
995 /* ensure depth and color settings match */
996 if ( ((imf->planes == R_IMF_PLANES_BW) && !(chan_flag & IMA_CHAN_FLAG_BW)) ||
997 ((imf->planes == R_IMF_PLANES_RGBA) && !(chan_flag & IMA_CHAN_FLAG_ALPHA)))
999 imf->planes = R_IMF_PLANES_RGB;
1002 /* ensure usable depth */
1004 const int depth_ok = BKE_imtype_valid_depths(imf->imtype);
1005 if ((imf->depth & depth_ok) == 0) {
1006 /* set first available depth */
1007 char depth_ls[] = {R_IMF_CHAN_DEPTH_32,
1008 R_IMF_CHAN_DEPTH_24,
1009 R_IMF_CHAN_DEPTH_16,
1010 R_IMF_CHAN_DEPTH_12,
1011 R_IMF_CHAN_DEPTH_10,
1017 for (i = 0; depth_ls[i]; i++) {
1018 if (depth_ok & depth_ls[i]) {
1019 imf->depth = depth_ls[i];
1026 if (id && GS(id->name) == ID_SCE) {
1027 Scene *scene = ptr->id.data;
1028 RenderData *rd = &scene->r;
1030 BKE_ffmpeg_image_type_verify(rd, imf);
1036 static const EnumPropertyItem *rna_ImageFormatSettings_file_format_itemf(
1037 bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
1039 ID *id = ptr->id.data;
1040 if (id && GS(id->name) == ID_SCE) {
1041 return rna_enum_image_type_items;
1044 return image_only_type_items;
1048 static const EnumPropertyItem *rna_ImageFormatSettings_color_mode_itemf(
1049 bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
1051 ImageFormatData *imf = (ImageFormatData *)ptr->data;
1052 ID *id = ptr->id.data;
1053 const bool is_render = (id && GS(id->name) == ID_SCE);
1055 /* note, we need to act differently for render
1056 * where 'BW' will force grayscale even if the output format writes
1057 * as RGBA, this is age old blender convention and not sure how useful
1058 * it really is but keep it for now - campbell */
1059 char chan_flag = BKE_imtype_valid_channels(imf->imtype, true) | (is_render ? IMA_CHAN_FLAG_BW : 0);
1062 /* a WAY more crappy case than B&W flag: depending on codec, file format MIGHT support
1063 * alpha channel. for example MPEG format with h264 codec can't do alpha channel, but
1064 * the same MPEG format with QTRLE codec can easily handle alpha channel.
1065 * not sure how to deal with such cases in a nicer way (sergey) */
1067 Scene *scene = ptr->id.data;
1068 RenderData *rd = &scene->r;
1070 if (BKE_ffmpeg_alpha_channel_is_supported(rd))
1071 chan_flag |= IMA_CHAN_FLAG_ALPHA;
1075 if (chan_flag == (IMA_CHAN_FLAG_BW | IMA_CHAN_FLAG_RGB | IMA_CHAN_FLAG_ALPHA)) {
1076 return rna_enum_image_color_mode_items;
1080 EnumPropertyItem *item = NULL;
1082 if (chan_flag & IMA_CHAN_FLAG_BW) RNA_enum_item_add(&item, &totitem, &IMAGE_COLOR_MODE_BW);
1083 if (chan_flag & IMA_CHAN_FLAG_RGB) RNA_enum_item_add(&item, &totitem, &IMAGE_COLOR_MODE_RGB);
1084 if (chan_flag & IMA_CHAN_FLAG_ALPHA) RNA_enum_item_add(&item, &totitem, &IMAGE_COLOR_MODE_RGBA);
1086 RNA_enum_item_end(&item, &totitem);
1093 static const EnumPropertyItem *rna_ImageFormatSettings_color_depth_itemf(
1094 bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
1096 ImageFormatData *imf = (ImageFormatData *)ptr->data;
1099 return rna_enum_image_color_depth_items;
1102 const int depth_ok = BKE_imtype_valid_depths(imf->imtype);
1103 const int is_float = ELEM(imf->imtype, R_IMF_IMTYPE_RADHDR, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER);
1105 const EnumPropertyItem *item_8bit = &rna_enum_image_color_depth_items[0];
1106 const EnumPropertyItem *item_10bit = &rna_enum_image_color_depth_items[1];
1107 const EnumPropertyItem *item_12bit = &rna_enum_image_color_depth_items[2];
1108 const EnumPropertyItem *item_16bit = &rna_enum_image_color_depth_items[3];
1109 const EnumPropertyItem *item_32bit = &rna_enum_image_color_depth_items[4];
1112 EnumPropertyItem *item = NULL;
1113 EnumPropertyItem tmp = {0, "", 0, "", ""};
1115 if (depth_ok & R_IMF_CHAN_DEPTH_8) {
1116 RNA_enum_item_add(&item, &totitem, item_8bit);
1119 if (depth_ok & R_IMF_CHAN_DEPTH_10) {
1120 RNA_enum_item_add(&item, &totitem, item_10bit);
1123 if (depth_ok & R_IMF_CHAN_DEPTH_12) {
1124 RNA_enum_item_add(&item, &totitem, item_12bit);
1127 if (depth_ok & R_IMF_CHAN_DEPTH_16) {
1130 tmp.name = "Float (Half)";
1131 RNA_enum_item_add(&item, &totitem, &tmp);
1134 RNA_enum_item_add(&item, &totitem, item_16bit);
1138 if (depth_ok & R_IMF_CHAN_DEPTH_32) {
1141 tmp.name = "Float (Full)";
1142 RNA_enum_item_add(&item, &totitem, &tmp);
1145 RNA_enum_item_add(&item, &totitem, item_32bit);
1149 RNA_enum_item_end(&item, &totitem);
1156 static const EnumPropertyItem *rna_ImageFormatSettings_views_format_itemf(
1157 bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
1159 ImageFormatData *imf = (ImageFormatData *)ptr->data;
1162 return rna_enum_views_format_items;
1164 else if (imf->imtype == R_IMF_IMTYPE_OPENEXR) {
1165 return rna_enum_views_format_multiview_items;
1167 else if (imf->imtype == R_IMF_IMTYPE_MULTILAYER) {
1168 return rna_enum_views_format_multilayer_items;
1171 return rna_enum_views_format_items;
1178 static const EnumPropertyItem *rna_ImageFormatSettings_exr_codec_itemf(
1179 bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
1181 ImageFormatData *imf = (ImageFormatData *)ptr->data;
1183 EnumPropertyItem *item = NULL;
1184 int i = 1, totitem = 0;
1186 if (imf->depth == 16)
1187 return rna_enum_exr_codec_items; /* All compression types are defined for halfs */
1189 for (i = 0; i < R_IMF_EXR_CODEC_MAX; i++) {
1190 if ((i == R_IMF_EXR_CODEC_B44 || i == R_IMF_EXR_CODEC_B44A)) {
1191 continue; /* B44 and B44A are not defined for 32 bit floats */
1194 RNA_enum_item_add(&item, &totitem, &rna_enum_exr_codec_items[i]);
1197 RNA_enum_item_end(&item, &totitem);
1204 static int rna_SceneRender_file_ext_length(PointerRNA *ptr)
1206 RenderData *rd = (RenderData *)ptr->data;
1209 BKE_image_path_ensure_ext_from_imformat(ext, &rd->im_format);
1213 static void rna_SceneRender_file_ext_get(PointerRNA *ptr, char *str)
1215 RenderData *rd = (RenderData *)ptr->data;
1217 BKE_image_path_ensure_ext_from_imformat(str, &rd->im_format);
1221 static void rna_FFmpegSettings_lossless_output_set(PointerRNA *ptr, bool value)
1223 Scene *scene = (Scene *) ptr->id.data;
1224 RenderData *rd = &scene->r;
1227 rd->ffcodecdata.flags |= FFMPEG_LOSSLESS_OUTPUT;
1229 rd->ffcodecdata.flags &= ~FFMPEG_LOSSLESS_OUTPUT;
1231 BKE_ffmpeg_codec_settings_verify(rd);
1234 static void rna_FFmpegSettings_codec_settings_update(Main *UNUSED(bmain), Scene *UNUSED(scene_unused), PointerRNA *ptr)
1236 Scene *scene = (Scene *) ptr->id.data;
1237 RenderData *rd = &scene->r;
1239 BKE_ffmpeg_codec_settings_verify(rd);
1243 static int rna_RenderSettings_active_view_index_get(PointerRNA *ptr)
1245 RenderData *rd = (RenderData *)ptr->data;
1249 static void rna_RenderSettings_active_view_index_set(PointerRNA *ptr, int value)
1251 RenderData *rd = (RenderData *)ptr->data;
1252 rd->actview = value;
1255 static void rna_RenderSettings_active_view_index_range(
1256 PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
1258 RenderData *rd = (RenderData *)ptr->data;
1261 *max = max_ii(0, BLI_listbase_count(&rd->views) - 1);
1264 static PointerRNA rna_RenderSettings_active_view_get(PointerRNA *ptr)
1266 RenderData *rd = (RenderData *)ptr->data;
1267 SceneRenderView *srv = BLI_findlink(&rd->views, rd->actview);
1269 return rna_pointer_inherit_refine(ptr, &RNA_SceneRenderView, srv);
1272 static void rna_RenderSettings_active_view_set(PointerRNA *ptr, PointerRNA value)
1274 RenderData *rd = (RenderData *)ptr->data;
1275 SceneRenderView *srv = (SceneRenderView *)value.data;
1276 const int index = BLI_findindex(&rd->views, srv);
1277 if (index != -1) rd->actview = index;
1280 static SceneRenderView *rna_RenderView_new(ID *id, RenderData *UNUSED(rd), const char *name)
1282 Scene *scene = (Scene *)id;
1283 SceneRenderView *srv = BKE_scene_add_render_view(scene, name);
1285 WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
1290 static void rna_RenderView_remove(
1291 ID *id, RenderData *UNUSED(rd), Main *UNUSED(bmain), ReportList *reports, PointerRNA *srv_ptr)
1293 SceneRenderView *srv = srv_ptr->data;
1294 Scene *scene = (Scene *)id;
1296 if (!BKE_scene_remove_render_view(scene, srv)) {
1297 BKE_reportf(reports, RPT_ERROR, "Render view '%s' could not be removed from scene '%s'",
1298 srv->name, scene->id.name + 2);
1302 RNA_POINTER_INVALIDATE(srv_ptr);
1304 WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
1307 static void rna_RenderSettings_views_format_set(PointerRNA *ptr, int value)
1309 RenderData *rd = (RenderData *)ptr->data;
1311 if (rd->views_format == SCE_VIEWS_FORMAT_MULTIVIEW &&
1312 value == SCE_VIEWS_FORMAT_STEREO_3D)
1314 /* make sure the actview is visible */
1315 if (rd->actview > 1) rd->actview = 1;
1318 rd->views_format = value;
1321 static void rna_RenderSettings_engine_set(PointerRNA *ptr, int value)
1323 RenderData *rd = (RenderData *)ptr->data;
1324 RenderEngineType *type = BLI_findlink(&R_engines, value);
1327 BLI_strncpy_utf8(rd->engine, type->idname, sizeof(rd->engine));
1328 DEG_id_tag_update(ptr->id.data, ID_RECALC_COPY_ON_WRITE);
1332 static const EnumPropertyItem *rna_RenderSettings_engine_itemf(
1333 bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
1335 RenderEngineType *type;
1336 EnumPropertyItem *item = NULL;
1337 EnumPropertyItem tmp = {0, "", 0, "", ""};
1338 int a = 0, totitem = 0;
1340 for (type = R_engines.first; type; type = type->next, a++) {
1342 tmp.identifier = type->idname;
1343 tmp.name = type->name;
1344 RNA_enum_item_add(&item, &totitem, &tmp);
1347 RNA_enum_item_end(&item, &totitem);
1353 static int rna_RenderSettings_engine_get(PointerRNA *ptr)
1355 RenderData *rd = (RenderData *)ptr->data;
1356 RenderEngineType *type;
1359 for (type = R_engines.first; type; type = type->next, a++)
1360 if (STREQ(type->idname, rd->engine))
1366 static void rna_RenderSettings_engine_update(Main *bmain, Scene *UNUSED(unused), PointerRNA *UNUSED(ptr))
1368 ED_render_engine_changed(bmain);
1371 static bool rna_RenderSettings_multiple_engines_get(PointerRNA *UNUSED(ptr))
1373 return (BLI_listbase_count(&R_engines) > 1);
1376 static bool rna_RenderSettings_use_spherical_stereo_get(PointerRNA *ptr)
1378 Scene *scene = (Scene *)ptr->id.data;
1379 return BKE_scene_use_spherical_stereo(scene);
1382 void rna_Scene_glsl_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1384 Scene *scene = (Scene *)ptr->id.data;
1386 DEG_id_tag_update(&scene->id, 0);
1389 static void rna_Scene_world_update(Main *bmain, Scene *scene, PointerRNA *ptr)
1391 Scene *sc = (Scene *)ptr->id.data;
1393 rna_Scene_glsl_update(bmain, scene, ptr);
1394 WM_main_add_notifier(NC_WORLD | ND_WORLD, &sc->id);
1395 DEG_relations_tag_update(bmain);
1398 void rna_Scene_freestyle_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1400 Scene *scene = (Scene *)ptr->id.data;
1402 DEG_id_tag_update(&scene->id, 0);
1405 void rna_Scene_use_view_map_cache_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
1407 #ifdef WITH_FREESTYLE
1408 FRS_free_view_map_cache();
1412 void rna_ViewLayer_name_set(PointerRNA *ptr, const char *value)
1414 Scene *scene = (Scene *)ptr->id.data;
1415 ViewLayer *view_layer = (ViewLayer *)ptr->data;
1416 BLI_assert(BKE_id_is_in_global_main(&scene->id));
1417 BKE_view_layer_rename(G_MAIN, scene, view_layer, value);
1420 static void rna_SceneRenderView_name_set(PointerRNA *ptr, const char *value)
1422 Scene *scene = (Scene *)ptr->id.data;
1423 SceneRenderView *rv = (SceneRenderView *)ptr->data;
1424 BLI_strncpy_utf8(rv->name, value, sizeof(rv->name));
1425 BLI_uniquename(&scene->r.views, rv, DATA_("RenderView"), '.', offsetof(SceneRenderView, name), sizeof(rv->name));
1428 void rna_ViewLayer_material_override_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
1430 Scene *scene = (Scene *)ptr->id.data;
1431 rna_Scene_glsl_update(bmain, scene, ptr);
1432 DEG_relations_tag_update(bmain);
1435 void rna_ViewLayer_pass_update(Main *bmain, Scene *activescene, PointerRNA *ptr)
1437 Scene *scene = (Scene *)ptr->id.data;
1439 if (scene->nodetree)
1440 ntreeCompositUpdateRLayers(scene->nodetree);
1442 rna_Scene_glsl_update(bmain, activescene, ptr);
1445 static char *rna_SceneRenderView_path(PointerRNA *ptr)
1447 SceneRenderView *srv = (SceneRenderView *)ptr->data;
1448 return BLI_sprintfN("render.views[\"%s\"]", srv->name);
1451 static void rna_Scene_use_nodes_update(bContext *C, PointerRNA *ptr)
1453 Scene *scene = (Scene *)ptr->data;
1454 if (scene->use_nodes && scene->nodetree == NULL) {
1455 ED_node_composit_default(C, scene);
1457 DEG_relations_tag_update(CTX_data_main(C));
1460 static void rna_Physics_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1462 Scene *scene = (Scene *)ptr->id.data;
1463 FOREACH_SCENE_OBJECT_BEGIN(scene, ob)
1465 BKE_ptcache_object_reset(scene, ob, PTCACHE_RESET_DEPSGRAPH);
1467 FOREACH_SCENE_OBJECT_END;
1469 DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE);
1472 static void rna_Scene_editmesh_select_mode_set(PointerRNA *ptr, const bool *value)
1474 ToolSettings *ts = (ToolSettings *)ptr->data;
1475 int flag = (value[0] ? SCE_SELECT_VERTEX : 0) | (value[1] ? SCE_SELECT_EDGE : 0) | (value[2] ? SCE_SELECT_FACE : 0);
1478 ts->selectmode = flag;
1480 /* Update select mode in all the workspaces in mesh edit mode. */
1481 wmWindowManager *wm = G_MAIN->wm.first;
1482 for (wmWindow *win = wm->windows.first; win; win = win->next) {
1483 ViewLayer *view_layer = WM_window_get_active_view_layer(win);
1485 if (view_layer && view_layer->basact) {
1486 Mesh *me = BKE_mesh_from_object(view_layer->basact->object);
1487 if (me && me->edit_btmesh && me->edit_btmesh->selectmode != flag) {
1488 me->edit_btmesh->selectmode = flag;
1489 EDBM_selectmode_set(me->edit_btmesh);
1496 static void rna_Scene_editmesh_select_mode_update(bContext *C, PointerRNA *UNUSED(ptr))
1498 ViewLayer *view_layer = CTX_data_view_layer(C);
1501 if (view_layer->basact) {
1502 me = BKE_mesh_from_object(view_layer->basact->object);
1503 if (me && me->edit_btmesh == NULL)
1508 DEG_id_tag_update(&me->id, ID_RECALC_SELECT);
1509 WM_main_add_notifier(NC_SCENE | ND_TOOLSETTINGS, NULL);
1513 static void object_simplify_update(Object *ob)
1516 ParticleSystem *psys;
1518 if ((ob->id.tag & LIB_TAG_DOIT) == 0) {
1522 ob->id.tag &= ~LIB_TAG_DOIT;
1524 for (md = ob->modifiers.first; md; md = md->next) {
1525 if (ELEM(md->type, eModifierType_Subsurf, eModifierType_Multires, eModifierType_ParticleSystem)) {
1526 DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
1530 for (psys = ob->particlesystem.first; psys; psys = psys->next)
1531 psys->recalc |= ID_RECALC_PSYS_CHILD;
1533 if (ob->dup_group) {
1534 CollectionObject *cob;
1536 for (cob = ob->dup_group->gobject.first; cob; cob = cob->next)
1537 object_simplify_update(cob->ob);
1541 static void rna_Scene_use_simplify_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
1543 Scene *sce = ptr->id.data;
1547 BKE_main_id_tag_listbase(&bmain->object, LIB_TAG_DOIT, true);
1548 FOREACH_SCENE_OBJECT_BEGIN(sce, ob)
1550 object_simplify_update(ob);
1552 FOREACH_SCENE_OBJECT_END;
1554 for (SETLOOPER_SET_ONLY(sce, sce_iter, base)) {
1555 object_simplify_update(base->object);
1558 WM_main_add_notifier(NC_GEOM | ND_DATA, NULL);
1559 DEG_id_tag_update(&sce->id, 0);
1562 static void rna_Scene_simplify_update(Main *bmain, Scene *scene, PointerRNA *ptr)
1564 Scene *sce = ptr->id.data;
1566 if (sce->r.mode & R_SIMPLIFY)
1567 rna_Scene_use_simplify_update(bmain, scene, ptr);
1570 static void rna_Scene_use_persistent_data_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1572 Scene *sce = ptr->id.data;
1574 if (!(sce->r.mode & R_PERSISTENT_DATA))
1575 RE_FreePersistentData();
1578 /* Scene.transform_orientation_slots */
1579 static void rna_Scene_transform_orientation_slots_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
1581 Scene *scene = (Scene *)ptr->id.data;
1582 TransformOrientationSlot *orient_slot = &scene->orientation_slots[0];
1583 rna_iterator_array_begin(iter, orient_slot, sizeof(*orient_slot), ARRAY_SIZE(scene->orientation_slots), 0, NULL);
1586 static int rna_Scene_transform_orientation_slots_length(PointerRNA *ptr)
1588 Scene *scene = (Scene *)ptr->id.data;
1589 return ARRAY_SIZE(scene->orientation_slots);
1592 static bool rna_Scene_use_audio_get(PointerRNA *ptr)
1594 Scene *scene = (Scene *)ptr->data;
1595 return (scene->audio.flag & AUDIO_MUTE) != 0;
1598 static void rna_Scene_use_audio_set(PointerRNA *ptr, bool value)
1600 Scene *scene = (Scene *)ptr->data;
1603 scene->audio.flag |= AUDIO_MUTE;
1605 scene->audio.flag &= ~AUDIO_MUTE;
1607 BKE_sound_mute_scene(scene, value);
1610 static int rna_Scene_sync_mode_get(PointerRNA *ptr)
1612 Scene *scene = (Scene *)ptr->data;
1613 if (scene->audio.flag & AUDIO_SYNC)
1615 return scene->flag & SCE_FRAME_DROP;
1618 static void rna_Scene_sync_mode_set(PointerRNA *ptr, int value)
1620 Scene *scene = (Scene *)ptr->data;
1622 if (value == AUDIO_SYNC) {
1623 scene->audio.flag |= AUDIO_SYNC;
1625 else if (value == SCE_FRAME_DROP) {
1626 scene->audio.flag &= ~AUDIO_SYNC;
1627 scene->flag |= SCE_FRAME_DROP;
1630 scene->audio.flag &= ~AUDIO_SYNC;
1631 scene->flag &= ~SCE_FRAME_DROP;
1637 static TimeMarker *rna_TimeLine_add(Scene *scene, const char name[], int frame)
1639 TimeMarker *marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker");
1640 marker->flag = SELECT;
1641 marker->frame = frame;
1642 BLI_strncpy_utf8(marker->name, name, sizeof(marker->name));
1643 BLI_addtail(&scene->markers, marker);
1645 WM_main_add_notifier(NC_SCENE | ND_MARKERS, NULL);
1646 WM_main_add_notifier(NC_ANIMATION | ND_MARKERS, NULL);
1651 static void rna_TimeLine_remove(Scene *scene, ReportList *reports, PointerRNA *marker_ptr)
1653 TimeMarker *marker = marker_ptr->data;
1654 if (BLI_remlink_safe(&scene->markers, marker) == false) {
1655 BKE_reportf(reports, RPT_ERROR, "Timeline marker '%s' not found in scene '%s'",
1656 marker->name, scene->id.name + 2);
1661 RNA_POINTER_INVALIDATE(marker_ptr);
1663 WM_main_add_notifier(NC_SCENE | ND_MARKERS, NULL);
1664 WM_main_add_notifier(NC_ANIMATION | ND_MARKERS, NULL);
1667 static void rna_TimeLine_clear(Scene *scene)
1669 BLI_freelistN(&scene->markers);
1671 WM_main_add_notifier(NC_SCENE | ND_MARKERS, NULL);
1672 WM_main_add_notifier(NC_ANIMATION | ND_MARKERS, NULL);
1675 static KeyingSet *rna_Scene_keying_set_new(Scene *sce, ReportList *reports, const char idname[], const char name[])
1677 KeyingSet *ks = NULL;
1679 /* call the API func, and set the active keyingset index */
1680 ks = BKE_keyingset_add(&sce->keyingsets, idname, name, KEYINGSET_ABSOLUTE, 0);
1683 sce->active_keyingset = BLI_listbase_count(&sce->keyingsets);
1687 BKE_report(reports, RPT_ERROR, "Keying set could not be added");
1692 static void rna_UnifiedPaintSettings_update(bContext *C, PointerRNA *UNUSED(ptr))
1694 Scene *scene = CTX_data_scene(C);
1695 ViewLayer *view_layer = CTX_data_view_layer(C);
1696 Brush *br = BKE_paint_brush(BKE_paint_get_active(scene, view_layer));
1697 WM_main_add_notifier(NC_BRUSH | NA_EDITED, br);
1700 static void rna_UnifiedPaintSettings_size_set(PointerRNA *ptr, int value)
1702 UnifiedPaintSettings *ups = ptr->data;
1704 /* scale unprojected radius so it stays consistent with brush size */
1705 BKE_brush_scale_unprojected_radius(&ups->unprojected_radius,
1710 static void rna_UnifiedPaintSettings_unprojected_radius_set(PointerRNA *ptr, float value)
1712 UnifiedPaintSettings *ups = ptr->data;
1714 /* scale brush size so it stays consistent with unprojected_radius */
1715 BKE_brush_scale_size(&ups->size, value, ups->unprojected_radius);
1716 ups->unprojected_radius = value;
1719 static void rna_UnifiedPaintSettings_radius_update(bContext *C, PointerRNA *ptr)
1721 /* changing the unified size should invalidate the overlay but also update the brush */
1722 BKE_paint_invalidate_overlay_all();
1723 rna_UnifiedPaintSettings_update(C, ptr);
1726 static char *rna_UnifiedPaintSettings_path(PointerRNA *UNUSED(ptr))
1728 return BLI_strdup("tool_settings.unified_paint_settings");
1731 static char *rna_CurvePaintSettings_path(PointerRNA *UNUSED(ptr))
1733 return BLI_strdup("tool_settings.curve_paint_settings");
1736 /* generic function to recalc geometry */
1737 static void rna_EditMesh_update(bContext *C, PointerRNA *UNUSED(ptr))
1739 ViewLayer *view_layer = CTX_data_view_layer(C);
1742 if (view_layer->basact) {
1743 me = BKE_mesh_from_object(view_layer->basact->object);
1744 if (me && me->edit_btmesh == NULL)
1749 DEG_id_tag_update(&me->id, ID_RECALC_GEOMETRY);
1750 WM_main_add_notifier(NC_GEOM | ND_DATA, me);
1754 static char *rna_MeshStatVis_path(PointerRNA *UNUSED(ptr))
1756 return BLI_strdup("tool_settings.statvis");
1759 /* note: without this, when Multi-Paint is activated/deactivated, the colors
1760 * will not change right away when multiple bones are selected, this function
1761 * is not for general use and only for the few cases where changing scene
1762 * settings and NOT for general purpose updates, possibly this should be
1763 * given its own notifier. */
1764 static void rna_Scene_update_active_object_data(bContext *C, PointerRNA *UNUSED(ptr))
1766 ViewLayer *view_layer = CTX_data_view_layer(C);
1767 Object *ob = OBACT(view_layer);
1770 DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
1771 WM_main_add_notifier(NC_OBJECT | ND_DRAW, &ob->id);
1775 static void rna_SceneCamera_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1777 Scene *scene = (Scene *)ptr->id.data;
1778 Object *camera = scene->camera;
1780 if (camera && (camera->type == OB_CAMERA)) {
1781 DEG_id_tag_update(&camera->id, ID_RECALC_GEOMETRY);
1785 static void rna_SceneSequencer_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
1787 BKE_sequencer_cache_cleanup();
1788 BKE_sequencer_preprocessed_cache_cleanup();
1791 static char *rna_ToolSettings_path(PointerRNA *UNUSED(ptr))
1793 return BLI_strdup("tool_settings");
1796 PointerRNA rna_FreestyleLineSet_linestyle_get(PointerRNA *ptr)
1798 FreestyleLineSet *lineset = (FreestyleLineSet *)ptr->data;
1800 return rna_pointer_inherit_refine(ptr, &RNA_FreestyleLineStyle, lineset->linestyle);
1803 void rna_FreestyleLineSet_linestyle_set(PointerRNA *ptr, PointerRNA value)
1805 FreestyleLineSet *lineset = (FreestyleLineSet *)ptr->data;
1807 if (lineset->linestyle)
1808 id_us_min(&lineset->linestyle->id);
1809 lineset->linestyle = (FreestyleLineStyle *)value.data;
1810 id_us_plus(&lineset->linestyle->id);
1813 FreestyleLineSet *rna_FreestyleSettings_lineset_add(
1814 ID *id, FreestyleSettings *config, Main *bmain, const char *name)
1816 Scene *scene = (Scene *)id;
1817 FreestyleLineSet *lineset = BKE_freestyle_lineset_add(bmain, (FreestyleConfig *)config, name);
1819 DEG_id_tag_update(&scene->id, 0);
1820 WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
1825 void rna_FreestyleSettings_lineset_remove(
1826 ID *id, FreestyleSettings *config, ReportList *reports, PointerRNA *lineset_ptr)
1828 FreestyleLineSet *lineset = lineset_ptr->data;
1829 Scene *scene = (Scene *)id;
1831 if (!BKE_freestyle_lineset_delete((FreestyleConfig *)config, lineset)) {
1832 BKE_reportf(reports, RPT_ERROR, "Line set '%s' could not be removed", lineset->name);
1836 RNA_POINTER_INVALIDATE(lineset_ptr);
1838 DEG_id_tag_update(&scene->id, 0);
1839 WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
1842 PointerRNA rna_FreestyleSettings_active_lineset_get(PointerRNA *ptr)
1844 FreestyleConfig *config = (FreestyleConfig *)ptr->data;
1845 FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(config);
1846 return rna_pointer_inherit_refine(ptr, &RNA_FreestyleLineSet, lineset);
1849 void rna_FreestyleSettings_active_lineset_index_range(
1850 PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
1852 FreestyleConfig *config = (FreestyleConfig *)ptr->data;
1855 *max = max_ii(0, BLI_listbase_count(&config->linesets) - 1);
1858 int rna_FreestyleSettings_active_lineset_index_get(PointerRNA *ptr)
1860 FreestyleConfig *config = (FreestyleConfig *)ptr->data;
1861 return BKE_freestyle_lineset_get_active_index(config);
1864 void rna_FreestyleSettings_active_lineset_index_set(PointerRNA *ptr, int value)
1866 FreestyleConfig *config = (FreestyleConfig *)ptr->data;
1867 BKE_freestyle_lineset_set_active_index(config, value);
1870 FreestyleModuleConfig *rna_FreestyleSettings_module_add(ID *id, FreestyleSettings *config)
1872 Scene *scene = (Scene *)id;
1873 FreestyleModuleConfig *module = BKE_freestyle_module_add((FreestyleConfig *)config);
1875 DEG_id_tag_update(&scene->id, 0);
1876 WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
1881 void rna_FreestyleSettings_module_remove(
1882 ID *id, FreestyleSettings *config, ReportList *reports, PointerRNA *module_ptr)
1884 Scene *scene = (Scene *)id;
1885 FreestyleModuleConfig *module = module_ptr->data;
1887 if (!BKE_freestyle_module_delete((FreestyleConfig *)config, module)) {
1889 BKE_reportf(reports, RPT_ERROR, "Style module '%s' could not be removed", module->script->id.name + 2);
1891 BKE_report(reports, RPT_ERROR, "Style module could not be removed");
1895 RNA_POINTER_INVALIDATE(module_ptr);
1897 DEG_id_tag_update(&scene->id, 0);
1898 WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
1901 char *rna_GPUDOF_path(PointerRNA *ptr)
1903 /* if there is ID-data, resolve the path using the index instead of by name,
1904 * since the name used is the name of the texture assigned, but the texture
1905 * may be used multiple times in the same stack
1908 if (GS(((ID *)ptr->id.data)->name) == ID_CA) {
1909 return BLI_strdup("gpu_dof");
1913 return BLI_strdup("");
1916 static void rna_GPUDOFSettings_blades_set(PointerRNA *ptr, const int value)
1918 GPUDOFSettings *dofsettings = (GPUDOFSettings *)ptr->data;
1920 if (value == 1 || value == 2) {
1921 if (dofsettings->num_blades == 0) {
1922 dofsettings->num_blades = 3;
1925 dofsettings->num_blades = 0;
1929 dofsettings->num_blades = value;
1933 static void rna_GPUDOFSettings_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
1935 /* TODO(sergey): Can be more selective here. */
1936 BKE_sequencer_cache_cleanup();
1937 BKE_sequencer_preprocessed_cache_cleanup();
1938 WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
1941 static void rna_Stereo3dFormat_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
1943 ID *id = ptr->id.data;
1945 if (id && GS(id->name) == ID_IM) {
1946 Image *ima = (Image *)id;
1950 if (!BKE_image_is_stereo(ima))
1953 ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
1956 BKE_image_signal(bmain, ima, NULL, IMA_SIGNAL_FREE);
1958 BKE_image_release_ibuf(ima, ibuf, lock);
1962 static ViewLayer *rna_ViewLayer_new(
1963 ID *id, Scene *UNUSED(sce), Main *bmain, const char *name)
1965 Scene *scene = (Scene *)id;
1966 ViewLayer *view_layer = BKE_view_layer_add(scene, name);
1968 DEG_id_tag_update(&scene->id, 0);
1969 DEG_relations_tag_update(bmain);
1970 WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL);
1975 static void rna_ViewLayer_remove(
1976 ID *id, Scene *UNUSED(sce), Main *bmain, ReportList *reports, PointerRNA *sl_ptr)
1978 Scene *scene = (Scene *)id;
1979 ViewLayer *view_layer = sl_ptr->data;
1981 if (ED_scene_view_layer_delete(bmain, scene, view_layer, reports)) {
1982 RNA_POINTER_INVALIDATE(sl_ptr);
1986 /* Fake value, used internally (not saved to DNA). */
1987 #define V3D_ORIENT_DEFAULT -1
1989 static int rna_TransformOrientationSlot_type_get(PointerRNA *ptr)
1991 Scene *scene = ptr->id.data;
1992 TransformOrientationSlot *orient_slot = ptr->data;
1993 if (orient_slot != &scene->orientation_slots[SCE_ORIENT_DEFAULT]) {
1994 if ((orient_slot->flag & SELECT) == 0) {
1995 return V3D_ORIENT_DEFAULT;
1998 return BKE_scene_orientation_slot_get_index(orient_slot);
2001 void rna_TransformOrientationSlot_type_set(PointerRNA *ptr, int value)
2003 Scene *scene = ptr->id.data;
2004 TransformOrientationSlot *orient_slot = ptr->data;
2006 if (orient_slot != &scene->orientation_slots[SCE_ORIENT_DEFAULT]) {
2007 if (value == V3D_ORIENT_DEFAULT) {
2008 orient_slot->flag &= ~SELECT;
2012 orient_slot->flag |= SELECT;
2016 BKE_scene_orientation_slot_set_index(orient_slot, value);
2019 static PointerRNA rna_TransformOrientationSlot_get(PointerRNA *ptr)
2021 Scene *scene = ptr->id.data;
2022 TransformOrientationSlot *orient_slot = ptr->data;
2023 TransformOrientation *orientation;
2024 if (orient_slot->type < V3D_ORIENT_CUSTOM) {
2028 orientation = BKE_scene_transform_orientation_find(scene, orient_slot->index_custom);
2030 return rna_pointer_inherit_refine(ptr, &RNA_TransformOrientation, orientation);
2033 static const EnumPropertyItem *rna_TransformOrientation_impl_itemf(
2034 Scene *scene, const bool include_default,
2037 EnumPropertyItem tmp = {0, "", 0, "", ""};
2038 EnumPropertyItem *item = NULL;
2039 int i = V3D_ORIENT_CUSTOM, totitem = 0;
2041 if (include_default) {
2042 tmp.identifier = "DEFAULT";
2043 tmp.name = "Default";
2044 tmp.description = "Use the scene orientation";
2045 tmp.value = V3D_ORIENT_DEFAULT;
2046 tmp.icon = ICON_OBJECT_ORIGIN;
2047 RNA_enum_item_add(&item, &totitem, &tmp);
2050 RNA_enum_item_add_separator(&item, &totitem);
2053 RNA_enum_items_add(&item, &totitem, rna_enum_transform_orientation_items);
2055 const ListBase *transform_orientations = scene ? &scene->transform_spaces : NULL;
2057 if (transform_orientations && (BLI_listbase_is_empty(transform_orientations) == false)) {
2058 RNA_enum_item_add_separator(&item, &totitem);
2060 for (TransformOrientation *ts = transform_orientations->first; ts; ts = ts->next) {
2061 tmp.identifier = ts->name;
2062 tmp.name = ts->name;
2064 RNA_enum_item_add(&item, &totitem, &tmp);
2068 RNA_enum_item_end(&item, &totitem);
2073 const EnumPropertyItem *rna_TransformOrientation_itemf(
2074 bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
2077 if (ptr->id.data && (GS(((ID *)ptr->id.data)->name) == ID_SCE)) {
2078 scene = ptr->id.data;
2081 scene = CTX_data_scene(C);
2083 return rna_TransformOrientation_impl_itemf(scene, false, r_free);
2086 const EnumPropertyItem *rna_TransformOrientation_with_scene_itemf(
2087 bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
2089 Scene *scene = ptr->id.data;
2090 TransformOrientationSlot *orient_slot = ptr->data;
2091 bool include_default = (orient_slot != &scene->orientation_slots[SCE_ORIENT_DEFAULT]);
2092 return rna_TransformOrientation_impl_itemf(scene, include_default, r_free);
2095 #undef V3D_ORIENT_DEFAULT
2097 void rna_TransformOrientationSlot_ui_info(
2098 ID *scene_id, TransformOrientationSlot *orient_slot,
2099 char *r_name, int *r_icon_value)
2101 Scene *scene = (Scene *)scene_id;
2103 if (orient_slot->type < V3D_ORIENT_CUSTOM) {
2104 const EnumPropertyItem *items = rna_enum_transform_orientation_items;
2105 const int i = RNA_enum_from_value(items, orient_slot->type);
2106 strcpy(r_name, items[i].name);
2107 *r_icon_value = items[i].icon;
2110 TransformOrientation *orientation = BKE_scene_transform_orientation_find(
2111 scene, orient_slot->index_custom);
2112 strcpy(r_name, orientation->name);
2113 *r_icon_value = ICON_OBJECT_ORIGIN;
2117 static const EnumPropertyItem *rna_UnitSettings_itemf_wrapper(
2118 const int system, const int type, bool *r_free)
2122 bUnit_GetSystem(system, type, &usys, &len);
2124 EnumPropertyItem *items = NULL;
2127 EnumPropertyItem adaptive = { 0 };
2128 adaptive.identifier = "ADAPTIVE";
2129 adaptive.name = "Adaptive";
2130 adaptive.value = USER_UNIT_ADAPTIVE;
2131 RNA_enum_item_add(&items, &totitem, &adaptive);
2133 for (int i = 0; i < len; i++) {
2134 if (!bUnit_IsSuppressed(usys, i)) {
2135 EnumPropertyItem tmp = { 0 };
2136 tmp.identifier = bUnit_GetIdentifier(usys, i);
2137 tmp.name = bUnit_GetNameDisplay(usys, i);
2139 RNA_enum_item_add(&items, &totitem, &tmp);
2147 const EnumPropertyItem *rna_UnitSettings_length_unit_itemf(
2148 bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
2150 UnitSettings *units = ptr->data;
2151 return rna_UnitSettings_itemf_wrapper(units->system, B_UNIT_LENGTH, r_free);
2154 const EnumPropertyItem *rna_UnitSettings_mass_unit_itemf(
2155 bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
2157 UnitSettings *units = ptr->data;
2158 return rna_UnitSettings_itemf_wrapper(units->system, B_UNIT_MASS, r_free);
2161 const EnumPropertyItem *rna_UnitSettings_time_unit_itemf(
2162 bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
2164 UnitSettings *units = ptr->data;
2165 return rna_UnitSettings_itemf_wrapper(units->system, B_UNIT_TIME, r_free);
2168 static void rna_UnitSettings_system_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
2170 UnitSettings *unit = &scene->unit;
2171 if (unit->system == USER_UNIT_NONE) {
2172 unit->length_unit = USER_UNIT_ADAPTIVE;
2173 unit->mass_unit = USER_UNIT_ADAPTIVE;
2176 unit->length_unit = bUnit_GetBaseUnitOfType(unit->system, B_UNIT_LENGTH);
2177 unit->mass_unit = bUnit_GetBaseUnitOfType(unit->system, B_UNIT_MASS);
2181 static char *rna_UnitSettings_path(PointerRNA *UNUSED(ptr))
2183 return BLI_sprintfN("unit_settings");
2188 /* Grease Pencil Interpolation tool settings */
2189 static void rna_def_gpencil_interpolate(BlenderRNA *brna)
2194 srna = RNA_def_struct(brna, "GPencilInterpolateSettings", NULL);
2195 RNA_def_struct_sdna(srna, "GP_Interpolate_Settings");
2196 RNA_def_struct_path_func(srna, "rna_GPencilInterpolateSettings_path");
2197 RNA_def_struct_ui_text(srna, "Grease Pencil Interpolate Settings",
2198 "Settings for Grease Pencil interpolation tools");
2201 prop = RNA_def_property(srna, "interpolate_all_layers", PROP_BOOLEAN, PROP_NONE);
2202 RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_TOOLFLAG_INTERPOLATE_ALL_LAYERS);
2203 RNA_def_property_ui_text(prop, "Interpolate All Layers", "Interpolate all layers, not only active");
2204 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
2206 prop = RNA_def_property(srna, "interpolate_selected_only", PROP_BOOLEAN, PROP_NONE);
2207 RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_TOOLFLAG_INTERPOLATE_ONLY_SELECTED);
2208 RNA_def_property_ui_text(prop, "Interpolate Selected Strokes", "Interpolate only selected strokes in the original frame");
2209 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
2211 /* interpolation type */
2212 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
2213 RNA_def_property_enum_sdna(prop, NULL, "type");
2214 RNA_def_property_enum_items(prop, rna_enum_gpencil_interpolation_mode_items);
2215 RNA_def_property_enum_funcs(prop, NULL, "rna_GPencilInterpolateSettings_type_set", NULL);
2216 RNA_def_property_ui_text(prop, "Type",
2217 "Interpolation method to use the next time 'Interpolate Sequence' is run");
2218 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
2221 prop = RNA_def_property(srna, "easing", PROP_ENUM, PROP_NONE);
2222 RNA_def_property_enum_sdna(prop, NULL, "easing");
2223 RNA_def_property_enum_items(prop, rna_enum_beztriple_interpolation_easing_items);
2224 RNA_def_property_ui_text(prop, "Easing",
2225 "Which ends of the segment between the preceding and following grease pencil frames "
2226 "easing interpolation is applied to");
2227 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
2229 /* easing options */
2230 prop = RNA_def_property(srna, "back", PROP_FLOAT, PROP_NONE);
2231 RNA_def_property_float_sdna(prop, NULL, "back");
2232 RNA_def_property_ui_text(prop, "Back", "Amount of overshoot for 'back' easing");
2233 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
2235 prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
2236 RNA_def_property_float_sdna(prop, NULL, "amplitude");
2237 RNA_def_property_range(prop, 0.0f, FLT_MAX); /* only positive values... */
2238 RNA_def_property_ui_text(prop, "Amplitude", "Amount to boost elastic bounces for 'elastic' easing");
2239 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
2241 prop = RNA_def_property(srna, "period", PROP_FLOAT, PROP_NONE);
2242 RNA_def_property_float_sdna(prop, NULL, "period");
2243 RNA_def_property_ui_text(prop, "Period", "Time between bounces for elastic easing");
2244 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
2246 /* custom curvemap */
2247 prop = RNA_def_property(srna, "interpolation_curve", PROP_POINTER, PROP_NONE);
2248 RNA_def_property_pointer_sdna(prop, NULL, "custom_ipo");
2249 RNA_def_property_struct_type(prop, "CurveMapping");
2250 RNA_def_property_ui_text(prop, "Interpolation Curve",
2251 "Custom curve to control 'sequence' interpolation between Grease Pencil frames");
2252 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
2255 static void rna_def_transform_orientation(BlenderRNA *brna)
2260 srna = RNA_def_struct(brna, "TransformOrientation", NULL);
2262 prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
2263 RNA_def_property_float_sdna(prop, NULL, "mat");
2264 RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_3x3);
2265 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2267 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
2268 RNA_def_struct_name_property(srna, prop);
2269 RNA_def_property_ui_text(prop, "Name", "Name of the custom transform orientation");
2270 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2273 static void rna_def_transform_orientation_slot(BlenderRNA *brna)
2278 srna = RNA_def_struct(brna, "TransformOrientationSlot", NULL);
2279 RNA_def_struct_sdna(srna, "TransformOrientationSlot");
2280 RNA_def_struct_ui_text(srna, "Orientation Slot", "");
2283 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
2284 RNA_def_property_enum_items(prop, rna_enum_transform_orientation_items);
2285 RNA_def_property_enum_funcs(
2287 "rna_TransformOrientationSlot_type_get",
2288 "rna_TransformOrientationSlot_type_set",
2289 "rna_TransformOrientation_with_scene_itemf");
2290 RNA_def_property_ui_text(prop, "Orientation", "Transformation orientation");
2291 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
2293 prop = RNA_def_property(srna, "custom_orientation", PROP_POINTER, PROP_NONE);
2294 RNA_def_property_struct_type(prop, "TransformOrientation");
2295 RNA_def_property_pointer_funcs(prop, "rna_TransformOrientationSlot_get", NULL, NULL, NULL);
2296 RNA_def_property_ui_text(prop, "Current Transform Orientation", "");
2299 prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
2300 RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
2301 RNA_def_property_ui_text(prop, "Use", "Use scene orientation instead of a custom setting");
2302 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
2307 /* UI access only (avoid slow RNA introspection). */
2308 func = RNA_def_function(srna, "ui_info", "rna_TransformOrientationSlot_ui_info");
2309 RNA_def_function_ui_description(func, "");
2310 RNA_def_function_flag(func, FUNC_USE_SELF_ID);
2311 parm = RNA_def_string(func, "name", NULL, sizeof(((TransformOrientation *)NULL)->name), "name", "");
2312 RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
2313 RNA_def_function_output(func, parm);
2314 parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_NONE);
2315 RNA_def_property_ui_text(parm, "", "");
2316 RNA_def_function_output(func, parm);
2320 static void rna_def_tool_settings(BlenderRNA *brna)
2325 /* the construction of this enum is quite special - everything is stored as bitflags,
2326 * with 1st position only for for on/off (and exposed as boolean), while others are mutually
2327 * exclusive options but which will only have any effect when autokey is enabled
2329 static const EnumPropertyItem auto_key_items[] = {
2330 {AUTOKEY_MODE_NORMAL & ~AUTOKEY_ON, "ADD_REPLACE_KEYS", 0, "Add & Replace", ""},
2331 {AUTOKEY_MODE_EDITKEYS & ~AUTOKEY_ON, "REPLACE_KEYS", 0, "Replace", ""},
2332 {0, NULL, 0, NULL, NULL},
2335 static const EnumPropertyItem edge_tag_items[] = {
2336 {EDGE_MODE_SELECT, "SELECT", 0, "Select", ""},
2337 {EDGE_MODE_TAG_SEAM, "SEAM", 0, "Tag Seam", ""},
2338 {EDGE_MODE_TAG_SHARP, "SHARP", 0, "Tag Sharp", ""},
2339 {EDGE_MODE_TAG_CREASE, "CREASE", 0, "Tag Crease", ""},
2340 {EDGE_MODE_TAG_BEVEL, "BEVEL", 0, "Tag Bevel", ""},
2341 {EDGE_MODE_TAG_FREESTYLE, "FREESTYLE", 0, "Tag Freestyle Edge Mark", ""},
2342 {0, NULL, 0, NULL, NULL},
2345 static EnumPropertyItem mod_weighted_strength[] = {
2346 {FACE_STRENGTH_WEAK, "Weak", 0, "Weak", ""},
2347 {FACE_STRENGTH_MEDIUM, "Medium", 0, "Medium", ""},
2348 {FACE_STRENGTH_STRONG, "Strong", 0, "Strong", ""},
2349 {0, NULL, 0, NULL, NULL},
2352 static const EnumPropertyItem draw_groupuser_items[] = {
2353 {OB_DRAW_GROUPUSER_NONE, "NONE", 0, "None", ""},
2354 {OB_DRAW_GROUPUSER_ACTIVE, "ACTIVE", 0, "Active", "Show vertices with no weights in the active group"},
2355 {OB_DRAW_GROUPUSER_ALL, "ALL", 0, "All", "Show vertices with no weights in any group"},
2356 {0, NULL, 0, NULL, NULL},
2359 static const EnumPropertyItem vertex_group_select_items[] = {
2360 {WT_VGROUP_ALL, "ALL", 0, "All", "All Vertex Groups"},
2361 {WT_VGROUP_BONE_DEFORM, "BONE_DEFORM", 0, "Deform", "Vertex Groups assigned to Deform Bones"},
2362 {WT_VGROUP_BONE_DEFORM_OFF, "OTHER_DEFORM", 0, "Other", "Vertex Groups assigned to non Deform Bones"},
2363 {0, NULL, 0, NULL, NULL},
2366 static const EnumPropertyItem gpencil_stroke_placement_items[] = {
2367 {GP_PROJECT_VIEWSPACE, "ORIGIN", ICON_OBJECT_ORIGIN, "Origin", "Draw stroke at Object origin"},
2368 {GP_PROJECT_VIEWSPACE | GP_PROJECT_CURSOR, "CURSOR", ICON_PIVOT_CURSOR, "3D Cursor", "Draw stroke at 3D cursor location" },
2369 {GP_PROJECT_VIEWSPACE | GP_PROJECT_DEPTH_VIEW, "SURFACE", ICON_SNAP_FACE, "Surface", "Stick stroke to surfaces"},
2370 {GP_PROJECT_VIEWSPACE | GP_PROJECT_DEPTH_STROKE, "STROKE", ICON_STROKE, "Stroke", "Stick stroke to other strokes"},
2371 {0, NULL, 0, NULL, NULL},
2374 static const EnumPropertyItem gpencil_stroke_snap_items[] = {
2375 {0, "NONE", 0, "All points", "No snap"},
2376 {GP_PROJECT_DEPTH_STROKE_ENDPOINTS, "ENDS", 0, "End points", "Snap to first and last points and interpolate" },
2377 {GP_PROJECT_DEPTH_STROKE_FIRST, "FIRST", 0, "First point", "Snap to first point" },
2378 {0, NULL, 0, NULL, NULL},
2381 static const EnumPropertyItem gpencil_selectmode_items[] = {
2382 {GP_SELECTMODE_POINT, "POINT", ICON_GP_SELECT_POINTS, "Point", "Select only points"},
2383 {GP_SELECTMODE_STROKE, "STROKE", ICON_GP_SELECT_STROKES, "Stroke", "Select all stroke points" },
2384 /* GPXX need better icon for segment */
2385 {GP_SELECTMODE_SEGMENT, "SEGMENT", ICON_SHADERFX, "Segment", "Select all stroke points between other strokes" },
2386 {0, NULL, 0, NULL, NULL},
2389 static const EnumPropertyItem annotation_stroke_placement_items[] = {
2390 {GP_PROJECT_VIEWSPACE | GP_PROJECT_CURSOR, "CURSOR", ICON_PIVOT_CURSOR, "3D Cursor", "Draw stroke at 3D cursor location" },
2391 {0, "VIEW", ICON_RESTRICT_VIEW_ON, "View", "Stick stroke to the view "}, /* weird, GP_PROJECT_VIEWALIGN is inverted */
2392 {GP_PROJECT_VIEWSPACE | GP_PROJECT_DEPTH_VIEW, "SURFACE", ICON_FACESEL, "Surface", "Stick stroke to surfaces"},
2393 {0, NULL, 0, NULL, NULL},
2397 srna = RNA_def_struct(brna, "ToolSettings", NULL);
2398 RNA_def_struct_path_func(srna, "rna_ToolSettings_path");
2399 RNA_def_struct_ui_text(srna, "Tool Settings", "");
2401 prop = RNA_def_property(srna, "sculpt", PROP_POINTER, PROP_NONE);
2402 RNA_def_property_struct_type(prop, "Sculpt");
2403 RNA_def_property_ui_text(prop, "Sculpt", "");
2405 prop = RNA_def_property(srna, "use_auto_normalize", PROP_BOOLEAN, PROP_NONE);
2406 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
2407 RNA_def_property_boolean_sdna(prop, NULL, "auto_normalize", 1);
2408 RNA_def_property_ui_text(prop, "WPaint Auto-Normalize",
2409 "Ensure all bone-deforming vertex groups add up "
2410 "to 1.0 while weight painting");
2411 RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data");
2413 prop = RNA_def_property(srna, "use_multipaint", PROP_BOOLEAN, PROP_NONE);
2414 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
2415 RNA_def_property_boolean_sdna(prop, NULL, "multipaint", 1);
2416 RNA_def_property_ui_text(prop, "WPaint Multi-Paint",
2417 "Paint across the weights of all selected bones, "
2418 "maintaining their relative influence");
2419 RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data");
2421 prop = RNA_def_property(srna, "vertex_group_user", PROP_ENUM, PROP_NONE);
2422 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
2423 RNA_def_property_enum_sdna(prop, NULL, "weightuser");
2424 RNA_def_property_enum_items(prop, draw_groupuser_items);
2425 RNA_def_property_ui_text(prop, "Mask Non-Group Vertices", "Display unweighted vertices");
2426 RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data");
2428 prop = RNA_def_property(srna, "vertex_group_subset", PROP_ENUM, PROP_NONE);
2429 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
2430 RNA_def_property_enum_sdna(prop, NULL, "vgroupsubset");
2431 RNA_def_property_enum_items(prop, vertex_group_select_items);
2432 RNA_def_property_ui_text(prop, "Subset", "Filter Vertex groups for Display");
2433 RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data");
2435 prop = RNA_def_property(srna, "vertex_paint", PROP_POINTER, PROP_NONE);
2436 RNA_def_property_pointer_sdna(prop, NULL, "vpaint");
2437 RNA_def_property_ui_text(prop, "Vertex Paint", "");
2439 prop = RNA_def_property(srna, "weight_paint", PROP_POINTER, PROP_NONE);
2440 RNA_def_property_pointer_sdna(prop, NULL, "wpaint");
2441 RNA_def_property_ui_text(prop, "Weight Paint", "");
2443 prop = RNA_def_property(srna, "image_paint", PROP_POINTER, PROP_NONE);
2444 RNA_def_property_pointer_sdna(prop, NULL, "imapaint");
2445 RNA_def_property_ui_text(prop, "Image Paint", "");
2447 prop = RNA_def_property(srna, "uv_sculpt", PROP_POINTER, PROP_NONE);
2448 RNA_def_property_pointer_sdna(prop, NULL, "uvsculpt");
2449 RNA_def_property_ui_text(prop, "UV Sculpt", "");
2451 prop = RNA_def_property(srna, "gpencil_paint", PROP_POINTER, PROP_NONE);
2452 RNA_def_property_pointer_sdna(prop, NULL, "gp_paint");
2453 RNA_def_property_ui_text(prop, "Grease Pencil Paint", "");
2455 prop = RNA_def_property(srna, "particle_edit", PROP_POINTER, PROP_NONE);
2456 RNA_def_property_pointer_sdna(prop, NULL, "particle");
2457 RNA_def_property_ui_text(prop, "Particle Edit", "");
2459 prop = RNA_def_property(srna, "use_uv_sculpt", PROP_BOOLEAN, PROP_NONE);
2460 RNA_def_property_boolean_sdna(prop, NULL, "use_uv_sculpt", 1);
2461 RNA_def_property_ui_text(prop, "UV Sculpt", "Enable brush for UV sculpting");
2462 RNA_def_property_ui_icon(prop, ICON_TPAINT_HLT, 0);
2463 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, "rna_SpaceImageEditor_uv_sculpt_update");
2465 prop = RNA_def_property(srna, "uv_sculpt_lock_borders", PROP_BOOLEAN, PROP_NONE);
2466 RNA_def_property_boolean_sdna(prop, NULL, "uv_sculpt_settings", UV_SCULPT_LOCK_BORDERS);
2467 RNA_def_property_ui_text(prop, "Lock Borders", "Disable editing of boundary edges");
2469 prop = RNA_def_property(srna, "uv_sculpt_all_islands", PROP_BOOLEAN, PROP_NONE);
2470 RNA_def_property_boolean_sdna(prop, NULL, "uv_sculpt_settings", UV_SCULPT_ALL_ISLANDS);
2471 RNA_def_property_ui_text(prop, "Sculpt All Islands", "Brush operates on all islands");
2473 prop = RNA_def_property(srna, "uv_sculpt_tool", PROP_ENUM, PROP_NONE);
2474 RNA_def_property_enum_sdna(prop, NULL, "uv_sculpt_tool");
2475 RNA_def_property_enum_items(prop, rna_enum_uv_sculpt_tool_items);
2476 RNA_def_property_ui_text(prop, "UV Sculpt Tools", "Select Tools for the UV sculpt brushes");
2478 prop = RNA_def_property(srna, "uv_relax_method", PROP_ENUM, PROP_NONE);
2479 RNA_def_property_enum_sdna(prop, NULL, "uv_relax_method");
2480 RNA_def_property_enum_items(prop, uv_sculpt_relaxation_items);
2481 RNA_def_property_ui_text(prop, "Relaxation Method", "Algorithm used for UV relaxation");
2483 prop = RNA_def_property(srna, "lock_object_mode", PROP_BOOLEAN, PROP_NONE);
2484 RNA_def_property_boolean_sdna(prop, NULL, "object_flag", SCE_OBJECT_MODE_LOCK);
2485 RNA_def_property_ui_text(prop, "Lock Object Modes", "Restrict select to the current mode");
2486 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
2489 prop = RNA_def_property(srna, "proportional_edit", PROP_ENUM, PROP_NONE);
2490 RNA_def_property_enum_sdna(prop, NULL, "proportional");
2491 RNA_def_property_enum_items(prop, rna_enum_proportional_editing_items);
2492 RNA_def_property_ui_text(prop, "Proportional Editing",
2493 "Proportional Editing mode, allows transforms with distance fall-off");
2494 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
2496 prop = RNA_def_property(srna, "use_proportional_edit_objects", PROP_BOOLEAN, PROP_NONE);
2497 RNA_def_property_boolean_sdna(prop, NULL, "proportional_objects", 0);
2498 RNA_def_property_ui_text(prop, "Proportional Editing Objects", "Proportional editing object mode");
2499 RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1);
2500 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
2502 prop = RNA_def_property(srna, "use_proportional_edit_mask", PROP_BOOLEAN, PROP_NONE);
2503 RNA_def_property_boolean_sdna(prop, NULL, "proportional_mask", 0);
2504 RNA_def_property_ui_text(prop, "Proportional Editing Objects", "Proportional editing mask mode");
2505 RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1);
2506 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
2508 prop = RNA_def_property(srna, "use_proportional_action", PROP_BOOLEAN, PROP_NONE);
2509 RNA_def_property_boolean_sdna(prop, NULL, "proportional_action", 0);
2510 RNA_def_property_ui_text(prop, "Proportional Editing Actions", "Proportional editing in action editor");
2511 RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1);
2512 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
2514 prop = RNA_def_property(srna, "use_proportional_fcurve", PROP_BOOLEAN, PROP_NONE);
2515 RNA_def_property_boolean_sdna(prop, NULL, "proportional_fcurve", 0);
2516 RNA_def_property_ui_text(prop, "Proportional Editing FCurves", "Proportional editing in FCurve editor");
2517 RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1);
2518 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
2520 prop = RNA_def_property(srna, "lock_markers", PROP_BOOLEAN, PROP_NONE);
2521 RNA_def_property_boolean_sdna(prop, NULL, "lock_markers", 0);
2522 RNA_def_property_ui_text(prop, "Lock Markers", "Prevent marker editing");
2524 prop = RNA_def_property(srna, "proportional_edit_falloff", PROP_ENUM, PROP_NONE);
2525 RNA_def_property_enum_sdna(prop, NULL, "prop_mode");
2526 RNA_def_property_enum_items(prop, rna_enum_proportional_falloff_items);
2527 RNA_def_property_ui_text(prop, "Proportional Editing Falloff", "Falloff type for proportional editing mode");
2528 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
2530 prop = RNA_def_property(srna, "proportional_size", PROP_FLOAT, PROP_DISTANCE);
2531 RNA_def_property_float_sdna(prop, NULL, "proportional_size");
2532 RNA_def_property_ui_text(prop, "Proportional Size", "Display size for proportional editing circle");
2533 RNA_def_property_range(prop, 0.00001, 5000.0);
2535 prop = RNA_def_property(srna, "double_threshold", PROP_FLOAT, PROP_DISTANCE);
2536 RNA_def_property_float_sdna(prop, NULL, "doublimit");
2537 RNA_def_property_ui_text(prop, "Double Threshold", "Limit for removing duplicates and 'Auto Merge'");
2538 RNA_def_property_range(prop, 0.0, 1.0);
2539 RNA_def_property_ui_range(prop, 0.0, 0.1, 0.01, 6);
2542 prop = RNA_def_property(srna, "transform_pivot_point", PROP_ENUM, PROP_NONE);
2543 RNA_def_property_enum_sdna(prop, NULL, "transform_pivot_point");
2544 RNA_def_property_enum_items(prop, rna_enum_transform_pivot_items_full);
2545 RNA_def_property_ui_text(prop, "Pivot Point", "Pivot center for rotation/scaling");
2546 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
2548 prop = RNA_def_property(srna, "use_transform_pivot_point_align", PROP_BOOLEAN, PROP_NONE);
2549 RNA_def_property_boolean_sdna(prop, NULL, "transform_flag", SCE_XFORM_AXIS_ALIGN);
2550 RNA_def_property_ui_text(prop, "Align", "Manipulate center points (object, pose and weight paint mode only)");
2551 RNA_def_property_ui_icon(prop, ICON_CENTER_ONLY, 0);
2552 RNA_def_property_update(prop, NC_SCENE, NULL);
2554 prop = RNA_def_property(srna, "use_mesh_automerge", PROP_BOOLEAN, PROP_NONE);
2555 RNA_def_property_boolean_sdna(prop, NULL, "automerge", 0);
2556 RNA_def_property_ui_text(prop, "AutoMerge Editing", "Automatically merge vertices moved to the same location");
2557 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
2559 prop = RNA_def_property(srna, "use_snap", PROP_BOOLEAN, PROP_NONE);
2560 RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP);
2561 RNA_def_property_ui_text(prop, "Snap", "Snap during transform");
2562 RNA_def_property_ui_icon(prop, ICON_SNAP_OFF, 1);
2563 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
2565 prop = RNA_def_property(srna, "use_snap_align_rotation", PROP_BOOLEAN, PROP_NONE);
2566 RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_ROTATE);
2567 RNA_def_property_ui_text(prop, "Align Rotation to Target", "Align rotation with the snapping target");
2568 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
2570 prop = RNA_def_property(srna, "use_snap_grid_absolute", PROP_BOOLEAN, PROP_NONE);
2571 RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_ABS_GRID);
2572 RNA_def_property_ui_text(prop, "Absolute Grid Snap",
2573 "Absolute grid alignment while translating (based on the pivot center)");
2574 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
2576 prop = RNA_def_property(srna, "snap_elements", PROP_ENUM, PROP_NONE);
2577 RNA_def_property_enum_bitflag_sdna(prop, NULL, "snap_mode");
2578 RNA_def_property_enum_items(prop, rna_enum_snap_element_items);
2579 RNA_def_property_enum_funcs(prop, NULL, "rna_ToolSettings_snap_mode_set", NULL);
2580 RNA_def_property_flag(prop, PROP_ENUM_FLAG);
2581 RNA_def_property_ui_text(prop, "Snap Element", "Type of element to snap to");
2582 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
2584 /* node editor uses own set of snap modes */
2585 prop = RNA_def_property(srna, "snap_node_element", PROP_ENUM, PROP_NONE);
2586 RNA_def_property_enum_bitflag_sdna(prop, NULL, "snap_node_mode");
2587 RNA_def_property_enum_items(prop, rna_enum_snap_node_element_items);
2588 RNA_def_property_ui_text(prop, "Snap Node Element", "Type of element to snap to");
2589 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
2591 /* image editor uses own set of snap modes */
2592 prop = RNA_def_property(srna, "snap_uv_element", PROP_ENUM, PROP_NONE);
2593 RNA_def_property_enum_bitflag_sdna(prop, NULL, "snap_uv_mode");
2594 RNA_def_property_enum_items(prop, snap_uv_element_items);
2595 RNA_def_property_ui_text(prop, "Snap UV Element", "Type of element to snap to");
2596 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
2598 prop = RNA_def_property(srna, "snap_target", PROP_ENUM, PROP_NONE);
2599 RNA_def_property_enum_sdna(prop, NULL, "snap_target");
2600 RNA_def_property_enum_items(prop, rna_enum_snap_target_items);
2601 RNA_def_property_ui_text(prop, "Snap Target", "Which part to snap onto the target");
2602 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
2604 prop = RNA_def_property(srna, "use_snap_peel_object", PROP_BOOLEAN, PROP_NONE);
2605 RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_PEEL_OBJECT);
2606 RNA_def_property_ui_text(prop, "Snap Peel Object", "Consider objects as whole when finding volume center");
2607 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
2609 prop = RNA_def_property(srna, "use_snap_project", PROP_BOOLEAN, PROP_NONE);
2610 RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_PROJECT);
2611 RNA_def_property_ui_text(prop, "Project Individual Elements",
2612 "Project individual elements on the surface of other objects");
2613 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
2615 prop = RNA_def_property(srna, "use_snap_self", PROP_BOOLEAN, PROP_NONE);
2616 RNA_def_property_boolean_negative_sdna(prop, NULL, "snap_flag", SCE_SNAP_NO_SELF);
2617 RNA_def_property_ui_text(prop, "Project onto Self", "Snap onto itself (Edit Mode Only)");
2618 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
2620 prop = RNA_def_property(srna, "use_snap_translate", PROP_BOOLEAN, PROP_NONE);
2621 RNA_def_property_boolean_sdna(prop, NULL, "snap_transform_mode_flag", SCE_SNAP_TRANSFORM_MODE_TRANSLATE);
2622 RNA_def_property_ui_text(prop, "Use Snap for Translation",
2623 "Move is affected by snapping settings");
2624 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
2626 prop = RNA_def_property(srna, "use_snap_rotate", PROP_BOOLEAN, PROP_NONE);
2627 RNA_def_property_boolean_sdna(prop, NULL, "snap_transform_mode_flag", SCE_SNAP_TRANSFORM_MODE_ROTATE);
2628 RNA_def_property_boolean_default(prop, false);
2629 RNA_def_property_ui_text(prop, "Use Snap for Rotation",
2630 "Rotate is affected by the snapping settings");
2631 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
2633 prop = RNA_def_property(srna, "use_snap_scale", PROP_BOOLEAN, PROP_NONE);
2634 RNA_def_property_boolean_sdna(prop, NULL, "snap_transform_mode_flag", SCE_SNAP_TRANSFORM_MODE_SCALE);
2635 RNA_def_property_boolean_default(prop, false);
2636 RNA_def_property_ui_text(prop, "Use Snap for Scale",
2637 "Scale is affected by snapping settings");
2638 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
2640 prop = RNA_def_property(srna, "use_gizmo_mode", PROP_ENUM, PROP_NONE);
2641 RNA_def_property_enum_sdna(prop, NULL, "gizmo_flag");
2642 RNA_def_property_enum_items(prop, rna_enum_gizmo_items);
2643 RNA_def_property_flag(prop, PROP_ENUM_FLAG);
2644 RNA_def_property_ui_text(prop, "Gizmo Mode", "");
2645 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ToolSettings_gizmo_flag_update");
2648 prop = RNA_def_property(srna, "use_gpencil_draw_additive", PROP_BOOLEAN, PROP_NONE);
2649 RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_RETAIN_LAST);
2650 RNA_def_property_ui_text(prop, "Use Additive Drawing",
2651 "When creating new frames, the strokes from the previous/active frame "
2652 "are included as the basis for the new one");
2653 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
2655 prop = RNA_def_property(srna, "use_gpencil_draw_onback", PROP_BOOLEAN, PROP_NONE);
2656 RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_PAINT_ONBACK);
2657 RNA_def_property_ui_text(prop, "Draw Strokes on Back",
2658 "When draw new strokes, the new stroke is drawn below of all strokes in the layer");
2659 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
2661 prop = RNA_def_property(srna, "use_gpencil_thumbnail_list", PROP_BOOLEAN, PROP_NONE);
2662 RNA_def_property_boolean_negative_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_THUMBNAIL_LIST);
2663 RNA_def_property_ui_text(prop, "Compact List",
2664 "Show compact list of color instead of thumbnails");
2665 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
2667 prop = RNA_def_property(srna, "use_gpencil_weight_data_add", PROP_BOOLEAN, PROP_NONE);
2668 RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_CREATE_WEIGHTS);
2669 RNA_def_property_ui_text(prop, "Add weight data for new strokes",
2670 "When creating new strokes, the weight data is added according to the current vertex group and weight, "
2671 "if no vertex group selected, weight is not added");
2672 RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
2674 prop = RNA_def_property(srna, "gpencil_sculpt", PROP_POINTER, PROP_NONE);
2675 RNA_def_property_pointer_sdna(prop, NULL, "gp_sculpt");
2676 RNA_def_property_struct_type(prop, "GPencilSculptSettings");
2677 RNA_def_property_ui_text(prop, "Grease Pencil Sculpt",
2678 "Settings for stroke sculpting tools and brushes");
2680 prop = RNA_def_property(srna, "gpencil_interpolate", PROP_POINTER, PROP_NONE);
2681 RNA_def_property_pointer_sdna(prop, NULL, "gp_interpolate");
2682 RNA_def_property_struct_type(prop, "GPencilInterpolateSettings");
2683 RNA_def_property_ui_text(prop, "Grease Pencil Interpolate",
2684 "Settings for Grease Pencil Interpolation tools");
2686 /* Grease Pencil - 3D View Stroke Placement */
2687 prop = RNA_def_property(srna, "gpencil_stroke_placement_view3d", PROP_ENUM, PROP_NONE);
2688 RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_v3d_align");
2689 RNA_def_property_enum_items(prop, gpencil_stroke_placement_items);
2690 RNA_def_property_ui_text(prop, "Stroke Placement (3D View)", "");
2691 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
2693 prop = RNA_def_property(srna, "gpencil_stroke_snap_mode", PROP_ENUM, PROP_NONE);
2694 RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_v3d_align");
2695 RNA_def_property_enum_items(prop, gpencil_stroke_snap_items);
2696 RNA_def_property_ui_text(prop, "Stroke Snap", "");
2697 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
2699 prop = RNA_def_property(srna, "use_gpencil_stroke_endpoints", PROP_BOOLEAN, PROP_NONE);
2700 RNA_def_property_boolean_sdna(prop, NULL, "gpencil_v3d_align", GP_PROJECT_DEPTH_STROKE_ENDPOINTS);
2701 RNA_def_property_ui_text(prop, "Only Endpoints", "Only use the first and last parts of the stroke for snapping");
2702 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
2704 /* Grease Pencil - Select mode */
2705 prop = RNA_def_property(srna, "gpencil_selectmode", PROP_ENUM, PROP_NONE);
2706 RNA_def_property_enum_sdna(prop, NULL, "gpencil_selectmode");
2707 RNA_def_property_enum_items(prop, gpencil_selectmode_items);
2708 RNA_def_property_ui_text(prop, "Select Mode", "");
2709 RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
2711 /* Annotations - 2D Views Stroke Placement */
2712 prop = RNA_def_property(srna, "annotation_stroke_placement_view2d", PROP_ENUM, PROP_NONE);
2713 RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_v2d_align");
2714 RNA_def_property_enum_items(prop, annotation_stroke_placement_items);
2715 RNA_def_property_ui_text(prop, "Stroke Placement (2D View)", "");
2716 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
2718 /* Annotations - Sequencer Preview Stroke Placement */
2719 prop = RNA_def_property(srna, "annotation_stroke_placement_sequencer_preview", PROP_ENUM, PROP_NONE);
2720 RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_seq_align");
2721 RNA_def_property_enum_items(prop, annotation_stroke_placement_items);
2722 RNA_def_property_ui_text(prop, "Stroke Placement (Sequencer Preview)", "");
2723 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
2725 /* Annotations - Image Editor Stroke Placement */
2726 prop = RNA_def_property(srna, "annotation_stroke_placement_image_editor", PROP_ENUM, PROP_NONE);
2727 RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_ima_align");
2728 RNA_def_property_enum_items(prop, annotation_stroke_placement_items);
2729 RNA_def_property_ui_text(prop, "Stroke Placement (Image Editor)", "");
2730 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
2732 /* Annotations - 3D View Stroke Placement */
2733 /* XXX: Do we need to decouple the stroke_endpoints setting too? */
2734 prop = RNA_def_property(srna, "annotation_stroke_placement_view3d", PROP_ENUM, PROP_NONE);
2735 RNA_def_property_enum_bitflag_sdna(prop, NULL, "annotate_v3d_align");
2736 RNA_def_property_enum_items(prop, annotation_stroke_placement_items);
2737 RNA_def_property_ui_text(prop, "Annotation Stroke Placement (3D View)", "How annotation strokes are orientated in 3D space");
2738 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
2740 /* Annotations - Stroke Thickness */
2741 prop = RNA_def_property(srna, "annotation_thickness", PROP_INT, PROP_PIXEL);
2742 RNA_def_property_int_sdna(prop, NULL, "annotate_thickness");
2743 RNA_def_property_range(prop, 1, 10);
2744 RNA_def_property_ui_text(prop, "Annotation Stroke Thickness", "Thickness of annotation strokes");
2745 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
2748 prop = RNA_def_property(srna, "use_keyframe_insert_auto", PROP_BOOLEAN, PROP_NONE);
2749 RNA_def_property_boolean_sdna(prop, NULL, "autokey_mode", AUTOKEY_ON);
2750 RNA_def_property_ui_text(prop, "Auto Keying", "Automatic keyframe insertion for Objects and Bones");
2751 RNA_def_property_ui_icon(prop, ICON_REC, 0);
2753 prop = RNA_def_property(srna, "auto_keying_mode", PROP_ENUM, PROP_NONE);
2754 RNA_def_property_enum_bitflag_sdna(prop, NULL, "autokey_mode");
2755 RNA_def_property_enum_items(prop, auto_key_items);
2756 RNA_def_property_ui_text(prop, "Auto-Keying Mode", "Mode of automatic keyframe insertion for Objects and Bones");
2758 prop = RNA_def_property(srna, "use_record_with_nla", PROP_BOOLEAN, PROP_NONE);
2759 RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", ANIMRECORD_FLAG_WITHNLA);
2760 RNA_def_property_ui_text(prop, "Layered",
2761 "Add a new NLA Track + Strip for every loop/pass made over the animation "
2762 "to allow non-destructive tweaking");
2764 prop = RNA_def_property(srna, "use_keyframe_insert_keyingset", PROP_BOOLEAN, PROP_NONE);
2765 RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_ONLYKEYINGSET);
2766 RNA_def_property_ui_text(prop, "Auto Keyframe Insert Keying Set",
2767 "Automatic keyframe insertion using active Keying Set only");
2768 RNA_def_property_ui_icon(prop, ICON_KEYINGSET, 0);
2770 prop = RNA_def_property(srna, "use_keyframe_cycle_aware", PROP_BOOLEAN, PROP_NONE);
2771 RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_CYCLEAWARE);
2772 RNA_def_property_ui_text(prop, "Cycle-Aware Keying",
2773 "For channels with cyclic extrapolation, keyframe insertion is automatically "
2774 "remapped inside the cycle time range, and keeps ends in sync");
2777 prop = RNA_def_property(srna, "keyframe_type", PROP_ENUM, PROP_NONE);
2778 RNA_def_property_enum_sdna(prop, NULL, "keyframe_type");
2779 RNA_def_property_enum_items(prop, rna_enum_beztriple_keyframe_type_items);
2780 RNA_def_property_ui_text(prop, "New Keyframe Type", "Type of keyframes to create when inserting keyframes");
2783 prop = RNA_def_property(srna, "uv_select_mode", PROP_ENUM, PROP_NONE);
2784 RNA_def_property_enum_sdna(prop, NULL, "uv_selectmode");
2785 RNA_def_property_enum_items(prop, rna_enum_mesh_select_mode_uv_items);
2786 RNA_def_property_ui_text(prop, "UV Selection Mode", "UV selection and display mode");
2787 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
2789 prop = RNA_def_property(srna, "use_uv_select_sync", PROP_BOOLEAN, PROP_NONE);
2790 RNA_def_property_boolean_sdna(prop, NULL, "uv_flag", UV_SYNC_SELECTION);
2791 RNA_def_property_ui_text(prop, "UV Sync Selection", "Keep UV and edit mode mesh selection in sync");
2792 RNA_def_property_ui_icon(prop, ICON_UV_SYNC_SELECT, 0);
2793 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
2795 prop = RNA_def_property(srna, "show_uv_local_view", PROP_BOOLEAN, PROP_NONE);
2796 RNA_def_property_boolean_sdna(prop, NULL, "uv_flag", UV_SHOW_SAME_IMAGE);
2797 RNA_def_property_ui_text(prop, "UV Local View", "Display only faces with the currently displayed image assigned");
2798 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
2801 prop = RNA_def_property(srna, "mesh_select_mode", PROP_BOOLEAN, PROP_NONE);
2802 RNA_def_property_boolean_sdna(prop, NULL, "selectmode", 1);
2803 RNA_def_property_array(prop, 3);
2804 RNA_def_property_boolean_funcs(prop, NULL, "rna_Scene_editmesh_select_mode_set");
2805 RNA_def_property_ui_text(prop, "Mesh Selection Mode", "Which mesh elements selection works on");
2806 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
2807 RNA_def_property_update(prop, 0, "rna_Scene_editmesh_select_mode_update");
2809 prop = RNA_def_property(srna, "vertex_group_weight", PROP_FLOAT, PROP_FACTOR);
2810 RNA_def_property_float_sdna(prop, NULL, "vgroup_weight");
2811 RNA_def_property_ui_text(prop, "Vertex Group Weight", "Weight to assign in vertex groups");
2813 /* use with MESH_OT_shortest_path_pick */
2814 prop = RNA_def_property(srna, "edge_path_mode", PROP_ENUM, PROP_NONE);
2815 RNA_def_property_enum_sdna(prop, NULL, "edge_mode");
2816 RNA_def_property_enum_items(prop, edge_tag_items);
2817 RNA_def_property_ui_text(prop, "Edge Tag Mode", "The edge flag to tag when selecting the shortest path");
2819 prop = RNA_def_property(srna, "edge_path_live_unwrap", PROP_BOOLEAN, PROP_NONE);
2820 RNA_def_property_boolean_sdna(prop, NULL, "edge_mode_live_unwrap", 1);
2821 RNA_def_property_ui_text(prop, "Live Unwrap", "Changing edges seam re-calculates UV unwrap");
2823 prop = RNA_def_property(srna, "normal_vector", PROP_FLOAT, PROP_XYZ);
2824 RNA_def_property_ui_text(prop, "Normal Vector", "Normal Vector used to copy, add or multiply");
2825 RNA_def_property_ui_range(prop, -10000.0, 10000.0, 1, 3);
2827 prop = RNA_def_property(srna, "face_strength", PROP_ENUM, PROP_NONE);
2828 RNA_def_property_enum_items(prop, mod_weighted_strength);
2829 RNA_def_property_ui_text(prop, "Face Strength", "Set strength of face to specified value");
2831 /* Unified Paint Settings */
2832 prop = RNA_def_property(srna, "unified_paint_settings", PROP_POINTER, PROP_NONE);
2833 RNA_def_property_flag(prop, PROP_NEVER_NULL);
2834 RNA_def_property_struct_type(prop, "UnifiedPaintSettings");
2835 RNA_def_property_ui_text(prop, "Unified Paint Settings", NULL);
2837 /* Curve Paint Settings */
2838 prop = RNA_def_property(srna, "curve_paint_settings", PROP_POINTER, PROP_NONE);
2839 RNA_def_property_flag(prop, PROP_NEVER_NULL);
2840 RNA_def_property_struct_type(prop, "CurvePaintSettings");
2841 RNA_def_property_ui_text(prop, "Curve Paint Settings", NULL);
2843 /* Mesh Statistics */
2844 prop = RNA_def_property(srna, "statvis", PROP_POINTER, PROP_NONE);
2845 RNA_def_property_flag(prop, PROP_NEVER_NULL);
2846 RNA_def_property_struct_type(prop, "MeshStatVis");
2847 RNA_def_property_ui_text(prop, "Mesh Statistics Visualization", NULL);
2850 static void rna_def_unified_paint_settings(BlenderRNA *brna)
2855 srna = RNA_def_struct(brna, "UnifiedPaintSettings", NULL);
2856 RNA_def_struct_path_func(srna, "rna_UnifiedPaintSettings_path");
2857 RNA_def_struct_ui_text(srna, "Unified Paint Settings", "Overrides for some of the active brush's settings");
2859 /* high-level flags to enable or disable unified paint settings */
2860 prop = RNA_def_property(srna, "use_unified_size", PROP_BOOLEAN, PROP_NONE);
2861 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_SIZE);
2862 RNA_def_property_ui_text(prop, "Use Unified Radius",
2863 "Instead of per-brush radius, the radius is shared across brushes");
2865 prop = RNA_def_property(srna, "use_unified_strength", PROP_BOOLEAN, PROP_NONE);
2866 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_ALPHA);
2867 RNA_def_property_ui_text(prop, "Use Unified Strength",
2868 "Instead of per-brush strength, the strength is shared across brushes");
2870 prop = RNA_def_property(srna, "use_unified_weight", PROP_BOOLEAN, PROP_NONE);
2871 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_WEIGHT);
2872 RNA_def_property_ui_text(prop, "Use Unified Weight",
2873 "Instead of per-brush weight, the weight is shared across brushes");
2875 prop = RNA_def_property(srna, "use_unified_color", PROP_BOOLEAN, PROP_NONE);
2876 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_COLOR);
2877 RNA_def_property_ui_text(prop, "Use Unified Color",
2878 "Instead of per-brush color, the color is shared across brushes");
2880 /* unified paint settings that override the equivalent settings
2881 * from the active brush */
2882 prop = RNA_def_property(srna, "size", PROP_INT, PROP_PIXEL);
2883 RNA_def_property_int_funcs(prop, NULL, "rna_UnifiedPaintSettings_size_set", NULL);
2884 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
2885 RNA_def_property_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS * 10);
2886 RNA_def_property_ui_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS, 1, -1);
2887 RNA_def_property_ui_text(prop, "Radius", "Radius of the brush");
2888 RNA_def_property_update(prop, 0, "rna_UnifiedPaintSettings_radius_update");
2890 prop = RNA_def_property(srna, "unprojected_radius", PROP_FLOAT, PROP_DISTANCE);
2891 RNA_def_property_float_funcs(prop, NULL, "rna_UnifiedPaintSettings_unprojected_radius_set", NULL);
2892 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
2893 RNA_def_property_range(prop, 0.001, FLT_MAX);
2894 RNA_def_property_ui_range(prop, 0.001, 1, 0, -1);
2895 RNA_def_property_ui_text(prop, "Unprojected Radius", "Radius of brush in Blender units");
2896 RNA_def_property_update(prop, 0, "rna_UnifiedPaintSettings_radius_update");
2898 prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
2899 RNA_def_property_float_sdna(prop, NULL, "alpha");
2900 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
2901 RNA_def_property_float_default(prop, 0.5f);
2902 RNA_def_property_range(prop, 0.0f, 10.0f);
2903 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
2904 RNA_def_property_ui_text(prop, "Strength", "How powerful the effect of the brush is when applied");
2905 RNA_def_property_update(prop, 0, "rna_UnifiedPaintSettings_update");
2907 prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_FACTOR);
2908 RNA_def_property_float_sdna(prop, NULL, "weight");
2909 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
2910 RNA_def_property_float_default(prop, 0.5f);
2911 RNA_def_property_range(prop, 0.0f, 1.0f);
2912 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
2913 RNA_def_property_ui_text(prop, "Weight", "Weight to assign in vertex groups");
2914 RNA_def_property_update(prop, 0, "rna_UnifiedPaintSettings_update");
2916 prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
2917 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
2918 RNA_def_property_range(prop, 0.0, 1.0);
2919 RNA_def_property_float_sdna(prop, NULL, "rgb");
2920 RNA_def_property_ui_text(prop, "Color", "");
2921 RNA_def_property_update(prop, 0, "rna_UnifiedPaintSettings_update");
2923 prop = RNA_def_property(srna, "secondary_color", PROP_FLOAT, PROP_COLOR_GAMMA);
2924 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
2925 RNA_def_property_range(prop, 0.0, 1.0);
2926 RNA_def_property_float_sdna(prop, NULL, "secondary_rgb");
2927 RNA_def_property_ui_text(prop, "Secondary Color", "");
2928 RNA_def_property_update(prop, 0, "rna_UnifiedPaintSettings_update");
2930 prop = RNA_def_property(srna, "use_pressure_size", PROP_BOOLEAN, PROP_NONE);
2931 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_BRUSH_SIZE_PRESSURE);
2932 RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
2933 RNA_def_property_ui_text(prop, "Size Pressure", "Enable tablet pressure sensitivity for size");
2935 prop = RNA_def_property(srna, "use_pressure_strength", PROP_BOOLEAN, PROP_NONE);
2936 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_BRUSH_ALPHA_PRESSURE);
2937 RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
2938 RNA_def_property_ui_text(prop, "Strength Pressure", "Enable tablet pressure sensitivity for strength");
2940 prop = RNA_def_property(srna, "use_locked_size", PROP_BOOLEAN, PROP_NONE);
2941 RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_BRUSH_LOCK_SIZE);
2942 RNA_def_property_ui_text(prop, "Use Blender Units",
2943 "When locked brush stays same size relative to object; "
2944 "when unlocked brush size is given in pixels");
2945 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, true);
2949 static void rna_def_curve_paint_settings(BlenderRNA *brna)
2954 srna = RNA_def_struct(brna, "CurvePaintSettings", NULL);
2955 RNA_def_struct_path_func(srna, "rna_CurvePaintSettings_path");
2956 RNA_def_struct_ui_text(srna, "Curve Paint Settings", "");
2958 static const EnumPropertyItem curve_type_items[] = {
2959 {CU_POLY, "POLY", 0, "Poly", ""},
2960 {CU_BEZIER, "BEZIER", 0, "Bezier", ""},
2961 {0, NULL, 0, NULL, NULL},
2964 prop = RNA_def_property(srna, "curve_type", PROP_ENUM, PROP_NONE);
2965 RNA_def_property_enum_sdna(prop, NULL, "curve_type");
2966 RNA_def_property_enum_items(prop, curve_type_items);
2967 RNA_def_property_ui_text(prop, "Type", "Type of curve to use for new strokes");
2969 prop = RNA_def_property(srna, "use_corners_detect", PROP_BOOLEAN, PROP_NONE);
2970 RNA_def_property_boolean_sdna(prop, NULL, "flag", CURVE_PAINT_FLAG_CORNERS_DETECT);
2971 RNA_def_property_ui_text(prop, "Detect Corners", "Detect corners and use non-aligned handles");
2973 prop = RNA_def_property(srna, "use_pressure_radius", PROP_BOOLEAN, PROP_NONE);
2974 RNA_def_property_boolean_sdna(prop, NULL, "flag", CURVE_PAINT_FLAG_PRESSURE_RADIUS);
2975 RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
2976 RNA_def_property_ui_text(prop, "Use Pressure", "Map tablet pressure to curve radius");
2978 prop = RNA_def_property(srna, "use_stroke_endpoints", PROP_BOOLEAN, PROP_NONE);
2979 RNA_def_property_boolean_sdna(prop, NULL, "flag", CURVE_PAINT_FLAG_DEPTH_STROKE_ENDPOINTS);
2980 RNA_def_property_ui_text(prop, "Only First", "Use the start of the stroke for the depth");
2982 prop = RNA_def_property(srna, "use_offset_absolute", PROP_BOOLEAN, PROP_NONE);
2983 RNA_def_property_boolean_sdna(prop, NULL, "flag", CURVE_PAINT_FLAG_DEPTH_STROKE_OFFSET_ABS);
2984 RNA_def_property_ui_text(prop, "Absolute Offset", "Apply a fixed offset (don't scale by the radius)");
2986 prop = RNA_def_property(srna, "error_threshold", PROP_INT, PROP_PIXEL);
2987 RNA_def_property_range(prop, 1, 100);
2988 RNA_def_property_ui_text(prop, "Tolerance", "Allow deviation for a smoother, less precise line");
2990 prop = RNA_def_property(srna, "fit_method", PROP_ENUM, PROP_PIXEL);
2991 RNA_def_property_enum_sdna(prop, NULL, "fit_method");
2992 RNA_def_property_enum_items(prop, rna_enum_curve_fit_method_items);
2993 RNA_def_property_ui_text(prop, "Method", "Curve fitting method");
2995 prop = RNA_def_property(srna, "corner_angle", PROP_FLOAT, PROP_ANGLE);
2996 RNA_def_property_range(prop, 0, M_PI);
2997 RNA_def_property_ui_text(prop, "Corner Angle", "Angles above this are considered corners");
2999 prop = RNA_def_property(srna, "radius_min", PROP_FLOAT, PROP_NONE);
3000 RNA_def_property_range(prop, 0.0, 100.0);
3001 RNA_def_property_ui_range(prop, 0.0f, 10.0, 10, 2);
3002 RNA_def_property_ui_text(prop, "Radius Min",
3003 "Minimum radius when the minimum pressure is applied (also the minimum when tapering)");
3005 prop = RNA_def_property(srna, "radius_max", PROP_FLOAT, PROP_NONE);
3006 RNA_def_property_range(prop, 0.0, 100.0);
3007 RNA_def_property_ui_range(prop, 0.0f, 10.0, 10, 2);
3008 RNA_def_property_ui_text(prop, "Radius Max",
3009 "Radius to use when the maximum pressure is applied (or when a tablet isn't used)");
3011 prop = RNA_def_property(srna, "radius_taper_start", PROP_FLOAT, PROP_NONE);
3012 RNA_def_property_range(prop, 0.0, 1.0);
3013 RNA_def_property_ui_range(prop, 0.0f, 1.0, 1, 2);
3014 RNA_def_property_ui_text(prop, "Radius Min", "Taper factor for the radius of each point along the curve");
3016 prop = RNA_def_property(srna, "radius_taper_end", PROP_FLOAT, PROP_NONE);
3017 RNA_def_property_range(prop, 0.0, 10.0);
3018 RNA_def_property_ui_range(prop, 0.0f, 1.0, 1, 2);
3019 RNA_def_property_ui_text(prop, "Radius Max", "Taper factor for the radius of each point along the curve");
3021 prop = RNA_def_property(srna, "surface_offset", PROP_FLOAT, PROP_NONE);
3022 RNA_def_property_range(prop, -10.0, 10.0);
3023 RNA_def_property_ui_range(prop, -1.0f, 1.0, 1, 2);
3024 RNA_def_property_ui_text(prop, "Offset", "Offset the stroke from the surface");
3026 static const EnumPropertyItem depth_mode_items[] = {
3027 {CURVE_PAINT_PROJECT_CURSOR, "CURSOR", 0, "Cursor", ""},
3028 {CURVE_PAINT_PROJECT_SURFACE, "SURFACE", 0, "Surface", ""},
3029 {0, NULL, 0, NULL, NULL},
3032 prop = RNA_def_property(srna, "depth_mode", PROP_ENUM, PROP_NONE);
3033 RNA_def_property_enum_sdna(prop, NULL, "depth_mode");
3034 RNA_def_property_enum_items(prop, depth_mode_items);
3035 RNA_def_property_ui_text(prop, "Depth", "Method of projecting depth");
3037 static const EnumPropertyItem surface_plane_items[] = {
3038 {CURVE_PAINT_SURFACE_PLANE_NORMAL_VIEW, "NORMAL_VIEW", 0, "Normal/View", "Display perpendicular to the surface"},
3039 {CURVE_PAINT_SURFACE_PLANE_NORMAL_SURFACE, "NORMAL_SURFACE", 0, "Normal/Surface", "Display aligned to the surface"},
3040 {CURVE_PAINT_SURFACE_PLANE_VIEW, "VIEW", 0, "View", "Display aligned to the viewport"},
3041 {0, NULL, 0, NULL, NULL},};
3043 prop = RNA_def_property(srna, "surface_plane", PROP_ENUM, PROP_NONE);
3044 RNA_def_property_enum_sdna(prop, NULL, "surface_plane");
3045 RNA_def_property_enum_items(prop, surface_plane_items);
3046 RNA_def_property_ui_text(prop, "Plane", "Plane for projected stroke");
3049 static void rna_def_statvis(BlenderRNA *brna)
3054 static const EnumPropertyItem stat_type[] = {
3055 {SCE_STATVIS_OVERHANG, "OVERHANG", 0, "Overhang", ""},
3056 {SCE_STATVIS_THICKNESS, "THICKNESS", 0, "Thickness", ""},
3057 {SCE_STATVIS_INTERSECT, "INTERSECT", 0, "Intersect", ""},
3058 {SCE_STATVIS_DISTORT, "DISTORT", 0, "Distortion", ""},
3059 {SCE_STATVIS_SHARP, "SHARP", 0, "Sharp", ""},
3060 {0, NULL, 0, NULL, NULL},
3063 srna = RNA_def_struct(brna, "MeshStatVis", NULL);
3064 RNA_def_struct_path_func(srna, "rna_MeshStatVis_path");
3065 RNA_def_struct_ui_text(srna, "Mesh Visualize Statistics", "");
3067 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
3068 RNA_def_property_enum_items(prop, stat_type);
3069 RNA_def_property_ui_text(prop, "Type", "Type of data to visualize/check");
3070 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3071 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
3075 prop = RNA_def_property(srna, "overhang_min", PROP_FLOAT, PROP_ANGLE);
3076 RNA_def_property_float_sdna(prop, NULL, "overhang_min");
3077 RNA_def_property_float_default(prop, 0.5f);
3078 RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
3079 RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 0.001, 3);
3080 RNA_def_property_ui_text(prop, "Overhang Min", "Minimum angle to display");
3081 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3082 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
3084 prop = RNA_def_property(srna, "overhang_max", PROP_FLOAT, PROP_ANGLE);
3085 RNA_def_property_float_sdna(prop, NULL, "overhang_max");
3086 RNA_def_property_float_default(prop, 0.5f);
3087 RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
3088 RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 10, 3);
3089 RNA_def_property_ui_text(prop, "Overhang Max", "Maximum angle to display");
3090 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3091 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
3093 prop = RNA_def_property(srna, "overhang_axis", PROP_ENUM, PROP_NONE);
3094 RNA_def_property_enum_sdna(prop, NULL, "overhang_axis");
3095 RNA_def_property_enum_items(prop, rna_enum_object_axis_items);
3096 RNA_def_property_ui_text(prop, "Axis", "");
3097 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3098 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
3102 prop = RNA_def_property(srna, "thickness_min", PROP_FLOAT, PROP_DISTANCE);
3103 RNA_def_property_float_sdna(prop, NULL, "thickness_min");
3104 RNA_def_property_float_default(prop, 0.5f);
3105 RNA_def_property_range(prop, 0.0f, 1000.0);
3106 RNA_def_property_ui_range(prop, 0.0f, 100.0, 0.001, 3);
3107 RNA_def_property_ui_text(prop, "Thickness Min", "Minimum for measuring thickness");
3108 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3109 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
3111 prop = RNA_def_property(srna, "thickness_max", PROP_FLOAT, PROP_DISTANCE);
3112 RNA_def_property_float_sdna(prop, NULL, "thickness_max");
3113 RNA_def_property_float_default(prop, 0.5f);
3114 RNA_def_property_range(prop, 0.0f, 1000.0);
3115 RNA_def_property_ui_range(prop, 0.0f, 100.0, 0.001, 3);
3116 RNA_def_property_ui_text(prop, "Thickness Max", "Maximum for measuring thickness");
3117 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3118 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
3120 prop = RNA_def_property(srna, "thickness_samples", PROP_INT, PROP_UNSIGNED);
3121 RNA_def_property_int_sdna(prop, NULL, "thickness_samples");
3122 RNA_def_property_range(prop, 1, 32);
3123 RNA_def_property_ui_text(prop, "Samples", "Number of samples to test per face");
3124 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3125 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
3128 prop = RNA_def_property(srna, "distort_min", PROP_FLOAT, PROP_ANGLE);
3129 RNA_def_property_float_sdna(prop, NULL, "distort_min");
3130 RNA_def_property_float_default(prop, 0.5f);
3131 RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
3132 RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 10, 3);
3133 RNA_def_property_ui_text(prop, "Distort Min", "Minimum angle to display");
3134 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3135 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
3137 prop = RNA_def_property(srna, "distort_max", PROP_FLOAT, PROP_ANGLE);
3138 RNA_def_property_float_sdna(prop, NULL, "distort_max");
3139 RNA_def_property_float_default(prop, 0.5f);
3140 RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
3141 RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 10, 3);
3142 RNA_def_property_ui_text(prop, "Distort Max", "Maximum angle to display");
3143 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3144 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
3147 prop = RNA_def_property(srna, "sharp_min", PROP_FLOAT, PROP_ANGLE);
3148 RNA_def_property_float_sdna(prop, NULL, "sharp_min");
3149 RNA_def_property_float_default(prop, 0.5f);
3150 RNA_def_property_range(prop, -DEG2RADF(180.0f), DEG2RADF(180.0f));
3151 RNA_def_property_ui_range(prop, -DEG2RADF(180.0f), DEG2RADF(180.0f), 10, 3);
3152 RNA_def_property_ui_text(prop, "Distort Min", "Minimum angle to display");
3153 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3154 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
3156 prop = RNA_def_property(srna, "sharp_max", PROP_FLOAT, PROP_ANGLE);
3157 RNA_def_property_float_sdna(prop, NULL, "sharp_max");
3158 RNA_def_property_float_default(prop, 0.5f);
3159 RNA_def_property_range(prop, -DEG2RADF(180.0f), DEG2RADF(180.0f));
3160 RNA_def_property_ui_range(prop, -DEG2RADF(180.0f), DEG2RADF(180.0f), 10, 3);
3161 RNA_def_property_ui_text(prop, "Distort Max", "Maximum angle to display");
3162 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
3163 RNA_def_property_update(prop, 0, "rna_EditMesh_update");
3166 static void rna_def_unit_settings(BlenderRNA *brna)
3171 static const EnumPropertyItem unit_systems[] = {
3172 {USER_UNIT_NONE, "NONE", 0, "None", ""},
3173 {USER_UNIT_METRIC, "METRIC", 0, "Metric", ""},
3174 {USER_UNIT_IMPERIAL, "IMPERIAL", 0, "Imperial", ""},
3175 {0, NULL, 0, NULL, NULL},
3178 static const EnumPropertyItem rotation_units[] = {
3179 {0, "DEGREES", 0, "Degrees", "Use degrees for measuring angles and rotations"},
3180 {USER_UNIT_ROT_RADIANS, "RADIANS", 0, "Radians", ""},
3181 {0, NULL, 0, NULL, NULL},
3184 srna = RNA_def_struct(brna, "UnitSettings", NULL);
3185 RNA_def_struct_ui_text(srna, "Unit Settings", "");
3186 RNA_def_struct_nested(brna, srna, "Scene");
3187 RNA_def_struct_path_func(srna, "rna_UnitSettings_path");
3190 prop = RNA_def_property(srna, "system", PROP_ENUM, PROP_NONE);
3191 RNA_def_property_enum_items(prop, unit_systems);
3192 RNA_def_property_ui_text(prop, "Unit System", "The unit system to use for button display");
3193 RNA_def_property_update(prop, NC_WINDOW, "rna_UnitSettings_system_update");
3195 prop = RNA_def_property(srna, "system_rotation", PROP_ENUM, PROP_NONE);
3196 RNA_def_property_enum_items(prop, rotation_units);
3197 RNA_def_property_ui_text(prop, "Rotation Units", "Unit to use for displaying/editing rotation values");
3198 RNA_def_property_update(prop, NC_WINDOW, NULL);
3200 prop = RNA_def_property(srna, "scale_length", PROP_FLOAT, PROP_UNSIGNED);
3201 RNA_def_property_ui_text(prop, "Unit Scale", "Scale to use when converting between blender units and dimensions."
3202 " When working at microscopic or astronomical scale, a small or large unit scale"
3203 " respectively can be used to avoid numerical precision problems");
3204 RNA_def_property_range(prop, 0.00001, 100000.0);
3205 RNA_def_property_ui_range(prop, 0.001, 100.0, 0.1, 6);
3206 RNA_def_property_update(prop, NC_WINDOW, NULL);
3208 prop = RNA_def_property(srna, "use_separate", PROP_BOOLEAN, PROP_NONE);
3209 RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_UNIT_OPT_SPLIT);
3210 RNA_def_property_ui_text(prop, "Separate Units", "Display units in pairs (e.g. 1m 0cm)");
3211 RNA_def_property_update(prop, NC_WINDOW, NULL);
3213 prop = RNA_def_property(srna, "length_unit", PROP_ENUM, PROP_NONE);
3214 RNA_def_property_enum_items(prop, DummyRNA_DEFAULT_items);
3215 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_UnitSettings_length_unit_itemf");
3216 RNA_def_property_ui_text(prop, "Length Unit", "Unit that will be used to display length values");
3217 RNA_def_property_update(prop, NC_WINDOW, NULL);
3219 prop = RNA_def_property(srna, "mass_unit", PROP_ENUM, PROP_NONE);
3220 RNA_def_property_enum_items(prop, DummyRNA_DEFAULT_items);
3221 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_UnitSettings_mass_unit_itemf");
3222 RNA_def_property_ui_text(prop, "Mass Unit", "Unit that will be used to display mass values");
3223 RNA_def_property_update(prop, NC_WINDOW, NULL);
3225 prop = RNA_def_property(srna, "time_unit", PROP_ENUM, PROP_NONE);
3226 RNA_def_property_enum_items(prop, DummyRNA_DEFAULT_items);
3227 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_UnitSettings_time_unit_itemf");
3228 RNA_def_property_ui_text(prop, "Time Unit", "Unit that will be used to display time values");
3229 RNA_def_property_update(prop, NC_WINDOW, NULL);
3232 void rna_def_view_layer_common(StructRNA *srna, const bool scene)
3236 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
3237 if (scene) RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ViewLayer_name_set");
3238 else RNA_def_property_string_sdna(prop, NULL, "name");
3239 RNA_def_property_ui_text(prop, "Name", "View layer name");
3240 RNA_def_struct_name_property(srna, prop);
3241 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
3242 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
3245 prop = RNA_def_property(srna, "material_override", PROP_POINTER, PROP_NONE);
3246 RNA_def_property_pointer_sdna(prop, NULL, "mat_override");
3247 RNA_def_property_struct_type(prop, "Material");
3248 RNA_def_property_flag(prop, PROP_EDITABLE);
3249 RNA_def_property_ui_text(prop, "Material Override",
3250 "Material to override all other materials in this view layer");
3251 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_material_override_update");
3253 prop = RNA_def_property(srna, "samples", PROP_INT, PROP_UNSIGNED);
3254 RNA_def_property_ui_text(prop, "Samples", "Override number of render samples for this view layer, "
3255 "0 will use the scene setting");
3256 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
3258 prop = RNA_def_property(srna, "pass_alpha_threshold", PROP_FLOAT, PROP_FACTOR);
3259 RNA_def_property_ui_text(prop, "Alpha Threshold",
3260 "Z, Index, normal, UV and vector passes are only affected by surfaces with "
3261 "alpha transparency equal to or higher than this threshold");
3262 RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
3266 prop = RNA_def_property(srna, "use_zmask", PROP_BOOLEAN, PROP_NONE);
3267 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ZMASK);
3268 RNA_def_property_ui_text(prop, "Zmask", "Only render what's in front of the solid z values");
3269 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
3270 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
3272 prop = RNA_def_property(srna, "invert_zmask", PROP_BOOLEAN, PROP_NONE);
3273 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_NEG_ZMASK);
3274 RNA_def_property_ui_text(prop, "Zmask Negate",
3275 "For Zmask, only render what is behind solid z values instead of in front");
3276 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
3277 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
3279 prop = RNA_def_property(srna, "use_all_z", PROP_BOOLEAN, PROP_NONE);
3280 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ALL_Z);
3281 RNA_def_property_ui_text(prop, "All Z", "Fill in Z values for solid faces in invisible layers, for masking");
3282 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
3283 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
3285 prop = RNA_def_property(srna, "use_solid", PROP_BOOLEAN, PROP_NONE);
3286 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_SOLID);
3287 RNA_def_property_ui_text(prop, "Solid", "Render Solid faces in this Layer");
3288 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
3289 else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
3291 prop = RNA_def_property(srna, "use_halo", PROP_BOOLEAN, PROP_NONE);
3292 RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_HALO);
3293 RNA_def_property_ui_text(prop, "Halo", "Render Halos in this Layer (on top of Solid)");
3294 if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);