Commit Graph

111408 Commits

Author SHA1 Message Date
YimingWu
ea56b408ef Fix #124526: VSE: Null check for seq->scene.
In `sequencer_check_scene_recursion`, `seq->scene` can be null which
leads to crashes, thus guard against that.

Pull Request: https://projects.blender.org/blender/blender/pulls/124536
2024-07-12 05:17:59 +02:00
Richard Antalik
d97c4e6606 Merge branch 'blender-v4.2-release' 2024-07-12 04:06:29 +02:00
Richard Antalik
5d9f9f9964 Fix: VSE handle position drawing is reversed
When left handle is selected, right handle position was displayed.

Pull Request: https://projects.blender.org/blender/blender/pulls/124503
2024-07-12 03:59:19 +02:00
Lukas Stockner
ca39a60863 Fix: Reduce AnimData versioning overhead for node socket changes
Since the code only does anything if both substrings are found, implement
an early-out if either of them isn't found.

This seems like a micro-optimization at first, but since the current node
socket versioning requires looping over all AnimData in the file, this adds
up to e.g. 1.9sec saved when loading the Spring benchmark file.
2024-07-12 03:43:04 +02:00
Lukas Stockner
399498fdc0 Fix: Slow versioning on files with many meshes due to unnecessary loop
Unlike most versioning helper functions, version_mesh_crease_generic
takes care of all meshes in the blend file. However, the versioning
code was looping over all meshes and calling it for each one anyways.

This doesn't do anything after the first iteration, but it results
in quadratic time complexity w.r.t. number of meshes and manages to
waste e.g. 600ms when loading the Spring benchmark file.
2024-07-12 03:41:34 +02:00
Harley Acheson
82ca220ad4 Cleanup: Const Arguments for ScrArea name_get Functions
Const arguments for ED_area_name, and space_name_get callbacks.

Pull Request: https://projects.blender.org/blender/blender/pulls/124560
2024-07-12 01:13:44 +02:00
Harley Acheson
a82954cb63 UI: Improved Area Icon Using a SpaceType Callback
Centralized method to obtain ScrArea icons. Areas can add an optional
space_icon_get callback to provide an icon that differs by subtype. If
not defined then ED_area_icon will return RNA UI icon, which is correct
in cases without area subtypes.

Pull Request: https://projects.blender.org/blender/blender/pulls/124556
2024-07-12 00:08:19 +02:00
Sean Kim
66c1341ef9 Cleanup: make format 2024-07-11 11:58:54 -07:00
Pratik Borhade
7ee2938bc1 Fix #124468: UI is not refreshed after copying modifier using Outliner
Add notifier when copying a modifier to a different object so that
Properties and Outliner can update and redraw.

Pull Request: https://projects.blender.org/blender/blender/pulls/124510
2024-07-11 20:55:21 +02:00
Sean Kim
4f73bf2871 Sculpt: Initial data oriented refactor of relax face set brush
Part of #118145.

For each of the PBVH types, the refactored Relax Face Set brush
performs the following steps:
* Calculate all relevant element factors like other refactored brushes
* Calculate the displacement by performing the following steps, using a
  displacement of 0 if certain conditions are unfulfilled (e.g. factor
  will have no effect, no relevant neighbor vertices, etc)
  * Find all neighbors for each element
  * Filter the neighbors based on if the current vert is or is not a
    boundary vert, looking at the face sets of each neighbor
  * From the relevant neighbors, calculate a smoothed average position.
  * For boundary verts, calculate the normal based on the summed
    direction towards each neighbor vertex
  * For non-boundary verts, retrieve the current vertex normal.
  * Use the current position and the retrieved normal to create a
    plane.
  * Find the closest point on the plane to the smoothed position, use
    this as the final displacement
* Apply all of these displacements to the relevant elements

Q: Why do we perform three different parallel loops for each method
instead of a single one like other brushes?

Because much of the processing time for these functions is spent in the
neighbor calculation, we opt to process factors in an earlier loop to
short-circuit neighbor calculation if we know it cannot possibly have
an effect (i.e `factor[i] == 0.0f`)

Q: Why are lambdas used in `filtered_neighbors` ?
Simply put, reducing the overall amount of code duplication,
otherwise this function would require 6 different methods to do the
necessary filtering (boundary vs non boundary vertices for each of the
three pbvh types)

### Potential Areas of Improvement
* Unique face set calculation requires iterating over the
  `vert_to_face` map and happens multiple times per brush stroke (each
  stroke performs the vertex tasks 4 times in succession). Some form of
  cache or precomputed map similar to the `boundary_verts` `BitSpan`
  may improve performance.

Pull Request: https://projects.blender.org/blender/blender/pulls/124135
2024-07-11 20:55:03 +02:00
Harley Acheson
1f3d1048d4 Fix #124070: Improved Area Names Using a SpaceType Callback
Centralized method to obtain ScrArea names. Areas can add an optional
space_name_get callback to provide a name that differs by subtype. If
not defined then ED_area_name will return RNA UI name, which is correct
in cases without area subtypes. This eliminates the current use of
RNA_property_enum_name_gettexted using a temporary context, which
results in the reported (hard to duplicate) error.

Pull Request: https://projects.blender.org/blender/blender/pulls/124488
2024-07-11 20:40:06 +02:00
Sean Kim
c3243f363d UI: Voxel Size Edit status display
Updates the `OBJECT_OT_voxel_size_edit` operator to use the new
workspace status display.

Pull Request: https://projects.blender.org/blender/blender/pulls/124492
2024-07-11 20:22:48 +02:00
Sean Kim
f966bb9ed4 UI: Dyntopo Detail Size Edit status text
Updates the `SCULPT_OT_dyntopo_detail_size_edit` operator to use the
new workspace status display.

Pull Request: https://projects.blender.org/blender/blender/pulls/124495
2024-07-11 20:22:16 +02:00
Hans Goudey
9a343ccc9f Cleanup: Sculpt: Use C++ Array and destructor for StrokeCache 2024-07-11 14:18:32 -04:00
Hans Goudey
143fcd3022 Cleanup: Sculpt: Use std::unique_ptr for cloth sim data 2024-07-11 14:18:32 -04:00
Hans Goudey
06dea7c1b2 Cleanup: Sculpt: Use C++ Array/Vector in cloth sim state 2024-07-11 14:18:32 -04:00
Sean Kim
5ddaf6dfd7 Refactor: WM: Use mval for polyline gesture
When this was originally implemented, the `mval` attribute `wmGesture`
didn't exist. This commit switches the current mouse position from being
stored in the last element of the point array to `mval`.

Pull Request: https://projects.blender.org/blender/blender/pulls/124489
2024-07-11 20:17:02 +02:00
Sean Kim
10b871a211 Fix: Dyntopo sample detail doesn't update status text
Pull Request: https://projects.blender.org/blender/blender/pulls/124494
2024-07-11 20:12:19 +02:00
Sean Kim
daee90c7cc Sculpt: Add report for invalid mode for trim tools
Pull Request: https://projects.blender.org/blender/blender/pulls/124498
2024-07-11 20:11:15 +02:00
John Kiril Swenson
901f5495cb VSE: Fix strip icon drawing
VSE icon drawing is larger than previous after #123700, and has an
incorrect check if there is enough space to show them. This PR restores
uses of MISSING_ICON_SIZE and fixes the minimum size check.

Pull Request: https://projects.blender.org/blender/blender/pulls/124378
2024-07-11 19:18:13 +02:00
Julian Eisel
942cefdf91 Fix: Applying poses in asset shelf broken after own earlier fix
This mostly reverts d6e9438e60 and applies a different fix. Consuming
events here would break firing operators on these events, which is what
the pose library does. Added a comment to note this, because this is not
the first time that I want to change this return value to consume
events.
2024-07-11 19:16:57 +02:00
Jacques Lucke
83373002d2 Cleanup: use more C++ containers in BlendfileLinkAppendContext
This replaces two members of `BlendfileLinkAppendContext`:
* `LinkNodePair libraries` -> `Vector<BlendfileLinkAppendContextLibrary *>`
* `LinkNodePair items` -> `std::list<BlendfileLinkAppendContextItem *>`

This simplifies the code quite a bit.

Making `libraries` a `Vector` works because afaik we never iterate over the
libraries while also adding new ones (which would invalidate iterators). It's
also nice, necause we use random access in some cases.
`items` can't become a vector, because afaik more items may be added while
iterating over it. So it's still a linked list now, but with a better type that reduces
boilerplate a lot.

Pull Request: https://projects.blender.org/blender/blender/pulls/124524
2024-07-11 18:44:38 +02:00
Jacques Lucke
f56a74287c Cleanup: use Map for linked_ids_to_local_liboverrides
Pull Request: https://projects.blender.org/blender/blender/pulls/124520
2024-07-11 18:44:20 +02:00
Jacques Lucke
436f4570c2 Cleanup: move weak reference map to C++
This replaces a `GHash` with `Map<LibWeakRefKey, ID *>` which simplifies the code.

Pull Request: https://projects.blender.org/blender/blender/pulls/124519
2024-07-11 18:43:35 +02:00
Jesse Yurkovich
6ace3eb065 Merge branch 'blender-v4.2-release' 2024-07-11 08:44:58 -07:00
Jesse Yurkovich
af85fd3b22 Fix: Safely handle >4 channel float images inside IMB_dupImBuf
While investigating #124217 it was noticed that sometimes a >4 channel
ImBuf might be passed through to this api.

This would cause memory to be overwritten because the destination ImBuf
was created with only 4 channels of memory. Now we create it with the
proper number of channels.

Pull Request: https://projects.blender.org/blender/blender/pulls/124472
2024-07-11 17:44:09 +02:00
Jesse Yurkovich
7a076d26a6 Fix: Guard against null operation in ImageNode::convert_to_operations
Properly guard the conditionals inside ImageNode::convert_to_operations
against null operations.

I've duplicated the null check in order to not add another layer of
nesting in an already very deep set of conditionals.

Pull Request: https://projects.blender.org/blender/blender/pulls/124473
2024-07-11 17:43:45 +02:00
Jesse Yurkovich
a362c225c0 Fix #124479: Collection Export: Clear last-used operator properties
Collection Export and File->Export were inadvertently sharing the
"last used" operator properties.

This would cause settings that were used during File->Export to
interfere, silently, when exporting the collections. Or vice versa.

Pull Request: https://projects.blender.org/blender/blender/pulls/124481
2024-07-11 17:42:49 +02:00
Jacques Lucke
549f567743 Merge branch 'blender-v4.2-release' 2024-07-11 17:27:42 +02:00
Jacques Lucke
85760b6a13 Fix #123974: handle corrupted file missing baked data more gracefully 2024-07-11 17:25:29 +02:00
Sybren A. Stüvel
6e683e26cc Anim: Add dopesheet & graph editor filtering support for layered Actions
Add name-based filtering and graph editor visibility filter to layered
Actions.

Pull Request: https://projects.blender.org/blender/blender/pulls/124528
2024-07-11 16:39:00 +02:00
YimingWu
d52e5e6fc0 Fix (Unreported): VSE: handle ed==null in SEQ_retiming_selection_get
When creating a new scene, ed can be null when switching to a vse
space, now will return early.
2024-07-11 22:28:43 +08:00
Jacques Lucke
c9766f31e0 Fix: handle non-array attributes when resampling curve
Previously, this code would crash when there are vertex groups which are
not stored as simple arrays. This happened e.g. in #124416.

All non-array attributes are converted to array-attributes with this change
for now, which is better than crashing.
2024-07-11 16:19:33 +02:00
Julian Eisel
d6e9438e60 Fix #124448, #115549: View Drag drop not working
Issue was that the left mouse press event was handled to activate the
dragging state, but not "consumed". So general view item handling would
attempt to force-activate it again, exiting the dragging state
immediately again.

Consume the event now, plus handle properly any similar unexpected cases
(with failing assert), where modal state would be exited because of an
unconsumed event.

Alternative solution to #124529, thanks to Pratik Borhade for finding
the root of the issue.
2024-07-11 16:15:43 +02:00
Omar Emara
acd4a85d6b Fix #124445: Sun beams produces sharp results
The Sun beams node produces sharp results when the background has an
alpha channel. That's because the sun beams samples were weights by the
alpha channel, and when the image is mostly transparent, no smooth
falloff can exist.

This is a regression in the Sun Beams redesign that took place in v3.6.
I was mislead by the fact that the alpha was multiplied to the weight.
But the original code actually multiplied the alpha of the border color,
not the sample color. So this fix essentially restores the old behavior.

Pull Request: https://projects.blender.org/blender/blender/pulls/124532
2024-07-11 16:10:50 +02:00
Omar Emara
57a6832b17 Fix #101263: Vector pass wrongly saved in File Output
The vector pass and potentially other vectors that store 4 values are
stored wrongly, in particular, the last channel is ignored. To fix this
we identify if a vector pass is 4D and store the information in the
result meta data, then use this information to either save a 3D or a 4D
pass in the File Output node.

This is a partial fix for the GPU compositor only. The complete fix for
the CPU compositor will be submitted separately as it is not
straightforward and will likely require a refactor.

Pull Request: https://projects.blender.org/blender/blender/pulls/124522
2024-07-11 16:08:19 +02:00
Hans Goudey
f997d35033 Cleanup: Fix typo in comment 2024-07-11 09:06:44 -04:00
Jacques Lucke
5a4d7611f4 Merge branch 'blender-v4.2-release' 2024-07-11 15:03:07 +02:00
Jacques Lucke
1d4ef04a6d Fix #124463: crash when trying link a node to itself with swapping
The swapping code incorrectly expected the link to have a start and end.
However, this was not necessarily the case when attempting to create
a link from a node to itself. This case has special handling in
`node_link_find_socket`.
2024-07-11 15:00:02 +02:00
Sybren A. Stüvel
987972c7c2 Anim: add RNA wrappers for selected/expanded flags of Action Slots
Add two new RNA properties to `ActionSlot`: `select` and `show_expanded`.
The names were chosen to be consistent with other Blender RNA APIs for the
same things.

Ref: #124399
Pull Request: https://projects.blender.org/blender/blender/pulls/124513
2024-07-11 14:04:22 +02:00
Jacques Lucke
a473107489 Cleanup: start using Map instead of GHash in BlendfileLinkAppendContext
This changes the type of `new_id_to_item` from `GHash` to
`Map<ID *, BlendfileLinkAppendContextItem *>` which simplifies code. For this to work
nicely, `BlendfileLinkAppendContext` had to become a non-trivial type. Since it
was allocated with `calloc` before, I gave all members
zero-default-initializers.

This also changes `BKE_blendfile_link_append_context_new` so that it uses
`MEM_new` instead of allocating the `BlendfileLinkAppendContext` as part of the
memory arena, because that's the more common way to do it, and it does not seem
like saving this one allocation here makes a difference considering how this is
used.

Pull Request: https://projects.blender.org/blender/blender/pulls/124516
2024-07-11 13:54:57 +02:00
Jacques Lucke
10415d704b Geometry Nodes: support grease pencil in Join Geometry and Realize Instances nodes
Previously, grease pencil was just ignored by the Join Geometry and Realize
Instances code. Now they work by concatenating the layers of all grease pencil
geometries together. So if e.g. there are two inputs with each 3 layers, then
the output will have 6 layers. Layer attributes are kept intact.

Some important things to keep in mind:
* Grease pencil layers are expected to have unique names. Ensuring uniqueness
  requires O(n^2) currently.
* The material indices on the curves in each layer have to be remapped.

Just like with all other geometry types, the first input in the Join Geometry
node will come first in the output geometry. Since grease pencil layers are
drawn starting at index zero, that means that the first input will be drawn
first (i.e. it's at the bottom).

Pull Request: https://projects.blender.org/blender/blender/pulls/124361
2024-07-11 13:48:50 +02:00
Omar Emara
d14ad05078 Fix #124208: Cryptomatte are compressed in File Output
The Cryptomatte layers in the compositor are saved compressed and saved
in half precision in the File Output node. That's because the EXR writer
makes decision about compression and half float based on channel names.
And Cryptomatte are currently saved using RGBA channel names like other
color images.

To fix this, we follow the Cycles convention of using lowercase rgba for
Cryptomatte images, allowing them to be saved without compression and
always in full precision since they are otherwise useless.

Fixes #124208, #87988.

Pull Request: https://projects.blender.org/blender/blender/pulls/124508
2024-07-11 12:47:58 +02:00
Bastien Montagne
01484ce5d2 Fix (unreported) memoryleak in tests in some cases.
The call to `GHOST_DisposeSystemPaths` was done in `WM_exit_ex` and
_some_ of the tests' 'teardown'. But some more where missing. Issue was
only reproducible when defining `WITH_CXX_GUARDEDALLOC` cmake option.

There are several layers of issues here, this commit addresses the
first, simplest one: since `BKE_appdir` API will indirectly create the
GHOST SystemPaths data, it is simpler and more logical to move the
deletion of this SystemPaths data in `BKE_appdir_exit()`. This avoids
exposing a fairly low-level implementation detail all over our codebase.

Further more, `WM_init` also does not need to explicitely call
`GHOST_CreateSystemPaths`, since it will be created automatically when
required.
2024-07-11 12:06:14 +02:00
Julian Eisel
94d4864fa8 Fix: Asset shelf quick tooltips not showing
Since 4a9e8087a7, preview-tile buttons are non-interactive by default,
so tooltip handling is not triggered. Instead, attach the tooltip to the
underlying view-item button.
2024-07-11 11:58:02 +02:00
Christoph Lendenfeld
907c49da08 Anim: Operator to convert a legacy action to a layered action
This commit creates an operator to convert a `legacy Action` into a `layered Action`.
No data is destroyed, the operator creates a new datablock.
The conversion to the `layered Action` is lossless.

Pull Request: https://projects.blender.org/blender/blender/pulls/122043
2024-07-11 11:57:26 +02:00
Jeroen Bakker
a730454c8a Vulkan: Add test case for render graph draw
Pull Request: https://projects.blender.org/blender/blender/pulls/124507
2024-07-11 11:38:36 +02:00
Jeroen Bakker
82e56ca200 Merge branch 'blender-v4.2-release' 2024-07-11 11:10:14 +02:00
Jeroen Bakker
b9e15791f9 Fix #123052: EEVEE: Metal/AMD artifacts depth of field
This patch, provided by James McCarthy, removes artifacts on
Metal/AMD platforms when using depth of field.

Pull Request: https://projects.blender.org/blender/blender/pulls/124389
2024-07-11 11:09:36 +02:00
Sergey Sharybin
2a71c345d0 Merge branch 'blender-v4.2-release' 2024-07-11 11:08:12 +02:00