Commit Graph

102245 Commits

Author SHA1 Message Date
Hans Goudey
df7f22d28e Cleanup: Simplify mesh primitive grid and cuboid quad creation
Fill face offsets in one multithreaded loop with an offset indices
utility function instead of keeping track of the index and setting
the offset for each face.
2023-08-28 21:57:22 -04:00
Rawalanche
411cd827b7 Nodes: Move Auto-Offset toggle to User Preferences
Move Auto-Offset toggle from Node Editor View menu
into the Editing > Node Editor section of User Preferences,
to reflect its use as a workflow option not configured
per editor or per file.

Pull Request: https://projects.blender.org/blender/blender/pulls/111589
2023-08-29 01:18:33 +02:00
Iliya Katueshenock
226359ec48 Mesh: Parallelize vertex and edge to corner topology map creation
Change the algorithm to make better use of multiple CPU cores. First
offsets are created by counting the number of elements using each
vertex. Those offsets are used during the next phase that adds indices
to each group in parallel. Atomic increments are used to add elements
to each group. Since the order in each group is non-deterministic,
they are sorted in parallel afterwards.

The performance improvement depends on the number of cores, CPU caches,
memory bandwidth, single threaded performance, and mesh topology. In
our tests, performance improved by 3-4.5x for large grid-like meshes.

See [1] for investigation of this algorithm and potential alternatives.

1. https://hackmd.io/@s0TMIS4lTAGwHVO20ECwpw/build_edge_to_loop_map_tests.

Pull Request: https://projects.blender.org/blender/blender/pulls/110707
2023-08-28 22:32:31 +02:00
Miguel Pozo
ee7e187b7f Fix #111561: Workbench-Next: Overlay in-front compositing
Copy the in-front depth buffer to `DefaultTextureList::depth_in_front` for
correct overlay compositing.

Pull Request: https://projects.blender.org/blender/blender/pulls/111630
2023-08-28 21:01:56 +02:00
Miguel Pozo
0fa8b099a5 EEVEE-Next: Move the transmittance LUT to the Utility Texture
Saves one texture slot for forward materials.

Pull Request: https://projects.blender.org/blender/blender/pulls/111535
2023-08-28 21:01:08 +02:00
Germano Cavalcante
a0c5467b7d Fix #111592: Merge modifier may crash in some cases
The count of faces destroyed could be wrong when more than one groups
of vertices on the same face resulted in the face collapsing.

The solution is to break the loop on the first collapsed face
detection.

Caused by 6ec842c43c.
2023-08-28 14:33:48 -03:00
Miguel Pozo
3acda70d8c Fix: Workbench-Next: Viewport Image Render 2023-08-28 18:12:39 +02:00
Bastien Montagne
5ba692898e I18N/UI messages fixes. 2023-08-28 18:02:31 +02:00
Almaz-Shinbay
60560c7da5 Cleanup: remove irrelevant comment in TreeElementModifier
The comment doesn't provide any useful information, as it wasn't removed
before the merge of 28f4bb2007.

Pull Request: https://projects.blender.org/blender/blender/pulls/111621
2023-08-28 17:32:50 +02:00
Bastien Montagne
a931c7e7b4 Writefile: Enable some checks systematically when writing blendfile.
These checks (shape keys and ID names) cost less than 1ms in Pets
production files, so think they are OK to run systematically.

The library consistency one is way more expensive (~200ms), so keeping
it behind the G_DEBUG_IO debug option for now.
2023-08-28 15:44:36 +02:00
Jeroen Bakker
779bfe2734 Cleanup: Make format 2023-08-28 15:31:20 +02:00
Gilberto Rodrigues
fb6687a790 Viewport: Add toggle for edit mode overlays fresnel
Adds a userpref toggle for the edit mode overlays fresnel.
The edit mode fresnel is only a bit useful in edge cases, like
very dense photogrametry, and the problem is that it causes
more eye strain when modeling for many hours. And it's
benefit on shape readability is small compared to it's negative
impact on selection visibility. It makes the selection color to a
darker less saturated color instead of the theme color, which
leads to worse contrast between the selection and the mesh
or with the background, and also makes the unselected (black)
brighter, also reducing contrast. So it's off by default.

This was split up from https://projects.blender.org/blender/blender/pulls/110097

Pull Request: https://projects.blender.org/blender/blender/pulls/111494
2023-08-28 15:29:25 +02:00
Bastien Montagne
52300ccc87 Writefile: Add validation of ID names as part of pre-write checks.
NOTE: This code remains only executed in 'unlikely' case `G_DEBUG_IO` is
enabled. Think this should be systematically done, even though it can
have a non-neglectable cost... Will submit design task first though.
2023-08-28 15:18:50 +02:00
Hans Goudey
3db523ab3e Cleanup: Move BLO headers to C++
Except for BLO_readfile.h, which is still included by C files.

Pull Request: https://projects.blender.org/blender/blender/pulls/111610
2023-08-28 15:01:05 +02:00
Bastien Montagne
66c05fe368 Fix RNA collection accessor (string search) not checking for null key pointer.
While in a way one could argue calling code could check for such case,
in practice it is way handier for the search code itself to just return
'not found' value in such case, rather than crash!
2023-08-28 13:18:11 +02:00
Bastien Montagne
47672bd06a Readfile: Add validation call for invalid ID naming.
Add a call to `BKE_main_namemap_validate_and_fix` in the 'general
sanity validation' `after_liblink_merged_bmain_process` function.

This will detect, fix and report invalid ID naming issues (case found in
an early Gold production file).
2023-08-28 13:18:11 +02:00
Bastien Montagne
c4a0bd7d50 Fix BLI_findstring_ptr & co. potentially accessing NULL pointer.
By definition, unlike in `BLI_findstring` & co, there is no guarantee
that the `const char *id_iter` pointer here is not a NULL one.
2023-08-28 13:18:11 +02:00
Sergey Sharybin
42473099b4 Cleanup: Braces around initialization
Pull Request: https://projects.blender.org/blender/blender/pulls/111605
2023-08-28 12:46:27 +02:00
Jeroen Bakker
3806febb15 Cleanup: Make format 2023-08-28 11:12:40 +02:00
Gilberto Rodrigues
1f4c7a36df Wireframe color option for all shading modes
Enables three options of wireframe color for all shading modes: theme color, object color
and random color.  Previously this was exclusive to the wireframe shading mode.

Pull Request: https://projects.blender.org/blender/blender/pulls/111502
2023-08-28 11:04:40 +02:00
Campbell Barton
35a5297ae6 Cleanup: replace magic number with sizeof(..) 2023-08-28 18:56:25 +10:00
ChengduLittleA
02406e17a0 Fix #111601: VSE strip modifier copy ensure unique name
Previously `SEQ_modifier_list_copy` in append mode does not ensure
unique strip name, which will result in duplicated names in target
modifier list, then `strip_modifier_remove(name="something")` can remove
the wrong one later on. Now fixed using `BLI_uniquename`.

Pull Request: https://projects.blender.org/blender/blender/pulls/111602
2023-08-28 10:05:22 +02:00
Campbell Barton
c388ff6f89 Viewport: show fractional FPS playback values
When the scenes FPS is not a whole number - display the fractional FPS
in the viewport. Previously, 29.97 FPS would round to 30 FPS for e.g.
2023-08-28 17:25:18 +10:00
Weizhen Huang
8a735d0aa4 Fix: EEVEE: Incorrect GGX BRDF pdf and BTDF evaluation
* Using standard NDF and Smith shadowing-masking terms. The previous
`xxxx_opti()` functions were faster to evaluate, but confusing and
error-prone.
* After correcting the BRDF pdf, the prefiltered environment LOD bias
needs to be adjusted to avoid overblurred reflections.
* Corrected the half-vector computation in BTDF evaluation, added check
for invalid configuration due to total internal reflection or `eta == 1`.
* Use `saturate()` instead of `max()` when no division is needed because
the former is faster.
* Indirectly fixes EEVEE-Next refraction denoising.

Pull Request: https://projects.blender.org/blender/blender/pulls/111591
2023-08-27 20:51:32 +02:00
Campbell Barton
6538a58725 Correct missing include from 7458d68b35
This worked on Linux but failed on WIN32 & macOS.
2023-08-27 19:13:14 +10:00
Campbell Barton
0e2f4046c6 Fix #111579: erratic viewport FPS at high frame rate
Setting the FPS to 120 caused the FPS to flicker erratically between
130 & 140 FPS.

This also impacted lower frame-rates with 23.98 playing back at 24.03
FPS on my system, 30 FPS played back at 30.13 FPS.
This problem was hidden by the FPS display rounding to an integer.

Regression in 2.5x series (worked in 2.49).

Resolve by clamping the sleep time in the main event loop so the 5ms
sleep doesn't result in sleeping when timers are scheduled to run.

There is still some visible FPS jitter that can be solved by using a
higher resolution sleep interval but that's out of scope for this fix.
2023-08-27 17:26:05 +10:00
Campbell Barton
7458d68b35 Scene: increase the number of FPS samples, use fixed-point arithmetic
Using a higher number of samples (enough samples to account for the last
second or two of playback for e.g.) can be useful when comparing minor
changes in overall playback speed, where the behavior of multi-threaded
operations can make the value jitter with 8 samples (default).

Using fixed-point arithmetic means the average FPS can be updated
by subtracting the oldest FPS sample before adding the new value,
instead of having to average an array of floats every draw.
Increasing the number of samples now only uses a little more memory
(20kb at most).

The error margin from using fixed-point arithmetic is under 0.5
microseconds per frame - more than enough precision for FPS display.
A commented define is included that shows the error margin when enabled.
2023-08-27 12:25:32 +10:00
Weizhen Huang
03071e8c02 Cleanup: remove unused test file
This file was committed by mistake. There is no lightprobe test
2023-08-26 21:09:04 +02:00
Campbell Barton
b274952694 Cleanup: move scene FPS calculation into it's own file
Defining ED_scene_* functions in screen_edit.cc didn't make much sense.
Also make ScreenFrameRateInfo a private struct.
2023-08-26 19:02:02 +10:00
Campbell Barton
19850496cb Cleanup: remove unused function, format 2023-08-26 17:05:19 +10:00
Weizhen Huang
67843e188b Fix: EEVEE-Next: incorrect GGX BRDF LUT coordinates 2023-08-26 00:23:00 +02:00
Rawalanche
d86d2a41e0 Fix #94148: Top bar, Status bar Header Colors Differ from Theme Setting
Fixes the Top and Status bars having their specified theme colors
incorrectly modified by highlight effect intended for active editor
headers only

Pull Request: https://projects.blender.org/blender/blender/pulls/111265
2023-08-26 00:16:20 +02:00
Hans Goudey
383a145a19 Mesh: Share normals caches by splitting vertex and face calculation
Since vertex and face normals can be calculated separately, it simplifies
things to further separate the two caches. This makes it easier to use
`SharedCache` to avoid recalculating normals when copying meshes.

Sharing vertex normal caches with meshes with the same positions and
topology allows completely skipping recomputation as meshes are
copied. The effects are similar to e8f4010611, but normals are much
more expensive, so the benefit is larger.

In a simple test changing a large grid's generic attribute with geometry
nodes, I observed a performance improvement from 12 to 17 FPS.
Most real world situations will have smaller changes though.

Completely splitting face and vertex calculation is slightly slower
when face normals aren't already calculated, so I kept the option
to recalculate them together as well.

This simplifies investigating the changes in #105920 which resolve
non-determinism in the vertex normal calculation. If we can make the
topology map creation fast enough, that might allow simplifying this
code more in the future.

Pull Request: https://projects.blender.org/blender/blender/pulls/110479
2023-08-25 23:06:06 +02:00
Germano Cavalcante
da510b0d73 Cleanup: Remove unused variable
`rna_enum_snap_element_items` is no longer used since 932baa18b7.
2023-08-25 17:29:28 -03:00
Harley Acheson
7405993cb7 UI: Object Types Visibility Popover Tweaks
Visual changes to the Object Types Visibility Popover, adding icons,
changes to order and alignment, and tooltips.

Co-authored-by: Pablo Vazquez <pablo@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/111285
2023-08-25 22:17:48 +02:00
Harley Acheson
eb0a9346df Cleanup: Make format
Only formatting changes.
2023-08-25 12:18:13 -07:00
Julian Eisel
211d631428 Fix error in own previous fix (56781c80b7) 2023-08-25 20:24:26 +02:00
Julian Eisel
56781c80b7 Fix #111212: Crash in menu search when cursor is outside the window
When the mouse cursor is outside the window, it's expected to not have
an active area set in context on such screen level operators. Use the
existing context query that handles this case.
2023-08-25 19:47:36 +02:00
Julian Eisel
3220912760 Fix 109320: Crash when showing tooltip in menu search (Intel MacOS)
`uiBut` cannot simply be zero-allocated any more and needs proper construction
(so the `std::function` members can be constructed properly for example). I'm
not entirely sure where and how exactly the crash happens (happens in release
builds only, so probably optimization related), but this change must be done
either way and fixes the issue.
2023-08-25 19:18:40 +02:00
Jacques Lucke
b6df32f740 Fix #111273: multiple vertex weight sliders show the same value
This was broken by cd74ba6413. There I somehow completely missed that the
panel would not only show the active vertex weights, but the weights in all vertex
groups the vertex is part of.

Pull Request: https://projects.blender.org/blender/blender/pulls/111421
2023-08-25 18:36:04 +02:00
Hans Goudey
cf9fcbf24e Cleanup: Use C++ threading API in sculpt/paint code
Remove the global `SculptThreadedTaskData` struct which contained
the arguments to ALL multi-threaded sculpt functions. Use the C++
threading API instead of the old task API, moving the arguments
previously stored in the shared struct to actual function arguments.

Pull Request: https://projects.blender.org/blender/blender/pulls/111525
2023-08-25 18:18:35 +02:00
Sergey Sharybin
4151691552 Fix #111504: Regression: Mesh draw corruption in sculpt mode
The commit f10965dcb8 introduced a regression in the way how the VBOs
are filled by assuming the requested VBO attribute type has the same
alignment as the CPU and is the same on different platforms.

Unfortunately, this turned out to not be the case.

Switch the mask attribute to be float on the GPU, which has a downside
of increased bandwidth to be transferred, but a benefit of less compute
power needed to update the VBO.

The fix is suggested by Clement.

Pull Request: https://projects.blender.org/blender/blender/pulls/111521
2023-08-25 17:58:35 +02:00
Lukas Tönne
9a4a167476 UI: Add a context argument to tree view item rename functions.
This is needed by #111348 to trigger updates of node groups in `Main`
after renaming panels. The `rename_button_fn` already has a context but
wasn't making use of it.

Pull Request: https://projects.blender.org/blender/blender/pulls/111522
2023-08-25 16:00:05 +02:00
Guillermo Venegas
b05d44b75b Fix #109847: Inconsistent panning in editors
Not updating `deltax/deltay` property values of the `VIEW2D_OT_pan`
operator can cause reusing delta values from previous modal iterations.

Pull Request: https://projects.blender.org/blender/blender/pulls/110547
2023-08-25 15:02:02 +02:00
Bastien Montagne
a186f5e48a Cleanup: unused variable in release builds. 2023-08-25 12:24:21 +02:00
Iliya Katueshenock
888a7f0bf0 Cleanup: remove C++ RawArray
Unused, and conflict with rna `RawArray`.

Pull Request: https://projects.blender.org/blender/blender/pulls/111491
2023-08-25 11:46:37 +02:00
Campbell Barton
b150b47720 UI: add a preference for the number of samples used for FPS playback
This was hard coded to 8, which can still result in a number that
jitters making the overall FPS difficult to measure.

The default is still 8, but this is now a preference that can be
increased for values that don't jitter as much.
2023-08-25 19:33:48 +10:00
Pratik Borhade
faff3d1d15 Cleanup: Comment style
Pull Request: https://projects.blender.org/blender/blender/pulls/111509
2023-08-25 11:14:19 +02:00
Clément Foucault
2eb447b00f EEVEE-Next: Shadow: Fix shader compilation
Some platforms do not support `bool` type as
shared variables, and no component reference
for atomics.
2023-08-25 11:07:00 +02:00
Bastien Montagne
e20a284cb9 Fix #111488: Copying object crashes Blender after recent refactor.
Caused by 8bb5916183.

Trivial mistake, would have been caught by a basic test, so also added
said test for the 'write partial' feature.
2023-08-25 11:04:03 +02:00