Commit Graph

105543 Commits

Author SHA1 Message Date
Ray Molenkamp 079a752a20 CMake: windows: disable vcpkg for blendthumb
vcpkg was once more sticking its libraries where
we do not want them. Hopefully this will be the
last of it.
2023-12-22 13:35:51 -07:00
Jeroen Bakker ac1c75f3d0 Vulkan: Check Resource Bind Type when Binding
GPU module assumes that image and textures uses different bind
namespaces. In Vulkan this isn't the case, leading that some shaders
generate incorrect bind types, when the state has bindings that are not
used by the shader, but would conflict due to namespace differences.

This PR will only return the binding when after validating it is from
the expected namespace. This removes several validation warnings.

This was done in order to debug EEVEE using modern toolsets. These
toolsets don't support OpenGL and we use Vulkan as a workaround if
possible.

Pull Request: https://projects.blender.org/blender/blender/pulls/116465
2023-12-22 19:02:53 +01:00
Brecht Van Lommel ec01ee0196 Fix #116471: some menus incorrectly display vertical on macOS
Take into account retina pixel size for estimating window width when
checking if the menu fits.
2023-12-22 18:23:32 +01:00
Jacques Lucke f824476bd5 UI: add support for uiLayout based panels
This adds support for so called "layout panels" which are panels that are created as part
of `uiLayout`. The goal is to make it easier to have expandable sections as part of a UI.

The initial use case for this are panels in the geometry nodes modifier. This patch provides
a better solution compared to what was attempted in #108565.

### Problems with Existing Approaches

Currently, there are two ways to create these expandable sections:
* One can define a new `Panel` type for each expandable section and use the `parent_id`
  to make this a subpanel of another panel. This has a few problems:
  * `uiLayout` drawing code is more scattered, because one can't just use a single function
    that creates the layout for an entire panel including its subpanels.
  * It does not work so well for dynamic amounts of panels (e.g. like what we need for
    the geometry nodes modifier to organize the inputs).
  * Typically, Blender uses a immediate-ui approach, but subpanels break that currently
    and need extra handling.
  * The order of panels is not very explicit.
  * One can't interleave subpanels and other ui elements, subpanels always come at the
    end of the parent panel.
* Custom solution using existing `uiLayout`. This is done in the material properties. It
  also has a few problems:
  * Custom solutions tend to work slightly different in different places. So the UI is less unified.
  * Can't drag open/close multiple panels.
  * The background color for subpanels does not change.

### Solution

A possible solution to all of these problems is to add support for panels to `uiLayout` directly:
```cpp
/* Add elements before subpanel. */
if (uiLayout *panel_layout = uiLayoutPanel(layout, ...)) {
  /* Add elements in subpanel, but only of the panel is open. */
}
/* Add elements after subpanel. */
```

Integrating subpanels with `uiLayout` has some benefits:
* Subpanels are treated like any other sub-layout and don't have unnecessary boilerplate.
* It becomes trivial to have a dynamic number of potentially nested subpanels.
* Resolves all mentioned problems of custom subpanel solutions.

### Open/Close State

The most tricky thing is to decide where to store the open/close state. Ideally, it should
be stored in the `region` because then the same layout panel can be opened and closed
in every region independently. Unfortunately, storing the state in the region is fairly
complex in some cases.

For example, for modifier subpanels the region would have to store an open/close state
for each panel in each modifier in each object. So a map with
`object pointer + modifier id + panel id` as key would be required. Obviously, this map
could become quite big. Also storing that many ID pointers in UI data is not great and
we don't even have stable modifier ids yet. There also isn't an obvious way for how to
clear unused elements from the map which could become necessary when it becomes big.

In practice, it's rare that the same modifier list is shown in two editors. So the benefit of
storing the open/close state in the region is negligible. Therefor, a much simpler solution
is possible: the open/close state can be stored in the modifier directly. This is actually
how it was implemented before already (see `ui_expand_flag`).

The implementation of layout panels in this patch is *agnostic* to how the open/close
state is stored exactly, as long as it can be referenced as a boolean rna property. This
allows us to store the state in the modifier directly but also allows us to store the state
in the region for other layout panels in the future. We could consider adding an API that
makes it easy to store the state in the region for cases where the key is simpler.
For example: `uiLayoutPanel(layout, TIP_("Mesh Settings"), PanelRegionKey("mesh_settings"))`.

### Python API (not included)

Adding a Python API is fairly straight forward. However, it is **not** included in this patch
so that we can mature the internal API a bit more if necessary, before addon developers
start to depend on it. It would probably work like so:

```python
if panel := layout.panel("Mesh Settings", ...):
    # Add layout elements in the panel if it's open.
```

Pull Request: https://projects.blender.org/blender/blender/pulls/113584
2023-12-22 17:57:57 +01:00
Miguel Pozo 831dd3500e Fix #116403: Workbench: Broken overlays with clipping planes
Workbench only outputs depth when overlays are enabled, but
some overlay passes can be rendered even with overlays disabled.

Pull Request: https://projects.blender.org/blender/blender/pulls/116441
2023-12-22 17:48:39 +01:00
Miguel Pozo a90fdd5246 Fix #115226: Shader Nodes: Don't execute the same node twice
Allow to share nodes between the main shader and multiple AOVs,
since they are executed in the same function.
2023-12-22 17:32:25 +01:00
Hans Goudey 0f2e534674 Fix #115046: Crash updating string custom property UI data
`PyArg_ParseTupleAndKeywords` does not initialize variable corresponding
to optional arguments that aren't passed by Python. Thanks to Germano for
initial investigation.
2023-12-22 09:16:19 -05:00
Pratik Borhade 239d3bb04b Fix #116320: Crash assigning bone to collection of other armature
`Move to collection` popup shows collections of active armature. So when
bone of "non-active" armature is selected, crash will be triggered after
assigning it a bone-collection of active armature.
To fix the crash, remove multi-object editing code since it's only
possible to operate on active armature/object

Pull Request: https://projects.blender.org/blender/blender/pulls/116328
2023-12-22 12:31:52 +01:00
Omar Emara 7a8e349b73 Compositor: Support viewer offset in GPU compositor
This patch adds support for viewer offsets in the experimental GPU
compositor.
2023-12-22 13:12:17 +02:00
Jeroen Bakker 45582662a1 EEVEE-Next: Fix Pointshader Requirements
The Metal and Vulkan backend checks if the vertex shader uses
`gl_PointSize` in order to set the correct parameters for point
rendering. The `eevee_deferred_tile_compact` shader uses point
rendering, but is only used as dummy geometry. The vertex
shader ignored the incoming input data, but didn't set the
`gl_PointSize` which generated incorrect shader pipelines.

It was detected on Vulkan, but Metal uses a similar workaround.

Pull Request: https://projects.blender.org/blender/blender/pulls/116463
2023-12-22 11:48:47 +01:00
Sybren A. Stüvel 3e6139cc30 Anim: RNA, mark `armature.collections` as editable
By setting the RNA property flag `PROP_EDITABLE` on `armature.collections`,
the UIList understands that it's editable and will show "Double click to
rename" in the tooltip.

Note that this does not make the array itself editable; assignment like
`collections[0] = collections[1]` will still be refused.
2023-12-22 09:06:49 +01:00
Brecht Van Lommel 3443ded9df Fix: bf_animrig_tests test failure
Zero initialize mock data to avoid uninitialized variable access.

Pull Request: https://projects.blender.org/blender/blender/pulls/116451
2023-12-21 23:31:36 +01:00
Hans Goudey 78c3253553 Fix #116069: Incorrect data transfer custom normals behavior
Mistake in 89e3ba4e25 and 451c054d9b. Though I'm not
exactly sure why, it looks like the result layer needs to be filled with
"default" values before the transfer.
2023-12-21 14:54:22 -05:00
Hans Goudey 48b0a504b4 Cleanup: Remove unnecessary argument in mesh normals code
This function is only used in one place, and the argument was constant.
2023-12-21 14:54:22 -05:00
Harley Acheson 341c54ce21 Fix #116415: Show Empty text for Current Asset Library
Show "No items" if item count is less than one, to include situations
where it is -1

Pull Request: https://projects.blender.org/blender/blender/pulls/116446
2023-12-21 20:09:29 +01:00
Christoph Lendenfeld bf96f6cda9 Fix: failing unit tests due to "stack-use-after-scope"
The return value of `get_rotation_mode_path` was stored in a
`blender::StringRef` which caused the memory of the string to
be freed to early.

Fix by returning a `blender::StringRef`

Interestingly this seems to be only an issue on ASAN builds.

Pull Request: https://projects.blender.org/blender/blender/pulls/116434
2023-12-21 19:40:45 +01:00
Omar Emara 9bbe81b630 Fix #116432: Crash when changing source of image node
Blender crashes when changing the source of the image node to Generated
then to something else, then making any changes to the image. This is
just due to a nullptr GPU texture.

This is because Blender resets the path of the image when changed to
Generated source.
2023-12-21 20:20:37 +02:00
Brecht Van Lommel 802ac5ba5a Build: Library updates for 4.1
Update libraries to match VFX platform 2024, and a few other upgrades to
latest versions.

boost 1.82.0
deflate 1.18 (new)
ffi 3.4.4
freeglut (deleted)
ispc 1.12.1
llvm 17.0.6
materialx 1.38.8
mesa 23.3.0
numpy 1.24.3
opencolorio 2.3.0
openexr 3.2.1
openimageio 2.5.6.0
opensubdiv 3.6.0
openvdb 11.0.0
osl 1.13.5.0 (now dynamic)
python 3.11.6
sqlite 3.42.0
sse2neon 0d6e9b3dd4
usd 23.11
vulkan 1.3.270
xm2 2.12.3

This only updates the build scripts, the precompiled libraries for each
platform will land over the coming weeks.

Ref #113157

Co-authored-by: Ray Molenkamp <github@lazydodo.com>
Co-authored-by: Campbell Barton <campbell@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/116420
2023-12-21 19:16:11 +01:00
Miguel Pozo e8c5f8dddf Fix #116424: GPU Nodes: UDIM texture user count
Count texture and mapping as a single user.
2023-12-21 18:55:32 +01:00
ok_what 04efca91f9 Fix: VSE Slip Strips operator doesn't move effect strips inside of a meta strip.
When slipping meta strip, effect position was not updated. These updates
are limited to VSE core code, so function `SEQ_time_slip_strip()` was
added to resolve this issue.

This also simplifies operator code, so it does not have to deal with
recursion and doesn't need to hold quite detailed strip state for when
operator is cancelled.

Pull Request: https://projects.blender.org/blender/blender/pulls/113200
2023-12-21 18:04:56 +01:00
Harley Acheson 548b45d13b Revert #116228: Check Interactivity in button comparisons
Revert of 5741f7b8a9 as this has caused issues as reported in #116384
and #116426.

Pull Request: https://projects.blender.org/blender/blender/pulls/116437
2023-12-21 17:08:47 +01:00
Hans Goudey 66409b3860 Fix #116372: Crash in boolean triangulation after recent cleanup
Missing array initialization in 34bf1f6c0c.
2023-12-21 11:00:32 -05:00
Hans Goudey ebb9cf21ec Fix: Incorrect curves asset in recent commit
Mistake in f63a7c1ee9
2023-12-21 10:54:26 -05:00
Hans Goudey da6867ca3b Cleanup: Use dynamic declaration for sample curve node
Change the attribute "value" sockets to use dynamic declarations, but
not the others. See 8149678d5e, f7383cfe9b.
2023-12-21 10:34:55 -05:00
Christoph Lendenfeld 84c65732fe Refactor: extract code from ANIM_keying_sets_enum_itemf
No functional changes.

Split off from: #116189

Extract code to build the keying set menu from
`ANIM_keying_sets_enum_itemf`
to be able to later use the same code from a different menu
function so the label can be changed.

Pull Request: https://projects.blender.org/blender/blender/pulls/116332
2023-12-21 16:15:42 +01:00
Sybren A. Stüvel eac4a6c697 Anim: add checks for system overrides to bone collection operators
Editability checks shouldn't just check for linked data & library
overrides, but also for the type of library override. A "system
override" should still not be editable by users.

This fixes #115310: Bone collections can be added to system-overridden
(i.e. non-user-editable) armatures
2023-12-21 14:58:30 +01:00
Omar Emara dea7d65ee7 Fix: Crash in single value input to Glare node
The Glare node crashes in the full-frame compositor when its input is a
single value. Since the Glare node is constant foldable, do not inflate
its input and instead output a single value.
2023-12-21 14:48:33 +02:00
Omar Emara e055db6605 Realtime Compositor: Implement Defocus node
This patch implements the defocus node for the Realtime Compositor. The
implementation does not match the CPU compositor implementation, but
uses a new formulation that is more physically accurate and consistent
with Blender's render engines.

The existing CPU implementation is questionable starting from its circle
of confusion calculation, to the morphological operations applied on the
CoC radius, to ignoring the maximum CoC radius in the search kernel, and
ending with the threshold parameter used to reduce artifacts. Therefore,
it should be reimplemented along with this same implementation using a
more consistent methodology.

EEVEE and Workbench already have a GPU defocus method, which can be
ported to the compositor and used as the preview defocus algorithm.
While this implementation will be updated to be a more accurate method
that produces the same structure as the ported EEVEE implementation.

The new formulation ignores the threshold parameter for now, as well as
the preview parameter.

Pull Request: https://projects.blender.org/blender/blender/pulls/116391
2023-12-21 12:20:38 +01:00
Falk David da78dd47e3 Fix #116343: Drawing on frame with auto-keying off gives error
When drawing on a frame that didn't have a keyframe, but did have a drawing,
Blender would report that there was no drawing to draw on.
The issue was some faulty logic on the invoke of the drawing code.

Now, this properly checks if a new frame needs to be inserted and
only reports an error in case auto-key is off and there is no drawing.

Pull Request: https://projects.blender.org/blender/blender/pulls/116417
2023-12-21 12:10:50 +01:00
Falk David 89947aac1c Cleanup: Non-const version of `get_active_layer` 2023-12-21 11:09:23 +01:00
Christoph Lendenfeld 614d7749df Fix: Autokeyframe with Insert Needed with no keyframes
The issue occurs when auto-keyframe AND "Only Insert Needed" enabled.
And only when no keyframes have been added yet.

Before the commit that caused the issue, moving an object with `G` would
create only location keyframes. After it would key all.
That is because that commit removed the logic that checks the
`eTfmMode` (Transform mode). That only works as long as there are already
keyframes on the object/bone because the logic needs an
existing value to compare against. In the case where the first keyframe is set,
it would always key everything.

The fix is to bring back the logic that checks the Transform mode and pass
a `Span` of rna paths to the autokeyframe function. This restores the behavior.

This still has the issue that "Only Insert Needed" behaves differently if
keys exist vs inserting the first keys. While this isn't ideal, I don't see a way
to get values of an object/bone before and after the transformation.
We might be able to fix this in a future PR, but for now we restore the
old behavior.

Caused by #115522

Pull Request: https://projects.blender.org/blender/blender/pulls/116219
2023-12-21 10:50:17 +01:00
Christoph Lendenfeld b27718a9e7 Anim: Graph Editor Scale From Neighbor
Combination of two operators by Ares Deveaux
#106524 and #106523

Introduces a new operator "Scale from Neighbor"
that scales selected keyframe segments from either
the left or right keyframe neighbor.

Pressing "D" during modal operation will switch
from which end of the segment the scaling happens.

This is useful to make a section of animation closer to a pose on either side.

Co-authored-by: Ares Deveaux <aresdevo@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/112387
2023-12-21 10:46:43 +01:00
Omar Emara e165624885 Compositor: Only execute compositor if result is viewed
This patch makes it such that the compositor only executes when its
result is viewed either through the backdrop or through an image editor.

Pull Request: https://projects.blender.org/blender/blender/pulls/116326
2023-12-21 10:22:51 +01:00
Aras Pranckevicius fec8461365 Cleanup: move BKE_colorband.h and BKE_colorcools.h to .hh
Also remove includes of those where not needed

Pull Request: https://projects.blender.org/blender/blender/pulls/116416
2023-12-21 10:10:53 +01:00
Jeroen Bakker 3261508e82 Cleanup: Make format 2023-12-21 09:03:53 +01:00
Aras Pranckevicius a9aaf0bc26 Cleanup: Inconsistent struct vs. class declaration warning 2023-12-21 09:55:52 +02:00
Hans Goudey f63a7c1ee9 Curves: Add basic custom normals support
Add a new normal mode called "Custom" which directly interpolates
a "custom_normal" attribute to the evaluated points for the final
normal. Extend the "Set Curve Normal" node with this mode and
give it the ability to set the custom normal value.

This is intentionally a very basic implementation of custom normals.
In particular, the storage is not rotation invariant. So the normals
are expected to be set procedurally at the end of the modifier stack.
On the other hand, it is very easy to understand and explain.

Pull Request: https://projects.blender.org/blender/blender/pulls/116066
2023-12-21 03:29:18 +01:00
Hans Goudey 8e30dc12da Cleanup: Debug build error, unused variable warnings 2023-12-20 21:24:53 -05:00
Hans Goudey 7132c7a53c Cleanup: Replace MVertTri type with C++ vector
Similar to 7c69c8827b. Remove more unused includes.
2023-12-20 20:59:11 -05:00
Hans Goudey b9b47088bc Cleanup: Remove unnecessary DNA_meshdata_types.h includes
Except for vertex groups and a few older color types, these
are generally replaced by newer generic attribute types.
Also remove some includes of DNA_mesh_types.h, since it's
included indirectly by BKE_mesh.hh currently.
2023-12-20 20:58:38 -05:00
Hans Goudey 2c43a9eed9 Cleanup: Move BKE_mesh_calc_edges to bke namespace
Also use reference for mesh argument, and move edges calculation
from legacy faces to "legacy" file.
2023-12-20 20:47:10 -05:00
Lukas Tönne e470edf3e1 Geometry Nodes: initial Volume Grid socket support
This is the initial implementation for the volume grid sockets that has been
discussed during the November 2023 geometry nodes workshop.

It adds initial support for passing volume grids around in sockets. Furthermore,
it adds two new nodes. Both are initially hidden under the "New Volume Nodes"
experimental option until we have a few mode nodes.
* **Get Named Grid**: Gets or extracts a volume grid from a volume geometry
  based on the grid's name.
* **Store Named Grid**: Puts a volume grid back into a volume with a name.

`SocketValueVariant` is extended to support grids besides single values and fields.

Next steps:
* Implement grid socket shape and inferencing (currently, they just look like
  single values).
* Add implicit conversions between grid types.
* Implement nodes that operate on the grids (#116021).
* Improved spreadsheet and viewer support.

Links:
* https://devtalk.blender.org/t/volumes-in-geometry-nodes-proposal/31917
* https://devtalk.blender.org/t/2023-11-06-geometry-nodes-workshop-notes/32007#volumes-3

Co-authored-by: Jacques Lucke <jacques@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/115270
2023-12-20 22:33:17 +01:00
Jacques Lucke 17e2186dd9 Cleanup: fix missing include 2023-12-20 21:32:59 +01:00
Hans Goudey 19b46e0816 Cleanup: Make format 2023-12-20 14:54:50 -05:00
Harley Acheson 13208038da UI: Show "No results found" for empty searches
For menu and operator searches, and for File and Asset Browser
filtering, show "No Results Found" when there is nothing to show.

Pull Request: https://projects.blender.org/blender/blender/pulls/116201
2023-12-20 20:53:48 +01:00
Hans Goudey 4f8d584325 Cleanup: Inconsistent struct vs. class declaration warning 2023-12-20 14:14:11 -05:00
Miguel Pozo 7288201e96 EEVEE-Next: Partial World LightPath node support 2023-12-20 20:04:44 +01:00
Aras Pranckevicius 1be8b51b11 VSE: display audio waveforms by default
As outlined in #115274 design task, at this point VSE timeline audio
waveform processing/rendering is no longer a performance issue,
so make it on by default.

Pull Request: https://projects.blender.org/blender/blender/pulls/116334
2023-12-20 19:51:23 +01:00
Hans Goudey edf8a776ac Cleanup: Use forward declarations to replace includes of BKE_attribute.hh
Remove most includes of this header inside other headers, to remove unnecessary
indirect includes which can have a impact on compile times. In the future we may
want more dedicated "_fwd.hh" headers, but until then, this sticks with the
solution in existing code.

Unfortunately it isn't yet possible to remove the include from `BKE_geometry_set.hh`.
2023-12-20 13:25:28 -05:00
Hans Goudey 7f24972911 Cleanup: Use accessor functions for point cloud positions 2023-12-20 13:25:28 -05:00