Commit Graph

119717 Commits

Author SHA1 Message Date
Philipp Oeser
e951ea250a Fix #138727: Crash translating a strip without an active strip
Caused by 12f5ce7c85

Simple NULL check to prevent accesing non-existing act_strip

Pull Request: https://projects.blender.org/blender/blender/pulls/138753
2025-05-13 09:13:28 +02:00
Martin-Vignali
ca6571383a FFmpeg: Use Gray8 when rendering black and white with Quicktime Qtrle and Png
Also be more explicit about RGB pixel format
(instead of trusting first encoder pixel format)
File have been tested with After Effects CC 2025, and load as expected.

Co-authored-by: Jokyo <jokyo@MacBook-Pro-de-Jokyo-2019.local>
Pull Request: https://projects.blender.org/blender/blender/pulls/138601
2025-05-13 08:55:26 +02:00
Jacques Lucke
c2c61ce8c5 Cleanup: Nodes: decentralize node specific rna struct generation
Instead of calling all of these functions from `RNA_def_nodetree`, call them
from their respective node callbacks. This didn't work a few months ago, because
these callbacks did not have the `brna` argument back then.

Pull Request: https://projects.blender.org/blender/blender/pulls/138798
2025-05-13 08:19:30 +02:00
Endor H
309ce182b8 Nodes: Allow dragging Group Inputs from the panel into the nodes editor
This patch adds support for creating Group Input nodes by dragging input sockets
and panels from the group interface tree-view in the side bar. This
significantly simplifies creating a Group Input node for a specific input when
there are lots of them.

These cases are supported:
* Dragging an input socket creates a Group Input node just for that socket.
* Dragging a panel without panel-toggle creates a Group Input node containing
  all sockets in the panel.
* Dragging a panel with panel-toggle creates a Group Input for the panel-toggle.
* Dragging a panel with panel-toggle while holding Ctrl creates a Group Input
  with the panel-toggle and all sockets in the panel.

This is supported in all node tree types.

Pull Request: https://projects.blender.org/blender/blender/pulls/137739
2025-05-13 07:17:48 +02:00
Jacques Lucke
23d5ae7da5 Refactor: Nodes: decentralize node storage blend read/write
Previously, whenever a node had a non-trivial storage struct, there would have
to be code for it in `node.cc`. Now there is a general callback that new node
types can use to implement their blend read/write behavior.

Some existing nodes were converted to use this decentralized method. However,
some older nodes can't use it in the same way, because the node types were
introduced before there were node idnames. It's also somewhat hard to reason
about special cases that versioning code might have for these nodes, so they
remain unchanged.

The node callback only writes the non-trivial data, while the main node storage
struct is written automatically by relying on `bNodeType::storagename`. This
simplifies the callback in many cases or makes it unnecessary for trivial types.

Some nodes have specific handling for forward-compatibility. This
forward-compatibility code is kept in `node.cc` for now, because it also affects
the main storage struct and therefore has to be changed before that struct is
written.

Pull Request: https://projects.blender.org/blender/blender/pulls/138722
2025-05-13 07:00:03 +02:00
Jacques Lucke
1d99f6e7a9 Cleanup: Geometry Nodes: simplify accessing node group input index
This is the same approach as used in the Geometry Nodes modifier.
2025-05-13 05:48:49 +02:00
Jacques Lucke
f1aebcb353 Cleanup: Geometry Nodes: extract draw context struct for node group operator
This simplifies passing all these arguments recursively when panels are supported.
2025-05-13 05:44:24 +02:00
Jacques Lucke
d81a6e4a7b Cleanup: Geometry Nodes: wrong name in node group operator
This was likely copied from the Geometry Nodes modifier.
2025-05-13 05:34:40 +02:00
Jacques Lucke
1e071603a2 Cleanup: Geometry Nodes: simplify property name escaping 2025-05-13 05:31:01 +02:00
Hans Goudey
9edd645638 Fix #138790: Crash applying empty geometry node modifier on point cloud
Copying the point cloud is basically free in the scheme of things.
Better to do that than check if the output point cloud is the same.
2025-05-12 23:25:29 -04:00
Campbell Barton
b6b43339ef Cleanup: format 2025-05-13 13:21:10 +10:00
Jason C. Wenger
ae5b83e4ef Refactor: Nodes: frame node drawing
Removes an inconsistency where sometimes `bke::node_label` is used and sometimes
`node.label` to get the frame label.

Consolidates several duplicated formulas for computing the frame layout into a
single function.

Pull Request: https://projects.blender.org/blender/blender/pulls/138035
2025-05-13 05:17:09 +02:00
Campbell Barton
d859425cb3 Cleanup: differentiate object mode viewport selection types
For local struct types "Mesh" was used for both edit-mesh and
object-modes.

- Use "MeshObject" non edit-mesh selection (vertex paint selection).
- Use "Mesh" for edit-mesh types.

This follows existing naming convention: `do_lasso_select_meshobject`
for e.g.
2025-05-13 13:08:28 +10:00
Jacques Lucke
87f0ab292f Geometry Nodes: support menu type in Menu Switch node
Previously, it was not possible to switch a menu based on another menu. This
patch adds support for this.

Usually, menu sockets are drawn without the label in nodes currently. Now there
is one exception: the Menu Switch node when it switches another menu. If the
label is not shown, the UI is missing crucial information.

Pull Request: https://projects.blender.org/blender/blender/pulls/138704
2025-05-13 04:57:19 +02:00
Jacques Lucke
61e99ca667 Geometry Nodes: improve muted behavior of switch nodes
Previously, Switch node were using the fallback behavior when they were muted.
That implied that the generated internal link was generally not very useful.
This patch makes the behavior of muted switch nodes explicit. Now the internal
link will always point to the first value input and never to the condition
input. Note, for the Menu Switch node this does not make a difference yet,
because menu sockets are not supported there yet (#138704).

Pull Request: https://projects.blender.org/blender/blender/pulls/138724
2025-05-13 04:54:54 +02:00
Campbell Barton
2f2eb6468b Cleanup: add missing break statement 2025-05-13 12:31:16 +10:00
Hans Goudey
8f5952f4c1 Cleanup: Formatting 2025-05-12 22:18:01 -04:00
Hans Goudey
f83830409e Cleanup: Remove outdated todo comment
There isn't really a reason why the sculpt and BLI
BVH trees have to have the same threading threshold.
2025-05-12 21:54:04 -04:00
Campbell Barton
7554126109 Fix: missing null check on Curve::str before freeing 2025-05-13 11:47:44 +10:00
Campbell Barton
094104651f Fix: crash if Curve::str was null when entering edit-mode
This is checked for null elsewhere, check on entering edit-mode too.
2025-05-13 11:32:23 +10:00
Campbell Barton
9deea7677f Cleanup: use doxygen doc-strings, correct file references in UI headers
Also move implementation note from doc-string into the body of the
function.
2025-05-13 11:14:27 +10:00
Campbell Barton
011de28348 Fix #138730: Crash setting 3D texts font to None
Regression in [0] caused a null pointer dereference.

[0]: 2336b7c6f8
2025-05-13 10:48:37 +10:00
Campbell Barton
64a43fff20 Fix #138652: Crash editing an ID name after undo
Regression in [0] which missed updating the old-buttons data,
causing it to reference freed Main & ID pointers after undo.

Apply the same fix for uiBut::pushed_state_func.

[0]: 3e03576b09
2025-05-13 09:48:11 +10:00
Hans Goudey
a86873f251 Cleanup: Fix custom data type categories in attribute type conversion 2025-05-12 19:28:32 -04:00
Harley Acheson
87dcf4907a UI: Add Hide to Properties NavBar Item Context Menu
Add an item to hide the NavBar to the Context Menu for the items on the
NavBar.

Pull Request: https://projects.blender.org/blender/blender/pulls/138786
2025-05-13 00:57:10 +02:00
Sean Kim
8fdaa555e8 Sculpt: Use capability check for dyntopo panel options
Prior to this commit, the Dyntopo panel was hardcoded to display as
faded if the current brush was the mask brush. This conflicts with the
common set of brushes which we do not support dyntopo for, which
includes many other brushes.

This commit changes the check to better indicate that certain brushes do
not support dyntopo. The scene-level settings can still be changed & the
detail flood fill operator remains functional even if the a different
brush is selected.

Additionally, the panel is no longer greyed out if the "Manual" option is
active.

Pull Request: https://projects.blender.org/blender/blender/pulls/138634
2025-05-12 23:19:01 +02:00
Hans Goudey
f2327a956b Cleanup: Remove disabled code
This only makes this function even more difficult to understand.
2025-05-12 16:38:14 -04:00
Guillermo Venegas
a017a6cc54 Refactor: UI: Replace uiItemO with class method uiLayout::op
This converts the public `uiItemO` function to an object oriented
API (`uiLayout::op`).
Also this rearranges `idname` paramether, since this the only one
required, and to make format similar to `uiItemFullO`

Note: One of the benefits of moving from a public function to class
method is to reduce API usage difference between C++ and Python. In
Python this method is called `UILayout::operator`, however `operator`
is a reserved keyword in C++.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/138776
2025-05-12 22:14:38 +02:00
Hans Goudey
93be6baa9c Refactor: Remove domain from draw attribute request struct
Similar to b21cb20eeb.
This time the domain is removed. The idea is that the domain doesn't
change anything about how the attribute is stored on the vertex buffers
so it doesn't make sense as part of the request. If we continue that
logic to also remove the data type, we can avoid searching through the
geometry when creating the requests, instead handling invalid requests
when creating the buffers.

The complexity of the change comes from the fact that the request's
domain was used to determine whether the Curves drawing code needed to
interpolate the attribute to the evaluated points. This is now stored
separately in the curves cache. The change in the sculpt code is also
non-trivial since we delay more of the logic until after we have
looked up the attribute from the geometry.

Pull Request: https://projects.blender.org/blender/blender/pulls/138619
2025-05-12 21:16:15 +02:00
Miguel Pozo
c16aba915f GPU: Add GPU_shader_batch_cancel
Fix the recently implemented ShaderCompiler::batch_cancel.
Expose it with GPU_shader_batch_cancel and
GPU_shader_specialization_batch_cancel.
Use them in the EEVEE ShaderModule destructor, to prevent blocking on
destruction when there are in-flight compilations.

Pull Request: https://projects.blender.org/blender/blender/pulls/138774
2025-05-12 19:54:03 +02:00
Miguel Pozo
ee5185b287 Fix: Workbench: Image Render AA
Regression from 66796ef9d4.
taa_finished is only true after the last sample.
2025-05-12 18:58:00 +02:00
Sergey Sharybin
3c8138cdc5 Cleanup: Unused variable warning 2025-05-12 17:54:19 +02:00
Clément Foucault
91dcea8efc Fix: UI: Invalid scissors in interface drawing
These were causing asserts on Metal.

Pull Request: https://projects.blender.org/blender/blender/pulls/138684
2025-05-12 17:49:16 +02:00
Mattias Fredriksson
d0cf7dd8b5 Fix: Improve OBJ NURBS IO, support exporting custom knots
Corrects behavior with NURBS knot values in .obj exporter. Knot values
denoting the curve parameter range and values at the boundary region
in the span ends had hardcoded knot values. It also implemented its own
knot calculation, which is not ideal...

Importer is updated to not try to second guess the knot values.
Not entirely sure what it was trying to do but it used wrong indices
and missed writing the end of the knot vector. Combined the changes
should make it possible to import and export a simple NURBS curve with
custom knots and leaving it intact.

This replaces some of the erronous behavior using functions from [new]
Curves implementation. Mixing new and legacy curve implementation is not
ideal but exporter is exporting POLY curves as NURBS while legacy method
does not support computing the knot vector. To avoid introducing
additional branch cases nor update legacy functions, using the new
functions seems to be the correct choice. These functions should be
functionally equivalent but is not identical (e.g. legacy curve returns
knots in [0, 1] range). It should also make it easier to transition to
exporting new Curves.

Pull Request: https://projects.blender.org/blender/blender/pulls/138732
2025-05-12 16:51:21 +02:00
Jacques Lucke
dd47ee9e25 Nodes: show warning when a group output is unused
There are very rare use-cases for having multiple Group Output nodes. However,
it's something that's been supported for a long time and removing it may be a
regression for some. In practice, it's usually a mistake when someone has
multiple Group Output nodes.

This patch adds a simple warning on inactive Group Output nodes to help the user
notice this case.

Pull Request: https://projects.blender.org/blender/blender/pulls/138743
2025-05-12 16:13:57 +02:00
Jeroen Bakker
542e7bb8e7 Compositor: Add GPU debug groups
This PR adds debug groups to improve using GPU tools like debuggers
and profilers. It will try to use the node type as debug group name when
available.

Pull Request: https://projects.blender.org/blender/blender/pulls/138768
2025-05-12 15:45:45 +02:00
YimingWu
f091195480 Fix: Grease Pencil: Prevent infinite drawing when doing separate pass
Previously if a scene has Grease Pencil objects that are drawn in-front
and objects that are not, Grease Pencil drawing sorting call would
concat those two drawing lists into one. Since "separate pass" rendering
will call Grease Pencil drawing again, this list was concatenated twice,
resulting in a looped list which goes on indefinitely when iterated.
Now Grease Pencil will only sort once per drawing instance.

Thanks to @antonioya and @mmendio for testing and reporting!

Pull Request: https://projects.blender.org/blender/blender/pulls/138528
2025-05-12 15:41:15 +02:00
Jeroen Bakker
624b52efdd Vulkan: Add debug info for pipeline caches 2025-05-12 15:00:51 +02:00
Hans Goudey
51ed527ab9 Fix #138718: Node tools crash on mesh with vertex groups
Caused by 0b891a68b1.
That commit didn't handle vertex groups correctly. They're provided by
the attribute API as "virtual" attributes that aren't backed by
individual custom data layers like "real" generic attributes, so they
don't have sharing info. Hopefully in the future this situation will be
improved, but in the meantime it's best to just just handle them more
explicitly.

Pull Request: https://projects.blender.org/blender/blender/pulls/138719
2025-05-12 14:56:51 +02:00
Jacques Lucke
f7c890e32f Cleanup: Nodes: remove stored static sdna type
Since 9fd7a093c9 this id can be derived automatically from the corresponding C++ type.

Pull Request: https://projects.blender.org/blender/blender/pulls/138760
2025-05-12 13:55:09 +02:00
Lukas Tönne
11ceddb9df New Grid Info node for reading grid transforms and background value
These are generic properties of grids (not stored in voxels) which are
useful to know in geometry nodes. The transform in particular defines
the voxel size. Background value is used outside of active voxels.

Pull Request: https://projects.blender.org/blender/blender/pulls/138592
2025-05-12 13:46:40 +02:00
Jeroen Bakker
800e2cdde1 Refactor: Vulkan: Use hash function
Specialization constants hash used get_default_hash. This replaces it
with a regular hash function.

Pull Request: https://projects.blender.org/blender/blender/pulls/138766
2025-05-12 13:33:50 +02:00
Omar Emara
17db65dfd0 Compositor: Remove Gamma from Blur and Defocus nodes
This patch removes the Gamma option from the Defocus and Blur nodes. The
reasoning is as follows.

- The option was originally added when the compositor wasn't working on
  a strictly linear workflow. So this is rarely needed now.
- It is easy to insert a Gamma node around Blur nodes to perform any
  gamma correction if really needed.
- Since we are moving options to inputs, it doesn't seem worth it to
  provide this option as an input in the process.

Pull Request: https://projects.blender.org/blender/blender/pulls/138673
2025-05-12 13:18:46 +02:00
Omar Emara
c33c93f886 Compositor: Use node discovery for node registration
This patch uses the add_node_discovery node registration mechanism
already used by Geometry and Function nodes. This is done to reduce the
number of places needed to add a new node.

Pull Request: https://projects.blender.org/blender/blender/pulls/138755
2025-05-12 12:50:38 +02:00
Philipp Oeser
df98fbe91b Fix #138613: Template Paths not resolved when using ALT+Click in Output
To resolve, add path template handling to `BUTTONS_OT_file_browse` /
`BUTTONS_OT_directory_browse`.

Pull Request: https://projects.blender.org/blender/blender/pulls/138674
2025-05-12 12:47:49 +02:00
Philipp Oeser
e7b630e6ef Fix #138669: Face dots visible outside Clipped Region
Was missing call to `view_clipping_distances`

Pull Request: https://projects.blender.org/blender/blender/pulls/138672
2025-05-12 11:19:19 +02:00
Jacques Lucke
9fd7a093c9 DNA: support getting sdna id for static DNA type
This adds a new `DNA_sdna_type_ids.hh` header:
```cpp
namespace blender::dna {

/**
 * Each DNA struct has an integer identifier which is unique within a specific
 * Blender build, but not necessarily across different builds. The identifier
 * can be used to index into `SDNA.structs`.
 */
template<typename T> int sdna_struct_id_get();

/**
 * The maximum identifier that will be returned by #sdna_struct_id_get in this
 * Blender build.
 */
int sdna_struct_id_get_max();

}  // namespace blender::dna
```

The `sdna_struct_id_get` function is used as replacement of
`SDNA_TYPE_FROM_STRUCT` in all places except the DNA defaults system. The
defaults system is C code and therefore can't use the template. There is ongoing
work to replace the defaults system as well though: #134531.

Using this templated function has some benefits over the old approach:
* No need to rely on macros.
* Can use type inferencing in functions like `BLO_write_struct` which avoids
  redundancy on the call site. E.g. `BLO_write_struct(writer, ActionStrip,
  strip);` can become `BLO_write_struct(writer, strip);` which could even become
  `writer.write_struct(strip);`. None of that is implemented as part of this
  patch though.
* No need to include the generated `dna_type_offsets.h` file which contains a
  huge enum.

Implementation wise, this is done using explicit template instantiations in a
new file generated by `makesdna.cc`: `dna_struct_ids.cc`. The generated file
looks like so:
```cpp
namespace blender::dna {

template<typename T> int sdna_struct_id_get();

int sdna_struct_id_get_max();
int sdna_struct_id_get_max() { return 951; }

}
struct IDPropertyUIData;
template<> int blender:🧬:sdna_struct_id_get<IDPropertyUIData>() { return 1; }
struct IDPropertyUIDataEnumItem;
template<> int blender:🧬:sdna_struct_id_get<IDPropertyUIDataEnumItem>() { return 2; }
```

I tried using static variables instead of separate functions, but I didn't
manage to link it properly. Not quite sure yet if that's an actual limitation or
if I was just missing something.

Pull Request: https://projects.blender.org/blender/blender/pulls/138706
2025-05-12 11:16:26 +02:00
Aras Pranckevicius
a96ecd2834 Fix #137768: new FBX importer does not import some animations correctly
- FBX "root bone" should become the Armature object itself, and not
  an extra bone (follow same logic as Python importer did).
- "World to armature matrix" was not correct for armatures that are
  parented under some other objects with transforms.
- Parenting imported meshes under an Armature was not taking into
  account that the mesh bind transform might not be the same as the
  current mesh node transform (i.e. was not setting "matrix parent
  inverse" to compensate like the Python importer did).
- The repro file in #137768 also exposed an issue that importing custom
  vertex normals was not working correctly in the new importer, when
  mesh is partially invalid (validation alters the mesh, custom normals
  have to be set afterwards).

Pull Request: https://projects.blender.org/blender/blender/pulls/138736
2025-05-12 10:56:07 +02:00
Christoph Lendenfeld
6a31554394 Anim: add extra poll checks to bone eyedropper
It was unclear when the bone eyedropper could be used
since it stayed active even though it would be impossible to pick something.

The limitation is that an armature has to be in pose or edit mode to pick from.
Since that is the case we can check in the poll function if the active
object is an armature and if that armature is either in pose or edit mode.

Follow up to: #138182

Pull Request: https://projects.blender.org/blender/blender/pulls/138498
2025-05-12 10:49:14 +02:00
Jacques Lucke
ddbd880fa9 Fix: Nodes: missing update after activating different group output 2025-05-12 04:37:52 +02:00