Commit Graph

131489 Commits

Author SHA1 Message Date
Sybren A. Stüvel 1ff3b546f5 Cleanup: Anim, document `bonecoll_ensure_name_unique`
Document an assumption of the `bonecoll_ensure_name_unique()` function.

No functional changes.
2023-12-28 14:37:31 +01:00
Sybren A. Stüvel 6aa1a869c6 Refactor: Anim, move refresh of active bone collection to own function
Move some of the functionality of `ANIM_armature_runtime_refresh()` into
a function of its own (`ANIM_armature_bonecoll_active_runtime_refresh()`).
It will be called from another place as well in upcoming commits.

No functional changes.
2023-12-28 14:36:05 +01:00
Clément Foucault 553b1b6f1f Cleanup: EEVEE-Next: Change bind_resource syntax
This is just for making it clearer we bind to what
pass we are binding.

Pull Request: https://projects.blender.org/blender/blender/pulls/116597
2023-12-28 10:19:20 +01:00
Omar Emara dc082f432a Fix #116522: Compositor incorrectly extrapolates values
The GPU compositor incorrectly extrapolates values of RGBA curves node.
That's because the code introduces a half-pixel offset to the color
values since they will be used to sample the curve maps. Those same
values are then used for extrapolation, which shouldn't take the
half-pixel value into account.

This patch fixes that by computing sampler coordinate in a separate
step.

Pull Request: https://projects.blender.org/blender/blender/pulls/116586
2023-12-28 09:25:11 +01:00
Jason Fielder 335d3a1b75 GPU: Add Shader specialization constant API
Adds API to allow usage of specialization constants in shaders.
Specialization constants are dynamic runtime constants which can
be compiled into a shader pipeline state object (PSO) to improve
runtime performance by reducing shader complexity through
shader compiler constant-folding.

This API allows specialization constant values to be specified
along with a default value if no constant value has been declared.
Each GPU backend is then responsible for caching PSO permutations
against the current specialization configuration.

This patch adds support for specialization constants in the
Metal backend and provides a generalised high-level solution
which can be adopted by other graphics APIs supporting
this feature.

Authored by Apple: Michael Parkin-White
Authored by Blender: Clément Foucault (files in gpu/test folder)

Pull Request: https://projects.blender.org/blender/blender/pulls/115193
2023-12-28 05:34:38 +01:00
Jesse Yurkovich eb99895c97 Fix #116546: Disable openexr core
The new 2.5.x version of OIIO came with the OpenEXR Core library enabled
by default. Unfortunately it's not quite ready to be used so disable it
for now.

The current issue will prevent DWA-A/B from loading correctly. There may
also be a potential ZIPS compression related quirk that upstream is
still working through as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/116591
2023-12-28 00:48:25 +01:00
Hans Goudey 7d44065f73 Cleanup: Revert replacement of GSQueue with std::queue
There are some tragic design flaws with the Microsoft STL
implementation of `std::dequeue`. Unless we implement our
own similar data structure or use an implementation from
another library, the change isn't worth it.

This reverts commit b26cd6a4b9.
This reverts commit cc11ba33d9.
This reverts commit c929d75054.
This reverts commit bd3d5a750d.
2023-12-27 12:34:49 -05:00
Andres Stephens 369f1fe4e2 Fix #116558: Console error due to missing property use_template_override
`use_template_override` experimental option was removed in 25ab53a4af.
But property was still mentioned in preference panel which results in console
error.

Pull Request: https://projects.blender.org/blender/blender/pulls/116559
2023-12-27 12:52:24 +01:00
Hans Goudey 06eda2a484 Cleanup: Remove most indirect includes of BKE_customdata.hh
Some common headers were including this. Separating the includes
will ideally lead to better conceptual separation between CustomData
and the attribute API too. Mostly the change is adding the file to
places where it was included indirectly before. But some code is
shuffled around to hopefully better places as well.
2023-12-26 23:59:44 -05:00
Hans Goudey dcbc5a3641 Cleanup: Correct and improve comments in DNA_customdata_types.h 2023-12-26 23:26:32 -05:00
Hans Goudey d54b24c55a Cleanup: Remove unnecessary/indirect includes in sculpt headers
The main goal is removing bmesh.hh from BKE_paint.hh, since that
includes it in many more files than necessary. Also remove more
includes from sculpt_intern.hh.
2023-12-26 23:26:32 -05:00
Hans Goudey a683d1b0c6 Cleanup: Use BitVector instead of BLI_bitmap in sculpt code 2023-12-26 23:26:32 -05:00
Hans Goudey b26cd6a4b9 Cleanup: Remove unused GSQueue container
GSQueue dates back over 21 years, past the initial git commit. Nowadays
we generally prefer to use data structures from the C++ standard library
or our own C++ data structures. Previous commits replaced this container
with `std::queue` in a few areas. Now it is unused and can be removed.
2023-12-26 23:26:32 -05:00
Hans Goudey cc11ba33d9 Cleanup: Use std::queue instead of GSQueue for thread queue
Similar to previous commits.
2023-12-26 23:26:32 -05:00
Hans Goudey c929d75054 Cleanup: Use std::queue instead of GSQueue in depsgraph scheduling
Similar to previous commits.
2023-12-26 23:26:32 -05:00
Hans Goudey bd3d5a750d Cleanup: Use std::queue instead of GSQueue in multires_unsubdivide 2023-12-26 23:26:32 -05:00
Hans Goudey dca81dc3df Cleanup: Use std::queue instead of GSQueue in sculpt code
This improves type safety, simplifies memory management,
and is a step towards removing the GSQueue container.
2023-12-26 23:26:32 -05:00
Ray Molenkamp fcbb94ed1e deps_builder: include OIIO PR #4062
OIIO was including imaths half.h when it did not
need to, leading to build errors in lite builds.
This issue had been fixed already upstream but
was not yet included in the version we use.
2023-12-26 12:50:10 -07:00
Germano Cavalcante 2824e45678 Fix #115510: Poly Build does not update snapped geometry
Commit 91b27ab637 reveals the error.

The Poly Build code was using the wrong mesh to access the evaluated
coordinates.

It was accessing the original mesh, which wasn't affected by modifiers
or editing.

The most ideal meshes would be either the cage or even the deform, as
these better correspond to the geometry seen by the user.
2023-12-26 10:48:49 -03:00
Habib Gahbiche 57df35c8f9 Fullframe compositor: unify scaling behavior with realtime compositor
This patch unifies the behavior of the scale node by removing the arbitrary limit of scaling images. The change applies to scale and transform nodes.

Note: with this change, Blender can crash for large resizing factors (around 10 000 x 10 000 relative factors). We think it's very unlikely users will run into this issue, so we agreed errors coming from failed memory allocation won't be handled, as is the case for GPU compositor.

Pull Request: https://projects.blender.org/blender/blender/pulls/114764
2023-12-26 12:58:46 +01:00
Omar Emara 92a0dfed94 Fix: Bokeh images missing write usage flag
Bokeh images are written from shaders without a write usage flag, which
causes assertions on Metal.
2023-12-26 12:59:35 +02:00
Aras Pranckevicius 140f5f619d Fix #116520: OBJ exporter does not add leading zeros in frame filenames
When exporting animation (one .obj file per animation frame), the old
Python OBJ exporter used to emit frame number with leading zeros, e.g.
"000012" which made sorting files by frame easier. The new C++ OBJ
exporter does not do that.

Fix that by reintroducing leading zeros. However, use 4 digits
("0012") since that matches 4 digits used in many other places, and
also it's very unlikely that someone would export more than several
thousand frames into OBJ. If that happens, it all works correctly
anyway, just without leading zeroes.

Fixes #116520
2023-12-25 21:48:07 +02:00
Casey Bianco-Davis 72a74ae8cc Fix: #116349: `Connected Only` not working for proportional editing
The problem was created in 78d9267a56

The problem was that `return` would skip the rest of the segment.

Pull Request: https://projects.blender.org/blender/blender/pulls/116523
2023-12-25 11:38:55 +01:00
Jeroen Bakker 2bb7d767c4 EEVEE-Next: Add Raytracing Presets
This PR adds raytracing presets. It contains a preset with default settings and
users are able to add their own.

Pull Request: https://projects.blender.org/blender/blender/pulls/116223
2023-12-24 22:17:31 +01:00
Jason Fielder 6692390501 EEVEE: Metal: Enable attachmentless FB support for VSM update FB
Utilise attachmentless framebuffer for atomic shadow update
Path.

Authored by Apple: Michael Parkin-White.

Pull Request: https://projects.blender.org/blender/blender/pulls/116396
2023-12-24 12:19:18 +01:00
Clément Foucault 258ba00a03 Fix: EEVEE-Next: Wrong function declaration order 2023-12-25 00:06:10 +13:00
Clément Foucault 2794afc84e Fix: EEVEE-Next: Broken capture shader compilation 2023-12-24 20:18:00 +13:00
Clément Foucault c0fe51678e Fix #116489: Improper use of enum in GLSL file
Use defines instead.
2023-12-24 20:18:00 +13:00
Campbell Barton 57a3f2f685 Cleanup: format 2023-12-24 17:50:22 +11:00
Campbell Barton cd0967d3e1 Fix autopep8 reference for "make format" on Linux 2023-12-24 17:47:06 +11:00
Aras Pranckevicius 0fb89c2301 IO: remove experimental label from C++ based STL import/export
The Python STL addon got "legacy" labels added
2023-12-23 23:11:09 +02:00
Ray Molenkamp 6f21b09e73 CMake: Windows: Install oidn HIP kernel if available 2023-12-23 12:46:14 -07:00
Ray Molenkamp c6ae08b06b deps_builder: build fixes for oidn
- OIDN doesn't need to be build for debug builds on windows, while
it's mostly C++ code its public API is C
- Python was not found by the HIP build
- Level Zero was downloaded during the build.
2023-12-23 11:45:11 -07:00
Iliya Katueshenock bd7c217f17 Cleanup: fix warning
Pull Request: https://projects.blender.org/blender/blender/pulls/116496
2023-12-23 19:15:36 +01:00
Jacques Lucke ad7a5abb2d Geometry Nodes: support panels in geometry nodes modifier
This builds on top of f824476bd5 to show
panels in the geometry nodes modifier. It also changes the two existing panels
to use the new layout panels.

The open-close state of the panels is stored in the modifier itself. It contains a
mapping from panel id to the corresponding state flag.

Pull Request: https://projects.blender.org/blender/blender/pulls/116472
2023-12-23 16:33:14 +01:00
Clément Foucault 84d1d30028 EEVEE-Next: Add translucent contribution in probe capture 2023-12-23 20:06:39 +13:00
Clément Foucault dc155e2ae4 EEVEE-Next: Remove Light eval hard coded closures
Related to #115966

Allows for multiple evaluation of the same closure
(i.e: metal + clearcoat).

Pull Request: https://projects.blender.org/blender/blender/pulls/116478
2023-12-23 07:58:10 +01:00
Clément Foucault df91fb329e Fix: EEVEE-Next: Broken Support for SSS
Broken by f4275cc4df
2023-12-23 19:47:21 +13:00
Pratik Borhade 574daf20e1 Fix #116389: Sculpt: Box Hide tool keymap option "Outside" not working
Both inside/outside was hiding verts that are within `isect_point_planes_v3`.
For VisArea::Outside, verts outside the box should be hidden (same for
"show").

Pull Request: https://projects.blender.org/blender/blender/pulls/116412
2023-12-23 06:27:12 +01:00
Campbell Barton e18e4a1acf CMake: default to Python 3.10 for macOS
The recent bump to 3.11 should have only changed Linux as updated macOS
libraries have not yet been committed.
2023-12-23 16:19:09 +11:00
Clément Foucault f4275cc4df EEVEE-Next: Gbuffer Optimization
This modify the GBuffer layout to store less bits per closures.
This allows packing all closures into 64 bits or 96 bits.
In turn, this reduces the amount of data stored for most
usual materials.

Moreover, this contain some groundwork for the getting rid of the
hard-coded closure type. But evaluation shaders still use
the hard-coded types.

This adds tests for checking packing and unpacking of the gbuffer
doesn't loose any data.

Related to #115966

Pull Request: https://projects.blender.org/blender/blender/pulls/116476
2023-12-23 05:58:52 +01:00
Campbell Barton 526019b559 CMake: default to Python 3.11, auto-update existing variables 2023-12-23 14:39:55 +11:00
Jacques Lucke db8d381f71 Fix: layout panels headers don't take block width into account
Found while working on #116472.
2023-12-22 22:14:16 +01:00
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