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
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
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
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.
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.
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'.
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.
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++.
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
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`.
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
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.
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
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.
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