Commit Graph

120055 Commits

Author SHA1 Message Date
Campbell Barton
c9a810db58 WM: correct error printing for suspicious time-stamps
Future/past were swapped & include the literal uint64 value as it's
useful to know the invalid value when debugging.
2023-12-13 14:58:58 +11:00
Clément Foucault
4aff321af5 Fix: EEVEE-Next: Broken surfel lighting
This was caused by #113257 which removed the
simple ltc evaluation usage. This in turn
caused a precision issue for the cases where
V == N and surfel lighting was one of them.

Adding a special case fixes the issue.
2023-12-13 04:06:37 +01:00
Jesse Yurkovich
a7ed0e25ca USD: Apply MaterialBindingAPI to Curves with materials
For Curves having materials, make sure to apply the MaterialBindingAPI
to their prims during export.

Pull Request: https://projects.blender.org/blender/blender/pulls/116078
2023-12-13 03:07:29 +01:00
Clément Foucault
7f8763d823 Fix: EEVEE-Next: OpenGL errors in probe capture
Was caused by missing / incorrect bindings.
Reuse the same gbuffer setup for all deferred
layer to avoid this problem later on.
2023-12-13 02:47:40 +01:00
Clément Foucault
ac11ccd2bd EEVEE-Next: Add Translucent BSDF support
This adds support for Translucent BSDF.

This also fixes a bug to allow correct
shadowing.

The input normal had to be set back to
non-inverted in the node function to allow
for correct interpretation of the Normal
by Screen Space Reflections.

This add the necessary optimization
and code deduplication to hybrid deferred
and forward pipeline.

Pull Request: https://projects.blender.org/blender/blender/pulls/116070
2023-12-13 02:19:19 +01:00
Campbell Barton
7ad2c71a0a Cleanup: remove redundant clamp with BLI_str_utf8_offset_from_index 2023-12-13 12:14:47 +11:00
Campbell Barton
2d171aa612 Tests: ensure BLI_str_utf8_offset_from_index index is logically clamped
Callers to this function were clamping the index which isn't necessary.

Update doc-string & tests to reflect this.
2023-12-13 12:14:29 +11:00
Hans Goudey
768cd9b763 Cleanup: Remove inline functions and extra includes from draw extraction 2023-12-12 20:08:30 -05:00
Hans Goudey
79ade784b8 Cleanup: Move draw_manager_text.h to C++ 2023-12-12 19:49:26 -05:00
Clément Foucault
c1130ee782 Cleanup: EEVEE-Next: Avoid use of float math when needed 2023-12-13 01:17:00 +01:00
Clément Foucault
c4d91ad328 Fix: EEVEE-Next: Numerical imprecision with emission only volumes
This was caused by the fix to #65771 which biased the extinction.
The fix uses an exact method by taking the limit of the ill defined
computation and replacing the result by the simplified formula.
2023-12-13 01:17:00 +01:00
Damien Picard
402cec5646 Fix #112293: wrong console line cursor position with multi-byte chars
The ConsoleLine's `cursor` stores the index of the char where the
cursor is currently at. This works for ASCII characters, which
are all one-byte long, but will be offset when the string contains
multi-byte UTF8 sequences.

This caused an issue during auto-complete where the matching results
would be offset to the right.

This commit reuses the same logic as the text editor's
`current_character` RNA property, so that on getting and setting, the
cursor index is converted from and to UTF-8.

Ref: !114121
2023-12-13 10:42:52 +11:00
Hans Goudey
c53e220aef Cleanup: Use C++ attribute API instead of CustomData API
This gives better asserts in debug builds through use of Span, more
safety when name convention attributes happen to have different types
or domains, and simpler code in some cases. But the main reasoning is to
avoid relying on the specifics of CustomData more to allow us to replace
it in the future.
2023-12-12 18:23:59 -05:00
Hans Goudey
1d0179adbb Cleanup: Move mesh update tags to DNA struct
This is similar to other update tags and update tags for other geometry types.
2023-12-12 18:23:59 -05:00
Miguel Pozo
224658266f EEVEE-Next: Add Light Path node support
Fix #113922.

Pull Request: https://projects.blender.org/blender/blender/pulls/116107
2023-12-12 21:27:18 +01:00
Miguel Pozo
b86d656df4 Fix #114284: EEVEE-Next: Light cutoff with small radius 2023-12-12 21:26:24 +01:00
Hans Goudey
a7e8d8c8be Fix #115326: Memory leak toggling dyntopo on and off with empty mesh
The custom data layers (the format) wasn't freed if there were no
geometry elements. But it's fine to call the custom data free functions
with a size of 0.
2023-12-12 15:18:20 -05:00
Hans Goudey
7aee8124a7 Fix: Out of bounds array access building PBVH for empty BMesh
Use Span and Array to catch this sort of mistake faster.
2023-12-12 15:18:20 -05:00
Brecht Van Lommel
cd61a140fa Depsgraph: avoid unnecessary image updates, for compositor caching
For non-COW datablocks like images, there is no need to update when
they just got added to the depsgraph and there is no flag indicating
a specific change that was made to them. Avoiding this helps preserve
the cached image draw data used by the compositor.

Co-authored-by: Sergey Sharybin <sergey@blender.org>

Ref #115511
2023-12-12 20:41:50 +01:00
Douglas Paul
75f160ee96 Geometry Nodes: Add Active Camera input node
This adds a new "Active Camera" input geometry node, per #105761.

The node outputs the the scene's current active camera. It is available
from Input > Scene > Active Camera in the geometry nodes Add menu.

Typical usage would be to connect this node to an Object Info node to
obtain its transform. This works as expected when the camera's
transform is animated, and also when there are markers on the timeline
that change the active camera.

In order to support the aforementioned changes in the active camera,
this implementation adds depsgraph relations for all cameras referenced
by timeline markers. This eliminates the complexity of updating the
depsgraph whenever the scene switches to a different active camera,
but of course it comes at the cost of including more objects than
strictly necessary in the depsgraph for scenes that switch cameras.
Dynamically updating the depsgraph upon camera changes could be a
future improvement if there proves to be sufficient need for it.

Pull Request: https://projects.blender.org/blender/blender/pulls/113431
2023-12-12 19:11:06 +01:00
Sebastian Parborg
86953dfac4 Cleanup: Change information messages to not mention "VSE" but "Video Sequencer" 2023-12-12 19:06:40 +01:00
Hans Goudey
5875349390 Fix: Mesh draw normals extraction ignores sharp_edge with no sharp_face
See c4446d7924

When the "fully flat" state comes from "sharp_edge" and "sharp_face"
doesn't exist, we need to check for that for every face when extracting
normals. Eventually these loops should be unrolled so we don't have a
function call per face. That would remove the cost of this check.
2023-12-12 12:46:27 -05:00
Hans Goudey
a6838c8a12 Geometry Nodes: Change Instance Rotation node to use rotation socket
See #92967. Since the versioning is idempotent, I just moved it to the
latest subversion bump again.
2023-12-12 12:46:27 -05:00
Guillermo Venegas
c00c8b1b37 IO: Add support for multiple drag-n-drop files
There are operators in Blender that allow the user to import multiple
files at the same time, however this functionality is only implemented
when importing with blender's file browser, drag and drop files only
takes first selected file.

The patch adds support for drag and drop multiple files.

Notes:
* The files are filtered according to the extension of the first
  selected file.
* Not all operators that import files support importing multiple files,
  so they will still import one.
* Changes must be made to allow importers to read all file paths.

This will be used in upcoming drag & drop import.

Pull Request: https://projects.blender.org/blender/blender/pulls/107230
2023-12-12 18:46:12 +01:00
Aras Pranckevicius
a0640ce8d5 PLY: extend test coverage for #116022 2023-12-12 19:09:43 +02:00
Aras Pranckevicius
460439acba Fix #116022: Binary PLY import fails if first data byte is 0x0A or 0x0D
Now instead of trying to potentially handle unlimited amount of
newlines (which might be actual data in a binary file), only
explicitly handle either LF or CRLF line endings. Fixes #116022.

Will add test coverage in a followup commit, for easier backporting
of just the fix if needed.
2023-12-12 19:09:43 +02:00
Hans Goudey
d7b2141c2e Fix: Sculpt undo crash for multires after recent cleanup 2023-12-12 12:07:58 -05:00
Hans Goudey
0ad65762cc Cleanup: Remove unnecessary PBVH function
This is only used internally. Externally, it's simpler to fetch the spans instead.
2023-12-12 12:04:44 -05:00
Hans Goudey
93a3423584 Cleanup: Slightly improve variable naming in sculpt undo nodes 2023-12-12 11:39:02 -05:00
Hans Goudey
ba6c07f2d9 Cleanup: Simplify vertex index retrieval in sculpt undo nodes 2023-12-12 11:39:02 -05:00
Hans Goudey
36d5443f57 Cleanup: Remove unnecessary "sculpt_undo" prefix for local functions 2023-12-12 11:39:02 -05:00
Hans Goudey
36097b757e Cleanup: Use loops instead of PBVH iter macro in sculpt undo
With the goal of finding/using different abstractions that are more
aligned with the data structures.
2023-12-12 11:39:02 -05:00
Christoph Lendenfeld
fd3629b80a Refactor: Remove dependencies on Editor code from animrig
No functional changes.

This moves the function `update_autoflags_fcurve_direct`
from the editors/animation section to blender/animrig.
This is in an effort to remove the need for editor code in animrig.

Also removes the include of editor code from fcurve.cc
This was only used on a single line for a macro.

Pull Request: https://projects.blender.org/blender/blender/pulls/116100
2023-12-12 16:04:53 +01:00
Jeroen Bakker
c11004579e GPU: Remove the Word OpenGL from Build Scripts
The build scripts are still referring to gpu tests as being opengl.
Although they can also use Metal or Vulkan. This PR only replaces
the work `opengl` with `gpu` for build options.

Special note is that the windows argument `with_opengl_tests` is
also replaced with `with_gpu_tests` for consistency.

Pull Request: https://projects.blender.org/blender/blender/pulls/116030
2023-12-12 16:02:29 +01:00
Thomas Barlow
e503536775 Fix #92621: foreach_get/set doesn't work for enum
There were two issues at play here.

The first is that only enum properties with raw array access were
supported.

The second is that if the item property pointer was found immediately,
`rna_raw_access` could fall back to the slower loop without checking if
the property was an enum property, which the slower loop did not
support. This would cause the code to go through the entire slower loop
without doing anything. In the case of `foreach_get` without a
compatible buffer, this meant that the temporary, uninitialized array
(which was supposed to be set by `rna_raw_access`) would be converted to
Python integers, causing garbage values to be retrieved by
`foreach_get`, since they were created from uninitialized memory.

This patch adds support for enum properties that are not arrays and adds
asserts if an enum array property is encountered because they do not
exist.

Additional unreachable asserts have been added to the default case of
each switch block within the slower loop because there are prior checks
that the property type is supported, so the switch blocks should never
get an unsupported property type.

Pull Request: https://projects.blender.org/blender/blender/pulls/115508
2023-12-12 15:43:21 +01:00
Pratik Borhade
16705f078c Fix #116000: Face set toggle visibility not working correctly
Toggle visibility is hiding active face sets instead of isoloating it.

Pull Request: https://projects.blender.org/blender/blender/pulls/116026
2023-12-12 12:33:59 +01:00
Pratik Borhade
f70e9cf21c Fix #116024: Face set unhide crash for masked type
This is due to accessing value from empty mask attribute array.

Pull Request: https://projects.blender.org/blender/blender/pulls/116028
2023-12-12 12:33:38 +01:00
Campbell Barton
598a48054b Cleanup: correct & improve MLoopTri struct comment
Own previous cleanup had a grammar error and could be worded better.

Co-authored-by: Hans Goudey <hans@blender.org>
2023-12-12 20:56:01 +11:00
Guillermo Venegas
e23b8eeb42 BLI: destruct non-trivial types after using remove_if
`Vector::remove_if` allows certain elements to be removed based on a predicate.
However `std::remove_if` only shifts the elements that will not be deleted
to the beginning of the container and then `Vector::remove_if` only
updates the pointer to the new last element after using `std::remove_if`.
This works well if `Vector` is used with trivial types that don't have a destructor.

Having a `Vector<std::unique_ptr>` for example, can generate undefined behavior
if the predicate gives `true` to elements that are contiguous at the end, if
`Vector::remove_if` only updates the end pointer in these specific cases, these
makes these smart pointers useless because  they will not be freed by themselves.

To prevent that, also destruct the elements being removed.

Pull Request: https://projects.blender.org/blender/blender/pulls/115914
2023-12-12 10:42:04 +01:00
Jeroen Bakker
efc1094d6a Metal: Enable Shader Validation on Buildbot
This PR enables shader validation testing on buildbot for Metal.

OpenGL isn't enabled as OpenGL requires an actual driver and GPU
attached to the build bot infrastructure. Also the OpenGL backend
caches data (glsl_patch) globally and requires a restart in order to
create the correct one.

Vulkan isn't enabled as it requires some changes:
* For windows it requires to install more recent vulkan software versions as
  part of the buildbot windows configuration
* For Linux it requires to start a GHOST System without any X11/Wayland
  This currently fails on the buildbot. We should check if we can use
  `GHOST_SystemHeadless` with `GHOST_ContextVK`

Each shaders are compiled twice. Once based on the
actual features of the installed GPU/backend. And once with all
the work-arounds enabled, simulating a platform close to the
minimum requirements of Blender.

Pull Request: https://projects.blender.org/blender/blender/pulls/116040
2023-12-12 10:14:13 +01:00
Omar Emara
a6948310b9 Fix #116037: Corner Pin mask retains original alpha
The Corner Pin mask output retains the original alpha of the input
image, while it should be a binary mask. This also affects the Plane
Deform node.
2023-12-12 11:09:22 +02:00
Jeroen Bakker
f9269312da Fix #116075: OpenGL Shader Compilation On Selected Platforms
Due to recent changes a cached patch string in GLShader grew out of
its bounds. This resulted in incorrect shader generation on selected
platforms (Reported was Windows/NVIDIA). The patch string can differ
based on the features that the GPU supports.

This PR replaces the old C-style string generation with CPP-style
string stream, making sure that the allocated memory grows with the
size of the string.

Pull Request: https://projects.blender.org/blender/blender/pulls/116085
2023-12-12 09:51:17 +01:00
Jesse Yurkovich
1db803516a Fix: Debug assert in file_handler_test
The debug assert condition was inverted.

It is expected that we do not find a `FileHandlerType` with the given
`idname` during add. Like Operators being added twice from c code, this
will now assert if one is actually found. Python duplicates are handled
through `register_class` already.

Pull Request: https://projects.blender.org/blender/blender/pulls/116084
2023-12-12 09:43:28 +01:00
Damien Picard
6428f2329e Anim: reorder "View in Graph Editor" buttons in the context menu
In the property context menu, the operator to View in Graph Editor can
apply to a single value or all values of a vector property.

Currently, these two options are presented in this order (Single, then
All), while all other operators (replace, delete, clear, add to keying
set, reset, copy to selected) follow the opposite order (All, then
Single).

This commit inverts this order for consistency's sake.

Pull Request: https://projects.blender.org/blender/blender/pulls/115962
2023-12-12 09:29:03 +01:00
Jeroen Bakker
f66ad2d919 Cleanup: Suppress Unused Variables In Release Builds
Pull Request: https://projects.blender.org/blender/blender/pulls/116083
2023-12-12 08:24:50 +01:00
Anthony Roberts
3b2ed40250 Windows: Remove workaround for ARM64/WSL Mesa drivers
This reverts #110582 - the workaround is no longer needed, as MS have updated
the version of mesa they ship as part of their compatibility pack, which contains
a workaround on that side instead.

This means that the supported version of OpenGL based on the host GPU is now
correct, bar `GL_ARB_texture_view`.

`GL_ARB_texture_view` is faked for ARM64 devices, as the part that is not
implemented (channel casting) is not used in blender.

This means that ARM64 devices (at least) now report compatibility up to OpenGL
4.6 in the system info export.

See: 698344b93c

Pull Request: https://projects.blender.org/blender/blender/pulls/116052
2023-12-12 08:12:45 +01:00
Campbell Barton
857714ceff WM: warn about suspicious event time-stamps in debug builds
Report suspicious time-stamps as they could cause bugs which are
difficult to troubleshoot.
Currently the time-stamps are only used for double-click detection but
we may want to use them in the future, so ensure they're valid.

Print an error when two events are handled in the last second and the
current event has a time-stamp 5 seconds before or after the current
time.
2023-12-12 14:57:47 +11:00
Campbell Barton
7f64bf482e Cleanup: rename GHOST event processing arguments
Rename `evt` to `ghost_event` since it's too similar to `event`
(used for generated `wmEvent` structs).
2023-12-12 13:21:22 +11:00
Campbell Barton
77204bed17 Cleanup: spelling in comments 2023-12-12 12:58:56 +11:00
Campbell Barton
d93a594708 Cleanup: compiler warnings 2023-12-12 12:53:03 +11:00