Commit Graph

117289 Commits

Author SHA1 Message Date
Campbell Barton
256f3cd52f Fix missing call to va_end(..)
Own regression in [0] replacing BLI_dynstr with BLI_vsprintfN.

[0]: 6fbe467021
2025-02-05 19:00:05 +11:00
Campbell Barton
4083b9ce62 Cleanup: use a more specific name for NDOF's guide
Prepare for having a second guide (!129594).
2025-02-05 15:19:35 +11:00
Campbell Barton
c3a80b5b19 Fix driver "Update Dependencies" doing nothing
Regression in [0] which disabled the functionality for an unrelated
change.

[0]: ba3f26fac5
2025-02-05 14:45:57 +11:00
Campbell Barton
8f80e373a0 Cleanup: pass std::string arguments by reference instead of value 2025-02-05 14:38:56 +11:00
Campbell Barton
4ed5776990 Cleanup: avoid double precision loss when converting to/from floats 2025-02-05 14:38:56 +11:00
Campbell Barton
5add20a131 Cleanup: remove redundant checks 2025-02-05 14:38:56 +11:00
Campbell Barton
df3d1bf506 Cleanup: use const arguments & variables where appropriate 2025-02-05 14:38:56 +11:00
Campbell Barton
378e49059e Fix invalid null checks (caught by cppcheck)
Resolve two instances where values were null checked
after use.
2025-02-05 14:38:56 +11:00
Campbell Barton
77fca5b15a Fix 3D viewport depth calculation for comparison
Replace ED_view3d_calc_zfac with a matrix multiply because the "zfac"
is never negative and near zero values are set to 1.0.

This makes sense for tools & viewport logic that use the value for
division and don't handle negative values but not for depth comparison.
2025-02-05 12:27:13 +11:00
Campbell Barton
b02bbbdb37 Cleanup: rename "GL" selection to "DEPTH"
The reference to OpenGL is no longer relevant.
2025-02-05 11:21:50 +11:00
Campbell Barton
e9de621159 Docs: improve doc-string for OPTYPE_REGISTER
Include another example where the REGISTER flag is set without UNDO.
2025-02-05 11:14:32 +11:00
Campbell Barton
4186175af8 Cleanup: improve code-comments & naming for window decoration styles
- Expand on the code-comment regarding tests & WM_capabilities_flag and
  move it from the caller into the functions body since this is useful
  for other callers, also mention in the doc-string.
- Use a common prefix for `WM_window_decoration_style_*` functions.
- Add a doxy-section for decoration style functions.
2025-02-05 10:56:54 +11:00
Campbell Barton
bc6dc89d50 Cleanup: quiet check_spelling_* warnings, use doxygen doc-strings 2025-02-05 10:29:00 +11:00
Julian Eisel
2d90ab9eca Fix: Deadlock when generating asset catalog tree after file-load
Partial fix for #130007.

The catalog tree mutex would be set in `catalog_tree()` and
`invalidate_catalog_tree()`. The former could end up adding catalogs and thus
calling `invalidate_catalog_tree()`, which would attempt to set a mutex that the
caller set already. This seems like a good use-case for `std::recursive_mutex`.

would make sure there's a catalog for each catalog path by calling
`create_missing_catalogs()`
2025-02-05 12:50:09 +01:00
Nicola
6f80dba66c Sculpt: Add 'Plane' brush type
This patch introduces the `Plane` brush, a generalization of the
existing `Flatten`, `Fill` and `Scrape` brushes, with the objective of
providing more flexibility when sculpting.

This brush has the following key features:
* `Height` and `Depth` parameters to control the range of the brush in
  the local z-axis.
* Stabilizers for the normal and center of the brush plane.

When inverting, the user can choose between two options:
* `Invert Displacement`: Identical to the existing behavior, displacing
  vertices away from the plane.
* `Swap Height and Depth`: Exchanges the roles of `Height` and `Depth`.
  For example a brush with `Height` = 0.7 and `Depth` = 0.3 behaves as
  if it had `Height` = 0.3 and `Depth` = 0.7. In particular, this
  ensures that a scrape brush (`Height` = 1, `Depth` = 0) becomes
  equivalent to a fill brush (`Height` = 0, `Depth` = 1)  when inverted,
  and viceversa.

In the existing planar brushes, the influence on a vertex is determined
by the 3D Euclidean distance between the vertex and the cursor position,
multiplied by the vertex's distance from the brush plane (and other
factors common to all brushes).

In the `Plane` brush, the 3D distance is between the vertex and the
plane center instead of the cursor position.

The Plane brush introduces two parameters — `Stabilize Normal` and
`Stabilize Plane`. These can be thought of as the non-binary version of
the `Original Normal` and `Original Plane` options found in existing
brushes. These values are a weighted moving average across a window of
previous stroke steps.

Pull Request: https://projects.blender.org/blender/blender/pulls/132723
2025-02-04 22:38:23 +01:00
Clément Foucault
6f9dedcdc4 Fix #134011: Overlay: Wireframe with object color isn't shown selected
This was an oversight and the shader was using the old API.
2025-02-04 19:19:55 +01:00
Hans Goudey
fc1fe4e78c Cleanup: Rename object materials "test" functions
"test" wasn't descriptive. Rename that part to "sync_length".
Also expose documentation from the function implementation
to describe what the functions do.

Pull Request: https://projects.blender.org/blender/blender/pulls/134058
2025-02-04 17:46:08 +01:00
Falk David
b760c5d6ef Cleanup: Grease Pencil: Add comments about attributes assumptions
In some places of the code we expect some attributes to not exist
and therefore always be created successfully.
2025-02-04 17:42:23 +01:00
Sybren A. Stüvel
7bb4611e50 Fix: compiler warning for case-fallthrough
No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/134057
2025-02-04 17:41:57 +01:00
Nathan Vegdahl
33b9d54abb Anim: add RNA Channelbag.slot property
This allows Python scripts to easily determine what Slot a Channelbag is
for. This is particularly important because we're trying to discourage
the use of Slot handles in the Python APIs, and before this the only
way to identify which Slot a Channelbag was for was via the Channelbag's
`slot_handle` property.

Pull Request: https://projects.blender.org/blender/blender/pulls/134053
2025-02-04 17:39:03 +01:00
Julian Eisel
21e626ced3 Refactor: Assets: Improve asset system APIs for asset operators
Brush and pose asset operators were doing some avoidable roundtrips
through asset types, lookups and rather low level operations. This
indicates that the asset system APIs need some improvements. Moving
lower-level logic there can help avoiding errors, since implementation
details are kept inside the corresponding module.

- Avoid lookups for asset library reference in operator code, make asset
  library itself construct it.
- Avoid redundant lookups for asset library definition (was looking up
  the asset library definition in the Preferences from the library
  reference type, just to turn it into the reference type again).
- Add utility for refreshing loading asset libraries
- Add utility for saving asset catalogs for an asset
- Remove unused function
2025-02-04 17:28:23 +01:00
Sybren A. Stüvel
134a846d14 Fix: Anim, crash when deleting both action slot and F-Curve group
Fix a crash that happened when trying to delete an action slot and an
F-Curve group contained within it.

Pull Request: https://projects.blender.org/blender/blender/pulls/134048
2025-02-04 17:09:11 +01:00
Nathan Vegdahl
c4e2e09c65 Cleanup: Anim: rename identifier_prefix_for_idtype to idtype_string
The previous name was confusingly similar to the new method
`identifier_prefix()` that was introduced in #133983. This new name
better distinguishes them while also reflecting its actual functionality
better and being shorter.

Pull Request: https://projects.blender.org/blender/blender/pulls/134046
2025-02-04 16:55:22 +01:00
Jeroen Bakker
3d20d39115 Cleanup: Vulkan: Use is_link_to_buffer
Previous implementation used the resource state tracker which is a hash
table lookup. `is_link_to_buffer` is a bit cheaper as it is compares
already loaded data.
2025-02-04 16:28:46 +01:00
Jonas Holzman
ce42d92503 macOS: Colored Titlebar and WM Window Decoration Styles API - GSoC 2024
As part of the GSoC 2024 project "Improvements to the Blender macOS User
Interface Experience" [1], this patch implements colored titlebar window
decorations on macOS, based on the current Blender theme colors.

Additionally, this patch introduces a new WM/GHOST API for implementing
and enabling custom decoration styles on any system/desktop environment
that support customizing window decorations.

[1]: https://devtalk.blender.org/t/gsoc-2024-proposal-improvements-to-the-blender-macos-user-interface-experience/34022)

Pull Request: https://projects.blender.org/blender/blender/pulls/123982
2025-02-04 16:18:19 +01:00
Sybren A. Stüvel
2b5946da4e Anim: make copy-paste of keyframes slot-aware
Copy-paste of keyframes is now slot-aware. See [1] for the design.

[1]: https://developer.blender.org/docs/features/animation/tools/action-editor-copy-paste/

In short:

- Copy-paste still works broadly as it used to. Only the visible
  F-Curves are pasted into.
- Slot identifiers matter when copying from multiple slots. When
  copying from one slot, they don't.
- Selection of channels (either F-Curves or Slots) determines where
  keys get pasted into.
- Pasting will either copy from the slot with the same identifier
  (when identifiers matter), or paste whatever was copied (when they
  do not).
- If both F-Curves and slots are selected, only the selected F-Curves
  get pasted into, and slots without any selected F-Curves are ignored
  (i.e. target is only defined by selected F-Curves, or only by
  selected slots, never by a mixture).

Fixes #129690

Pull Request: https://projects.blender.org/blender/blender/pulls/133979
2025-02-04 16:12:57 +01:00
Brecht Van Lommel
f5dd13826d Fix: Conflict between bpy.app.translations and PySide
Some versions of PySide give errors when imported together with
bpy.app.translations, because the latter uses a tp_name that does not
exist. The only other tp_name we have with a dot in it (bgl.Buffer)
does exist.

Pull Request: https://projects.blender.org/blender/blender/pulls/134033
2025-02-04 16:03:40 +01:00
Sybren A. Stüvel
c7900cc905 Fix: #125354: Assert with box/lasso select in driver editor
The box/lasso select code called `evaluate_fcurve()` to evaluate the
driver F-Curve, which is not meant for drivers. It now calls
`evaluate_fcurve_only_curve()`, which is meant for this purpose (only
evaluates the F-Curve part of the F-Curve, and ignore the driver).

Pull Request: https://projects.blender.org/blender/blender/pulls/134042
2025-02-04 16:03:01 +01:00
Nathan Vegdahl
f84197f0b9 Anim: ensure correct type prefix when setting Slot.identifier
Previously it was possible to make the type prefix of a Slot's identifier get
out-of-sync with its actual target ID type, by setting the identifier via
Python.

This PR changes `Slot.identifier` assignment to ensure that the type prefix is
set to match `target_id_type`. This now makes it impossible for the identifier
prefix and `target_id_type` to get out of sync, since this API previously was
the only way to accomplish that.

When the prefix that the user attempts to set doesn't match the `target_id_type`
of the Slot, a warning is issued telling the user about the mismatch and that
the identifier has been set with the correct prefix instead.

Pull Request: https://projects.blender.org/blender/blender/pulls/133983
2025-02-04 15:46:22 +01:00
Julian Eisel
0be16983eb Cleanup: Correct asset function comment
Was from an earler version of blender/blender!131871.
2025-02-04 15:31:32 +01:00
Sebastian Parborg
c952b12a6e Sound: Sync up the screen refresh timer to the audio when seeking
This fixes the case when the screen update timer would not be reset
when seeking leading to screen updates happening mid frame.
For example when jumping to a keyframe during playback.

Note that this doesn't reset the timer when no audio is playing.
It would be nice to have it happen there as well. But it is probably not
too noticeable.

Pull Request: https://projects.blender.org/blender/blender/pulls/133542
2025-02-04 15:30:20 +01:00
Julian Eisel
7684bbedb8 Fix: Assets: Previews of local IDs not showing in asset shelf
Previews for data-blocks in the current file might not have had an
icon-ID generated when we request the preview for display. Mistake in
7acd7e1246.
2025-02-04 15:24:09 +01:00
Julian Eisel
9a8779e0d8 Fix #134025: Crash displaying asset from current file in asset shelf
Missing return, mistake in 7acd7e1246.
2025-02-04 15:09:52 +01:00
Hans Goudey
73b25ba12e Cleanup: Use StringRef for some WM and UI APIs
Instead of const char * or StringRefNull.

Pull Request: https://projects.blender.org/blender/blender/pulls/134004
2025-02-04 13:53:30 +01:00
Nathan Vegdahl
eda2f11f7a Anim: change RNA Action.id_root to have backwards-compatible behavior
Most of the old Animato properties on an Action (e.g. FCurve list, Channel
Groups) already act as proxies for the data for the first slot in the first
strip of the first layer. (Say that three times fast!) However, this was not yet
the case for `Action.id_root`.

This PR changes `Action.id_root` to act as a proxy for the first Slot's
`target_id_type` property, both for reading and writing.

If the Action has no Slots, then reading always returns 'UNSPECIFIED', and
writing will create a Slot and set its `target_id_type`.

Note that the ability to write to the first Slot's `target_id_type` via
`Action.id_root` conflicts with `target_id_type` supposedly only being writable
when it's still 'UNSPECIFIED' (#133883). Although that's certainly a little
weird, practically speaking this doesn't break anything for now, and is a
temporary kludge to keep `id_root` working until we can remove it in Blender
5.0. `id_root` will be removed entirely in 5.0, resolving this inconsistency.

Pull Request: https://projects.blender.org/blender/blender/pulls/133823
2025-02-04 13:39:50 +01:00
Jeroen Bakker
aa535f1a5f Cleanup: Vulkan: Remove resource locking when reordering nodes
This PR changes the resource locking when reordering render graph
nodes. Reordering could be done without locking resources. No measurable
speedup detected.

Pull Request: https://projects.blender.org/blender/blender/pulls/134032
2025-02-04 13:24:01 +01:00
YimingWu
c4b4d62d96 Fix #129706: Guess keymap context from properties space
`WM_keymap_guess_from_context` did not handle properties space. This
simple fix made it respond the same way as if the current space is 3D
viewport, this enables brush asset sortcut assigning from tool
properties tab.

Pull Request: https://projects.blender.org/blender/blender/pulls/129717
2025-02-04 13:23:11 +01:00
Pratik Borhade
97a1b9b473 Fix #134003: Grease Pencil: Deleting vgroup shifts other vgroup content
`def_nr` is decremented twice, this results in shuffling of vgroupdata.
`remove_from_vertex_group` should only deal with weights and not tweak
`def_nr` as defgroup name index is updated in `remove_defgroup_index`
after deletion of selected vgroup. So just remove the code from
`remove_from_vertex_group`.

Pull Request: https://projects.blender.org/blender/blender/pulls/134015
2025-02-04 12:40:44 +01:00
Christoph Lendenfeld
358a0479e8 Anim: create pose assets to different libraries
Similar to how brush assets are created and managed this
PR allows to export pose assets into a different library.
Because of this there is a limitation to this where each
asset is stored in a separate blend file.
This may be lifted in the future as there are planned changes in
the design phase: #122061

### Create Asset

Now available in the 3D viewport in the "Pose" menu: "Create Pose Asset".
The button in the Dope Sheet will now call this new operator as well.

Clicking either of those will open a popup in which you can:

* Choose the name of the asset, which library and catalog it goes into.
* Clicking "Create" will create a pose asset on disk in the given library.

It is possible to create files into an outside library or add it in the current file.
The latter option does a lot less since it basically just creates the
action and tags it as an asset.

If no Asset Shelf **AND** no Asset Browser is visible anywhere in Blender,
the Asset Shelf will be shown on the 3D viewport from which
the operator was called.

### Adjust Pose Asset

Right clicking a pose asset that has been created in the way described
before will have options to overwrite it.
Only the active object will be considered for updating a pose asset

Available Options (the latter 3 under the "Modify Pose Asset" submenu):
* Adjust Pose Asset: From the selected bones, update ONLY channels that
are also present in the asset. This is the default.
* Replace: Will completely replace the data in the Pose Asset from
the current selection
* Add: Adds the current selection to the Pose Asset. Any already existing
channels have their values updated
* Remove: Remove selected bones from the pose asset

Currently this refreshes the thumbnail. In the case of custom
thumbnails it might not be something want

### Deleting an existing Pose Asset

Right click on a Pose Asset and hit "Delete Pose Asset". Works in the shelf
and in the asset library. Doing so will pop up a confirmation dialog,
if confirming, the asset is gone forever. Deleting a local asset is basically the
same as clearing the asset. This is a bit confusing because you get
two options that basically do the same thing sometimes,
but "Delete" works in other cases as well.
I currently don't see a way around that.

Part of design #131840

Pull Request: https://projects.blender.org/blender/blender/pulls/132747
2025-02-04 11:29:05 +01:00
Campbell Barton
007d46ef6d Cleanup: rename "opengl" to "gpu" for 3D viewport utilities 2025-02-04 21:19:28 +11:00
Campbell Barton
972a8c7b76 Cleanup: unused window argument to view3d_region_operator_needs_opengl 2025-02-04 21:17:10 +11:00
Pratik Borhade
ac27bd16db Fix: Grease Pencil: Debug build error when armature is parent
Error is about accessing value of nullopt optional `vert_coords_prev`.
This occurs when armature is parented to grease pencil object.

Pull Request: https://projects.blender.org/blender/blender/pulls/134016
2025-02-04 11:12:40 +01:00
Jeroen Bakker
d486c8f655 Fix: Image Engine: Incorrect size push constant
Detected when running OpenGL compositor tests. The far near distances
push constant only attached a single float in stead of two. Fixed by
using float2.

Pull Request: https://projects.blender.org/blender/blender/pulls/134019
2025-02-04 09:50:01 +01:00
Jeroen Bakker
7f04a4fef3 Fix: Vulkan: Stalling shader compilation
This PR fixes an issue that shaders compilation could stall. This could
be seen in the viewport (sometime not showing first EEVEE render) but
was more prominent when running test cases.

Pull Request: https://projects.blender.org/blender/blender/pulls/134020
2025-02-04 09:49:28 +01:00
Philipp Oeser
2a9b3573f5 Fix #131830: context.property missing prefix to struct
Caused by 59dc67974a

The behavior of `RNA_path_from_ID_to_property` /
`RNA_path_from_ID_to_property_index` is that it only gets the "prefix"
of the struct -- the one we are looking for, the one that is missing
here -- if we feed it the `newptr` since it calls
`RNA_path_from_ID_to_struct(ptr)` to get that prefix.
If we feed it the **ID** pointer it will be empty (makes sense it would
basically be "path from ID to ID"...we need it to be "path from ID to
constraint").

Pull Request: https://projects.blender.org/blender/blender/pulls/133977
2025-02-04 09:37:35 +01:00
Omar Emara
e53ac805af Compositor: Avoid redundant output computations
This patch allows the compositor context to specify exactly which
outputs it needs, selecting from: Composite, Viewer, File Output, and
Previews. Previously, the compositor fully executed if any of those were
needed, without granular control on which outputs are needed exactly.

For the viewport compositor engine, it requests Composite and Viewer,
with no Previews or File Outputs.

For the render pipeline, it requests Composite and File Output, with
node Viewer or Previews.

For the interactive compositor, it requests Viewer if the backdrop is
visible or an image editor with the viewer image is visible, it requests
Compositor if an image editor with the render result is visible, it
requests Previews if a node editor has previews overlay enabled. File
outputs are never requested.

Pull Request: https://projects.blender.org/blender/blender/pulls/133960
2025-02-04 08:34:48 +01:00
Campbell Barton
46e393e9b8 Refactor: pass in context arguments to view3d minmax functions
Remove the bContext argument from view3d_calc_minmax_{visible/selected},
this ensures only input arguments are used.
2025-02-04 18:14:00 +11:00
Sean Kim
8911d7136c Fix: BRUSH_INVERT_TO_SCRAPE_FILL flag applies for too many brushes
The `BRUSH_INVERT_TO_SCRAPE_FILL` check inside `brush_flip` applies to
any brush instead of just the Fill and Scrape brush, this means that if
an asset is in a weird state where the user has enabled this flag but
switched away from the brush type, the flag still applies even though
the option is no longer visible.

This commit checks the brush type to ensure it only applies to the
specified types.

Pull Request: https://projects.blender.org/blender/blender/pulls/134014
2025-02-04 07:10:00 +01:00
Campbell Barton
ebc918c717 Cleanup: use "ndof_" prefix for RegionView3D rotation & angle
These values are only ever used by NDOF, name them accordingly.
2025-02-04 15:20:32 +11:00
Campbell Barton
95393726b0 Cleanup: quiet check_spelling_* warnings 2025-02-04 14:43:20 +11:00