Commit Graph

28898 Commits

Author SHA1 Message Date
Jacques Lucke
f2ee95843c Nodes: improve socket tooltips
The main goal of the patch is to make the socket tooltips more useful. This is
achieved in two ways:
* Use better text formatting in the tooltip to make it easier to parse and to
  better separate the current actual value from more general information about
  the socket.
* Add some more information like implicit field inputs when the node is not used
  currently or more details about a color.

This patch basically rewrites the entire tooltip generation, because it's quite
different from before (where we just created a single string for the entire
tooltip).

I'm using monospace for the actual current socket value and type, while the
normal font is used for general information about the socket like it's name,
description, allowed geometry types etc.

Pull Request: https://projects.blender.org/blender/blender/pulls/140540
2025-07-17 12:48:17 +02:00
Christoph Lendenfeld
e80ceb52df Fix #139509: Slot assignment is lost when loading file saved in tweak mode
The issue was that the `AnimData.tmp_slot_handle` had no RNA property associated with it
and so it couldn't be saved in the lib override.

The fix is to add the property. To ensure the correct code is called, most of the previous code
was replaced with a call to `blender::animrig::assign_tmpaction`

Pull Request: https://projects.blender.org/blender/blender/pulls/141395
2025-07-17 11:35:18 +02:00
Falk David
1a46806546 Fix: Grease Pencil: Missing call to finish() writing layer attributes
The `GSpanAttributeWriter` was missing a call to `finish()` to ensure
the changes are tagged and saved.
2025-07-17 11:31:10 +02:00
Lukas Tönne
23d02ec57b Fix armature deform: Avoid accessing parameter data after moving 2025-07-17 09:42:39 +02:00
Jacques Lucke
55e2fd2929 Cleanup: unify naming for named constructors
Previously, we used an inconsistent naming scheme for such "named constructors".
Now it always uses `from_*`.

Pull Request: https://projects.blender.org/blender/blender/pulls/142175
2025-07-17 09:09:16 +02:00
Hans Goudey
b19696c0b8 Mesh: Simplify tangents calculation
- Tangent calculation functions no longer use the CustomData struct as
  an input and output.
- The "orco" and UV map calculations are exposed as separate API
  functions to avoid a confusing internal choice between the two
- Redundancy in the API is removed, function names are clarified
- Code is moved to C++ namespace
- The "orco" case is clarified in the mesh draw tangent VBO extraction
- CD_TANGENT layers are not stored in CustomData anymore, so some of
  that infrastructure is removed.
- Broken logic for caching tangents in CustomData is removed. That
  hasn't worked for many years, if it every worked. We could investigate
  adding caching again later if that's helpful.

Overall the change is motivated by the need to move away from CustomData
for #122398. But the changes should be a general improvement that makes
the code easier to understand either way.

Testing for this PR included using the default render UV in materials,
referencing specific UV tangents by name, using the spherical position-
based tangents in a material, and baking textures (multires and normal
baking).

Pull Request: https://projects.blender.org/blender/blender/pulls/141799
2025-07-17 02:24:09 +02:00
Hans Goudey
e3c5070dfe Cleanup: Remove unused data transfer code
Shape key interpolation was never implemented. Nowadays it's
probably better to implement similar features in different ways
rather than extending this system. Also some layer mapping
generation was unused. The motivation for this is easing some
cleanups to make this modifier less directly reliant on CustomData.

Pull Request: https://projects.blender.org/blender/blender/pulls/142131
2025-07-16 22:53:21 +02:00
Hans Goudey
d669f28e05 Fix: Overlapping data transfer enum values
This code is really weird, I'm not sure if this caused user-visible
errors but these values shouldn't overlap.

Pull Request: https://projects.blender.org/blender/blender/pulls/142130
2025-07-16 22:53:11 +02:00
Hans Goudey
65131f22f8 Cleanup: Use Span arguments for some mesh remapping functions
Pull Request: https://projects.blender.org/blender/blender/pulls/142123
2025-07-16 21:59:25 +02:00
Hans Goudey
b20ecee555 Mesh: Move freestyle tags to generic attributes
This commit moves the freestyle edge and face mark tags to become
generic attributes, similar to other changes over the past years. The
attributes are called "freestyle_edge" and "freestyle_face", and they're
now propagated like regular boolean attributes.

Compatibility wise, forward and backward blend file compatibility are
maintained (for forward compatibility this is implemented a bit
differently than in the past because of the ongoing `AttributeStorage`
transition). In the Python API, `use_freestyle_mark` has been removed;
the attribute API should be used instead (just like bevel weights).
The BMesh (`freestyle`) accessors are removed too.

The conversions benefit from the fact that bit-wise, the old structs are
the same as `bool`, so we can convert to the old and new formats without
reallocating arrays.

Pull Request: https://projects.blender.org/blender/blender/pulls/141996
2025-07-16 18:26:26 +02:00
Namit Bhutani
8602f893ed Fix #141811: Crash with remesh operator
Fixes crash in the remesh operator by moving mesh spatial organization
to appropriate execution contexts and using proper memory handling in
spatial organization's face offset calculations.

Pull Request: https://projects.blender.org/blender/blender/pulls/141842
2025-07-16 14:27:18 +02:00
Jacques Lucke
f7f18cd0c7 Nodes: initial support for built-in menu sockets
So far, only node group were able to have menu input sockets. Built-in nodes did
not support them. Currently, all menus of built-in nodes are stored on the node
instead of on the sockets. This limits their flexibility because it's not
possible to expose these inputs.

This patch adds initial support for having menu inputs in built-in nodes. For
testing purposes, it also changes a couple built-in nodes to use an input socket
instead of a node property: Points to Volume, Transform Geometry, Triangulate,
Volume to Mesh and Match String.

### Compatibility

Forward and backward compatibility is maintained where possible (it's not
possible when the menu input is linked in 5.0). The overall compatibility
approach is the same as what was done for the compositor with two differences:
there are no wrapper RNA properties (not necessary for 5.0, those were removed
for the compositor already too), no need to version animation (animation on the
menu properties was already disabled).

This also makes menu sockets not animatable in general which is kind of brittle
(e.g. doesn't properly update when the menu definition changes). To animate a
menu it's better to animate an integer and to drive an index switch with it.

### Which nodes to update?

Many existing menu properties can become sockets, but it's currently not the
intention to convert all of them. In some cases, converting them might restrict
future improvements too much. This mainly affects Math nodes.

Other existing nodes should be updated but are a bit more tricky to update for
different reasons:
* We don't support dynamic output visibility yet. This is something I'll need to
  look into at some point.
* They are shared with shader/compositor nodes, which may be more limited in
  what can become a socket.
* There may be performance implications unless extra special cases are
  implemented, especially for multi-function nodes.
* Some nodes use socket renaming instead of dynamic socket visibility which
  isn't something we support more generally yet.

### Implementation

The core implementation is fairly straight forward. The heavy lifting is done by
the existing socket visibility inferencing. There is a new simple API that
allows individual nodes to implement custom input-usage-rules based on other
inputs in a decentralized way.

In most cases, the nodes to update just have a single menu, so there is a new
node-declaration utility that links a socket to a specific value of the menu
input. This internally handles the usage inferencing as well as making the
socket available when using link-drag-search.

In the modified nodes, I also had to explicitly set the "main input" now which
is used when inserting the node in a link. The automatic behavior doesn't work
currently when the first input is a menu. This is something we'll have to solve
more generally at some point but is out of scope for this patch.

Pull Request: https://projects.blender.org/blender/blender/pulls/140705
2025-07-16 08:31:59 +02:00
Hans Goudey
0781b90962 Cleanup: Formatting 2025-07-15 17:24:46 -04:00
Hans Goudey
98a1816e01 Cleanup: Clarify comment position in custom data type conversion 2025-07-15 16:37:37 -04:00
Jacques Lucke
655afbb235 Fix: Geometry Nodes: output fields from closures
This fixes the anonymous attribute lifetime inferencing for the closure zone and
the evaluate closure node. It also adds new regression tests for cases where a
closure outputs a field.

Pull Request: https://projects.blender.org/blender/blender/pulls/141925
2025-07-15 06:48:24 +02:00
Sean Kim
8feef54afa Refactor: Use C++ math type for ReshapeGridElement structs
Pull Request: https://projects.blender.org/blender/blender/pulls/141698
2025-07-15 00:01:12 +02:00
Jacques Lucke
00c81f5113 Merge branch 'blender-v4.5-release' 2025-07-14 16:30:38 +02:00
YimingWu
4096309753 Fix #141819: Interface Use a flag for WM_set_locked_interface
Different operations may need to lock different part of the interface,
e.g. for rendering, the image editor may still need refreshing while the
interface is locked, but when baking data into a scene, the image editor
needs to be locked because it is not thread safe to get data from a
partially evaluated depsgraph.

This is a better fix on top of 7c8b8b2457
that addresses the root cause with more flexibility for future
operations that requires different interface locking strategy as
well.

Pull Request: https://projects.blender.org/blender/blender/pulls/141866
2025-07-14 16:17:46 +02:00
Sebastian Parborg
a172b40d56 PointCache: Remove support for LZO and LZMA compression, use ZSTD
LZO and LZMA is only used for compressing point caches inside of
Blender. As we already use ZSTD for compressing other data in Blender it
makes sense to remove LZO and LZMA to simplify our library requirements
(and lessen our library maintenance burden).

I've talked to Sergey about this and he suggested that I leave the LZO/LZMA
libraries and code around but effectively disabled until beta, so if there is a
huge uproar, we can easily reinstate the support.

Pull Request: https://projects.blender.org/blender/blender/pulls/141461
2025-07-14 12:51:04 +02:00
Falk David
45ab790e80 Grease Pencil: Initialize runtime drawing user counts on read
This adds a function `GreasePencil::count_frame_users_for_drawings()`
that computes the drawing user counts from the layer frames. This is used
to correctly initialize the runtime drawing user counts when reading the ID.

Note that we don't expose any functionality to instance drawings currently.
This change is also in preparation for when this will be possible.

Also adds a function `GreasePencil::validate_drawing_user_counts()` that
compares the actual user counts with the runtime user counts that are
stored. Only runs these checks in debug builds.

Pull Request: https://projects.blender.org/blender/blender/pulls/141458
2025-07-14 11:44:57 +02:00
Omar Emara
62e0a9105a Fix #141864: Crash opening files with Alpha Over node
Blender will crash if a file with an Alpha Over node was saved in 4.4,
then in 4.5 alpha, then back to 4.4. This is because the node was
missing forward compatibility code that allocates storage that was
necessary for the file to load correctly on older versions.

This was essentially missed in b62ef2cdd6 and 976efdcac9.

Pull Request: https://projects.blender.org/blender/blender/pulls/141873
2025-07-14 09:31:41 +02:00
Pratik Borhade
07b070404a Fix: Grease Pencil: Problem removing last layer with attributes
Caused by 68759af516
Deleting first layer (i.e. last in the tree view), layer attribute values
of previous layers gets messed up due to wrong offset value when
copying attribute data

Pull Request: https://projects.blender.org/blender/blender/pulls/141772
2025-07-14 08:49:51 +02:00
Hans Goudey
14e2876b73 Core: Replace BLI_buffer.hh with blender::Vector
The C++ Vector container has the benefits of the older C type,
along with improved performance, better type and memory safety,
and significantly improved ergonomics.

Pull Request: https://projects.blender.org/blender/blender/pulls/141759
2025-07-13 17:13:59 +02:00
Campbell Barton
ec8751f826 Cleanup: white-space around C-style comment blocks
Also use C++ style comments for disabling code.
2025-07-13 21:58:53 +10:00
Habib Gahbiche
b35971ad08 Compositor: Rename "Z" to "Depth" in Z Combine Node
Node:
- Rename "Z Combine" node to "Depth Combine"

Sockets:
- First input "Image" -> "A"
- Second input "Image" -> "B"
- First Z -> "Depth A"
- Second Z -> "Depth B"
- Output Image -> "Result"
- Output Z -> "Depth"

This is a breaking change for the Python API

Pull Request: https://projects.blender.org/blender/blender/pulls/141676
2025-07-11 11:58:29 +02:00
Nathan Vegdahl
03332c514d Cleanup: Use prescribed symbol syntax in Path Template code comments
Specifically, #Symbol rather than `Symbol`, as documented in
https://developer.blender.org/docs/handbook/guidelines/c_cpp/#comments

This is a follow up to #139438

Pull Request: https://projects.blender.org/blender/blender/pulls/141775
2025-07-11 11:00:52 +02:00
Jesse Yurkovich
4de536c114 Cleanup: Remove unused includes of grease pencil legacy headers
Removes unnecessary usages of the following headers:
- BKE_gpencil_geom_legacy.h
- BKE_gpencil_legacy.h
- BKE_gpencil_modifier_legacy.h
- BKE_grease_pencil_legacy_convert.hh
- DNA_gpencil_legacy_types.h

Pull Request: https://projects.blender.org/blender/blender/pulls/141471
2025-07-11 05:01:57 +02:00
Hans Goudey
8f65cbd727 Cleanup: Use attribute API for dynamic paint color outputs 2025-07-10 22:18:06 +02:00
Hans Goudey
16aca719e2 Cleanup: Remove unnecessary includes in attributes files 2025-07-10 22:18:06 +02:00
Hans Goudey
2b86b32fc3 Fix: Avoid tagging geometry with uninitialized attribute on add
Mistake in 325ceabb09

Pull Request: https://projects.blender.org/blender/blender/pulls/141747
2025-07-10 19:05:00 +02:00
Sergey Sharybin
93be12fde0 ImBuf: Linearize float buffers from FFmpeg
Blender expects float buffers to be in scene linear space, which was
violated bu the 1012bit movie reading code. While such image buffers
can be displayed correctly, performing operations in various areas
of Blender might lead to unexpected results.

The non-linear colorspace for ImBuf is expected to be "internal-only"
to a specific area, like VSE.

This is only done for Image and MovieClip data-blocks, sequencer still
reads movie files in their original colorspace as it helps performance and
sequencer can not be referenced from places where linear colorspace
for float buffer is really important.

Pull Request: https://projects.blender.org/blender/blender/pulls/141603
2025-07-10 17:39:00 +02:00
Hans Goudey
fc253de467 Cleanup: Use attribute API for Multires unsubdivide index mapping 2025-07-10 16:17:05 +02:00
Hans Goudey
6304609cd8 Cleanup: Simplify vertex group data access in data transfer modifier 2025-07-10 16:17:05 +02:00
Hans Goudey
cec05ab440 Cleanup: Use mesh helper functions to access vertex group data 2025-07-10 16:17:05 +02:00
Hans Goudey
c21a98d76a Cleanup: Use references for CustomData arguments in data transfer 2025-07-10 16:17:05 +02:00
Hans Goudey
325ceabb09 Fix #141721: Adding curve attributes doesn't invalidate caches
In this report, adding the "resolution" attribute didn't clear the
evaluated positions cache. In some cases capturing an attribute on
the mesh might just add the mesh rather than using an attribute
writer.
2025-07-10 10:02:25 -04:00
Nathan Vegdahl
69433a181e Fix #141024: Normalize active vertex group properly
When manually setting a group's vertex weight, auto-normalization would
fail in some circumstances, such as when all other groups are locked.

The root cause of this issue was our approach for ensuring that the
weight specified by the user remained as-is when possible during
normalization. Rather than "when possible", it erroneously *always*
ensured the weight stayed as-is even when that made normalization
impossible. It came down to this:

1. Normalization is done as a post process, with no knowledge of what
   changes were just made to the weights.
2. In order to (try to) make up for that and ensure that the just-set
   weight remains as the user specified, the active group was
   temporarily locked during normalization, which could prevent
   normalization in some cases.

This PR fixes the issue by introducing a new internal-only concept of
"soft locked" vertex groups to the normalization functions, intended to
be used in exactly these cases where there are weights that have just
been set and we want to avoid altering them when possible. Soft-locked
groups are left untouched whenever normalization is achievable without
touching them, but are still modified if normalization can't be achieved
otherwise.

This has been implemented by introducing a new bool array alongside the
"locked" bool array in the core normalization functions.  Although all
uses in this PR only ever specify a single group as "soft locked", using
a bool array will make it easy to use this concept in other weight
painting tools in the future, which may modify more than one group at
once.

Pull Request: https://projects.blender.org/blender/blender/pulls/141045
2025-07-10 14:51:50 +02:00
Nathan Vegdahl
caddde1eb7 Refactor: Clean up and modernize core vertex weight normalize functions
- Add code documentation.
- Use Span and references rather than pointers everywhere.
- Move all core normalization logic into
  `BKE_defvert_normalize_lock_map()`, and have the other variants call
  that. This keeps all the logic in one place, which will help make
  future changes easier since they only need to be made in one place.
- Add unit tests for `BKE_defvert_normalize_lock_map()`.
- Refactor `vgroup_normalize_all()` to be clearer and avoid an
  unnecessary `goto`.
- Make both `vgroup_normalize_all()` and `paint_weight_gradient_exec()`
  only call into a single core vertex normalization function, rather
  than branching into one of many.

No functional change intended.
2025-07-10 14:51:49 +02:00
Campbell Barton
ad29066d9c Merge branch 'blender-v4.5-release' 2025-07-10 21:10:20 +10:00
Campbell Barton
841b3e9d81 Fix: avoid divide by zero in the "Stretch To" constraint
A zero scaled axis resulted in the matrix containing NAN values.
Use `safe_divide` to avoid this.

Ref !141654
2025-07-10 21:05:52 +10:00
Pratik Borhade
f4dbe20940 Fix: Grease Pencil: Assert duplicating layer with attributes
When duplicating a layer with layer attribute, caught an assert hit
at `attribute_to_writer()` due to size mismatch between attribute
domain (layers count) and attribute length.
Now fixed by moving `add_node()` prior to `foreach_attribute()`. This way,
extra node already added to runtime data and layer count is updated
inside `ensure_nodes_cache` with the next layers() call

Noticed it during review of !141090

Pull Request: https://projects.blender.org/blender/blender/pulls/141722
2025-07-10 12:13:30 +02:00
Campbell Barton
5dd160c39c Cleanup: indentation in cmake, sort files 2025-07-10 00:40:42 +00:00
Brecht Van Lommel
4653b65f7c Logging: Add DEBUG, TRACE severity, replace numeric levels
The numeric levels have no obvious meaning. This removes the distinction
between severity and levels, instead there is a single list of named levels
with defined meaning.

Debug means information that's mainly useful for developers, and trace is for
very verbose code execution tracing.

Pull Request: https://projects.blender.org/blender/blender/pulls/140244
2025-07-09 20:59:26 +02:00
Brecht Van Lommel
8d8e61fefd Logging: Change various categories and log levels
* Remove bke, ed and wm prefixes
* Add prefixes like: geom, object, blend, lib.
* Shorten some category names
* A few log level changes to improve --log-level info output

Pull Request: https://projects.blender.org/blender/blender/pulls/140244
2025-07-09 20:59:26 +02:00
Brecht Van Lommel
15d5f957ac Logging: Use CLOG for render progress
* Add render category, which is automatically enabled when using -f or -a
  command line flags for background rendering.
* Add extra logs to mention scene, view layer and frame ahead of time rather
  than including it in every line.
* Remaining time was removed from Cycles, this will be added back for animations
  at the render pipeline level.

Pull Request: https://projects.blender.org/blender/blender/pulls/140244
2025-07-09 20:59:26 +02:00
Brecht Van Lommel
9e0e860835 Logging: Redirect BKE_report prints to CLOG
For more consistent formatting of logs.

Pull Request: https://projects.blender.org/blender/blender/pulls/140244
2025-07-09 20:59:25 +02:00
Thomas Dinges
82f75f22ef Release: Bump 4.5 to release candidate 2025-07-09 12:56:08 +02:00
Lukas Tönne
bb293e5677 Regression test for armature deformation on lattice
This is a basic armature deformation test for #141535  using Lattices instead of
Mesh as the target object type. Lattice deformation was briefly broken, which is
caught by this test.

The test adds the general-purpose `unit_test_compare` function to lattice object
data. It only compares lattice point counts and positions for now, more data can
be added later if necessary.

The `MeshTest` class did not support lattice object types yet, so needed some
changes. The Curves case was already supported, but only by full conversion to
mesh data, without actually using the `unit_test_compare` function specific for
curves geometry. This is unchanged, because applying constructive modifiers on
curves does not work. If it were not for this limitation the test could do
actual curves comparisons now.

For lattice support the `MeshTest` class comparison function has been
generalized to all supported object data types. It runs the appropriate
`unit_test_compare` api function and validation where supported (only meshes at
this point).

Pull Request: https://projects.blender.org/blender/blender/pulls/141546
2025-07-09 09:53:00 +02:00
Campbell Barton
93ae46c68b Merge branch 'blender-v4.5-release' 2025-07-09 15:53:30 +10:00
Campbell Barton
35882493f4 Merge branch 'blender-v4.5-release' 2025-07-09 15:53:28 +10:00