Commit Graph

120055 Commits

Author SHA1 Message Date
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
Philipp Oeser
9077a26ba2 Fix #138265: Ctrl+shift+left click to Preview socket inconsistency
There are two implementations:

- "Link to Viewer Node"
-- when clicking on a socket directly, link from that socket [done by
first selecting and then taking that selection state into account]
-- otherwise cycles through available sockets
- "Connect to Output" [python operator, made core from Node Wrangler]
-- does not take socket selection into account
-- only cycles through available sockets

So goal is to replicate behavior of "Link to Viewer Node" in "Connect to
Output" in terms of "which socket to link from"

This is done by
- exposing a sockets select state to python
- tweaking the call to bpy.ops.node.select so it does socket selection
as well
- take that selection into account

Pull Request: https://projects.blender.org/blender/blender/pulls/138323
2025-05-11 09:52:16 +02:00
Campbell Barton
e51b4d5aa7 Cleanup: quiet GCC warnings mixing enum/non-enum types 2025-05-11 17:12:23 +10:00
Campbell Barton
5e75a9c1e8 Cleanup: spelling in comments 2025-05-11 17:00:47 +10:00
Jacques Lucke
127719fc87 Refactor: Nodes: decentralize detecting internal links
Previously, nodes which had their own special internal-links-behavior were
hardcoded in node tree update code. Now that is decentralized so that more nodes
can use this functionality without leaking special cases into general code.

Pull Request: https://projects.blender.org/blender/blender/pulls/138712
2025-05-11 05:23:43 +02:00
Jacques Lucke
19bfe03e54 Geometry Nodes: don't show error when using relative path in Import Nodes
Relative paths are supported, but the string input was showing an error.
This patch removes the error by tagging the string input as supporting relative files.
This feature was introduced recently in ab20edf469.

Pull Request: https://projects.blender.org/blender/blender/pulls/138707
2025-05-11 05:22:06 +02:00
Jacques Lucke
691a2be7f0 Nodes: improve frame label position
This changes two things:
* Take zone bounding box into account when computing frame dimensions.
* Move the label up a bit as it was too low before.

Pull Request: https://projects.blender.org/blender/blender/pulls/138705
2025-05-11 05:20:25 +02:00
Pratik Borhade
542f62f2c9 Fix: Outliner: Show NLA track count
Found this while reviewing !126839.
Right now icon is drawn for every nla track when collapsed. Similar to
other tree-elements, display total count of nla tracks.

Pull Request: https://projects.blender.org/blender/blender/pulls/138655
2025-05-11 03:37:19 +02:00
Harley Acheson
b2c4d71f1d Fix: Allow Duplication of Minimized Outliner
For as long back as I have tested (2.91) using "Duplicate Area into New
Window" for Outliner when minimized (showing only header) will result
in an invalid area - at least on Windows. The area may have have a
black background, invalid screen area verts, and has the header on the
bottom. This is because it is created in a window that is our minimum
size but initialized smaller, at the height of the area (0-2 pixels).
This PR just adds a small minimum to our blender window creation.

Pull Request: https://projects.blender.org/blender/blender/pulls/138696
2025-05-10 17:38:27 +02:00
Jacques Lucke
42431dcdd0 Cleanup: Nodes: remove unused group_update_func
Pull Request: https://projects.blender.org/blender/blender/pulls/138702
2025-05-10 08:37:17 +02:00
Jesse Yurkovich
2b4eb5ccfd Fix: USD: Don't attempt to export the special sharp_face attribute
While it hasn't seemed to affect anything currently, it's unnecessarily
wasteful in the resulting file and risky to be importing back in.

Pull Request: https://projects.blender.org/blender/blender/pulls/138699
2025-05-10 08:08:16 +02:00
Jacques Lucke
be489aa71a Cleanup: use C++ type for TransCustomDataNode 2025-05-10 05:03:59 +02:00
Jacques Lucke
bf696320f6 UI: support detecting good width for searchbox
Sometimes, the default size of the search box is not wide enough for the items
it shows. Currently, we sometimes hardcode an extra width factor and rely on
automatic name shortening with `...`. Both options are not ideal because they
are either often too wide or are hard to read with shortened names.

This patch implements an alternative solution. It adds a new function that
computes a good width for the search box based on its content. A certain minimum
and maximum width are still enforced.

Right now, this feature is only used in the Ctrl+F search in node editors, but I
guess it makes sense in most search boxes.

This also fixes #138641. While it's nice to have ways to use shorter search
terms, the search box should generally be able to deal with long items too.

Pull Request: https://projects.blender.org/blender/blender/pulls/138653
2025-05-10 04:48:30 +02:00