Commit Graph

130864 Commits

Author SHA1 Message Date
Christoph Lendenfeld e0806e6d51 Refactor: combine x and y for insert_vert_fcurve into float2
No functional changes.

To reduce the argument count of `insert_vert_fcurve`,
the x and y argumentsto define the position
of a keyframe can be merged into a single `float2`

Pull Request: https://projects.blender.org/blender/blender/pulls/115886
2023-12-07 12:05:09 +01:00
Casey Bianco-Davis 4dcda1ec12 GPv3: Overlay: Show edit lines option
Adds option to only show edit mode lines overlay, and also adds overlay options panel.

Pull Request: https://projects.blender.org/blender/blender/pulls/115739
2023-12-07 11:42:06 +01:00
Pratik Borhade 5a2b8da619 Fix: GPv3: Crash switching to draw mode for empty object
Crash occurs in debug mode after switching to draw mode if GP object is
empty (i.e. zero points)
This is due to accessing value which is empty i.e.`std::nullopt`

Pull Request: https://projects.blender.org/blender/blender/pulls/115795
2023-12-07 11:40:08 +01:00
Falk David cad81786d0 Fix: GPv3: Memory leaks in curve fitting functions
There were some memory leaks in the `polyline_fit_curve` and
`polyline_detect_corners` functions, because the
c-style arrays that the library returns are never freed.
We only copy the data and return it.

The fix makes sure we free the temporary arrays.
2023-12-07 11:08:50 +01:00
Pratik Borhade 31ee0a2a3e Fix: GPv3: Missing add layer option in menu when list is empty
There was a mistake in 671f428ead. When the layers list is empty, the operator to add a new
layer will be missing in the "Active Layer" menu.

Pull Request: https://projects.blender.org/blender/blender/pulls/115785
2023-12-07 10:51:44 +01:00
Jesse Yurkovich 2f0633f5fa Fix: Send more appropriate notification at end of USD/Alembic import
A recent change[1] caused the `NC_SCENE | ND_FRAME` combination to no
longer perform a full Outliner rebuild. However, both Alembic and USD
importers were using this combination. The end result was that the
outliner would not show any of the newly imported objects/collections
until a rebuild was forced some other way (like going into Edit mode on
an object).

Change to use a more appropriate notification that corresponds to the
concept of new IDs being added to the scene instead: `NC_ID | NA_ADDED`

Also, remove the notification being sent from the startjob callback when
creating a new collection. It's unneeded in this situation and it could
be problematic being called from the callback.

[1] b549260aa4

Pull Request: https://projects.blender.org/blender/blender/pulls/115883
2023-12-07 10:45:58 +01:00
Omar Emara 45dcc61fd2 Fix #115859: Cryptomatte node considers preview channels
The Cryptomatte node considers preview channels as part of the
Cryptomatte layers, producing bad pick outputs at best and bad mattes at
worst.

The Cryptomatte specification specifies that a layer with the same name
as the typename is a (Now deprecated) preview layer, so it should be
ignored, which is what the patch does.

Pull Request: https://projects.blender.org/blender/blender/pulls/115879
2023-12-07 10:00:55 +01:00
Jeroen Bakker 5475d8c5cf EEVEE: Lookdev HDRI Spheres
This PR implements the Lookdev (HDRI) Spheres overlay for EEVEE-Next. There are
also improvements for lookdev:

* Scene lighting (direct and indirect are) applied to the spheres.
* Shadow is applied to the spheres.

This is done by virtually placing the balls at the near clip plane of the camera/viewport.

![image](/attachments/735d0f49-a2cd-479e-b293-8e3f4b7f06a1)

Pull Request: https://projects.blender.org/blender/blender/pulls/115465
2023-12-07 08:19:32 +01:00
Campbell Barton e8f60d4de2 Cleanup: replace unordered_map for cursor lookups with an array 2023-12-07 17:50:43 +11:00
Campbell Barton 488ba5cd9a Fix #115811: Wayland picker cursor isn't displayed
Themes that didn't define "color-picker" showed the default cursor.

Resolve by checking if the theme contains a cursor,
not just that the name is known.
2023-12-07 17:08:06 +11:00
Campbell Barton 96e41bfd19 GHOST/Wayland: update cursor names
Update names to better support Adwaita & Breeze cursor themes.
2023-12-07 17:08:03 +11:00
Campbell Barton b570efb0a9 Cleanup: reference a const wl_cursor from Wayland 2023-12-07 17:08:01 +11:00
Campbell Barton ae8f971491 Cleanup: remove GHOST_System::getMilliSeconds
Each GHOST implementation defines it's own getMilliSeconds()
so there is no need to define this in GHOST_System.
2023-12-07 17:07:59 +11:00
Hans Goudey a86658a58a Fix #115856: Sculpt Face sets drawing sometimes uses wrong default
In some cases the value that defines which ID is displayed as white is
mismatched between the original and evaluated mesh. Use the original
as the source of truth, since that's the mesh that's actively edited.
2023-12-06 23:50:30 -05:00
Hans Goudey f3dd1a3260 Sculpt: Refactor face sets storage and access
Similar to previous changes for masks and visibility, remove the mutable
pointer to face sets from the sculpt session. With implicit sharing,
this avoids a duplicate copy of face sets on the evaluated object when
face sets aren't edited.

Most retrieval of face sets now goes through the Mesh attribute API
instead of the pointer in sculpt session. This integrates sculpt code
with the rest of Blender, avoiding the need to reinvent things like
basic attribute access.

Similar to previous refactors to mask and visibility operators, refactor
the face set gesture and edit operators to be multithreaded and only
push undo steps and tag updates for actually changed nodes.

There is opportunity for more code deduplication in the future.
For now the aim is to reduce the number of confusing abstraction
levels though.
2023-12-06 23:50:30 -05:00
Hans Goudey dc234c5d93 Cleanup: Add utility to compare non-indexed and indexed span values
This will be useful for other types in the future (similar abstractions
for editing face sets), and it makes more semantic sense as a templated
utility function.
2023-12-06 23:33:46 -05:00
Hans Goudey 184418b6d0 Fix: Incorrect use of Vector resize in mesh_fair
Wrong since c9b4d75336
2023-12-06 23:33:46 -05:00
Hans Goudey 4e7e539b33 Sculpt: Make hide poly pointer in sculpt session const
This avoids having to make the original data layer mutable when we
aren't going to modify it, meaning the memory can still be shared with
the evaluated mesh-- saving 1 byte per face in some situations. This was
made possible by previous commits that moved to using the Mesh attribute
API instead of the SculptSession pointer to edit this data. Eventually the
`hide_poly` pointer should be completely removed.
2023-12-06 23:33:46 -05:00
Hans Goudey 466dca07d5 Cleanup: Move mesh visibility and selection flushing to C++ namespace
Also rename the functions and move a sculpt function that depended on
the mesh functions to a more proper place. And also use references and
nicer variable names for meshes.
2023-12-06 23:33:46 -05:00
Hans Goudey 9f5878b628 Cleanup: Use enum class for some sculpt enums
Benefits are stronger type safety and prettier code.
2023-12-06 23:33:46 -05:00
Hans Goudey 251069ae5b Sculpt: Reimplement face sets visibility operator
Iterate over faces instead of vertices, and multithread the logic over
all PBVH nodes. The result is about 3 times faster in my tests;
noticeably snappier for large meshes. Add a new sculpt undo type for
face hide storage (as opposed to vertex storage), and use that only
when the data actually changed, which should reduce memory usage too.
Internally some code is shared with the other visibility operators,
since this operation always affects base mesh faces, most isn't.

Similar to 4e66769ec0
2023-12-06 23:33:46 -05:00
Hans Goudey f6ef00a6f4 Cleanup: Move RNA enum definitions to smaller scope 2023-12-06 23:33:46 -05:00
Hans Goudey 8e03fa34f1 Cleanup: Avoid repeatedly retrieving object in sculpt undo nodes 2023-12-06 23:33:46 -05:00
Hans Goudey d1d3207e33 Sculpt: Simplify and slightly improve undo update tagging
Mostly make logic more consistent with better variable naming,
early returns, and separated functions. But also avoid adding some
tags if the corresponding data hasn't changed. For example, don't
tag the mesh positions changed if the undo nodes only contained
color or face set information.
2023-12-06 23:33:46 -05:00
Hans Goudey 1e65ede8d9 Cleanup: Use C++ vector to store temporary sculpt undo update tags 2023-12-06 23:33:46 -05:00
Hans Goudey 1863533eb6 Cleanup: Move sculpt_face_set.cc to C++ namespace 2023-12-06 23:33:46 -05:00
Hans Goudey f61b271458 Cleanup: Remove unused sculpt functions 2023-12-06 23:33:46 -05:00
Hans Goudey 53418fc3a1 Sculpt: Separate invert visibility operator from face sets
Remove "Invert Visible" from the face sets menu, since those concepts
are no longer tied together, except for some convenience features to
toggle visibility of some face sets.

On the code side, the `SCULPT_OT_face_set_invert_visibility` operator
is replaced by `PAINT_OT_visibility_invert`. It inverts vertex visibility
instead of face visibility, which mostly has the same results, except
for multires sculpting where it no longer "downgrades" visibility to
base mesh faces.
2023-12-06 23:33:46 -05:00
Campbell Barton c0964dcd8d GHOST/Wayland: skip more involved timestamp conversion where possible
When the result of getMilliSeconds & wayland time-stamps match,
bypass more involved logic which attempts to maintain a delta and
return the time-stamp with an offset (to account for 32bit rollover).
2023-12-07 15:25:25 +11:00
Campbell Barton 57a1e9207f GHOST/Wayland: use monotonic timer for getMilliSeconds
This is closer to Wayland's own time-stamps, using this also allows for
optimizations calculating time-stamps from events.
2023-12-07 15:24:55 +11:00
Campbell Barton edc503356a Cleanup: tweak error checks for time access for GHOST/X11
Prefer checking the known success value instead of an exact error
since badly behaving systems could use different error values.
2023-12-07 15:24:54 +11:00
Campbell Barton 497600e49e Cleanup: spelling in comments, strings 2023-12-07 12:45:27 +11:00
Campbell Barton bad4390663 Cleanup: format, function style cast 2023-12-07 11:42:12 +11:00
Campbell Barton 9d9764c1c9 Cleanup: remove redundant define checks
Also reformat checks to quiet warnings so they don't read as empty
define checks.
2023-12-07 10:39:03 +11:00
Campbell Barton 9898602e9d Cleanup: clarify #ifndef checks in trailing #endif comments 2023-12-07 10:38:54 +11:00
Ray Molenkamp 44ac2e8a8d CMake: Allow asserts to be enabled for release builds.
Asserts historically only have been on in debug builds, however
running the tests in a debug configuration takes a while especially
if Cycles is enabled.

This adds WITH_ASSERT_RELEASE to enable asserts in release
configurations. It is enabled for "make developer" , and will also
be used for CI.

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/115071
2023-12-06 23:49:42 +01:00
Jason Fielder 0113fb5f31 Metal: Remove old small-tiles optimization
Explicit use of small tiles for high BPP
renderpasses was added as an optimization
to resolve long fragment execution tails for EEVEE's
material graph evaluation pass.

EEVEE Next alters performance characteristics with
the split pass for material processing and lighting
evaluation and does not have the same long-running
fragment threads.

Removing to fallack to default tile sizes for better
performance in EEVEE Next.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/115747
2023-12-06 23:17:11 +01:00
Julian Eisel c080604f63 Cleanup: Avoid unnecessary indentation level in region overlap function
Use `continue` top move pre-conditions for the iteration to the
beginning of the loop, rather than making the entire block conditional.
Reduces cognitive complexity since the pre-conditions are handled
clearly and early.
2023-12-06 21:07:41 +01:00
Julian Eisel b4d6c231c5 Fix failing assert when hiding header with asset shelf available
Old code to prevent multiple overlapping regions at the same place,
wasn't handling the combination of bit flags and the alignment enum in a
single field correctly. Newly introduced flags for the asset shelf
exposed this.

Was asserting on startup for a Pets production file
(`010_0050.anim.blend`).

Steps to reproduce:
* Replace default cube with armature object
* Enter Pose Mode (makes asset shelf available for pose libraries)
* Hide 3D View header
2023-12-06 20:47:51 +01:00
Aras Pranckevicius 06370b5fd6 VSE: make Wipe effect 6x-20x faster
Wipe effect was completely single threaded. So multi-thread that.
Additionally, simplify math done in Clock wipe code; asin() + hypot()
+ some checks is just atan2() really.

Applying Wipe to 4K UHD sequencer output, on Windows Ryzen 5950X:
- Single/Double: 99.1 -> 9.3 ms (10.6x faster)
- Iris: 153.3 -> 12.3 ms (12.4x faster)
- Clock: 301.4 -> 14.5 ms (20.8x faster)

The same on Mac M1 Max:
- Single: 74.5 -> 13.4 ms (5.6x faster)
- Iris: 84.2 -> 14.3 ms (5.9x faster)
- Clock: 185.3 -> 18.8 ms (9.8x faster)

Pull Request: https://projects.blender.org/blender/blender/pulls/115837
2023-12-06 19:42:59 +01:00
Aras Pranckevicius fc64f48682 VSE: make Glow effect 6x-10x faster
Glow effect was doing the correct thing algorithmically (separable gaussian
blur), but it was 1) completely single-threaded, and 2) did operations in
several passes over the source images, instead of doing them in one go.

- Adds multi-threading to Glow effect.
- Combines some operations, e.g. instead of IMB_buffer_float_from_byte
  followed by IMB_buffer_float_premultiply, do
  IMB_colormanagement_transform_from_byte_threaded which achieves the same,
  but more efficiently.
- Simplifies the code: removing separate loops around image boundaries is
  both less code and slightly faster; use float4 vector type for more
  compact code; use Array classes instead of manual memory allocation, etc.
- Removes IMB_buffer_float_unpremultiply and IMB_buffer_float_premultiply
  since they are no longer used by anything whatsoever.

Applying Glow to 4K UHD sequencer output, on Windows Ryzen 5950X:
- Blur distance 4: 935ms -> 109ms (8.5x faster)
- Blur distance 20: 3526ms -> 336ms (10.5x faster)

Same on Mac M1 Max:
- Blur distance 4: 732ms -> 126ms (5.8x faster)
- Blur distance 20:  3047ms -> 528ms (5.7x faster)

Pull Request: https://projects.blender.org/blender/blender/pulls/115818
2023-12-06 19:39:42 +01:00
Aras Pranckevicius 9cbc96194e VSE: make Gamma Cross effect 4x faster
Gamma Cross code seems to be coming from year 2005 or earlier, with complex
table based machinery to approximate "raise to power" calculations. Which,
for Gamma Cross, have always been hardcoded to 2.0 "since forever". So
simplify all that, i.e. replace all the table lookup/interpolation things
with just `x*x` and `sqrt(x)`.

Applying Gamma Cross on 4K UHD resolution, Windows Ryzen 5950X machine:
36.2ms -> 8.1ms

Pull Request: https://projects.blender.org/blender/blender/pulls/115801
2023-12-06 19:37:00 +01:00
Bastien Montagne 1e50987d94 LibOverride: Refactor some part of hierarchy handling code.
This commit is a preparation for an actual change in behavior of
automatic liboverride hierarchies creation. Although it may introduce
some minor changes (fixes) in behavior in some corner-cases, it is
not expected to have any noticeable end-user changes.

The main change is some refactor of the `LibOverrideGroupTagData` util
struct, to make it more clear and easy to manage data (IDs) from linked
reference, and data from liboverrides.

In addition, some minor changes in code logic, either optimizations or
hardened checks, e.g. to skip any processing of hierarchies when the
linked reference of its root is missing, or to ensure that libraries are
matching, etc.
2023-12-06 18:32:48 +01:00
Charles Wardlaw b7fa45b68d Fix: USD import: Improve texture color space choice
Many assets with UsdPreviewSurface materials exist in which the textures
do not have authored color space settings.  Because of this, assets with
normal maps and other non-color data look incorrect on import because
these textures are marked as being sRGB instead of Non-Color.

This patch fixes the color space choices for these textures based on
connections to the PBR shader; if no color space is specified, non-Albedo
maps get an automatic Non-Color assignment.

Co-authored-by: Charles Wardlaw <kattkieru@users.noreply.github.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/113374
2023-12-06 18:17:53 +01:00
Bastien Montagne d24a49da84 Fix (unreported) missing Viewlayer update in liboverride code.
In post-processing of objects & collections after liboverrides creation,
viewlayer could be accessed while tagged as dirty, since the
object/collection hierarchy may be modified several times during this
process.
2023-12-06 17:11:56 +01:00
Brecht Van Lommel e06561a27a Build: replace Blender specific DEBUG by standard NDEBUG
NDEBUG is part of the C standard and disables asserts. Only this will
now be used to decide if asserts are enabled.

DEBUG was a Blender specific define, that has now been removed.

_DEBUG is a Visual Studio define for builds in Debug configuration.
Blender defines this for all platforms. This is still used in a few
places in the draw code, and in external libraries Bullet and Mantaflow.

Pull Request: https://projects.blender.org/blender/blender/pulls/115774
2023-12-06 16:05:14 +01:00
Brecht Van Lommel fc863c63e6 BMesh: don't make threading threshold dependent on debug/release build
While it may be useful to detect threading issues for low poly meshes in debug
builds, it can also cause confusion when one breaks but not the other.

Further, having this logic for just a handlful bmesh functions while everything
else does not makes little sense.
2023-12-06 16:05:12 +01:00
Hans Goudey 2609f16fc8 Cleanup: Resolve inconsistent struct vs. class declaration warning
Also add a missing include in a header
2023-12-06 10:00:25 -05:00
Hans Goudey 79552f87f2 Fix: Protect against access of empty geometry bounds optional 2023-12-06 09:12:09 -05:00
Philipp Oeser 79ed05b29f Fix #115830: Poly Build tool crash with clipping borders
Since 02ee5a7693 we cant call `ED_view3d_win_to_ray_clipped_ex` with
null `r_ray_end`, `ED_view3d_clip_segment` relies on it.

To fix this, just pass a dummy from `ED_view3d_win_to_ray_clipped`.

Pull Request: https://projects.blender.org/blender/blender/pulls/115840
2023-12-06 14:13:07 +01:00