Commit Graph

102233 Commits

Author SHA1 Message Date
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
Pratik Borhade
4462100cee GPv3: Delete channels
Support deleting Grease pencil channels in dopesheet.
`remove_layer` function is used to remove the layer from GP object.

Pull Request: https://projects.blender.org/blender/blender/pulls/111426
2023-08-25 11:00:37 +02:00
Campbell Barton
0094bf8357 Remove debug printf committed by accident 2023-08-25 17:13:49 +10:00
Campbell Barton
4c0ef81926 Fix frame-rate display using times from previous playback
The average times weren't reset so the last draw time would be used
making the FPS seem low for the first ~10 or so frames.
The averages from the last time the playback operator ran were also
used which could be misleading although this was also limited to the
first 8 frames.

Resolve by freeing the ScreenFrameRateInfo on animation start/end.
2023-08-25 17:01:18 +10:00
Campbell Barton
2c587e31dd Fix error in frame-rate display check
Mistake in 1954baaed3
caused a near-zero FPS value to be used when animation playback started.
2023-08-25 17:01:16 +10:00
Campbell Barton
1954baaed3 Fix frame-rate display with multiple viewports open
Calculating the average FPS was done in the draw function which
also overwrote the old value. With multiple viewports the same
time-delta would be written multiple times causing the FPS display
not to use use REDRAW_FRAME_AVERAGE as intended.

Resolve by only calculating the average once per frame change across
multiple viewports.
2023-08-25 16:24:41 +10:00
Campbell Barton
09f61f6881 Cleanup: enforce documented convention for RNA enum naming
This was noted in code comments and checked in Python documentation
generation but not at build time.

Since these enums are identifiers that end up included in various places
enforce the `rna_enum_*_items` convention which was noted as
the convention but not followed strictly.

Partially reverts [0], avoids having to deal with multiple prefix types.

[0]: 3ea7117ed1
2023-08-25 13:35:58 +10:00
Campbell Barton
4d757510be Cleanup: remove unnecessary context arg to transform drawing functions 2023-08-25 10:46:24 +10:00
Campbell Barton
89c2e3c9dc Cleanup: remove unnecessary context argument to drawSnapping 2023-08-25 10:25:58 +10:00
Campbell Barton
2839e23a45 Fix sequencer snap failing to draw with drag & drop
TransInfo wasn't initialized, causing drawSnapping to depend on
uninitialized stack memory. When `t.tsnap.flag & SCE_SNAP` happened
to be set - snap would draw.

Initialize the TransInfo struct and set SCE_SNAP explicitly.
2023-08-25 10:19:33 +10:00
Campbell Barton
7074c210cc Cleanup: format 2023-08-25 09:40:42 +10:00
Campbell Barton
3de8900ed6 Cleanup: spelling in comments 2023-08-25 09:40:42 +10:00
Almaz-Shinbay
ed5110c0ef Outliner: Port pose channel elements to new tree-element code design
No user visible changes expected.

Part of #96713, continuation of work started in 249e4df110 and 2e221de4ce.
Refer to these for a motivation and design overview.

Adds a new class for pose channel elements.

Pull Request: https://projects.blender.org/blender/blender/pulls/111167
2023-08-24 23:18:20 +02:00