Commit Graph

113778 Commits

Author SHA1 Message Date
Jacques Lucke
5ad56c52ff Fix #128861: crash with Index Switch node when sliced virtual arrays are used
It looks like this specific case never really worked. This wasn't found before,
because in the large majority of cases, execution uses a more optimized code
path instead of this general one.

Pull Request: https://projects.blender.org/blender/blender/pulls/128993
2024-10-15 11:02:22 +02:00
Campbell Barton
44d0452a78 Cleanup: spelling in comments 2024-10-15 12:51:05 +11:00
Jesse Yurkovich
9c36cfb4b8 Fix: Use error reports as indication of cancellation for some IO ops
During development of Collection Export, it was noticed that our various
IO formats deal with errors in vastly different ways [1]. The crashes
were all fixed but now the motivating scenario is as follows:

If you setup a Collection Exporter for OBJ, STL, or PLY, and if it
runs into an error during processing, the C++ operator will return
"FINISHED" to the caller but the operator will also RPT_ERROR. This
causes the caller, Collection Export, to indicate "success" to the user
but the RPT_ERROR then causes a UI report that indicates failure.

This PR chooses to use the presence of the RPT_ERROR as indication of
"CANCELLED" operator status and should be safe enough to also apply
to 4.2 LTS.

This aligns with what Python does [2] and with what the new GSoC import
nodes have chosen to do [3]. Though doing this on import isn't quite
correct so this PR does not add that in to the base import operators.

Alembic and USD are better behaved in this scenario already. However,
they have their own quirks to follow-up afterwards.

[1] https://projects.blender.org/blender/blender/issues/117881
[2] https://projects.blender.org/blender/blender/src/branch/main/source/blender/python/intern/bpy_capi_utils.cc#L25
[3] https://projects.blender.org/blender/blender/src/branch/main/source/blender/nodes/geometry/nodes/node_geo_import_obj.cc#L49

Pull Request: https://projects.blender.org/blender/blender/pulls/127525
2024-10-14 22:55:20 +02:00
Sean Kim
feaa7bbbcc Fix #129013: Certain brushes can cause artifacts
Any brush that used the `restore_position_from_undo_step` codepath (i.e.
brushes that use `OrigPositionData` to calculate their deformations) had
the possibility to cause artifacts due to the nested tbb parallelization
causing incorrect usage of TLS data.

To fix this we add a call to `threading::isolate_task` to prevent thread
stealing.

Pull Request: https://projects.blender.org/blender/blender/pulls/129020
2024-10-14 22:46:30 +02:00
Sean Kim
3d40d6e188 Fix #128999: Smooth Surface brush doesn't update viewport
Missed in 347ec1acd7

Pull Request: https://projects.blender.org/blender/blender/pulls/129017
2024-10-14 21:45:12 +02:00
Philipp Oeser
0319b7b50a Fix #127611: Linked material can be modified by Copy/Paste Material
Seems like we can use `object_materials_supported_poll` (similar to
other material operators) that already checks the right things.

Pull Request: https://projects.blender.org/blender/blender/pulls/128996
2024-10-14 17:59:59 +02:00
Sean Kim
b2e0193cc1 Fix #128929: Multires face set automasking doesnt work with no face set
Introduced in 7c42c80126

Incorrect value of `1` was used for the situation where the
`.sculpt_face_set` attribute was missing on the mesh instead of
`SCULPT_FACE_SET_NONE`.

Pull Request: https://projects.blender.org/blender/blender/pulls/128939
2024-10-14 17:27:45 +02:00
Sean Kim
a205e34158 Fix #128933: Dyntopo density brush prints constant console errors
The brush does not use the value calculated from brush_strength, this
commit silences the assert by just handling the case statement for this
brush type with a static value of 0.0f.

Pull Request: https://projects.blender.org/blender/blender/pulls/128936
2024-10-14 17:23:10 +02:00
Julian Eisel
10f2d683ba Cleanup: Use dedicated string reference type for drop tooltip drawing
Followup to 682161283e.

This type better reflects the intention of a read-only string reference,
and `std::string` should usually be used for owning string variables
only.
2024-10-14 16:41:54 +02:00
Guillermo Venegas
682161283e Fix unreported: FileHandler drag-an-drop tooltip is generated in a wrong context
The tool-tip generated for FileHandler drag-n-drop may be obtained from a
different context where the dropbox poll function is invoked, which could
generated an incorrect tool-tip since FileHandlers are polled again in a wrong
context.

This can be solved by ensuring the same context is used, however the tool-tip
could be drawn in different windows.

To avoid undefined tool-tips , this generates the tool-tip in place when the
dropbox poll function is invoked.

Pull Request: https://projects.blender.org/blender/blender/pulls/125037
2024-10-14 16:39:31 +02:00
Jeroen Bakker
ceb61ac921 Fix: Vulkan: Strict extension test
VK_EXT_dynamic_rendering_unused_attachments is required for correct working.
Renderdoc hides this extension, but most platforms do work. However the
Windows Intel driver crashes when using iGPUs; they don't support this
extension at all.

This change does a more strict extension test so drivers that do not
support this extension will fallback to OpenGL. When using renderdoc it
is now allowed to compile blender with `WITH_RENDERDOC=On`.

Future developments are needed to add support for Intel iGPUs on
Windows.

Pull Request: https://projects.blender.org/blender/blender/pulls/128986
2024-10-14 15:43:41 +02:00
Jeroen Bakker
d35cd15e12 Fix #128608: Vulkan: Sync issues when sharing context between threads
Resources are shared, when running multiple contexts on the same thread.
Cycles uses the same context on multiple threads and expected same resources.

This change will introduce a single render graph per context and an updated
resource management. Render graphs are not shared anymore; Resource pools
are still shared, but garbage collection depends on the thread and if
background rendering is used.

Pull Request: https://projects.blender.org/blender/blender/pulls/128983
2024-10-14 15:42:46 +02:00
Jeroen Bakker
fb862d082a Fix: Vulkan: Sync issue command buffers
Cycles uses multiple threads to send commands to the GPU. The current
command buffer structure assumed that all commands from the same context
were send via the same thread. This wasn't the case and could lead to
recording commands to command buffers that are still pending (preparing
commands to send to GPU).

This is fixed by creating a command buffer each time a render graph
submits its work.

Detected when researching #128608

Pull Request: https://projects.blender.org/blender/blender/pulls/128978
2024-10-14 15:41:30 +02:00
Jeroen Bakker
3b7dd61e01 Fix: Vulkan: Incorrect Host Visibility Allocation
When allocating a host visible buffer it could be that the returned
buffer was not host visible and access to the buffer would write to
unallocated memory.

Detected when researching #128608

Pull Request: https://projects.blender.org/blender/blender/pulls/128977
2024-10-14 15:39:27 +02:00
Jeroen Bakker
acb205763e Fix: Vulkan: Cycles CPU Synchronization
When using cycles in the viewport there it uses render threads and
workers to update the viewport. All threads can record commands to the
queue and needs to be synchronized. This didn't happen leading to
incorrect renders.

Detected when researching #128608

Pull Request: https://projects.blender.org/blender/blender/pulls/128975
2024-10-14 15:38:22 +02:00
Jeroen Bakker
af151e89a7 Fix: Vulkan: Unguarded Access Device Queues
Multiple threads can access the same device queue from different
threads. This could happen when doing a cycles preview render, baking
eevee volume probes or generating material previews.

This PR adds a mutex around access to the device queues.

Detected when researching #128608

Pull Request: https://projects.blender.org/blender/blender/pulls/128974
2024-10-14 15:30:11 +02:00
Jacques Lucke
2806d54320 Fix #128499: dot dash modifier crashes because of missing attributes
These attributes are not guaranteed to exist. So they should either be used
conditionally, or with a fallback value. The fallback value for the opacity is
obvious, but for the radius it's more tricky. There is not a consistent fallback
value across Blender unfortunately. The one I used here is used in a couple of
places.

Pull Request: https://projects.blender.org/blender/blender/pulls/128847
2024-10-14 14:19:24 +02:00
Pratik Borhade
373d77aeb6 Fix #128672: Brush Assets: Wrong catalogs in asset shelf by default
Mistake in `catalog_path` name

Pull Request: https://projects.blender.org/blender/blender/pulls/128681
2024-10-14 14:10:21 +02:00
Bastien Montagne
39c1127dc0 Fixes for #128078
# Fix 128078, Part I: Fix missing reverse endian switch of Action's `idroot`.

ID type code stored as ints (or shorts) need their endian switch to be
reverted (in case there is endianess conversion) on file read.
Interestingly, this was done for the deprecated IPO data (among others), but
not for the Action one!

NOTE: There is no versioning fix for this mistake, i.e. old files that
were saved from a BE system, then opened and re-saved from a LE system,
will still have totally invalid ID code values. This is not considered
as necessary currently, given that this `idroot` value is only
'informational' and not relied on by any part of the code.

# Fix 128078, Part II: GPv3 conversion code missing animation of Layers' location.

Also add code to the AnimDataConverter to ensure that actions get the
`idroot` matching their new ID owner type in GP data case.

Pull Request: https://projects.blender.org/blender/blender/pulls/128129
2024-10-14 13:59:06 +02:00
Pratik Borhade
ae1409b9ae Fix #128921: GPv3: Influence subpanel is missing in Simplify modifier
The layer/material/vertex group filter properties had already been added but they were
not exposed in the UI. Also the influence panel was missing. Now added in "rna_" function
of the modifier.

Pull Request: https://projects.blender.org/blender/blender/pulls/128973
2024-10-14 13:06:07 +02:00
Philipp Oeser
1246baa81b Fix #128935: Preview range to selected keyframes wrong
Depending on from where this functionality was called, it behaved
differently (there are three operators for this).

- from the GE, it uses `get_graph_keyframe_extents` [which falls back to
existing scene (preview) start/end frames if no real extends are found]
- from the NLA, it uses `get_nlastrip_extents`[which falls back to
existing scene start/end frames if no real extends are found]
- elsewhere (and this was reported in #128935) it uses
`get_keyframe_extents` but did not consider if extends were really
found.

The last case lead to startframe being set higher than endframe causing
a crash on playback.

This PR checks the return value of `get_keyframe_extents` [which tells
us if extends were found] and cancels out early.

NOTE: it would probably be nice if the behavior was consistent across
all editors, but since I think the right behavior is to not do anything
if nothing is selected (after all the description is "based on range of
selected keyframes"), I am going for correct behavior of
`ACTION_OT_previewrange_set` but leave the Graph Editor and NLA editor
operators untouched for the time being.

Pull Request: https://projects.blender.org/blender/blender/pulls/128981
2024-10-14 11:51:24 +02:00
Pratik Borhade
99b876e2bc Fix #128946: GPv3: Can't select materials in Modifier
Should have been `value.data`.

Pull Request: https://projects.blender.org/blender/blender/pulls/128971
2024-10-14 11:20:28 +02:00
YimingWu
dc45169acd Fix #128637: Gizmo line tool not snapping to exactly 45 degrees
Due to rounding errors in `wm_gesture_straightline_do_angle_snap`, it
could give out a snapped result that's meant to be 45 degrees but does
not have equal X/Y distances after converted to integer. Since 45
degrees can be used to make a equal length structure, it's best to make
sure that resulting X/Y values are the same if the angle is multiple of
45 degrees.

This fix would be effective for all tools that uses this "straight line
gizmo".

Pull Request: https://projects.blender.org/blender/blender/pulls/128683
2024-10-14 13:03:03 +08:00
John Kiril Swenson
e3f9d210d1 Fix #128401: Issues when splitting connected strip
This patch fixes broken connections and effect strips which would arise
in some cases when trying to split connected strips with effects.

This happened in case an effect strip was being split -- first, its
effect chain would be added to a VectorSet of seqs, but then, only the
connected strips of the original seq (in this case the effect strip)
would be added to the VectorSet. Fix by iterating over the entire list
and adding connected strips.

Additionally:

- Add a final SEQ_iterator_set_expand() for SEQ_query_effect_chain() in
  case these connected strips had effects themselves.
- Move the seq_edit_split_operation_permitted() check after the entire
  chain is evaluated to avoid bugs w/ locked strips being editable
  before.

Pull Request: https://projects.blender.org/blender/blender/pulls/128670
2024-10-14 05:26:42 +02:00
Campbell Barton
77b523d317 Fix #128920: Crash calculating geometry nodes that use UV unwrap
Regression in [0], missing null check.

[0]: 788bc5158e
2024-10-14 11:46:34 +11:00
John Kiril Swenson
72be365c6b Fix #126191: Both handle seqslide modal cancel
The issue was that if the seqslide was cancelled such that the
`new_frame` of the left handle was greater than its previous
right_handle (before the cancel), `SEQ_time_left_handle_frame_set()`
would clamp this value and so the left handle would not properly restore
itself.

Fix by updating both handles at once (right handle first) if both
handles are selected and the cancel jump travels in the right direction.

This also seems to fix the situation where strips w/ both handles
selected would be erroneously detected as overlapping when moving them
rapidly side to side.

Pull Request: https://projects.blender.org/blender/blender/pulls/128740
2024-10-14 00:49:01 +02:00
Harley Acheson
bdee3dfaa2 Fix #128906: Remove Docking Draw Callbacks After Deactivate
If we lose focus while splitting or docking we need to make sure that
the overlay drawing callbacks are stopped.

Pull Request: https://projects.blender.org/blender/blender/pulls/128957
2024-10-13 20:24:35 +02:00
Campbell Barton
15be0030f6 Cleanup: various non-functional C++ changes
- Avoid shadowing.
- Use default functions.
- Remove unused struct member from GpencilBatchCache.
2024-10-12 22:44:19 +11:00
YimingWu
57ca937a7c Fix #128714: GPv3: Don't erase behind the camera
If points are beind the camera, we don't really want to erase them. This
patch marks invalid coordinates thus preventing them from intersecting
with a eraser.

The reason for using a large value to indicate "invalid coordinate"s are:

- No need to further break down the way we process `src_to_dist` point matching array for `hard_eraser` `soft_eraser`, makes the entire logic much easier.
- No eraser is gonna be touching such a large coordinate of `1e20`.

Technically there's this case where if a segment crosses the near or far clipping plane (to handle this correctly, you'll need to split that segment into two at the clipping plane position and it increases complexity a lot), and then you will have undefined erasing behaviour, however the worse case is that the one segment was completely removed, and in such case I think it's acceptable.

Pull Request: https://projects.blender.org/blender/blender/pulls/128738
2024-10-12 13:24:58 +08:00
Pratik Borhade
bcf6524ca1 Fix #128601: Redoing move operation crash in sculpt mode
PBVH is null when redoing the move operation. To fix this,
update active object data from evaluated object before sending
undo_push.

Also fixed the crash in cache_init() after updating depsgraph

Pull Request: https://projects.blender.org/blender/blender/pulls/128625
2024-10-12 00:23:49 +02:00
Julian Eisel
d177388979 Sculpt/Paint: Tag brushes for unsaved changes for UI indication
Part of the brush assets project followups, see #116337.

Based on feedback, it seems important to indicate to the user when a brush has
unsaved changes.

There's no reliable updating mechanism we can use or hook into here, except for
RNA "update" callbacks. Brush data gets changed in many places in code, the only
way to do this seems manual tagging every time a brush property gets changed.
This PR introduces `BKE_brush_tag_unsaved_changes()` for this. I spent some time
going through all brush properties to ensure changes call the tagging function.

A known limitation with this will be that changes to dependencies won't be
indicated in the brush. E.g. Changing the texture attached to a brush won't make
the brush be indicated as changed.

The UI to indicate the changed brushes is being discussed still, see #128846.

Pull Request: https://projects.blender.org/blender/blender/pulls/128845
2024-10-11 22:08:14 +02:00
Harley Acheson
8675533448 Fix #128868: Hide Sharp Corners in Docking Split
While splitting areas the two parts are shown with rounded outlines,
but some of the underlying content can show through in the corners,
spoiling the effect. This PR just erases anything in those corners,
making it look cleaner and rounder.

Accidentally merged to main first with c3ea941273.
2024-10-11 12:31:23 -07:00
Clément Foucault
ac1069805c Fix: DRW: Broken multiview support with inverted scale object instances
If a `DrawGroup` contained both inverted and non-inverted scale
the command generate shader would output the `resource_id`
content at conflicting indices. This is because the number of
instances stored inside the `DrawGroup` are the original
count before multiview. Actually, only `start` was taking the
multi-view count into account.

We cannot modify the value on CPU otherwise it would increase
the instance count for each submission. So the fix is to
pass the view count to the command generate shader and
multiply the instance count where needed.

Fix #128085

Pull Request: https://projects.blender.org/blender/blender/pulls/128854
2024-10-11 18:09:57 +02:00
Clément Foucault
3764f53b1b Fix: EEVEE: Point lights with zero radius create in shadow artifact
This is likely caused by local_ray_up being degenerate with
very small radii. This is a temporary fix and should be revisited
later.

The issue is that the real fix is likely to have a higher
performance cost.

Fix #124636
2024-10-11 18:06:47 +02:00
Campbell Barton
094f7235bb Cleanup: replace own Py_INCREF_RET with CPython's Py_NewRef
These are both simple functions that serve the same purpose.
Py_NewRef didn't exist when Py_INCREF_RET was added to Blender.
2024-10-12 00:20:55 +11:00
Campbell Barton
02670b1547 Cleanup: correct wording in comments 2024-10-11 23:39:58 +11:00
Campbell Barton
b3e3eaabf0 Cleanup: suppress unknown-warning-option for clang
Also note why the warning isn't valid.
2024-10-11 23:36:19 +11:00
Falk David
24019cc863 Fix: GPv3: Effects not showing in right modes
The object mode flags of the cache population for the effects
were outdated.

This fix makes sure the right flags are used.
2024-10-11 10:54:49 +02:00
Jeroen Bakker
483f96ce73 Fix #128407: EEVEE: Cannot allocate volume pool on Intel ARC/OpenGL
When using OpenGL on Intel ARC the driver reports a max 3d allowed size
of 2048. The volume probe will create a texture that doesn't fit in this
dimension when selecting a probe size of 512 or 1024 MB.

This PR will reshape the volume pool atlas texture until it found a shape
that is optimal and fit on the device. When reshaping selects a different
pool size a warning message will be displayed as it might change the
visual quality.

When reshaping the smallest row size will be selected in order
to improve the occupancy. Reshaping will only happens when a
different setting is set in the `Performance->Memory->Light Probes Volume Pool`.

NOTE: Needs to be backported to 4.2

Pull Request: https://projects.blender.org/blender/blender/pulls/128877
2024-10-11 10:05:56 +02:00
blastframe
70280e9d12 Fix: typo in shadow error message
The error message related to shadow updates in `eevee_shadow.cc`
currently contains a typo:
`"Error: Too many shadow updates, some shadow might be incorrect."`
This sentence should use the plural form of "shadows" to correctly
describe the context.

Fixing this typo ensures clarity and correctness in the error message,
providing developers and users with the appropriate feedback when
encountering shadow update issues.

Pull Request: https://projects.blender.org/blender/blender/pulls/128865
2024-10-11 09:41:31 +02:00
Campbell Barton
b68ba3dae8 Fix #128839: "Apply Visual Geometry to Mesh" doesn't apply shape-keys
Technically a regression in [0] although it matches behavior prior
to v3.3 going back to 2.7x. The fix for #101883 [1] added a check
for the vertex number changing after the number was zeroed,
causing the shape key to be cleared in most cases.

While the handling of shape-keys in OBJECT_OT_convert wasn't well
defined - clearing the shape-key means in the evaluated coordinates
are always used so it is preferable.

Now the operator ensures the old (un-evaluated) shape-key isn't used.

[0]: 0791f53029
[1]: be32882e1c
2024-10-11 16:43:34 +11:00
Campbell Barton
6fe7203d1a Cleanup: suppress dangling-reference warning 2024-10-11 11:24:39 +11:00
Sean Kim
5c855bd6bf Fix: Sculpt: Reduce clay strips z-axis influence
This commit changes the Clay Strips brush in the following ways:
* Removes hardcoded displacement and scaling of brush matrix
* Applies a falloff to the factor based on the distance to the point in
  the brush-local z-axis

This change has the effect of reducing the brush influence on nearby or
other back-facing planes, reducing overall unwanted deformations.

Pull Request: https://projects.blender.org/blender/blender/pulls/128775
2024-10-10 22:49:12 +02:00
Sean Kim
57c4e9dd2c Fix #128820: Mask filter behaves incorrectly with hidden faces
The usage of `hide::node_visible_verts` in this function does not work
as intended, as the resulting span is misaligned with the sliced
per-node mask data. To fix this issue, this commit adds a similar helper
function to copy all hidden vert data and applies changes to all of the
node vertices.

Pull Request: https://projects.blender.org/blender/blender/pulls/128828
2024-10-10 22:40:38 +02:00
Clément Foucault
bc3fdc3293 Fix: EEVEE: Object wihtout volume probe visibility don't cast shadow
Object without lightprobe visibility should still
cast shadows during baking. They should only not
bounce indirect lighting.

This is more visible now that shadow linking is supported.

Fix #128812
2024-10-10 16:25:59 +02:00
Clément Foucault
b78354152e Revert "Fix #128407: EEVEE: Cannot allocate volume pool on Intel ARC/OpenGL"
Reverted as it breaks render test on some configs (AMD+Mesa+Linux).
This reverts commit 7d5712be9b.
2024-10-10 16:20:44 +02:00
Julian Eisel
10ef436c8f UI: Include asset description in asset shelf tooltip
Tooltips for assets in the asset shelf now don't only display the name,
but also the description saved in the asset's metadata. This is what we
usually do when assets are displayed, for example in the asset browser
or in add menus. Here it was just a small bit of polish that was never
done.
2024-10-10 16:10:34 +02:00
Sybren A. Stüvel
d261a881b1 Anim: change Action.id_root RNA definition to be more like v4.2
Change the `Action.id_root` RNA definition such that
`Action.bl_rna.properties["id_root"].enum_items` returns all valid
values for that property. This was the Blender 4.2 (and older) behaviour
as well.

The only difference now is that v4.3 adds a new `UNSPECIFIED` enum item,
which is not a valid ID type, but is a valid value for `Action.id_root`.

Some more context:

In Blender 4.2 the `Action.id_root` property was a hard-coded list of
all ID types. To add the `UNSPECIFIED` item in v4.3, this was replaced
by an 'items' callback. The way Blender deals with this by default is
such that querying `Action.bl_rna.properties["id_root"].enum_items`
returns its hard-coded default list, and not the result of that 'items'
callback function.

For Action Slots (which will be released in v4.4 but are already in the
sources as experimental feature), there is a similar property that is
implemented in a way such that its `.enum_items` always returns the
proper list. This commit updates the `Action.id_root` RNA property
definition so that it shares code with `ActionSlot.id_root`, fixing the
reported issue.

Note that the `ActionSlot` type is not exposed to RNA in Blender 4.3,
it's just some internal code that is now shared.

Pull Request: https://projects.blender.org/blender/blender/pulls/128834
2024-10-10 14:33:33 +02:00
Philipp Oeser
da9cf98324 Fix: assert parenting a legacy curve to an armature
The armature modifier calls `BKE_armature_deform_coords_with_mesh` (and
thus `BKE_id_defgroup_list_get`) for legacy curves as well, these are
only "riggable" via envelope weights though (this situation could be
made a bit clearer when parenting -- which is for another commit
though).

So to avoid the (rightful) assert in `BKE_id_defgroup_list_get`, only
call it in case vertex groups are supported (and possibly used later on
-- which is never the case for legacy curves).

Note: this was reported in chat by @LazyDodo because the CurveArmature
test was failing in debug

Pull Request: https://projects.blender.org/blender/blender/pulls/128792
2024-10-10 13:53:51 +02:00
Jacques Lucke
f2352efe55 Fix: wrong return type
This only resulted in an assert in debug builds.
2024-10-10 13:26:07 +02:00