Commit Graph

120055 Commits

Author SHA1 Message Date
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
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
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
111b0764c1 Cleanup: Remove unused parameter in OBJ importer 2025-05-18 15:15:39 +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
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
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
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
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
Sebastian Parborg
e4aa758d70 Fix #137346: IME input getting lost when using Wayland
Our IME input system relied on passing around pointers to global variables.
However this will not work as the Wayland input handling is multithreaded so the content of the global variable would change while the event loop were reading the data.

Pull Request: https://projects.blender.org/blender/blender/pulls/138871
2025-05-16 14:21:06 +02:00
Clément Foucault
8ac5940e33 GPU: Add GL_ARB_clip_control support to the GL backend
This adds support for the extension and always
set the clip state value to 0..1 to align with vulkan
and metal. Moreover this is needed for the Reverse Z
implementation.

Note that this is a OpenGL 4.5 feature and is not
required to start Blender. So there must still be
a fallback path for now.

Rel #138898

Pull Request: https://projects.blender.org/blender/blender/pulls/138941
2025-05-16 13:53:36 +02:00
Christoph Lendenfeld
45240026a2 Refactor: Remove unused bone flag
No functional changes intended.

This removes the `BONE_HIDDEN_PG` flag for Bones.
It was never set, only read so it had no effect.

Part of #138482

Pull Request: https://projects.blender.org/blender/blender/pulls/138802
2025-05-16 13:43:56 +02:00
Habib Gahbiche
1035a7c463 Cleanup: Order nodes alphabetically
Pull Request: https://projects.blender.org/blender/blender/pulls/138972
2025-05-16 12:35:05 +02:00
Jeroen Bakker
6f84eb6d30 Vulkan: Report on all enabled optional features and extensions
Report on all enaled optional features and extensions of the selected
device.

Use `blender --debug-gpu --log-level 2`.
2025-05-16 12:17:59 +02:00
Jeroen Bakker
abede0e682 Fix: Vulkan: Incorrect vertex fetch mode
Issue introduced by 91627b3d47
When reading floats as floats they were actually read as ints.

Pull Request: https://projects.blender.org/blender/blender/pulls/138969
2025-05-16 11:21:52 +02:00
Jeroen Bakker
729f6290b8 Fix: Draw: Asserts due to recent changes
cbcf421db7 could raise asserts as it
didn't use the `!is_empty()` function to test if the name is set.

Pull Request: https://projects.blender.org/blender/blender/pulls/138970
2025-05-16 11:20:53 +02:00
Clément Foucault
2ce71fca18 GPU: Shader Preprocess: Add support for template inside namespaces
And also support for template definition on single line.
2025-05-16 11:01:07 +02:00
Sybren A. Stüvel
82699dfe01 Fix #138733: Driver to control GP layer visibility is invalid
Fix an issue where a driver on the grease pencil layer visibility was not
considered to be animating the visibility.

Pull Request: https://projects.blender.org/blender/blender/pulls/138944
2025-05-16 10:46:06 +02:00
Christoph Lendenfeld
0c10ada0cb Refactor: typedef for Shape Key enums
No functional changes intended.

This adds `typedef`s for the enums used by Shape Keys.
Doing so makes it clear what kind of values are stored
under the `flag` and `type` fields.

Also adding/cleaning-up comments that various functions
in `key.cc` can be changed to a `switch/case`.

In preparation for #136838

Pull Request: https://projects.blender.org/blender/blender/pulls/138595
2025-05-16 10:14:29 +02:00
Sean Kim
1232d64681 Sculpt: Enable pen tilt without experimental option
At this point, with pen tilt functionality having received the following
changes recently:
* Consistency between platforms for what pen tilt values represent
* Inactive cursor visualization
* Invertable per-brush strength

The majority of the work that remains is wider testing and addressing
per-device issues, thus it makes sense to make this option available in
release builds.

By default, no brushes packaged with Blender have a non-zero Tilt
Strength, making this option opt-in by default.

The following brushes support this option:
* Draw
* Draw Sharp
* Flatten
* Fill
* Scrape
* Plane
* Clay Strips

With a non-zero Tilt Strength value on the brush, the normal of the
brush plane is tilted in the same direction as the user's pen, where a
perpendicular orientation for the pen matches the behavior with a Tilt
Strength of 0.

Resolves #82877

Pull Request: https://projects.blender.org/blender/blender/pulls/137574
2025-05-16 01:44:37 +02:00
Sean Kim
a69bb2a7ce Refactor: Replace Paint brush density_seed storage
* Changes the field to be an optional<float> so that initialization is
  more clear
* Removes usage of `SCULPT_stroke_is_first_brush_step`

Pull Request: https://projects.blender.org/blender/blender/pulls/138955
2025-05-15 23:10:05 +02:00