Commit Graph

150077 Commits

Author SHA1 Message Date
Brecht Van Lommel
98104d63ca Refactor: Track max subdivision depth per edge instead of per patch
This ensure results are consistent between patches for the upcoming triangle
patch case, where we can't assume alternating subdivision like quads.

Pull Request: https://projects.blender.org/blender/blender/pulls/139062
2025-05-19 12:04:08 +02:00
Brecht Van Lommel
d6b42d3eac Refactor: Rename subpatch members to prepare for triangular patch
Pull Request: https://projects.blender.org/blender/blender/pulls/139062
2025-05-19 12:03:58 +02:00
Habib Gahbiche
69701e3357 Compositor: Add filter types to search menu
Expose filter types of the filter node (Sobel, Diamond Sharpen, etc..)
in the compositor search menu.

Pull Request: https://projects.blender.org/blender/blender/pulls/139078
2025-05-19 11:55:57 +02:00
Brecht Van Lommel
40642343b6 Fix #138978: Modifier cage option not working when GPU subdivision is off
Need an equivalent of DRW_object_get_data_for_drawing for the cage mesh,
to ensure proper comparison between meshes.

Pull Request: https://projects.blender.org/blender/blender/pulls/138987
2025-05-19 11:50:00 +02:00
Nikita Sirgienko
2a4ca81af2 Build: Upgrade Embree library to release v4.4.0
This new version brings several fixes that Blender no
longer needs to patch manually. In addition, it includes
an internal change related to GPU memory management which,
together with the new API, could address several tickets
and issues currently reported in relation to Embree GPU execution.

Pull Request: https://projects.blender.org/blender/blender/pulls/138176
2025-05-19 11:34:19 +02:00
Nikita Sirgienko
54766b6a54 Cycles: Introducing the code for adoption of Embree 4.4
Embree 4.4 introduces an improvement in the Embree GPU
implementation by dropping shared memory usage in favor
of direct controllable memory transfers. This should allow
addressing several problems spotted in Blender regarding
multithreading and memory corruption when BVH and rendering
happen at the same time. However, to implement such
improvements, the API has changed for several functions, and
this commit adopts Blender code to these changes, making Blender
buildable and functional with all existing Embree 4.X
versions, before and after 4.4.

No functional changes in Blender behavior are expected if
using Embree versions below 4.4.

Pull Request: https://projects.blender.org/blender/blender/pulls/139061
2025-05-19 11:25:50 +02:00
Clément Foucault
c7c3ed9fbf GPU: Shader Preprocess: Assert pragma once in lib
This avoid forgetting to add `pragma once` inside
shader library files and have different include
behavior between C++ and shader code.
2025-05-19 09:20:31 +02:00
EmomaxD
5a4a642472 Fix: Typo in default_world_get
This commit fixes a typo in `eevee_world.cc`,
"EEVEEE" to "EEVEE".

Pull Request: https://projects.blender.org/blender/blender/pulls/138989
2025-05-19 05:29:07 +02:00
Pratik Borhade
5baf28b9d5 Fix: Vertex group ui in edit mode
Introduced in 4e7dfcbe3f
Set decorate property to false to remove extra padding from the right.
Found this bug while revisiting #138168

Pull Request: https://projects.blender.org/blender/blender/pulls/138432
2025-05-19 05:20:11 +02:00
Clément Foucault
e1ac6a75d5 GPU: Shader Preprocess: Escape more character in regex strings
This is trying to fix a reported issue on some compilern with
regex not matching the template definitions
2025-05-19 00:07:40 +02:00
Clément Foucault
84298a8fd8 GPU: Shader Preprocess: Add error check for conditional include
These are not supported, so make it an error to use them.
2025-05-19 00:02:28 +02:00
Lukas Stockner
a6015e1411 Cycles: Fix inconsistency in Ng handling between Microfacets and other closures
In Cycles, the convention is that reflection vs. refraction are classified
based on the hemisphere defined by the *shading* normal (N).

In general, most closure code uses the shading normal for most operations,
as is expected since using the geometric normal (Ng) would break normal maps
and smooth shading.

However, there are two places that use Ng: On the one hand, BSDF sampling
functions generally reject reflections that fall below the Ng hemisphere, since
they'd intersect the geometry when tracing the bounce. This is required, and
we can't do much about it.
On the other hand, the Microfacet evaluation code also checked that the ray
is in the same hemisphere w.r.t. both shading and geometric normal.

Theoretically, this is the right thing to do, since sampling and evaluation code
are supposed to be consistent. However, doing so breaks smooth shading, since
now direct light evaluation near the terminator will sometimes be rejected.

This didn't cause problems in practice because of another inconsistency: While
the parameter of the eval functions was named Ng, the caller actually provided
N (unclear whether by mistake or as a hacky workaround to the terminator).
When this was fixed in 063a9e89, users quickly reported issues with the shadow
terminator, so it was reverted to the hacky inconsistency in 1c50dd8b.

So, let's clean this mess up properly. If we don't want to do the Ng hemisphere
check in _eval, then instead of passing in a misleading value that ends up
making it a no-op, just remove the check. After all, the other closures don't
perform it either.

This way, we avoid the mislabeled Ng, we get rid of the special case for
microfacets, and the shadow terminator continues to be fine.

Technically, we still have the _sample vs. _eval mismatch. However, this is just
unavoidable, and is irrelevant in practice: For a strongly directional light
that makes the shadow terminator noticeable, the MIS weights will be massively
in favor of eval, to the point that it doesn't really matter what sample does.

To support this argument: You can actually reproduce a broken shadow terminator
in pretty much every Cycles version going back to 2011 by just setting up a
small intense mesh emitter, turning off MIS on it to disable _eval, and then
rendering a diffuse smooth-shaded sphere with >100000 samples so that the
fireflies resolve into somewhat consistent lighting.
If nobody has complained about this affecting all closures for 11 years,
I guess it's fine.

Pull Request: https://projects.blender.org/blender/blender/pulls/138632
2025-05-18 17:20:32 +02:00
Lukas Stockner
111b0764c1 Cleanup: Remove unused parameter in OBJ importer 2025-05-18 15:15:39 +02:00
Lukas Stockner
6749695ccb Deps: Build OSL with LLVM bitcode
Split out from #138161.

I checked with a locally built OSL (on Linux), and all tests (incl. OptiX OSL)
still pass without the Cycles-side changes in that PR, so we can merge this and
update the libs separately.

The only file that needs to be updated in the deps is `liboslexec.so`,
and probably `llvm/lib/clang/17/include/__clang_cuda_device_functions.h`
(we don't use this when building Blender, but since it's changed,
it's probably cleaner to update it anyways).

Pull Request: https://projects.blender.org/blender/blender/pulls/138788
2025-05-18 14:53:13 +02:00
Jacques Lucke
1816a2665e Tests: Geometry Nodes: add initial Import CSV node tests
Previously, the test files still had absolute instead of relative paths in them.

Pull Request: https://projects.blender.org/blender/blender/pulls/139020
2025-05-18 07:34:57 +02:00
Jacques Lucke
d04699397b Fix: Nodes: off-by-one error when reordering tree interface items
It was possible to move an input socket above one output socket.

Caused by 45eb746250.
2025-05-17 15:18:26 +02:00
Jacques Lucke
3c39c46e3d Revert "Tests: Geometry Nodes: add initial Import CSV node tests"
This reverts commit e9da1e8629.

Looks like these tests don't succeed yet, maybe WITH_IO_CSV is off?
2025-05-17 13:35:40 +02:00
Habib Gahbiche
4b207be8f9 Cleanup: replace tree type by tree_idname
Pull Request: https://projects.blender.org/blender/blender/pulls/139018
2025-05-17 13:25:59 +02:00
Jacques Lucke
45eb746250 Cleanup: Nodes: generalize finding valid insert position for tree view item
Currently, there are some constraints on the interface of node groups:
* Sockets have to be above panels.
* Outputs have to be above inputs.

The current code that ensures these constraints wasn't able to handle the
case when there are more interface items without the same constraints.

This patch is extracted from #138747.
2025-05-17 11:35:07 +02:00
Jacques Lucke
5fc33bb343 Cleanup: Nodes: simplify drag & drop code for node group interface tree view
This is extracted out of #138747. Some code can be reused for multiple
tree interface items.
2025-05-17 11:33:24 +02:00
Jacques Lucke
b2b22cb66d Cleanup: Nodes: switch using enum instead of int
This simplifies adding more interface item types, because there will
be a compiler warning when it's not handled somewhere.
2025-05-17 11:31:08 +02:00
Jacques Lucke
5d98465acd Fix: Geometry Nodes: wrong struct passed to BLO_read_struct
This didn't cause issues so far, because only the size of that passed in
struct is taken into account currently.
2025-05-17 11:27:45 +02:00
Jacques Lucke
e9da1e8629 Tests: Geometry Nodes: add initial Import CSV node tests 2025-05-17 11:17:57 +02:00
Philipp Oeser
82e557eb21 Fix #138636: "Affect only origins" fails for bezier handles
... for Grease Pencil & Curves

Was only moving the points relative to the origin (so only they stayed
in place, handles were still transformed along with the origin).

In order to fix this this, we now take into account curves handles in
the whole `XFormObjectData` related code (for both Grease Pencil &
Curves). There was a handly existing pair of functions
[`curves::bezier::retrieve_all_positions` &
`curves::bezier::write_all_positions`] which we can use for Curves, for
Grease Pencil this uses code from those functions (but not the functions
directly -- indices would fail there because Grease Pencil would call
this from multiple layers).

This also introduces `BKE_grease_pencil_has_curve_with_type` so we can
know in advance how many elements we need for the
`XFormObjectData_GreasePencil`.

Also corrects a typo in c1c67c918e (swapping `XFormObjectData_Curves`
with `XFormObjectData_GreasePencil`)

Pull Request: https://projects.blender.org/blender/blender/pulls/138665
2025-05-17 10:38:01 +02:00
Aras Pranckevicius
01698188e9 Cleanup: remove stale comment 2025-05-17 09:40:11 +03:00
Aras Pranckevicius
e2b43a4dba Cleanup: armature bone display type naming
- User visible rename: "Use Armature Setting" -> "Armature Defined"
  (just added in 8bf73386f2)
- Internal code only: rename eArmature_Drawtype enum items to have
  ARM_DRAW_TYPE_ prefix, instead of just ARM_ (just ARM_ is used in
  several unrelated enums, leading to confusion)

This is re-apply of PR !138982 was backed out in cef7cb4534 due to
Win x64 buildbot failure. The error was:
```
view3d_navigate_view_all.cc(321): error C2672: 'blender::bounds::transform_bounds': no matching overloaded function found
view3d_navigate_view_all.cc(322): error C2784: 'blender::Bounds<blender::VecBase<T,3>> blender::bounds::transform_bounds(const blender::MatBase<T,Size,Size,NumCol*NumRow%4==0?4:1*sizeof(T)> &,const blender::Bounds<blender::VecBase<T,3>> &)': could not deduce template argument for 'const blender::MatBase<T,Size,Size,NumCol*NumRow%4==0?4:1*sizeof(T)> &' from 'const blender::float4x4'
```
which has nothing whatsoever to do with the PR. But something
in the PR (i.e. rename of a completely unrelated enum entries)
presumably makes this specific VS2019 compiler version not be
able to resolve template argument type. Again, in completely
unrelated file with completely unrelated types.

So "the fix" is to help VS2019 compiler in that place by explicitly
specifying the template types. What exactly in the original
change triggers the issue, remains a mystery. "It is known" that
VS2019 is quite funky in template argument deduction, maybe this
is one of these cases.

Pull Request: https://projects.blender.org/blender/blender/pulls/138995
2025-05-17 08:36:33 +02:00
Campbell Barton
eaedc88c48 Cleanup: remove unnecessary system headers 2025-05-17 01:59:21 +00:00
Campbell Barton
b3dfde88f3 Cleanup: spelling in comments (check_spelling_* target)
Also uppercase acronyms: API, UTF & ASCII.
2025-05-17 10:17:37 +10:00
Campbell Barton
be3199771e WM: use boolean for ime_data_is_composing
This only used char since it was originally part of DNA.

Also correct typo.
2025-05-17 09:05:28 +10:00
Campbell Barton
ec7691e35c Cleanup: warnings with GCC mixing enums/ints & missing break
An unexpected GPUVertAttr::fetch_mode could have resulted in an
GPU_COMP_U16 being treated as a I32. Break & assert in this case.
2025-05-17 08:58:47 +10:00
Sean Kim
9e1e9b0859 Paint: Add toggle support for brush.asset_activate
This commit adds a toggle functionality to the `brush.asset_activate`
operator that makes it behave similarly to the `paint.brush_select`
parameter of the same name.

When the operator has this option enabled, using the operator or
pressing the relevant key will either:
* Activate the specified brush and store it if the current brush does
  not match the specified brush
* Activate the previously stored brush if it exists.

This option is exposed in the keymaps and enabled by default for the
Sculpt Mask brush.

This allows, for example, users to press 'M' to switch to the mask brush
and then press 'M' again to switch back to their previously active
brush.

Partially addresses this RCS submission: [1]
[1] https://blender.community/c/rightclickselect/1VwZ/

---

### Notes
This commit does not currently clear the `AssetWeakReference` when switching paint modes.

Pull Request: https://projects.blender.org/blender/blender/pulls/138845
2025-05-16 23:25:45 +02:00
Sean Kim
fe0b230a2b Fix: active_grid_index and active_face_index can be stale
Neither value was being cleared when the active vert was cleared,
leading to an invalid state where we could have no active vertex but an
active face or grid index.

Pull Request: https://projects.blender.org/blender/blender/pulls/138963
2025-05-16 22:26:47 +02:00
Jesse Yurkovich
3b2bbad609 USD: Add support for Text objects during export
Similar to the existing meta-ball export, and the other exporters,
convert Text objects to meshes for export.

Ref #138883

Pull Request: https://projects.blender.org/blender/blender/pulls/138903
2025-05-16 22:12:48 +02:00
Aras Pranckevicius
de5d0cfdc5 Fix #138795: FBX importer was not handling armatures with non-bone nodes
File under #138795 showed several issues, which, while investigating
them, led to also fixing some other issues.

- FBX files can contain non-bone nodes in between actual bone nodes
  ("fake bones" as they used to be called in Python importer). Handling
  this case was missing in the new importer.
- Due to above, some armatures had what appeared like multiple
  "root bones" inside them, which led to crashes while importing
  animations.
- Meshes with multiple armature modifiers (multiple skin deformers
  in FBX) were not handled correctly, see
  https://projects.blender.org/blender/blender-addons/issues/45171
  for when the same issue was fixed in the Python importer.

Extended test coverage to encompass the above.

Pull Request: https://projects.blender.org/blender/blender/pulls/138992
2025-05-16 21:45:27 +02:00
Thomas Dinges
cef7cb4534 Revert "Cleanup: armature bone display type naming"
This reverts commit 2149f462d4 (broke Windows x64 compilation on CI).

Pull Request: https://projects.blender.org/blender/blender/pulls/138994
2025-05-16 21:01:41 +02:00
Julian Eisel
0d7e958006 Fix: Asset editing API possibly deleting user asset files
Similar to b51229f5fd.

The asset editing API would allow deleting any .blend file that was
linked via the same API, even if it was not created & managed by the API
itself but by the user.

All users of the API had sufficient other checks, so in practice it
wouldn't happen. Still make sure the API is safe to use without
requiring the caller to perform extra checks.
2025-05-16 19:24:44 +02:00
Julian Eisel
b51229f5fd Fix: Possible overwriting of custom asset blend files
The asset editing API wouldn't check if the file it's writing to is
known to be managed by the asset editing API itself, and therefore
writable by the API. So the API could potentially lead to custom blend
files getting overridden.

To be clear, all users of the API had sufficient other checks, so in
practice it wouldn't happen. Still make sure the API is safe to use
without requiring the caller performing extra checks.
2025-05-16 19:14:44 +02:00
Harley Acheson
107c744540 UI: Increase Gizmo 3D Wire Parts Hit Size
Gizmos that contain 3D wire parts, like the rounded lines of the
"Rotate" gizmo, have a fairly small hit size that make it hard to grab,
especially with tablet pens. This PR just increases the width of these
lines during the (invisible) selection process. This is done in such ability
way that it could be increased in the future for touch if needed.

Pull Request: https://projects.blender.org/blender/blender/pulls/138406
2025-05-16 19:04:57 +02:00
Hans Goudey
7a125d5ebc Cleanup: Draw: Simplify trivial attribute requests clearing 2025-05-16 12:30:48 -04:00
Philipp Oeser
d2ea328a6c Fix #138869: Select Colums on selected Keys fails in NLA tweakmode
Currently, `columnselect_action_keys` gets "raw" non-NLA-mapped keyframe
data via `ANIM_fcurve_keyframes_loop`  with the `bezt_to_cfraelem` callback,
so the list of `CfraElem` contains frames in "local" FCurve space.

Later, this would be (rightfully) NLA-unmapped to "local/strip" time, because
this is what `ANIM_editkeyframes_ok(BEZT_OK_FRAME)` expects, it also only
compares "raw" `BezTriple` data.

But this only makes sense if we would store "global/scene" frame data in
`CfraElem` `cfra` already.

This is what we now do, let `bezt_to_cfraelem` perform the NLATIME_CONVERT_MAP

Pull Request: https://projects.blender.org/blender/blender/pulls/138937
2025-05-16 17:21:42 +02:00
Pratik Borhade
52b8eba9eb Fix: UI: Invert button doesn't work for some UIList instances
invert button doesn't work quite well when `filter_items()` is used in
UIList (eg. workspace, attributes list). First issue is, when search
string is empty and invert button is pressed, none item is shown. Now
fixed with extra condition of `filter_byname[0]`. Another issue is when
search string is non-empty then invert button should show elements that
doens't match with the string but it doesn't work. This occurs due to
filtering elements twice. First inside
`filter_items_by_name(reverse=true)` then `UI_list_item_index_is_filtered_visible`.
Remove `UILST_FLT_EXCLUDE` so only once the items are filtered with
invert condition.

Noticed this during !138756

Pull Request: https://projects.blender.org/blender/blender/pulls/138761
2025-05-16 16:44:45 +02:00
Pratik Borhade
6b5521d49f Fix #138713: UI: Inverting attribute UILIst shows internal attributes
Add new rna property that sets `UILST_FLT_ITEM_NEVER_SHOW` Flag for
internal attributes. This avoids internal attributes from showing in the
list with invert button is enabled, see:  `UI_list_item_index_is_filtered_visible`

Pull Request: https://projects.blender.org/blender/blender/pulls/138756
2025-05-16 16:08:30 +02:00
Mattias Fredriksson
bc0913240f Fix: Improve Obj importers parsing and detection of NURBS knot mode
Reworks the implementation for how knots are interpreted when importing
NURBS in .obj format. It refactors each test into a separate function
and simplifies functions using a 'multiplicity sequence' which counts
repeated occurances of knot values (or their 'multiplicity'). Making
comparisons simpler, clearer, and with improved correctness.

With regard to regression tests behavior is almost the same, noticable
difference is consideration of cyclic. Allowing curves with multiplicity
at the endpoints to be cyclic (so Bezier curves can be cyclic given
one repeated point). Untested behavior may also have been 'refined'
(changed), but additional tests would be needed to identify those cases.

Pull Request: https://projects.blender.org/blender/blender/pulls/138778
2025-05-16 15:44:38 +02:00
carnaval
eb6fe4f6d7 Depsgraph: Avoid repeated evaluations when parenting multiple objects
Currently the depsgraph is re-evaluated between every parent operation
when parenting multiple objects. This patch evaluates it only once and
does all the parenting after.

Since it is most of the work, this makes a big difference in large-ish
files. For example, re-parenting 400 objects in a 4000 object file goes
from 10 seconds to a few tens of milliseconds.

I'm definitely not familiar enough with blender internals and all possible
situations to know if this is actually safe or not.

Pull Request: https://projects.blender.org/blender/blender/pulls/138616
2025-05-16 15:40:47 +02:00
Aras Pranckevicius
2149f462d4 Cleanup: armature bone display type naming
- User visible rename: "Use Armature Setting" -> "Armature Defined"
  (just added in 8bf73386f2)
- Internal code only: rename eArmature_Drawtype enum items to have
  ARM_DRAW_TYPE_ prefix, instead of just ARM_ (just ARM_ is used in
  several unrelated enums, leading to confusion)

Pull Request: https://projects.blender.org/blender/blender/pulls/138982
2025-05-16 15:35:56 +02:00
Matvey Smorodin
2ae62e3774 Cleanup: Remove Strip::slot_data_remove() in favour of looping over the strip data arrays
Refactor `Action::slot_remove`: implemented iteration over
`strip_keyframe_data_array` and direct calling
`StripKeyFrameData::slot_data_remove()`. Also removed
`Strip::slot_data_remove()` as well as `Layer::slot_data_remove` as it
had no usages after refactoring.

Fixes: #137095

Pull Request: https://projects.blender.org/blender/blender/pulls/138343
2025-05-16 15:17:58 +02:00
HeCorr
c4acb840ef Fix #127175: KeyingSets: Always show 'Available' option in Insert Keyframe Menu
Always show the 'Available' option in the keyframe menu, so that the
shown menu items are stable. This helps to keep hotkey assignments for
the menu items remain the same.

Note that this isn't a full guarantee yet, as the 'Active Keying Set'
option is also still conditionally added, depending on whether a
keying set was chosen or not. This will be addressed in another
commit.

Pull Request: https://projects.blender.org/blender/blender/pulls/136952
2025-05-16 15:12:51 +02:00
Aras Pranckevicius
8bf73386f2 Anim: support per-bone "Display As" overrides
Armature bone display mode (Octahedral, Stick, Envelope, B-Bone,
Wire) could only be set on the whole armature. This adds ability to
override the display mode per-bone (by default bones use the
same display mode as the armature).

Images in the PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/138445
2025-05-16 15:06:36 +02:00
Pablo Vazquez
fcc6e022b1 Keymap: Use horizontal scroll wheel to pan in 3D Viewport
Use the horizontal scroll wheel for panning left/right in the
3D Viewport. Similar to how it is used in 2D Views.

Also add it to the industry compatible keymap, since it is
a pretty standard/basic navigation gesture.

Pull Request: https://projects.blender.org/blender/blender/pulls/138880
2025-05-16 14:57:47 +02:00
Christoph Lendenfeld
9c35656766 Refactor: Move bone functions to separate file and into namespace
No functional changes intended.

This moves the functions
* ANIM_bone_is_visible
* ANIM_bone_is_visible_ebone
* ANIM_bone_is_visible_pchan

into new files `ANIM_armature.hh`/`armature.cc`.
They were previously in `ANIM_bone_collections.hh` but don't
directly have anything to do with bone collections.

It also puts the functions into the `blender::animrig::` namespace
and removes the `ANIM_` prefix as is the standard for C++ files.

Part of #138482

Pull Request: https://projects.blender.org/blender/blender/pulls/138833
2025-05-16 14:45:46 +02:00