Blender  V3.3
versioning_defaults.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
14 #include "MEM_guardedalloc.h"
15 
16 #include "BLI_listbase.h"
17 #include "BLI_math.h"
18 #include "BLI_string.h"
19 #include "BLI_system.h"
20 #include "BLI_utildefines.h"
21 
22 #include "DNA_camera_types.h"
23 #include "DNA_curveprofile_types.h"
24 #include "DNA_gpencil_types.h"
25 #include "DNA_light_types.h"
26 #include "DNA_mask_types.h"
27 #include "DNA_material_types.h"
28 #include "DNA_mesh_types.h"
29 #include "DNA_meshdata_types.h"
30 #include "DNA_object_types.h"
31 #include "DNA_scene_types.h"
32 #include "DNA_screen_types.h"
33 #include "DNA_space_types.h"
34 #include "DNA_userdef_types.h"
36 #include "DNA_workspace_types.h"
37 
38 #include "BKE_appdir.h"
39 #include "BKE_brush.h"
40 #include "BKE_colortools.h"
41 #include "BKE_curveprofile.h"
42 #include "BKE_customdata.h"
43 #include "BKE_gpencil.h"
44 #include "BKE_idprop.h"
45 #include "BKE_layer.h"
46 #include "BKE_lib_id.h"
47 #include "BKE_main.h"
48 #include "BKE_main_namemap.h"
49 #include "BKE_material.h"
50 #include "BKE_mesh.h"
51 #include "BKE_node.h"
52 #include "BKE_node_tree_update.h"
53 #include "BKE_paint.h"
54 #include "BKE_screen.h"
55 #include "BKE_workspace.h"
56 
57 #include "BLO_readfile.h"
58 
59 #include "BLT_translation.h"
60 
61 #include "versioning_common.h"
62 
63 /* Make preferences read-only, use versioning_userdef.c. */
64 #define U (*((const UserDef *)&U))
65 
66 static bool blo_is_builtin_template(const char *app_template)
67 {
68  /* For all builtin templates shipped with Blender. */
69  return (
70  !app_template ||
71  STR_ELEM(app_template, N_("2D_Animation"), N_("Sculpting"), N_("VFX"), N_("Video_Editing")));
72 }
73 
74 static void blo_update_defaults_screen(bScreen *screen,
75  const char *app_template,
76  const char *workspace_name)
77 {
78  /* For all app templates. */
79  LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
80  LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
81  /* Some toolbars have been saved as initialized,
82  * we don't want them to have odd zoom-level or scrolling set, see: T47047 */
83  if (ELEM(region->regiontype, RGN_TYPE_UI, RGN_TYPE_TOOLS, RGN_TYPE_TOOL_PROPS)) {
84  region->v2d.flag &= ~V2D_IS_INIT;
85  }
86  }
87 
88  /* Set default folder. */
89  LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
90  if (sl->spacetype == SPACE_FILE) {
91  SpaceFile *sfile = (SpaceFile *)sl;
92  if (sfile->params) {
93  const char *dir_default = BKE_appdir_folder_default();
94  if (dir_default) {
95  STRNCPY(sfile->params->dir, dir_default);
96  sfile->params->file[0] = '\0';
97  }
98  }
99  }
100  }
101  }
102 
103  /* For builtin templates only. */
105  return;
106  }
107 
108  LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
109  LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
110  /* Remove all stored panels, we want to use defaults
111  * (order, open/closed) as defined by UI code here! */
112  BKE_area_region_panels_free(&region->panels);
113  BLI_freelistN(&region->panels_category_active);
114 
115  /* Reset size so it uses consistent defaults from the region types. */
116  region->sizex = 0;
117  region->sizey = 0;
118  }
119 
120  if (area->spacetype == SPACE_IMAGE) {
121  if (STREQ(workspace_name, "UV Editing")) {
122  SpaceImage *sima = area->spacedata.first;
123  if (sima->mode == SI_MODE_VIEW) {
124  sima->mode = SI_MODE_UV;
125  }
126  }
127  }
128  else if (area->spacetype == SPACE_ACTION) {
129  /* Show markers region, hide channels and collapse summary in timelines. */
130  SpaceAction *saction = area->spacedata.first;
131  saction->flag |= SACTION_SHOW_MARKERS;
132  if (saction->mode == SACTCONT_TIMELINE) {
133  saction->ads.flag |= ADS_FLAG_SUMMARY_COLLAPSED;
134 
135  LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
136  if (region->regiontype == RGN_TYPE_CHANNELS) {
137  region->flag |= RGN_FLAG_HIDDEN;
138  }
139  }
140  }
141  else {
142  /* Open properties panel by default. */
143  LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
144  if (region->regiontype == RGN_TYPE_UI) {
145  region->flag &= ~RGN_FLAG_HIDDEN;
146  }
147  }
148  }
149  }
150  else if (area->spacetype == SPACE_GRAPH) {
151  SpaceGraph *sipo = area->spacedata.first;
152  sipo->flag |= SIPO_SHOW_MARKERS;
153  }
154  else if (area->spacetype == SPACE_NLA) {
155  SpaceNla *snla = area->spacedata.first;
156  snla->flag |= SNLA_SHOW_MARKERS;
157  }
158  else if (area->spacetype == SPACE_SEQ) {
159  SpaceSeq *seq = area->spacedata.first;
166  }
167  else if (area->spacetype == SPACE_TEXT) {
168  /* Show syntax and line numbers in Script workspace text editor. */
169  SpaceText *stext = area->spacedata.first;
170  stext->showsyntax = true;
171  stext->showlinenrs = true;
172  }
173  else if (area->spacetype == SPACE_VIEW3D) {
174  View3D *v3d = area->spacedata.first;
175  /* Screen space cavity by default for faster performance. */
181  /* Use dimmed selected edges. */
183  /* grease pencil settings */
184  v3d->vertex_opacity = 1.0f;
186  /* Remove dither pattern in wireframe mode. */
187  v3d->shading.xray_alpha_wire = 0.0f;
188  v3d->clip_start = 0.01f;
189  /* Skip startups that use the viewport color by default. */
191  copy_v3_fl(v3d->shading.background_color, 0.05f);
192  }
193  /* Disable Curve Normals. */
196  }
197  else if (area->spacetype == SPACE_CLIP) {
198  SpaceClip *sclip = area->spacedata.first;
200  sclip->mask_info.blend_factor = 0.7f;
202  }
203  }
204 
205  /* Show tool-header by default (for most cases at least, hide for others). */
206  const bool hide_image_tool_header = STREQ(workspace_name, "Rendering");
207  LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
208  LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
209  ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase : &sl->regionbase;
210 
211  LISTBASE_FOREACH (ARegion *, region, regionbase) {
212  if (region->regiontype == RGN_TYPE_TOOL_HEADER) {
213  if (((sl->spacetype == SPACE_IMAGE) && hide_image_tool_header) ||
214  sl->spacetype == SPACE_SEQ) {
215  region->flag |= RGN_FLAG_HIDDEN;
216  }
217  else {
218  region->flag &= ~(RGN_FLAG_HIDDEN | RGN_FLAG_HIDDEN_BY_USER);
219  }
220  }
221  }
222  }
223  }
224 
225  /* 2D animation template. */
226  if (app_template && STREQ(app_template, "2D_Animation")) {
227  LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
228  if (area->spacetype == SPACE_ACTION) {
229  SpaceAction *saction = area->spacedata.first;
230  /* Enable Sliders. */
231  saction->flag |= SACTION_SLIDERS;
232  }
233  else if (area->spacetype == SPACE_VIEW3D) {
234  View3D *v3d = area->spacedata.first;
235  /* Set Material Color by default. */
237  /* Enable Annotations. */
238  v3d->flag2 |= V3D_SHOW_ANNOTATION;
239  }
240  }
241  }
242 }
243 
245 {
246  LISTBASE_FOREACH (WorkSpaceLayout *, layout, &workspace->layouts) {
247  if (layout->screen) {
248  blo_update_defaults_screen(layout->screen, app_template, workspace->id.name + 2);
249  }
250  }
251 
253  /* Clear all tools to use default options instead, ignore the tool saved in the file. */
254  while (!BLI_listbase_is_empty(&workspace->tools)) {
255  BKE_workspace_tool_remove(workspace, workspace->tools.first);
256  }
257 
258  /* For 2D animation template. */
259  if (STREQ(workspace->id.name + 2, "Drawing")) {
260  workspace->object_mode = OB_MODE_PAINT_GPENCIL;
261  }
262 
263  /* For Sculpting template. */
264  if (STREQ(workspace->id.name + 2, "Sculpting")) {
265  LISTBASE_FOREACH (WorkSpaceLayout *, layout, &workspace->layouts) {
266  bScreen *screen = layout->screen;
267  if (screen) {
268  LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
269  LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
270  if (area->spacetype == SPACE_VIEW3D) {
271  View3D *v3d = area->spacedata.first;
273  copy_v3_fl(v3d->shading.single_color, 1.0f);
274  STRNCPY(v3d->shading.matcap, "basic_1");
275  }
276  }
277  }
278  }
279  }
280  }
281  }
282 }
283 
285 {
287 
288  scene->r.cfra = 1.0f;
289 
290  /* Don't enable compositing nodes. */
291  if (scene->nodetree) {
294  scene->nodetree = NULL;
295  scene->use_nodes = false;
296  }
297 
298  /* Rename render layers. */
299  BKE_view_layer_rename(bmain, scene, scene->view_layers.first, "ViewLayer");
300 
301  /* Disable Z pass by default. */
302  LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
303  view_layer->passflag &= ~SCE_PASS_Z;
304  }
305 
306  /* New EEVEE defaults. */
307  scene->eevee.bloom_intensity = 0.05f;
308  scene->eevee.bloom_clamp = 0.0f;
310 
311  copy_v3_v3(scene->display.light_direction, (float[3]){M_SQRT1_3, M_SQRT1_3, M_SQRT1_3});
312  copy_v2_fl2(scene->safe_areas.title, 0.1f, 0.05f);
313  copy_v2_fl2(scene->safe_areas.action, 0.035f, 0.035f);
314 
315  /* Change default cube-map quality. */
316  scene->eevee.gi_filter_quality = 3.0f;
317 
318  /* Enable Soft Shadows by default. */
320 
321  /* Be sure `curfalloff` and primitive are initialized. */
323  if (ts->gp_sculpt.cur_falloff == NULL) {
324  ts->gp_sculpt.cur_falloff = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
325  CurveMapping *gp_falloff_curve = ts->gp_sculpt.cur_falloff;
326  BKE_curvemapping_init(gp_falloff_curve);
327  BKE_curvemap_reset(gp_falloff_curve->cm,
328  &gp_falloff_curve->clipr,
331  }
332  if (ts->gp_sculpt.cur_primitive == NULL) {
333  ts->gp_sculpt.cur_primitive = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
334  CurveMapping *gp_primitive_curve = ts->gp_sculpt.cur_primitive;
335  BKE_curvemapping_init(gp_primitive_curve);
336  BKE_curvemap_reset(gp_primitive_curve->cm,
337  &gp_primitive_curve->clipr,
340  }
341 
342  if (ts->sculpt) {
344  }
345 
346  /* Correct default startup UV's. */
347  Mesh *me = BLI_findstring(&bmain->meshes, "Cube", offsetof(ID, name) + 2);
348  if (me && (me->totloop == 24) && (me->mloopuv != NULL)) {
349  const float uv_values[24][2] = {
350  {0.625, 0.50}, {0.875, 0.50}, {0.875, 0.75}, {0.625, 0.75}, {0.375, 0.75}, {0.625, 0.75},
351  {0.625, 1.00}, {0.375, 1.00}, {0.375, 0.00}, {0.625, 0.00}, {0.625, 0.25}, {0.375, 0.25},
352  {0.125, 0.50}, {0.375, 0.50}, {0.375, 0.75}, {0.125, 0.75}, {0.375, 0.50}, {0.625, 0.50},
353  {0.625, 0.75}, {0.375, 0.75}, {0.375, 0.25}, {0.625, 0.25}, {0.625, 0.50}, {0.375, 0.50},
354  };
355  for (int i = 0; i < ARRAY_SIZE(uv_values); i++) {
356  copy_v2_v2(me->mloopuv[i].uv, uv_values[i]);
357  }
358  }
359 
360  /* Make sure that the curve profile is initialized */
361  if (ts->custom_bevel_profile_preset == NULL) {
363  }
364 
365  /* Clear ID properties so Cycles gets defaults. */
366  IDProperty *idprop = IDP_GetProperties(&scene->id, false);
367  if (idprop) {
368  IDP_ClearProperty(idprop);
369  }
370 }
371 
373 {
374  /* For all app templates. */
375  for (WorkSpace *workspace = bmain->workspaces.first; workspace; workspace = workspace->id.next) {
377  }
378 
379  /* New grease pencil brushes and vertex paint setup. */
380  {
381  /* Update Grease Pencil brushes. */
382  Brush *brush;
383 
384  /* Pencil brush. */
385  do_versions_rename_id(bmain, ID_BR, "Draw Pencil", "Pencil");
386 
387  /* Pen brush. */
388  do_versions_rename_id(bmain, ID_BR, "Draw Pen", "Pen");
389 
390  /* Pen Soft brush. */
391  brush = (Brush *)do_versions_rename_id(bmain, ID_BR, "Draw Soft", "Pencil Soft");
392  if (brush) {
394  }
395 
396  /* Ink Pen brush. */
397  do_versions_rename_id(bmain, ID_BR, "Draw Ink", "Ink Pen");
398 
399  /* Ink Pen Rough brush. */
400  do_versions_rename_id(bmain, ID_BR, "Draw Noise", "Ink Pen Rough");
401 
402  /* Marker Bold brush. */
403  do_versions_rename_id(bmain, ID_BR, "Draw Marker", "Marker Bold");
404 
405  /* Marker Chisel brush. */
406  do_versions_rename_id(bmain, ID_BR, "Draw Block", "Marker Chisel");
407 
408  /* Remove useless Fill Area.001 brush. */
409  brush = BLI_findstring(&bmain->brushes, "Fill Area.001", offsetof(ID, name) + 2);
410  if (brush) {
411  BKE_id_delete(bmain, brush);
412  }
413 
414  /* Rename and fix materials and enable default object lights on. */
415  if (app_template && STREQ(app_template, "2D_Animation")) {
416  Material *ma = NULL;
417  do_versions_rename_id(bmain, ID_MA, "Black", "Solid Stroke");
418  do_versions_rename_id(bmain, ID_MA, "Red", "Squares Stroke");
419  do_versions_rename_id(bmain, ID_MA, "Grey", "Solid Fill");
420  do_versions_rename_id(bmain, ID_MA, "Black Dots", "Dots Stroke");
421 
422  /* Dots Stroke. */
423  ma = BLI_findstring(&bmain->materials, "Dots Stroke", offsetof(ID, name) + 2);
424  if (ma == NULL) {
425  ma = BKE_gpencil_material_add(bmain, "Dots Stroke");
426  }
428 
429  /* Squares Stroke. */
430  ma = BLI_findstring(&bmain->materials, "Squares Stroke", offsetof(ID, name) + 2);
431  if (ma == NULL) {
432  ma = BKE_gpencil_material_add(bmain, "Squares Stroke");
433  }
435 
436  /* Change Solid Stroke settings. */
437  ma = BLI_findstring(&bmain->materials, "Solid Stroke", offsetof(ID, name) + 2);
438  if (ma != NULL) {
439  ma->gp_style->mix_rgba[3] = 1.0f;
440  ma->gp_style->texture_offset[0] = -0.5f;
441  ma->gp_style->mix_factor = 0.5f;
442  }
443 
444  /* Change Solid Fill settings. */
445  ma = BLI_findstring(&bmain->materials, "Solid Fill", offsetof(ID, name) + 2);
446  if (ma != NULL) {
448  ma->gp_style->mix_rgba[3] = 1.0f;
449  ma->gp_style->texture_offset[0] = -0.5f;
450  ma->gp_style->mix_factor = 0.5f;
451  }
452 
453  Object *ob = BLI_findstring(&bmain->objects, "Stroke", offsetof(ID, name) + 2);
454  if (ob && ob->type == OB_GPENCIL) {
455  ob->dtx |= OB_USE_GPENCIL_LIGHTS;
456  }
457  }
458 
459  /* Reset all grease pencil brushes. */
460  LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
462 
463  if (ts->gp_paint) {
464  BKE_brush_gpencil_paint_presets(bmain, ts, true);
465  }
466  if (ts->gp_sculptpaint) {
467  BKE_brush_gpencil_sculpt_presets(bmain, ts, true);
468  }
469  if (ts->gp_vertexpaint) {
470  BKE_brush_gpencil_vertex_presets(bmain, ts, true);
471  }
472  if (ts->gp_weightpaint) {
473  BKE_brush_gpencil_weight_presets(bmain, ts, true);
474  }
475 
476  /* Ensure new Paint modes. */
480 
481  /* Enable cursor. */
482  if (ts->gp_paint) {
484  }
485 
486  /* Ensure Palette by default. */
487  if (ts->gp_paint) {
489  }
490  }
491  }
492 
493  /* For builtin templates only. */
495  return;
496  }
497 
498  /* Workspaces. */
499  LISTBASE_FOREACH (wmWindowManager *, wm, &bmain->wm) {
500  LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
501  LISTBASE_FOREACH (WorkSpace *, workspace, &bmain->workspaces) {
503  win->workspace_hook, workspace);
504  /* Name all screens by their workspaces (avoids 'Default.###' names). */
505  /* Default only has one window. */
506  if (layout->screen) {
507  bScreen *screen = layout->screen;
508  if (!STREQ(screen->id.name + 2, workspace->id.name + 2)) {
509  BKE_main_namemap_remove_name(bmain, &screen->id, screen->id.name + 2);
510  BLI_strncpy(screen->id.name + 2, workspace->id.name + 2, sizeof(screen->id.name) - 2);
511  BLI_libblock_ensure_unique_name(bmain, screen->id.name);
512  }
513  }
514 
515  /* For some reason we have unused screens, needed until re-saving.
516  * Clear unused layouts because they're visible in the outliner & Python API. */
517  LISTBASE_FOREACH_MUTABLE (WorkSpaceLayout *, layout_iter, &workspace->layouts) {
518  if (layout != layout_iter) {
519  BKE_workspace_layout_remove(bmain, workspace, layout_iter);
520  }
521  }
522  }
523  }
524  }
525 
526  /* Scenes */
527  for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
529 
530  if (app_template && STREQ(app_template, "Video_Editing")) {
531  /* Filmic is too slow, use standard until it is optimized. */
533  STRNCPY(scene->view_settings.look, "None");
534  }
535  else {
536  /* AV Sync break physics sim caching, disable until that is fixed. */
537  scene->audio.flag &= ~AUDIO_SYNC;
539  }
540 
541  /* Change default selection mode for Grease Pencil. */
542  if (app_template && STREQ(app_template, "2D_Animation")) {
545  }
546  }
547 
548  /* Objects */
549  do_versions_rename_id(bmain, ID_OB, "Lamp", "Light");
550  do_versions_rename_id(bmain, ID_LA, "Lamp", "Light");
551 
552  if (app_template && STREQ(app_template, "2D_Animation")) {
553  for (Object *object = bmain->objects.first; object; object = object->id.next) {
554  if (object->type == OB_GPENCIL) {
555  /* Set grease pencil object in drawing mode */
556  bGPdata *gpd = (bGPdata *)object->data;
557  object->mode = OB_MODE_PAINT_GPENCIL;
559  break;
560  }
561  }
562  }
563 
564  for (Mesh *mesh = bmain->meshes.first; mesh; mesh = mesh->id.next) {
565  /* Match default for new meshes. */
566  mesh->smoothresh = DEG2RADF(30);
567  /* Match voxel remesher options for all existing meshes in templates. */
570 
571  /* For Sculpting template. */
572  if (app_template && STREQ(app_template, "Sculpting")) {
573  mesh->remesh_voxel_size = 0.035f;
575  }
576  else {
577  /* Remove sculpt-mask data in default mesh objects for all non-sculpt templates. */
580  }
581  }
582 
583  for (Camera *camera = bmain->cameras.first; camera; camera = camera->id.next) {
584  /* Initialize to a useful value. */
585  camera->dof.focus_distance = 10.0f;
586  camera->dof.aperture_fstop = 2.8f;
587  }
588 
589  for (Light *light = bmain->lights.first; light; light = light->id.next) {
590  /* Fix lights defaults. */
591  light->clipsta = 0.05f;
592  light->att_dist = 40.0f;
593  }
594 
595  /* Materials */
596  for (Material *ma = bmain->materials.first; ma; ma = ma->id.next) {
597  /* Update default material to be a bit more rough. */
598  ma->roughness = 0.5f;
599 
600  if (ma->nodetree) {
601  LISTBASE_FOREACH (bNode *, node, &ma->nodetree->nodes) {
602  if (node->type == SH_NODE_BSDF_PRINCIPLED) {
604  bNodeSocketValueFloat *roughness_data = roughness_socket->default_value;
605  roughness_data->value = 0.5f;
606  node->custom2 = SHD_SUBSURFACE_RANDOM_WALK;
608  }
609  else if (node->type == SH_NODE_SUBSURFACE_SCATTERING) {
610  node->custom1 = SHD_SUBSURFACE_RANDOM_WALK;
612  }
613  }
614  }
615  }
616 
617  /* Brushes */
618  {
619  /* Enable for UV sculpt (other brush types will be created as needed),
620  * without this the grab brush will be active but not selectable from the list. */
621  const char *brush_name = "Grab";
622  Brush *brush = BLI_findstring(&bmain->brushes, brush_name, offsetof(ID, name) + 2);
623  if (brush) {
624  brush->ob_mode |= OB_MODE_EDIT;
625  }
626  }
627 
628  for (Brush *brush = bmain->brushes.first; brush; brush = brush->id.next) {
629  brush->blur_kernel_radius = 2;
630 
631  /* Use full strength for all non-sculpt brushes,
632  * when painting we want to use full color/weight always.
633  *
634  * Note that sculpt is an exception,
635  * its values are overwritten by #BKE_brush_sculpt_reset below. */
636  brush->alpha = 1.0;
637 
638  /* Enable antialiasing by default */
639  brush->sampling_flag |= BRUSH_PAINT_ANTIALIASING;
640  }
641 
642  {
643  /* Change the spacing of the Smear brush to 3.0% */
644  const char *brush_name;
645  Brush *brush;
646 
647  brush_name = "Smear";
648  brush = BLI_findstring(&bmain->brushes, brush_name, offsetof(ID, name) + 2);
649  if (brush) {
650  brush->spacing = 3.0;
651  }
652 
653  brush_name = "Draw Sharp";
654  brush = BLI_findstring(&bmain->brushes, brush_name, offsetof(ID, name) + 2);
655  if (!brush) {
656  brush = BKE_brush_add(bmain, brush_name, OB_MODE_SCULPT);
657  id_us_min(&brush->id);
659  }
660 
661  brush_name = "Elastic Deform";
662  brush = BLI_findstring(&bmain->brushes, brush_name, offsetof(ID, name) + 2);
663  if (!brush) {
664  brush = BKE_brush_add(bmain, brush_name, OB_MODE_SCULPT);
665  id_us_min(&brush->id);
667  }
668 
669  brush_name = "Pose";
670  brush = BLI_findstring(&bmain->brushes, brush_name, offsetof(ID, name) + 2);
671  if (!brush) {
672  brush = BKE_brush_add(bmain, brush_name, OB_MODE_SCULPT);
673  id_us_min(&brush->id);
674  brush->sculpt_tool = SCULPT_TOOL_POSE;
675  }
676 
677  brush_name = "Multi-plane Scrape";
678  brush = BLI_findstring(&bmain->brushes, brush_name, offsetof(ID, name) + 2);
679  if (!brush) {
680  brush = BKE_brush_add(bmain, brush_name, OB_MODE_SCULPT);
681  id_us_min(&brush->id);
683  }
684 
685  brush_name = "Clay Thumb";
686  brush = BLI_findstring(&bmain->brushes, brush_name, offsetof(ID, name) + 2);
687  if (!brush) {
688  brush = BKE_brush_add(bmain, brush_name, OB_MODE_SCULPT);
689  id_us_min(&brush->id);
691  }
692 
693  brush_name = "Cloth";
694  brush = BLI_findstring(&bmain->brushes, brush_name, offsetof(ID, name) + 2);
695  if (!brush) {
696  brush = BKE_brush_add(bmain, brush_name, OB_MODE_SCULPT);
697  id_us_min(&brush->id);
699  }
700 
701  brush_name = "Slide Relax";
702  brush = BLI_findstring(&bmain->brushes, brush_name, offsetof(ID, name) + 2);
703  if (!brush) {
704  brush = BKE_brush_add(bmain, brush_name, OB_MODE_SCULPT);
705  id_us_min(&brush->id);
707  }
708 
709  brush_name = "Paint";
710  brush = BLI_findstring(&bmain->brushes, brush_name, offsetof(ID, name) + 2);
711  if (!brush) {
712  brush = BKE_brush_add(bmain, brush_name, OB_MODE_SCULPT);
713  id_us_min(&brush->id);
715  }
716 
717  brush_name = "Smear";
718  brush = BLI_findstring(&bmain->brushes, brush_name, offsetof(ID, name) + 2);
719  if (!brush) {
720  brush = BKE_brush_add(bmain, brush_name, OB_MODE_SCULPT);
721  id_us_min(&brush->id);
723  }
724 
725  brush_name = "Boundary";
726  brush = BLI_findstring(&bmain->brushes, brush_name, offsetof(ID, name) + 2);
727  if (!brush) {
728  brush = BKE_brush_add(bmain, brush_name, OB_MODE_SCULPT);
729  id_us_min(&brush->id);
731  }
732 
733  brush_name = "Simplify";
734  brush = BLI_findstring(&bmain->brushes, brush_name, offsetof(ID, name) + 2);
735  if (!brush) {
736  brush = BKE_brush_add(bmain, brush_name, OB_MODE_SCULPT);
737  id_us_min(&brush->id);
739  }
740 
741  brush_name = "Draw Face Sets";
742  brush = BLI_findstring(&bmain->brushes, brush_name, offsetof(ID, name) + 2);
743  if (!brush) {
744  brush = BKE_brush_add(bmain, brush_name, OB_MODE_SCULPT);
745  id_us_min(&brush->id);
747  }
748 
749  brush_name = "Multires Displacement Eraser";
750  brush = BLI_findstring(&bmain->brushes, brush_name, offsetof(ID, name) + 2);
751  if (!brush) {
752  brush = BKE_brush_add(bmain, brush_name, OB_MODE_SCULPT);
753  id_us_min(&brush->id);
755  }
756 
757  brush_name = "Multires Displacement Smear";
758  brush = BLI_findstring(&bmain->brushes, brush_name, offsetof(ID, name) + 2);
759  if (!brush) {
760  brush = BKE_brush_add(bmain, brush_name, OB_MODE_SCULPT);
761  id_us_min(&brush->id);
763  }
764 
765  /* Use the same tool icon color in the brush cursor */
766  for (brush = bmain->brushes.first; brush; brush = brush->id.next) {
767  if (brush->ob_mode & OB_MODE_SCULPT) {
768  BLI_assert(brush->sculpt_tool != 0);
769  BKE_brush_sculpt_reset(brush);
770  }
771  }
772  }
773 }
const char * BKE_appdir_folder_default(void) ATTR_WARN_UNUSED_RESULT
Definition: appdir.c:127
struct Brush * BKE_brush_add(struct Main *bmain, const char *name, eObjectMode ob_mode)
Definition: brush.cc:496
void BKE_brush_gpencil_paint_presets(struct Main *bmain, struct ToolSettings *ts, bool reset)
Definition: brush.cc:1308
void BKE_brush_sculpt_reset(struct Brush *brush)
Definition: brush.cc:1683
void BKE_brush_gpencil_weight_presets(struct Main *bmain, struct ToolSettings *ts, bool reset)
Definition: brush.cc:1529
void BKE_brush_gpencil_sculpt_presets(struct Main *bmain, struct ToolSettings *ts, bool reset)
Definition: brush.cc:1455
void BKE_brush_gpencil_vertex_presets(struct Main *bmain, struct ToolSettings *ts, bool reset)
Definition: brush.cc:1409
void BKE_curvemapping_init(struct CurveMapping *cumap)
Definition: colortools.c:1235
void BKE_curvemap_reset(struct CurveMap *cuma, const struct rctf *clipr, int preset, int slope)
@ CURVEMAP_SLOPE_POSITIVE
struct CurveMapping * BKE_curvemapping_add(int tot, float minx, float miny, float maxx, float maxy)
Definition: colortools.c:72
struct CurveProfile * BKE_curveprofile_add(eCurveProfilePresets preset)
Definition: curveprofile.cc:31
CustomData interface, see also DNA_customdata_types.h.
void CustomData_free_layers(struct CustomData *data, int type, int totelem)
Definition: customdata.cc:2904
void BKE_gpencil_palette_ensure(struct Main *bmain, struct Scene *scene)
Definition: gpencil.c:2241
struct IDProperty * IDP_GetProperties(struct ID *id, bool create_if_needed) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: idprop.c:778
void IDP_ClearProperty(struct IDProperty *prop)
Definition: idprop.c:1099
void BKE_view_layer_rename(struct Main *bmain, struct Scene *scene, struct ViewLayer *view_layer, const char *name)
Definition: layer.c:534
void id_us_min(struct ID *id)
Definition: lib_id.c:313
void BKE_id_delete(struct Main *bmain, void *idv) ATTR_NONNULL()
void BLI_libblock_ensure_unique_name(struct Main *bmain, const char *name) ATTR_NONNULL()
Definition: lib_id.c:1813
void BKE_main_namemap_remove_name(struct Main *bmain, struct ID *id, const char *name) ATTR_NONNULL()
General operations, lookup, etc. for materials.
struct Material * BKE_gpencil_material_add(struct Main *bmain, const char *name)
Definition: material.c:298
void BKE_mesh_smooth_flag_set(struct Mesh *me, bool use_smooth)
Definition: mesh.cc:1486
#define SH_NODE_BSDF_PRINCIPLED
Definition: BKE_node.h:1164
#define SH_NODE_SUBSURFACE_SCATTERING
Definition: BKE_node.h:1148
void ntreeFreeEmbeddedTree(struct bNodeTree *ntree)
Definition: node.cc:3112
struct bNodeSocket * nodeFindSocket(const struct bNode *node, eNodeSocketInOut in_out, const char *identifier)
void BKE_ntree_update_tag_node_property(struct bNodeTree *ntree, struct bNode *node)
bool BKE_paint_ensure_from_paintmode(struct Scene *sce, ePaintMode mode)
Definition: paint.c:294
@ PAINT_MODE_VERTEX_GPENCIL
Definition: BKE_paint.h:79
@ PAINT_MODE_WEIGHT_GPENCIL
Definition: BKE_paint.h:81
@ PAINT_MODE_SCULPT_GPENCIL
Definition: BKE_paint.h:80
void BKE_area_region_panels_free(struct ListBase *panels)
Definition: screen.c:616
void BKE_workspace_layout_remove(struct Main *bmain, struct WorkSpace *workspace, struct WorkSpaceLayout *layout) ATTR_NONNULL()
Definition: workspace.c:383
void BKE_workspace_tool_remove(struct WorkSpace *workspace, struct bToolRef *tref) ATTR_NONNULL(1
struct WorkSpaceLayout * BKE_workspace_active_layout_for_workspace_get(const struct WorkSpaceInstanceHook *hook, const struct WorkSpace *workspace) GETTER_ATTRS
#define BLI_assert(a)
Definition: BLI_assert.h:46
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
Definition: BLI_listbase.h:269
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:336
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
Definition: BLI_listbase.h:354
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
Definition: listbase.c:466
void * BLI_findstring(const struct ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define DEG2RADF(_deg)
MINLINE void copy_v2_fl2(float v[2], float x, float y)
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void copy_v3_fl(float r[3], float f)
#define STR_ELEM(...)
Definition: BLI_string.h:539
#define STRNCPY(dst, src)
Definition: BLI_string.h:483
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
Definition: string.c:64
#define ARRAY_SIZE(arr)
#define ELEM(...)
#define STREQ(a, b)
external readfile function prototypes.
@ ID_LA
Definition: DNA_ID_enums.h:55
@ ID_BR
Definition: DNA_ID_enums.h:69
@ ID_MA
Definition: DNA_ID_enums.h:51
@ ID_OB
Definition: DNA_ID_enums.h:47
@ ADS_FLAG_SUMMARY_COLLAPSED
@ SACTCONT_TIMELINE
@ SACTION_SHOW_MARKERS
@ SACTION_SLIDERS
@ BRUSH_PAINT_ANTIALIASING
@ SCULPT_TOOL_CLOTH
@ SCULPT_TOOL_DRAW_SHARP
@ SCULPT_TOOL_SIMPLIFY
@ SCULPT_TOOL_DRAW_FACE_SETS
@ SCULPT_TOOL_CLAY_THUMB
@ SCULPT_TOOL_BOUNDARY
@ SCULPT_TOOL_PAINT
@ SCULPT_TOOL_POSE
@ SCULPT_TOOL_DISPLACEMENT_ERASER
@ SCULPT_TOOL_SLIDE_RELAX
@ SCULPT_TOOL_SMEAR
@ SCULPT_TOOL_DISPLACEMENT_SMEAR
@ SCULPT_TOOL_MULTIPLANE_SCRAPE
@ SCULPT_TOOL_ELASTIC_DEFORM
@ GP_BRUSH_ICON_PEN
@ CURVE_PRESET_GAUSS
@ CURVE_PRESET_BELL
@ PROF_PRESET_LINE
@ CD_PAINT_MASK
@ CD_GRID_PAINT_MASK
@ GP_DATA_STROKE_PAINTMODE
#define MASK_DRAWFLAG_SPLINE
@ GP_MATERIAL_STROKE_SHOW
@ GP_MATERIAL_MODE_SQUARE
@ GP_MATERIAL_MODE_DOT
@ ME_REMESH_REPROJECT_VOLUME
@ ME_REMESH_REPROJECT_VERTEX_COLORS
@ ME_REMESH_REPROJECT_SCULPT_FACE_SETS
@ ME_REMESH_REPROJECT_PAINT_MASK
@ SHD_SUBSURFACE_RANDOM_WALK
@ SOCK_IN
@ OB_MODE_EDIT
@ OB_MODE_SCULPT
@ OB_MODE_PAINT_GPENCIL
Object is a sort of wrapper for general info.
@ OB_GPENCIL
@ OB_USE_GPENCIL_LIGHTS
@ GP_SELECTMODE_STROKE
@ PAINT_SHOW_BRUSH
@ PAINT_SYMMETRY_FEATHER
#define AUDIO_SYNC
@ SCE_EEVEE_SHADOW_SOFT
#define SCE_FRAME_DROP
@ SCE_PASS_Z
@ RGN_FLAG_HIDDEN
@ RGN_FLAG_HIDDEN_BY_USER
@ RGN_TYPE_CHANNELS
@ RGN_TYPE_TOOL_HEADER
@ RGN_TYPE_UI
@ RGN_TYPE_TOOLS
@ RGN_TYPE_TOOL_PROPS
@ SEQ_RENDER_SIZE_PROXY_100
@ SPACE_TEXT
@ SPACE_CLIP
@ SPACE_ACTION
@ SPACE_FILE
@ SPACE_NLA
@ SPACE_SEQ
@ SPACE_IMAGE
@ SPACE_GRAPH
@ SPACE_VIEW3D
@ SEQ_TIMELINE_SHOW_STRIP_DURATION
@ SEQ_TIMELINE_SHOW_STRIP_SOURCE
@ SEQ_TIMELINE_SHOW_STRIP_NAME
@ SEQ_TIMELINE_SHOW_GRID
@ SEQ_TIMELINE_SHOW_STRIP_COLOR_TAG
@ SIPO_SHOW_MARKERS
@ SEQ_PREVIEW_SHOW_OUTLINE_SELECTED
@ SNLA_SHOW_MARKERS
@ SEQ_SHOW_MARKERS
@ SEQ_USE_PROXIES
@ SEQ_ZOOM_TO_FIT
@ SEQ_SHOW_OVERLAY
@ SI_MODE_VIEW
@ SI_MODE_UV
@ V2D_IS_INIT
@ V3D_SHADING_BACKGROUND_VIEWPORT
@ V3D_SHADING_MATERIAL_COLOR
@ V3D_AROUND_CENTER_MEDIAN
#define V3D_SHOW_ANNOTATION
@ V3D_SHADING_SPECULAR_HIGHLIGHT
@ V3D_SHADING_CAVITY
@ V3D_OVERLAY_EDIT_CU_NORMALS
@ V3D_OVERLAY_EDIT_EDGES
@ V3D_SHADING_CAVITY_CURVATURE
#define V3D_GP_SHOW_EDIT_LINES
Read Guarded memory(de)allocation.
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between camera
OperationNode * node
Scene scene
bNodeSocketValueFloat * roughness_socket
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
static void area(int d1, int d2, int e1, int e2, float weights[2])
const char * RE_engine_id_BLENDER_EEVEE
Definition: scene.cc:1695
short ob_mode
struct BrushGpencilSettings * gpencil_settings
char sculpt_tool
CurveMap cm[4]
struct CurveMapping * cur_primitive
struct CurveMapping * cur_falloff
Definition: DNA_ID.h:368
void * next
Definition: DNA_ID.h:369
char name[66]
Definition: DNA_ID.h:378
void * first
Definition: DNA_listBase.h:31
Definition: BKE_main.h:121
ListBase brushes
Definition: BKE_main.h:193
ListBase scenes
Definition: BKE_main.h:168
ListBase wm
Definition: BKE_main.h:197
ListBase meshes
Definition: BKE_main.h:171
ListBase lights
Definition: BKE_main.h:178
ListBase materials
Definition: BKE_main.h:174
ListBase cameras
Definition: BKE_main.h:179
ListBase workspaces
Definition: BKE_main.h:203
ListBase objects
Definition: BKE_main.h:170
struct MaterialGPencilStyle * gp_style
float smoothresh
CustomData vdata
uint16_t flag
float remesh_voxel_size
struct MLoopUV * mloopuv
int totvert
int totloop
CustomData ldata
int symmetry_flags
char engine[32]
float light_direction[3]
float motion_blur_shutter
float bloom_intensity
float gi_filter_quality
struct bNodeTree * nodetree
struct SceneDisplay display
short flag
struct ToolSettings * toolsettings
ColorManagedViewSettings view_settings
struct RenderData r
ListBase view_layers
struct DisplaySafeAreas safe_areas
char use_nodes
struct AudioData audio
struct SceneEEVEE eevee
Paint paint
bDopeSheet ads
MaskSpaceInfo mask_info
FileSelectParams * params
struct SequencerTimelineOverlay timeline_overlay
short render_size
struct SequencerPreviewOverlay preview_overlay
GpWeightPaint * gp_weightpaint
struct CurveProfile * custom_bevel_profile_preset
GpPaint * gp_paint
GpSculptPaint * gp_sculptpaint
char gpencil_selectmode_edit
struct GP_Sculpt_Settings gp_sculpt
GpVertexPaint * gp_vertexpaint
float normals_constant_screen_size
float texture_paint_mode_opacity
float vertex_paint_mode_opacity
float weight_paint_mode_opacity
float background_color[3]
float single_color[3]
float vertex_opacity
View3DOverlay overlay
View3DShading shading
float clip_start
short gp_flag
Wrapper for bScreen.
struct bScreen * screen
ListBase areabase
ID * do_versions_rename_id(Main *bmain, const short id_type, const char *name_src, const char *name_dst)
void BLO_update_defaults_workspace(WorkSpace *workspace, const char *app_template)
static void blo_update_defaults_screen(bScreen *screen, const char *app_template, const char *workspace_name)
static void blo_update_defaults_scene(Main *bmain, Scene *scene)
void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
static bool blo_is_builtin_template(const char *app_template)
#define N_(msgid)
char app_template[64]
Definition: wm_files.c:1021