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.
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++.
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
Some regions have a fixed size or the size is determined by the layout
somehow, and so the regions should allow hiding/unhiding via the resize
operator, but the size shouldn't be modified. When the region was just
unhidden, it would still use a size based on the mouse position for one
mouse move event. Ensure the size isn't modified, as requested.
No user visible changes expected.
This is needed for the asset shelf (#104831), so that the user can
resize the asset shelf region, but it's ensured to always be snapped to
a multiple of the row height (which can change over redraws).
Before this, `RGN_FLAG_DYNAMIC_SIZE` would have to be set so that
regions can control their own size in the `ARegionType::layout()`
callback. But this would also disable resizing the region by the user.
Tagging regions as being dynamically sized and disabling user resizing
are now two separate options/flags.
Included changes:
- Rename `RGN_FLAG_PREFSIZE_OR_HIDDEN` to `RGN_FLAG_NO_USER_RESIZE` and
make that generally disable user resizing like `RGN_FLAG_DYNAMIC_SIZE`
used to, so that it can be used for more than just the properties
editor tabs region.
- Ensure regions that relied on the previous `RGN_FLAG_DYNAMIC_SIZE`
behavior that disallowed user resizing have the
`RGN_FLAG_NO_USER_RESIZE` flag set too now.
- Versioning to ensure the previous point for old files.
- Update comments.
This commit adds modifier support for Grease Pencil 3.
The `BKE_grease_pencil_data_update` function evaluates the modifiers by
first creating a `GeometrySet` from the grease pencil data,
then evaluating the modifiers, and finally reading the
resulting `GreasePencilComponent` component and assigning
the evaluated object data.
Pull Request: https://projects.blender.org/blender/blender/pulls/110500
Dynamic topology drawing can now use the smooth status saved in each
edge. Because of that, the "Smooth Shading" draw option is unnecessary
and just adds confusion because of inconsistency between dynamic
topology drawing and other modes.
Fixes#109191
Pull Request: https://projects.blender.org/blender/blender/pulls/110548
In Walk Navigation mode with gravity enabled, the jump height is
often inappropriate for the scene that you are viewing. This is a small
feature that lets you change the jump height in modal walk navigation
as you go, i.e. if there are varying elevation changes across the scene.
Pressing '.' increases and ',' decreases the jump height (because these keys
are the same for most layouts).
Pull Request: https://projects.blender.org/blender/blender/pulls/109827
The issue was caused by recent C++ transition: the header file is
shared between CPU and GPU. The Metal defines __cplusplus so it is
not enough to check for it to use C linking as it is not a valid
syntax for shaders.
Pull Request: https://projects.blender.org/blender/blender/pulls/110570
Context is needed to import and instantiate assets correctly. Previously
the context was stored as "evil" pointer in the drag data. Since
77794b1a7b, context is passed to the dragging callbacks doing the asset
import, so the context doesn't need to be stored that way anymore and
can simply be passed to the import function.
This change is needed for PAINT_OT_weight_sample_group to be accessed
from a menu.
Otherwise using the OPTYPE_DEPENDS_ON_CURSOR flag causes both the
initial activation and the selected vertex group to prompt the user
to select a region.