Commit Graph

120055 Commits

Author SHA1 Message Date
Clément Foucault
c0f191f580 GPU: Make polylines vertex shader use C++ shader compilation
_No response_

Pull Request: https://projects.blender.org/blender/blender/pulls/138411
2025-05-05 00:44:34 +02:00
Mattias Fredriksson
8d06479d24 Fix #137057: Sample Single Point Curves
Fixes behavior for #137057 when sampling single point curves.
Previous behavior just checked the evaluated length cache size and
called fill_invalid(), it will now fill using the point value and terminate.

Pull Request: https://projects.blender.org/blender/blender/pulls/138153
2025-05-04 16:31:58 +02:00
илья _
aa2ca33da2 Fix #137064: Nodes: Some nodes have a blank header when no datablock is selected
Similar to Mix node in #135535, some nodes did not properly implement a
callback to provide a UI node name.

Pull Request: https://projects.blender.org/blender/blender/pulls/137065
2025-05-04 11:37:07 +02:00
Jacques Lucke
5dd37abfbf Fix: Nodes: new empty frame node is always at origin
Now, when a new frame node is added while no node is selected,
it will be added at the cursor.
2025-05-04 09:40:22 +02:00
YimingWu
884ef238c0 Fix #136397: Line Art: Skip dupli objects with include_objects
Previously to handle unevaluated objects in line art "load all"
iteration, a `include_objects` variable is added in depsgraph
iteration settings, and this was only processed by object iterator
but not for any of the dupli objects. Now `make_duplis_collection`
will also handle `include_objects`

The only case where this border case can lead to crash is that a
line art grease pencil object is inside one of the dupli collection,
which isn't a valid use in the first place. But this fix makes it
more robust.

Pull Request: https://projects.blender.org/blender/blender/pulls/137323
2025-05-04 08:20:06 +02:00
Jacques Lucke
327ac569b2 Geometry Nodes: show node timings for import nodes 2025-05-04 05:44:52 +02:00
Sean Kim
6ec5ad88b9 Fix: Making a brush local doesn't set user count correctly
When copying a brush from a linked library to the current main, the fake
user flag is set, but the user count is set to 0. This later means that
saving such a file does not persist the brush datablock, and the
associated invariants are violated.

Related to / Found in #138105

Pull Request: https://projects.blender.org/blender/blender/pulls/138243
2025-05-04 01:25:05 +02:00
Hans Goudey
71ac8eee68 Cleanup: Use const arguments for realize instances function
OrderedAttributes was passed by value unnecessarily.
2025-05-03 15:25:24 -04:00
Guillermo Venegas
9e5151d294 Refactor: UI: Replace uiLayoutSplit with class method uiLayout::split
This converts the public `uiLayoutSplit` function to an object oriented
API (`uiLayout::split`), 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.

`uiLayout::split` now returns an `uiLayout` reference instead of a pointer.
New calls to this method should use references too.

Pull Request: https://projects.blender.org/blender/blender/pulls/138361
2025-05-03 20:51:42 +02:00
Mukhesh
5055a4e5a3 FIX: Select operators in Sequencer Preview
Behavior of select all operator invoked by shortcut was inconsistent
with menu. This was, because operator context was not set.

Also the selection in timeline is cleared when running this operator
as not doing it may cause unexpected behavior for users.
Selection invert also follows the same behavior.

Pull Request: https://projects.blender.org/blender/blender/pulls/137713
2025-05-03 02:20:56 +02:00
Campbell Barton
7d97ba4c5f Cleanup: use float2, int2 types for cursor drawing callbacks
Ref !138172
2025-05-02 23:01:29 +00:00
Hans Goudey
ae2c601a0c Fix: Curves split/separate points operators lose vertex group status
The fix is only clearly correct if `copy_data_to_geometry` returns by value.
2025-05-02 14:39:20 -04:00
Guillermo Venegas
5dc86dacda Refactor: UI: Replace uiLayoutBox with class method uiLayout::box
This converts the public `uiLayoutBox` function to an object oriented
API (`uiLayout::box`), 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.

`uiLayout::box` now returns an `uiLayout` reference instead of a pointer.
New calls to this method should use references too.

Pull Request: https://projects.blender.org/blender/blender/pulls/138334
2025-05-02 19:46:26 +02:00
Bastien Montagne
b1fd91c2c0 Fix #138329: Workbench Material color type broken for meshes with no material.
Regression from 368c737fe7. Forgot to fully move to using
`BKE_id_new_nomain` at some point for default materials, instead
of doing more low-level set of 'alloc liblock, initialize it with
default values'.
2025-05-02 18:58:15 +02:00
Miguel Pozo
f24ad7a470 Build: Add WITH_OPTIMIZED_BUILD_TOOLS
Enable optimizations on Debug builds for executables used for the build
process (datatoc and glsl_preprocess) and enable unity builds for
shader preprocessing targets.

Debug: From 28.9s to 5.7s
Release: From 4.9s to 3.5s

Pull Request: https://projects.blender.org/blender/blender/pulls/138274
2025-05-02 18:33:44 +02:00
Hans Goudey
37dcdb2b6a Depsgraph: Avoid quadratic overhead when building collection relations
Checking whether relations already existed was a bottleneck when building
collection -> object hierarchy relations. The duplicate checking would be
unnecessary since an object can only be in a collection once, but this function
to build relations can be called multiple times for the same collection.

To avoid the need to check for duplicates, only run the relation creation
once for each collection. The `BuilderMap` gives a simple way to do that.
Note that because a collection might be built separately as a non-layer
collection, there may still be duplicate hierarchy relations.

Building a Depsgraph for 60k simple objects became 1.86x faster, from 2.39
to 1.29 seconds.

Pull Request: https://projects.blender.org/blender/blender/pulls/137737
2025-05-02 17:51:10 +02:00
Brecht Van Lommel
321e9e049e Fix: USD material reader uses fixed colorspace names
For other OpenColorIO configurations these may not exist or have a
different meaning.
2025-05-02 17:39:56 +02:00
Brecht Van Lommel
af4a7efaed Fix #138262: Movie file colorspace can't be changed
Regression from recent ccd7bc2078, restore previous logic and add
comments.
2025-05-02 17:39:56 +02:00
Laurynas Duburas
45a2634917 Fix: Curves: "Separate" in point selection mode loses boundary segments
The current code doesn't include selection boundary points in non-
selected curves after separation, causing some segments to be lost.
Legacy curves do include those points. The second issue is with cyclic
curves. The current version leaves the separated part cyclic, though
the more intuitive behavior would be cut off the result. This is also
different from legacy curves. This commit fixes both issues.

Pull Request: https://projects.blender.org/blender/blender/pulls/135035
2025-05-02 17:30:02 +02:00
Sergey Sharybin
5b29ba488f Color management: Implement shader to convert to scene linear
Previous conversion to scene linear was done in the display transform
shader. Having a separate shader to convert texture to scene linear
allows drawing input textures with different color spaces into a
viewport and apply display transform on all of them.

Currently unused, but is required for !138094. It could also be used
in the future to avoid host-side linearization in the image engine.

Internally it uses a lot of the same logic for shader caching and
binding, but the code is refactored a bit to make it easier to have
a stronger separation in the future if needed.

Ref #138094

Pull Request: https://projects.blender.org/blender/blender/pulls/138308
2025-05-02 16:51:46 +02:00
Sergey Sharybin
a26ed85adf Fix: Wrong ID type used to create Lookdev world
Fixes incorrect render of lookdev on macOS.
There might have been some other issues caused by the mistake, hard to say,
seems to be hitting some platform-specific behavior and such.
2025-05-02 16:30:44 +02:00
Falk David
a1b92f91b7 Fix #137990: Grease Pencil: Crash when creating library override
There were two issues:
* Some rna properties to access members in the layer tree were missing
  `PROPOVERRIDE_NO_COMPARISON`.
* In `rna_Attributes_noncolor_layer_skip` the wrong `AttributeOwner`
  was created.

Pull Request: https://projects.blender.org/blender/blender/pulls/138324
2025-05-02 16:15:34 +02:00
Hans Goudey
ed68c0a635 Cleanup: Clarify instances almost unique IDs cache
Use the safer VArraySpan instead of get_internal_span(). And remove
the size check for the output data. If the callback inside `ensure` is
called it means that recomputing the data is necessary, regardless of
the array's current size.
2025-05-02 10:11:29 -04:00
Sergey Sharybin
b1c8f90b32 Math: Use lvalue ref-qualifier for compound assignment operators
The goal is to make issues like the ones fixed in #138310 become visible
much earlier in the development cycle.

This PR covers the most obvious places where it could be applied. There
are probably more places, but they can be covered later.

Pull Request: https://projects.blender.org/blender/blender/pulls/138315
2025-05-02 15:25:32 +02:00
Jacques Lucke
e8d1491e62 Refactor: Depsgraph: simplify query API further
* Remove `DEG_get_evaluated_object` in favor of `DEG_get_evaluated`.
* Remove `DEG_is_original_object` in favor of `DEG_is_original`.
* Remove `DEG_is_evaluated_object` in favor of `DEG_is_evaluated`.

Pull Request: https://projects.blender.org/blender/blender/pulls/138317
2025-05-02 15:08:29 +02:00
Campbell Barton
f59cd876ad Cleanup: ensure logically correct sort callback (id_order_compare)
Ref: !138299
2025-05-02 22:39:41 +10:00
Bastien Montagne
276fac2294 Harden blendfile reading against fully corrupted input data.
'Fixes' the "curveprofile" case of #137870, by immediately crashing
on nullptr access instead of allowing readfile code to further access
memory detected as invalid (which would most likely lead to a crash
later anyway).

I don't think we can expect readfile code to gracefully abort at such a
low-level error detection, not without using some form of exception
handling at least? Otherwise the whole readfile code would have to
constantly check for invalid flag in the Mains.

Pull Request: https://projects.blender.org/blender/blender/pulls/138145
2025-05-02 14:29:11 +02:00
Bastien Montagne
368c737fe7 Core: Fix/refactor invalid logic around handling of 'default materials'.
These were handled mostly completely outside of IDManagement code, yet
(ab)using the same ID management system in some cases, adding hacks to
address some issues, etc.

Also address a similar issue in the eevee lookdev `LookdevWorld` code.

Since initializing pre-allocated (or static) buffers as valid IDs is not
currently supported, and these use-cases do not seem common enough to be
worth supporting it currently, instead switch to storing allocated IDs
into static pointers.

This allows to use proper 'out-of-main' ID creation code API.

NOTE: There are still some remaining issues, especially in the GP
material BKE api. These are noted in comments for now, as it would be
out of scope to address them in this commit.

Pull Request: https://projects.blender.org/blender/blender/pulls/138263
2025-05-02 14:09:53 +02:00
Julian Eisel
58247efc69 Refactor: Assets: Use weak reference comparison to lookup assets
Comparing paths is tricky, especially when different operating systems
are involved, with different slashes, encodings, etc. So often a string
comparison is not good enough. Use asset weak reference comparison for
this case, which performs more careful path comparisons.

Not sure if this makes a difference in practice. But it might solve some subtle
issues, and it makes some more sense semantically. So I think it's worth
trying. Originally I was hoping this would fix #123508, but apparently didn't

Pull Request: https://projects.blender.org/blender/blender/pulls/127685
2025-05-02 13:35:34 +02:00
Jeroen Bakker
098990b172 Fix: Vulkan: Revisited samplers
Implemented the VKSamplers based on the documentation in GPU_texture.hh.
They used to be reversed engineered from the OpenGL backend, however
Vulkan has better control over mipmap filtering and OpenGL needed to
combine some flexibility inside the min/mag filtering.

Changes:
- Mipmap filtering was always on, not only when `GPU_SAMPLER_FILTERING_MIPMAP`
  is used.
- Mipmap filter mode is always set to linear. This is not according to the
  documentation, but matches OpenGL and the render tests.

Fixes #136439, #138111
Partial fix #137436 - seam isn't there, inf can still be part of the
texture.

Pull Request: https://projects.blender.org/blender/blender/pulls/138313
2025-05-02 13:24:06 +02:00
Omar Emara
4cb69dafb0 Compositor: Remove Use Alpha option from Composite and Viewer node
This patch removes the Use Alpha option from Composite and Viewer nodes.
The reasoning for the removal is as follows:

- It has an unintuitive complicated design at the moment.
  - If the Alpha Input is unlinked, the output alpha is not adjusted
    even if Use Alpha is enabled, leaving users wondering why their
    adjustments have no effect.
  - Disabled Use Alpha means output an opaque image, that is, it
    actually means Ignore Alpha. Which is confusing because users might
    think that it controls alpha adjustments based on input.
- It always does alpha replacement without premultiplication, which is
  not clear to the user and is not what the user wants in most cases.
- Adding a Set Alpha node before the output is pretty easy and clear, so
  the option seems redundant considering the above.

Pull Request: https://projects.blender.org/blender/blender/pulls/138309
2025-05-02 12:50:58 +02:00
Jeroen Bakker
d77fb1fb0e Fix #138149: Vulkan: Update descriptor pool sizes
Update descriptor pool sizes to be better for smaller scenes. Creating,
resetting and destroying pools are expensive operations. In smaller
scenes this can lead to lower performance.

The  improvements may differ per platforms or not be visible.

Pull Request: https://projects.blender.org/blender/blender/pulls/138300
2025-05-02 12:42:20 +02:00
Lukas Tönne
deddc6f18c Fix #137913: Grease Pencil: Fallback for looking up material index attribute
The "material_index" attribute is expected to exist by many operations,
but that is not always the case. Using a fallback value prevents crashing
in case the attribute has been removed. A default material is already
supported when the index is not in range of the actual material slots on
an object or grease pencil data block respectively.

Pull Request: https://projects.blender.org/blender/blender/pulls/138303
2025-05-02 12:34:49 +02:00
Philipp Oeser
1a96c310d8 Fix #138272: Camera Ortho Scale adjustment wrong Background Image offset
Wrong since the Overlay Next implementation in ce28af7352

We cannot write to things like `.xy()`, these are for reading only.
Not aware of a version that is for writing, so for now, write to [0] and
[1] separately.

Pull Request: https://projects.blender.org/blender/blender/pulls/138310
2025-05-02 12:05:40 +02:00
Pratik Borhade
68252ef77c Fix #138163: Autokey doesn't work when using trackpad to move locked camera
Navigating with mouse executes the respective modal function where it
handles autokeying the locked camera. But navigating with trackpad just
executes invoke function (for eg: see event_code in `viewrotate_invoke_impl`).
To fix this, Call `ED_view3d_camera_lock_autokey` inside invoke() to handle
autokeying.

Pull Request: https://projects.blender.org/blender/blender/pulls/138179
2025-05-02 11:56:24 +02:00
Pratik Borhade
3aea40b8cd Anim: Bone collection UI changes
Allow assign/select operators to execute when armature tab is pinned.
For assign operators, pinned armature should be active in 3D view
because we cannot assign bones of one armature to the bone collection of
different armature. Added extra condition in poll function to control
the above case.
For select operators, use `ED_armature_context` to obtain pinned Armature.
These operators are now hidden in object modes.

Pull Request: https://projects.blender.org/blender/blender/pulls/137587
2025-05-02 11:52:33 +02:00
Sietse Brouwer
67bec541fa Fix: Grease Pencil: Undo layer drag-and-drop
Reordering layers via drag-and-drop in the layer tree couldn't be
undone. With this patch an undo step is pushed when the layer order
changes via drag-and-drop, so the action can be undone.

Pull Request: https://projects.blender.org/blender/blender/pulls/138214
2025-05-02 11:32:07 +02:00
Sergey Sharybin
806a633609 GPU: Implement blending mode for piercing a hole in alpha
The use-case of this blend mode is to be able to make parts of an
viewport overlay transparent.

The future user of this blend mode is sequencer preview drawing
where frame will be drawn to an HDR render frame-buffer, and overlays
drawn on-top. In a way it is similar to the image engine, but without
need to have custom shader.

Ref #138094

Pull Request: https://projects.blender.org/blender/blender/pulls/138307
2025-05-02 10:40:23 +02:00
Sergey Sharybin
a345c3db64 GPU: Add API to access render frame buffer
Currently unused, but allows areas outside of DRW to render to the
color render and depth texture.

The primary user of this new API will be Sequencer preview to draw
HDR images.

Ref #138094

Pull Request: https://projects.blender.org/blender/blender/pulls/138306
2025-05-02 10:38:28 +02:00
Sergey Sharybin
180770fe3f Draw: Scale checkerboard with pixel size
Solves the problem of checkerboard in the sequencer have much smaller
grid than in the 3D viewport.

Ref #138094

Pull Request: https://projects.blender.org/blender/blender/pulls/138305
2025-05-02 10:36:59 +02:00
Campbell Barton
614f3957fe Cleanup: suppress null-dereference warning
Resolve a theoretical null pointer de-reference. In practice this is
unlikely as the result of `fd->file->read()` would need to fail to read
the requested data from memory.

Also use `UNLIKELY(...)` with checks that the expected amount of data
could be read.
2025-05-02 07:23:54 +00:00
Campbell Barton
f6e3635c1c Fix: potential null pointer de-reference in 2.8x UI versioning
Since it's not guaranteed specific region types exist,
null check before accessing.

Quiet null-dereference warning.
2025-05-02 07:03:12 +00:00
Pratik Borhade
703fce10f9 Fix: Complier warning
Following warning triggered after 6a90382390
`C4312: conversion from 'const uint' to 'const void *' of greater size`
As Jacques mentioned in the chat, do additional casting to resolve the
error.

Pull Request: https://projects.blender.org/blender/blender/pulls/138190
2025-05-02 07:51:30 +02:00
Pratik Borhade
3a3265581b Fix: Code comment about ignoring scale/rotate lock flags in global orientation
After 5f7d5c0809, just translate gizmo is listening to protection flags
in global orientation. Commit doesn't specify the reason behind the
change. It intentionally ignores scale/rotate lock flags in global
orientation. Added a code comment to explicitly mention the reason
behind it.

Resolves #116666

Pull Request: https://projects.blender.org/blender/blender/pulls/133286
2025-05-02 07:01:57 +02:00
Sean Kim
e5e7b6232a UI: Add labels for local and essentials assets in tooltip
This commit changes the asset tooltips for Local and Essential assets to
include a static string indicating their library type.

Related to #138105
2025-05-02 02:16:29 +02:00
Sean Kim
0491c2c233 Fix #136940: brush.asset_save_as crashes in background mode
Calling `brush.asset_save_as` both creates an asset and also activates
the corresponding brush. When run while Blender is in background mode,
the `active_tool->runtime` field may be null. To avoid crashing in this
case, check for null when comparing active tool data.

Pull Request: https://projects.blender.org/blender/blender/pulls/138245
2025-05-02 00:45:06 +02:00
Hans Goudey
20b471e851 Cleanup: Resolve missing declaration warning 2025-05-01 16:05:00 -04:00
Sietse Brouwer
668aed18e9 Grease Pencil: Viewport option for showing onion skins of the active object only
This PR adds an option to only show the onion skins of the active
object. The option is added to the Grease Pencil overlay menu in the
3D viewport.
When enabled, only the onion skins of the active object are shown.
This keeps the viewport a lot cleaner when working with multiple
Grease Pencil objects.

This resolves #136820.

Pull Request: https://projects.blender.org/blender/blender/pulls/137405
2025-05-01 17:43:17 +02:00
Guillermo Venegas
5e2a856566 UI: Add shortcut to show active sidebar tab
Add a keyboard shortcut  (numpad period) to show the active sidebar
tab, so users can locate the tab without scrolling.

Pull Request: https://projects.blender.org/blender/blender/pulls/107752
2025-05-01 17:32:51 +02:00
Nathan Vegdahl
4e7dfcbe3f Modeling: Add Auto Normalize when Assigning vertex weights
Part of #135062.

This PR adds an Auto Normalize option in the Vertex Group panel that
when checked will normalize the other deform-bone vertex groups' weights
when assigning the weight of a deform-bone vertex group. For example if
a selected vertex has the following weights:

| Name    | Weight |
|---------|--------|
| Group 1 | 0.2    |
| Group 2 | 0.2    |
| Group 3 | 0.6    |

And the user selects Group 3, checks the Auto Normalize checkbox, sets
the weight to 0.8, and clicks Assign, the new weights will be:

| Name    | Weight |
|---------|--------|
| Group 1 | 0.1    |
| Group 2 | 0.1    |
| Group 3 | 0.8    |

Co-authored-by: Andy Beers <acbeers1@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/138133
2025-05-01 16:08:10 +02:00