Commit Graph

128936 Commits

Author SHA1 Message Date
Jacques Lucke 5830316681 Nodes: use better default for color sockets
Using a fully transparent black is default never was an explicit decision.
Now the default is a light grey, that we use in many nodes already.
2023-10-08 15:25:07 +02:00
Jacques Lucke 1ecc315d34 Nodes: pass node declaration builder to dynamic declaration function
Generally, one should use the declaration builder instead of trying to
do it manually which is more error prone and verbose.
2023-10-08 14:38:28 +02:00
Jacques Lucke 0b3daea393 Geometry Nodes: use declaration builder for simulation zone 2023-10-08 14:14:22 +02:00
Jacques Lucke b6a3ac5a12 Geometry Nodes: use declaration builder for repeat zone 2023-10-08 13:58:22 +02:00
Jacques Lucke f3a1dd1eb5 Nodes: move socket declaration methods to base declaration builder
The goal here is to make it easier to use the socket declaration builder
for cases where the actual socket type is not known at compile time.
For that purpose, all the methods that are not dependent on the specific
socket type are moved to the base socket declaration builder.

A nice side effect of this is reduced templated boilerplate and that more
code can be moved out of the header.

With this patch, one is now forced to put type specific method calls before
generic method calls in a chain. For example `.default_value(...).supports_field()`
instead of `supports_field().default_value(...)`. In theory, we could keep
support for both orders but that would involve a lot of additional boilerplate
code. Enforcing this order is simple enough. Note that this limitation only
applies when chaining multiple method calls. This is still possible:
```
auto &decl = b.add_input<decl::Vector>("Value");
decl.supports_field();
decl.default_value(...);
```

Pull Request: https://projects.blender.org/blender/blender/pulls/113410
2023-10-08 13:30:31 +02:00
Campbell Barton 5c98d53125 Cleanup: use early return to reduce right-shift in ghost_event_proc 2023-10-08 19:30:52 +11:00
Campbell Barton 0df1a0df3d WM: use time-stamps from events for double-click check
Using the time from events is more accurate under Wayland which
can create events while the main thread is busy.
2023-10-08 19:30:52 +11:00
Campbell Barton 8adc4cf7fa Cleanup: remove redundant window size assignment in playanim_window_zoom 2023-10-08 17:59:38 +11:00
Campbell Barton c1a01ae7b4 WM: move last press time from the wmEvent into wmWindow
This was only ever used in the wmWindow::eventstate so it doesn't
make sense to store in every event.
2023-10-08 16:16:57 +11:00
Campbell Barton 39295476d0 Cleanup: store const events in GHOST's event handling logic 2023-10-08 15:23:40 +11:00
Campbell Barton fc78182cc8 Refactor: use const event data, use static_casts
In some cases processing events was modifying them, as there can be
multiple event consumers, manipulating events isn't correct.
Even though in practice it didn't cause issues, it's straightforward
not to do this and makes logic easier to reason about.
2023-10-08 15:23:39 +11:00
Campbell Barton 0bf7d15fa6 Cleanup: replace strncpy with memcpy for buffers of a known size 2023-10-08 14:34:27 +11:00
Campbell Barton 8f8a9ef488 Cleanup: remove unused GHOST_kEventTimer
There was a type error assigning customdata, (wmTimer *) was expected
although this data isn't created so it was never hit.
2023-10-08 14:31:15 +11:00
Campbell Barton 0742ef808f Fix writing past struct bounds of GHOST_TEventImeData
IME editing would cast GHOST_TEventImeData to wmIMEData then read/write
an additional member that doesn't exist in GHOST_TEventImeData.

In practice it's likely struct padding prevented this from showing up
as a bug. Nevertheless it's bad practice to rely on this.

- Make GHOST_TEventImeData read-only, move the is_ime_composing boolean
  into the window.
- Add static assert to ensure both structs are the same size.
- Correct code comments.
2023-10-08 14:29:08 +11:00
Campbell Barton 519d29423d Fix building WITH_GHOST_DEBUG without NDOF 2023-10-08 14:28:25 +11:00
Clément Foucault 3cca8680e0 EEVEE-Next: Split Thickness Approximation
This moves the thickness from shadow map
approximation out of the lighting and shadowing
loop. Instead of using the thickness from
the shadow tracing from each individual light
before SSS evaluation, we precompute the
average thickness from all shadowed light.
This is then mixed with the nodetree thicknes.

## SSS Translucency
This add back SSS transmission support by using
the mentionned thickness computation, and applying the
transmission profile on it. This is then applied on top of a
flipped normal LTC computation.

Pull Request: https://projects.blender.org/blender/blender/pulls/113401
2023-10-08 00:29:06 +02:00
Jesse Yurkovich 186189c1a6 Merge branch 'blender-v4.0-release' 2023-10-07 15:22:49 -07:00
Jesse Yurkovich 4a57a56f87 Fix #113387: Memory leak with Separate by Loose Parts
Mistake in 118ec54ec7

Free the `groups` array before returning.

Pull Request: https://projects.blender.org/blender/blender/pulls/113402
2023-10-08 00:21:31 +02:00
Clément Foucault 7c694c9d04 EEVEE-Next: Refactor Light evaluation
This allow splitting shadow and light evaluation.
This is the first step to deferred shadowing.

The evaluate closure types can be dynamically
set which mean we can have arbitrary BSDF
evaluation inside the same shader.

This also contain some refactor to `light_lib.glsl`
for more consistency and less clutter.

Note that this breaks the SSS translucency
as the shadow evaluation changes for these.
A new solution for this feature is to be found

Pull Request: https://projects.blender.org/blender/blender/pulls/113257
2023-10-08 00:15:41 +02:00
Jacques Lucke 29d4779bf9 Merge branch 'blender-v4.0-release' 2023-10-07 23:19:41 +02:00
Jacques Lucke 331247fcee Fix: don't set repeat zone output twice 2023-10-07 23:14:04 +02:00
Jacques Lucke e299c41312 BLI: assert that hash of key is the same after inserting it in hash table
These asserts would have caught the issue fixed in the previous
commit earlier.
2023-10-07 23:14:04 +02:00
Jacques Lucke 262c67d36b Fix: instance reference does not compare equal to copy of itself
A copy has to compare equal to itself and have the same hash
when it is supposed to be used as a reference in a hash table
like `VectorSet`.

Just making the hash not change during a copy by hashing the
geometry component pointers instead of the geometry-set pointer
does not work because of `geometry_set_from_reference` which
assumed that changing the geometry set does not change the
hash of the reference.

For now the solution is to just not use a hash table as this
makes it easier to get corretness right. Instead, just use a
regular `Vector` to store all the references which avoids
the need for a hash function.

This can now lead to some O(n^2) behavior when adding many
references. Fortunately, this is not too common yet, as usually
one has few references but many instances that use those.
It's still something that has to be solved at some point. It's
not clear yet what approach would work best:
* Reintroduce `VectorSet` for the references and properly update
  the reference positions in the hash table after the references
  have changed.
* Add a separate `Map<Object*/Collection*, int>` for the
  deduplication.
* Do deduplication on the call-site of `add_reference` by building
  a temporary map there.
2023-10-07 23:14:04 +02:00
Germano Cavalcante 8c1c782853 Merge branch 'blender-v4.0-release' into main 2023-10-07 12:12:06 -03:00
Germano Cavalcante 4abd59e204 Fix #113320: 'Automatic Constraint' not working in 2D editors
Caused by 586ffcd669

The condition `(t->flag & T_2D_EDIT)` went unnoticed.
2023-10-07 12:08:06 -03:00
Hans Goudey ce4663403b Cleanup: Return early to reduce indentation for 3D cursor drawing 2023-10-07 09:09:33 -04:00
Hans Goudey 36b88bc041 Merge branch 'blender-v4.0-release' 2023-10-07 09:08:37 -04:00
Hans Goudey e59a2b9a21 Fix: Incorrect rotation from 3D cursor tool node
The 3D cursor's quaternion and euler storage are not always in sync.
The quaternion rotation should be retrieved by speciffic functions,
which I had previously missed.
2023-10-07 09:08:06 -04:00
Campbell Barton 0c91466785 GHOST/Wayland: remove WITH_GHOST_WAYLAND_DBUS
This was only used for accessing cursor themes which only worked
with gnome and wasn't used in official releases.
Use the default theme or the theme defined by XCURSOR_THEME.

Eventually wp_cursor_shape_manager_v1 can be supported which avoids
having to access the theme.
2023-10-07 21:31:15 +11:00
Campbell Barton e8834565a3 CMake: support building GHOST/X11 without OpenGL 2023-10-07 21:22:15 +11:00
Campbell Barton f482e5979d CMake: set_and_warn_incompatible now warns if arguments are undefined
Previously this caused an error which can happen on other platforms that
don't define the features being checked.
2023-10-07 21:22:13 +11:00
Campbell Barton f3f494fd63 macOS: fix issues building without OpenGL headers
macOS has WITH_OPENGL_BACKEND disabled but still included
`epoxy/gl.h` and defined an unused NSOpenGLContext.
2023-10-07 20:51:24 +11:00
Campbell Barton 1dafc2786f CMake: fix building on macOS 2023-10-07 20:21:52 +11:00
Campbell Barton 149d80946e Cleanup: CMake formatting 2023-10-07 19:46:38 +11:00
Campbell Barton d2d654407f CMake: use set_and_warn_incompatible macro 2023-10-07 19:28:36 +11:00
Campbell Barton 1054b9721e CMake: allow WITH_GHOST_SDL with X11/WAYLAND backends
Multiple backends at once are now supported.
2023-10-07 19:21:31 +11:00
Campbell Barton 833eddafa3 CMake: add set_and_warn_incompatible macro, use for HEADLESS & GHOST_SDL
When WITH_GHOST_SDL or WITH_HEADLESS were used, the message didn't make
much sense, especially since the features warned about weren't
necessarily enabled or even supported by the platform.

Replace with a `set_and_warn_incompatible` macro which only reports
configuration changes based on incompatible features.
2023-10-07 19:11:51 +11:00
Campbell Barton 1bb098bf44 CMake: WITH_OPENGL_BACKEND=OFF excludes EGL/EPOXY includes & libraries
This isn't complete as opensubdiv, hydra & XR still depend on OpenGL.
2023-10-07 18:30:17 +11:00
Campbell Barton ce4a34d6b6 Cleanup: expand confusing conditional in panels poll function 2023-10-07 18:29:50 +11:00
Campbell Barton 77a94e9e38 Cleanup: various non-functional changes for C++ 2023-10-07 18:29:48 +11:00
Campbell Barton cf7e0c205f Cleanup: sort CMake file lists 2023-10-07 18:29:46 +11:00
Campbell Barton a17d6efe98 Cleanup: correct enums used as booleans 2023-10-07 18:28:09 +11:00
Campbell Barton 126cf64004 CMake: quiet undefined variable use with MOLTENVK on non-apple systems 2023-10-07 18:25:44 +11:00
Campbell Barton b434d40dbf CMake: quiet noisy messages on every run
Printing that a library is found every time CMake runs isn't helpful.
Restrict these messages for the first execution so messages are limited
to information developers may need to know such as features being
disabled because of incompatible configurations.
2023-10-07 18:20:30 +11:00
Campbell Barton 4b3e7b3928 License headers: add SPDX header 2023-10-07 18:13:22 +11:00
Clément Foucault 5e43bf3483 EEVEE-Next: Refactor Lightprobe irradiance evaluation
This refactor the lightprobes sample so that we always query
the spherical probe and the volume probe.

Then, given the BSDF type, we reconstruct the incoming radiance
differently depending on the ray probability blending between
the spherical and volume probe depending on ray probability.

Moreover, we implement cubemap normalization using
volume probe spherical harmonic data at spherical probe
position and at the shading point position.

Pull Request: https://projects.blender.org/blender/blender/pulls/113301
2023-10-06 23:37:38 +02:00
Jacques Lucke 144a5aa512 Cleanup: replace use of std::iota with more specific function
`iota` is name that has no meaning, it's not an acronym or initialism.
It's usually very cryptic when I come across it. Replacing it with a
specialized function makes the code more readible.
2023-10-06 23:01:16 +02:00
Hans Goudey 4cbcaf51cb Cleanup: Use "vert" term consistently in mesh randomization debug code
In this area the contraction is usally used. It's nice to be consistent.
2023-10-06 16:50:52 -04:00
Hans Goudey 36f7d33121 Fix: False positive geometry randomization in split edges node
See cc7da09c1b.

Splitting edges only potentially affects the order of edges and
vertices. Face corner vertex and edge indices are affected, but their
order isn't affected, and faces aren't affected at all. This didn't
cause problems, but correcting it shows users they can rely on
these consistencies after this operation.
2023-10-06 16:46:49 -04:00
Jacques Lucke bef0d6c067 Functions: extract remapped-params to make it reusable
This idea is of remapping parameters of lazy-functions is useful
not only for the repeat zone. For example, it could be used for the
for-each zone as well.

Also, moving it to a more general place indicates that there is no
repeat-zone specific stuff in it.
2023-10-06 22:32:51 +02:00