Commit Graph

113218 Commits

Author SHA1 Message Date
Sybren A. Stüvel
b51d60a226 Anim: add iterator over Action Slot uses, with references
Add an iterator `foreach_action_slot_use_with_references(ID, callback)`
that provides references to the found `bAction` pointer and slot handle.
That way the callback can assign another Action or slot when it sees
fit, without having to know exactly what the source of this info is
(could be a direct assignment, but also an NLA strip or Action
Constraint).

Ref: #127844
Pull Request: https://projects.blender.org/blender/blender/pulls/127871
2024-09-20 10:30:15 +02:00
Philipp Oeser
44a845d650 Fix #127833: Action linked after particle settings duplication
Similar to how we do for new world, material, ..., no reason to not
duplicate Actions (no way otherwise to assign a different Action from
UI).

Fix similar to a75ac18638

Pull Request: https://projects.blender.org/blender/blender/pulls/127850
2024-09-20 09:37:12 +02:00
Jeroen Bakker
ec7fc8fef4 Vulkan: Parallel shader compilation
This PR introduces parallel shader compilation for Vulkan shader
modules. This will improve shader compilation when switching to material
preview or EEVEE render preview. It also improves material compilation.
However in order to measure the differences shaderc needs to be updated.

PR has been created so we can already start with the code review. This
PR doesn't include SPIR-V caching, what will land in a separate PR as
it needs more validation.

Parallel shader compilation has been tested on AMD/NVIDIA on Linux.
Testing on other platforms is planned in the upcoming days.

**Performance**

```
AMD Ryzen™ 9 7950X × 32, 64GB Ram
Operating system: Linux-6.8.0-44-generic-x86_64-with-glibc2.39 64 Bits, X11 UI
Graphics card: Quadro RTX 6000/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 550.107.02
```

*Test*: Start blender, open barbershop_interior.blend and wait until the viewport
has fully settled.

| Backend | Test                      | Duration |
| ------- | ------------------------- | -------- |
| OpenGL  | Coldstart/No subprocesses | 1:52     |
| OpenGL  | Coldstart/8 Subprocesses  | 0:54     |
| OpenGL  | Warmstart/8 Subprocesses  | 0:06     |
| Vulkan  | Coldstart Without PR      | 0:59     |
| Vulkan  | Warmstart Without PR      | 0:58     |
| Vulkan  | Coldstart With PR         | 0:33     |
| Vulkan  | Warmstart With PR         | 0:08     |

The difference in time (why OpenGL is faster in a warm start is that all
shaders are cached). Vulkan in this case doesn't cache anything and all
shaders are recompiled each time. Caching the shaders will be part of
a future PR. Main reason not to add it to this PR directly is that SPIR-V
cannot easily be validated and would require a sidecar to keep SPIR-V
compatible with external tools..

**NOTE**:
- This PR was extracted from #127418
- This PR requires #127564 to land and libraries to update. Linux lib
  is available as attachment in this PR. It works without, but is as slow as
  single threaded compilation.

Pull Request: https://projects.blender.org/blender/blender/pulls/127698
2024-09-20 08:30:09 +02:00
Sybren A. Stüvel
615cb46412 Anim: add Action Slot selector to Action Constraint
Add slotted Actions support to Action constraints.

The user interface can be improved once #127751 lands.

Ref: #120406
Pull Request: https://projects.blender.org/blender/blender/pulls/127749
2024-09-20 08:07:15 +02:00
Sean Kim
e37f5616f5 Cleanup: Make depth naming variables consistent
Follow up to 5d40992fe8.

In the PBVH API, some contexts that take a `float *` parameter named
`depth` use it purely as a return value, other places, however, read
from and write to this parameter.

In the former case, this commit either adds or keeps the `r_` prefix, in
the latter, this commit ensures the parameter has no prefix to avoid
misleading future readers.

Pull Request: https://projects.blender.org/blender/blender/pulls/127886
2024-09-20 06:50:54 +02:00
YimingWu
800d543fa5 Fix #127745: Increase "angle_limit" display precision
The property "angle_limit" in bevel and decimate modifier only has a
display precision of 2, but the steps are in 0.1 for each click, so
clicking does not necessarily cause the display number to update. Set
precision to 4 to allow fractions to be displayed properly.
2024-09-20 11:49:43 +08:00
Campbell Barton
8485aaf105 Cleanup: correct copyright, SPDX header 2024-09-20 13:14:58 +10:00
Campbell Barton
0fc27c8d81 Cleanup: spelling in comments 2024-09-20 13:14:57 +10:00
Campbell Barton
02345de80b Docs: improve wording in doc-strings for ED_view3d.h 2024-09-20 12:52:22 +10:00
Hans Goudey
9d225f7116 Sculpt: Avoid face corners counting overhead in drawing code
Currently the `sum_group_sizes` call used to count the number
of elements in GPU vertex buffers for each PBVH node stands out
in profiles, taking a few percent of the total time when building
PBVH GPU data. Since the number of corners in a node doesn't
change, it's simpler to just store it in the node. We could
eventually cache it somewhere else too, if there was a benefit
to not storing it in the node itself.
2024-09-19 22:31:55 -04:00
Sean Kim
4dc51e56b2 Cleanup: Silence clang defaulted-function-deleted warning
Because the pbvh::Tree has a unique_ptr, the copy assignment constructor
is implicitly deleted. This change makes that fact explicit by declaring
the entire object's copy assignment constructor as deleted.

Pull Request: https://projects.blender.org/blender/blender/pulls/127884
2024-09-20 03:02:52 +02:00
Sean Kim
5cc7687a1a Cleanup: Silence gcc used uninitialized warning
Missed in 5d40992fe8

Pull Request: https://projects.blender.org/blender/blender/pulls/127883
2024-09-20 01:58:56 +02:00
Sean Kim
5d40992fe8 Cleanup: Various non-functional PBVH raycast changes
A set of general tidying steps prior to making some PBVHVertRef changes

* Add const where possible
* Add r_ prefix for return parameters
* Use pass-by-reference instead of pointer for some return parameters
* Use std::array's .size() operator for some iteration bounds
* Use float3 for some variables

Pull Request: https://projects.blender.org/blender/blender/pulls/127832
2024-09-19 21:27:41 +02:00
Sean Kim
fbc8ef56ef Fix #127557: Polyline gesture creates extra point
This commit adds a bool to signal the user's intent so that dependent
code can determine the number of points the gesture should have.

Pull Request: https://projects.blender.org/blender/blender/pulls/127827
2024-09-19 21:22:42 +02:00
Hans Goudey
43e4f93ca3 Cleanup: Use index mask utility function for setting bits 2024-09-19 15:16:58 -04:00
Hans Goudey
c2dd238ba1 Refactor: Sculpt: Use static constructors for PBVH build 2024-09-19 15:14:35 -04:00
Hans Goudey
c8ed2b695a Cleanup: Formatting 2024-09-19 14:54:25 -04:00
Harley Acheson
b5fc1683fd UI: Use WM_CURSOR_EDIT For Corner Hover Cursor with Docking
Prior behavior when hovering over the corner action zones the mouse
cursor would change to WM_CURSOR_EDIT (like a plus sign). With docking
that is WM_CURSOR_HAND, but on other platforms it is WM_CURSOR_MOVE.
Unfortunately on some platforms WM_CURSOR_MOVE does not show a
different cursor from default so there isn't an change when hovering
the corner.  This PR changes this back to WM_CURSOR_EDIT for non-Mac
platforms.

Pull Request: https://projects.blender.org/blender/blender/pulls/127878
2024-09-19 20:22:13 +02:00
Hans Goudey
598c2a1032 Mesh: Add version of set custom normals functions for normalized values
Followup to 1939eb03a7.
The values are expected to already be normalized in these cases.
2024-09-19 14:18:08 -04:00
notrudyyy
1939eb03a7 Refactor: Mesh: Normalize input normals in set custom normals
To reduce code duplication in importers, modifies the C++
set_custom_normals API functions to normalize the input normals.

Reverts !124336, !124267, and !124261 as the normalization now
occurs in the API call.

Resolves #124358.

Pull Request: https://projects.blender.org/blender/blender/pulls/127814
2024-09-19 20:12:40 +02:00
Jacques Lucke
69f9366911 Fix #127045: regression when importing assets from the asset browser
The behavior was unintentionally changed in 2858c3b287. This patch brings back
the old behavior when dragging objects/collections from the asset browser into
the 3d view, while still keeping the loose-data-instantiation separate from the
core import code.

The `view3d_ob_drop_copy_external_asset` and `view3d_collection_drop_copy_external_asset`
functions are turned to their old state before the refactor.

Pull Request: https://projects.blender.org/blender/blender/pulls/127452
2024-09-19 18:43:52 +02:00
Philipp Oeser
f9ebc493ee Fix #127836: Cloth Pinch brush regression in behavior
Caused by c06e2ccde7

In said commit, a `mul_v3_v3fl` was turned into a subtraction? Seems
wrong, turning this back to multiply seems to give the previous
behavior.

Pull Request: https://projects.blender.org/blender/blender/pulls/127848
2024-09-19 18:34:51 +02:00
Aras Pranckevicius
f0de61c19e Cleanup: early outs in IMB_colormanagement functions on error conditions
Suggested by Sergey in another PR:
https://projects.blender.org/blender/blender/pulls/127467#issuecomment-1297753
2024-09-19 19:26:59 +03:00
Aras Pranckevicius
67f0358a0a VSE: Optimize the Tonemap modifier
VSE tonemap is 12-15 times faster.

1) multi-threaded image luminance calculation,
2) avoid calling into OpenColorIO per-pixel, instead do that in
   larger batches,
3) for float images (which are primary target for tonemapping),
   do not do "to linear space" conversion twice.

Applying tonemap on 4K resolution EXR image, on Ryzen 5950X (Win10/VS2022):

- R/D Photoreceptor mode: 405 -> 31 ms
- Rh Simple mode: 388 -> 23 ms

Pull Request: https://projects.blender.org/blender/blender/pulls/127467
2024-09-19 18:14:49 +02:00
Jacques Lucke
08b29ac143 Refactor: Core: add getter functions for data-block name
This adds a new `BKE_id_name` function. It should be used in places where we
currently do something like `id.name + 2`.

This patch just adds the function and uses them in a small subset of possible
cases. Given that there are >700 cases that need to be replaced, I'd rather to
that in chunks instead of all at once.

Pull Request: https://projects.blender.org/blender/blender/pulls/127410
2024-09-19 18:13:47 +02:00
Falk David
1449b943df Fix #127869: Crash when using pick selection in edit mode
The issue was that `retrieve_editable_drawings_grouped_per_frame`
returned garbage memory, leading to a crash a bit further.

The fix adds a nullptr check to make sure the `current_drawing` exists
and can be safely dereferenced.
2024-09-19 17:35:22 +02:00
Hans Goudey
9e920bc95b Refactor: Sculpt: Add scene argument to undo step creation functions
This is necessary for using the 3D cursor instead of the sculpt pivot (#118250).
It's committed separately from #127863 to make that diff smaller.
2024-09-19 11:28:38 -04:00
Sybren A. Stüvel
fe68190923 Anim: fix group name check in Action constraint
Action constraints on an Object will pass a `nullptr` as group name to
another function, which didn't handle this properly.

Pull Request: https://projects.blender.org/blender/blender/pulls/127865
2024-09-19 17:25:52 +02:00
Sybren A. Stüvel
6ebe7a3985 Anim: don't evaluate the Action constraint if it has no Action
Skip the evaluation of the Action constraint when no Action is set.

Before, the constraint would run an entire animation data evaluation
cycle on a fake object, with the given (but NULL) Action. Now it's just
skipped.
2024-09-19 17:25:51 +02:00
Lalit Shankar Chowdhury
6d8d21812b Fix #126983: custom nodes and groups icon missing
Fix regression caused by commit b120440f7c.

Pull Request: https://projects.blender.org/blender/blender/pulls/127263
2024-09-19 17:05:21 +02:00
Jonas Holzman
9453ff6995 macOS: Splash Screen notice to about reduced performance on Rosetta
Implements a simple splash screen notice displayed if an x86/Intel macOS
Blender build is ran on an Apple Silicon Mac to warn against reduced
performance.

On the technical side of things, this adds a function that detects if
the current process is currently running through Rosetta using `sysctl`.
Implementation wise, I tried to keep this function contained in a single
conditional preprocessor macro block in the same file for simplicity.

Co-authored-by: Harley Acheson <harley.acheson@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/124382
2024-09-19 16:38:08 +02:00
Nathan Vegdahl
02d0c258d9 Anim: define RNA subtypes of ActionStrip, and refine to those types
This is a follow up to #126559. In that PR I temporarily removed the
strip subtypes from RNA because I didn't have the brain space to tackle
updating that at the same time.

This PR restores the strip subtypes in RNA, even though the strip
themselves don't exist as separate C++ types anymore. Now the RNA type
that we present the strip as depends on the type of strip data the strip
references.

Note that currently there is only one subtype: the keyframe strip.

Pull Request: https://projects.blender.org/blender/blender/pulls/127859
2024-09-19 16:31:06 +02:00
casey bianco-davis
421d6c55ae GPv3: Implement the set_origin operator.
Add support the "Set Origin" operator for Grease Pencil objects.
Unlike GPv2, this will update radius properly.

Pull Request: https://projects.blender.org/blender/blender/pulls/127543
2024-09-19 15:27:29 +02:00
Hans Goudey
f82af7fa19 Cleanup: Sculpt: Remove unused PBVHVertRef function
Part of #118145.
2024-09-19 09:09:42 -04:00
Sybren A. Stüvel
3fcd153d89 Anim: fix unit test when built without experimental features
The `ActionQueryTest` unit test was unconditionally creating a layered
Action, which fails the test when Blender was built without experimental
features.

Pull Request: https://projects.blender.org/blender/blender/pulls/127840
2024-09-19 14:47:59 +02:00
Sybren A. Stüvel
823ee1ac92 Anim: add F-Curve getter functions that work with legacy & layered Actions
Add some F-Curve getter functions that work in all these situations:

- Built without experimental features.
- Built with experimental features, and called with legacy Action.
- Built with experimental features, and called with layered Action.

No functional changes, just useful tools for migrating to the new
Actions API.

Ref: #120406

Pull Request: https://projects.blender.org/blender/blender/pulls/127841
2024-09-19 14:46:25 +02:00
Casey Bianco-Davis
929f17ab2b GPv3: Add reset_uvsoperator
This implements `GPENCIL_OT_reset_transform_fill` for GPv3 and
renames it to `GREASE_PENCIL_OT_reset_uvs`

Pull Request: https://projects.blender.org/blender/blender/pulls/126217
2024-09-19 14:19:34 +02:00
Casey Bianco-Davis
2a4b298802 GPv3: Implement view_selected for edit mode
This adds `view_selected` (i.e. `NUMPAD_PERIOD`) when in edit mode of a
grease pencil object.

Pull Request: https://projects.blender.org/blender/blender/pulls/126448
2024-09-19 14:18:03 +02:00
Falk David
bdb4233279 GPv3: Rename property name of noise modifier
The `factor` property that controls the noise on the positions
was named `Offset Factor` in RNA but this name is overriden
in the modifier to `Position`.

When this property is e.g. keyed the RNA UI name is used
which can be very confusing.

This renames the RNA UI name to "Position Factor" to avoid
this confusion.
2024-09-19 14:14:50 +02:00
Clément Foucault
c92514f1e7 Fix #124567: No Normals pass when combining two shader to RGB
The unlit packing could write to the (non-existing) 4th
closure bin inside the gbuffer header leading to no
combined pass shader being invoked for these specific
(complex) materials.

Making sure the unlit workaround writes to bin 0 fixes the
issue.

Pull Request: https://projects.blender.org/blender/blender/pulls/127811
2024-09-19 14:11:20 +02:00
Clément Foucault
02cf5f5f0f Fix #127774: Flat Object matrix leads to incorrect culling
Object with degenerate transform matrix can lead to flat
bounds on GPU. This in turn lead to NaN intersection planes
inside `IsectBox`.

Compute (pseudo) size of matrix and bypass culling is any
axis is too small.

The other part of the patch makes sure that there is a
distinction between disabled culling and invalid
bounding boxes.

Pull Request: https://projects.blender.org/blender/blender/pulls/127807
2024-09-19 14:09:57 +02:00
Sean Kim
4291ab855c GPv3: Add Reproject operator
This commit adds the `Reproject Strokes` operator in the
`Grease Pencil` > `Cleanup` menu in edit mode.

All similar operator settings have been ported over from GPv2.

Pull Request: https://projects.blender.org/blender/blender/pulls/127735
2024-09-19 14:06:10 +02:00
Sybren A. Stüvel
38e15412dd Fix #127755: 4.3 regression: Some rigged meshes do not load properly
Revert part of 9530852347 as that did not
take into account that the `max` property may actually be smaller than
the `min` property.

I've also taken the liberty to document this fact in some comments.

The fix for the crash when `min == max` is still in place.
2024-09-19 13:57:30 +02:00
Nathan Vegdahl
91fd95bad4 Cleanup: make strip_keyframe_data_append() doc comment accurate 2024-09-19 13:56:19 +02:00
Jeroen Bakker
214a47f15c Vulkan: Make Unused Attachments Optional
Windows/Intel and Apple drivers do not support dynamic
rendering unused attachments. Due to mistakes we made
this extension partly optional. Eg. the extension was
optional, but its settings were not.

This PR makes the extension fully optional. However
without the extension some drivers might make incorrect
assumptions. This should be solved when it is more clear
why some drivers are still crashing when using dynamic
rendering.

Pull Request: https://projects.blender.org/blender/blender/pulls/127839
2024-09-19 13:03:50 +02:00
Pratik Borhade
ba6126dbbd Fix #127604: Skip unlink operator for linked materials
Materials of a linked object can be unlinked from outliner id operation
which should not be possible. Add an extra check to avoid this.

Pull Request: https://projects.blender.org/blender/blender/pulls/127686
2024-09-19 12:54:23 +02:00
Pratik Borhade
912c6d9a3c Fix #127620: Disable smooth operator for linked objects
Shade flat/smooth operators are callable when linked but greyed out if
objects are overridden. Disable these operators in UI for linked objects.

Pull Request: https://projects.blender.org/blender/blender/pulls/127681
2024-09-19 12:53:22 +02:00
Jonas Holzman
b427253a4d Obj-C Refactor: General Code Style cleanups
As part of a more general Objective-C GHOST refactor and in an effort to
modernize the macOS backend for further works, this commit cleans up the
codestyle of Objective-C files. Based off the Blender C/C++ style guide,
in addition to some Objective-C specific style changes.

Changes:
- `const` correctness, use nullptr, initializer list for simple struct
- Reduced variable scope for simple functions, removed unused variables
- Use braces for conditional statements, no else after return
- Annotate inheritted function of GHOST Cocoa classes with override and
  use `= default` to define trivial constructors
- Use #import instead of #include for Objective-C headers
    This is only for correctness. As the Objective-C #import directive
    is really just an #include with an implicit #pragma once.
- Use proper C-style comments instead of #pragma mark
    #pragma mark is an XCode feature to mark code chapters, to follow
    the Blender codestyle, and make the Objective-C code more editor
    agnostic, these were replaced with multi-line C-style comments.

Ref #126772

Pull Request: https://projects.blender.org/blender/blender/pulls/126770
2024-09-19 11:37:52 +02:00
YimingWu
11bf2b9a62 Fix #127539: Prevent multi-object editing in GPv3
Multi-object editing is not supported in GPv3 right now,
do not allow multiple GPv3 objects to go into edit mode
at the same time.

Pull Request: https://projects.blender.org/blender/blender/pulls/127796
2024-09-19 11:22:15 +02:00
Lukas Tönne
3a1ab067f2 Fix #127342: Support Curve domain when selecting by vertex group
This requires writing selection attributes to a different domain than
the Point domain.

Note that for assigning/removing from vgroups the `adapt_domain`
function is used implicitly by always looking up attributes from the
Point domain: ".selection" may be stored on Curves and will
automatically be adapted to points. For select-by-vgroup `adapt_domain`
cannot be used because the selection has to be "greedy" (one point
selects the whole curve).

Pull Request: https://projects.blender.org/blender/blender/pulls/127799
2024-09-19 10:59:55 +02:00