Commit Graph

120055 Commits

Author SHA1 Message Date
Omar Emara
440dc61db2 Compositor: Add stub implemenetation for CPU pixel nodes
This patch adds stub implementation for CPU pixel nodes in order to stop
those nodes from crashing when used while also easing future
development.

Pull Request: https://projects.blender.org/blender/blender/pulls/129033
2024-10-15 09:32:13 +02:00
Jeroen Bakker
d1ccebffd0 Cleanup: make format 2024-10-15 08:58:29 +02:00
Campbell Barton
aa6742897e Cleanup: spelling in comments 2024-10-15 16:22:38 +11:00
Campbell Barton
11e41f7276 Merge branch 'blender-v4.3-release' 2024-10-15 16:22:09 +11:00
Campbell Barton
eb36125218 Unbreak build from missing include 2024-10-15 16:20:53 +11:00
Omar Emara
fbdb803750 Compositor: Implement Multi-Function Procedure Operation
This patch implements the multi-function procedure operation for the new
CPU compositor, which is a concrete implementation of the PixelOperation
abstraction, much like ShaderOperation, but uses the FN system to more
efficiently evaluate a group of pixel-wise operations.

A few changes were done to FN to support development. The multi-function
builder now allows retrieving the built function. A new builder method
construct_and_set_matching_fn_cb was added to allow using the SI_SO
builders with non static functions. A few other SI_SO were added to. And
a CPP type for float4 was added.

Additionally, the Gamma, Math, Brightness, and Normal nodes were
implemented as an example. The Math node implementation reused the
existing GN math node implementation, so the code was moved to a common
file.

Reference #125968.

Pull Request: https://projects.blender.org/blender/blender/pulls/126988
2024-10-15 06:51:42 +02:00
Campbell Barton
44d0452a78 Cleanup: spelling in comments 2024-10-15 12:51:05 +11:00
Jesse Yurkovich
24301e9b22 Merge branch 'blender-v4.3-release' 2024-10-14 13:57:38 -07: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
b2a67aa750 Merge branch 'blender-v4.3-release' 2024-10-14 13:47:16 -07: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
a68cad4d59 Cleanup: Various non-functional changes for sculpt_gesture.cc
* Use const where possible
* Use C++ math types where possible
* Use std::array of vector types instead of raw arrays where possible

The main areas untouched here are functions which currently do not have
a C++ equivalent (math_geom.cc) and some clip plane arguments which are
wider-reaching than just this file (PBVHFrustumPlanes).

Pull Request: https://projects.blender.org/blender/blender/pulls/128931
2024-10-14 22:07:56 +02:00
Sean Kim
f5f116aba8 Merge branch 'blender-v4.3-release' 2024-10-14 12:46:00 -07: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
Sybren A. Stüvel
975b5f4533 Anim: invert Action editor 'Show All Slots' filter flag meaning
In the Action editor header, change the "Show All Slots" filter to
become "Only Show Slot of Active Object". The default state remains
"off".

This means that any new/upgraded Action editor will show all slots in
the Action by default. I think this is a good idea, especially since
cb6ed12ef1 makes related data-blocks share
the same Action, and thus the Action will have a mixture of Object and
non-Object animation. I suspect that it'll help in understanding the new
functionality of slotted Actions when they are most visible, i.e. when
the multiple slots are all shown.

Since slotted Actions are so new, I don't think we need to add
versioning code to accomodate this change.

Pull Request: https://projects.blender.org/blender/blender/pulls/129011
2024-10-14 19:21:36 +02:00
Sybren A. Stüvel
bb310831b8 Anim: don't depend on space data pointer when unassigning Action
When un-assigning an Action, do not depend on the Dope Sheet space data
`action` pointer. Instead, Blender now just sets the RNA property
`id.animation_data.action = None` to un-assign the Action. Using RNA this
way will ensure that the messagebus gets notified of this change as well.

The Dope Sheet space data 'action' pointer is still set to `nullptr`, but
it is now no longer used as primary way to clear the Action.

Pull Request: https://projects.blender.org/blender/blender/pulls/129006
2024-10-14 18:34:10 +02:00
Sybren A. Stüvel
ab1cd6f223 Anim: also copy tmp_slot_handle and tmp_slot_name on liboverride apply
Extend the library override code for the `AnimData` struct so that it
correctly copies the `tmp_slot_handle` and `tmp_slot_name` fields.

Pull Request: https://projects.blender.org/blender/blender/pulls/129005
2024-10-14 18:28:48 +02:00
Sybren A. Stüvel
5cdb950bef Anim: Fix pose library flipping with slotted Actions
Building the F-Curve cache used for pose flipping now also works with
slotted Actions. Like the pose library itself, it only considers the first
slot of the pose asset. Multi-slot pose assets are not supported.

Pull Request: https://projects.blender.org/blender/blender/pulls/128992
2024-10-14 18:26:20 +02:00
Philipp Oeser
ced8833d72 Merge branch 'blender-v4.3-release' 2024-10-14 18:00:29 +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
88420820fb Merge branch 'blender-v4.3-release' 2024-10-14 08:28:31 -07: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
ccb8eff970 Merge branch 'blender-v4.3-release' 2024-10-14 08:25:02 -07: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
Jason Fielder
6da42e9c95 Fix: Metal: GPU_finish() not syncing when there's no (current) command buffer to sync on
Reported by @fclem.  On Metal GPU_finish enacts a CPU<-> GPU sync by
submitting a command buffer and waiting on the completion event.
However if there was no command buffer to submit then the call was
returning immediately, regardless of any outstanding GPU work.
This fixes that case by keeping track of all outstanding work and
blocking on that.

Authored by Apple: James McCarthy

Co-authored-by: James McCarthy <jamesmccarthy@apple.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/128987
2024-10-14 17:12:03 +02:00
Bastien Montagne
c082260b50 Merge branch 'blender-v4.3-release' 2024-10-14 16:52:01 +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
399060aa0e Merge branch 'blender-v4.3-release' 2024-10-14 15:45:34 +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
be24e7a6a1 Merge branch 'blender-v4.3-release' 2024-10-14 17:43:54 +05:30
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
40d87a824e Fix #125611: Add collection instance ignores scale property
Get `scale` property value and copy it to `ob->scale`.
"scale" member to CollectionAddInfo is added to handle this.

Pull Request: https://projects.blender.org/blender/blender/pulls/125651
2024-10-14 13:52:30 +02:00
Sybren A. Stüvel
d00e6e7353 Anim: update slot selection for Action Constraint
Like with NLA strips, Action assignment on Action Constraints needs to
have an extra step (compared to regular assignment to animated
data-blocks).

For the Action Constraint, the auto slot selection gets one more
fallback option (compared to the generic code). This is to support the
following scenario, which used to be necessary as a workaround for a bug
in Blender (#127976):

- Python script creates an Action,
- assigns it to the animated object,
- unassigns it from that object,
- and assigns it to the object's Action Constraint.

The generic code doesn't work for this. The first assignment would see
the slot `XXSlot`, and because it has never been used, just use it. This
would change its name to `OBSlot`. The assignment to the Action
Constraint would not see a 'virgin' slot, and thus not auto-select
`OBSlot`. This behaviour makes sense when assigning Actions in the
Action editor (it shouldn't automatically pick the first slot of
matching ID type), but for the Action Constraint I (Sybren) feel that it
could be a bit more 'enthousiastic' in auto-picking a slot.

Note that this is the same behaviour as for NLA strips, albeit for a
slightly different reason. Because of that it's not sharing code with
the NLA.

Pull Request: https://projects.blender.org/blender/blender/pulls/128892
2024-10-14 13:45:36 +02:00
Sybren A. Stüvel
76bddb41df Anim: Fix NLA Strip Action assignment
When creating a new NLA strip for an action, as well as when setting
`strip.action` via RNA, use the generic action-assignment code. This
ensures that the slot selection follows the same logic as other Action
assignments.

If the generic slot selection doesn't find a suitable slot, and there is
a single slot on that Action of a suitable ID type, always assign it.
This is to support the following scenario:

- Python script creates an Action and adds F-Curves via the legacy API.
- This creates a slot 'XXSlot'.
- The script creates multiple NLA strips for that Action.
- The desired result is that these strips get the same Slot assigned as
  well.

The generic code doesn't work for this, because:

- The first strip assignment would see the slot `XXSlot` (`XX`
  indicating "not bound to any ID type yet"). Because that slot has
  never been used, it will be assigned (which is good). This assignment
  would change its name to, for example, `OBSlot`.

- The second strip assignment would not see a 'virgin' slot, and thus
  not auto-select `OBSlot`. This behaviour makes sense when assigning
  Actions in the Action editor (assigning an Action that already
  animates 'Cube' to 'Suzanne' should not assign the 'OBCube' slot to
  Suzanne), but for the NLA I feel that it could be a bit more
  'enthousiastic' in auto-picking a slot to support the above case.

This is preparation for the removal of the 'Slotted Actions'
experimental flag, and getting the new code to run as compatibly as
possible with the legacy code.

The return value of `animrig::nla::assign_action()` has changed a bit.
It used to indicate whether a slot was auto-selected; it now indicates
whether the Action assignment was successful. Whether a slot was
assigned or not can be seen at `strip.action_slot`.

Pull Request: https://projects.blender.org/blender/blender/pulls/128892
2024-10-14 13:45:02 +02:00
Sybren A. Stüvel
ee3aea4caf Anim: When assigning an Action, auto-assign slot if it was never used
When assigning an Action, and it has only one slot that has never been
assigned to anything before, auto-assign that slot.

This is the last option for the slot auto-selection. It is in place mostly
for backward compatibility in the following situation:

- Python script creates a new Action, and adds F-Curves via the legacy API
  `action.fcurves.new(...)`. This automatically creates a slot with
  `id_type = 0`, indicating it is not yet bound to any ID type.
- The script assigns the Action to a data-block.

In this case the implicitly created slot is automatically assigned, and
thus the data-block is animated by the F-Curves created through the legacy
API.

Pull Request: https://projects.blender.org/blender/blender/pulls/128892
2024-10-14 13:44:59 +02:00
Sybren A. Stüvel
86249a6216 Anim: Implement cycle-aware keying for Slotted Actions
Cycle-aware keying on slotted Actions now works the same as on legacy
Actions. In the future this will be improved, but for now it's good enough
to have the same behaviour as before.

Pull Request: https://projects.blender.org/blender/blender/pulls/128892
2024-10-14 13:44:55 +02:00
Sybren A. Stüvel
b7049a7c04 Refactor: Anim: add function to ensure an F-Curve exists in legacy Action
Split the legacy Action handling code of `action_fcurve_ensure()` into a
new function `action_fcurve_ensure_legacy()`. This makes it possible for
unit tests to explicitly create a legacy Action for testing, regardless
of the 'Slotted Actions' experimental feature flag.

When we drop that flag, the unit tests that explicitly test legacy
behaviour will keep running.

Pull Request: https://projects.blender.org/blender/blender/pulls/128892
2024-10-14 13:44:37 +02:00
Omar Emara
f4fc683fc4 Compositor: Add stub CPU implementation for nodes
This patch adds stub implementations for the new CPU mode of the
realtime compositor. Unsupported nodes will return zero results until
they are implemented.
2024-10-14 14:19:14 +03: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
62b7947769 Merge branch 'blender-v4.3-release' 2024-10-14 11:51:52 +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