Commit Graph

111607 Commits

Author SHA1 Message Date
Falk David
a5c4218b02 Fix: Outliner: Grease Pencil object filter
The filter for grease pencil objects wasn't showing up.
The code was still checking for the legacy type.
Now, we're checking for the right object type and
are also looking at the `bpy.data.grease_pencils_v3`
list to make the checkbox show up in the UI.
2024-07-19 18:01:47 +02:00
Sebastian Parborg
c09ed8a04f Fix: GPU resourses were not set to nullptr after deleting, resulting in heap-use-after-free
The code has nullptr checks to make sure it doesn't try to use freed or unitiallized variables.
However the when freeing the data, the code doesn't assign the pointer to be null.
Now set them to be null

Pull Request: https://projects.blender.org/blender/blender/pulls/125090
2024-07-19 17:44:22 +02:00
Richard Antalik
fc8660999a Cleanup: Make format 2024-07-19 17:17:56 +02:00
Nathan Vegdahl
9f944fe53c Fix: key insertion sometimes treats layered actions as legacy actions
When the Baklava experimental flag was disabled, attempting to insert
a key on a layered action would erroneously use the legacy action key
insertion code path. This was simply due to the condition for which
code path to use being incorrect.

This commit fixes that condition.

Pull Request: https://projects.blender.org/blender/blender/pulls/125055
2024-07-19 16:56:22 +02:00
Matthieu Carteron
3e12a6d622 Sound: Add channels and sample rate properties to mixdown operator
Previously, they were taken from the FFMPEG parameters, from the Output
panel, and this was not very convenient.

Co-authored-by: Matthieu Carteron <rubisetcie@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/124988
2024-07-19 16:33:54 +02:00
Clément Foucault
d2fdb22b93 GPU: Add support for in shader printf
This allows much easier debugging of shader programs.

Usage is as simple as adding `printf` calls inside shaders.
example: `printf("Formating %d\n", my_var);`

Contrary to the `drw_print`, this is not limited
to draw manager shader dispatch/draws. It is compatible
with any shader inside blender.
Most notably, this doesn't need a viewport to display.
So this can be used to debug render pipeline.

Data formating is currently limited to only `%x`, `%d`,
`%u` and `%f`. This could be easily extended if this is
really needed.

There is no type checking, so values are directly reinterpreted
as specified by the printf format.

The current approach for making this work is to bind a
storage buffer inside `GPU_shader_bind`, making it
available to any shader that needs it. The storage buffer
is downloaded back to CPU after a frame or a render
step and the content printed to the console.

This scheduling means that you cannot rely on these printfs
to detect crashes. We could add a mode to force flushing
at shader binding to avoid this limitation.

The values are written from the shaders in binary form and
only formated on the CPU. This avoid issues with manual
printing like with `drw_print`.

Pull Request: https://projects.blender.org/blender/blender/pulls/125071
2024-07-19 15:48:00 +02:00
Julian Eisel
fba6e050c2 Revert "Fix #120466: Crash when opening file with inactive asset browser"
Two issues:
- The `AS_asset_libraries_available()` function would always return
  true, because `AssetLibraryService::get()` would actually allocate the
  service if not available.
- The issue would still happen if another code path would call
  `AssetLibraryService::get()` after the service was destroyed, and
  before the UI data was destroyed. This was happening now, so the crash
  was back, see #124167.

I'm working on a new fix, for now, remove this broken one.
2024-07-19 15:03:50 +02:00
Richard Antalik
63db751cde Fix #124623: Strips are not deselected as expected
With 2.7x keymap, clicking on selected strips does not de-select others.

Seems to be caused by leftover code, when some selection functionality
was moved to `SEQUENCER_OT_select_handle`

Pull Request: https://projects.blender.org/blender/blender/pulls/124779
2024-07-19 13:13:32 +02:00
Philipp Oeser
71e1d795b3 Fix #124990: GP Draw mode always adds black color to a palette
Caused by fe0e2907b3

Prior to that commit, adding palette colors was only working because
`BKE_paintmode_get_active_from_context` was falling through to
`PaintMode::Texture2D` which then would do its thing in
`palette_color_add_exec`

To resolve, now respect `PaintMode::GPencil` as well there.

Pull Request: https://projects.blender.org/blender/blender/pulls/125062
2024-07-19 12:29:55 +02:00
Philipp Oeser
61b8397174 Modeling: remove unused Knife cut operator
This got superseeded by the "super knife" in 421823e34e 14 years ago
it seems, it cannot be executed atm. (and even if reactivated, it
crashes in multiple places).

Stumbled over this while checking on usages of
#BM_custom_loop_normals_to_vector_layer /
#BM_custom_loop_normals_from_vector_layer (to add this to more tools),
and apparently this outdated piece of code got an update in 93c8955a72
:) -- work on adding this to our "real" Knife is upcoming in another
PR...

Pull Request: https://projects.blender.org/blender/blender/pulls/124970
2024-07-19 11:42:30 +02:00
Jacques Lucke
8bf8542ffe Fix: missing node tree update after deleting library
Node trees have to be updated after remapping IDs in the node tree. This will,
among other things, create/delete sockets on group nodes. Furthermore, this also
tags the depsgraph so that objects that (indirectly) depend on the node group
output are reevaluated.

The tagging of node trees to update already happens in
`foreach_libblock_remap_callback_apply` for a while, the issue is that the
actual propagation of tagged changes does not happen currently.

I was checking this because Simon ran into some bug after deleting libraries. He
couldn't reproduce it anymore, but my best guess right now is that it is caused
by a missing update.

Pull Request: https://projects.blender.org/blender/blender/pulls/124980
2024-07-19 11:20:06 +02:00
Campbell Barton
d0b105f5fd Core: disable audio device for bpy module & headless builds
This was missing from [0] which changed the behavior in when setting
background mode from the command line.

[0]: 7c90018f23
2024-07-19 14:11:16 +10:00
Campbell Barton
0826cb9681 Unbreak WITH_HEADLESS builds 2024-07-19 14:11:14 +10:00
Harley Acheson
ef080a4219 UI: Icon Hover Brightness for Properties Items
Properties category icons with new SVG icons are slightly brighter than
before, and therefore do not seem to brighten on hover. This PR makes
them match exactly. Was assigning an alpha instead of multiplying. And
an earlier refactor for outlines made these icons not show initially
dimmer unless there is also an outline.

Pull Request: https://projects.blender.org/blender/blender/pulls/125029
2024-07-19 04:17:52 +02:00
Harley Acheson
3b4debd285 Revert #124938: Allow Back Button When File Browser Loaded in Workspace
This reverts #124938 & #124827, leaving File Browser as it was before,
without any extra ED_fileselect_set_params_from_userdef to ensure that
the previous_dir is populated with current directory. I have not found
a place to ensure this history is correct (when File Browser is part of
the layout) that does not cause unintended consequences. Will mark the
original bug report, #124771, as unresolved.

Pull Request: https://projects.blender.org/blender/blender/pulls/125019
2024-07-18 22:27:07 +02:00
Bastien Montagne
a62f1dc6cc Refactor: use new PartialWriteContext for copy of Material ID.
Fairly trivial conversion, since there is no complex handling of
dependencies currently in that case.

NOTE: Also fixes the 'not copying any material' issue also present in
4.2 (at least), but the proper way. For reference, see !125003 for a fix
for code using the deprecated partial write API.
2024-07-18 19:01:51 +02:00
Sean Kim
5bbf2f430a Refactor: Specialize flood_fill methods per PBVH type
Part of #118145.

The `flood_fill` functions are used for a number of different remaining
brushes and tools. It is unlikely that this particular implementation
is the most efficient way to solve the problems that the different
brushes pose, but further refactors to improve performance should
happen in future commits. For now this is a temporary solution to
remove usage of `PBVHVertRef` and related macros.

Pull Request: https://projects.blender.org/blender/blender/pulls/124830
2024-07-18 18:18:44 +02:00
Sean Kim
cb4aecca80 Cleanup: Restructure and add doxygen blocks to sculpt_boundary.cc
Part of #118145

This commit restructures sculpt_boundary.cc to improve readability and
aid in iteratively removing usages of PBVHVertRef.

Pull Request: https://projects.blender.org/blender/blender/pulls/124958
2024-07-18 18:12:14 +02:00
Sybren A. Stüvel
2fa7e7eda3 Anim: call RNA_POINTER_INVALIDATE() when deleting things from RNA
Call `RNA_POINTER_INVALIDATE()` when deleting action layers, strips,
channelbags, and slots.

Pull Request: https://projects.blender.org/blender/blender/pulls/124994
2024-07-18 17:52:06 +02:00
Sybren A. Stüvel
efbdc4e1fa Anim: ChannelBag F-Curve management functions (C++/RNA)
Add F-Curve management functions on ChannelBags
(`channelbag.fcurves.xxx`) that are very similar to the legacy Action
functions `Action.fcurves.xxx`.

```python
channelbag = strip.channelbags.new(slot)
fcurve = channelbag.fcurves.new("rotation_quaternion", index=1)
assert channelbag.fcurves[0] == fcurve
channelbag.fcurves.remove(fcurve)
channelbag.fcurves.clear()
```

Pull Request: https://projects.blender.org/blender/blender/pulls/124987
2024-07-18 17:06:12 +02:00
Aras Pranckevicius
7a260b761d Fix #124589: VSE meta/scene strip contents have misleading horizontal margins
To account for rounded corners, the meta/scene strip contents were
drawn with a horizontal margin on both strip sides. However this is
confusing and misleading, since it can look like the contents have
a frame gap between content start and parent strip start.

Instead, add vertical margins which do not have a possibility of
confusion with frame gaps.

Pull Request: https://projects.blender.org/blender/blender/pulls/124965
2024-07-18 16:48:52 +02:00
Bastien Montagne
8055b5d4f9 Core: PartialWriteContext: Fix handling of operations for dependencies.
Add an explicit mask in `IDAddOperations` for flags that are inherited
by default for dependencies of explicitely added data.

And refactor handling of per-id-usage flags returned by the
`dependencies_filter_cb` callback to also have a mask value defined in
`IDAddOperations`, as this is clearer and easier to maintain than a
constexpr hiddin in implementation code.
2024-07-18 15:59:44 +02:00
Nathan Vegdahl
9a28e1d1b8 Refactor: move fcurve methods from KeyframeStrip to ChannelBag
Semantically this is where those methods belong anyway, and it's needed
for upcoming work on the RNA API.

This also adds a method `KeyframeStrip::channelbag_for_slot_ensure()` to
make some of the things that used to be done with
`KeyframeStrip::fcurve_find_or_create()` less inconvenient in the face
of the latter moving to `ChannelBag::fcurve_find_or_create()`.

Pull Request: https://projects.blender.org/blender/blender/pulls/124973
2024-07-18 15:07:16 +02:00
Jacques Lucke
52ad896b35 Fix: Outliner: incorrect tooltip for delete library operator
Undo is supported for a while already.
2024-07-18 14:57:36 +02:00
Christoph Lendenfeld
6ef77a0d22 Anim: Deselect Keys before inserting new keys
This commit changes the keying code to deselect keyframes when inserting new keys.
This has been discussed in the Animation & Rigging module meeting [1].
There is also an RCS post about that [2].
Doing this brings key creation in line with object creation,
where only the newly created object is selected.
There has been a previous attempt [3] to do a similar thing.

### Changes
When inserting keys by pressing `I` in the viewport or choosing a keying set,
all keys of the `Action` get deselected before inserting new keys.
New keys are selected by default.
Python RNA functions are **NOT** affected, meaning addons using
those functions will not deselect any keys by default.
The developer has to choose to do so.
To make that easier, there is a new RNA function on the action
`deselect_keys`

[1]: https://devtalk.blender.org/t/2024-05-02-animation-rigging-module-meeting/34493#patches-review-decision-time-5
[2]: https://blender.community/c/rightclickselect/K0hbbc
[3]: https://archive.blender.org/developer/D11623

Pull Request: https://projects.blender.org/blender/blender/pulls/121908
2024-07-18 14:48:00 +02:00
Pratik Borhade
c7ecaf67fd Fix #124906: GPv3: Eraser crash when pressure is enabled
This is due to uninitialized `curve_strength` table. It is either
initialized for active tool or the eraser (if ctrl is held). So fix is
to choose correct brush in execute() function.

Also fix the inverted condition in begin() function to choose
eraser brush.

Pull Request: https://projects.blender.org/blender/blender/pulls/124975
2024-07-18 13:33:08 +02:00
Bastien Montagne
1144235e90 Cleanup: VSE Copy/Paste: Use new SET_CLIPBOARD_MARK operation. 2024-07-18 12:52:45 +02:00
Bastien Montagne
74a279ebc7 Cleanup: VSE copy/paste: Simplify namespace handling. 2024-07-18 12:52:45 +02:00
Bastien Montagne
7a87233c85 PartialWriteContext: add the 'clipboard mark' new operation option.
This is used by ID copy/paste code to detect which IDs from a copy/paste
buffer can be used as paste source.

Also slightly refactor implementation to handle both fake/extra ID user,
and clipboard mark in the same utils function.
2024-07-18 12:52:45 +02:00
Falk David
0c6365ecad Fix: GPv3: Crash switching to weight paint mode
The issue was that `BKE_paint_get_active_from_paintmode`
was called before `BKE_paint_ensure`.
2024-07-18 12:30:57 +02:00
Sebastian Parborg
81ee5c0313 Fix: VSE strip offsets were not drawn correctly
The code used a hack to work around a quirk that was fixed in 7b25d1327e.
Update the code to work properly (now also with sound offsets)

Pull Request: https://projects.blender.org/blender/blender/pulls/124972
2024-07-18 11:59:39 +02:00
Sybren A. Stüvel
7360ce4bcc Anim: add RNA code for ChannelBags
RNA API for creating & removing channelbags, as well as a path function
to construct RNA paths for channelbags.

```python
action = bpy.data.actions.new('TestAction')

slot = action.slots.new()
slot.name = 'OBTest'

layer = action.layers.new(name="Layer")
strip = layer.strips.new(type='KEYFRAME')

# New in this commit:
channelbag = strip.channelbags.new(slot)
strip.channelbags.remove(channelbag)
```

Pull Request: https://projects.blender.org/blender/blender/pulls/124793
2024-07-18 11:14:15 +02:00
Campbell Barton
5a29b16974 Cleanup: spelling in comments 2024-07-18 15:24:27 +10:00
Campbell Barton
5b2771cd0c Cleanup: replace copy-by-value with const reference
This was changed in [0] & [1] when replacing `float[3]` with `float3`.
However copying by value wasn't needed for the fix.

[0]: 7249b78b6b
[1]: efd3c4b3c9
2024-07-18 15:17:12 +10:00
Guillermo Venegas
604dc2cc33 Fix #124931: Fix crash dropping images in overlapping regions
Ref: !124921
2024-07-18 14:57:58 +10:00
Harley Acheson
e802fe1433 UI: Screen Area Docking Experimental Feature
Improvements to Area maintenance, adding the ability to move and dock
areas to any location, including between multiple windows. Allows
transitioning between splitting, joining, moving, and docking without
early commit. Improved visual feedback. Design Doc #124915. Added
as experiment feature.

Pull Request: https://projects.blender.org/blender/blender/pulls/123414
2024-07-18 02:47:32 +02:00
Sean Kim
7104813d31 Cleanup: Add copyright to sculpt_flood_fill.cc
Missed in 76a1e19

Pull Request: https://projects.blender.org/blender/blender/pulls/124942
2024-07-18 02:06:17 +02:00
Harley Acheson
0b70a9edc5 Fix: Do Not Reload File Browser Params in fileselect_refresh_params
Fix #124827 for Bug #124771 adds a call in fileselect_refresh_params to
ED_fileselect_set_params_from_userdef. But fileselect_refresh_params is
not just called from file_init but also file_refresh, which is far too
often and keeps some options from being selected. This moves
ED_fileselect_set_params_from_userdef directly to file_init.

Pull Request: https://projects.blender.org/blender/blender/pulls/124938
2024-07-18 01:28:31 +02:00
Harley Acheson
6240a36d18 Refactor: Icon Type ICON_TYPE_MONO_TEXTURE to ICON_TYPE_SVG_MONO
A rename of the icon type ICON_TYPE_MONO_TEXTURE to ICON_TYPE_SVG_MONO
to better reflect the underlying function. This new name makes a nice
matched set with new ICON_TYPE_SVG_COLOR used for SVG in full color.

Pull Request: https://projects.blender.org/blender/blender/pulls/123957
2024-07-17 22:15:09 +02:00
Harley Acheson
6145920a0d UI: Allow Use of Full-Color UI Icons
Allow the optional use of SVG UI icons shown in full color by
changing their definition from DEF_ICON to DEF_ICON_COLOR.

Pull Request: https://projects.blender.org/blender/blender/pulls/124696
2024-07-17 20:13:17 +02:00
Harley Acheson
a63a15527d Fix #124771: Allow Back Button When File Browser Loaded in Workspace
If File Browser is opened while embedded into a blender window, as
apposed to opened in a new window, some initialization is not done
and the current directory is not added to the list of previous
folders. Therefore the "back" button cannot bring you back to the
initial folder. This happens if your layout contains a File Browser
editor, like when selecting New / Video Editing. This PR just adds
`ED_fileselect_set_params_from_userdef` to `fileselect_refresh_params`,
which is called from `file_init()`.

Pull Request: https://projects.blender.org/blender/blender/pulls/124827
2024-07-17 17:54:13 +02:00
Bastien Montagne
3d3fb3dcce Fix: BKE: PartialWrite: Wrong define used in masked-in values.
`DUPLICATE_DEPENDENCIES` was wrongly used instead of `ADD_DEPENDENCIES`,
the former should be considered a non-modifiable option for a whole
'add' operation. But the per-ID-usage callback should be able to force a
dependency to be added or cleared.
2024-07-17 17:46:54 +02:00
Weizhen Huang
4000e1f2f2 Fix: EEVEE materials with three closures render black on MacOS
somehow the compiler is struggling with `default:` in `switch`, even if
it's never reached.
This fixes the discrepancy in the `principled emission alpha` test.

Pull Request: https://projects.blender.org/blender/blender/pulls/124889
2024-07-17 17:37:18 +02:00
Weizhen Huang
275d90f2b0 Fix: EEVEE missing break in switch case
this was working because the following cases overwrite the previous set,
but it's still better to have a `break`.
2024-07-17 17:27:16 +02:00
Bastien Montagne
da59808ce1 RNA: Add comment about recent change to references for extern'ed PropertyRNA.
Comment about why change from faf56cc3bf was needed, and what are the
consequences (regarding type aliasing).
2024-07-17 17:20:03 +02:00
Laurynas Duburas
85f8161ef7 Overlay-Next: Lattice
Overlay-Next version of Lattice.

Rel #102179

Co-authored-by: Clément Foucault <foucault.clem@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/123398
2024-07-17 16:49:38 +02:00
Laurynas Duburas
a412268980 Fix: Overlay-Next when multiple objects are click selected
Fixes Overlay-Next selection when multiple objects are hit.

To reproduce:
- enable "Ovlay Next" in Preferences>Experimental
- create any Empty object and duplicate it without moving
- try to select by clicking them

Crash occurs because `mixed_bones_object_selectbuffer` in `view3d_select.cc` expects that `view3d_opengl_select_ex` will append results to `buffer`. Depending on situation after several `view3d_opengl_select_ex`calls with decreasing radius it tries to `slice` results from buffer:
```c
has_bones9 = selectbuffer_has_bones(storage.as_span().slice(ofs, hits9));
```

Pull Request: https://projects.blender.org/blender/blender/pulls/124154
2024-07-17 16:07:15 +02:00
Hans Goudey
6c2e998e7f Cleanup: Sculpt: Avoid deformation flushing call for non-deforming tools 2024-07-17 09:57:25 -04:00
Hans Goudey
2f4926d6e7 Fix: Sculpt: Avoid unnecessarily creating layer displacement factor array
When using the persistent base feature, the separate array isn't necessary.
2024-07-17 09:57:25 -04:00
Jeroen Bakker
31a045ba15 Vulkan: Faster hashing of fragment shader
Improving performance as hashing the fragment shader was visible
in performance analysis. This PR calculates the hash once and stores
it inside the struct for quick access.

Pull Request: https://projects.blender.org/blender/blender/pulls/124882
2024-07-17 15:23:21 +02:00