Commit Graph

120055 Commits

Author SHA1 Message Date
Hans Goudey
e371822c9a Fix: Sculpt: Crash after recent BVH tree positions/normals refactor
The Mesh normals update still has to run even if there are no tagged
nodes, because the vertex might be tagged dirty if the mesh has only
flat faces.
2024-08-22 16:43:23 -04:00
Hans Goudey
c7b4e3e71a Refactor: Sculpt: Remove SubdivCCG pointer from BVH tree
Part of #118145.
2024-08-22 16:07:16 -04:00
Hans Goudey
24809baf2b Cleanup: Remove unused variables 2024-08-22 15:26:32 -04:00
Hans Goudey
5fdf7deb57 Sculpt: Remove duplicate BVH tree positions storage
When there is a deform modifier or shape keys, currently the evaluated
position array is copied to a duplicate array on the sculpt PBVH tree.
Historically most code has used this array directly, so the code has
been a bit confusing, but conceptually this is just supposed to be
the evaluated positions.

Instead of editing the BVH tree position array while sculpting, we
can edit the arrays on the evaluated mesh directly-- or the original
mesh when there are no deform modifiers.

Removing this array reduces memory usage and plays better with implicit
sharing since we don't need to unshare the attribute just to store a
mutable copy.

The remaining non-ideal part is sculpt mode's use of a specialized
crazy-space function `BKE_crazyspace_build_sculpt` for building the
evaluated position array rather than using the general system for
retrieving deformed mesh data, `BKE_object_get_mesh_deform_eval`.
This should be replaced at some point.

This change makes clear a few simplifications for sculpt normals
recomputation, because we can store the normals for all cases as
a shared cache, unifying the code paths for original and deformed
normals.

Part of #118145.

Pull Request: https://projects.blender.org/blender/blender/pulls/126382
2024-08-22 21:00:25 +02:00
Harley Acheson
810687ad5b UI: Improvement to Screen Area Options Menu Invoke Area Join
Right-clicking on an edge between editors, the "Screen Area Options"
menu has a number of items including for Area Join.  When docking is
NOT enabled this gives the prior behavior of interactive join where
you can change direction and requires Enter to confirm.  If docking
is enabled then there are instead instant join options but now with
a specific icon for each direction.

Pull Request: https://projects.blender.org/blender/blender/pulls/126616
2024-08-22 20:25:51 +02:00
Harley Acheson
1d1ea87617 UI: Fix Docking Multi-Window Highlighting
When docking between multiple windows the highlight showing the icon
representing the moved area does not display correctly if the target
window differs from the source. This corrects that by using the
dpi-corrected values from the event, not win->eventstate

Pull Request: https://projects.blender.org/blender/blender/pulls/126659
2024-08-22 19:38:01 +02:00
Nathan Vegdahl
df02e7a5e5 Anim: add channel groups to layered actions
This PR adds channel groups (also known as fcurve groups or action groups) to
layered actions.  For layered actions, these groups belong to the `ChannelBag`s
and can vary by bag.

From a user perspective, the goal is for these to function just like channel
groups from legacy actions.  However, internally they are implemented a little
differently: legacy actions store both channel groups and fcurves in a listbase,
and groups indicate what fcurves are in them with a listbase that points
directly into the larger fcurve listbase.  Layered actions, on the other hand,
store both fcurves and channel groups in an array, and groups indicate what
fcurves are in them by indexing into the fcurve array.

Despite taking this different approach, we still reuse the `bActionGroup` struct
for the new channel groups, just adding the necessary fields for index-based
fcurve membership as described above.

This PR does not implement all of the functionality needed to reach feature
parity with legacy action channel groups, but implements the main core and gets
them basically working.

It's easier to list the things that *haven't* been implemented yet:

- Operators for letting the user manually create/remove/move channel groups.
- Keyframe selection in the action/dopesheet editor on channel group rows
  themselves are not yet working correctly.
- Handling channel groups in legacy/layered action conversion operators.
- Making the legacy `action.groups` property work on single-layer-single-strip
  layered actions.

Those are left for future PRs.  Other than that, in theory everything should be
working now.

Pull Request: https://projects.blender.org/blender/blender/pulls/125774
2024-08-22 17:13:12 +02:00
Lleu Yang
166c921a44 UI: Add Frequency unit
This adds the unit of frequency Hertz (Hz) and Kilohertz (kHz) for
expressing pitch of a sound.

This will be used for the ongoing Sample Sound node in #122228.

Pull Request: https://projects.blender.org/blender/blender/pulls/125915
2024-08-22 17:05:48 +02:00
Hans Goudey
549d137eb7 Refactor: Paint: Replace "CoNo" struct with separate arrays
This is similar to how this data is processed/stored elsewhere.
2024-08-22 10:50:50 -04:00
Omar Emara
758401c672 Fix #126567: Packed images are missing meta data
Blender doesn't read meta data of images in case they were packed, which
make things like image Cryptomatte fail. This is because the image
loading code didn't specify meta data reading for packed images, but did
for normal images.

To fix this, we also specify meta data reading for packed images. And
while at it, move all common IB flags in the same like to avoid such
differences in the future.

Pull Request: https://projects.blender.org/blender/blender/pulls/126602
2024-08-22 16:46:50 +02:00
Hans Goudey
bda0c27c05 Refactor: Sculpt: Deduplicate topology falloff creation in expand tool
Part of #118145.
This was implemented three times before. Instead, implement it once
with an interface that can start with a varying number of vertices.
2024-08-22 09:52:54 -04:00
Hans Goudey
6e845f54c3 Fix #126464: Subdiv optimal display edges causes broken wires on Metal
Caused by d1049f6082.
The old 255 FORCE_HIDE value converts to 1.0f as a float, not 255.0f.
2024-08-22 09:48:44 -04:00
Pratik Borhade
3a1f71c06e Fix #126624: Sculpt undo crash with shape keys
Caused by 18a7aff3e2
`search_gather()` returns vector but span is used to receive list from
function call. This results in crash due to accessing invalid data.

Pull Request: https://projects.blender.org/blender/blender/pulls/126626
2024-08-22 15:03:10 +02:00
Julian Eisel
03ae57dd8b UI: Disable "Render Active Object" for previews of incompatible object types
Object types like empties, lamps and cameras don't have geometry that can be
rendered by regular render engines. Attempting to render them for an asset
preview doesn't work.

36c5606fc3 already fixed a crash in this situation, resulting in an empty
preview. But better to entirely disallow this action, with useful feedback in
the UI.
2024-08-22 14:55:57 +02:00
John Kiril Swenson
715129bf5b VSE: ability to connect and disconnect strips in the VSE.
Adds the ability to connect and disconnect strips in the VSE.

- Connected strips have an icon indicating their status, and attempting
  to select one connected strip selects all other connected strips in
  that chain.
- If the user attempts to connect a strip that is already connected to
  other strips, that strip will disconnect itself from others before
  connecting to new strips.
- Preview selection also works in bulk if multiple video strips are
  connected together in the timeline.
- When adding new strips from the Add menu or the File Browser, strips
  from the same file are connected by default. There's an option to
  turn this off in Editing > Video Sequencer user preferences.
- It is possible to individually tweak strips/handles and ignore
  connections with Alt+Click.
  - This shortcut overrides the old keymap item for "Linked Handle"
    selection. The property still exists if people want to use that
    shortcut for its old purpose.
- To make sure that connections remain valid even after duplication,
  I've added a condition to `seq_new_fix_links_recursive` that also
  updates connections using the `seq->tmp` var. (A note -- I've updated
  the comment for this field in `DNA_sequence_types.h` because the var
  is only used for duplication now. It was once present in
  `select_more_less_seq__internal` to be used for linked selection but
  is gone now).
  - There are also functions to cut one-way links and make sure that
    all strips are bidirectionally connected after duplicating.

Pull Request: https://projects.blender.org/blender/blender/pulls/124333
2024-08-22 14:54:42 +02:00
Bastien Montagne
ce95155b30 Fix #122757: Walk/Fly modes would not push undo step when moving an object around.
In case the general 'locked in 3DView' code does not create an undo push
(e.g. because the 3DView is in camera mode, but is _not_ locked to the
camera), but the walk/fly operator does transform an object, it still
needs to push an undo step.
2024-08-22 14:29:37 +02:00
Campbell Barton
765052fdb8 Fix crash & other errors creating fallback path for buttons
Resolve the following issues.

- Crash reading a string from uninitialized memory when
  the default font directory was not found.
  Fall back to the BKE_appdir_folder_default_or_root in this case.
- Memory leak when reading from the default font directory.
- Failure to ensure a trailing slash for the preferences font directory.
- Buffer overflow writing a trailing slash past the allocated size.
2024-08-22 22:20:27 +10:00
Omar Emara
997ab86906 Compositor: Add Composite node for new CPU compositor
This patch implements the Composite node for the new CPU compositor.
This is essentially equivalent to the Viewer node commit.
2024-08-22 14:48:52 +03:00
Pratik Borhade
b0390cae09 Fix #126605: GPv3: Crash exporting selected frames to PDF
Crash when exporting selected frames due to two different reason.
frame returned by frame_at() can be null, so add a null check
before calling `is_selected()` member function.

After depsgraph update, ob_eval.data changes. So cast it to gease_pencil
every frame to avoid the crash (otherwise grease_pencil will point to
invalid memory).

Pull Request: https://projects.blender.org/blender/blender/pulls/126643
2024-08-22 13:38:45 +02:00
Alaska
16bf67cf37 Fix: Outdated tooltip on Principled BSDF
Ever since Blender 4.0 when the Principled BSDF was updated to
generally match the OpenPBR standard, it hadn't supported negative
specular ansiostropy.

Update the Principled BSDF tooltip to match this change.

Pull Request: https://projects.blender.org/blender/blender/pulls/126644
2024-08-22 13:00:24 +02:00
Christoph Lendenfeld
69d50b2f4d Fix #126632: Pose Breakdowner not interpolating all curves
Caused by 0f5dd1c55c

The refactor commit changed the arguments to receive a `Listbase` reference
instead of a pointer because in all use cases it was always passed.
As such the check for a `ListBase` null pointer went away.
However by removing JUST the nullptr check in this line
`if ((curves) || (flags & ACT_TRANS_LOC) == 0)`
to
`if ((flags & ACT_TRANS_LOC) == 0)`

I effectively changed the behavior.
Since `curves` was ALWAYS passed, the second condition never triggered.
With the change, this condition would always trigger, effectively only
adding the first FCurve of either location rotation or scale.

Pull Request: https://projects.blender.org/blender/blender/pulls/126642
2024-08-22 12:38:14 +02:00
Jeroen Bakker
529c720457 Fix #126412: Metal default alpha value
Metal doesn't support RGB textures and the backend converts them to RGBA textures.
During the conversion missing RGB components should be set to 0 and missing A
component should be set to 1.

In the current implementation this was not the case and A components where also set
to 0.

PR should be backported to 4.2

Pull Request: https://projects.blender.org/blender/blender/pulls/126630
2024-08-22 11:52:34 +02:00
Jeroen Bakker
7391810b53 Fix #126556: EEVEE: Metadata not available when only use material layer
When only rendering the cryptomatte material layer, the meta data wasn't
exported. Note this issue is due to differences not reproducable in 4.3.
But the fix should also be applied there for consistency.

Pull Request: https://projects.blender.org/blender/blender/pulls/126631
2024-08-22 11:31:34 +02:00
Jeroen Bakker
d16806bc17 Fix: Vulkan: Incorrect Depth Retargetting
Vulkan has different depth limits then opengl. We fix this by
retargetting the opengl limits into the limits that vulkan supports.

This is done in the vertex shader, or in the geometry shader. When
viewport index or layer isn't supported a geometry shader is added to
workaround these missing features. In this case the depth range was
could be done twice (vertex shader and geometry shader).

Pull Request: https://projects.blender.org/blender/blender/pulls/126634
2024-08-22 11:29:55 +02:00
Omar Emara
9b903d4c6f Compositor: Implement type conversion in new CPU compositor
This patch implements implicit conversion operations for the new CPU
compositor.
2024-08-22 11:15:57 +03:00
Christoph Lendenfeld
1b23a8983d Fix #120950: Graph Editor FCurve line rendering
The issue was that the key bounds for determining if a key can be skipped
were initialized incorrectly.
The order of `rctf` is [xmin, xmax, ymin, ymax] but the values were given as
[x, y, x, y].
The correct order is [x, x, y, y]

Pull Request: https://projects.blender.org/blender/blender/pulls/126554
2024-08-22 10:09:12 +02:00
Jeroen Bakker
22698fc34c Cleanup: Code style 2024-08-22 09:12:30 +02:00
Campbell Barton
e00b7c4ad4 Fix soft-delete hanging on *nix when the command was not found
When execvp() failed to replace the stack, the forked process would
return to Blender's WM_main(..) loop then hang when attempting to draw
the window.

Resolve by calling _exit() when execvp fails.
2024-08-22 17:08:20 +10:00
Campbell Barton
6c82c039db Fix missing error check for fork() failing 2024-08-22 17:08:20 +10:00
Harley Acheson
ae3bf84f35 UI: Docking Interactive Resizing
This is a change to the docking process so that the target area SIZE
can be specified at the same time as selecting the location. This also
changes to a drag-and-drop style of mouse pointer indication.

Pull Request: https://projects.blender.org/blender/blender/pulls/126447
2024-08-22 02:38:46 +02:00
Hans Goudey
df0564f3b8 Refactor: Sculpt: Remove dynamic topology edge length from BVH tree
Part of #118145.
The maximum and minumum edge length were stored in the BVH tree.
That's unnecessary since the source of truth is elsewhere and the values
are only used during remeshing operations.

Pull Request: https://projects.blender.org/blender/blender/pulls/126571
2024-08-21 23:52:23 +02:00
Harley Acheson
9bbe669cad Fix #126612: Area Join Exec Tag Source for Redraw
Non-interactive join - area_join_exec - needs to tag the source area
for redraw. Otherwise Outliner can attempt a partial redraw when a full
is needed, triggering an assert.

Pull Request: https://projects.blender.org/blender/blender/pulls/126615
2024-08-21 23:39:11 +02:00
Iliya Katueshenock
93546768ba Fix #126595: Group ID in Fill Curve Evaluate inconsistantly
Fix typo from 90de0368cd.
The wrong field-specifier of the socket was used.

Pull Request: https://projects.blender.org/blender/blender/pulls/126611
2024-08-21 23:31:24 +02:00
Jesse Yurkovich
ce82d4434f Fix #126324: Fallback to linear POLY curves for invalid Alembic data
Provide an appropriate fallback during Import of some incorrect Alembic
curve data and write out valid data during our Export as well.

The buggy file in question has 2 problems:
- The curve data is marked as being `kVariableOrder` but provides no
  actual `order` data. This is invalid according to Alembic code [1]
- The curve data is also marked as being `kBezierBasis` but the actual
  values are most likely not bezier judging from how many elements are
  in each curve array

This PR focuses on the first problem and allows the file to load
"correctly" - or at least as correctly as it did prior to Blender 4.2.
If we encounter such a file, we will fallback to interpreting the data
as linear POLY curves. It also ensures that we only use `kVariableOrder`
when needed during Export.

[1] 23f1c76d7c/lib/Alembic/AbcGeom/ICurves.h (L91)

Pull Request: https://projects.blender.org/blender/blender/pulls/126378
2024-08-21 18:57:09 +02:00
Bastien Montagne
de47fee2e1 Fix #126156: Do not allow to assign embedded IDs to IDProperties.
This is just not supported, and typically not doable from Blender UI
(since embedded IDs won't be listed in ID template list).

Add asserts to IDProp code itself, and checks & error reports in
relevant BPY and RNA setters.
2024-08-21 18:19:06 +02:00
Campbell Barton
08d5eb8f9c Cleanup: cmake formatting 2024-08-21 23:20:34 +10:00
Campbell Barton
83fe5712ab Fix #126525: Gizmo flickering when a Blender window is resized 2024-08-21 23:03:31 +10:00
Jeroen Bakker
d7a6ab6f04 Fix #124364: BPY improve description template_list.list_id
Add some hints when the property is needed.
Use similar text as `template_asset_view` widget.

Pull Request: https://projects.blender.org/blender/blender/pulls/126569
2024-08-21 14:33:12 +02:00
Hans Goudey
11524775c7 Cleanup: Pass BVH nodes by reference 2024-08-21 08:10:56 -04:00
Lukas Tönne
2e9fc8ef2d GPv3: Segment selection support
Support segment mode in Grease Pencil v3 selection operators.
This is a continuation of #109221.

Segment selection works in multiple stages:
1. When enabled, the 2D evaluated lines for all visible curves are
entered into a BVH tree. This tree is used to find intersections later
on. All the visible drawings are in the tree, an `OffsetIndices` array
is used to record ranges of BVH elements for each drawing.
2. Primary selection functions get alternative versions that produce an
`IndexMask` instead of writing directly to selection attributes. This
makes it possible to detect select actions on points that are already
selected. Using a delta of selection attributes for this is not enough
to detect such user actions (and inefficient).
3. In segment mode the `IndexMask` is extended to fully cover segment
points (or exclude them when deselecting respectively). This first
performs and intersection test using the BVH tree, then finds all point
range with selected elements.
4. Finally the extended index mask is applied to selection attributes as
usual.

Pull Request: https://projects.blender.org/blender/blender/pulls/126027
2024-08-21 13:35:26 +02:00
Jonas Holzman
9b1d653554 Fix #126246: Missing Outliner redraw notifier when making datablock single user
Without a proper redraw, the outliner (in `Blender File` mode) would
only *partially* update on mouse hover, refreshing the user-count of
the old datablock without listing the newly added datablock.

Pull Request: https://projects.blender.org/blender/blender/pulls/126386
2024-08-21 13:10:35 +02:00
Julian Eisel
36c5606fc3 Fix #124622: Crash/assert on "Render Active Object"
The preview rendering would fall back to the shader preview rendering
pipeline, which is not suitable for objects. Instead, don't render any
preview (use an empty preview) for such object types. This case could be
handled a bit nicer by the code triggering the preview rendering (e.g.
the "Render Active Object" operator poll could return false), but
keeping that separate from fixing the lower level logic to ensure crash
free behavior.

Pull Request: https://projects.blender.org/blender/blender/pulls/126235
2024-08-21 11:54:50 +02:00
Bastien Montagne
6e143cbf75 Fix #126549: Forbid unlinking Scene main collection.
Looks like this use to 'work' because lower-level code would refuse to
delete an embedded scene collection, but the operator should not have
been active at all in the first place.

Fixed by adding a proper `poll` callback to the `collection unlink`
operator.
2024-08-21 11:48:03 +02:00
Campbell Barton
5a0e8317f4 Cleanup: use const vars/args 2024-08-21 19:19:38 +10:00
Omar Emara
844d6d2df0 Fix #126552: Crash on Render Layers node with no scene
Blender crashes when a Render Layers node is used with no scene in the
GPU compositor. This is fixed by a simple nullptr check.
2024-08-21 10:54:00 +03:00
Jesse Yurkovich
d6ea01bd38 Fix #126551: Write Hex values using 2 digits in the color tooltips
We need to use 2 hex digits to ensure that the value displayed in the
tooltips is correct.

Pull Request: https://projects.blender.org/blender/blender/pulls/126580
2024-08-21 04:55:55 +02:00
Campbell Barton
ddcf5bac44 Revert "Fix image sequence detection to account for the number of digits"
This reverts commit 5c2d412a29.
because it caused a regression.

Resolve #124832.
2024-08-21 12:40:14 +10:00
Harley Acheson
6be90285bc Fix #126512: Icon Positioning When Icon Height Varies
Remove the subpixel positioning of icons. I just can't get this work
well in enough circumstances to make it worth the hassle it causes.

Pull Request: https://projects.blender.org/blender/blender/pulls/126579
2024-08-21 04:04:19 +02:00
Hans Goudey
ef0b163b49 Sculpt: Make BMesh BVH tree build similar to mesh/grids
Changes similar to f9c6fe30db.
- Calculate node bounds after building the tree.
- Calculate node visibility after building the tree.
- Avoid redundant normals recalculation. They are already calculated
  when first building the dynamic topology BMesh.
- Avoid clearing the default node flags.
2024-08-20 17:47:43 -04:00
Hans Goudey
65efd7f033 Fix: Dynamic topology mesh invisible after recent commit
Mistake in 7e0029fb65.
I assumed the BMesh and Mesh PBVH building process was
more similar than they really are.
2024-08-20 16:08:57 -04:00