Commit Graph

117289 Commits

Author SHA1 Message Date
Charlie Jolly
b1fc786653 Fix #127897: GPv3 Trim Stroke Ends crash on lines without intersections
Add check to see if curve has intersections before deleting the segments.

Pull Request: https://projects.blender.org/blender/blender/pulls/127918
2024-09-20 17:59:11 +02:00
Jacques Lucke
3506dc42c3 Fix: add missing include 2024-09-20 17:53:16 +02:00
Philipp Oeser
b58f61a91a Fix: inconsistent bone selection after hiding or changing selectability
In blender, hidden items should not be selected.
Also, making an item unselectable should deselect it.

- in armature editmode (unlike posemode), hiding a bone through RNA
(unlike though the Outliner) would not deselect the bone
- in armature editmode (unlike posemode), hiding a bone through RNA
would not update the Outliner
- in armature posemode (unlike editmode), making a bone unselectable did
not deselect it (at least it did not update properly)

To resolve, add deselection to the RNA update functions and add needed
depsgraph tagging
Also add Bone selectability checkbox to Properties Editor (could be
split in a separate commit) -- came up in #127180.

Pull Request: https://projects.blender.org/blender/blender/pulls/127340
2024-09-20 17:42:41 +02:00
Falk David
c20399442d Fix #127906: Issues with reproject operator
There were some issues with the operator:
* The `keep_original` option could easily crash blender.
* The surface projection did not work correctly.

This commits fixes those issues. The `keep_original` was
missing a tag for the topology that changes in the
drawing. The surface projection needed to cache the
viewport depths. This is done once and then used
to initialize the `DrawingPlacement`.
2024-09-20 16:53:41 +02:00
Jacques Lucke
c0179a1b78 Nodes: show panel description when hovering over panel headers
We already have the `description` property on panels but are currently not
displaying it when hovering over a panel header. With this patch, the
descriptions will be shown in group nodes as well as the geometry nodes
modifier.

I had to do two lower level changes for layout panels because it didn't work
with tooltips properly.
* Tooltips make the label in the panel header interactive, but clicking to
  open/close the panel should still work.
* The tooltip should disappear when clicking on the header. This is consistent
  with tooltips in other places.

Pull Request: https://projects.blender.org/blender/blender/pulls/127852
2024-09-20 16:24:09 +02:00
Jacques Lucke
3ccfa65245 Geometry Nodes: support packing bakes into .blend files
Previously, it was only possible to bake to disk with geometry nodes. This patch
adds support for storing the baked data directly in the .blend file.

By default, new bakes are stored in the .blend file now. Whether a new bake
should be packed or stored on disk can be configured in two places: in the
properties of the bake node and in the bake panel of the modifier. These
settings don't affect existing bakes, only the next bake.

To unpack or pack an individual bake, there is a new operator button next to the
bake button. The icon and the label below indicate where the bake is currently
stored. The label now also contains the size of the bake.

To unpack or pack all bakes, the `File > External Data > Pack Resources / Unpack
Resources` operators can be used. The unpack operator also has a new title that
mentions the number if individual files separate from the number of bakes. This
works better than just listing a number of files because a bake can consist of
many files.

Pull Request: https://projects.blender.org/blender/blender/pulls/124230
2024-09-20 16:18:12 +02:00
Falk David
645aa27965 Cleanup: Format 2024-09-20 15:48:45 +02:00
Miguel Pozo
88c84e6a37 Fix #124514: Wrong "slight defocus" DoF
The radius was not used for the sampling offset.

Pull Request: https://projects.blender.org/blender/blender/pulls/127880
2024-09-20 15:22:23 +02:00
Christoph Lendenfeld
34a18c7608 Anim: Merge Animation operator
This adds the "Merge Animation" (`ANIM_OT_merge_animation`) operator to the 3D viewport.
It merges the animation of all selected objects into the animation of the active object.

On a technical level this moves the `ChannelBag` of the source action into a new slot
on the target action. The Slot name is copied but might differ due to name clashes.
Due to this, the operator is named "Merge Animation" and not "Merge Actions" since
it might not merge the complete actions but only the slots actually used by the selection
in the 3D viewport

This operator will find all related IDs to the selection, i.e. object data, shape keys etc. and merge those as well.
That means this operator can also be used to JUST merge the actions of the active object and its data.

### Caveats
Because there may be more than 1 slot user this might reassign an object that isn't actually selected.
The other option is that when there is more than 1 slot user, the `ChannelBag` is copied instead of moved.
That means moving objects that share a slot one by one would result in a loss of slot sharing and
data duplication. I think it's better to respect the artist decision of "these things use the same animation"
in this case. (open to opinions though)

Design task: #126937

Pull Request: https://projects.blender.org/blender/blender/pulls/127414
2024-09-20 15:08:16 +02:00
Lukas Tönne
057a6c3efd Fix: GPv3: Clone tool crashes due to index range regression
The `IndexRange::total_size` function was changed in ba28469e45.
This broke the grease pencil clipboard paste function, because it
already subtracts the starting index, leading now to invalid index
ranges. Removing the duplicate fixes this issue.

Pull Request: https://projects.blender.org/blender/blender/pulls/127907
2024-09-20 14:55:51 +02:00
Sybren A. Stüvel
26379c2b01 Anim: Update Action Slot selectors in the UI
Now that #127751 has landed, `layout.template_slot(...)` calls can pass a
text to use as label. This produces a nicer layout than possible before.

Pull Request: https://projects.blender.org/blender/blender/pulls/127905
2024-09-20 14:33:24 +02:00
Bastien Montagne
b2e50d5886 Revert "Cleanup: add missing struct qualifier"
`struct` keyword for members and parameters is not necessary in C++
headers, as long as the struct has been declared previously.

This reverts commit 09e459589f.
2024-09-20 13:42:13 +02:00
Bastien Montagne
3e03576b09 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
Nathan Vegdahl
b200d1f975 Anim: remove strip data as well when an action strip is removed
This is a follow up to #126559. In that PR, strip data is never deleted even
when the strip that uses it is. Thus, the strip data array just keeps growing as
more strips are added, and never shrinks.

This PR implements that deletion. The approach is simple: remove the strip data
from the array using a swap-remove that swaps in the last item in the data
array, and then loop over the strips in the action to update any that were
referencing that swapped-in item. Additionally, before removal we check to make
sure the data item isn't still being used by any strips, and if it is then we
don't remove it.

Pull Request: https://projects.blender.org/blender/blender/pulls/127837
2024-09-20 13:07:15 +02:00
Julian Eisel
439d4dfc3c Fix: UI: Small layout glitch with search template and decorators
Button layout wouldn't be entirely correct with split layout was
enabled, but decorators disabled (`uiLayout.use_property_split = True`,
`uiLayout.use_property_decorate = False`).

See https://projects.blender.org/blender/blender/pulls/127751#issuecomment-1298468.
2024-09-20 13:06:21 +02:00
Julian Eisel
7d97f99dfc Refactor: UI: Avoid confusing layout property split return value
The function would return two very different layouts in different code
paths, making it not clear to the caller what to expect. For one code
path the return value was rather useless, and in fact unused, so I was
able to just remove this. Also clarified behavior and return values in
the function API comment.
2024-09-20 12:33:56 +02:00
Julian Eisel
a3a5793a28 UI: Allow label for search template (respecting property split layout)
Since 5bcb0c9935, `uiLayout.template_ID()` already supports passing a label, in
which case the `uiLayout.use_property_split` would be respected. This makes the
template fit nicely with the surrounding layout, where buttons might have a
label split on the left, and a decorator button on the right.

This change brings the same to `uiLayout.template_search()`, plus makes it
respect `uiLayout.use_property_decorate`

Pull Request: https://projects.blender.org/blender/blender/pulls/127751
2024-09-20 12:24:36 +02:00
dereck
24dfc75c4b Spreadsheet: add tooltips to float and int values to see the complete value
Sometimes it is inconvenient to see some large numbers in the spreadsheet
because they are cut off.

This commit adds tool tips to the spreadsheet when hovering the mouse
over a normal float or int value.

Pull Request: https://projects.blender.org/blender/blender/pulls/127588
2024-09-20 12:23:34 +02:00
Campbell Barton
09e459589f Cleanup: add missing struct qualifier 2024-09-20 19:52:01 +10:00
Bastien Montagne
60013228e1 Fix #126205: Do not rebuild collection caches on any ID deletion.
Deleting ID would systematically call `BKE_main_collection_sync_remap`,
which would invalidate all collection caches. This should only be needed
when deleting a Scene, Collection or Object ID.

Pull Request: https://projects.blender.org/blender/blender/pulls/127866
2024-09-20 11:14:22 +02:00
Sean Kim
bd7c6208b7 GPv3: Add Bake Grease Pencil Animation operator
This commit ports over the legacy Grease Pencil "Bake Object Transform
to Grease Pencil" (`GPENCIL_OT_bake_grease_pencil_animation`) to GPv3.

It is accessed in the same location as the old operator, via the menu
path Object > Animation > Bake Object Transform to Grease Pencil

Pull Request: https://projects.blender.org/blender/blender/pulls/126581
2024-09-20 10:53:31 +02:00
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