Commit Graph

113659 Commits

Author SHA1 Message Date
Omar Emara
6ae3232eda Fix #126565: Render region corrupt compositor output
Activating render region while using the CPU compositor produces corrupt
output for areas outside of the region when using the File Output node.
That's because the Full Frame compositor ignored nodes' render_border
flag, so the areas of interest of nodes that didn't consider render
border like the File Output were corrupt, producing uninitialized
outputs.

To fix this, we just consider the render_border flag when determining
output areas for output nodes in the Full Frame compositor.

Pull Request: https://projects.blender.org/blender/blender/pulls/128546
2024-10-04 14:25:31 +02:00
Omar Emara
ccab8005f6 Fix #126604: Legacy Cryptomatte doesn't work in GPU
The Legacy Cryptomatte node doesn't work in GPU execution mode if
Precision is set to Auto. That's because the colors picked from the Pick
layer might be in half precision and thus will not match the colors in
the Cryptomatte layers. This is due to the compositor using the
context's precision for Viewer outputs as opposed to the precision of
the image that actually needs to be viewed in the Viewer node.

To fix this, we set the Viewer node precision to be the precision of its
input, that way, the Cryptomatte pick layer will be output in full
precision as intended.

Pull Request: https://projects.blender.org/blender/blender/pulls/128495
2024-10-04 14:25:16 +02:00
Falk David
70c7fb6da2 Fix: GPv3: Context object has no attribute grease_pencil
When opeing the 2D Animation template, there was a UI error:
`AttributeError: 'Context' object has not attribute 'grease_pencil'`
This was because the context function `grease_pencil` was missing.
The fix adds this function.

Pull Request: https://projects.blender.org/blender/blender/pulls/128580
2024-10-04 14:24:31 +02:00
Falk David
364d62e59b Fix: GPv3: Solid View: Show vertex colors in Draw and Vertex paint mode
There was a bug where vertex colors were not shown in solid view in
draw or vertex paint mode. The check to use `V3D_SHADING_VERTEX_COLOR`
was outdated and checked the wrong mode flags.

The fix makes sure that we use `V3D_SHADING_VERTEX_COLOR` in
draw and vertex paint mode.

Pull Request: https://projects.blender.org/blender/blender/pulls/128581
2024-10-04 14:22:17 +02:00
Lukas Tönne
3d6a142162 GPv3: Remove unused GPv2 operators
Removes many of the operators, panels, and menus used exclusively by Grease Pencil v2 that are no longer needed in v3.
No functional changes are expected.

Some operators are still used by the annotations system and have to be kept around. These may be renamed in future.

Pull Request: https://projects.blender.org/blender/blender/pulls/128521
2024-10-04 13:05:09 +02:00
Jeroen Bakker
f1c0e258af Fix #128575: Vulkan: Fix armature drawing NVIDIA
The armature shape drawing was broken on NVIDIA. The reason is that not
all the elements in of the geometry shader out stages are written to. On
NVIDIA platforms this leads to not storing all the output data.

This could be that geometry shader on those plaforms write directly to
the final location in GPU memory. Other platforms might keep the data in
a local registry and copy it to the final location when emitting the
vertex.

Blender 4.4 might not have this issue as overlay next will remove the
need of the geometry shader.

From Khronos GLSL spec:
```
GS code writes all of the output values for a vertex, then calls EmitVertex().
This tells the system to write those output values to where ever it is that
output vertices get written. After calling this function, all output variables
contain undefined values. So you will need to write to them all again before
emitting the next vertex (if there is a next vertex).
```

Pull Request: https://projects.blender.org/blender/blender/pulls/128578
2024-10-04 12:47:42 +02:00
Falk David
c54d5d833b Fix: Compiler warning related to grease_pencil_context_poll
Declare this function in `ED_grease_pencil.hh`.
Move the implementation to `grease_pencil_ops.cc` with the other poll
functions.
2024-10-04 12:36:01 +02:00
Julian Eisel
bf52f6f723 UI: Remember asset shelf visibility per mode
After feedback from the brush assets, we want to not only set the
default visibility, but also remember the visibility per mode. This way
we can keep the shelf hidden in modes where there's only one bundled
brush per available tool. While having these tools support brushes can
be useful, we don't expect to bundle more brushes soon. So to avoid a
mostly empy asset shelf for a single brush, allow keeping the shelf
hidden in these modes unless the user expands it. The following commit
will set the default visibility for these modes.

More strictly speaking this is entirely context sensitive, not just per
mode, but with current shelf types is practically per mode.
2024-10-04 12:19:18 +02:00
Jeroen Bakker
7596a08b2c Vulkan: Add back command reordering for buffer updates.
Related to #126974, which removed command reordering due to some
EEVEE/framebuffer requirements. However buffer can still be reordered
without any artifacts.

Update buffers are common operations and are often isolated; safe to
move them outside the rendering scope.

Pull Request: https://projects.blender.org/blender/blender/pulls/128538
2024-10-04 12:11:40 +02:00
Pratik Borhade
bd4f7acce5 GPv3: Display layers when properties tab is pinned
Layer panel (also mask/ transform etc.) and other operators are gone
when properties tab is pinned and gpv3 object is non-active.
To fix this, get grease pencil pointer from `button_context()`
(done in `grease_pencil_context()`).

Continuation of cd476226d8

Pull Request: https://projects.blender.org/blender/blender/pulls/128475
2024-10-04 11:58:12 +02:00
Falk David
9d9dc3fc8f GPv3: Apply modifier to all frames
This adds an option `all_keyframes` to the `object.modifier_apply` operator.
With the option enabled, the operator will iterate through all the keyframes,
then apply the modifier and merge the result back into the original
object. This is only done for Grease Pencil objects.

This is how the default `Apply` operation worked in GPv2. This adds the
functionality back but also keeps the current `Apply` behavior for consistency
with other object types.

The UI is also changed to show both options in the dropdown menu.
Again, this is only shown for Grease Pencil objects.

With Geometry Nodes it's possible to add new layers to the geometry.
When applying, this will create a single keyframe on the first frame of
evaluation.  Layers with duplicated names in evaluated geometry will
be deduplicated. It's also possible to have layers with empty names.
When applying these get renamed to `Layer` (and `Layer.001` etc.
when such a layer already exists in the original geometry).

Pull Request: https://projects.blender.org/blender/blender/pulls/128487
2024-10-04 11:51:30 +02:00
Lukas Tönne
6e9462e056 Fix #128533: GPv3: Crash on undo
The poll function of the Grease Pencil edit undo system was changed by accident to include other
object modes like sculpt mode as well. In the other modes, undo steps wouldn't be created correctly.
Instead, fix the poll function to only allow the Grease Pencil undo system to take over in edit mode.
In all other modes fall back to the global undo system.

Fixes #128566 as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/128573
2024-10-04 11:36:46 +02:00
Falk David
78e4dd14bc Fix: Make grease_pencil_selection_poll non-static 2024-10-04 10:58:04 +02:00
Jeroen Bakker
55c180acc4 Fix #128561: EEVEE: Lightlinking crashes on NVIDIA
On NVIDIA drivers it is not allowed to pass buffers directly from the
interface to a function as the qualifiers do not match. This is commonly
fixed by first storing it in a local variable to remove the qualifiers
and then pass it to the function that need the object.

Pull Request: https://projects.blender.org/blender/blender/pulls/128571
2024-10-04 10:52:53 +02:00
Philipp Oeser
e9262f48aa Fix #121075: Outliner Ctrl-clicking to toggle selection has speed limit
There are a couple of keymap entries for `OUTLINER_OT_item_activate` in
our keymap. One of them has Ctrl+dblclick as a binding to trigger
recursion, but that one exits early when not dblclicking on the icon.
(introduced in 796577d76e)

It does not exit in a way that the non-dblclick variant can run, for
that we need to exit with OPERATOR_PASS_THROUGH, so that the "other"
operator can run as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/121130
2024-10-04 10:43:43 +02:00
Philipp Oeser
9664fb0e69 Fix #128482: Motion Tracking: Apply Scale misses update
Missing depsgraph tagging the clip.
(elsewhere this area of the code uses 0 as the flag, but I assume using
a proper flag is preferred? using `ID_RECALC_SYNC_TO_EVAL` in this
PR...)

Pull Request: https://projects.blender.org/blender/blender/pulls/128527
2024-10-04 10:42:46 +02:00
Falk David
effa8fbb7a GPv3: Material Isolate Operator
This ports the `gpencil.material_isolate` operator to GPv3.

Pull Request: https://projects.blender.org/blender/blender/pulls/128549
2024-10-04 10:38:04 +02:00
Falk David
b353260b9a Fix: Missing declaration of grease_pencil_selection_poll 2024-10-04 10:31:55 +02:00
Campbell Barton
4b6ebc9579 Fix error with select non-manifold when a mesh is in face-mode
In multi-edit mode, the select non-manifold function would exit with
an error if any mesh was in face mode.

While in practice the mode is synced between meshes, it's possible for
them to get out of sync with multiple scenes.

Editing in the middle of a loop on all edit-objects would change their
selection based on the internal order, leaving some unhandled,
returning canceled even though changes where made.

Resolve by checking the selection mode in the operators poll function,
then ensure all edit-meshes selection modes match the active object.
2024-10-04 17:42:45 +10:00
Campbell Barton
e03214f424 Cleanup: use doxy code-command
Supports language & is ignored by spell checker.
2024-10-04 14:46:59 +10:00
Campbell Barton
318125c82b Fix #127692: Artifact in axis aligned portions of mask feather
BLI_scanfill could remove edges later needed for feathering,
although this would only occur in specific cases.

Resolve by storing edges before triangle filling.
2024-10-04 11:46:38 +10:00
Campbell Barton
a2617b0029 Fix mask duplicate failing to set the active point
Duplicate was setting the last-duplicated spline as active,
leaving the active vertex set to the original (non-duplicated) spline.

This caused the active spline/point to get out of sync,
while not an error - it is confusing and should be avoided.

Now the active spline & point are duplicated,
matching active behavior elsewhere (objects for e.g.).
2024-10-04 11:46:36 +10:00
Campbell Barton
18da036ecc Fix crash deleting mask vertices
The active vertex was only cleared when it was part of the active-spline
(which isn't guaranteed).

Duplicating & deleting left the active vertex pointing to freed memory.
2024-10-04 11:46:34 +10:00
Campbell Barton
44bb032590 Fix ARRAY_HAS_ITEM macro on 64bit systems
An unsigned int was used for pointer offset calculation which could wrap
around, for large values or when pointer being checked is from a
different allocation.
2024-10-04 11:46:33 +10:00
Campbell Barton
0b8ce96bc1 Cleanup: quiet warnings, spelling 2024-10-04 11:45:26 +10:00
Jesse Yurkovich
80cf6b99c3 USD: Provide Import option for Material Purpose
USD has the concept of material "purposes" which allows different
materials to be associated for a prim and gives special meaning to them.
These are somewhat similar to display purposes, which we already allow
to be chosen, but are distinct concepts. This PR adds an option for
Import allowing the user to chose which material purpose to load.

Blender currently attempts to load purposes automatically. It starts
with "allPurpose" and then moves to "preview" and "full" in that order.
This behavior is now changed and the automated search is removed to
instead give the user control which purpose to load. Additionally, USD
already has its own fallback behavior during material resolution[1]:
- When given "full" it will first check "full" and fallback to
  "allPurpose" if not found. An additional, Blender-specific fallback
  to "preview" is also implemented here upon request.
- When given "preview" it will first check "preview" and fallback to
  "allPurpose" if not found
- When given "allPurpose", it will only check "allPurpose"

I have opt'd to keep this behavior directly as-is to not introduce
differences that may surprise those already familiar with USD elsewhere.

Additionally, I've set Blender's default import purpose to "full" to
ensure we're loading in the highest quality assets first. Though this
has the obvious risk that "full" assets tend to be quite heavy. We can
change to "preview" if this proves too problematic later.

This does not change how Blender exports materials. Blender always uses
the "allPurpose" binding when writing its USD files.

--------
[1] USD docs:
https://openusd.org/release/api/class_usd_shade_material_binding_a_p_i.html#details
https://openusd.org/release/api/class_usd_shade_material_binding_a_p_i.html#UsdShadeMaterialBindingAPI_MaterialResolution

Pull Request: https://projects.blender.org/blender/blender/pulls/128206
2024-10-03 20:16:27 +02:00
Julian Eisel
a4d9a38c70 UI: Increase size of previews in asset shelf popups
The asset previews were a little smaller than in comparable popups,
leading to a lot of truncation in the asset names. Increasing the size
mitigates this quite a bit, plus previews get more readable. 3355ca3813
increased the size of the popup so there's more space to put the now
bigger previews in.

Part of the brush assets followups:
ihttps://projects.blender.org/blender/blender/issues/116337
2024-10-03 19:49:36 +02:00
Julian Eisel
3355ca3813 UI: Increase width of asset shelf popup and clamp by window size
Increasing the width of the popup makes it show more assets on the
screen and reduces the need to scroll in bigger asset libraries. Plus,
in a follow-up commit the size of previews will be increased so that
there's more space to display the full name. Makes sense to increase the
popup size together with that, so a similar amount of assets can remain
visible still.

Increasing the size means it's more likely to overflow the window, so
this also makes sure the popup is clamped nicely by the window size.
2024-10-03 19:49:19 +02:00
Clément Foucault
f308e42d56 Fix: EEVEE: Volume Lightprobe: Division by zero if no object is visible
If no object with valid bounds can be found,
we simply abort the baking process.

This avoid a division by zero during the view planes
computation.
2024-10-03 19:31:04 +02:00
Julian Eisel
71dee64743 Sculpt/Paint: Asset shelf option to filter brushes by the active tool
Part of: https://projects.blender.org/blender/blender/issues/128066

Adds a "Filter by Active Tool" option for the brush asset shelves,
enabled by default. If enabled, the asset shelf only shows brushes
matching the brush type of the current tool. If the general "Brush" tool
is active, only brushes that are not covered by another tool are
displayed. The popup brush selector always shows all assets.

The option is stored in the Preferences, toggled in the "Display
Settings" popover of the asset shelf.

Note: This is committed to the 4.3 release branch, which was discussed
in advance.

Pull Request: https://projects.blender.org/blender/blender/pulls/128450
2024-10-03 18:56:40 +02:00
Falk David
3628433e6b GPv3: Python: Add API to move a frame
This adds a function `layer.frames.move(from_frame_number, to_frame_number)`.
The function will move any keyframe starting at `from_frame_number` to
`to_frame_number`. If there already is a frame at `to_frame_number`
the function will fail and return an error.

Pull Request: https://projects.blender.org/blender/blender/pulls/128544
2024-10-03 18:42:35 +02:00
Chris Clyne
5a27280916 EEVEE: Light & Shadow linking
This adds feature parity with Cycles regarding light and shadow liking.

Technically, this extends the GBuffer header to 32 bits, and uses
the top bits to store the object's light set membership index.
The same index is also added to `ObjectInfo` in place of padding bytes.

For shadow linking, the shadow blocker sets bitmask is stored per
tilemap. It is then used during the GPU culling phase to cull objects
that do not belong to the shadow's sets.

Co-authored-by: Clément Foucault <foucault.clem@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/127514
2024-10-03 18:41:06 +02:00
Miguel Pozo
3af44f9e76 EEVEE: Improve info messages at render time
Print shadow errors at render time.
Ensure all render errors are printed.
Add render error message in the UI.
Don't print the same error twice.

Pull Request: https://projects.blender.org/blender/blender/pulls/128548
2024-10-03 18:34:46 +02:00
Falk David
6b78894740 Fix: GPv3: Radial controls not working in some modes
The radial controls to set the brush size were not working in sculpt and
vertex paint mode.
This was because of a collision with the  `cyclical_set` operator in edit mode.
The issue was that the poll function for the edit mode keymaps also
passed in sculpt and vertex paint mode.

To solve this, add a keymap for these common selection operators and
separate them from the general edit mode keymap.

Pull Request: https://projects.blender.org/blender/blender/pulls/128542
2024-10-03 17:45:04 +02:00
Falk David
0872e898bc Fix: GPv3: Paint cursor rendering
Fixes to the paint cursor rendering:
* Fill tool no longer draws a huge cursor
* Tint tool now uses the right size
2024-10-03 16:32:08 +02:00
Omar Emara
3a070122ea Fix #126998: Fog Glow is corrupt for large images
The Fog Glow Glare node produces corrupt images for large inputs in GPU
mode. That's due to a typo where the number of channels was declared as
a float as opposed to an integer, causing rounding errors in indexing
statements.
2024-10-03 13:20:53 +03:00
Falk David
9c6488ca42 Fix: GPv3: Crash in evelope modifier
Caused by ba28469e45.
The `total_size()` function excludes the start offset now, which meant
that the `dst_curve_num` and `dst_point_num` were off.

The fix makes sure to include the src curves and points totals in the
destination if `keep_original` is true.

Pull Request: https://projects.blender.org/blender/blender/pulls/128523
2024-10-03 11:20:08 +02:00
Lukas Tönne
c986aa03b9 GPv3: Remove unused GPv2 keymap entries
This should free up references to GPv2 types and operators and should
in turn make their removal easier.

- Remove keymaps for GPv2 operators from `blender_default.py` and
  `industry_compatible_data.py`
- Remove keymap poll callback assignment from `gpencil_ops.cc`
- Remove keymap handler registration from `area.cc:ed_default_handlers`

Pull Request: https://projects.blender.org/blender/blender/pulls/128480
2024-10-03 11:18:31 +02:00
Jeroen Bakker
52dfb4aa8f Fix #124720: Metal: Crash when trying to allocate large 3d textures
The metal backend assumes that textures can always be allocated. When
metal later detects that the texture cannot be 'baked' it leads to
undesired behavior as Blender think it has a texture with memory
allocated.

This PR only changes the GPU_TEXTURE_3D case as that leads to issues
when loading large voluetric data. Arrayed textures will still fail
as that requires different checks to be added. I rather re-view the
current implementation in the future.

> NOTE: The max depth is hardcoded to 2048

Change should be backported to 4.2

Pull Request: https://projects.blender.org/blender/blender/pulls/128365
2024-10-03 10:11:23 +02:00
Jeroen Bakker
06a4198329 Fix #127274: Vulkan: Incorrect limits.
When using AMD pro-drivers the limits reported of the device can be
`UINT_MAX` but are stored in int fields. In this case the limits would
become negative and GPU materials validation failed resulting into errors.

This is fixed by clamping the value to `INT_MAX`.

Pull Request: https://projects.blender.org/blender/blender/pulls/128437
2024-10-03 10:10:32 +02:00
Sybren A. Stüvel
e282b9e5e7 Fix #128490: Crash opening a file with with slotted action enabled
The crash was caused by infinite recursion. When recursing into sub-strips
of an NLA strip, it helps to actually recurse with the pointer to that
sub-strip.

Pull Request: https://projects.blender.org/blender/blender/pulls/128492
2024-10-03 09:40:19 +02:00
Sybren A. Stüvel
e16e43dcde Anim: Make experimental.use_animation_baklava read-only when non-exp
Make the RNA property `prefs.experimental.use_animation_baklava` read-only
when Blender was built without experimental features.

This reverts parts of b46e2e6300, which
completely removed the flag. That was a bit over-zealous, as there is still
Python code that checks it. Now it always stays `False` on non-experimental
builds.

Pull Request: https://projects.blender.org/blender/blender/pulls/128494
2024-10-03 09:39:10 +02:00
Campbell Barton
589da4acb5 Cleanup: keep end-of-function code comment last (#2) 2024-10-03 15:00:07 +10:00
Campbell Barton
a9b977d256 Cleanup: sort CMake file lists 2024-10-03 14:46:26 +10:00
Campbell Barton
459c7c7f82 Cleanup: sort DNA rename (documented as sorted) 2024-10-03 14:44:12 +10:00
Campbell Barton
f489611ff3 Cleanup: keep end-of-function code comment last 2024-10-03 14:42:36 +10:00
Campbell Barton
cb283c3cd9 Cleanup: suppress array-bounds warning with GCC 2024-10-03 13:25:15 +10:00
Campbell Barton
952e1d46d1 Cleanup: match declaration names, avoid shadowing & clear trailing space 2024-10-03 12:12:08 +10:00
Campbell Barton
4fa3dc0dd4 Cleanup: spelling in comments, use uppercase tags 2024-10-03 12:11:52 +10:00
John Kiril Swenson
d2a802d3c6 VSE: Remove timeline box select
Remove the box select tool from the timeline to simplify selection
logic, avoid confusion for users, and make maintaining the code
easier in the future. It also brings the selection system  closer
to other industry-standard NLEs.

It also fixes an issue caused by d2091b4b1.

More details in PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/128051
2024-10-03 00:37:00 +02:00