Commit Graph

103520 Commits

Author SHA1 Message Date
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
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
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
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
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
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
126cf64004 CMake: quiet undefined variable use with MOLTENVK on non-apple systems 2023-10-07 18:25:44 +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
Bastien Montagne
106d54554a Merge branch 'blender-v4.0-release' 2023-10-06 20:20:03 +02:00
Bastien Montagne
5f7f6b65f3 Fix (unreported) crash in 'startup.blend' GP default update code.
This commit fixes two different issues in
`BLO_update_defaults_startup_blend`:
* No check were done whether a given 'paint mode' tool settings actually
  exist or not before trying to 'update' it, leading to hard crash when
  some did not.
* Only the first Scene in loaded 'startup' Main would be processed -
  nothing prevents a `startup.blend` file to have more than one scene!
2023-10-06 20:19:26 +02:00
Jacques Lucke
d6f4a9a09b Merge branch 'blender-v4.0-release' 2023-10-06 18:38:07 +02:00
Jacques Lucke
b04f006a4c Fix: dynamic node declaration is not resetting update-skip flag 2023-10-06 18:37:46 +02:00
Hans Goudey
5052fe489c Cleanup: Simplify filling constant value per triangle in PBVH draw 2023-10-06 18:33:21 +02:00
Jacques Lucke
57e914fc8a Cleanup: move join geometry functionality to separate file
This allows us to reuse the functionality more easily.
2023-10-06 18:31:44 +02:00
Jacques Lucke
6279be4157 Geometry Nodes: use socket name instead of identifier as debug names
This makes it easier to read generated lazy-function graphs, especially when
there are zones or group nodes, because the socket identifiers on those
are some generated internal name.
2023-10-06 18:31:44 +02:00
Hans Goudey
9d201dc16b Cleanup: Simplify BMesh PBVH draw data upload
Instead of using a lambda with a FunctionRef argument, just write the
loops explicitly. This results in a bit more boilerplate code and a bit
more repetition, but the overall design and flow is much simpler. Based
on the results in f10965dcb8, it can improve performance too.
2023-10-06 18:16:30 +02:00
Sergey Sharybin
9a44445667 Fix assert in PBVH face set drawing code
The assert was assuming that the attribute request is properly
initialized and that was not the case: the "special" data layers
like coordinates, normals, masks, and face sets did not initialize
domain in the attribute request.

The domain is now properly initialized. As well as there is an
assert added in other PBVH types for the face sets. It is possible
to add asserts in more places, but it is not directly related to
this CL.

Pull Request: https://projects.blender.org/blender/blender/pulls/113354
2023-10-06 18:05:59 +02:00
Clément Foucault
eb9d765eea Fix EEVEE-Next: Broken compilation on Metal 2023-10-06 17:53:29 +02:00
Miguel Pozo
026b81ce7c Merge branch 'blender-v4.0-release' 2023-10-06 17:49:15 +02:00
Miguel Pozo
c6194afc41 Fix: Workbench: Missing texture flag
Drawing volumes would trigger an assertion after fe39456ba5.
2023-10-06 17:48:40 +02:00
Lukas Tönne
711c9c5553 Fix for wobbly volume object outlines in the viewport
The outlines of volume grids in the viewport are noticeable "wobbly"
when they should simply represent grid boxes. This is especially
noticeable on simple regular grids such as the "Volume Cube" geometry
node output.

The reason is that the outlines generated by taking a triangulated mesh
of the grid boxes and then growing it by successively scaling each
triangle. The offset for each vertex grows proportional to its degree
(number of connected edges). The fix is to divide each vertex's offset
by its degree.

The resulting mesh is much more regular and closer to to 1% desired
growth factor.

Old: ![Screenshot_20230829_155602](/attachments/87fbdca3-fb9d-49d8-b4f5-6780d1c72f79)
New: ![Screenshot_20230829_155648](/attachments/4452c52b-96df-4200-a02f-3d0d8aa8680e)

Pull Request: https://projects.blender.org/blender/blender/pulls/111657
2023-10-06 17:43:07 +02:00
Jacques Lucke
87bf783479 Merge branch 'blender-v4.0-release' 2023-10-06 17:28:14 +02:00
Jacques Lucke
2fdb38f972 Fix: failing string search test 2023-10-06 17:27:48 +02:00
Germano Cavalcante
cf93c16775 Fix #112580: Limit Constraint with 'Affect Transform' not working properly in 'World Space'
The problem is observed with the "Limit Distance" and "Limit Location"
constraints.

There is an incorrect usage of `td->mtx` and `td->smtx` when converting
`TransData` space from local to global.

In this case, the code is concatenating matrices instead of converting
the location component space.

Also, these matrices only inform the global transformation components
of rotation and scale. They do not include location.

Since the "Limit Distance" and "Limit Location" constraints only require
the location component, it is not necessary to convert the rotation and
scale components.

So, the solution is to convert the location component space instead of
concatenating matrices.

Pull Request: https://projects.blender.org/blender/blender/pulls/112601
2023-10-06 12:19:53 -03:00
Germano Cavalcante
7e078b724a Fix #112580: Limit Constraint with 'Affect Transform' not working properly in 'World Space'
The problem is observed with the "Limit Distance" and "Limit Location"
constraints.

There is an incorrect usage of `td->mtx` and `td->smtx` when converting
`TransData` space from local to global.

In this case, the code is concatenating matrices instead of converting
the location component space.

Also, these matrices only inform the global transformation components
of rotation and scale. They do not include location.

Since the "Limit Distance" and "Limit Location" constraints only require
the location component, it is not necessary to convert the rotation and
scale components.

So, the solution is to convert the location component space instead of
concatenating matrices.

Pull Request: https://projects.blender.org/blender/blender/pulls/112601
2023-10-06 17:14:25 +02:00
Jacques Lucke
c37faf8c2f Merge branch 'blender-v4.0-release' 2023-10-06 16:41:38 +02:00
Jacques Lucke
0aa91a30dd Fix #113092: take highlighted part of search item into account in more places
When using menu-search, only the last part of a search item is highlighted.
When sorting the search results, this should be taken into account and
the highlighted words should be prioritized.

This was already partially implemented in 56e98f8ba6. Now it's also
taken into account with prefix search. For example, `TC` now prefers
`Input > Texture Coordinate` over `Texture > Checker Texture`.
2023-10-06 16:38:45 +02:00
Jacques Lucke
046155572d UI: use recent search for weighting only if the query is short
The idea is that accessing recent searches is mostly only useful when actually
searching for something very recent, which means that it would show up at the
top even if the query is empty or extremely short. If the user is typing a longer
query, it likely means that what is at the top is not what is actually desired, so
it's better to not take recent searches into account anymore.

Pull Request: https://projects.blender.org/blender/blender/pulls/113338
2023-10-06 16:16:07 +02:00
Hans Goudey
0fc3e3dd98 Fix: Debug build error from incorrect PBVH draw assert 2023-10-06 15:47:54 +02:00