Commit Graph

119672 Commits

Author SHA1 Message Date
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
Hans Goudey
d68cd0c1fe Refactor: Use attribute API to convert between mesh and point cloud
Besides not using CustomData directly which allows future changes,
this should result in proper conversion of vertex groups to generic
point cloud attributes.
2025-05-09 22:47:26 -04:00
Jacques Lucke
1e23f9235c Nodes: highlight frame that nodes will be attached to
Previously, it was somewhat difficult to know if a dragged node will be attached
to a frame or not. This patch highlights the frame that dragged nodes will be
attached to which removes the guesswork. This is similar to how we highlight the
link that a dragged node will be inserted onto.

Pull Request: https://projects.blender.org/blender/blender/pulls/138648
2025-05-10 04:44:23 +02:00
Hans Goudey
4c1ae9454a Point Cloud: Simplify creating data-block without attributes
Remove the addition of the position attribute from the default
"init data" callback where we don't know the desired number
of points. Add it in the other functions that add the data-block
(except the version that purposefully doesn't add attributes).

Pull Request: https://projects.blender.org/blender/blender/pulls/138697
2025-05-10 04:37:43 +02:00
Jacques Lucke
99a2589217 Nodes: use alternating frame colors
Previously, nested frames were very hard to see and therefore to work with. This
patch solves this by alternating between two different frame colors depending on
the nesting depth.

Custom colors can still be used like before. There is still a single theme
option. The alternating color is derived from that.

Pull Request: https://projects.blender.org/blender/blender/pulls/138649
2025-05-10 04:37:21 +02:00
Guillermo Venegas
858abf43c3 Refactor: UI: Replace uiItemFullR with class method uiLayout::prop
This converts the public `uiItemFullR` function to an object oriented
API (an overload of `uiLayout::prop`), matching the python API.
This reduces the difference between the C++ API with the python version,
its also helps while converting code from python to C++ code (or vice-versa),
making it almost seamless.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/138683
2025-05-10 03:39:31 +02:00
Harley Acheson
c9e7136161 UI: Turn Off Ability to Drag Properties NavBar Away
The Properties NavBar region can be resized by dragging an edge, but
this only allows either normal width or hidden. The edge is along the
line of category tabs and it is extremely easy to hide the region
rather than select a tab. This PR remove the ability to drag the edge,
but adds a "Hide" option to the region's context menu. It also leaves
the triangular disclosure widget visible while hidden so that it can
be shown again.

Pull Request: https://projects.blender.org/blender/blender/pulls/138628
2025-05-10 02:53:56 +02:00
Harley Acheson
836247a146 UI: Allow Disabling Ortho Axes Lines
While in 3D View Perspective Mode you are able to disable the Floor
and/or the XYZ axis lines. But in Orthographic views turning off the
axes lines has no effect, but turning off the grid also turns off the
lines. This PR just makes these work independently, as you'd expect
from the options in Viewport Overlays.

Pull Request: https://projects.blender.org/blender/blender/pulls/138694
2025-05-10 02:34:23 +02:00
Hans Goudey
578df47c8d Refactor: Avoid using CustomData directly for PointCloud RNA
Part of #122398.

Pull Request: https://projects.blender.org/blender/blender/pulls/138686
2025-05-10 02:24:42 +02:00
Hans Goudey
8ac48880e7 Point Cloud: Move "Random" default primitive creation to operator
Previously all new point clouds created in the main database would
have the random 400 points. Now that's only the point cloud created
from the add menu.

Similar to f98d74c80d.

Pull Request: https://projects.blender.org/blender/blender/pulls/138685
2025-05-10 02:24:18 +02:00
Sergey Sharybin
cd70b9d730 Fix #138637: EXR Sequencer preview is broken
The issue was caused by the shader always applying exposure even if
it is 1. When the input image had negative values this lead to nan
values to the input of the shader which converts to the display
space.

Solved by only doing to-scene-linear transform in the shader which
does this.

Caused by 18110744a2

Pull Request: https://projects.blender.org/blender/blender/pulls/138666
2025-05-09 23:20:35 +02:00
Harley Acheson
2d72475d62 Fix #138661: Ensure Correct SubType After Stacked Fullscreen
Going from fullscreen to temporary fullscreen (usually file browser),
and back, is AREA_FLAG_STACKED_FULLSCREEN. In this case we need to
ensure that we restore the last-used area subtype and not just the zero
base type.

Pull Request: https://projects.blender.org/blender/blender/pulls/138682
2025-05-09 20:51:38 +02:00
Brecht Van Lommel
5697918905 Cleanup: Compiler warning 2025-05-09 19:10:14 +02:00
Habib Gahbiche
58ebe99d9d Fix: Compositor: Incorrect viewer is activated
In some cases, multiple viewers can be active and the active viewer is
not the desired one. This is only a problem for the compositor

The fix has two parts:
1. Tag the node tree as changed after the output changes. This solves
 the issue of two viewers being active at the same time
2. Deactivate all other viewers before activating the desired viewer
node (similar to how `NODE_OT_activate_viewer()` works). This ensures
that the only active viewer is the one that the user just set.

Pull Request: https://projects.blender.org/blender/blender/pulls/138671
2025-05-09 18:07:05 +02:00
Hans Goudey
bb8719030d Geometry: Initial replacement of CustomData with AttributeStorage
As described in #122398, implement read and write support for a new
attribute storage system. Currently this is only implemented to support
forward compatibility; the format used at runtime isn't changed at all.
That can be done one step at a time during the 4.5 and 5.0 development
cycles. A new experimental option for testing tells Blender to always
save with the new format.

The main benefit of the new structure is that it matches the attribute
system design, it allows for future attribute storage optimization, and
each attribute is an allocated struct, which will give pointer stability
for the Python API.

The next step is to connect the attribute API and the RNA API to
AttributeStorage for the simplest geometry type, point clouds.

Pull Request: https://projects.blender.org/blender/blender/pulls/133874
2025-05-09 17:27:07 +02:00
Sergey Sharybin
9d4b236d13 Fix: Class memory access on the color management tear-down
Pull Request: https://projects.blender.org/blender/blender/pulls/138670
2025-05-09 16:22:57 +02:00
Jacques Lucke
d9b91c73e3 Core: use template for BKE_id_new
This is the same change as e09ccc9b35 but for `BKE_id_new`.

Pull Request: https://projects.blender.org/blender/blender/pulls/138667
2025-05-09 16:13:25 +02:00
Omar Emara
a84de8067b Compositor: Remove Offset from Scale node
This patch removes the translation Offset from the Scale node. The
reasoning is that it is easy to insert a Translate node afterwards to
perform any necessary translation. And since we are moving options to
inputs, it doesn't seem worth it to provide those offsets as inputs in
the process.

Pull Request: https://projects.blender.org/blender/blender/pulls/138668
2025-05-09 15:46:41 +02:00
Omar Emara
fd3ca68b5e Compositor: Turn Bokeh Blur options to inputs
This patch turns the options of the Bokeh Blur node into inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/138664
2025-05-09 14:15:14 +02:00
Sergey Sharybin
8a6951a986 Cleanup: Use Blender::Mutex in OpenColorIO integration 2025-05-09 14:05:04 +02:00
Sergey Sharybin
7ceb4495c5 Refactor: OpenColorIO integration
Briefly about this change:
- OpenColorIO C-API is removed.
- The information about color spaces in ImBuf module is removed.
  It was stored in global ListBase in colormanagement.cc.
- Both OpenColorIO and fallback implementation supports GPU drawing.
- Fallback implementation supports white point, RGB curves, etc.
- Removed check for support of GPU drawing in IMB.

Historically it was implemented in a separate library with C-API, this
is because way back C++ code needed to stay in intern. This causes all
sort of overheads, and even calls that are strictly considered bad
level.

This change moves OpenColorIO integration into a module within imbuf,
next to movie, and next to IMB_colormanagement which is the main user
of it. This allows to avoid copy of color spaces, displays, views etc
in the ImBuf: they were used to help quickly querying information to
be shown on the interface. With this change it can be stored in the
same data structures as what is used by the OpenColorIO integration.
While it might not be fully avoiding duplication it is now less, and
there is no need in the user code to maintain the copies.

In a lot of cases this change also avoids allocations done per access
to the OpenColorIO. For example, it is not needed anymore to allocate
image descriptor in a heap.

The bigger user-visible change is that the fallback implementation now
supports GLSL drawing, with the whole list of supported features, such
as curve mapping and white point. This should help simplifying code
which relies on color space conversion on GPU: there is no need to
figure out fallback solution in such cases. The only case when drawing
will not work is when there is some actual bug, or driver issue, and
shader has failed to compile.

The change avoids having an opaque type for color space, and instead
uses forward declaration. It is a bit verbose on declaration, but helps
avoiding unsafe type-casts. There are ways to solve this in the future,
like having a header for forward declaration, or to flatten the name
space a bit.

There should be no user-level changes under normal operation.
When building without OpenColorIO or the configuration has a typo or
is missing a fuller set of color management tools is applies (such as the
white point correction).

Pull Request: https://projects.blender.org/blender/blender/pulls/138433
2025-05-09 14:01:43 +02:00
Jeroen Bakker
40af2b7be4 Vulkan: Add debug name for pipeline layouts 2025-05-09 13:40:46 +02:00
Jacques Lucke
4acd6d46d4 UI: rename Tooltip Label to Quick Tooltip
Change the mentions of "tooltip label" to "quick tooltip" to make this feature more
universally useful. The new name was suggested in #138583.

Pull Request: https://projects.blender.org/blender/blender/pulls/138639
2025-05-09 13:34:35 +02:00
Omar Emara
f3275f5d12 Compositor: Remove Max Blur option from Bokeh Blur node
This patch removes the Max Blur option from the Bokeh Blur node. The
reasoning is as follows.

- The option was unused in case of non-variable sized blur, which was
  the default, so the option did nothing for the default case of the
  node.
- The option was originally introduced to define the search window of
  variable size blur. This is no longer the case, since we compute the
  search window dynamically from the input using parallel reduction,
  which is now very fast. So currently, it only works as an upper limit.
- The node options will be exposed as inputs, so the user will see two
  inputs that control the radius, which can be confusing for users that
  are not experienced.
- The plan is to make the node take absolute pixel sizes in the future,
  instead of the arbitrary relative size now in place, which would make
  it very easy for the user to impose such limits manually.

It is difficult to version this change, since the size is relative to
the image size, while max blur is in pixels. But we assume the user
chose a sufficiently large max blur for the node to be useful, so the
composite should not be expected to be drastically different.

Pull Request: https://projects.blender.org/blender/blender/pulls/138659
2025-05-09 12:47:27 +02:00
Nathan Vegdahl
0b97a13eaa Cleanup: Use libfmt functions in path template code
The use of `sprintf()` was causing compiler warnings on Apple's version
of Clang. This replaces those uses with `fmt::format_to_n()` from
libfmt, which is safer and silences those warnings.

Additionally, the format string given to `printf()` in debugging
functions for the path template unit tests was also causing warnings due
to type mismatch (long long vs long). This replaces those with
`fmt::print()`, which infers the correct type on its own, silencing
those warnings.

Pull Request: https://projects.blender.org/blender/blender/pulls/138660
2025-05-09 12:45:52 +02:00
Sergey Sharybin
191f395cac Fix: Dead-lock when opening image from the Image compositor node
An oversight in the #138551
2025-05-09 11:55:53 +02:00
Pratik Borhade
3b1b05ded8 UI: Outliner: Show Grease Pencil vertex groups
GP vertex group been missing in outliner. It seems we just need to adjust
the condition to include them.

Pull Request: https://projects.blender.org/blender/blender/pulls/138474
2025-05-09 11:53:48 +02:00
Jacques Lucke
eea2c6b00b Fix: Nodes: missing name escaping when constructing RNA paths
This also adds a version of `BLI_str_escape` that returns an std::string,
because it's much easier to use in C++ code.
2025-05-09 11:09:00 +02:00
Jesse Yurkovich
eb82c4edf1 Format: use fmt::format correctly with runtime format strings
Starting with C++20, `fmt::format` will process the format string at
compile time by default. We need to opt out in the cases where this is
not possible by using `fmt::runtime(...)`, like, for example, when using
our various translation utilities.

This mirrors prior commit e62aa986b2 and
fixes 2 cases that have slipped back in.

Pull Request: https://projects.blender.org/blender/blender/pulls/138640
2025-05-09 06:43:48 +02:00
Jacques Lucke
efefb16d4b Nodes: draw frame outline over zone backgrounds
Previously, the outline of frames was sometimes unexpectedly invisible.
The solution is to draw the frame outlines together with the zone outlines
after all the zone and frame backgrounds have been drawn already.

Pull Request: https://projects.blender.org/blender/blender/pulls/138645
2025-05-09 05:47:30 +02:00
Campbell Barton
cab63d272c Cleanup: rename str_len to str_maxncpy
By convention str_len excludes the nil terminator.

Also assert the increment is a single unit as larger numbers aren't
supported (or needed currently).
2025-05-09 12:34:41 +10:00
Campbell Barton
2cd2f2ea4d Cleanup: quiet missing parenthesis & unused function warnings 2025-05-09 02:13:33 +00:00
Jacques Lucke
a03d0fd512 Nodes: show node errors tooltip faster
The idea here is to use `UI_but_func_tooltip_label_set` which has a shorter
duration until the tooltip shows (besides also being easier to use). It does
seem like it makes sense to use it here, because the only purpose of the error
icon is to hover over it. Therefore, one shouldn't have to wait for long until
the tooltip shows.

Pull Request: https://projects.blender.org/blender/blender/pulls/138583
2025-05-09 04:07:54 +02:00
Jacques Lucke
4a760c1a70 Nodes: show link errors directly on link
Previously, we had shown link errors on the target node as part of the node
warning system. While better than not showing any information about invalid
links (as was the state before that), it's still not ideal because it's easy to
miss when just looking at the link.

This patch adds an error icon in the middle of the invalid link. When hovering
over it, it shows the error text. When the middle of the link is not in view but
part of the link is, then the error icon will also stay visible.

Pull Request: https://projects.blender.org/blender/blender/pulls/138529
2025-05-09 04:06:00 +02:00