Commit Graph

150077 Commits

Author SHA1 Message Date
YimingWu
fa6e104362 Fix #136402: Gizmo: Removing ruler annotation layer can crash
`WM_gizmomap_group_find` can return null when removing ruler annotation
layer when current tool is not "Ruler" tool, this causes
`ruler_item_remove` to crash. This fix made it only remove ruler items
when `gzgroup` is not null (which is the same logic in
`view3d_ruler_remove_invoke`).

Pull Request: https://projects.blender.org/blender/blender/pulls/136416
2025-03-24 10:08:51 +01:00
Brecht Van Lommel
c448bf16e5 Cycles: Multithread adaptive subdivision dicing
* Perform attribute interpolation as part of dicing.
* Remove temporary subd uv and face index attributes.

On a MacBook M3 with 12 P-cores and 4 E-cores, these changes overall give
a 10x-14x speedup on various scenes. Note that splitting is still single
threaded and can be expensive, and UV subdivision can be optimized more.

Pull Request: https://projects.blender.org/blender/blender/pulls/136411
2025-03-24 09:42:47 +01:00
Brecht Van Lommel
4e16c4bd7d Refactor: Cycles: Tweaks to adaptive subdivision dicing
* Move dicing out of DiagSplit, caller now uses EdgeDice
* Merge, rename and reorder various EdgeDice functions
* Compute triangle indices for subpatches in advance

Pull Request: https://projects.blender.org/blender/blender/pulls/136411
2025-03-24 09:42:45 +01:00
Brecht Van Lommel
17fbfbc2d5 Refactor: Cycles: Subdivision avoids writing vertices multiple times
For performance and determinism with upcoming multithreading.

Pull Request: https://projects.blender.org/blender/blender/pulls/136411
2025-03-24 09:42:43 +01:00
Brecht Van Lommel
e054dc3eeb Refactor: Cycles: Add concurrent vector, concurrent set from TBB
Pull Request: https://projects.blender.org/blender/blender/pulls/136411
2025-03-24 09:42:25 +01:00
Brecht Van Lommel
758e70d728 Fix #134756: Internal IES texture node flagged in missing file report
There was another fix for this, but it addressed a different problem than
what was reported.

Pull Request: https://projects.blender.org/blender/blender/pulls/136331
2025-03-24 09:39:22 +01:00
Brecht Van Lommel
583f4a7909 Fix #136010: Clarify meaning of Gamma in render settings and nodes
With more detailed tooltips.

Pull Request: https://projects.blender.org/blender/blender/pulls/136082
2025-03-24 09:39:00 +01:00
Jacques Lucke
06ddccac05 BLI: change strict flag from -Wshadow to -Wshadow=local
Previously, including `BLI_strict_flags.h` caused compile errors for all
shadowed values. Generally, this is fine, but sometimes it may catch more cases
than desirable. For example, adding `int U;` in `init_data` in
`MOD_correctivesmooth.cc` causes an error because there is the global `U` symbol
(user prefs).

While not an issue right now, this can cause unexpected compile errors when
adding additional includes. I ran into this while working on a tool that adds
additional includes automatically as part of its operation.

Fortunately, GCC supports a slightly weaker variant of this error:
`-Wshadow=local`. This only covers the case we mainly care about where local
variables are shadowed by other local variables.

Pull Request: https://projects.blender.org/blender/blender/pulls/136389
2025-03-24 09:29:21 +01:00
Jacques Lucke
2a9ebda328 Cleanup: avoid duplicate definition of unit_m3 and unit_m4
It does not seem worth it to avoid including `BLI_math_matrix.h` here nowadays.

Pull Request: https://projects.blender.org/blender/blender/pulls/136387
2025-03-24 09:28:54 +01:00
Omar Emara
7c0c31efb0 Nodes: Enable panel toggles in the Compositor
This patch enables panel toggles in the compositor since it now supports
boolean sockets. This essentially reverts c3957f432a.
2025-03-24 10:20:39 +02:00
Omar Emara
55e09a6cbf Fix #136353: Mix node causes the compositor to misbehave
The newly added Mix node causes the compositor to assert and misbehave.
That's because its has unavailable sockets, and the compositor code base
was not designed to handle unavailable sockets. To this patch fixes that
by handing unavailable sockets everywhere that matters.
2025-03-24 10:00:52 +02:00
Omar Emara
fca510a4db Fix: Missing break in switch statement 2025-03-24 09:01:29 +02:00
YimingWu
68a0e68bcd Fix #135999: Extensions: Remove emails in bl_info['author']
Previously when an addon is expanded on the UI, the "Maintainer" string
would be cut short until a `<` character, to prevent showing e-mail on the
UI, however there could be more than one person/email entries in there
so to prevent cutting short the string, now we use regex to take out the
email part only, so full maintainer string is displayed.

Pull Request: https://projects.blender.org/blender/blender/pulls/136031
2025-03-24 07:35:44 +01:00
Jeroen Bakker
2f41aa6a52 Fix #132968: OpenGL: Strip line directives on legacy AMD
Potential fix for legacy AMD driver issue.

- Updating drivers using a clean install has proven to fix the issue as well.
As driver can leave parts of an older driver active what it actually the cau
- Solution comments out the `#line` by replacing the first two characters.

Pull Request: https://projects.blender.org/blender/blender/pulls/136231
2025-03-24 07:31:29 +01:00
Brecht Van Lommel
0991ca7169 Fix: Shader node editor UI causes CPU subdivision to be used
Don't access Object.data through the RNA API.
2025-03-23 21:01:25 +01:00
Brecht Van Lommel
f506564a47 Cleanup: Unused argument compiler warning 2025-03-23 21:01:25 +01:00
Jacques Lucke
26c95c9968 Cleanup: avoid ambiguous type name
There was a potential conflict between blender::Map and Eigen::Map.
2025-03-23 13:35:48 +01:00
Jacques Lucke
3943a39c08 Cleanup: rename dot to dot_export namespace
Without this, including `BLI_dot_export.hh` in `delaunay_2d.cc` causes a
compile error because the name `dot` is ambiguous.

Pull Request: https://projects.blender.org/blender/blender/pulls/136385
2025-03-23 13:34:07 +01:00
Jacques Lucke
0c9f0709d3 Cleanup: remove duplicate math functions
Pull Request: https://projects.blender.org/blender/blender/pulls/136383
2025-03-23 13:28:20 +01:00
Campbell Barton
f76d3c8eb6 Cleanup: past const arguments to UV selection testing functions 2025-03-23 05:35:17 +00:00
Campbell Barton
3e5de94c8e Fix #136188: Invalid read clicking on a menu socket button in modifier
Clicking the drop-down button for a Menu-type socket in geometry
modifier panel crashes with ASAN error.

Resolve by skipping the check for ID properties & assert the property
is an RNA property.
2025-03-22 08:06:42 +00:00
Campbell Barton
0d2fd12d8d Cleanup: format 2025-03-22 08:06:40 +00:00
Campbell Barton
818a1a6a35 Cleanup: replace int with wmOperatorStatus 2025-03-22 16:35:59 +11:00
Campbell Barton
28c282cdad Cleanup: return bool from outliner_open_back 2025-03-22 16:26:50 +11:00
Pratik Borhade
4281767fc0 Fix #113383: Clear button in selector input in redo panel closes the panel
`UI_OT_button_string_clear` clears the redo panel in `wm_operator_finished`.
hud_status is set to CLEAR due to undo flag on above the internal operator.
To fix the redo panel from closing, undo flag from the operator could be
removed. Alternative is, skip internal operators from closing the redo
panel with extra check `if (op->type->flag & OPTYPE_INTERNAL) {return;}`

Ref: !135727
2025-03-22 15:47:41 +11:00
Sergey Sharybin
5ce4e91a80 Fix #136319: Incorrect transparent bounce count with spatial splits
The transparent bounce test was too optimistic in regards to the intersection
being considered. The check needs to happen after it has been validated that
it is not duplicate.

It was already the case for Metal and HIP-RT, but not for Embree and BVH2.

Tests updated by: Alaska <Alaskayou01@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/136325
2025-03-22 04:51:42 +01:00
Julien Duroure
8c35fe05b6 Fix Regression: glTF: Fix NLA track export mode 2025-03-22 00:27:53 +01:00
Johnny Matthews
633b8d30db Fix #135071: Vertex Parenting: Provide Index Access Options
When using vertex parenting, an option for using the parent object
final evaluated indices is exposed in the Object Properties: Relations
panel. This allows the calculation of the parent vertex position to
ignore the the CD_ORIGINDEX layer and instead use the final indices
that may have been altered by the node tree evaluation.

The indices that will be used for the vertex parenting are also exposed
to the UI in the same panel, allowing them to be altered after the
vertex parent has been created.
2025-03-21 23:43:48 +01:00
Guillermo Venegas
61783caa7f UI: Rename Add File Node operator to Add Image as Node
`Add File Node` name is too generic. This operator only handles
opening images and movies as nodes, not script files or other kind of files as nodes.

Pull Request: https://projects.blender.org/blender/blender/pulls/122561
2025-03-21 22:49:13 +01:00
Jesse Yurkovich
01ddb320dd Fix #124263: Generate unique names during Alembic and USD export
While object names in Blender are already unique, the names themselves
may be "unsafe" for use in the various file formats. During processing
we make the names "safe". However, we did not guarantee that these new
safe names were themselves unique wrt each other. Consider object names
"Test 1" and "Test-1" which both become "Test_1" after being made safe.
These will collide during export; only 1 object would be exported and
it's undefined which object's data would "win".

To rectify this we add another name map to the hierarchy iterator which
is then used to handle collisions as they happen. The map is per-
hierarchy meaning that a name can appear more than once as long as its
under a different hierarchy. E.g.
- `/root/A/X` and another `/root/B/X` is OK
- `/root/A/X` and another `/root/A/X` is NOT OK

Pull Request: https://projects.blender.org/blender/blender/pulls/135418
2025-03-21 21:29:08 +01:00
Hans Goudey
321dbb0115 Cleanup: Use spans for mesh tangent calculation arguments 2025-03-21 15:27:24 -04:00
Aras Pranckevicius
850d67829c Tests: emit more information in import test templates
- Object parent type & parent bones
- Pose information that is not trivial (i.e. print posed bones that
  have either non-identity pose matrix, or custom properties)
- Make sure custom properties are output sorted by name

Pull Request: https://projects.blender.org/blender/blender/pulls/136321
2025-03-21 20:16:47 +01:00
Hans Goudey
4e1e47f840 Fix: Assert in draw mesh tangents extraction
Avoid requesting mesh data when the mesh is an edit mesh wrapper. That
triggered asserts that hid the real issue in #136235.
2025-03-21 15:00:04 -04:00
Clément Foucault
485167dd02 EEVEE: Update tests after new geometric normal 2025-03-21 19:08:15 +01:00
Clément Foucault
410282e156 EEVEE: Add quantized geometric normal for shadow bias
This improves the situations where the shading normal is far from the
best shadow bias direction. This is particularly noticeable on low poly
meshes with smooth normals.

This patch fixes the issue by storing a quantized version of the
geometric normal in the Gbuffer.
Only 6 bits are used (each axis uses 2 bits). This is stored inside the
gbuffer header since it is always available and has some spare bits to
store this data.

This quantization is only done if the error introduced by using the
shading normal is higher than using the quantized normal. This means
that flat shaded surfaces will not have any quantization artifact.
For smooth shaded surfaces, the quantization is only effective if the
shading normal is quite different (greater than ~20° difference)
than the geometric normal.

The attached blendfile contains an example Material that shows
how the quantization is done. This was used to find the threshold
value with the least amount of error.

To compensate the quantization error,  we increase the normal bias by
~20% which is subpixel if the shadow texel density is high enough.

This also changes the forward shading pipeline to use the geometric
normal for bias.

The first Light closure normal is now used for the attenuation function
since this is the most representative of the final shading. This normal
being inverted for transmission closures, we have to negate the normal
in the attenuation computation.

Pull Request: https://projects.blender.org/blender/blender/pulls/136136
2025-03-21 19:07:46 +01:00
Clément Foucault
32fe65dc9b Fix #136098: Impossible to select of pose bones when in Weight Paint mode
This was caused by the select_id not being flushed to
the armature object.

This is because the selection code uses `FOREACH_OBJECT_IN_MODE_BEGIN`
to iterate over the objects. This doesn't call the depsgraph
which would, in normal circumstances, flush the select_id value
to the evaluated object.

Also fix #136141

Pull Request: https://projects.blender.org/blender/blender/pulls/136320
2025-03-21 18:15:23 +01:00
Clément Foucault
463ea020e4 Fix #136185: Overlay: Reference images in front of meshes in render mode
This was caused by the reference images being drawn before
the prepass.

Moving after the prepass fixes the issue.

Pull Request: https://projects.blender.org/blender/blender/pulls/136324
2025-03-21 18:15:14 +01:00
Pratik Borhade
a4058fa173 Cleanup: UI: Remove unused function
Removal of unused `eyedropper_draw_cursor_text_window` function and
simplification of surrounding code.

Pull Request: https://projects.blender.org/blender/blender/pulls/136240
2025-03-21 17:49:54 +01:00
Miguel Pozo
a27b2c5f49 Fix #135552, #135783: DRW: Crash when creating DRW context in background mode
Regression from 583e2b7240

`DRW_shader_init()` calls `GPU_context_create` before having a valid
GHOST context active (`WM_system_gpu_context_activate(system_gpu_context)`).
Swap the calling order to fix the issue.

Pull Request: https://projects.blender.org/blender/blender/pulls/136270
2025-03-21 16:03:06 +01:00
Jonas Holzman
34a7aa3a5e Docs build: Update path of newly renamed gizmo_simple_3d.py Python template 2025-03-21 14:47:01 +01:00
Sergey Sharybin
50180283e9 Fix #117527: Spatial split leads to artifacts on transparent shadows
The reason for this to happen is because when spatial split is used
the same intersection could be recorded twice (via different BVH nodes).

This change introduces check for the intersection being already recoded,
similar to the check in the local BVH. The check is done during BVH
intersection which allows to properly ignore intersections even for the
maximum bounce number check. A faster approach would be to do such
filtering after sorting, but then we can not keep bounce check in the
BVH code consistent with and without spatial splits.

Intuitively it seems that it should be possible to merge the new loop
with the one that checks for which intersection to keep. But it is not
so trivial in practice: it doesn't run for all intersections, and also
it is formulated in a way that updates isect_index for the next record.

Pull Request: https://projects.blender.org/blender/blender/pulls/136251
2025-03-21 13:56:50 +01:00
Michael Jones
c23c4ae6ba Cycles: Fix issue affecting Metal kernel profiling (normally disabled)
This issue only affects profiling mode (`CYCLES_METAL_PROFILING=1`). There's a modest limit to the number of concurrent counter sampling buffers per device, so instead of creating one per device queue, we create one per device that can be reused by successive device queues.

Authored by Emma Liu.

Pull Request: https://projects.blender.org/blender/blender/pulls/136248
2025-03-21 12:47:15 +01:00
Jonas Holzman
bcb343c597 Python Templates: Add Gizmo Simple 2D
Following discussion to document the `icon_value` property of
`GIZMO_GT_button_2d` in PR #136080, and generally improve the
documentation of this Gizmo Type, this patch adds a new "Gizmo
Simple 2D" Python template, and renames the existing "Gizmo
Simple" template to "Gizmo Simple 3D".

Pull Request: https://projects.blender.org/blender/blender/pulls/136304
2025-03-21 12:20:22 +01:00
Casey Bianco-Davis
cdccc51b2e Grease Pencil: Draw Tool: Improve random color value and saturation setting results
This makes the random vertex color brightness work on a relative basis.

Because humans see relative differences in brightness more then absolute
brightness, simple adding randomness to `Value` will cause dark colors to be
effected more heavily then light colors.

This also fixes a problem desaturated colors with becoming red after
saturation randomization.

Pull Request: https://projects.blender.org/blender/blender/pulls/107315
2025-03-21 12:15:09 +01:00
Jonas Holzman
ec149a919a Gizmo: Add icon_value property to support using custom icons
This patch adds the icon_value property to GIZMO_GT_button_2d to support
using custom icons values. This allows for the use of user-defined icons
(via custom preview collections), or generated icons like material or
image previews.

On the API side, this property replicates the RNA UI API behavior (seen
in layout.operator/layout.prop) of prioritizing `icon` over `icon_value`
if the former is set.

Pull Request: https://projects.blender.org/blender/blender/pulls/136080
2025-03-21 12:10:49 +01:00
Campbell Barton
d037fcd5fb Cleanup: don't redefine built-ins in the key-map
Also remove redundant dictionary unpacking for a single item.
2025-03-21 22:08:31 +11:00
Campbell Barton
5b04f13219 Cleanup: wrap long lines 2025-03-21 22:08:31 +11:00
Campbell Barton
d9edc0c057 Cleanup: replace multiple checks with static sets 2025-03-21 22:08:31 +11:00
Omar Emara
d6fa68eb58 Compositor: Add boolean socket support
This patch adds support for boolean sockets in the compositor. This
involves adding a new Bool ResultType and handling it in relevant code.
For shader operations, booleans are passes as floats since GPUMaterial
does not yet support boolean types.

Pull Request: https://projects.blender.org/blender/blender/pulls/136296
2025-03-21 12:03:09 +01:00
Bastien Montagne
cef8de874b Cleanup: blenlib: Replace 'void' MEM_[cm]allocN with templated, type-safe MEM_[cm]allocN<T>.
The main issue of 'type-less' standard C allocations is that there is no check on
allocated type possible.

This is a serious source of annoyance (and crashes) when making some
low-level structs non-trivial, as tracking down all usages of these
structs in higher-level other structs and their allocation is... really
painful.

MEM_[cm]allocN<T> templates on the other hand do check that the
given type is trivial, at build time (static assert), which makes such issue...
trivial to catch.

NOTE: New code should strive to use MEM_new (i.e. allocation and
construction) as much as possible, even for trivial PoD types.

Pull Request: https://projects.blender.org/blender/blender/pulls/136268
2025-03-21 11:50:00 +01:00