Commit Graph

117524 Commits

Author SHA1 Message Date
Omar Emara
fc02027d1c Cleanup: Compositor: List all types in switch case
Replace default cases with all types to make adding new types easier.
2025-02-20 14:32:39 +02:00
Omar Emara
5e8f96277d Compositor: Reduce vector type components to 3
Previously, the vector type in the compositor had 4-components to
accommodated float4 types, while the last component was ignored for the
rest of the vector types. But now that we have a dedicated type for
float4 in #134486. We can reduce that vector type to 3-components.

Pull Request: https://projects.blender.org/blender/blender/pulls/134570
2025-02-20 13:23:54 +01:00
Sybren A. Stüvel
611a138719 Merge remote-tracking branch 'origin/blender-v4.4-release' 2025-02-20 12:54:26 +01:00
Jeroen Bakker
e39669e3c3 SubDiv: Use shader create info for SubdivNormalsFinalize shaders.
This change migrates the first 2 subdiv shaders  to use the ShaderCreateInfo.
Other shaders will follow in separate PRs.

- Should compile when using `WITH_GPU_SHADER_CPP_COMPILATION`
- A `subdiv_` prefix is added only to the functions related to `PosNorLoop`.
    But eventually the prefix should also be added to other lib functions.
- Due to Metal restrictions `subdiv_set_vertex_*` is implemented using a
    functional paradigma. Our Metal backend only supports `inout` qualifier
    on thead local data structures.

Pull Request: https://projects.blender.org/blender/blender/pulls/134218
2025-02-20 12:30:51 +01:00
Sybren A. Stüvel
3dbede128e Fix #134581: Regression: Animation breaking going from 4.3 to 4.4
Fix an issue where the versioning of Action & slot assignments did not
use RNA properties to do the slot assignment. This caused certain
on-update callbacks to be missed, which in turn meant that an Action
constraint could remain disabled even though its action slot assignment
had been corrected.

This is now resolved by actually using RNA to set the assigned slot in
the versioning code.

Unfortunately that does mean that any reporting done will be by the
generic RNA code as well, and won't be specific to versioning. This
shouldn't be much of an issue in practice, as any warning was only shown
in the rare case of mis-matched `action.idroot` properties.

Pull Request: https://projects.blender.org/blender/blender/pulls/134759
2025-02-20 11:58:01 +01:00
Jacques Lucke
88157430c1 Geometry Nodes: eagerly update bounding box after CSV import
This avoids computing the bounding box later (if the positions are not changed).
Since the positions are are zero, the bounding box is just the origin point too.
2025-02-20 11:45:21 +01:00
Anthony Roberts
c8929b856a Merge branch 'blender-v4.4-release' 2025-02-20 10:27:08 +00:00
Bastien Montagne
8045576c60 Cleanup: Avoid some void pointer freeing for type safety
Essentially add some API to properly free non-public data, instead of directly calling `MEM_freeN` on them.

Based on @brecht code from
https://projects.blender.org/mont29/blender/compare/tmp-guardedalloc-api...brecht:free-void

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/134765
2025-02-20 11:24:34 +01:00
Jeroen Bakker
b1eaf58aa4 Fix #134586: EEVEE: Crash when rendering large resolutions
EEVEE crashes when it is not able to allocate buffers. Previously we had a
message showing to the user that it tries to allocate a texture larger than
supported by the GPU. But was not implemented for EEVEE-next. This fix will
add back this error message.

![image.png](/attachments/723c10a4-2b44-49c4-a30f-6e8178055d8a)

Pull Request: https://projects.blender.org/blender/blender/pulls/134725
2025-02-20 11:18:26 +01:00
Jeroen Bakker
3ca5f6f62e Cleanup: GPU: Reduce compilation warnings
When compiling shaders using GCC there are warnings about functions
being declared twice. This PR will remove those warnings as they are
false positives. The warnings exists to identify typing errors.

Pull Request: https://projects.blender.org/blender/blender/pulls/134832
2025-02-20 11:17:49 +01:00
Jacques Lucke
46ae0a86ca Geometry Nodes: improve multi-threading and avoid redundant work in CSV import
The position attribute was not initialized in parallel. Also there was an accidental
single threaded copy of each attribute because a `std::move` didn't work because
the variable was `const`.
2025-02-20 10:52:15 +01:00
Omar Emara
a5ecde48ae Compositor: Add Float4 type
The compositor previously overloaded the vector type to represent
multiple dimensions that are always stored in a 4D float vector. This
patch introduce a dedicated type for float4, leaving the vector type to
always represent a 3D vector, which will be done in a later commit.

This is not exposed to the user as a separate socket type with a
different color, it is only an internal type that uses the same vector
socket shape and color.

Since the vector socket represents both 4D and 3D vectors, code
generally assumes that such sockets represents 3D vectors, and the
developer is expected to set it to a 4D vector if needed in the node
operation constructor, or use the newly added skip_type_conversion flag
for nodes that do not care about types, like the File Output node.
Though this should be redundant once we add a dimension property for
vector sockets.

Pull Request: https://projects.blender.org/blender/blender/pulls/134486
2025-02-20 10:38:40 +01:00
Bastien Montagne
48e26c3afe MEM_guardedalloc: Refactor to add more type-safety.
The main goal of these changes are to improve static (i.e. build-time)
checks on whether a given data can be allocated and freed with `malloc`
and `free` (C-style), or requires proper C++-style construction and
destruction (`new` and `delete`).

* Add new `MEM_malloc_arrayN_aligned` API.
* Make `MEM_freeN` a template function in C++, which does static assert on
  type triviality.
* Add `MEM_SAFE_DELETE`, similar to `MEM_SAFE_FREE` but calling
  `MEM_delete`.

The changes to `MEM_freeN` was painful and useful, as it allowed to fix a bunch
of invalid calls in existing codebase already.

It also highlighted a fair amount of places where it is called to free incomplete
type pointers, which is likely a sign of badly designed code (there should
rather be an API to destroy and free these data then, if the data type is not fully
publicly exposed). For now, these are 'worked around' by explicitly casting the
freed pointers to `void *` in these cases - which also makes them easy to search for.
Some of these will be addressed separately (see blender/blender!134765).

Finally, MSVC seems to consider structs defining new/delete operators (e.g. by
using the `MEM_CXX_CLASS_ALLOC_FUNCS` macro) as non-trivial. This does not
seem to follow the definition of type triviality, so for now static type checking in
`MEM_freeN` has been disabled for Windows. We'll likely have to do the same
with type-safe `MEM_[cm]allocN` API being worked on in blender/blender!134771

Based on ideas from Brecht in blender/blender!134452

Pull Request: https://projects.blender.org/blender/blender/pulls/134463
2025-02-20 10:37:10 +01:00
Dalai Felinto
6be8dd16e7 Fix (experimental) Point Cloud properties editor not showing
This was introduced on: 1584cd9aa5.
2025-02-20 09:32:21 +01:00
Omar Emara
263d9b9ccc Merge branch 'blender-v4.4-release' 2025-02-20 08:30:51 +02:00
Omar Emara
f0e92c695d Fix: File Output node crash when saving vector image
The File Output node crashes when saving a 16-bit vector image in an
RGBA image. That's because the OIIO writer assumes 4-channel buffer
while the buffer provided by the node is only 3-channel. To fix this,
the OIIO writer is extended to support all possible combination of
source and target channels.

Pull Request: https://projects.blender.org/blender/blender/pulls/134789
2025-02-20 07:29:34 +01:00
Sean Kim
0dd326592a Undo: Add explicit filtering for IDs and RNA structs marked as skippable
In the past, around the time that 2.80 was released, 4a08b974f4
introduced the idea of filtering out certain editor changes inside
the paint modes and edit mode (e.g. changing brush sizes in the editor).

This commit is the first in a series to attempt to refine this behavior
so that only certain editor settings are filtered out from the undo
stack.

In total, it does the following:
* Adds the Brush datablock to the list of IDs that do not have undo
  pushes.
* Adds support to filter out RNA structs that do not have the
  `STRUCT_UNDO` property applied (currently, just the 3D Cursor).

This has the following effects:
* Changing brush settings inside the Image Editor no longer causes
  undo pushes, becoming consistent with the other paint modes.
* Changing brush settings while in object mode in the outliner data
  block view no longer causes undo pushes.

Co-authored-by: Campbell Barton <campbell@blender.org>
2025-02-20 07:12:56 +01:00
Campbell Barton
3f6a152bf0 Cleanup: avoid redundant file-type flag calculation 2025-02-20 16:38:59 +11:00
Harley Acheson
80ae7ab04f Merge branch 'blender-v4.4-release' 2025-02-19 17:06:17 -08:00
Harley Acheson
81262b9421 Fix #134491: Adjust Text Input Offset When Deleting Selection
When a text string is longer than the available space it can be at a
scrolled offset, so that you can edit text that is wider than its
container. When selected text is deleted we don't update this offset,
so it is possible to have newly pasted text scrolled out of view. This
PR decreases the offset by the amount of the selected string that is
currently out of view.

Pull Request: https://projects.blender.org/blender/blender/pulls/134815
2025-02-20 02:05:03 +01:00
Jesse Yurkovich
c5b34ff17f Cleanup: IO: Use recently added radius accessors for USD and Alembic IO
Use recently added `radius` accessors for USD and Alembic PointClouds
and Curves.

Pull Request: https://projects.blender.org/blender/blender/pulls/134704
2025-02-20 00:23:25 +01:00
Jesse Yurkovich
de5c38e969 Merge branch 'blender-v4.4-release' 2025-02-19 14:09:48 -08:00
Jesse Yurkovich
1ef3808030 Fix: Incorrect radius values used for Alembic points and USD nurbs
These were reading in "widths" and not adjusting the values when setting
Blender's "radius" properties.

Found while cleaning up the radius API usage as part of another change.

Pull Request: https://projects.blender.org/blender/blender/pulls/134709
2025-02-19 23:09:03 +01:00
Jacques Lucke
dd28661bea Refactor: BLI: extract function to convert bytes to bits
Right now this code is only used to convert boolean arrays to bits (e.g. for
faster `IndexMask` generation). This patch extracts a more general function that
converts bytes to bits using a rule that is passed in as parameter. This may
become useful to speedup parsing e.g. CSV files to speedup detection of
delimiters and other special byte values.

This code is already covered by unit tests, so no new tests have been added.

Pull Request: https://projects.blender.org/blender/blender/pulls/134798
2025-02-19 22:52:55 +01:00
Jörg Müller
9301a0e159 Compile fix: include limits.h for INT_MIN/MAX.
Pull Request: https://projects.blender.org/blender/blender/pulls/134697
2025-02-19 22:51:07 +01:00
Sean Kim
188811feb4 Merge branch 'blender-v4.4-release' 2025-02-19 13:08:17 -08:00
Sean Kim
0acd86abca Fix: Vertex Paint average brush produces incorrect results
This commit moves the initialization of the node-sized accumulation
array out of the parallel loop to avoid odd optimization errors when
differing between debug and release builds as well as errors due to
integer overflow in both builds.

Additionally it only accumulates results from affected nodes.

Pull Request: https://projects.blender.org/blender/blender/pulls/134720
2025-02-19 22:07:34 +01:00
Sean Kim
b128f5b0d6 Merge branch 'blender-v4.4-release' 2025-02-19 13:06:16 -08:00
Sean Kim
f3377aa7e8 Fix: Set Persistent Base doesn't work for cloth brushes
The `init_positions` variable that the `ss.sculpt_persistent_co` member
gets set to was not passed into the corresponding calculation function,
resulting in a no-op.

Pull Request: https://projects.blender.org/blender/blender/pulls/134781
2025-02-19 22:05:37 +01:00
Sean Kim
875f9abe9d Merge branch 'blender-v4.4-release' 2025-02-19 13:04:40 -08:00
Sean Kim
f1fca48a4f Fix #134292: Clone brush cannot access local blendfile images
With the brush assets project, brushes were moved from being local to
the working blendfile to being linked from asset libraries. This breaks
the Image Paint 'Clone' brush, as it has a brush property that links to
other Image datablocks.

To support this functionality, this commit adds the corresponding
properties into the `ImagePaintSettings` struct so that it is stored
locally with the images that will be used by the tool, inside the main
blendfile.

The source image property is shared with the 3D version of the 'Clone'
brush instead of adding a separate field to preserve old behavior.

Notably, this has the following limitations:
* If clone brush assets have been made and shared with external packs,
  they would not work out of the box with linked image assets.
* Despite these settings being stored on the scene, they are populated
  inside the tool window under "Brush Settings" which is potentially
  misleading. However, this is already the case for the 3D version of
  the brush, so further UI refinement will happen outside of this PR.
* Users will be unable to use separate images simultaneously for the
  Image editor and the 3D viewport, unlike in pre-4.3 versions. This
  can be adjusted in the future if it is a critical workflow.

Because the intended design and functionality of this tool is currently
questionable, this commit opts to make these changes instead of doing
further design to support both accessing data on the brush and on the
scene.

Pull Request: https://projects.blender.org/blender/blender/pulls/134474
2025-02-19 22:00:39 +01:00
Sean Kim
5cce8cc073 Merge branch 'blender-v4.4-release' 2025-02-19 12:59:30 -08:00
Sean Kim
af8da338a0 Fix #134770: Multires persistent base doesn't work randomly
The previous attempt to restore this behavior was in
0a2d5d5801

That commit introduced clearing the related `SculptSession` variables
when the paint BVH was freed to avoid bad behaviors seen in 4.2 and
prior. However, this solution is somewhat incorrect, as the prior state
of this data is not necessarily restored when the BVH is recreated,
unlike other temporary mapping data.

This results in the persistent base data being cleared occasionally with
no indication to the user that this is happening, causing the setting to
appear to be inactive.

To fix this, this commit makes a few changes:
* Removes clearing this data in the `BKE_sculptsession_free_pbvh`
  function.
* Initializes the displacement arrays to the same size as the position
  and normal array.
* Introduce new variables to track the saved multires grid size so
  that it is not deleted, only considered invalid when the topology
  changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/134780
2025-02-19 21:58:49 +01:00
Julian Eisel
05c6446c38 Fix #128966: Update Dopesheet playhead in separate window
The playhead is redrawn as an overlay, so instead of a full region
redraw using `ARegionType.draw()`, at least an overlay only redraw using
`ARegion.draw_overlay()` needs to be triggered.

Any redrawing within a window is skipped if neither the screen, nor any
of its areas or regions are tagged for redraw. So since there are no
other areas or regions to be fully redrawn in this window, no redrawing
will happen. The screen needs to be tagged for redraw, which will skip
most drawing in this case, and just draw the overlays as wanted.

Pull Request: https://projects.blender.org/blender/blender/pulls/134579
2025-02-19 21:53:15 +01:00
Harley Acheson
2e90aace03 Fix #134796: Adjust Error Theme Color for Widget Text
When using the Error theme color for widget text color, this has to be
altered to provide sufficient contrast with other content.  This was
done with label text color, before recent changes to make these colors
themeable, by blending with text color. This PR makes similar changes
and gives similar results.

Pull Request: https://projects.blender.org/blender/blender/pulls/134807
2025-02-19 20:24:33 +01:00
Harley Acheson
9a36b800eb Merge branch 'blender-v4.4-release' 2025-02-19 11:04:59 -08:00
Harley Acheson
0425940794 Fix #134630: Do Not Set Area Subtype For Previously Stored Editors
When changing editors within an area we are currently always setting
the subtype if there are modes. This causes problems when returning to
a previous editor versus starting with the correct one. We have tried
various ways of returning to the old editor, but never quite works.
This PR only sets the subtype if we are creating a new area. If not
just leave it as it was so we naturally return to its old state.

Pull Request: https://projects.blender.org/blender/blender/pulls/134642
2025-02-19 20:03:55 +01:00
Harley Acheson
9c374fbb93 UI: Skip Internal Operators For Idle Status Bar
During idle time, just moving your mouse into an editor, the Status Bar
only shows operations attached to mouse events. Hovering into
Properties shows an item on the left mouse called "Set Active
Modifier". This is always shown because it is an internal operator
always running in that area. This PR just skips OPTYPE_INTERNAL
operators for this idle display.

Pull Request: https://projects.blender.org/blender/blender/pulls/134782
2025-02-19 19:25:14 +01:00
Clément Foucault
f8195e0bb4 Fix: Overlay: Broken shader compilation
Caused by the changes in UBO members.
This removes the duplicated lib used by overlay
and reuse the same side clip plane UBO mechanism
as workbench.
2025-02-19 17:46:47 +01:00
Dalai Felinto
9d06f32761 Point Cloud: Select Random
Move the mask_random function to BLI_index_mask.hh, so it can be shared between curves, grease pencil and point cloud.

Copied/inspired by the curves select code.

Pull Request: https://projects.blender.org/blender/blender/pulls/134624
2025-02-19 17:23:37 +01:00
Dalai Felinto
1584cd9aa5 Cleanup: Rename point cloud to pointcloud / POINT_CLOUD to POINTCLOUD
Though "Point Cloud" written as two words is technically correct and should be used in the UI, as one word it's typically easier to write and parse when reading. We had a mix of both before this patch, so better to unify this as well.

This commit also renames the editor/intern/ files to remove pointcloud_ prefix.
point_cloud was only preserved on the user facing strings:

* is_type_point_cloud
* use_new_point_cloud_type

Pull Request: https://projects.blender.org/blender/blender/pulls/134803
2025-02-19 17:11:08 +01:00
Miguel Pozo
d6682af786 Fix: Compiler warnings on Mac
Caused by #133557

Pull Request: https://projects.blender.org/blender/blender/pulls/134776
2025-02-19 17:08:38 +01:00
Jacques Lucke
234810f01d Fix: Geometry Nodes: support relative paths in import nodes
Previously, the code would assert in `BLI_fopen` when the path is relative.

There are two main options to make the path absolute:
1. Always use the path of the current .blend file as base.
2. Is the path of the .blend file "owns" the current node as base. So when
  the Import node is part of a linked node tree, the path of the linked .blend
  file is used as base.

Both options are useful depending on the specific use-case, but the latter
seems more consistent with other places in Blender. For more advanced
functionality, we might need nodes that give the current .blend file path
and one node to join paths.

Pull Request: https://projects.blender.org/blender/blender/pulls/134794
2025-02-19 15:33:37 +01:00
Hans Goudey
0fd79c3613 Point Cloud: Implement join operator
Similar to !134691.

Pull Request: https://projects.blender.org/blender/blender/pulls/134702
2025-02-19 15:30:12 +01:00
Hans Goudey
5a6d2e1ce2 Curves: Implement join operator
Previously the object join operator wasn't implemented for the new
curves type. This commit implements the joining by passing the selected
curves geometry as instances to the realize instances function. That way
the complexity of the new code just relates to dealing with objects.

Pull Request: https://projects.blender.org/blender/blender/pulls/134691
2025-02-19 15:24:29 +01:00
Hans Goudey
2f01da564d Fix: Point Cloud: Properly handle caches in undo step decode
Previously the bounds and BVH caches could be incorrect after redo.
2025-02-19 09:14:33 -05:00
Hans Goudey
cc2d85ae7c Point Cloud: Support view selected operator in edit mode 2025-02-19 09:14:33 -05:00
Philipp Oeser
7847df4686 Pointcloud: Integration with transverts (cursor snapping)
This adds:
- support for snapping for the pointcloud object (selection to cursor/
grid, cursor to selection)
- as usual, "Warp" an "Randomize" operators come along "for free" with
this

Pull Request: https://projects.blender.org/blender/blender/pulls/134799
2025-02-19 15:06:06 +01:00
Philipp Oeser
57ed1e9632 Merge branch 'blender-v4.4-release' 2025-02-19 14:28:38 +01:00
Philipp Oeser
3dc9211b8f Fix #134662: Video Sequencer: reset transforms ignores auto keyframing
Just call the appropriate autokeyframe functions when this operator
changes StripTransform properties.

Pull Request: https://projects.blender.org/blender/blender/pulls/134667
2025-02-19 14:28:14 +01:00