Commit Graph

126474 Commits

Author SHA1 Message Date
Hans Goudey
f10965dcb8 Sculpt: Improve PBVH draw performance for meshes
Reduce overhead of copying attribute data into GPU buffers when the
PBVH is active. The existing lambda with a FunctionRef callback had
a significant overhead. While that was reduced by 25917f0165
already, even making the `foreach_faces` lambda into a template gave
significant overhead compared to simpler loops. Instead, separate
value conversion and iteration over visible triangles in a way that the
compiler is able to optimize more easily.

According to the GPU module, it's also better to use raw data access
than `GPU_vertbuf_raw_step`, since the data format strides aren't
meant to vary by platform, and the runtime stride can have a
noticeable performance impact.

Also avoid recalculating face normals, since they're already used to
calculate vertex normals anyway (since ac02f94caf).

I tested the runtime of the initial data-upload after entering sculpt
mode with a 16 million vertex mesh. Before, that took 1350 ms, after
it took 680 ms, which is almost a 2x improvement. In my tests, the
performance improvement was only observable for the initial data
upload, theoretically it is a more general change though.

It's possible that a similar optimization could be applied to multires
or dynamic topology sculpting, but that can be looked at later too.

Pull Request: https://projects.blender.org/blender/blender/pulls/110621
2023-07-31 14:40:41 +02:00
Clément Foucault
92be22ff4b Fix: EEVEE-Next: Broken world diffuse irradiance 2023-07-31 14:28:55 +02:00
Caleb-Cleavinger
20091a2b9e Fix #110096: Crash Crash on calling curve pen operator
Changed poll function to `ED_operator_editcurve` to prevent
crashing when accessed from the developer menu in modes other
than edit mode.

Pull Request: https://projects.blender.org/blender/blender/pulls/110619
2023-07-31 14:06:18 +02:00
Amelie Fondevilla
6f8ff2846f GPv3: Add API function to get active frame
Adds the Layer method `frame_at` which finds the frame that is active at a given frame number.

Pull Request: https://projects.blender.org/blender/blender/pulls/110583
2023-07-31 12:23:31 +02:00
Campbell Barton
79e7449a52 Cleanup: remove unused declarations 2023-07-31 20:01:40 +10:00
Campbell Barton
6d2326dabf Cleanup: use function style casts 2023-07-31 19:57:32 +10:00
Campbell Barton
90e123c746 Tools: fix code_clean cleaning generated files
When a relative build directory was passed in, code-clean wasn't
filtering out generated sources and would clean them too.
2023-07-31 19:57:27 +10:00
Sergey Sharybin
c2dfa1a066 Fix crash in GPU compositor when viewer size changes
This change fixes crash which happens when a viewer node is used for
backdrop, and the scene render size is modified. After the modification
the render size and the texture size gets out of sync since the texture
was never adapting for the size change.

Pull Request: https://projects.blender.org/blender/blender/pulls/110590
2023-07-31 11:17:14 +02:00
Alaska
462dbe9929 Fix NaN in Cycles light tree bone.axis
Fix `NaN` in the light tree `bcone.axis` that can occur when
normalizing direction vectors of 0 length.

Pull Request: https://projects.blender.org/blender/blender/pulls/110374
2023-07-31 10:56:15 +02:00
Chris Blackbourn
fc2ee7d912 Cleanup: improve uv packing inline comments 2023-07-31 16:49:38 +08:00
Alaska
18575e411b Cleanup: Cycles device_update_lights
Rearrange and remove some unnecessary lines of code
to improve readability.

Pull Request: https://projects.blender.org/blender/blender/pulls/110377
2023-07-31 10:46:31 +02:00
Alaska
1261272da7 Cleanup: Simplify get centroid in Cycles light tree builder
`scene->lights[object_id` is already available as `lamp`.

Pull Request: https://projects.blender.org/blender/blender/pulls/110376
2023-07-31 10:40:40 +02:00
Chao Li
b40e8242ca GPv3 : Select circle/lasso grease pencil frames
Adapt the `ACTION_OT_select_circle` and `ACTION_OT_select_lasso` operators to take into account grease pencil layer channels. These operators both call `region_select_action_keys` which subsequently calls `region_select_elem` function. In the last function, grease pencil layer needs to be taken into consideration. This resolves #110521

Pull Request: https://projects.blender.org/blender/blender/pulls/110558
2023-07-31 10:35:36 +02:00
Campbell Barton
52acf6a6ec Cleanup: correct file names in comments after C -> C++ renaming
Use back-tick quotes to differentiate these from plain text.
2023-07-31 13:02:30 +10:00
Chris Blackbourn
a35ad5899f Fix #110626: restore abf uv unwrap logic
Regression from 8ace65e3c6.
2023-07-31 10:40:38 +08:00
Campbell Barton
74a222f0e0 Cleanup: rename BMEditMesh 'editData' to 'em'
Avoid confusion with EditMeshData, often accessed via
`mesh->runtime->edit_data`.
2023-07-31 10:20:26 +10:00
Campbell Barton
724755879e Cleanup: spelling in comments, use doxygen doc-strings 2023-07-31 10:18:09 +10:00
Campbell Barton
d5fc5c5a04 Cleanup: quite MSVC warning in datatoc_icon.cc 2023-07-31 10:00:23 +10:00
Campbell Barton
f324cbf2a6 Cleanup: use doxygen docs for datatoc_icon 2023-07-31 10:00:23 +10:00
Bastien Montagne
a14c747fe8 Fix (unreported) minor bug in RNA/Liboverride apply code.
The wrong RNA pointers were passed (passing the root ones instead of the
ones actually owning the rna-path-resolved property).

This was likely a harmless mistake, since it only affected RNA
collections of IDs, afaik we currently don't have many (if any) of these
in non-ID RNA structures. The children collections and objects in a
Collection data-block RNA structure e.g. were not affected.

But the potential consequence of that bug would have been missing
automatic detection of some needed liboverride resyncs.
2023-07-30 17:51:01 +02:00
Campbell Barton
344ba9691b WM: use repr for WM_OT_context_toggle_enum
Use instead of "'%s'" to avoid problems in the unlikely instance of
the strings containing characters that need escaping.

Also use a ternary operator instead of indexing a tuple.
2023-07-30 16:14:14 +10:00
Campbell Barton
53e6803977 Cleanup: check for "BaseException" instead of "Exception"
Prefer the more generic exception type as it's possible exceptions
derive from this and not "Exception".

Also use the name 'ex' for exceptions instead of 'e'.
2023-07-30 16:14:13 +10:00
Campbell Barton
9f5be2a861 Cleanup: quiet pylint warnings using BaseException 2023-07-30 16:14:11 +10:00
Campbell Barton
fd0977284b Cleanup: simplify typedefs
Also remove unused `buffer_struct`.
2023-07-30 16:14:09 +10:00
Hans Goudey
79cb56e1f1 Cleanup: Remove check for null object when building PBVH
In the two callers of `BKE_sculpt_object_pbvh_ensure`,
the object is already expected to be non-null.
2023-07-29 23:47:13 -04:00
Hans Goudey
c4ac4ecc4c Mesh: Extract loose edges and vertices in two threads
The process of calculating the caches for loose edges and loose vertices
and extracting their indices are independent and both single threaded.
If the CPU isn't doing anything else, using two threads can half the
total time for both. For example, this saves 40-50ms opening a file
with a 16 million face mesh.
2023-07-29 23:47:13 -04:00
Hans Goudey
38fc111fc9 Cleanup: Clarify string usage in PBVH draw
Use StringRef where possible to avoid copying strings, avoid
redundant string returns, and use std::string for attribute
request names now that all the relevant code is C++.
2023-07-29 23:47:13 -04:00
Hans Goudey
e749599f95 Cleanup: Remove using keyword for std::string in pbvh draw
Typically it's considered questionable to add `using` for `std` types
and functions. With just a few more characters, the type is always
familiar.
2023-07-29 23:47:13 -04:00
Campbell Barton
52109ff7f0 Refactor: out addon_utils fake_module(..) into a top-level function
Even though it's private, it's useful to be able to access this for
prototyping support for scanning addons in other other locations.
2023-07-29 22:20:40 +10:00
Campbell Barton
6ff81c6505 PyAPI: internal changes needed to support sub-modules as add-ons
Apply minor changes needed for an add-on to be a sub-module.
2023-07-29 22:15:11 +10:00
Jacques Lucke
830fb684c3 Fix: failing mesh boolean test in debug build due to unnormalized normal
This was accidentally changed in f557222a7b.
2023-07-29 12:03:07 +02:00
Campbell Barton
916f6a7bf3 UI: add weight paint gradient menu items for discoverability 2023-07-29 16:33:14 +10:00
Campbell Barton
69e290d2fe Cleanup: code comments
Note that the previous commit [0] added a workaround for MMB-Emulation,
which should have been a separate commit.
(Ctrl-Shift-LMB for weight paint selection).
Extended the code comment for this.

[0]: cfffd813c1
2023-07-29 16:20:03 +10:00
Campbell Barton
cfffd813c1 Cleanup: use typed enum for UI_ITEM_* flags
Using an int lead to confusion with other flags often used with buttons.
For e.g. these flags could be easily confused with uiItem::flag.
2023-07-29 15:32:45 +10:00
Campbell Barton
acbf16d91a Cleanup: correct invalid flag types
- wmOperatorCallContext was used to store UI_ITEM_* flags.
- Collada export use passed invalid UI_ITEM_* flag as an argument.
2023-07-29 14:52:47 +10:00
Campbell Barton
98f848dc4b Cleanup: use typed flag for uiItem::flag 2023-07-29 14:48:13 +10:00
Campbell Barton
ed01e16aa6 Cleanup: quiet uninitialized warnings 2023-07-29 13:47:57 +10:00
Campbell Barton
42713bf0f8 Cleanup: quiet uninitialized warnings for finder root directories 2023-07-29 13:47:55 +10:00
Campbell Barton
2bc89982dc Cleanup: remove unused variable 2023-07-29 13:47:53 +10:00
Germano Cavalcante
22206a1592 Fix #110571: Property option 'TEXTEDIT_UPDATE' no longer updates
The `ENUM_OPERATORS` utility was used in `PropertyFlag` in d154ebfa83.

In that commit, it was set with a maximum value lower than
`PROP_TEXTEDIT_UPDATE`.

Consequently, when `bpy_props.c` was converted to C++ in 6fcecb7e46,
the cast to `PropertyFlag` caused the value of `PROP_TEXTEDIT_UPDATE`
to be cleared.

The solution is to set the maximum value to `PROP_TEXTEDIT_UPDATE`
instead of `PROP_NO_DEG_UPDATE`.
2023-07-28 17:51:54 -03:00
Ray Molenkamp
6228338d74 deps_builder: fix zlib homepage
was accidentally committed as a comment
2023-07-28 13:17:04 -06:00
Jacques Lucke
860196d5a1 Geometry Nodes: extract bake items from simulation baking
The goal is to reuse the same bake items for simulation and normal baking (#110137).
Previously, the bake data was tied to a simulation state which made it harder to reuse.

Now the code for the following things can be reused easily:
- Convert geometry node socket values into bake items and back.
- Serialize and deserialize bake items.

Pull Request: https://projects.blender.org/blender/blender/pulls/110577
2023-07-28 18:30:32 +02:00
Brecht Van Lommel
635c2591ff Fix #109683: Cycles AOV render without surface output missing attributes 2023-07-28 17:35:50 +02:00
Bastien Montagne
ef26e5d313 Cleanup: Rename 'override' variables and parameters to 'liboverride'.
`override` is a reserved keyword in C++.

Pull Request: https://projects.blender.org/blender/blender/pulls/110534
2023-07-28 16:37:06 +02:00
Bastien Montagne
ded695bc73 LibOverride/RNA Diffing refactor.
Use a context structure for both parameters and results of the rna
diffing functions, instead of 10+ individual parameters.

Also switch to C++ features like `std::string` and `std::optional`
instead of handling manually buffers and allocated C-style strings.

This commit also makes some minor cleanups, add some documentation, and
removes a few small parts of code that have been detected as
redundant/useless.

No behavioral nor performance changes are expected with this commit.
2023-07-28 16:36:31 +02:00
Falk David
187545109a Cleanup: GPv3 drawings API
This cleans up the API a bit to make things more readable.
No functional changes.
2023-07-28 16:32:42 +02:00
Amelie Fondevilla
f7130d98c4 GPv3: Select frames by column
Implementation of column-based operators : "Columns on selected keys", "Column on current frame", and "Columns on selected markers" for grease pencil frames in the dopesheet.

Pull Request: https://projects.blender.org/blender/blender/pulls/110523
2023-07-28 16:18:40 +02:00
Julian Eisel
088d7a0bdd UI: Activate view item on right click on nested button too
No user visible change expected.

Right-clicking a view item is supposed to activate it and display the
context menu. However, nested buttons could "swallow" the right click
event. Ensure the view item is still activated.
2023-07-28 15:31:52 +02:00
Julian Eisel
1fe45cef91 Fix broking popover refreshing
Mistake in 167c5c6b53, basically making the commit have no effect.
2023-07-28 15:25:48 +02:00
Christoph Lendenfeld
9cd60da3cb Refactor: extract code from dopesheet draw function
No functional changes

Extracting code into two new functions in the dopesheet draw code
to improve readability and reduce variable scopes.
in addition to the extraction two if checks were negated to reduce indentation.

the diff makes it look a bit convoluted, but it's just copy paste into functions

Pull Request: https://projects.blender.org/blender/blender/pulls/110290
2023-07-28 15:14:56 +02:00