Commit Graph

26232 Commits

Author SHA1 Message Date
Campbell Barton
5e1a048294 Cleanup: resolve undeclared function warning 2025-06-22 21:26:36 +10:00
Aaron Carlisle
98d11bf445 Cleanup: Use "Custom Normals" in code comments
Follows up on f0675f05a7 and corrects the terminology in some code comments.
2025-06-21 19:42:04 -04:00
Sean Kim
17f5c826bb Fix: Incorrect UnifiedPaintSettings compatibility writing
Mistake in 582c7d94b8.

The `ToolSetting` struct needs to be written after changing the
in-memory value.

Pull Request: https://projects.blender.org/blender/blender/pulls/140775
2025-06-22 00:03:16 +02:00
Sean Kim
3d507c4afe Merge branch 'blender-v4.5-release' 2025-06-21 15:02:38 -07:00
Sean Kim
99d4e7e330 Fix: Incorrect file version for brush forward compatibility code
Mistake in 6a03e8249d

Pull Request: https://projects.blender.org/blender/blender/pulls/140777
2025-06-22 00:02:03 +02:00
Sean Kim
a59ee6b2d0 Cleanup: Replace init/free functions for MultiresReshapeSmoothContext
Pull Request: https://projects.blender.org/blender/blender/pulls/140513
2025-06-21 02:42:36 +02:00
Sean Kim
ae8b2a827d Cleanup: Use Span<float3> instead of pointers for multires_reshape.cc
* Converts the old `vertcos` to a `Span<float3>`
* Reduces visibility of helper function.

Pull Request: https://projects.blender.org/blender/blender/pulls/140512
2025-06-21 02:40:56 +02:00
Sean Kim
4434a30d40 Paint: Make UnifiedPaintSettings a per-mode instead of scene-wide value
Historically, the `UnifiedPaintSettings` struct has been used to
provide users the ability to set brush values at a scene level. Examples
of such attributes are the brush size, strength, and color, to name a
few.

Instead of these values being shared across all of the grease pencil,
mesh painting, and curves sculpting modes. This commit migrates the
data to the `Paint` struct, meaning that each individual mode (e.g.
Sculpt, Vertex Paint, Grease Pencil Draw) now has the ability to change
these values without affecting other modes.

While this change is large, the majority of the work is simply
refactoring access to the `UnifiedPaintSetting` struct. to ensure the
correct property is being retrieved.

Resolves #134077

Pull Request: https://projects.blender.org/blender/blender/pulls/139766
2025-06-21 02:35:14 +02:00
Hans Goudey
417f8dee40 Merge branch 'blender-v4.5-release' 2025-06-20 11:46:56 -04:00
Hans Goudey
19ef847647 Fix #140689: Paint mode crash with empty Grease Pencil layer
In this case an empty CurvesGeometry didn't contain the position
attribute. Skipping the lookup in that case should be harmless.
2025-06-20 11:40:42 -04:00
Hans Goudey
5d184bd1d6 Fix: Potential memory leak reading AttributeStorage
For unsupported domains, storage types, or other issues with
reading the attribute data, the attribute name and data struct
could be leaked.
2025-06-20 11:40:42 -04:00
Campbell Barton
c2b96128ca Merge branch 'blender-v4.5-release' 2025-06-20 19:55:28 +10:00
Jacques Lucke
baf68516f0 Fix: Nodes: missing socket descriptions when grouping node 2025-06-20 10:23:32 +02:00
Hans Goudey
f61fbc468a Attributes: Remove AttributeStorage legacy compatibility option
Remove the use_attribute_storage_write experimental option and always
write in the new format, which is supported by 4.5. The new format is
only used at runtime by point clouds currently but there is no reason
for it to be an option at this point.

This is a second commit repeating 84212bae4b
after that was reverted. Issues that came up with Grease Pencil writing
have been resolved in the meantime.
2025-06-19 11:54:07 -04:00
Hans Goudey
77da71cd9d Merge branch 'blender-v4.5-release' 2025-06-19 11:45:07 -04:00
Hans Goudey
e82a051ade Fix: Issues in Grease Pencil blend file writing
After a recent commit, multiple drawings were always written using the
same address because we used the same stack memory in a loop. This
causes the blend file reading to not be able to distinguish between the
structs, meaning the file is corrupt. However, we already had the same
problem in some cases because of the inline buffer in `BlendWriteData`.
To resolve this, make all "temporary" data for writing live as long as
the writing is going on for the ID. This is somewhat inefficient since
it makes memory reuse impossible for this temporary data. In the future
we should use a technique like #127706 to address this.

For testing, I saved and loaded multiple production files with Grease
Pencil objects, with and without the "write with attribute storage"
option enabled. The fix still goes to 4.5 though, because the first
mentioned issue is present there, and the `CustomDataLayer` vector
address reuse is potentially a problem too.

Pull Request: https://projects.blender.org/blender/blender/pulls/140667
2025-06-19 17:44:28 +02:00
Michal Krupa
fdaaea6328 Core: Increase MAX_ID_NAME length from 66 to 258 (Blender 5.0)
Change the maximum data-block name from 64 to 256 bytes by increasing MAX_ID_NAME value.

Also increase a few related non-ID data name max size, essentially the action slots identifiers, as these are the primary key used to match an Action's slot to an ID by name.

Other sub-data (bones, modifiers, etc.) lengths are not modified here, as these can be made actual dynamic strings in the future, while keeping (a reasonable level of) forward compatibility, during the course of Blender 5 release cycles.

Implements #137608.

Co-authored-by: Bastien Montagne <bastien@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/137196
2025-06-19 16:39:20 +02:00
Bastien Montagne
5bfee02df3 Merge branch 'blender-v4.5-release' 2025-06-19 15:42:14 +02:00
Bastien Montagne
eb5d630db1 Fix #140581: Crash due to invalid info about potential ID dependencies of GP data.
GreasePencil ID type did not list `ID_OB` as its potential ID dependency
type, leading to lack of remapping of its layers' parents objects
pointers (e.g. on Object deletion), leading to crash from accessing
freed data.
2025-06-19 15:33:05 +02:00
Falk David
0e737b23c5 Revert "Attributes: Remove AttributeStorage legacy compatibility option"
This reverts commit 84212bae4b.
2025-06-19 12:20:20 +02:00
Habib Gahbiche
d88d4cc8ce Compositor: remove "Use Nodes"
Part of simplifying the compositor workflow:
https://projects.blender.org/blender/blender/issues/134214

The option "Use Nodes" is removed from the UI and marked deprecated.
It will get fully removed in 6.0.

"Use Nodes" is effectively replaced by the existing "Compositing"
option in the post-processing panel

Pull Request: https://projects.blender.org/blender/blender/pulls/138560
2025-06-18 18:39:02 +02:00
Hans Goudey
e743fe6c97 Merge branch 'blender-v4.5-release' 2025-06-18 10:03:44 -04:00
Hans Goudey
29c623f857 Fix #140530: Crash after writing Grease Pencil drawings in new format
`blend_write_prepare` expects to work on a shallow copy of the
`CurvesGeometry` struct. This is necessary because it changes
the struct to contain only the layers being written. This is
particularly important with writing with the new format enabled,
where attributes are written as part of `AttributeStorage`.

Writing with a shallow copy of the struct also gives us the
flexibility to zero the runtime pointer in the written file which
is generally a good practice.

Pull Request: https://projects.blender.org/blender/blender/pulls/140560
2025-06-18 16:02:15 +02:00
Jacques Lucke
1bb49edf7f Geometry Nodes: add structure type inferencing tests
The way these tests work is similar to the existing field inferencing tests.
There is a .blend file that is opened and then we check the inferred structure
types from Python. A new `NodeSocket.inferred_structure_type` property is added
to be able to access this information. Other then the field inferencing tests,
this patch does not directly check the socket shapes, which are not always
exactly determined by the inferred structure type.

This also fixes a few issues I found while adding the tests.

Pull Request: https://projects.blender.org/blender/blender/pulls/140520
2025-06-18 08:39:01 +02:00
Brecht Van Lommel
789db82dfd Merge branch 'blender-v4.5-release' 2025-06-17 20:09:12 +02:00
Brecht Van Lommel
03b1071bcb Fix: Invalid snprintf into the same string in recent bugfix
Mistake in 5b1126da66
2025-06-17 20:06:51 +02:00
Hans Goudey
54c3c8f411 Draw: Inline small functions to reduce overhead
Some functions used at least once per object/instance
when drawing are so trivial that function call overhead
becomes significant. Allowing these functions to be
inlined can remove that overhead and also give the
compiler more information it can use for optimization.

In the Erindale Flower Shop file, this change gives me
a 10% improvement in playback FPS, from 8.77 to 9.65.

Pull Request: https://projects.blender.org/blender/blender/pulls/140402
2025-06-17 16:06:05 +02:00
Brecht Van Lommel
ff8658b457 Merge branch 'blender-v4.5-release' 2025-06-17 14:17:06 +02:00
Brecht Van Lommel
5b1126da66 Fix #140375: Image editor save overwrites movie file
Create a good default name for saving individual frames of a movie file loaded
as an image datablock, instead of the movie file name.

Changes ImBuf to store the frame separate from the filepath, to implement this.
Seems more clear for ImBuf.filepath to be an actual filepath anyway.

Thanks to Jesse and Aras for investigating this bug.

Pull Request: https://projects.blender.org/blender/blender/pulls/140471
2025-06-17 14:15:19 +02:00
Campbell Barton
c29c7d2eae Cleanup: remove unused functions 2025-06-17 21:24:58 +10:00
Omar Emara
3ba4d8f58d Compositor: Remove Vector Curves node
This patch removes the Vector Curves node that was deprecated in 4.5 and
was planned for removal in 5.0. The common Shading Vector Curves node
should be used instead.

Pull Request: https://projects.blender.org/blender/blender/pulls/140529
2025-06-17 12:14:39 +02:00
Pratik Borhade
18421a3f48 Cleanup: Grease Pencil: Remove unused legacy functions
Some BKE_ functions are not relevant anymore. They are specific to legacy structure
dealing with masks and vertex weights.

Pull Request: https://projects.blender.org/blender/blender/pulls/135563
2025-06-17 10:38:39 +02:00
Sean Kim
29de34fdab Fix: Potential read of uninitialized memory for Vertex#is_infinite_sharp
Pull Request: https://projects.blender.org/blender/blender/pulls/140510
2025-06-17 06:15:30 +02:00
Sean Kim
03f3f42984 Cleanup: Remove unused and extraneous size variables
Pull Request: https://projects.blender.org/blender/blender/pulls/140507
2025-06-17 04:28:42 +02:00
Sean Kim
a6d3fa40ca Refactor: Use container types instead of pointers in multires_reshape_smooth.cc
This commit switches all of the manually allocated and freed arrays of
data in `multires_reshape_smooth` for various core container types,
depending on the specific usecase. As a direct result, many of the
parameters which were previously tagged as `const` are no longer.

Additionally, this allows for removing some manually tracked `size`
values.

Pull Request: https://projects.blender.org/blender/blender/pulls/140446
2025-06-16 23:43:00 +02:00
Sean Kim
73fd422701 Cleanup: Use C++ math types for multires_inline.hh
* Use `float3x3` and `float3` for the resulting tangent matrix and
  constituent derivatives, respectively.

Pull Request: https://projects.blender.org/blender/blender/pulls/140442
2025-06-16 23:42:05 +02:00
Mattias Fredriksson
407dcb39d4 Tests: EXPECT_EQ_SPAN utility macro
Replaces pointer based EXPECT_EQ_ARRAY with EXPECT_EQ_SPAN in most cases
as they already used spans (or span compatible datastructures).
Currently EXPECT_EQ_ARRAY only takes in one size variable and doesn't
compare the  number of elements between arguments (requiring an
additional line to do so).

This should make the code cleaner and safer. Goal is also to promote
the use Spans in new test code.

Pull Request: https://projects.blender.org/blender/blender/pulls/140340
2025-06-16 20:31:00 +02:00
Bastien Montagne
9a41dc73f9 Merge branch 'blender-v4.5-release' 2025-06-16 18:49:45 +02:00
Bastien Montagne
2e5b4a120a Fix #140083: Nodes: Never attempt to read default value from custom socket.
Pull Request: https://projects.blender.org/blender/blender/pulls/140459
2025-06-16 18:48:19 +02:00
Nathan Vegdahl
9b1f4dc483 Merge branch 'blender-v4.5-release' 2025-06-16 17:33:09 +02:00
Nathan Vegdahl
33b712f909 Core: Always use current open file for blend_name variable
Previously `blend_name` was using the same path to get its file name
as `//` used. However, the choice of path for `//` seems to be
bespokely chosen at each call site.  There may be a logic to it, but
if so it's not immediately clear what it is.

This PR changes `blend_name` to instead always use the currently open
("global") file path, making it well-defined and predictable for
users.

This also prepares better for PR #139438 for 5.0, which adds
`blend_name_lib`, which always uses the blend file that the ID owning
the path is linked from. Over-all this should be much more predictable
and controllable for users.

Pull Request: https://projects.blender.org/blender/blender/pulls/140474
2025-06-16 17:32:11 +02:00
Hans Goudey
c16ee2c939 Refactor: Use C++ bounds corners function
Remove the last uses of `BKE_boundbox_init_from_minmax` in
favor of the newer `bounds::corners`. Besides clearer naming
and better ergonomics, it's also inline-able which seems to be a
good thing for such a simple function.

In order to get the same behavior as before I changed the
C++ bounds function to give the same vertex order as the
older function.

Pull Request: https://projects.blender.org/blender/blender/pulls/140401
2025-06-16 15:49:14 +02:00
Hans Goudey
84212bae4b Attributes: Remove AttributeStorage legacy compatibility option
Remove the `use_attribute_storage_write` experimental option and always
write in the new format, which is supported by 4.5. The new format is
only used at runtime by point clouds currently but there is no reason
for it to be an option at this point.

Pull Request: https://projects.blender.org/blender/blender/pulls/140284
2025-06-16 15:48:23 +02:00
Omar Emara
35d21bd9d7 Compositor: Remove forward compatibility code
This patch removes the forward compatibility code for the compositor
that was introduced in 4.x and planned for removal in 5.0.

Pull Request: https://projects.blender.org/blender/blender/pulls/140458
2025-06-16 12:38:45 +02:00
Brecht Van Lommel
b920f6f1a7 Shaders: Remove point density texture node
This is replaced by geometry nodes, where volumes can now be generated from
point clouds and meshes with more control, and more efficient rendering as a
sparse volume.

No backwareds compatibility is provided, as this would be complicated, and
probably this feature was not used much in the past few years.

This node was supported in Cycles only, not by EEVEE.

Pull Request: https://projects.blender.org/blender/blender/pulls/140292
2025-06-16 12:06:02 +02:00
Pratik Borhade
a93ab6446d Merge branch 'blender-v4.5-release' 2025-06-16 09:57:57 +05:30
Sean Kim
005ce385d4 Cleanup: Add missing explicit dependency on header
All of the modified files were  pulling in `BLI_math_vector.h` via
`BLI_multires.hh` and subsequently `multires_inline.hh`

Pull Request: https://projects.blender.org/blender/blender/pulls/140441
2025-06-16 01:00:29 +02:00
Sean Kim
716653d22b Cleanup: Use blender::Array instead of raw pointer for PolyCornerIndex
Changes `MultiresDisplacementData` to use a `blender::Array` instead of
a manually allocated pointer to allow for using `Span`s and avoid
further manual memory management.

Note that `MultiresDisplacementData` is already handled via C++ style
`new` & `delete` and does not need to be converted as a prerequisite.

Pull Request: https://projects.blender.org/blender/blender/pulls/140328
2025-06-16 00:56:12 +02:00
Sean Kim
23cc842319 Cleanup: C++ changes for subdiv_displacement_multires.cc
* Uses references where possible
* Adds const where appropriate

This commit only modifies the internal methods, and does not touch any
of the function signatures or areas that interface with other parts of
the codebase.

Pull Request: https://projects.blender.org/blender/blender/pulls/140326
2025-06-15 23:09:18 +02:00
YimingWu
6756982f07 Fix #139873: Grease Pencil: Auto normalization on assign/remove operator
Auto normalization used to not work on assign/remove vertex group
operator, this was due to `BKE_object_defgroup_validmap_get` and
`vgroup_parray_alloc` did not handle grease pencil type objects. Now
added grease pencil cases in them and auto normalization works as
expected.

Pull Request: https://projects.blender.org/blender/blender/pulls/139912
2025-06-15 12:50:13 +02:00