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.
21 #include "MEM_guardedalloc.h"
23 #include "BLI_listbase.h"
25 #include "BLI_string.h"
26 #include "BLI_system.h"
27 #include "BLI_utildefines.h"
29 #include "DNA_camera_types.h"
30 #include "DNA_curveprofile_types.h"
31 #include "DNA_gpencil_types.h"
32 #include "DNA_light_types.h"
33 #include "DNA_mesh_types.h"
34 #include "DNA_meshdata_types.h"
35 #include "DNA_object_types.h"
36 #include "DNA_scene_types.h"
37 #include "DNA_screen_types.h"
38 #include "DNA_space_types.h"
39 #include "DNA_userdef_types.h"
40 #include "DNA_windowmanager_types.h"
41 #include "DNA_workspace_types.h"
43 #include "BKE_appdir.h"
44 #include "BKE_brush.h"
45 #include "BKE_colortools.h"
46 #include "BKE_curveprofile.h"
47 #include "BKE_gpencil.h"
48 #include "BKE_layer.h"
49 #include "BKE_lib_id.h"
51 #include "BKE_material.h"
54 #include "BKE_paint.h"
55 #include "BKE_screen.h"
56 #include "BKE_workspace.h"
58 #include "BLO_readfile.h"
60 /* Make preferences read-only, use versioning_userdef.c. */
61 #define U (*((const UserDef *)&U))
64 * Rename if the ID doesn't exist.
66 static ID *rename_id_for_versioning(Main *bmain,
71 /* We can ignore libraries */
72 ListBase *lb = which_libbase(bmain, id_type);
74 LISTBASE_FOREACH (ID *, idtest, lb) {
75 if (idtest->lib == NULL) {
76 if (STREQ(idtest->name + 2, name_src)) {
79 if (STREQ(idtest->name + 2, name_dst)) {
85 BLI_strncpy(id->name + 2, name_dst, sizeof(id->name) - 2);
86 /* We know it's unique, this just sorts. */
87 BLI_libblock_ensure_unique_name(bmain, id->name);
92 static bool blo_is_builtin_template(const char *app_template)
94 /* For all builtin templates shipped with Blender. */
95 return (!app_template ||
96 STR_ELEM(app_template, "2D_Animation", "Sculpting", "VFX", "Video_Editing"));
99 static void blo_update_defaults_screen(bScreen *screen,
100 const char *app_template,
101 const char *workspace_name)
103 /* For all app templates. */
104 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
105 LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
106 /* Some toolbars have been saved as initialized,
107 * we don't want them to have odd zoom-level or scrolling set, see: T47047 */
108 if (ELEM(region->regiontype, RGN_TYPE_UI, RGN_TYPE_TOOLS, RGN_TYPE_TOOL_PROPS)) {
109 region->v2d.flag &= ~V2D_IS_INITIALISED;
113 /* Set default folder. */
114 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
115 if (sl->spacetype == SPACE_FILE) {
116 SpaceFile *sfile = (SpaceFile *)sl;
118 const char *dir_default = BKE_appdir_folder_default();
120 STRNCPY(sfile->params->dir, dir_default);
121 sfile->params->file[0] = '\0';
128 /* For builtin templates only. */
129 if (!blo_is_builtin_template(app_template)) {
133 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
134 LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
135 /* Remove all stored panels, we want to use defaults
136 * (order, open/closed) as defined by UI code here! */
137 BKE_area_region_panels_free(®ion->panels);
138 BLI_freelistN(®ion->panels_category_active);
140 /* Reset size so it uses consistent defaults from the region types. */
145 if (area->spacetype == SPACE_IMAGE) {
146 if (STREQ(workspace_name, "UV Editing")) {
147 SpaceImage *sima = area->spacedata.first;
148 if (sima->mode == SI_MODE_VIEW) {
149 sima->mode = SI_MODE_UV;
153 else if (area->spacetype == SPACE_ACTION) {
154 /* Show markers region, hide channels and collapse summary in timelines. */
155 SpaceAction *saction = area->spacedata.first;
156 saction->flag |= SACTION_SHOW_MARKERS;
157 if (saction->mode == SACTCONT_TIMELINE) {
158 saction->ads.flag |= ADS_FLAG_SUMMARY_COLLAPSED;
160 LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
161 if (region->regiontype == RGN_TYPE_CHANNELS) {
162 region->flag |= RGN_FLAG_HIDDEN;
167 else if (area->spacetype == SPACE_GRAPH) {
168 SpaceGraph *sipo = area->spacedata.first;
169 sipo->flag |= SIPO_SHOW_MARKERS;
171 else if (area->spacetype == SPACE_NLA) {
172 SpaceNla *snla = area->spacedata.first;
173 snla->flag |= SNLA_SHOW_MARKERS;
175 else if (area->spacetype == SPACE_SEQ) {
176 SpaceSeq *seq = area->spacedata.first;
177 seq->flag |= SEQ_SHOW_MARKERS | SEQ_SHOW_FCURVES;
179 else if (area->spacetype == SPACE_TEXT) {
180 /* Show syntax and line numbers in Script workspace text editor. */
181 SpaceText *stext = area->spacedata.first;
182 stext->showsyntax = true;
183 stext->showlinenrs = true;
185 else if (area->spacetype == SPACE_VIEW3D) {
186 View3D *v3d = area->spacedata.first;
187 /* Screen space cavity by default for faster performance. */
188 v3d->shading.cavity_type = V3D_SHADING_CAVITY_CURVATURE;
189 v3d->shading.flag |= V3D_SHADING_SPECULAR_HIGHLIGHT;
190 v3d->overlay.texture_paint_mode_opacity = 1.0f;
191 v3d->overlay.weight_paint_mode_opacity = 1.0f;
192 v3d->overlay.vertex_paint_mode_opacity = 1.0f;
193 /* Use dimmed selected edges. */
194 v3d->overlay.edit_flag &= ~V3D_OVERLAY_EDIT_EDGES;
195 /* grease pencil settings */
196 v3d->vertex_opacity = 1.0f;
197 v3d->gp_flag |= V3D_GP_SHOW_EDIT_LINES;
198 /* Remove dither pattern in wireframe mode. */
199 v3d->shading.xray_alpha_wire = 0.0f;
200 v3d->clip_start = 0.01f;
201 /* Skip startups that use the viewport color by default. */
202 if (v3d->shading.background_type != V3D_SHADING_BACKGROUND_VIEWPORT) {
203 copy_v3_fl(v3d->shading.background_color, 0.05f);
206 else if (area->spacetype == SPACE_CLIP) {
207 SpaceClip *sclip = area->spacedata.first;
208 sclip->around = V3D_AROUND_CENTER_MEDIAN;
212 /* Show tool-header by default (for most cases at least, hide for others). */
213 const bool hide_image_tool_header = STREQ(workspace_name, "Rendering");
214 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
215 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
216 ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase : &sl->regionbase;
218 LISTBASE_FOREACH (ARegion *, region, regionbase) {
219 if (region->regiontype == RGN_TYPE_TOOL_HEADER) {
220 if ((sl->spacetype == SPACE_IMAGE) && hide_image_tool_header) {
221 region->flag |= RGN_FLAG_HIDDEN;
224 region->flag &= ~(RGN_FLAG_HIDDEN | RGN_FLAG_HIDDEN_BY_USER);
231 /* 2D animation template. */
232 if (app_template && STREQ(app_template, "2D_Animation")) {
233 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
234 LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
235 if (area->spacetype == SPACE_ACTION) {
236 SpaceAction *saction = area->spacedata.first;
237 /* Enable Sliders. */
238 saction->flag |= SACTION_SLIDERS;
240 else if (area->spacetype == SPACE_VIEW3D) {
241 View3D *v3d = area->spacedata.first;
242 /* Set Material Color by default. */
243 v3d->shading.color_type = V3D_SHADING_MATERIAL_COLOR;
244 /* Enable Annotations. */
245 v3d->flag2 |= V3D_SHOW_ANNOTATION;
252 void BLO_update_defaults_workspace(WorkSpace *workspace, const char *app_template)
254 ListBase *layouts = BKE_workspace_layouts_get(workspace);
255 LISTBASE_FOREACH (WorkSpaceLayout *, layout, layouts) {
256 if (layout->screen) {
257 blo_update_defaults_screen(layout->screen, app_template, workspace->id.name + 2);
261 if (blo_is_builtin_template(app_template)) {
262 /* Clear all tools to use default options instead, ignore the tool saved in the file. */
263 while (!BLI_listbase_is_empty(&workspace->tools)) {
264 BKE_workspace_tool_remove(workspace, workspace->tools.first);
267 /* For 2D animation template. */
268 if (STREQ(workspace->id.name + 2, "Drawing")) {
269 workspace->object_mode = OB_MODE_PAINT_GPENCIL;
272 /* For Sculpting template. */
273 if (STREQ(workspace->id.name + 2, "Sculpting")) {
274 LISTBASE_FOREACH (WorkSpaceLayout *, layout, layouts) {
275 bScreen *screen = layout->screen;
277 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
278 LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
279 if (area->spacetype == SPACE_VIEW3D) {
280 View3D *v3d = area->spacedata.first;
281 v3d->shading.flag &= ~V3D_SHADING_CAVITY;
282 copy_v3_fl(v3d->shading.single_color, 1.0f);
283 STRNCPY(v3d->shading.matcap, "basic_1");
293 static void blo_update_defaults_scene(Main *bmain, Scene *scene)
295 BLI_strncpy(scene->r.engine, RE_engine_id_BLENDER_EEVEE, sizeof(scene->r.engine));
297 scene->r.cfra = 1.0f;
299 /* Don't enable compositing nodes. */
300 if (scene->nodetree) {
301 ntreeFreeEmbeddedTree(scene->nodetree);
302 MEM_freeN(scene->nodetree);
303 scene->nodetree = NULL;
304 scene->use_nodes = false;
307 /* Rename render layers. */
308 BKE_view_layer_rename(bmain, scene, scene->view_layers.first, "View Layer");
310 /* New EEVEE defaults. */
311 scene->eevee.bloom_intensity = 0.05f;
312 scene->eevee.bloom_clamp = 0.0f;
313 scene->eevee.motion_blur_shutter = 0.5f;
315 copy_v3_v3(scene->display.light_direction, (float[3]){M_SQRT1_3, M_SQRT1_3, M_SQRT1_3});
316 copy_v2_fl2(scene->safe_areas.title, 0.1f, 0.05f);
317 copy_v2_fl2(scene->safe_areas.action, 0.035f, 0.035f);
319 /* Change default cubemap quality. */
320 scene->eevee.gi_filter_quality = 3.0f;
322 /* Enable Soft Shadows by default. */
323 scene->eevee.flag |= SCE_EEVEE_SHADOW_SOFT;
325 /* Be sure curfalloff and primitive are initializated */
326 ToolSettings *ts = scene->toolsettings;
327 if (ts->gp_sculpt.cur_falloff == NULL) {
328 ts->gp_sculpt.cur_falloff = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
329 CurveMapping *gp_falloff_curve = ts->gp_sculpt.cur_falloff;
330 BKE_curvemapping_initialize(gp_falloff_curve);
331 BKE_curvemap_reset(gp_falloff_curve->cm,
332 &gp_falloff_curve->clipr,
334 CURVEMAP_SLOPE_POSITIVE);
336 if (ts->gp_sculpt.cur_primitive == NULL) {
337 ts->gp_sculpt.cur_primitive = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
338 CurveMapping *gp_primitive_curve = ts->gp_sculpt.cur_primitive;
339 BKE_curvemapping_initialize(gp_primitive_curve);
340 BKE_curvemap_reset(gp_primitive_curve->cm,
341 &gp_primitive_curve->clipr,
343 CURVEMAP_SLOPE_POSITIVE);
347 ts->sculpt->paint.symmetry_flags |= PAINT_SYMMETRY_FEATHER;
350 /* Correct default startup UV's. */
351 Mesh *me = BLI_findstring(&bmain->meshes, "Cube", offsetof(ID, name) + 2);
352 if (me && (me->totloop == 24) && (me->mloopuv != NULL)) {
353 const float uv_values[24][2] = {
354 {0.625, 0.50}, {0.875, 0.50}, {0.875, 0.75}, {0.625, 0.75}, {0.375, 0.75}, {0.625, 0.75},
355 {0.625, 1.00}, {0.375, 1.00}, {0.375, 0.00}, {0.625, 0.00}, {0.625, 0.25}, {0.375, 0.25},
356 {0.125, 0.50}, {0.375, 0.50}, {0.375, 0.75}, {0.125, 0.75}, {0.375, 0.50}, {0.625, 0.50},
357 {0.625, 0.75}, {0.375, 0.75}, {0.375, 0.25}, {0.625, 0.25}, {0.625, 0.50}, {0.375, 0.50},
359 for (int i = 0; i < ARRAY_SIZE(uv_values); i++) {
360 copy_v2_v2(me->mloopuv[i].uv, uv_values[i]);
364 /* Make sure that the curve profile is initialized */
365 if (ts->custom_bevel_profile_preset == NULL) {
366 ts->custom_bevel_profile_preset = BKE_curveprofile_add(PROF_PRESET_LINE);
371 * Update defaults in startup.blend, without having to save and embed the file.
372 * This function can be emptied each time the startup.blend is updated. */
373 void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
375 /* For all app templates. */
376 for (WorkSpace *workspace = bmain->workspaces.first; workspace; workspace = workspace->id.next) {
377 BLO_update_defaults_workspace(workspace, app_template);
380 /* New grease pencil brushes and vertex paint setup. */
382 /* Update Grease Pencil brushes. */
386 rename_id_for_versioning(bmain, ID_BR, "Draw Pencil", "Pencil");
389 rename_id_for_versioning(bmain, ID_BR, "Draw Pen", "Pen");
391 /* Pen Soft brush. */
392 brush = (Brush *)rename_id_for_versioning(bmain, ID_BR, "Draw Soft", "Pencil Soft");
394 brush->gpencil_settings->icon_id = GP_BRUSH_ICON_PEN;
398 rename_id_for_versioning(bmain, ID_BR, "Draw Ink", "Ink Pen");
400 /* Ink Pen Rough brush. */
401 rename_id_for_versioning(bmain, ID_BR, "Draw Noise", "Ink Pen Rough");
403 /* Marker Bold brush. */
404 rename_id_for_versioning(bmain, ID_BR, "Draw Marker", "Marker Bold");
406 /* Marker Chisel brush. */
407 rename_id_for_versioning(bmain, ID_BR, "Draw Block", "Marker Chisel");
409 /* Remove useless Fill Area.001 brush. */
410 brush = BLI_findstring(&bmain->brushes, "Fill Area.001", offsetof(ID, name) + 2);
412 BKE_id_delete(bmain, brush);
415 /* Rename and fix materials and enable default object lights on. */
416 if (app_template && STREQ(app_template, "2D_Animation")) {
418 rename_id_for_versioning(bmain, ID_MA, "Black", "Solid Stroke");
419 rename_id_for_versioning(bmain, ID_MA, "Red", "Squares Stroke");
420 rename_id_for_versioning(bmain, ID_MA, "Grey", "Solid Fill");
421 rename_id_for_versioning(bmain, ID_MA, "Black Dots", "Dots Stroke");
424 ma = BLI_findstring(&bmain->materials, "Dots Stroke", offsetof(ID, name) + 2);
426 ma = BKE_gpencil_material_add(bmain, "Dots Stroke");
428 ma->gp_style->mode = GP_MATERIAL_MODE_DOT;
430 /* Squares Stroke. */
431 ma = BLI_findstring(&bmain->materials, "Squares Stroke", offsetof(ID, name) + 2);
433 ma = BKE_gpencil_material_add(bmain, "Squares Stroke");
435 ma->gp_style->mode = GP_MATERIAL_MODE_SQUARE;
437 /* Change Solid Fill settings. */
438 ma = BLI_findstring(&bmain->materials, "Solid Fill", offsetof(ID, name) + 2);
440 ma->gp_style->flag &= ~GP_MATERIAL_STROKE_SHOW;
443 Object *ob = BLI_findstring(&bmain->objects, "Stroke", offsetof(ID, name) + 2);
444 if (ob && ob->type == OB_GPENCIL) {
445 ob->dtx |= OB_USE_GPENCIL_LIGHTS;
449 /* Reset all grease pencil brushes. */
450 Scene *scene = bmain->scenes.first;
451 BKE_brush_gpencil_paint_presets(bmain, scene->toolsettings);
453 /* Ensure new Paint modes. */
454 BKE_paint_ensure_from_paintmode(scene, PAINT_MODE_VERTEX_GPENCIL);
455 BKE_paint_ensure_from_paintmode(scene, PAINT_MODE_SCULPT_GPENCIL);
456 BKE_paint_ensure_from_paintmode(scene, PAINT_MODE_WEIGHT_GPENCIL);
459 GpPaint *gp_paint = scene->toolsettings->gp_paint;
460 gp_paint->paint.flags |= PAINT_SHOW_BRUSH;
462 /* Ensure Palette by default. */
463 BKE_gpencil_palette_ensure(bmain, scene);
466 /* For builtin templates only. */
467 if (!blo_is_builtin_template(app_template)) {
472 wmWindow *win = ((wmWindowManager *)bmain->wm.first)->windows.first;
473 for (WorkSpace *workspace = bmain->workspaces.first; workspace; workspace = workspace->id.next) {
474 WorkSpaceLayout *layout = BKE_workspace_hook_layout_for_workspace_get(win->workspace_hook,
477 /* Name all screens by their workspaces (avoids 'Default.###' names). */
478 /* Default only has one window. */
479 if (layout->screen) {
480 bScreen *screen = layout->screen;
481 BLI_strncpy(screen->id.name + 2, workspace->id.name + 2, sizeof(screen->id.name) - 2);
482 BLI_libblock_ensure_unique_name(bmain, screen->id.name);
485 /* For some reason we have unused screens, needed until re-saving.
486 * Clear unused layouts because they're visible in the outliner & Python API. */
487 LISTBASE_FOREACH_MUTABLE (WorkSpaceLayout *, layout_iter, &workspace->layouts) {
488 if (layout != layout_iter) {
489 BKE_workspace_layout_remove(bmain, workspace, layout_iter);
495 for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
496 blo_update_defaults_scene(bmain, scene);
498 if (app_template && STREQ(app_template, "Video_Editing")) {
499 /* Filmic is too slow, use standard until it is optimized. */
500 STRNCPY(scene->view_settings.view_transform, "Standard");
501 STRNCPY(scene->view_settings.look, "None");
504 /* AV Sync break physics sim caching, disable until that is fixed. */
505 scene->audio.flag &= ~AUDIO_SYNC;
506 scene->flag &= ~SCE_FRAME_DROP;
509 /* Change default selection mode for Grease Pencil. */
510 if (app_template && STREQ(app_template, "2D_Animation")) {
511 ToolSettings *ts = scene->toolsettings;
512 ts->gpencil_selectmode_edit = GP_SELECTMODE_STROKE;
517 rename_id_for_versioning(bmain, ID_OB, "Lamp", "Light");
518 rename_id_for_versioning(bmain, ID_LA, "Lamp", "Light");
520 if (app_template && STREQ(app_template, "2D_Animation")) {
521 for (Object *object = bmain->objects.first; object; object = object->id.next) {
522 if (object->type == OB_GPENCIL) {
523 /* Set grease pencil object in drawing mode */
524 bGPdata *gpd = (bGPdata *)object->data;
525 object->mode = OB_MODE_PAINT_GPENCIL;
526 gpd->flag |= GP_DATA_STROKE_PAINTMODE;
532 for (Mesh *mesh = bmain->meshes.first; mesh; mesh = mesh->id.next) {
533 /* Match default for new meshes. */
534 mesh->smoothresh = DEG2RADF(30);
536 /* For Sculpting template. */
537 if (app_template && STREQ(app_template, "Sculpting")) {
538 mesh->remesh_voxel_size = 0.035f;
539 mesh->flag |= ME_REMESH_FIX_POLES | ME_REMESH_REPROJECT_VOLUME;
540 BKE_mesh_smooth_flag_set(mesh, false);
544 for (Camera *camera = bmain->cameras.first; camera; camera = camera->id.next) {
545 /* Initialize to a useful value. */
546 camera->dof.focus_distance = 10.0f;
547 camera->dof.aperture_fstop = 2.8f;
550 for (Light *light = bmain->lights.first; light; light = light->id.next) {
551 /* Fix lights defaults. */
552 light->clipsta = 0.05f;
553 light->att_dist = 40.0f;
557 for (Material *ma = bmain->materials.first; ma; ma = ma->id.next) {
558 /* Update default material to be a bit more rough. */
559 ma->roughness = 0.4f;
562 LISTBASE_FOREACH (bNode *, node, &ma->nodetree->nodes) {
563 if (node->type == SH_NODE_BSDF_PRINCIPLED) {
564 bNodeSocket *roughness_socket = nodeFindSocket(node, SOCK_IN, "Roughness");
565 bNodeSocketValueFloat *roughness_data = roughness_socket->default_value;
566 roughness_data->value = 0.4f;
574 /* Enable for UV sculpt (other brush types will be created as needed),
575 * without this the grab brush will be active but not selectable from the list. */
576 const char *brush_name = "Grab";
577 Brush *brush = BLI_findstring(&bmain->brushes, brush_name, offsetof(ID, name) + 2);
579 brush->ob_mode |= OB_MODE_EDIT;
583 for (Brush *brush = bmain->brushes.first; brush; brush = brush->id.next) {
584 brush->blur_kernel_radius = 2;
586 /* Use full strength for all non-sculpt brushes,
587 * when painting we want to use full color/weight always.
589 * Note that sculpt is an exception,
590 * it's values are overwritten by #BKE_brush_sculpt_reset below. */
593 /* Enable antialiasing by default */
594 brush->sampling_flag |= BRUSH_PAINT_ANTIALIASING;
598 /* Change the spacing of the Smear brush to 3.0% */
599 const char *brush_name;
602 brush_name = "Smear";
603 brush = BLI_findstring(&bmain->brushes, brush_name, offsetof(ID, name) + 2);
605 brush->spacing = 3.0;
608 brush_name = "Draw Sharp";
609 brush = BLI_findstring(&bmain->brushes, brush_name, offsetof(ID, name) + 2);
611 brush = BKE_brush_add(bmain, brush_name, OB_MODE_SCULPT);
612 id_us_min(&brush->id);
613 brush->sculpt_tool = SCULPT_TOOL_DRAW_SHARP;
616 brush_name = "Elastic Deform";
617 brush = BLI_findstring(&bmain->brushes, brush_name, offsetof(ID, name) + 2);
619 brush = BKE_brush_add(bmain, brush_name, OB_MODE_SCULPT);
620 id_us_min(&brush->id);
621 brush->sculpt_tool = SCULPT_TOOL_ELASTIC_DEFORM;
625 brush = BLI_findstring(&bmain->brushes, brush_name, offsetof(ID, name) + 2);
627 brush = BKE_brush_add(bmain, brush_name, OB_MODE_SCULPT);
628 id_us_min(&brush->id);
629 brush->sculpt_tool = SCULPT_TOOL_POSE;
632 brush_name = "Multi-plane Scrape";
633 brush = BLI_findstring(&bmain->brushes, brush_name, offsetof(ID, name) + 2);
635 brush = BKE_brush_add(bmain, brush_name, OB_MODE_SCULPT);
636 id_us_min(&brush->id);
637 brush->sculpt_tool = SCULPT_TOOL_MULTIPLANE_SCRAPE;
640 brush_name = "Clay Thumb";
641 brush = BLI_findstring(&bmain->brushes, brush_name, offsetof(ID, name) + 2);
643 brush = BKE_brush_add(bmain, brush_name, OB_MODE_SCULPT);
644 id_us_min(&brush->id);
645 brush->sculpt_tool = SCULPT_TOOL_CLAY_THUMB;
648 brush_name = "Cloth";
649 brush = BLI_findstring(&bmain->brushes, brush_name, offsetof(ID, name) + 2);
651 brush = BKE_brush_add(bmain, brush_name, OB_MODE_SCULPT);
652 id_us_min(&brush->id);
653 brush->sculpt_tool = SCULPT_TOOL_CLOTH;
656 brush_name = "Slide Relax";
657 brush = BLI_findstring(&bmain->brushes, brush_name, offsetof(ID, name) + 2);
659 brush = BKE_brush_add(bmain, brush_name, OB_MODE_SCULPT);
660 id_us_min(&brush->id);
661 brush->sculpt_tool = SCULPT_TOOL_SLIDE_RELAX;
664 brush_name = "Simplify";
665 brush = BLI_findstring(&bmain->brushes, brush_name, offsetof(ID, name) + 2);
667 brush = BKE_brush_add(bmain, brush_name, OB_MODE_SCULPT);
668 id_us_min(&brush->id);
669 brush->sculpt_tool = SCULPT_TOOL_SIMPLIFY;
672 brush_name = "Draw Face Sets";
673 brush = BLI_findstring(&bmain->brushes, brush_name, offsetof(ID, name) + 2);
675 brush = BKE_brush_add(bmain, brush_name, OB_MODE_SCULPT);
676 id_us_min(&brush->id);
677 brush->sculpt_tool = SCULPT_TOOL_DRAW_FACE_SETS;
680 /* Use the same tool icon color in the brush cursor */
681 for (brush = bmain->brushes.first; brush; brush = brush->id.next) {
682 if (brush->ob_mode & OB_MODE_SCULPT) {
683 BLI_assert(brush->sculpt_tool != 0);
684 BKE_brush_sculpt_reset(brush);