Commit Graph

109096 Commits

Author SHA1 Message Date
Hans Goudey
18eecb16db Cleanup: Remove unhelpful unreachable asset in asset shelf code 2024-05-03 11:41:37 -04:00
Julian Eisel
a6ebfb05ad UI: Option to store enabled asset shelf catalogs in preferences
Adds a new asset shelf option (`STORE_ENABLED_CATALOGS_IN_PREFERENCES`
option in RNA) to use the Preferences for storing the enabled catalogs.
This way asset shelf types can decide if for their use-case, they want
to synchronize the enabled catalogs over Blender sessions and files, or
keep the stored locally in the file.

This is important because for example on one hand, it would be annoying
if for brush assets you'd have to enable the visible catalog tabs for
every 3D View and every file, while on the other hand you need that
level of control for the pose library where the catalogs the rigger/
animator cares about varies from project to project, character to
character and shot to shot.

Conceptually this also makes some sense: The new brush assets workflow
synchronizes brush assets and their catalogs across Blender sessions
and files, basically making them globally accessible independent of
the current file/project, so treating the enabled catalogs the same
is consistent.

Previously reviewed in #120264

Pull Request: https://projects.blender.org/blender/blender/pulls/121363
2024-05-03 10:20:01 -04:00
Iliya Katueshenock
4732e7cda5 Cleanup: incorrect assertion
This assertion was added in assumption that sizes of input argument are always correct.
But this is not such. More correct is to depend on assertions of span access methods.

The size of the multi-function parameters is only guaranteed to be large enough so that
every index in the mask can be accessed. It may be larger.

Pull Request: https://projects.blender.org/blender/blender/pulls/121393
2024-05-03 15:05:48 +02:00
Hans Goudey
8203184192 Cleanup: Modernize variable naming in mesh_validate.cc
Change "poly" to "face" and "loop" to "corner"
2024-05-03 08:50:07 -04:00
Bastien Montagne
24560b6016 Fix #121310: Marking or clearing 'Fake User' on ID not undoable.
Remapping of internal ID pointers in 'undo swap' case (i.e. when new ID
data had to be read from undo buffer, but current ID address is kept)
needs to also ignore 'fake user' handling, otherwise it would reverse
the undoing effect.
2024-05-03 12:54:11 +02:00
Arye Ramaty
1db538683d Geometry Nodes: add selection and depth options to Realize Instances node
Previously, the Realize Instances node would always realize everything in the geometry.
Now it's possible to more selectively realize parts of the geometry:
* One can choose which top level instances should be realized.
* The realization depth can be controlled per top-level instance. For example, if there are
  5 top level instances, each of which contains 10 other instances, it's now possible to
  realize only one level so that one ends up with 50 instances.

Pull Request: https://projects.blender.org/blender/blender/pulls/116582
2024-05-03 12:47:59 +02:00
Clément Foucault
b00c6d7d13 GPU: Fix shader builder stubs 2024-05-03 12:24:33 +02:00
Aras Pranckevicius
3b67075f40 BLI: Make color sRGB<->Linear non-SIMD fallback path use the same approximation
All official Blender platforms use the SIMD code path, with pow() approximations
for 2.4 and 1/2.4 powers. The non-SIMD code path would only be used on other
platforms like PowerPC etc. Make that fallback scalar code path use the same
math approximation for consistency. This is part of #121312.

This also makes srgb_to_linearrgb_v3_v3 and linearrgb_to_srgb_v3_v3 functions
non-inlined. They are 50-100 CPU instructions, and thus hardly good candidates
for forced inlining into each and every call site.

Also _bli_math_blend_sse now uses actual SSE4 blend instruction instead of doing
it in a roundabout way.

Pull Request: https://projects.blender.org/blender/blender/pulls/121368
2024-05-03 12:05:56 +02:00
Iliya Katueshenock
29aecbf74c Fix #120841: parent nodes don't get logs from zones
Issue was in the fact that log should be propagated on source node and on parent node.
Instead of `group_node_id`, loggers need to have id of actual parent (zone node or node group) node.
This also fix issue with timings propagation on frame nodes.

Pull Request: https://projects.blender.org/blender/blender/pulls/120842
2024-05-03 11:59:35 +02:00
Sergey Sharybin
89ace28b30 Fix #121342: Alt + H unhides bones with drivers
Pull Request: https://projects.blender.org/blender/blender/pulls/121384
2024-05-03 11:52:41 +02:00
Campbell Barton
cd5dd6e454 Fix #115648: Crash on startup with an incompatible PYTHONPATH
Regression in [0]. PyPreConfig.use_environment was internalized to 0
but PyConfig.use_environment wasn't.

Thanks to @unwave for finding the root cause.

[0]: cafd6b519c
2024-05-03 15:48:35 +10:00
YimingWu
d46fe49ab3 Fix: Memory leak in multiresbake_image_exec
MultiresBakeJob is allocated before a potential early return of the
operator, so free the data before returning.

Part of #120767

Pull Request: https://projects.blender.org/blender/blender/pulls/121102
2024-05-03 06:21:08 +02:00
Hans Goudey
43b46503f1 Cleanup: Use const for mesh selection retrieval functions 2024-05-02 22:08:25 -04:00
Campbell Barton
9918488bb1 Cleanup: use uppercase tags, following own style guide 2024-05-03 11:33:21 +10:00
Campbell Barton
5529a94f14 Cleanup: spelling in comments 2024-05-03 11:33:18 +10:00
Anthony Roberts
570b76f600 Enable sse2neon in BLI_simd except for hydra/USD
This should get all of the tests to pass on Windows ARM64 platforms.

Sadly it needs disabling for hydra/USD stuff as currently it doesn't play nicely with the new preprocessor. @LazyDodo suggested a USD version update may fix this, which is something I can investigate in due course - right now, let's get daily builds up and working :)

Pull Request: https://projects.blender.org/blender/blender/pulls/121361
2024-05-02 20:05:51 +02:00
Hans Goudey
39f0e3c0f4 UI: Remove more use of brush tool type icons in enum
Missing from fd5a790f36
2024-05-02 13:50:22 -04:00
Hans Goudey
fd5a790f36 UI: Remove icon usage in brush tool RNA enums
With brush assets, these tool-type icons will be removed completely.
In main already though, it makes some sense to remove the usage of
the icons in the brush tool type enum items. These icons are quite
different than the others and don't look good with a small size anyway.

As far as I can tell this doesn't make a difference in the UI anyway,
since the enum menu selector exposed in the "Brushes" panel didn't
show the icons anyway.

Pull Request: https://projects.blender.org/blender/blender/pulls/121364
2024-05-02 19:46:29 +02:00
Julian Eisel
05b125f399 Asset Shelf: Add default preview size option
Allow changing the size of previews in a new asset shelf
when registering a new asset shelf type.

Pull Request: https://projects.blender.org/blender/blender/pulls/121358
2024-05-02 12:56:53 -04:00
Hans Goudey
6f5f70994e Cleanup: Unnecessary const in declaration, format 2024-05-02 12:43:07 -04:00
Julian Eisel
8e948a498d Tests: Add unit tests for AssetWeakReference test equality
4dbdd925d4
2024-05-02 12:21:48 -04:00
Bastien Montagne
ec350a6115 BKE ID copy: Pass new owner ID when possible.
Advanced ID copying code can now take a `new_owner_id` ID pointer parameter,
and use it to set the relevant 'loopback' pointer to its owner ID by the
copy code itself.

Besides avoiding the need for all code copying embedded IDs to set the
loopback pointer themselves, this also means that `lib_id` copying code
itself does not need to use `IDWALK_IGNORE_MISSING_OWNER_ID` anymore.

This change is not expected to have any effect in current codebase.
2024-05-02 17:17:04 +02:00
Bastien Montagne
36c3504994 BKE lib_query: Improve handling of owner ID info for embedded ID.
In previous code, the owner ID info would not be available when
processing an embedded ID in two cases, and was incorrectly set to the
processed (embedded) ID instead:
1. When directly calling `BKE_library_foreach_ID_link` on an embedded ID.
2. When using recursive processing (`IDWALK_RECURSE`).

This commit mostly fixes both cases, by using `BKE_id_owner_get` to find
the owner ID when it is unknown.

There are some caveats here though: in a few specific cases (mainly ID
copying, and depsgraph ID copying), `BKE_library_foreach_ID_link` can be
called on embedded IDs which owner ID is not yet valid. In such case, a
new flag can be used to keep using the previous behavior
(`IDWALK_IGNORE_MISSING_OWNER_ID`).

Fixing the issue with copy code being unaware of the owner ID when
copying an embedded one should also be fixed, but this will be addressed
separately.

Note that as 'side efect', this commit also fixes a matching issue in
the `lib_remap` code, where the `IDRemap.id-owner` pointer would also
wrongly be set to the remapped embedded ID instead of its actual owner.

This change is not expected to have any effect in current codebase.
2024-05-02 17:17:03 +02:00
Bastien Montagne
eb9bec54ad IDType owner ID accessor: Add option to skip relationship sanity checks.
While currently, all cases where `BKE_id_owner_get` is called are
'safe', there are some points in code where the pointers ensureing the
relationship between an embedded ID and its owner are not (fully) valid.

This new option (`false` by default) allows to skip the debug asserts
ensuring the sanity of these 'owner <-> embedded' ID pointers in the
relevant `owner_pointer_get` callbacks.

This change is not expected to have any effect in current codebase.
2024-05-02 17:17:03 +02:00
Bastien Montagne
8ba6c16242 BKE: ID copy: do not expand linked data usages when copying an embedded ID.
There is no reason to do this for embedded IDs - this process is
expected to happen as part of the copying of their owner ID anyway.

Further more, embedded IDs are not in a fully valid state during the
copying of their owner, better avoid as much processing on them as
possible.

This change is not expected to have any effect in current codebase.
2024-05-02 17:17:03 +02:00
Bastien Montagne
27f404c1b4 Cleanup/fix BKE scene copy code remapping its nodetree pointers before setting its owner ID.
While not an issue in current code, this was logically not ideal.
The owner ID is an important information that should be valid as soon as
possible after the copy, before any other process happens.

Ideally this could even become part of the ID copying code itself.

This change is not expected to have any effect in current codebase.
2024-05-02 17:17:03 +02:00
Falk David
5f8fbe62bf Fix: GPv3: Allow compiler use of copy elision
The `std::move` was not necessary and preventing
copy elision on clang.
2024-05-02 17:01:47 +02:00
Sebastian Parborg
221951657b VSE: Make cache overlay visible to non "Developer extras" users
This also moves the option to be a per editor space setting so you can
have different cache visualization options in different editor spaces
at the same time.

A quick toggle for the cache visualization is now available in the
overlays popover.

Pull Request: https://projects.blender.org/blender/blender/pulls/119428
2024-05-02 16:36:11 +02:00
Falk David
370712fc1b Fix #121354: GPv3: object mode selection outline too big
This was caused by c2504eb779.
The commit changed the factor for the radii, but didn't update the
overlay code for the outlines.

This fix makes sure we're using the right conversion factor.
2024-05-02 16:32:06 +02:00
Julian Eisel
d4fc167db1 Asset Shelf: Add region poll mechanism for initialization
Allows running some action when the context changes to make the
asset shelf region visible. Also add an option for when whether the
shelf should be visible by default when the poll succeeds.

Pull Request: https://projects.blender.org/blender/blender/pulls/121315
2024-05-02 10:27:55 -04:00
Julian Eisel
471378c666 Assets: Sort assets by catalog
Sort assets in asset shelf and asset browser by catalogs (and within
catalogs by name like before). This groups similar assets better,
reducing visual noise and making specific assets easier to find.

Pull Request: https://projects.blender.org/blender/blender/pulls/121316
2024-05-02 10:26:02 -04:00
Sergey Sharybin
1b0012d51c Refactor: Require C++ for users of BLI_simd.h
This is because sse2neon.h might be used to emulate SSE intrinsics
on ARM64 architecture, and it uses some preprocessor which is not
available for C language when using MSVC.

The old-style math file math_matrix.c uses this header, so needed
to become C++. Simple rename did not work since there is a new math
utility math_matrix.cc exists. Following some existing convention
the math_matrix.c is renamed to math_matrix_c.cc. Eventually all the
code should switch to use C++ style math, and the C style removed,
so it seems reasonable to not mix old and new style of API in the
same file.

There should be no functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/121335
2024-05-02 16:22:19 +02:00
Hans Goudey
a214d00f28 UI: Check for object modifier support in operator poll functions
Check whether the object supports modifiers in the clear and
copy to selected operators.
2024-05-02 10:12:46 -04:00
Falk David
cd93b6c925 Cleanup: GPv3: Compiler warning
Makes the function static and removes an unnecessary comment.
2024-05-02 14:56:55 +02:00
Campbell Barton
1b788f3a84 Fix #120778: Depth navigation no longer works for non-geometry objects
Regression in [0] that changed behavior of depth drawing to exclude
overlays which are needed so users can box-zoom to an armature or camera
for example. Add `V3D_DEPTH_NO_OVERLAY` when no overlays are desired.

[0]: 5fea1eda36
2024-05-02 22:36:05 +10:00
Campbell Barton
f15646df59 Fix failure to draw onto a surface with GPv3
GP_PROJECT_DEPTH_VIEW never used a surface depth and would
always use object-origin instead.
2024-05-02 22:34:43 +10:00
Lukas Stockner
17f2cdd104 Cycles: Add thin film iridescence to Principled BSDF
This is an implementation of thin film iridescence in the Principled BSDF based on "A Practical Extension to Microfacet Theory for the Modeling of Varying Iridescence".

There are still several open topics that are left for future work:
- Currently, the thin film only affects dielectric Fresnel, not metallic. Properly specifying thin films on metals requires a proper conductive Fresnel term with complex IOR inputs, any attempt of trying to hack it into the F82 model we currently use for the Principled BSDF is fundamentally flawed. In the future, we'll add a node for proper conductive Fresnel, including thin films.
- The F0/F90 control is not very elegantly implemented right now. It fundamentally works, but enabling thin film while using a Specular Tint causes a jump in appearance since the models integrate it differently. Then again, thin film interference is a physical effect, so of course a non-physical tweak doesn't play nicely with it.
- The white point handling is currently quite crude. In short: The code computes XYZ values of the reflectance spectrum, but we'd need the XYZ values of the product of the reflectance spectrum and the neutral illuminant of the working color space. Currently, this is addressed by just dividing by the XYZ values of the illuminant, but it would be better to do a proper chromatic adaptation transform or to use the proper reference curves for the working space instead of the XYZ curves from the paper.

Pull Request: https://projects.blender.org/blender/blender/pulls/118477
2024-05-02 14:28:44 +02:00
YimingWu
e8d028b7a5 Fix #121338: Depthdropper ensure viewport camera
Depthdropper should ensure that the viewport is in camera view to use
active camera position, otherwise it should still use rv3d->viewinv[3]
to ensure correct distance result.

Pull Request: https://projects.blender.org/blender/blender/pulls/121339
2024-05-02 13:24:22 +02:00
Amelie Fondevilla
725408e842 GPv3: Extrude operator
Implementation of the extrude operator for Grease Pencil v3.
If an endpoint is selected, the extrusion will extend the stroke.
If an inner point is selected, the extrusion will create a new stroke tied to the one that is selected.

Change of behavior from gpv2: the endpoints of a cyclic curve follow the same behavior as inner points.

Pull Request: https://projects.blender.org/blender/blender/pulls/121249
2024-05-02 12:51:30 +02:00
Christoph Lendenfeld
5b7a0ed1b5 Refactor: move keyingset enums to animrig
No functional changes expected.

This PR moves the enums
`eModifyKey_Modes` and `eModifyKey_Returns` to animrig
as enum classes.

Functions that take or return that value were also modified.

Pull Request: https://projects.blender.org/blender/blender/pulls/121132
2024-05-02 12:00:37 +02:00
Campbell Barton
530999fb76 Cleanup: add missing SPDX-FileCopyrightText 2024-05-02 16:46:26 +10:00
Campbell Barton
f6b7464b4c Cleanup: spelling in comments 2024-05-02 16:44:10 +10:00
Campbell Barton
41c43c9e87 Cleanup: use const pointers 2024-05-02 16:11:03 +10:00
Campbell Barton
523d84db85 Fix incorrect XDG_CURRENT_DESKTOP check
The string was checked for equality when the spec allows for `:`
delimiter characters.
2024-05-02 10:20:58 +10:00
Campbell Barton
594ee2c766 BLI_string: add BLI_string_elem_split_by_delim
Add a utility function to check if one string contains another
when split by a delimiter.
2024-05-02 10:20:56 +10:00
Jacques Lucke
5bc949b4a7 Fix: avoid tagging file as modified when clicking in node editor 2024-05-02 01:43:45 +02:00
Jacques Lucke
6cb9b7299d Fix: sample grid node uses wrong enum for data type
The used enum used the term "Value" instead of "Float".
Also the default value was wrong.
2024-05-01 23:29:56 +02:00
Jacques Lucke
ebd2762239 Fix: crash when applying geometry nodes with bake node 2024-05-01 23:11:58 +02:00
Iliya Katueshenock
831e91c357 Geometry Nodes: support working with raw matrix values
These nodes allow working with the raw values that make up a matrix.
This can be used to construct a 4x4 matrix directly, without using the
`Combine Transform` node. This allows building transforms with arbitrary
skew, or projection matrices.

Pull Request: https://projects.blender.org/blender/blender/pulls/121283
2024-05-01 21:31:08 +02:00
Jacques Lucke
17cc5d694c Fix #121214: invalid owner_tree pointer when node tree is overridden 2024-05-01 21:29:04 +02:00