Commit Graph

105556 Commits

Author SHA1 Message Date
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
Ray Molenkamp
6f21b09e73 CMake: Windows: Install oidn HIP kernel if available 2023-12-23 12:46:14 -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
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
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
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