2023-08-16 00:20:26 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
2023-05-31 16:19:06 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2013-09-10 13:25:35 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup blenloader
|
2020-10-02 23:36:05 +10:00
|
|
|
*
|
|
|
|
|
* This file handles updating the `startup.blend`, this is used when reading old files.
|
|
|
|
|
*
|
|
|
|
|
* Unlike regular versioning this makes changes that ensure the startup file
|
|
|
|
|
* has brushes and other presets setup to take advantage of newer features.
|
|
|
|
|
*
|
|
|
|
|
* To update preference defaults see `userdef_default.c`.
|
2013-09-10 13:25:35 +00:00
|
|
|
*/
|
|
|
|
|
|
Mesh: Replace auto smooth with node group
Design task: #93551
This PR replaces the auto smooth option with a geometry nodes modifier
that sets the sharp edge attribute. This solves a fair number of long-
standing problems related to auto smooth, simplifies the process of
normal computation, and allows Blender to automatically choose between
face, vertex, and face corner normals based on the sharp edge and face
attributes.
Versioning adds a geometry node group to objects with meshes that had
auto-smooth enabled. The modifier can be applied, which also improves
performance.
Auto smooth is now unnecessary to get a combination of sharp and smooth
edges. In general workflows are changed a bit. Separate procedural and
destructive workflows are available. Custom normals can be used
immediately without turning on the removed auto smooth option.
**Procedural**
The node group asset "Smooth by Angle" is the main way to set sharp
normals based on the edge angle. It can be accessed directly in the add
modifier menu. Of course the modifier can be reordered, muted, or
applied like any other, or changed internally like any geometry nodes
modifier.
**Destructive**
Often the sharp edges don't need to be dynamic. This can give better
performance since edge angles don't need to be recalculated. In edit
mode the two operators "Select Sharp Edges" and "Mark Sharp" can be
used. In other modes, the "Shade Smooth by Angle" controls the edge
sharpness directly.
### Breaking API Changes
- `use_auto_smooth` is removed. Face corner normals are now used
automatically if there are mixed smooth vs. not smooth tags. Meshes
now always use custom normals if they exist.
- In Cycles, the lack of the separate auto smooth state makes normals look
triangulated when all faces are shaded smooth.
- `auto_smooth_angle` is removed. Replaced by a modifier (or operator)
controlling the sharp edge attribute. This means the mesh itself
(without an object) doesn't know anything about automatically smoothing
by angle anymore.
- `create_normals_split`, `calc_normals_split`, and `free_normals_split`
are removed, and are replaced by the simpler `Mesh.corner_normals`
collection property. Since it gives access to the normals cache, it
is automatically updated when relevant data changes.
Addons are updated here: https://projects.blender.org/blender/blender-addons/pulls/104609
### Tests
- `geo_node_curves_test_deform_curves_on_surface` has slightly different
results because face corner normals are used instead of interpolated
vertex normals.
- `bf_wavefront_obj_tests` has different export results for one file
which mixed sharp and smooth faces without turning on auto smooth.
- `cycles_mesh_cpu` has one object which is completely flat shaded.
Previously every edge was split before rendering, now it looks triangulated.
Pull Request: https://projects.blender.org/blender/blender/pulls/108014
2023-10-20 16:54:08 +02:00
|
|
|
#define DNA_DEPRECATED_ALLOW
|
|
|
|
|
|
2018-08-21 15:21:53 +02:00
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
2014-09-04 15:03:03 +02:00
|
|
|
#include "BLI_listbase.h"
|
Cleanup: reduce amount of math-related includes
Using ClangBuildAnalyzer on the whole Blender build, it was pointing
out that BLI_math.h is the heaviest "header hub" (i.e. non tiny file
that is included a lot).
However, there's very little (actually zero) source files in Blender
that need "all the math" (base, colors, vectors, matrices,
quaternions, intersection, interpolation, statistics, solvers and
time). A common use case is source files needing just vectors, or
just vectors & matrices, or just colors etc. Actually, 181 files
were including the whole math thing without needing it at all.
This change removes BLI_math.h completely, and instead in all the
places that need it, includes BLI_math_vector.h or BLI_math_color.h
and so on.
Change from that:
- BLI_math_color.h was included 1399 times -> now 408 (took 114.0sec
to parse -> now 36.3sec)
- BLI_simd.h 1403 -> 418 (109.7sec -> 34.9sec).
Full rebuild of Blender (Apple M1, Xcode, RelWithDebInfo) is not
affected much (342sec -> 334sec). Most of benefit would be when
someone's changing BLI_simd.h or BLI_math_color.h or similar files,
that now there's 3x fewer files result in a recompile.
Pull Request #110944
2023-08-09 11:39:20 +03:00
|
|
|
#include "BLI_math_rotation.h"
|
|
|
|
|
#include "BLI_math_vector.h"
|
2023-01-04 00:14:55 +01:00
|
|
|
#include "BLI_math_vector_types.hh"
|
Sculpt/Paint: New asset based brush management workflow
This is the main merge commit of the brush assets project. The previous
commits did some preparing changes, more tweaks are in the following commits.
Also, a lot of the more general work was already merged into the main branch
over the last two years.
With the new design, quite some things can be removed/replaced:
- There's a unified "Brush" tool now, brush based tools and all special
handling is removed.
- Old tool and brush icons are unsed now, and their initialization code
removed here. That means they draw as blank now, and the icon files can be
removed in a follow up.
- Creation of default brushes is unnecessary since brushes are now bundled in
the Essentials asset library. Icons/previews are handled as standard asset
previews.
- Grease pencil eraser options are replaced by a general default eraser brush
that can be set by the user.
More changes are planned still, see task list issue below.
Main Authors: Bastien Montagne, Brecht Van Lommel, Hans Goudey, Julian Eisel
Additionally involved on the design: Dalai Felinto, Julien Kaspar
Blog Post: https://code.blender.org/2024/07/brush-assets-is-out/
Tasks:
https://projects.blender.org/blender/blender/issues/116337
Reviewed incrementally as part of the brush assets project, see:
https://projects.blender.org/blender/blender/pulls/106303
2024-07-08 13:09:57 +02:00
|
|
|
#include "BLI_mempool.h"
|
2017-05-12 13:36:35 +02:00
|
|
|
#include "BLI_string.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "BLI_utildefines.h"
|
2013-09-10 13:25:35 +00:00
|
|
|
|
2019-05-20 16:14:02 +02:00
|
|
|
#include "DNA_camera_types.h"
|
2019-11-20 16:12:32 -05:00
|
|
|
#include "DNA_curveprofile_types.h"
|
2023-07-13 13:30:38 -07:00
|
|
|
#include "DNA_defaults.h"
|
2023-03-13 10:42:51 +01:00
|
|
|
#include "DNA_gpencil_legacy_types.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "DNA_light_types.h"
|
2022-06-16 10:13:03 +02:00
|
|
|
#include "DNA_mask_types.h"
|
2020-12-15 10:47:58 +11:00
|
|
|
#include "DNA_material_types.h"
|
2018-11-15 18:28:51 +01:00
|
|
|
#include "DNA_mesh_types.h"
|
|
|
|
|
#include "DNA_object_types.h"
|
2013-09-10 13:25:35 +00:00
|
|
|
#include "DNA_scene_types.h"
|
2014-02-07 20:26:43 +06:00
|
|
|
#include "DNA_screen_types.h"
|
2024-04-24 19:54:44 +02:00
|
|
|
#include "DNA_sequence_types.h"
|
2014-02-07 20:26:43 +06:00
|
|
|
#include "DNA_space_types.h"
|
2013-09-10 13:25:35 +00:00
|
|
|
#include "DNA_userdef_types.h"
|
2018-10-19 20:29:15 +11:00
|
|
|
#include "DNA_windowmanager_types.h"
|
2018-11-15 18:28:51 +01:00
|
|
|
#include "DNA_workspace_types.h"
|
2024-06-13 14:09:52 +02:00
|
|
|
#include "DNA_world_types.h"
|
2013-09-10 13:25:35 +00:00
|
|
|
|
2024-01-21 19:42:13 +01:00
|
|
|
#include "BKE_appdir.hh"
|
2022-10-17 13:11:50 -05:00
|
|
|
#include "BKE_attribute.hh"
|
2023-08-02 22:14:18 +02:00
|
|
|
#include "BKE_brush.hh"
|
2023-12-21 10:10:53 +01:00
|
|
|
#include "BKE_colortools.hh"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "BKE_curveprofile.h"
|
2023-11-16 11:41:55 +01:00
|
|
|
#include "BKE_customdata.hh"
|
2023-03-13 10:42:51 +01:00
|
|
|
#include "BKE_gpencil_legacy.h"
|
2024-03-26 12:57:30 -04:00
|
|
|
#include "BKE_idprop.hh"
|
2024-01-23 15:18:09 -05:00
|
|
|
#include "BKE_layer.hh"
|
2024-01-15 12:44:04 -05:00
|
|
|
#include "BKE_lib_id.hh"
|
2023-12-01 19:43:16 +01:00
|
|
|
#include "BKE_main.hh"
|
2023-11-27 16:21:49 +01:00
|
|
|
#include "BKE_main_namemap.hh"
|
2020-03-09 16:27:24 +01:00
|
|
|
#include "BKE_material.h"
|
2023-03-12 22:29:15 +01:00
|
|
|
#include "BKE_mesh.hh"
|
2022-12-02 11:12:51 -06:00
|
|
|
#include "BKE_node_runtime.hh"
|
2023-11-16 11:41:55 +01:00
|
|
|
#include "BKE_node_tree_update.hh"
|
2023-08-02 22:14:18 +02:00
|
|
|
#include "BKE_paint.hh"
|
2023-09-25 17:48:21 -04:00
|
|
|
#include "BKE_screen.hh"
|
2024-04-12 17:03:18 -04:00
|
|
|
#include "BKE_workspace.hh"
|
2013-09-10 13:25:35 +00:00
|
|
|
|
2024-02-09 13:41:30 +01:00
|
|
|
#include "BLO_readfile.hh"
|
2013-09-10 13:25:35 +00:00
|
|
|
|
2024-02-09 18:59:42 +01:00
|
|
|
#include "BLT_translation.hh"
|
2022-08-04 16:13:18 +02:00
|
|
|
|
2023-08-28 15:01:05 +02:00
|
|
|
#include "versioning_common.hh"
|
2021-08-04 12:43:07 +10:00
|
|
|
|
2023-07-31 11:50:54 +10:00
|
|
|
/* Make preferences read-only, use `versioning_userdef.cc`. */
|
2019-11-24 22:54:51 +11:00
|
|
|
#define U (*((const UserDef *)&U))
|
|
|
|
|
|
2019-06-13 17:40:04 +02:00
|
|
|
static bool blo_is_builtin_template(const char *app_template)
|
2013-09-10 13:25:35 +00:00
|
|
|
{
|
2019-04-23 08:49:10 +10:00
|
|
|
/* For all builtin templates shipped with Blender. */
|
2022-08-05 13:34:10 +10:00
|
|
|
return (
|
|
|
|
|
!app_template ||
|
|
|
|
|
STR_ELEM(app_template, N_("2D_Animation"), N_("Sculpting"), N_("VFX"), N_("Video_Editing")));
|
2019-06-13 17:40:04 +02:00
|
|
|
}
|
2019-05-19 13:18:50 +02:00
|
|
|
|
2019-06-13 17:40:04 +02:00
|
|
|
static void blo_update_defaults_screen(bScreen *screen,
|
|
|
|
|
const char *app_template,
|
|
|
|
|
const char *workspace_name)
|
|
|
|
|
{
|
|
|
|
|
/* For all app templates. */
|
2020-04-03 19:15:01 +02:00
|
|
|
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
|
|
|
|
LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
|
2019-06-13 17:40:04 +02:00
|
|
|
/* Some toolbars have been saved as initialized,
|
2023-02-12 14:37:16 +11:00
|
|
|
* we don't want them to have odd zoom-level or scrolling set, see: #47047 */
|
2020-03-06 16:56:42 +01:00
|
|
|
if (ELEM(region->regiontype, RGN_TYPE_UI, RGN_TYPE_TOOLS, RGN_TYPE_TOOL_PROPS)) {
|
2020-08-01 13:02:21 +10:00
|
|
|
region->v2d.flag &= ~V2D_IS_INIT;
|
2014-02-07 20:26:43 +06:00
|
|
|
}
|
2019-06-13 17:40:04 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-06-13 17:40:04 +02:00
|
|
|
/* Set default folder. */
|
2020-04-03 19:15:01 +02:00
|
|
|
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
2019-06-13 17:40:04 +02:00
|
|
|
if (sl->spacetype == SPACE_FILE) {
|
|
|
|
|
SpaceFile *sfile = (SpaceFile *)sl;
|
|
|
|
|
if (sfile->params) {
|
|
|
|
|
const char *dir_default = BKE_appdir_folder_default();
|
|
|
|
|
if (dir_default) {
|
|
|
|
|
STRNCPY(sfile->params->dir, dir_default);
|
|
|
|
|
sfile->params->file[0] = '\0';
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2018-10-30 08:32:06 +11:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-08-21 15:21:53 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-06-13 17:40:04 +02:00
|
|
|
/* For builtin templates only. */
|
|
|
|
|
if (!blo_is_builtin_template(app_template)) {
|
|
|
|
|
return;
|
2019-04-23 08:49:10 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-03 19:15:01 +02:00
|
|
|
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
|
|
|
|
LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
|
2019-06-13 17:40:04 +02:00
|
|
|
/* Remove all stored panels, we want to use defaults
|
|
|
|
|
* (order, open/closed) as defined by UI code here! */
|
2020-03-06 16:56:42 +01:00
|
|
|
BKE_area_region_panels_free(®ion->panels);
|
|
|
|
|
BLI_freelistN(®ion->panels_category_active);
|
2019-06-13 17:40:04 +02:00
|
|
|
|
|
|
|
|
/* Reset size so it uses consistent defaults from the region types. */
|
2020-03-06 16:56:42 +01:00
|
|
|
region->sizex = 0;
|
|
|
|
|
region->sizey = 0;
|
2019-06-13 17:40:04 +02:00
|
|
|
}
|
|
|
|
|
|
2020-04-03 13:25:03 +02:00
|
|
|
if (area->spacetype == SPACE_IMAGE) {
|
2019-06-13 17:40:04 +02:00
|
|
|
if (STREQ(workspace_name, "UV Editing")) {
|
2022-10-17 13:00:37 -05:00
|
|
|
SpaceImage *sima = static_cast<SpaceImage *>(area->spacedata.first);
|
2019-06-13 17:40:04 +02:00
|
|
|
if (sima->mode == SI_MODE_VIEW) {
|
|
|
|
|
sima->mode = SI_MODE_UV;
|
2018-10-19 20:10:14 +11:00
|
|
|
}
|
|
|
|
|
}
|
2018-09-27 11:20:27 +10:00
|
|
|
}
|
2020-04-03 13:25:03 +02:00
|
|
|
else if (area->spacetype == SPACE_ACTION) {
|
2019-11-30 17:03:22 +11:00
|
|
|
/* Show markers region, hide channels and collapse summary in timelines. */
|
2022-10-17 13:00:37 -05:00
|
|
|
SpaceAction *saction = static_cast<SpaceAction *>(area->spacedata.first);
|
2019-11-30 17:03:22 +11:00
|
|
|
saction->flag |= SACTION_SHOW_MARKERS;
|
2019-06-13 17:40:04 +02:00
|
|
|
if (saction->mode == SACTCONT_TIMELINE) {
|
|
|
|
|
saction->ads.flag |= ADS_FLAG_SUMMARY_COLLAPSED;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-03 19:15:01 +02:00
|
|
|
LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
|
2020-03-06 16:56:42 +01:00
|
|
|
if (region->regiontype == RGN_TYPE_CHANNELS) {
|
|
|
|
|
region->flag |= RGN_FLAG_HIDDEN;
|
2019-06-13 17:40:04 +02:00
|
|
|
}
|
|
|
|
|
}
|
2018-08-21 15:21:53 +02:00
|
|
|
}
|
2022-07-26 11:32:33 +02:00
|
|
|
else {
|
|
|
|
|
/* Open properties panel by default. */
|
|
|
|
|
LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
|
|
|
|
|
if (region->regiontype == RGN_TYPE_UI) {
|
|
|
|
|
region->flag &= ~RGN_FLAG_HIDDEN;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2020-04-03 13:25:03 +02:00
|
|
|
else if (area->spacetype == SPACE_GRAPH) {
|
2022-10-17 13:00:37 -05:00
|
|
|
SpaceGraph *sipo = static_cast<SpaceGraph *>(area->spacedata.first);
|
2019-11-30 17:03:22 +11:00
|
|
|
sipo->flag |= SIPO_SHOW_MARKERS;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2020-04-03 13:25:03 +02:00
|
|
|
else if (area->spacetype == SPACE_NLA) {
|
2022-10-17 13:00:37 -05:00
|
|
|
SpaceNla *snla = static_cast<SpaceNla *>(area->spacedata.first);
|
2019-11-30 17:03:22 +11:00
|
|
|
snla->flag |= SNLA_SHOW_MARKERS;
|
|
|
|
|
}
|
2020-04-03 13:25:03 +02:00
|
|
|
else if (area->spacetype == SPACE_SEQ) {
|
2022-10-17 13:00:37 -05:00
|
|
|
SpaceSeq *seq = static_cast<SpaceSeq *>(area->spacedata.first);
|
2021-09-20 16:21:40 +02:00
|
|
|
seq->flag |= SEQ_SHOW_MARKERS | SEQ_ZOOM_TO_FIT | SEQ_USE_PROXIES | SEQ_SHOW_OVERLAY;
|
2021-03-16 17:59:30 +01:00
|
|
|
seq->render_size = SEQ_RENDER_SIZE_PROXY_100;
|
2021-09-20 16:21:40 +02:00
|
|
|
seq->timeline_overlay.flag |= SEQ_TIMELINE_SHOW_STRIP_SOURCE | SEQ_TIMELINE_SHOW_STRIP_NAME |
|
2021-09-29 14:29:32 +02:00
|
|
|
SEQ_TIMELINE_SHOW_STRIP_DURATION | SEQ_TIMELINE_SHOW_GRID |
|
VSE: Improve retiming UI
Currently retiming is quite awkward, when you need to retime multiple
strips strips in sync. It is possible to use meta strips, but this is
still not great. This is resolved by implementing selection.
General changes:
Gizmos are removed, since they are designed to operate only on active
strip and don't support selection.
Transform operator code is implemented for retiming data, which allows
more sophisticated manipulation.
Instead of drawing marker-like symbols, keyframes are drawn to
represent retiming data. Retiming handles are now called keys. To have
consistent names, DNA structures have been renamed.
Retiming data is drawn on strip as overlay.
UI changes:
Retiming tool is removed. To edit retiming data, press Ctrl + R, select
a key and move it. When retiming is edited, retiming menu and
context menu shows more relevant features, like making transitions.
Strip and retiming key selection can not be combined. It is possible to
use box select operator to select keys, if any key is selected.
Otherwise strips are selected.
Adding retiming keys is possible with I shortcut or from menu.
Retiming keys are always drawn at strip left and right boundary. These
keys do not really exist until they are selected. This is to simplify
retiming of strips that are resized. These keys are called "fake keys"
in code.
API changes:
Functions, properties and types related to retiming handles are renamed
to retiming keys:
retiming_handle_add() -> retiming_key_add()
retiming_handle_move() -> retiming_key_move()
retiming_handle_remove() -> retiming_key_remove()
retiming_handles -> retiming_keys
RetimingHandle -> RetimingKey
Retiming editing "mode" is activated by setting `Sequence.show_retiming_keys`.
Pull Request: https://projects.blender.org/blender/blender/pulls/109044
2023-09-27 01:45:59 +02:00
|
|
|
SEQ_TIMELINE_SHOW_STRIP_COLOR_TAG |
|
2024-09-10 13:01:24 +02:00
|
|
|
SEQ_TIMELINE_SHOW_STRIP_RETIMING |
|
|
|
|
|
SEQ_TIMELINE_WAVEFORMS_HALF | SEQ_TIMELINE_SHOW_THUMBNAILS;
|
2021-09-21 09:38:30 +02:00
|
|
|
seq->preview_overlay.flag |= SEQ_PREVIEW_SHOW_OUTLINE_SELECTED;
|
2024-05-02 16:36:11 +02:00
|
|
|
seq->cache_overlay.flag = SEQ_CACHE_SHOW | SEQ_CACHE_SHOW_FINAL_OUT;
|
2024-06-18 17:38:07 +02:00
|
|
|
seq->draw_flag |= SEQ_DRAW_TRANSFORM_PREVIEW;
|
2019-06-13 17:40:04 +02:00
|
|
|
}
|
2020-04-03 13:25:03 +02:00
|
|
|
else if (area->spacetype == SPACE_TEXT) {
|
2019-06-13 17:40:04 +02:00
|
|
|
/* Show syntax and line numbers in Script workspace text editor. */
|
2022-10-17 13:00:37 -05:00
|
|
|
SpaceText *stext = static_cast<SpaceText *>(area->spacedata.first);
|
2019-06-13 17:40:04 +02:00
|
|
|
stext->showsyntax = true;
|
|
|
|
|
stext->showlinenrs = true;
|
2024-09-13 16:27:56 +10:00
|
|
|
stext->flags |= ST_FIND_WRAP;
|
2019-06-13 17:40:04 +02:00
|
|
|
}
|
2020-04-03 13:25:03 +02:00
|
|
|
else if (area->spacetype == SPACE_VIEW3D) {
|
2022-10-17 13:00:37 -05:00
|
|
|
View3D *v3d = static_cast<View3D *>(area->spacedata.first);
|
2019-06-13 17:40:04 +02:00
|
|
|
/* Screen space cavity by default for faster performance. */
|
|
|
|
|
v3d->shading.cavity_type = V3D_SHADING_CAVITY_CURVATURE;
|
|
|
|
|
v3d->shading.flag |= V3D_SHADING_SPECULAR_HIGHLIGHT;
|
|
|
|
|
v3d->overlay.texture_paint_mode_opacity = 1.0f;
|
|
|
|
|
v3d->overlay.weight_paint_mode_opacity = 1.0f;
|
|
|
|
|
v3d->overlay.vertex_paint_mode_opacity = 1.0f;
|
2023-11-02 18:12:20 +11:00
|
|
|
/* Clear this deprecated bit for later reuse. */
|
|
|
|
|
v3d->overlay.edit_flag &= ~V3D_OVERLAY_EDIT_EDGES_DEPRECATED;
|
2019-06-13 17:40:04 +02:00
|
|
|
/* grease pencil settings */
|
|
|
|
|
v3d->vertex_opacity = 1.0f;
|
|
|
|
|
v3d->gp_flag |= V3D_GP_SHOW_EDIT_LINES;
|
|
|
|
|
/* Remove dither pattern in wireframe mode. */
|
|
|
|
|
v3d->shading.xray_alpha_wire = 0.0f;
|
2020-04-24 15:19:54 +02:00
|
|
|
v3d->clip_start = 0.01f;
|
2019-06-13 17:40:04 +02:00
|
|
|
/* Skip startups that use the viewport color by default. */
|
|
|
|
|
if (v3d->shading.background_type != V3D_SHADING_BACKGROUND_VIEWPORT) {
|
|
|
|
|
copy_v3_fl(v3d->shading.background_color, 0.05f);
|
2018-09-20 13:10:56 +02:00
|
|
|
}
|
2020-05-18 16:38:53 +02:00
|
|
|
/* Disable Curve Normals. */
|
|
|
|
|
v3d->overlay.edit_flag &= ~V3D_OVERLAY_EDIT_CU_NORMALS;
|
2021-08-04 10:52:51 +02:00
|
|
|
v3d->overlay.normals_constant_screen_size = 7.0f;
|
2024-03-27 17:07:13 +11:00
|
|
|
|
|
|
|
|
/* Level out the 3D Viewport camera rotation, see: #113751. */
|
|
|
|
|
constexpr float viewports_to_level[][4] = {
|
|
|
|
|
/* Animation, Modeling, Scripting, Texture Paint, UV Editing. */
|
|
|
|
|
{0x1.6e7cb8p-1, -0x1.c1747p-2, -0x1.2997dap-2, -0x1.d5d806p-2},
|
|
|
|
|
/* Layout. */
|
|
|
|
|
{0x1.6e7cb8p-1, -0x1.c17478p-2, -0x1.2997dcp-2, -0x1.d5d80cp-2},
|
|
|
|
|
/* Geometry Nodes. */
|
|
|
|
|
{0x1.6e7cb6p-1, -0x1.c17476p-2, -0x1.2997dep-2, -0x1.d5d80cp-2},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
constexpr float viewports_to_clear_ofs[][4] = {
|
|
|
|
|
/* Geometry Nodes. */
|
|
|
|
|
{0x1.6e7cb6p-1, -0x1.c17476p-2, -0x1.2997dep-2, -0x1.d5d80cp-2},
|
|
|
|
|
/* Sculpting. */
|
|
|
|
|
{0x1.885b28p-1, -0x1.2d10cp-1, -0x1.42ae54p-3, -0x1.a486a2p-3},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
constexpr float unified_viewquat[4] = {
|
|
|
|
|
0x1.6cbc88p-1, -0x1.c3a5c8p-2, -0x1.26413ep-2, -0x1.db430ap-2};
|
|
|
|
|
|
|
|
|
|
LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
|
|
|
|
|
if (region->regiontype == RGN_TYPE_WINDOW) {
|
|
|
|
|
RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < ARRAY_SIZE(viewports_to_clear_ofs); i++) {
|
|
|
|
|
if (equals_v4v4(rv3d->viewquat, viewports_to_clear_ofs[i])) {
|
|
|
|
|
zero_v3(rv3d->ofs);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < ARRAY_SIZE(viewports_to_level); i++) {
|
|
|
|
|
if (equals_v4v4(rv3d->viewquat, viewports_to_level[i])) {
|
|
|
|
|
copy_qt_qt(rv3d->viewquat, unified_viewquat);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-09-12 11:28:49 +02:00
|
|
|
}
|
2020-04-03 13:25:03 +02:00
|
|
|
else if (area->spacetype == SPACE_CLIP) {
|
2022-10-17 13:00:37 -05:00
|
|
|
SpaceClip *sclip = static_cast<SpaceClip *>(area->spacedata.first);
|
2019-06-13 17:40:04 +02:00
|
|
|
sclip->around = V3D_AROUND_CENTER_MEDIAN;
|
2022-06-15 15:15:23 +02:00
|
|
|
sclip->mask_info.blend_factor = 0.7f;
|
2022-06-16 10:13:03 +02:00
|
|
|
sclip->mask_info.draw_flag = MASK_DRAWFLAG_SPLINE;
|
2019-06-13 17:40:04 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
|
2020-01-22 18:33:25 +01:00
|
|
|
/* Show tool-header by default (for most cases at least, hide for others). */
|
|
|
|
|
const bool hide_image_tool_header = STREQ(workspace_name, "Rendering");
|
2020-04-03 19:15:01 +02:00
|
|
|
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
|
|
|
|
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
2022-10-17 13:00:37 -05:00
|
|
|
ListBase *regionbase = (sl == static_cast<SpaceLink *>(area->spacedata.first)) ?
|
|
|
|
|
&area->regionbase :
|
|
|
|
|
&sl->regionbase;
|
2020-01-22 18:33:25 +01:00
|
|
|
|
2020-04-03 19:15:01 +02:00
|
|
|
LISTBASE_FOREACH (ARegion *, region, regionbase) {
|
2020-03-06 16:56:42 +01:00
|
|
|
if (region->regiontype == RGN_TYPE_TOOL_HEADER) {
|
2021-10-15 23:35:49 +02:00
|
|
|
if (((sl->spacetype == SPACE_IMAGE) && hide_image_tool_header) ||
|
2024-01-02 18:12:54 +01:00
|
|
|
sl->spacetype == SPACE_SEQ)
|
|
|
|
|
{
|
2020-03-06 16:56:42 +01:00
|
|
|
region->flag |= RGN_FLAG_HIDDEN;
|
2020-01-22 18:33:25 +01:00
|
|
|
}
|
|
|
|
|
else {
|
2020-03-06 16:56:42 +01:00
|
|
|
region->flag &= ~(RGN_FLAG_HIDDEN | RGN_FLAG_HIDDEN_BY_USER);
|
2020-01-22 18:33:25 +01:00
|
|
|
}
|
2018-10-04 18:12:03 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-06-13 17:40:04 +02:00
|
|
|
}
|
2019-12-04 14:13:21 +01:00
|
|
|
|
|
|
|
|
/* 2D animation template. */
|
|
|
|
|
if (app_template && STREQ(app_template, "2D_Animation")) {
|
2020-04-03 19:15:01 +02:00
|
|
|
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
2020-05-14 12:28:45 +02:00
|
|
|
if (area->spacetype == SPACE_ACTION) {
|
2022-10-17 13:00:37 -05:00
|
|
|
SpaceAction *saction = static_cast<SpaceAction *>(area->spacedata.first);
|
2020-05-14 12:28:45 +02:00
|
|
|
/* Enable Sliders. */
|
|
|
|
|
saction->flag |= SACTION_SLIDERS;
|
|
|
|
|
}
|
|
|
|
|
else if (area->spacetype == SPACE_VIEW3D) {
|
2022-10-17 13:00:37 -05:00
|
|
|
View3D *v3d = static_cast<View3D *>(area->spacedata.first);
|
2020-05-14 12:28:45 +02:00
|
|
|
/* Set Material Color by default. */
|
|
|
|
|
v3d->shading.color_type = V3D_SHADING_MATERIAL_COLOR;
|
|
|
|
|
/* Enable Annotations. */
|
|
|
|
|
v3d->flag2 |= V3D_SHOW_ANNOTATION;
|
2019-12-04 14:13:21 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-06-13 17:40:04 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-06-13 16:33:01 +02:00
|
|
|
void BLO_update_defaults_workspace(WorkSpace *workspace, const char *app_template)
|
2019-06-13 17:40:04 +02:00
|
|
|
{
|
2020-05-26 20:32:21 +02:00
|
|
|
LISTBASE_FOREACH (WorkSpaceLayout *, layout, &workspace->layouts) {
|
2019-06-13 17:40:04 +02:00
|
|
|
if (layout->screen) {
|
|
|
|
|
blo_update_defaults_screen(layout->screen, app_template, workspace->id.name + 2);
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-04-29 22:50:14 +10:00
|
|
|
|
2019-06-13 17:40:04 +02:00
|
|
|
if (blo_is_builtin_template(app_template)) {
|
|
|
|
|
/* Clear all tools to use default options instead, ignore the tool saved in the file. */
|
|
|
|
|
while (!BLI_listbase_is_empty(&workspace->tools)) {
|
2022-10-17 13:00:37 -05:00
|
|
|
BKE_workspace_tool_remove(workspace, static_cast<bToolRef *>(workspace->tools.first));
|
2019-04-29 22:50:14 +10:00
|
|
|
}
|
|
|
|
|
|
2019-06-13 17:40:04 +02:00
|
|
|
/* For 2D animation template. */
|
|
|
|
|
if (STREQ(workspace->id.name + 2, "Drawing")) {
|
2023-07-03 15:15:54 +02:00
|
|
|
workspace->object_mode = OB_MODE_PAINT_GPENCIL_LEGACY;
|
2019-06-13 17:40:04 +02:00
|
|
|
}
|
2019-11-13 17:21:17 +01:00
|
|
|
|
|
|
|
|
/* For Sculpting template. */
|
|
|
|
|
if (STREQ(workspace->id.name + 2, "Sculpting")) {
|
2020-05-26 20:32:21 +02:00
|
|
|
LISTBASE_FOREACH (WorkSpaceLayout *, layout, &workspace->layouts) {
|
2019-11-13 17:21:17 +01:00
|
|
|
bScreen *screen = layout->screen;
|
|
|
|
|
if (screen) {
|
2020-04-03 19:15:01 +02:00
|
|
|
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
|
|
|
|
LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
|
2020-04-03 13:25:03 +02:00
|
|
|
if (area->spacetype == SPACE_VIEW3D) {
|
2022-10-17 13:00:37 -05:00
|
|
|
View3D *v3d = static_cast<View3D *>(area->spacedata.first);
|
2019-11-13 17:21:17 +01:00
|
|
|
v3d->shading.flag &= ~V3D_SHADING_CAVITY;
|
|
|
|
|
copy_v3_fl(v3d->shading.single_color, 1.0f);
|
|
|
|
|
STRNCPY(v3d->shading.matcap, "basic_1");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-06-13 17:40:04 +02:00
|
|
|
}
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-06-13 17:40:04 +02:00
|
|
|
static void blo_update_defaults_scene(Main *bmain, Scene *scene)
|
|
|
|
|
{
|
2024-05-08 20:57:00 +02:00
|
|
|
STRNCPY(scene->r.engine, RE_engine_id_BLENDER_EEVEE_NEXT);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-06-13 17:40:04 +02:00
|
|
|
scene->r.cfra = 1.0f;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-06-13 17:40:04 +02:00
|
|
|
/* Don't enable compositing nodes. */
|
|
|
|
|
if (scene->nodetree) {
|
2024-08-19 20:27:37 +02:00
|
|
|
blender::bke::node_tree_free_embedded_tree(scene->nodetree);
|
2019-06-13 17:40:04 +02:00
|
|
|
MEM_freeN(scene->nodetree);
|
2022-11-19 11:51:42 +01:00
|
|
|
scene->nodetree = nullptr;
|
2019-06-13 17:40:04 +02:00
|
|
|
scene->use_nodes = false;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-06-13 17:40:04 +02:00
|
|
|
/* Rename render layers. */
|
2022-10-17 13:00:37 -05:00
|
|
|
BKE_view_layer_rename(
|
|
|
|
|
bmain, scene, static_cast<ViewLayer *>(scene->view_layers.first), "ViewLayer");
|
2019-06-13 17:40:04 +02:00
|
|
|
|
2021-07-29 16:31:10 +02:00
|
|
|
/* Disable Z pass by default. */
|
|
|
|
|
LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
|
|
|
|
|
view_layer->passflag &= ~SCE_PASS_Z;
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-24 19:54:44 +02:00
|
|
|
/* Display missing media by default. */
|
|
|
|
|
if (scene->ed) {
|
|
|
|
|
scene->ed->show_missing_media_flag |= SEQ_EDIT_SHOW_MISSING_MEDIA;
|
|
|
|
|
}
|
|
|
|
|
|
2019-06-13 17:40:04 +02:00
|
|
|
/* New EEVEE defaults. */
|
|
|
|
|
scene->eevee.bloom_intensity = 0.05f;
|
|
|
|
|
scene->eevee.bloom_clamp = 0.0f;
|
2024-02-08 16:49:18 +01:00
|
|
|
scene->eevee.motion_blur_shutter_deprecated = 0.5f;
|
2019-06-13 17:40:04 +02:00
|
|
|
|
2022-10-17 13:00:37 -05:00
|
|
|
copy_v3_v3(scene->display.light_direction, blender::float3(M_SQRT1_3));
|
2019-06-13 17:40:04 +02:00
|
|
|
copy_v2_fl2(scene->safe_areas.title, 0.1f, 0.05f);
|
|
|
|
|
copy_v2_fl2(scene->safe_areas.action, 0.035f, 0.035f);
|
|
|
|
|
|
2020-07-15 13:11:22 +10:00
|
|
|
/* Change default cube-map quality. */
|
2019-06-13 17:40:04 +02:00
|
|
|
scene->eevee.gi_filter_quality = 3.0f;
|
|
|
|
|
|
2019-08-22 16:04:25 +02:00
|
|
|
/* Enable Soft Shadows by default. */
|
|
|
|
|
scene->eevee.flag |= SCE_EEVEE_SHADOW_SOFT;
|
|
|
|
|
|
2024-03-09 23:40:57 +11:00
|
|
|
/* Default Rotate Increment. */
|
2024-03-14 20:11:04 +11:00
|
|
|
const float default_snap_angle_increment = DEG2RADF(5.0f);
|
2024-03-09 16:50:06 +11:00
|
|
|
scene->toolsettings->snap_angle_increment_2d = default_snap_angle_increment;
|
|
|
|
|
scene->toolsettings->snap_angle_increment_3d = default_snap_angle_increment;
|
2024-03-14 20:11:04 +11:00
|
|
|
const float default_snap_angle_increment_precision = DEG2RADF(1.0f);
|
2024-03-09 16:50:06 +11:00
|
|
|
scene->toolsettings->snap_angle_increment_2d_precision = default_snap_angle_increment_precision;
|
|
|
|
|
scene->toolsettings->snap_angle_increment_3d_precision = default_snap_angle_increment_precision;
|
|
|
|
|
|
2021-02-16 21:15:45 +11:00
|
|
|
/* Be sure `curfalloff` and primitive are initialized. */
|
2019-06-13 17:40:04 +02:00
|
|
|
ToolSettings *ts = scene->toolsettings;
|
2022-11-19 11:51:42 +01:00
|
|
|
if (ts->gp_sculpt.cur_falloff == nullptr) {
|
2019-08-07 03:21:55 +10:00
|
|
|
ts->gp_sculpt.cur_falloff = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
|
2019-06-13 17:40:04 +02:00
|
|
|
CurveMapping *gp_falloff_curve = ts->gp_sculpt.cur_falloff;
|
2020-08-01 13:02:21 +10:00
|
|
|
BKE_curvemapping_init(gp_falloff_curve);
|
2019-08-07 03:21:55 +10:00
|
|
|
BKE_curvemap_reset(gp_falloff_curve->cm,
|
|
|
|
|
&gp_falloff_curve->clipr,
|
|
|
|
|
CURVE_PRESET_GAUSS,
|
|
|
|
|
CURVEMAP_SLOPE_POSITIVE);
|
2019-06-13 17:40:04 +02:00
|
|
|
}
|
2022-11-19 11:51:42 +01:00
|
|
|
if (ts->gp_sculpt.cur_primitive == nullptr) {
|
2019-08-07 03:21:55 +10:00
|
|
|
ts->gp_sculpt.cur_primitive = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
|
2019-06-13 17:40:04 +02:00
|
|
|
CurveMapping *gp_primitive_curve = ts->gp_sculpt.cur_primitive;
|
2020-08-01 13:02:21 +10:00
|
|
|
BKE_curvemapping_init(gp_primitive_curve);
|
2019-08-07 03:21:55 +10:00
|
|
|
BKE_curvemap_reset(gp_primitive_curve->cm,
|
|
|
|
|
&gp_primitive_curve->clipr,
|
|
|
|
|
CURVE_PRESET_BELL,
|
|
|
|
|
CURVEMAP_SLOPE_POSITIVE);
|
2019-06-13 17:40:04 +02:00
|
|
|
}
|
2019-07-26 21:54:57 +10:00
|
|
|
|
2019-09-26 16:14:02 +02:00
|
|
|
if (ts->sculpt) {
|
2023-07-13 13:30:38 -07:00
|
|
|
ts->sculpt->flags = static_cast<const Sculpt *>(DNA_struct_default_get(Sculpt))->flags;
|
2019-09-26 16:14:02 +02:00
|
|
|
}
|
|
|
|
|
|
2023-01-10 14:49:51 -05:00
|
|
|
/* Correct default startup UVs. */
|
2023-12-08 16:40:06 -05:00
|
|
|
Mesh *mesh = static_cast<Mesh *>(BLI_findstring(&bmain->meshes, "Cube", offsetof(ID, name) + 2));
|
2023-12-19 20:38:59 -05:00
|
|
|
if (mesh && (mesh->corners_num == 24) &&
|
2024-01-02 18:12:54 +01:00
|
|
|
CustomData_has_layer(&mesh->corner_data, CD_PROP_FLOAT2))
|
|
|
|
|
{
|
2019-07-26 21:54:57 +10:00
|
|
|
const float uv_values[24][2] = {
|
|
|
|
|
{0.625, 0.50}, {0.875, 0.50}, {0.875, 0.75}, {0.625, 0.75}, {0.375, 0.75}, {0.625, 0.75},
|
|
|
|
|
{0.625, 1.00}, {0.375, 1.00}, {0.375, 0.00}, {0.625, 0.00}, {0.625, 0.25}, {0.375, 0.25},
|
|
|
|
|
{0.125, 0.50}, {0.375, 0.50}, {0.375, 0.75}, {0.125, 0.75}, {0.375, 0.50}, {0.625, 0.50},
|
|
|
|
|
{0.625, 0.75}, {0.375, 0.75}, {0.375, 0.25}, {0.625, 0.25}, {0.625, 0.50}, {0.375, 0.50},
|
|
|
|
|
};
|
Mesh: Move UV layers to generic attributes
Currently the `MLoopUV` struct stores UV coordinates and flags related
to editing UV maps in the UV editor. This patch changes the coordinates
to use the generic 2D vector type, and moves the flags into three
separate boolean attributes. This follows the design in T95965, with
the ultimate intention of simplifying code and improving performance.
Importantly, the change allows exporters and renderers to use UVs
"touched" by geometry nodes, which only creates generic attributes.
It also allows geometry nodes to create "proper" UV maps from scratch,
though only with the Store Named Attribute node for now.
The new design considers any 2D vector attribute on the corner domain
to be a UV map. In the future, they might be distinguished from regular
2D vectors with attribute metadata, which may be helpful because they
are often interpolated differently.
Most of the code changes deal with passing around UV BMesh custom data
offsets and tracking the boolean "sublayers". The boolean layers are
use the following prefixes for attribute names: vert selection: `.vs.`,
edge selection: `.es.`, pinning: `.pn.`. Currently these are short to
avoid using up the maximum length of attribute names. To accommodate
for these 4 extra characters, the name length limit is enlarged to 68
bytes, while the maximum user settable name length is still 64 bytes.
Unfortunately Python/RNA API access to the UV flag data becomes slower.
Accessing the boolean layers directly is be better for performance in
general.
Like the other mesh SoA refactors, backward and forward compatibility
aren't affected, and won't be changed until 4.0. We pay for that by
making mesh reading and writing more expensive with conversions.
Resolves T85962
Differential Revision: https://developer.blender.org/D14365
2023-01-10 00:47:04 -05:00
|
|
|
float(*mloopuv)[2] = static_cast<float(*)[2]>(
|
2023-12-19 20:38:59 -05:00
|
|
|
CustomData_get_layer_for_write(&mesh->corner_data, CD_PROP_FLOAT2, mesh->corners_num));
|
2023-12-20 02:21:48 +01:00
|
|
|
memcpy(mloopuv, uv_values, sizeof(float[2]) * mesh->corners_num);
|
2019-07-26 21:54:57 +10:00
|
|
|
}
|
2019-11-20 16:12:32 -05:00
|
|
|
|
|
|
|
|
/* Make sure that the curve profile is initialized */
|
2022-11-19 11:51:42 +01:00
|
|
|
if (ts->custom_bevel_profile_preset == nullptr) {
|
2019-11-20 16:12:32 -05:00
|
|
|
ts->custom_bevel_profile_preset = BKE_curveprofile_add(PROF_PRESET_LINE);
|
|
|
|
|
}
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
|
|
|
|
|
/* Clear ID properties so Cycles gets defaults. */
|
2023-09-17 12:16:40 +10:00
|
|
|
IDProperty *idprop = IDP_GetProperties(&scene->id);
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
if (idprop) {
|
|
|
|
|
IDP_ClearProperty(idprop);
|
|
|
|
|
}
|
2024-01-29 15:39:34 +01:00
|
|
|
|
|
|
|
|
if (ts->sculpt) {
|
|
|
|
|
ts->sculpt->automasking_boundary_edges_propagation_steps = 1;
|
|
|
|
|
}
|
2024-01-30 05:08:23 +01:00
|
|
|
|
|
|
|
|
/* Ensure input_samples has a correct default value of 1. */
|
|
|
|
|
if (ts->unified_paint_settings.input_samples == 0) {
|
|
|
|
|
ts->unified_paint_settings.input_samples = 1;
|
|
|
|
|
}
|
2019-06-13 17:40:04 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-06-13 17:40:04 +02:00
|
|
|
void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
|
|
|
|
|
{
|
|
|
|
|
/* For all app templates. */
|
2022-10-17 13:00:37 -05:00
|
|
|
LISTBASE_FOREACH (WorkSpace *, workspace, &bmain->workspaces) {
|
2019-06-13 16:33:01 +02:00
|
|
|
BLO_update_defaults_workspace(workspace, app_template);
|
2019-06-13 17:40:04 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Sculpt/Paint: New asset based brush management workflow
This is the main merge commit of the brush assets project. The previous
commits did some preparing changes, more tweaks are in the following commits.
Also, a lot of the more general work was already merged into the main branch
over the last two years.
With the new design, quite some things can be removed/replaced:
- There's a unified "Brush" tool now, brush based tools and all special
handling is removed.
- Old tool and brush icons are unsed now, and their initialization code
removed here. That means they draw as blank now, and the icon files can be
removed in a follow up.
- Creation of default brushes is unnecessary since brushes are now bundled in
the Essentials asset library. Icons/previews are handled as standard asset
previews.
- Grease pencil eraser options are replaced by a general default eraser brush
that can be set by the user.
More changes are planned still, see task list issue below.
Main Authors: Bastien Montagne, Brecht Van Lommel, Hans Goudey, Julian Eisel
Additionally involved on the design: Dalai Felinto, Julien Kaspar
Blog Post: https://code.blender.org/2024/07/brush-assets-is-out/
Tasks:
https://projects.blender.org/blender/blender/issues/116337
Reviewed incrementally as part of the brush assets project, see:
https://projects.blender.org/blender/blender/pulls/106303
2024-07-08 13:09:57 +02:00
|
|
|
/* Grease pencil materials and paint modes setup. */
|
2020-04-10 10:49:18 +02:00
|
|
|
{
|
|
|
|
|
/* Rename and fix materials and enable default object lights on. */
|
|
|
|
|
if (app_template && STREQ(app_template, "2D_Animation")) {
|
2022-11-19 11:51:42 +01:00
|
|
|
Material *ma = nullptr;
|
2021-08-04 12:43:07 +10:00
|
|
|
do_versions_rename_id(bmain, ID_MA, "Black", "Solid Stroke");
|
|
|
|
|
do_versions_rename_id(bmain, ID_MA, "Red", "Squares Stroke");
|
|
|
|
|
do_versions_rename_id(bmain, ID_MA, "Grey", "Solid Fill");
|
|
|
|
|
do_versions_rename_id(bmain, ID_MA, "Black Dots", "Dots Stroke");
|
2020-04-10 10:49:18 +02:00
|
|
|
|
|
|
|
|
/* Dots Stroke. */
|
2022-10-17 13:00:37 -05:00
|
|
|
ma = static_cast<Material *>(
|
|
|
|
|
BLI_findstring(&bmain->materials, "Dots Stroke", offsetof(ID, name) + 2));
|
2022-11-19 11:51:42 +01:00
|
|
|
if (ma == nullptr) {
|
2020-04-10 10:49:18 +02:00
|
|
|
ma = BKE_gpencil_material_add(bmain, "Dots Stroke");
|
|
|
|
|
}
|
|
|
|
|
ma->gp_style->mode = GP_MATERIAL_MODE_DOT;
|
|
|
|
|
|
|
|
|
|
/* Squares Stroke. */
|
2022-10-17 13:00:37 -05:00
|
|
|
ma = static_cast<Material *>(
|
|
|
|
|
BLI_findstring(&bmain->materials, "Squares Stroke", offsetof(ID, name) + 2));
|
2022-11-19 11:51:42 +01:00
|
|
|
if (ma == nullptr) {
|
2020-04-10 10:49:18 +02:00
|
|
|
ma = BKE_gpencil_material_add(bmain, "Squares Stroke");
|
|
|
|
|
}
|
|
|
|
|
ma->gp_style->mode = GP_MATERIAL_MODE_SQUARE;
|
|
|
|
|
|
2020-04-27 10:49:33 +02:00
|
|
|
/* Change Solid Stroke settings. */
|
2022-10-17 13:00:37 -05:00
|
|
|
ma = static_cast<Material *>(
|
|
|
|
|
BLI_findstring(&bmain->materials, "Solid Stroke", offsetof(ID, name) + 2));
|
2022-11-19 11:51:42 +01:00
|
|
|
if (ma != nullptr) {
|
2020-04-27 10:49:33 +02:00
|
|
|
ma->gp_style->mix_rgba[3] = 1.0f;
|
|
|
|
|
ma->gp_style->texture_offset[0] = -0.5f;
|
|
|
|
|
ma->gp_style->mix_factor = 0.5f;
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-10 10:49:18 +02:00
|
|
|
/* Change Solid Fill settings. */
|
2022-10-17 13:00:37 -05:00
|
|
|
ma = static_cast<Material *>(
|
|
|
|
|
BLI_findstring(&bmain->materials, "Solid Fill", offsetof(ID, name) + 2));
|
2022-11-19 11:51:42 +01:00
|
|
|
if (ma != nullptr) {
|
2020-04-10 10:49:18 +02:00
|
|
|
ma->gp_style->flag &= ~GP_MATERIAL_STROKE_SHOW;
|
2020-04-27 10:49:33 +02:00
|
|
|
ma->gp_style->mix_rgba[3] = 1.0f;
|
|
|
|
|
ma->gp_style->texture_offset[0] = -0.5f;
|
|
|
|
|
ma->gp_style->mix_factor = 0.5f;
|
2020-04-10 10:49:18 +02:00
|
|
|
}
|
|
|
|
|
|
2022-10-17 13:00:37 -05:00
|
|
|
Object *ob = static_cast<Object *>(
|
|
|
|
|
BLI_findstring(&bmain->objects, "Stroke", offsetof(ID, name) + 2));
|
2023-03-08 12:35:58 +01:00
|
|
|
if (ob && ob->type == OB_GPENCIL_LEGACY) {
|
2020-04-10 10:49:18 +02:00
|
|
|
ob->dtx |= OB_USE_GPENCIL_LIGHTS;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
Sculpt/Paint: New asset based brush management workflow
This is the main merge commit of the brush assets project. The previous
commits did some preparing changes, more tweaks are in the following commits.
Also, a lot of the more general work was already merged into the main branch
over the last two years.
With the new design, quite some things can be removed/replaced:
- There's a unified "Brush" tool now, brush based tools and all special
handling is removed.
- Old tool and brush icons are unsed now, and their initialization code
removed here. That means they draw as blank now, and the icon files can be
removed in a follow up.
- Creation of default brushes is unnecessary since brushes are now bundled in
the Essentials asset library. Icons/previews are handled as standard asset
previews.
- Grease pencil eraser options are replaced by a general default eraser brush
that can be set by the user.
More changes are planned still, see task list issue below.
Main Authors: Bastien Montagne, Brecht Van Lommel, Hans Goudey, Julian Eisel
Additionally involved on the design: Dalai Felinto, Julien Kaspar
Blog Post: https://code.blender.org/2024/07/brush-assets-is-out/
Tasks:
https://projects.blender.org/blender/blender/issues/116337
Reviewed incrementally as part of the brush assets project, see:
https://projects.blender.org/blender/blender/pulls/106303
2024-07-08 13:09:57 +02:00
|
|
|
/* Reset grease pencil paint modes. */
|
2023-10-06 20:15:03 +02:00
|
|
|
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
|
|
|
|
ToolSettings *ts = scene->toolsettings;
|
|
|
|
|
|
|
|
|
|
/* Ensure new Paint modes. */
|
2024-05-01 11:44:16 -04:00
|
|
|
BKE_paint_ensure_from_paintmode(bmain, scene, PaintMode::VertexGPencil);
|
|
|
|
|
BKE_paint_ensure_from_paintmode(bmain, scene, PaintMode::SculptGPencil);
|
|
|
|
|
BKE_paint_ensure_from_paintmode(bmain, scene, PaintMode::WeightGPencil);
|
2023-10-06 20:15:03 +02:00
|
|
|
|
|
|
|
|
/* Enable cursor. */
|
|
|
|
|
if (ts->gp_paint) {
|
|
|
|
|
ts->gp_paint->paint.flags |= PAINT_SHOW_BRUSH;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Ensure Palette by default. */
|
|
|
|
|
if (ts->gp_paint) {
|
|
|
|
|
BKE_gpencil_palette_ensure(bmain, scene);
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-04-10 10:49:18 +02:00
|
|
|
}
|
|
|
|
|
|
2019-06-13 17:40:04 +02:00
|
|
|
/* For builtin templates only. */
|
|
|
|
|
if (!blo_is_builtin_template(app_template)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-01-16 13:57:10 +11:00
|
|
|
/* Work-spaces. */
|
2020-05-06 08:05:19 +10:00
|
|
|
LISTBASE_FOREACH (wmWindowManager *, wm, &bmain->wm) {
|
|
|
|
|
LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
|
|
|
|
|
LISTBASE_FOREACH (WorkSpace *, workspace, &bmain->workspaces) {
|
2020-05-26 20:32:21 +02:00
|
|
|
WorkSpaceLayout *layout = BKE_workspace_active_layout_for_workspace_get(
|
|
|
|
|
win->workspace_hook, workspace);
|
2020-05-06 08:05:19 +10:00
|
|
|
/* Name all screens by their workspaces (avoids 'Default.###' names). */
|
|
|
|
|
/* Default only has one window. */
|
|
|
|
|
if (layout->screen) {
|
|
|
|
|
bScreen *screen = layout->screen;
|
IDManagement: Speedup ID unique name assignment by tracking used names/basenames/suffixes
An implementation of T73412, roughly as outlined there:
Track the names that are in use, as well as base names (before
numeric suffix) plus a bit map for each base name, indicating which
numeric suffixes are already used. This is done per-Main/Library,
per-object-type.
Timings (Windows, VS2022 Release build, AMD Ryzen 5950X):
- Scene with 10k cubes, Shift+D to duplicate them all: 8.7s -> 1.9s.
Name map memory usage for resulting 20k objects: 4.3MB.
- Importing a 2.5GB .obj file of exported Blender 3.0 splash scene
(24k objects), using the new C++ importer: 34.2s-> 22.0s. Name map
memory usage for resulting scene: 8.6MB.
- Importing Disney Moana USD scene (almost half a million objects):
56min -> 10min. Name map usage: ~100MB. Blender crashes later on
when trying to render it, in the same place in both cases, but
that's for another day.
Reviewed By: Bastien Montagne
Differential Revision: https://developer.blender.org/D14162
2022-07-20 14:27:14 +03:00
|
|
|
if (!STREQ(screen->id.name + 2, workspace->id.name + 2)) {
|
Add more control over ID renaming behavior.
This commit adds low-level logic in BKE to support three behaviors in
case of name conflict when renaming an ID:
1. Always tweak new name of the renamed ID (never modify the other ID
name).
2. Always set requested name in renamed ID, modifying as needed the
other ID name.
3. Only modify the other ID name if it shares the same root name with the
current renamed ID's name.
It also adds quite some changes to IDTemplate, Outliner code, and
RNA-defined UILayout code, and the lower-level UI button API, to allow
for the new behavior defined in the design (i.e. option three from above list).
When renaming from the UI either 'fails' (falls back to adjusted name) or forces
renaming another ID, an INFO report is displayed.
This commit also fixes several issues in existing code, especially
regarding undo handling in rename operations (which could lead to saving
the wrong name in undo step, and/or over-generating undo steps).
API wise, the bahavior when directly assigning a name to the `ID.name`
property remains unchanged (option one from the list above). But a new
API call `ID.rename` has been added, which offers all three behaviors.
Unittests were added to cover the new implemented behaviors (both at
BKE level, and the RNA/Py API).
This commit implements #119139 design.
Pull Request: https://projects.blender.org/blender/blender/pulls/126996
2024-09-20 13:36:50 +02:00
|
|
|
BKE_libblock_rename(*bmain, screen->id, workspace->id.name + 2);
|
IDManagement: Speedup ID unique name assignment by tracking used names/basenames/suffixes
An implementation of T73412, roughly as outlined there:
Track the names that are in use, as well as base names (before
numeric suffix) plus a bit map for each base name, indicating which
numeric suffixes are already used. This is done per-Main/Library,
per-object-type.
Timings (Windows, VS2022 Release build, AMD Ryzen 5950X):
- Scene with 10k cubes, Shift+D to duplicate them all: 8.7s -> 1.9s.
Name map memory usage for resulting 20k objects: 4.3MB.
- Importing a 2.5GB .obj file of exported Blender 3.0 splash scene
(24k objects), using the new C++ importer: 34.2s-> 22.0s. Name map
memory usage for resulting scene: 8.6MB.
- Importing Disney Moana USD scene (almost half a million objects):
56min -> 10min. Name map usage: ~100MB. Blender crashes later on
when trying to render it, in the same place in both cases, but
that's for another day.
Reviewed By: Bastien Montagne
Differential Revision: https://developer.blender.org/D14162
2022-07-20 14:27:14 +03:00
|
|
|
}
|
2020-05-06 08:05:19 +10:00
|
|
|
}
|
2019-08-27 19:09:49 +10:00
|
|
|
|
2020-05-06 08:05:19 +10:00
|
|
|
/* For some reason we have unused screens, needed until re-saving.
|
|
|
|
|
* Clear unused layouts because they're visible in the outliner & Python API. */
|
|
|
|
|
LISTBASE_FOREACH_MUTABLE (WorkSpaceLayout *, layout_iter, &workspace->layouts) {
|
|
|
|
|
if (layout != layout_iter) {
|
|
|
|
|
BKE_workspace_layout_remove(bmain, workspace, layout_iter);
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-08-27 19:09:49 +10:00
|
|
|
}
|
|
|
|
|
}
|
2019-06-13 17:40:04 +02:00
|
|
|
}
|
2019-05-24 18:03:25 +02:00
|
|
|
|
2019-06-13 17:40:04 +02:00
|
|
|
/* Scenes */
|
2022-10-17 13:00:37 -05:00
|
|
|
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
2019-06-13 17:40:04 +02:00
|
|
|
blo_update_defaults_scene(bmain, scene);
|
2019-05-24 18:03:25 +02:00
|
|
|
|
2023-11-07 11:31:07 +11:00
|
|
|
if (app_template && STR_ELEM(app_template, "Video_Editing", "2D_Animation")) {
|
2019-06-13 17:40:04 +02:00
|
|
|
/* Filmic is too slow, use standard until it is optimized. */
|
|
|
|
|
STRNCPY(scene->view_settings.view_transform, "Standard");
|
|
|
|
|
STRNCPY(scene->view_settings.look, "None");
|
|
|
|
|
}
|
|
|
|
|
else {
|
2023-08-22 12:53:15 +02:00
|
|
|
/* Default to AgX view transform. */
|
|
|
|
|
STRNCPY(scene->view_settings.view_transform, "AgX");
|
2023-10-19 11:02:01 +02:00
|
|
|
}
|
2023-08-22 12:53:15 +02:00
|
|
|
|
2023-10-19 11:02:01 +02:00
|
|
|
if (app_template && STREQ(app_template, "Video_Editing")) {
|
|
|
|
|
/* Pass: no extra tweaks needed. Keep the view settings configured above, and rely on the
|
|
|
|
|
* default state of enabled AV sync. */
|
|
|
|
|
}
|
|
|
|
|
else {
|
2019-06-13 17:40:04 +02:00
|
|
|
/* AV Sync break physics sim caching, disable until that is fixed. */
|
|
|
|
|
scene->audio.flag &= ~AUDIO_SYNC;
|
|
|
|
|
scene->flag &= ~SCE_FRAME_DROP;
|
2019-05-24 18:03:25 +02:00
|
|
|
}
|
2019-09-27 16:52:08 +02:00
|
|
|
|
|
|
|
|
/* Change default selection mode for Grease Pencil. */
|
|
|
|
|
if (app_template && STREQ(app_template, "2D_Animation")) {
|
|
|
|
|
ToolSettings *ts = scene->toolsettings;
|
|
|
|
|
ts->gpencil_selectmode_edit = GP_SELECTMODE_STROKE;
|
|
|
|
|
}
|
2018-11-21 18:03:38 +01:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-06-13 17:40:04 +02:00
|
|
|
/* Objects */
|
2021-08-04 12:43:07 +10:00
|
|
|
do_versions_rename_id(bmain, ID_OB, "Lamp", "Light");
|
|
|
|
|
do_versions_rename_id(bmain, ID_LA, "Lamp", "Light");
|
2019-06-13 17:40:04 +02:00
|
|
|
|
|
|
|
|
if (app_template && STREQ(app_template, "2D_Animation")) {
|
2022-10-17 13:00:37 -05:00
|
|
|
LISTBASE_FOREACH (Object *, object, &bmain->objects) {
|
2023-03-08 12:35:58 +01:00
|
|
|
if (object->type == OB_GPENCIL_LEGACY) {
|
2019-06-13 17:40:04 +02:00
|
|
|
/* Set grease pencil object in drawing mode */
|
|
|
|
|
bGPdata *gpd = (bGPdata *)object->data;
|
2023-07-03 15:15:54 +02:00
|
|
|
object->mode = OB_MODE_PAINT_GPENCIL_LEGACY;
|
2019-06-13 17:40:04 +02:00
|
|
|
gpd->flag |= GP_DATA_STROKE_PAINTMODE;
|
|
|
|
|
break;
|
2018-11-28 15:57:40 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-10-17 13:00:37 -05:00
|
|
|
LISTBASE_FOREACH (Mesh *, mesh, &bmain->meshes) {
|
2019-06-13 17:40:04 +02:00
|
|
|
/* Match default for new meshes. */
|
Mesh: Replace auto smooth with node group
Design task: #93551
This PR replaces the auto smooth option with a geometry nodes modifier
that sets the sharp edge attribute. This solves a fair number of long-
standing problems related to auto smooth, simplifies the process of
normal computation, and allows Blender to automatically choose between
face, vertex, and face corner normals based on the sharp edge and face
attributes.
Versioning adds a geometry node group to objects with meshes that had
auto-smooth enabled. The modifier can be applied, which also improves
performance.
Auto smooth is now unnecessary to get a combination of sharp and smooth
edges. In general workflows are changed a bit. Separate procedural and
destructive workflows are available. Custom normals can be used
immediately without turning on the removed auto smooth option.
**Procedural**
The node group asset "Smooth by Angle" is the main way to set sharp
normals based on the edge angle. It can be accessed directly in the add
modifier menu. Of course the modifier can be reordered, muted, or
applied like any other, or changed internally like any geometry nodes
modifier.
**Destructive**
Often the sharp edges don't need to be dynamic. This can give better
performance since edge angles don't need to be recalculated. In edit
mode the two operators "Select Sharp Edges" and "Mark Sharp" can be
used. In other modes, the "Shade Smooth by Angle" controls the edge
sharpness directly.
### Breaking API Changes
- `use_auto_smooth` is removed. Face corner normals are now used
automatically if there are mixed smooth vs. not smooth tags. Meshes
now always use custom normals if they exist.
- In Cycles, the lack of the separate auto smooth state makes normals look
triangulated when all faces are shaded smooth.
- `auto_smooth_angle` is removed. Replaced by a modifier (or operator)
controlling the sharp edge attribute. This means the mesh itself
(without an object) doesn't know anything about automatically smoothing
by angle anymore.
- `create_normals_split`, `calc_normals_split`, and `free_normals_split`
are removed, and are replaced by the simpler `Mesh.corner_normals`
collection property. Since it gives access to the normals cache, it
is automatically updated when relevant data changes.
Addons are updated here: https://projects.blender.org/blender/blender-addons/pulls/104609
### Tests
- `geo_node_curves_test_deform_curves_on_surface` has slightly different
results because face corner normals are used instead of interpolated
vertex normals.
- `bf_wavefront_obj_tests` has different export results for one file
which mixed sharp and smooth faces without turning on auto smooth.
- `cycles_mesh_cpu` has one object which is completely flat shaded.
Previously every edge was split before rendering, now it looks triangulated.
Pull Request: https://projects.blender.org/blender/blender/pulls/108014
2023-10-20 16:54:08 +02:00
|
|
|
mesh->smoothresh_legacy = DEG2RADF(30);
|
2022-04-12 23:31:04 -07:00
|
|
|
/* Match voxel remesher options for all existing meshes in templates. */
|
2023-11-22 15:21:58 +01:00
|
|
|
mesh->flag |= ME_REMESH_REPROJECT_VOLUME | ME_REMESH_REPROJECT_ATTRIBUTES;
|
2019-11-13 17:21:17 +01:00
|
|
|
|
|
|
|
|
/* For Sculpting template. */
|
|
|
|
|
if (app_template && STREQ(app_template, "Sculpting")) {
|
|
|
|
|
mesh->remesh_voxel_size = 0.035f;
|
2023-12-13 09:50:24 -05:00
|
|
|
blender::bke::mesh_smooth_set(*mesh, false);
|
2019-11-13 17:21:17 +01:00
|
|
|
}
|
2021-09-10 19:18:13 +10:00
|
|
|
else {
|
|
|
|
|
/* Remove sculpt-mask data in default mesh objects for all non-sculpt templates. */
|
2023-12-20 02:21:48 +01:00
|
|
|
CustomData_free_layers(&mesh->vert_data, CD_PAINT_MASK, mesh->verts_num);
|
2023-12-19 20:38:59 -05:00
|
|
|
CustomData_free_layers(&mesh->corner_data, CD_GRID_PAINT_MASK, mesh->corners_num);
|
2021-09-10 19:18:13 +10:00
|
|
|
}
|
2022-10-17 13:11:50 -05:00
|
|
|
mesh->attributes_for_write().remove(".sculpt_face_set");
|
2019-06-13 17:40:04 +02:00
|
|
|
}
|
2019-05-27 17:07:17 +02:00
|
|
|
|
2022-10-17 13:00:37 -05:00
|
|
|
LISTBASE_FOREACH (Camera *, camera, &bmain->cameras) {
|
2019-06-13 17:40:04 +02:00
|
|
|
/* Initialize to a useful value. */
|
|
|
|
|
camera->dof.focus_distance = 10.0f;
|
|
|
|
|
camera->dof.aperture_fstop = 2.8f;
|
2018-11-30 13:26:30 +01:00
|
|
|
}
|
2019-04-23 12:31:37 +02:00
|
|
|
|
2022-10-17 13:00:37 -05:00
|
|
|
LISTBASE_FOREACH (Light *, light, &bmain->lights) {
|
2019-05-28 20:04:46 +02:00
|
|
|
/* Fix lights defaults. */
|
|
|
|
|
light->clipsta = 0.05f;
|
|
|
|
|
light->att_dist = 40.0f;
|
|
|
|
|
}
|
|
|
|
|
|
2019-06-13 17:40:04 +02:00
|
|
|
/* Materials */
|
2022-10-17 13:00:37 -05:00
|
|
|
LISTBASE_FOREACH (Material *, ma, &bmain->materials) {
|
2019-06-13 17:40:04 +02:00
|
|
|
/* Update default material to be a bit more rough. */
|
2022-08-02 16:35:58 +02:00
|
|
|
ma->roughness = 0.5f;
|
2024-09-03 13:03:30 +02:00
|
|
|
/* Enable transparent shadows. */
|
|
|
|
|
ma->blend_flag |= MA_BL_TRANSPARENT_SHADOW;
|
2019-06-13 17:40:04 +02:00
|
|
|
|
|
|
|
|
if (ma->nodetree) {
|
2022-12-02 11:12:51 -06:00
|
|
|
for (bNode *node : ma->nodetree->all_nodes()) {
|
2019-06-13 17:40:04 +02:00
|
|
|
if (node->type == SH_NODE_BSDF_PRINCIPLED) {
|
2024-08-19 20:27:37 +02:00
|
|
|
bNodeSocket *roughness_socket = blender::bke::node_find_socket(
|
|
|
|
|
node, SOCK_IN, "Roughness");
|
2023-09-13 03:05:27 +02:00
|
|
|
*version_cycles_node_socket_float_value(roughness_socket) = 0.5f;
|
2024-08-19 20:27:37 +02:00
|
|
|
bNodeSocket *emission = blender::bke::node_find_socket(node, SOCK_IN, "Emission Color");
|
2023-09-13 03:05:27 +02:00
|
|
|
copy_v4_fl(version_cycles_node_socket_rgba_value(emission), 1.0f);
|
2024-08-19 20:27:37 +02:00
|
|
|
bNodeSocket *emission_strength = blender::bke::node_find_socket(
|
2024-05-13 16:28:19 +02:00
|
|
|
node, SOCK_IN, "Emission Strength");
|
2023-09-13 03:05:27 +02:00
|
|
|
*version_cycles_node_socket_float_value(emission_strength) = 0.0f;
|
|
|
|
|
|
2023-08-18 15:51:30 +02:00
|
|
|
node->custom1 = SHD_GLOSSY_MULTI_GGX;
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
node->custom2 = SHD_SUBSURFACE_RANDOM_WALK;
|
2021-12-21 15:18:56 +01:00
|
|
|
BKE_ntree_update_tag_node_property(ma->nodetree, node);
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
}
|
|
|
|
|
else if (node->type == SH_NODE_SUBSURFACE_SCATTERING) {
|
|
|
|
|
node->custom1 = SHD_SUBSURFACE_RANDOM_WALK;
|
2021-12-21 15:18:56 +01:00
|
|
|
BKE_ntree_update_tag_node_property(ma->nodetree, node);
|
2019-06-13 17:40:04 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brushes */
|
|
|
|
|
{
|
Sculpt/Paint: New asset based brush management workflow
This is the main merge commit of the brush assets project. The previous
commits did some preparing changes, more tweaks are in the following commits.
Also, a lot of the more general work was already merged into the main branch
over the last two years.
With the new design, quite some things can be removed/replaced:
- There's a unified "Brush" tool now, brush based tools and all special
handling is removed.
- Old tool and brush icons are unsed now, and their initialization code
removed here. That means they draw as blank now, and the icon files can be
removed in a follow up.
- Creation of default brushes is unnecessary since brushes are now bundled in
the Essentials asset library. Icons/previews are handled as standard asset
previews.
- Grease pencil eraser options are replaced by a general default eraser brush
that can be set by the user.
More changes are planned still, see task list issue below.
Main Authors: Bastien Montagne, Brecht Van Lommel, Hans Goudey, Julian Eisel
Additionally involved on the design: Dalai Felinto, Julien Kaspar
Blog Post: https://code.blender.org/2024/07/brush-assets-is-out/
Tasks:
https://projects.blender.org/blender/blender/issues/116337
Reviewed incrementally as part of the brush assets project, see:
https://projects.blender.org/blender/blender/pulls/106303
2024-07-08 13:09:57 +02:00
|
|
|
/* Remove default brushes replaced by assets. Also remove outliner `treestore` that may point
|
|
|
|
|
* to brushes. Normally the treestore is updated properly but it doesn't seem to update during
|
|
|
|
|
* versioning code. It's not helpful anyway. */
|
|
|
|
|
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
|
|
|
|
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
|
|
|
|
LISTBASE_FOREACH (SpaceLink *, space_link, &area->spacedata) {
|
|
|
|
|
if (space_link->spacetype == SPACE_OUTLINER) {
|
|
|
|
|
SpaceOutliner *space_outliner = reinterpret_cast<SpaceOutliner *>(space_link);
|
|
|
|
|
if (space_outliner->treestore) {
|
|
|
|
|
BLI_mempool_destroy(space_outliner->treestore);
|
|
|
|
|
space_outliner->treestore = nullptr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-09-26 16:14:02 +02:00
|
|
|
}
|
2024-01-24 10:59:50 +01:00
|
|
|
}
|
Sculpt/Paint: New asset based brush management workflow
This is the main merge commit of the brush assets project. The previous
commits did some preparing changes, more tweaks are in the following commits.
Also, a lot of the more general work was already merged into the main branch
over the last two years.
With the new design, quite some things can be removed/replaced:
- There's a unified "Brush" tool now, brush based tools and all special
handling is removed.
- Old tool and brush icons are unsed now, and their initialization code
removed here. That means they draw as blank now, and the icon files can be
removed in a follow up.
- Creation of default brushes is unnecessary since brushes are now bundled in
the Essentials asset library. Icons/previews are handled as standard asset
previews.
- Grease pencil eraser options are replaced by a general default eraser brush
that can be set by the user.
More changes are planned still, see task list issue below.
Main Authors: Bastien Montagne, Brecht Van Lommel, Hans Goudey, Julian Eisel
Additionally involved on the design: Dalai Felinto, Julien Kaspar
Blog Post: https://code.blender.org/2024/07/brush-assets-is-out/
Tasks:
https://projects.blender.org/blender/blender/issues/116337
Reviewed incrementally as part of the brush assets project, see:
https://projects.blender.org/blender/blender/pulls/106303
2024-07-08 13:09:57 +02:00
|
|
|
LISTBASE_FOREACH_MUTABLE (Brush *, brush, &bmain->brushes) {
|
|
|
|
|
BKE_id_delete(bmain, brush);
|
2024-03-01 22:06:35 +01:00
|
|
|
}
|
|
|
|
|
}
|
2024-05-13 14:34:11 +02:00
|
|
|
|
|
|
|
|
{
|
|
|
|
|
LISTBASE_FOREACH (Light *, light, &bmain->lights) {
|
|
|
|
|
light->shadow_maximum_resolution = 0.001f;
|
2024-05-26 19:01:48 +02:00
|
|
|
light->transmission_fac = 1.0f;
|
2024-05-13 14:34:11 +02:00
|
|
|
SET_FLAG_FROM_TEST(light->mode, false, LA_SHAD_RES_ABSOLUTE);
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-06-13 14:09:52 +02:00
|
|
|
|
|
|
|
|
{
|
|
|
|
|
LISTBASE_FOREACH (World *, world, &bmain->worlds) {
|
|
|
|
|
SET_FLAG_FROM_TEST(world->flag, true, WO_USE_SUN_SHADOW);
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-09-10 13:25:35 +00:00
|
|
|
}
|