Commit Graph

116706 Commits

Author SHA1 Message Date
Sybren A. Stüvel
dd67b355ee Anim: do not set slot ID type when Action is linked
When an action slot does not have an ID type, and it is assigned to some
ID, the slot is bound to that ID's type. This now no longer happens when
the Action is linked, because linked data should not be modified.

Pull Request: https://projects.blender.org/blender/blender/pulls/133670
2025-01-27 17:51:23 +01:00
Nika Kutsniashvili
cc8c8c83a6 UI: Fix incorrect name for shape key property
"Shape Key Lock", the current name for the property to isolate
a shape key is non-descriptive. The pin icon helps a bit but
it is still unrelated.

Rename "Shape Key Lock" to "Solo Active Shape Key".

More details and screenshots in the PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/133377
2025-01-27 17:44:26 +01:00
Bastien Montagne
fe9478ff0b Cleanup: RNA: Use RNA_id_pointer_create for IDs, and return PointerRNA_NULL.
There is no (good) reason to use 'refine' internal code to create RNA
pointers of IDs, these always ignore any 'ID inheritance', since by
definition the 'owner ID' info of an ID PointerRNA is always that ID.

Similarily, do not call RNA pointers creation code with null data, this
will simply return `PointerRNA_NULL`, can as well return that directly.

Pull Request: https://projects.blender.org/blender/blender/pulls/133668
2025-01-27 17:15:54 +01:00
Hans Goudey
8b1bf74b3a Geometry Nodes: Reduce memory usage in edge angle node
Use 2 integers per edge instead of 3, by encoding the manifold
status of edges with negative face indices rather than as a separate
variable.
2025-01-27 10:59:51 -05:00
Jacques Lucke
48187684a3 BLI: assert valid utf8 in string search
This has been discussed in the context of #129209.
2025-01-27 16:38:06 +01:00
Sybren A. Stüvel
16ea57f8c6 Refactor: Anim, deduplicate Action Slot selection for keying & assignment
Deduplicate `assign_action_ensure_slot_for_keying()` and
`generic_slot_for_autoassign()`.

Some of the functionality of the latter function was copied into the
former. This has now been replaced by actually calling the function in
the appropriate spot.

No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/133652
2025-01-27 16:16:02 +01:00
Jacques Lucke
9e8b3e035a Fix #133633: crash because of edited Smooth by Angle node group
This adds a shallow check to see if the node group has been changed. If it has
been changed, the weak library reference is removed so that the node group will
be loaded from the source file again. This should become unnecessary once we
have asset embedding.

There are probably still ways to make Blender behave unexpectedly when editing
the Smooth by Angle node group, but this should already cover common edits. More
precise checks could be added as necessary.

Pull Request: https://projects.blender.org/blender/blender/pulls/133654
2025-01-27 15:31:22 +01:00
Sybren A. Stüvel
65c23dc7c6 Refactor: Anim, rename "unbound slot" to "untyped slot"
An Action slot usually has a specific ID type (`ActionSlot::idtype`).
When this is set to 0, it is not specifc to any particular ID type. The
latter case was called "unbound", and is now called "untyped".

Note that untyped slots are given an ID type as soon as they are
actually assigned to any ID.

No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/133651
2025-01-27 15:15:33 +01:00
Omar Emara
2028bc8d7d Compositor: Add derived resources optimization
This patch introduces a new Derived Resources concept to the compositor.
Derived resources are resources that are computed from a particular
result and cached in it in case it is needed by another operation, which
can greatly improve performance in some cases at the cost of more memory
usage.

The first use case is to store denoised versions of the Denoising Albedo
and Denoising Normals passes if auxiliary pass denoising is enabled in
the denoise node. Consequently, multi-pass denoising setups where the
same auxiliary passes are used in multiple denoise nodes should be much
faster due to caching of the derived resources.

This implementation has the limitation that it can't preemptively
invalidate the cache when the derived resources are no longer needed to
free up memory. This requires a special resource tracking mechanism that
need to happen during node tree compilation, and will be submitted
later. The limitation is not significant in the particular derived
resources that is currently implemented. Since the auxiliary passes are
rarely used outside of denoising.

Fixes #131171.

Pull Request: https://projects.blender.org/blender/blender/pulls/125671
2025-01-27 14:58:09 +01:00
Hans Goudey
e05a1871db Fix #133551: Crash accessing scene.tool_settings.uv_sculpt
After e3894f0a07, the UV sculpt
struct doesn't inherit from Paint anymore.

Pull Request: https://projects.blender.org/blender/blender/pulls/133655
2025-01-27 14:51:22 +01:00
Jeroen Bakker
8c014d0a32 Fix #133646: Grease Pencil: Crash when disabling simplified anti-aliasing
Uninitialized textures are bound when simplified anti-aliasing is disabled.
The textures are initialized later. Fixing by referencing the textures
similar to the other passes.

Pull Request: https://projects.blender.org/blender/blender/pulls/133648
2025-01-27 14:37:11 +01:00
Jacques Lucke
484250ad12 Fix #133401: support tooltips in custom node sockets
Previously, tooltips were always retrieved from the socket declaration, so they
were not available for custom node trees.

Pull Request: https://projects.blender.org/blender/blender/pulls/133555
2025-01-27 14:30:30 +01:00
Jacques Lucke
a0b898904e Cleanup: add clarifying comment 2025-01-27 14:26:10 +01:00
Bastien Montagne
90995f6c46 Fix #126310: Recursive ID CleanUp operation wrongly deleting some used IDs.
Broken detection of isolated archipelagos of IDs lead to falsly detecting
some data as unused in some specific cases (when the entry point of the
archipelago was only used within that archipelago, but some other ID in
the archipelago had actual valid users outside of it).
2025-01-27 14:19:25 +01:00
Jacques Lucke
82c676676a Fix #133524: crash with localized missing node group
The issue is that the localized node tree has an invalid type if the linked file
is not available. So we essentially ended up with a geometry node group that
contains a group node that points to a non-geometry nodes group.

Pull Request: https://projects.blender.org/blender/blender/pulls/133650
2025-01-27 13:33:16 +01:00
Jacques Lucke
c56d32353e Fix #103824: crash when trying to add socket to File Output node from Python API
Adding sockets to the file output node using `node.inputs.new` is not supported.
They would have been removed in `update_output_file` again anyway if the code
would get that far. The correct way to do this is to use the `node.file_slots`
API. We still allow moving and removing sockets for the time being, because
changing that would be a breaking change.

Pull Request: https://projects.blender.org/blender/blender/pulls/133554
2025-01-27 13:13:02 +01:00
Iliya Katushenock
c63b44eaec Fix #131095: EEVEE: Support long property path as attribute name
Attribute name could be a path built from multiple object/property names
while each of them can be 64 symbols long.
This was fixed by cff53fdb53, so Cycles
can handle this. But eevee need additional change.

Pull Request: https://projects.blender.org/blender/blender/pulls/131183
2025-01-27 12:07:32 +01:00
Jeroen Bakker
efff379ea5 Metal: Add support to force workarounds.
Recently it came to out attention that macOs13 doesn't always work due
to texture atomics not supported by that version of the OS.

Development happens most of the time on newer versions of the OS without
ability to check if it still works on the older versions.

This PR enables to disable some Metal capabilities to better check how
Blender works on those OS's. The capabilities that will be disabled
are texture gathering and texture atomics. It doesn't disable the
capabilities that are required to start Blender, which are still
part of the `MTLCapabilities` struct.

This allows us to reproduce issues like #129571

Pull Request: https://projects.blender.org/blender/blender/pulls/133636
2025-01-27 11:07:20 +01:00
Nathan Vegdahl
94b916a3ba Fix #133362: crash when autokeying object with motion path but no action
When moving an object with a motion path and animdata but no assigned
action, and with certain auto-key settings enabled, Blender would crash.

The cause was code that tried to access an action's fcurves without
proper guarding: the guard checked whether an object had animdata, but
not whether it had an action assigned or not, and would happily try to
access that non-existent action's fcurves.

This fixes the crash by also checking if an action is assigned.

Pull Request: https://projects.blender.org/blender/blender/pulls/133552
2025-01-27 09:52:32 +01:00
Omar Emara
4b3ad6ff23 Compositor: UI: Clarify warning in Render Layers node
Passes are supported in EEVEE, but not other engines, so exclude EEVEE
from the warning through wording.
2025-01-27 10:33:12 +02:00
Jeroen Bakker
e6b3cc8983 Vulkan: Device command builder
This PR implements a new the threading model for building render graphs
based on tests performed last month. For out workload multithreaded
command building will block in the driver or device. So better to use a
single thread for command building.

Details of the internal working is documented at https://developer.blender.org/docs/features/gpu/vulkan/render_graph/

- When a context is activated on a thread the context asks for a
  render graph it can use by calling `VKDevice::render_graph_new`.
- Parts of the GPU backend that requires GPU commands will add a
  specific render graph node to the render graph. The nodes also
  contains a reference to all resources it needs including the
  access it needs and the image layout.
- When the context is flushed the render graph is submitted to the
  device by calling `VKDevice::render_graph_submit`.
- The device puts the render graph in `VKDevice::submission_pool`.
- There is a single background thread that gets the next render
  graph to send to the GPU (`VKDevice::submission_runner`).
  - Reorder the commands of the render graph to comply with Vulkan
    specific command order rules and reducing possible bottlenecks.
    (`VKScheduler`)
  - Generate the required barriers `VKCommandBuilder::groups_extract_barriers`.
    This is a separate step to reduce resource locking giving other
    threads access to the resource states when they are building
    the render graph nodes.
  - GPU commands and pipeline barriers are recorded to a VkCommandBuffer.
    (`VKCommandBuilder::record_commands`)
  - When completed the command buffer can be submitted to the device
    queue. `vkQueueSubmit`
  - Render graphs that have been submitted can be reused by a next
    thread. This is done by pushing the render graph to the
    `VKDevice::unused_render_graphs` queue.

Pull Request: https://projects.blender.org/blender/blender/pulls/132681
2025-01-27 08:55:23 +01:00
Harley Acheson
b34c135c30 UI: Status Bar Display Improvements For Regions
PR #133601 exposes some holes in the Status Bar display. Currently you
can see keymap entries for other areas, like 3D View, when hovering in
the Top Bar.  Or see the wrong items when hovering in a non-region
portions of an area. Or see keymap entries for window regions while
hovering headers. This PR fixes all these things.

Pull Request: https://projects.blender.org/blender/blender/pulls/133620
2025-01-26 21:26:44 +01:00
Alaska
3e11cfb1d0 Fix #133591: Bevel profile shape name did not match between redo and status bar
Update the name of the Profile shape variable for the bevel tool
in edit mode to be `Profile Shape` in both the redo panel and
status bar.

Pull Request: https://projects.blender.org/blender/blender/pulls/133598
2025-01-26 04:29:30 +01:00
Harley Acheson
b58ff3484f Fix #133550: Status Bar Display at Window Edges
When your mouse is hovering in the gaps between editors the Status Bar
indicates that you can resize and bring up context options. This same
gap is also along the outside window edges even though not visible and
so shows these options when not applicable. This PR carefully shows the
actual area options right up to the edge instead. And also does not
show "Resize" for the gap between global areas and the rest.

Pull Request: https://projects.blender.org/blender/blender/pulls/133601
2025-01-26 03:45:44 +01:00
Richard Antalik
bf732e4237 Fix: Possibly incorrect return value in VSE text editing operators
Paste and text insert could delete selected text, but then cancel
operator execution due to buffer being too small. Ensure, that operator
returns value based on state being actually changed or not.

Pull Request: https://projects.blender.org/blender/blender/pulls/133569
2025-01-26 01:35:48 +01:00
luzpaz-2
974ac39044 Cleanup: Typo
Pull Request: https://projects.blender.org/blender/blender/pulls/133541
2025-01-26 00:39:59 +01:00
Pratik Borhade
2a85a27609 Fix #115697: Allow compression on auto-save files
After 0e8e219d71 / efb511a76d, memfile undo step is not used for writing
the autosave file, instead regular file saving function is used (`BLO_write_file`).
With that it is possible to compress the file when `G_FILE_COMPRESS`
flag is set.
As discussed in !132685, always compress auto-save .blend file
irrespective of `USER_FILECOMPRESS`

Pull Request: https://projects.blender.org/blender/blender/pulls/132685
2025-01-25 09:29:39 +01:00
Sean Kim
6e8ab9b04a Cleanup: Minor changes to multires_displacement_smear.cc
* Removes unused headers
* Removes no-op multiplication
* Reduces scope of variables

Pull Request: https://projects.blender.org/blender/blender/pulls/133567
2025-01-25 00:28:34 +01:00
Sean Kim
12583c0f4a Fix #133509: Smear Multires Displacement corrupts mesh
Caused by db73ef0f2f

The displacement smear brush works by evaluating the previous
displacement of a given neighbor vertex to generate a weighted average.
Prior to the linked commit, the mesh-sized `prev_displacement` array
would be initialized to (0.0, 0.0, 0.0) by subtracting the
`limit_surface_co` from itself.

in certain cases, a neighbor vertex value may not be initialized,
causing NaN to get propagated through the mesh.

To fix this, and avoid needing to reintroduce this unnecessary
computation, explicitly initialize `prev_displacement` to an array of
(0.0f, 0.0f, 0.0f).

Pull Request: https://projects.blender.org/blender/blender/pulls/133522
2025-01-24 23:07:20 +01:00
Julian Eisel
f5b1a4625d UI: Allow drawing icons as drag previews, use for dragging assets
Instead of requiring an image buffer to draw a bigger preview image
while dragging, allow passing an icon ID and draw that as preview. This
is also how we draw previews elsewhere. Use this for attaching the asset
previews to draggable buttons.

A small user visible change is that previews from the asset browser will
always draw at the default size (multiplied by the interface scale)
while dragging. Previously it used the same size as the asset browser
preview size, which I don't think was useful really. With small sizes
the preview while dragging got unnecessarily small too, with big sizes
it got in the way.

Needed for #131871.
2025-01-24 22:32:27 +01:00
Julian Eisel
d88e0459d1 Fix: Incorrect type in previous commit
Meant to use a boolean.
2025-01-24 20:53:00 +01:00
Julian Eisel
5055adc1c0 Fix: Preview images didn't load progressively as intended
Custom preview images loaded from disk are supposed to load one by one
in a background thread, but pop up in the UI as they get ready. This
gradual/progressive loading wasn't working correctly, previews would
only show up after all current preview requests were handled. I think
there would still be some progressive loading, since handling a batch of
requests might finish before all requests for the current frame are in.
Now it works as intended, by actually tagging loaded previews.

Mistake in 16ab6111f7.

Noticed while working on #131871.
2025-01-24 20:50:02 +01:00
Julian Eisel
315e7e04a8 UI: Avoid double scaling of preview images, improve filtering
When loading preview images from disk, we'd first scale them to the
standard preview image size (in `icon_copy_rect()`) and then scale them
again to the drawing size when eventually drawing to screen. The first
scaling would happen on the CPU, which is slow, and without filtering.

Now the image is stored in its original size and only scaled when
drawing, which uses scaling on the GPU with mipmaps and bi-linear
filtering. While a bit more blurry, the resulting image has less
artifacts and represents the original image better. Keeping the images
unscaled means memory footprint is bigger, we could cap the size if
necessary.

Noticed while working on #131871. Asset shelf previews would have more
artifacts than before.

See pull request for comparisons.

Pull Request: https://projects.blender.org/blender/blender/pulls/133559
2025-01-24 19:46:33 +01:00
Jacques Lucke
6b09daf1e4 BLI: support building VMutableArray from container
Previously, this was only implemented for `VArray`.

Pull Request: https://projects.blender.org/blender/blender/pulls/133540
2025-01-24 17:49:35 +01:00
Bastien Montagne
9c237af041 Refactor: RNA: add discrete suffix to RNA_pointer_create.
This is a noisy preliminary step to the 'RNA ancestors' change. The
rename helps clearly tell what each `pointer_create` function does.

Pull Request: https://projects.blender.org/blender/blender/pulls/133475
2025-01-24 16:45:32 +01:00
Jacques Lucke
2e1aba03d9 Fix: potential crash when iterating over linked list while freeing elements 2025-01-24 16:30:19 +01:00
Miguel Pozo
956236f7d4 Fix: Draw: Add missing shaders to DRW_subdiv_free 2025-01-24 16:01:48 +01:00
Philipp Oeser
e4c125400f Fix #133055: Some Grease Pencil modifiers ignore "Invert Vertex Group"
The handling of influence vertexgroups was incomplete/inconsistent.
Some prior work was already done in 08539618cd, c452d5d9e8,
782a4c9d85, 0fd3f3c216, 434f94b254, 82ea972834, f6b820ccb7,
00968fe6db .

Now that the inverting is handled consistently, we can move that part
out of specific modifier code an into the generic retrieval function
`greasepencil::get_influence_vertex_weights` -- resulting in all
modifiers using it behaving the same.

There were some modifiers already handling
`GREASE_PENCIL_INFLUENCE_INVERT_VERTEX_GROUP`, however even those still
had one issue: if no vertexgroup was set, invert would still have been
calculated (this issue is also resolved with this PR).

Remaining modifiers that were offering influence vertexgroups (e.g.
Noise) but ignoring it now work correctly.

NOTE: there are still modifiers handling influence vertexgroups outside
of `greasepencil::get_influence_vertex_weights`:
- Armature (has own code for this in
`BKE_armature_deform_coords_with_curves`)
- Shrinkwrap (has own code for this in `shrinkwrapParams_deform`)
- Thickness (this rather special behavior is untouched)

Pull Request: https://projects.blender.org/blender/blender/pulls/133426
2025-01-24 14:47:33 +01:00
Omar Emara
109478d599 Compositor: Delay transformations until realization
This patch delays applying transformations until realization happens on
some other domain.

Currently, transformations are applied immediately at the point of
transform nodes, this is problematic for a few reasons:

- If that result was then realized on some other domain, interpolation
  will have happened two times, at the transform nodes and at the node
  that required realization, causing less than ideal precision issues.
- It is not possible to repeat or extend a rotated result because its
  empty areas will be zero filled, leaving gaps in its extension. So
  this patch is a prerequisite for #132371 if we want full support for
  repetition.
- Doing inverse transformations will introduce interpolation artifacts
  which might be undesirable. Inverse transformations might be used to
  do pixelation for instance, so this change will be undesirable in this
  case. But we decided that this is not a use case that we want to
  support, and we added explicit pixel size control to the pixelate node
  as an alternative.

So this has four implications, two that might be considered bad:

- Transformations will now be higher quality and more precise.
- Repetition and other boundary extension methods will now be possible.
- Downsampling then upsampling will no longer produce pixelated results.
- Realization might happen multiple times with identical results in some
  cases.

The last point not a big issue, since domain realization is not a big
bottleneck in the compositor, and the plan is to move realization into
pixel operations, so it will even be more efficient than it is now.

Pull Request: https://projects.blender.org/blender/blender/pulls/133158
2025-01-24 13:59:55 +01:00
Jeroen Bakker
9db5f61403 Fix: DrawManager: Missing include for draw manager tests
`draw_manager_testing.hh` was needed otherwise the compiler would print
a warning.

Pull Request: https://projects.blender.org/blender/blender/pulls/133538
2025-01-24 12:57:13 +01:00
Laurynas Duburas
71e30bf229 Fix #132370: Grease Pencil: Draw on multiple frames
At the end of stroke drawing appends it to all editable
`greasepencil::Drawing`s if in `GP_USE_MULTI_FRAME_EDITING` mode.

Pull Request: https://projects.blender.org/blender/blender/pulls/133355
2025-01-24 12:50:44 +01:00
Christoph Lendenfeld
e4f34453e3 Refactor: pass Vector instead of ListBase to motion path functions
This changes the `ListBase` argument for certain motion path functions
to `Vector<MPathTarget *>`. (and `Span`)

To better describe what the function is doing,
`animviz_get_object_motionpaths` has been renamed
to `animviz_build_motionpath_targets`.

Since `BLI_freelistN` can no longer be used, I added
`animviz_free_motionpath_targets`.

Note that the Vector is of `MPathTarget *` which
are allocated the C way. Because the `MPathTarget` struct is defined
in the .cc file, that's the only way for it to work atm.
Other refactors may mitigate that in the future, but I wanted to keep
the scope small.

Pull Request: https://projects.blender.org/blender/blender/pulls/133212
2025-01-24 12:43:20 +01:00
Jeroen Bakker
e2dddea124 Fix: Vulkan: Thread safe cache folder
Vulkan shader compiler accesses the cache folder via multiple threads.
GHOST part isn't thread safe and can return and overwrite the returned
cache path. This resulted into crashes when performing background
rendering and failing test cases, loading of incorrect shaders etc.

This PR fixes this to cache the cache folder location in the
VKShaderCompiler, which is loaded via the main thread when the vulkan
backend is initialized.

Pull Request: https://projects.blender.org/blender/blender/pulls/133535
2025-01-24 12:20:43 +01:00
Jacques Lucke
2fda20e1db Fix #132099: crash when using same geometry on objects with different material counts
The core issue was that the geometry batch cache (e.g. `MeshBatchCache` or
`PointCloudBatchCache`) was dependent on the object. This is problematic when
the the same geometry is used with multiple different objects because the cache
can't be consistent with all of them.

Fortunately, the only thing that was retrieved from the object was the number of
material slots, so if that can be avoided we should be fine. We can't just use
the number of material slots stored on the geometry because that may have no
material slots but still has material indices which are overridden on the object
level.

The solution is to take make the number of materials for a geometry only
dependent on the actual `material_index` attribute and not on the number of
available slots. More specifically, we find the maximal referenced material
index and handle that many materials. This number does not depend on how many
material slots there are on the object, but it still allows the object to
override materials slots that the mesh references.

A downside is that the maximum material index has to be computed which often
requires an iteration over the mesh. Fortunately, we can cache that quite easily
and the computation can be done in parallel. Also we are probably able to
eagerly update the material index in many cases when it's set instead of
computing it lazily. That is not implemented in this patch though.

The largest part of the patch is making the maximal material index easily
available on all the geometry types. Besides that, the material API is slightly
replaced and the drawing code now makes use of the updated API.

Pull Request: https://projects.blender.org/blender/blender/pulls/133498
2025-01-24 12:05:25 +01:00
Jeroen Bakker
2feb435780 Fix: Vulkan: Memory allocation on no-rebar capable platforms
Memory areas was requested to be preferable host visible. On some
platforms this would fail to allocate. Best is to not add preferable
host visible for typically large allocations.

This PR also gives the caller the responsibility to set the allocation flags.

Pull Request: https://projects.blender.org/blender/blender/pulls/133528
2025-01-24 11:54:59 +01:00
Brecht Van Lommel
b11316fa3f Fix: Chinese language translation not working after recent refactor
Properly take into account script when searching for language folders.

Pull Request: https://projects.blender.org/blender/blender/pulls/133532
2025-01-24 11:23:36 +01:00
Omar Emara
759a7a08d9 Fix: Conversion shader fails compilation on MacOS
Argument names can't be the same as a push constant name, so rename the
push constant.

Pull Request: https://projects.blender.org/blender/blender/pulls/133531
2025-01-24 11:14:56 +01:00
Pratik Borhade
15e367f31a Fix #133434: No default tool for image editor view mode
Set sample tool as default for `view` mode of image editor.
Also expanded the condition in `toolsystem_key_ensure_check` so default
tool can be obtained inn view ui_mode.

Pull Request: https://projects.blender.org/blender/blender/pulls/133471
2025-01-24 11:04:10 +01:00
Jonas Holzman
b701ba6554 macOS: Fix WITH_GPU_DRAW_TESTS build linking error
The issue was twofold, the `draw_tests` library was missing a link
dependency on `gpu_tests`, and the `gpu_tests` would only be generated
if `WITH_GPU_BACKEND_TESTS` or `WITH_VULKAN_BACKEND` were also ON due
to a superflous condition.

Pull Request: https://projects.blender.org/blender/blender/pulls/133511
2025-01-24 11:00:34 +01:00
Falk David
7dfdf8f8f6 Cleanup: VSE: Rename rna_def_sequence to rna_def_strip 2025-01-24 10:22:55 +01:00