This changes the following keyframing functions to return
`SingleKeyingResult`, which is in turn used for better failure
reporting in the higher-level functions that call them:
- `KeyframeStrip::keyframe_insert()`
- `insert_vert_fcurve()`
As a side effect, this also means that
`rna_KeyframeAnimationStrip_key_insert()` can no longer return an
`FCurve *`, and now instead returns a bool indicating success.
This is part of an ongoing progressive refactor to improve error
messages and failure handling in the keyingframing code.
Pull Request: https://projects.blender.org/blender/blender/pulls/121517
BKE_mesh_validate is called by mesh.validate() Python API, as well as optionally
when doing file imports. This PR speeds it up a bit:
- Faster face data sorting by using parallel sort instead of qsort,
- One allocation for all face vertex indices, instead of a separate allocation
for each face,
- (more like a fix) Validation no longer adds a MDeformVert layer when there was
none in the input mesh.
- Small cleanups (more const inputs, etc.)
On my Windows/VS2022/Ryzen5950X machine, import time in seconds (validation on
before this PR -> validation on with this PR, validation off):
- USD (Intel Moore Lane): 9.1 -> 6.7, 4.8.
- OBJ (Blender 3.0 splash): 22.7 -> 18.6, 16.5.
Pull Request: https://projects.blender.org/blender/blender/pulls/121413
Bezier handles are recalculated in many places in the
animation code. Threading that code can give a performance
boost all over Blender.
This patch only threads a part of the handle calculation code.
`BKE_nurb_handle_smooth_fcurve` can still be run in parallel,
but that's more complicated, so not done in this PR.
Overall this patch mostly benefits code paths that are not already threaded.
------
Performance delta
| Action | Before | After |
| - | - | - |
| `recalcData_graphedit` moving a single key | 1.06 ms | 1.0 ms |
| `recalcData_graphedit` moving 300 keys of a single FCurve | 1.6 ms | 1.4 ms |
| `recalcData_graphedit` moving 300 keys of multiple FCurves | 60 ms | 55 ms |
| `ANIM_animdata_update` when using the Breakdown operator in the GE | 90 ms | 73 ms |
Test file used
https://download.blender.org/ftp/sybren/animation-rigging/heavy_mocap_test.blend
Pull Request: https://projects.blender.org/blender/blender/pulls/119388
Cleanup to avoid unnecessary copies of VArray. This
requires ref-qualifier overloads of dereference operator
of attribute reader and some move operators and constructor
overloads in the code.
Pull Request: https://projects.blender.org/blender/blender/pulls/118437
- Remove meaningless const for by-value arguments in declarations
- Use std::move for strings (otherwise StringRef should be used)
- Move struct to C++ namespace
- Avoid unnecessary namespace specification
- Use static constexpr instead of macros
- Add const for other arguments in function definitions
- Avoid copying struct in for loop
- Remove redundnat "private" in class
This PR fixes the ternary operation to avoid indexing into a cleared
`BitGroupVector`when trying to create an `IndexMask` for a mesh
with no hidden elements.
Pull Request: https://projects.blender.org/blender/blender/pulls/121461
Remove options that are duplicate and change description of options, so
they describe bit better, how timecodes are actually used.
Timecodes in Blender have pretty much nothing in common with more widely
known term "timecode". This confused users (and developers).
There were 5 options of which 3 were exactly same. This commit leaves
user with 3 options:
- Use timecodes for normal seeking/playback - Record Run
- Ensure, that no frame is duplicated or skipped - "Record Run No Gaps"
- Do not use timecodes - "None"
More verbose description was added to the definition in code.
Naming of these timecode types was kept, even if it is incorrect to not
break scripts and habits.
Pull Request: https://projects.blender.org/blender/blender/pulls/121001
In larger scenes Blender could crash when duplicating frames in GPv3.
This was caused by a dangling reference in `insert_duplicate_frame`.
The source frame could become invalid when the frames map was
reallocated due to `layer.add_frame(dst_frame_number, ...)` a few lines
later in the code.
The fix replaces the reference and assigns by value.
Pull Request: https://projects.blender.org/blender/blender/pulls/121414
Previously, menu sockets were sometimes shown as integers or strings
in socket tooltips. Now, they are always shown as "Menu" type. This also
changes how these values are logged. Previously, they were logged as
strings. Now, only the integer identifier is logged and the name is looked
up when drawing the tooltip.
Pull Request: https://projects.blender.org/blender/blender/pulls/121236
Rather than storing asset shelf types only for the space type defined
with `bl_space_type`, store them statically/globally so that asset shelf
popups can later be displayed in any space. In earlier designs the asset
shelf was more space dependent than it is now.
For example the brush selector asset shelf popup being implemented for
the brush assets project should be available in the tool settings UI,
which is also displayed in the Properties. If the asset shelf type is
space dependent, this popup won't work in the Properties.
To be clear, `bl_space_type` will still be what defines where the asset
shelf region will be available. But the popup version can be displayed
anywhere.
Pull Request: https://projects.blender.org/blender/blender/pulls/121411
Add a function for asset shelves, `get_active_asset` in RNA, that
can be used to sync the active item of an asset shelf with an asset
reference elsewhere in Blender. In the brush asset system this is
used to retrieve the asset reference from the active `Paint` struct.
Pull Request: https://projects.blender.org/blender/blender/pulls/121405
The operator stored when registering the asset shelf will be called
with properties that reference the asset (a weak reference, split into
three properties already used in other asset-related operators). The
operator is called whenever a grid view item is activated, and is
meant to do things like import and activate a brush asset.
Previously Reviewed: https://projects.blender.org/blender/blender/pulls/117861
Pull Request: https://projects.blender.org/blender/blender/pulls/121402
Adds a new asset shelf option (`STORE_ENABLED_CATALOGS_IN_PREFERENCES`
option in RNA) to use the Preferences for storing the enabled catalogs.
This way asset shelf types can decide if for their use-case, they want
to synchronize the enabled catalogs over Blender sessions and files, or
keep the stored locally in the file.
This is important because for example on one hand, it would be annoying
if for brush assets you'd have to enable the visible catalog tabs for
every 3D View and every file, while on the other hand you need that
level of control for the pose library where the catalogs the rigger/
animator cares about varies from project to project, character to
character and shot to shot.
Conceptually this also makes some sense: The new brush assets workflow
synchronizes brush assets and their catalogs across Blender sessions
and files, basically making them globally accessible independent of
the current file/project, so treating the enabled catalogs the same
is consistent.
Previously reviewed in #120264
Pull Request: https://projects.blender.org/blender/blender/pulls/121363
Advanced ID copying code can now take a `new_owner_id` ID pointer parameter,
and use it to set the relevant 'loopback' pointer to its owner ID by the
copy code itself.
Besides avoiding the need for all code copying embedded IDs to set the
loopback pointer themselves, this also means that `lib_id` copying code
itself does not need to use `IDWALK_IGNORE_MISSING_OWNER_ID` anymore.
This change is not expected to have any effect in current codebase.
In previous code, the owner ID info would not be available when
processing an embedded ID in two cases, and was incorrectly set to the
processed (embedded) ID instead:
1. When directly calling `BKE_library_foreach_ID_link` on an embedded ID.
2. When using recursive processing (`IDWALK_RECURSE`).
This commit mostly fixes both cases, by using `BKE_id_owner_get` to find
the owner ID when it is unknown.
There are some caveats here though: in a few specific cases (mainly ID
copying, and depsgraph ID copying), `BKE_library_foreach_ID_link` can be
called on embedded IDs which owner ID is not yet valid. In such case, a
new flag can be used to keep using the previous behavior
(`IDWALK_IGNORE_MISSING_OWNER_ID`).
Fixing the issue with copy code being unaware of the owner ID when
copying an embedded one should also be fixed, but this will be addressed
separately.
Note that as 'side efect', this commit also fixes a matching issue in
the `lib_remap` code, where the `IDRemap.id-owner` pointer would also
wrongly be set to the remapped embedded ID instead of its actual owner.
This change is not expected to have any effect in current codebase.
While currently, all cases where `BKE_id_owner_get` is called are
'safe', there are some points in code where the pointers ensureing the
relationship between an embedded ID and its owner are not (fully) valid.
This new option (`false` by default) allows to skip the debug asserts
ensuring the sanity of these 'owner <-> embedded' ID pointers in the
relevant `owner_pointer_get` callbacks.
This change is not expected to have any effect in current codebase.
There is no reason to do this for embedded IDs - this process is
expected to happen as part of the copying of their owner ID anyway.
Further more, embedded IDs are not in a fully valid state during the
copying of their owner, better avoid as much processing on them as
possible.
This change is not expected to have any effect in current codebase.
While not an issue in current code, this was logically not ideal.
The owner ID is an important information that should be valid as soon as
possible after the copy, before any other process happens.
Ideally this could even become part of the ID copying code itself.
This change is not expected to have any effect in current codebase.
This also moves the option to be a per editor space setting so you can
have different cache visualization options in different editor spaces
at the same time.
A quick toggle for the cache visualization is now available in the
overlays popover.
Pull Request: https://projects.blender.org/blender/blender/pulls/119428
Allows running some action when the context changes to make the
asset shelf region visible. Also add an option for when whether the
shelf should be visible by default when the poll succeeds.
Pull Request: https://projects.blender.org/blender/blender/pulls/121315
This is because sse2neon.h might be used to emulate SSE intrinsics
on ARM64 architecture, and it uses some preprocessor which is not
available for C language when using MSVC.
The old-style math file math_matrix.c uses this header, so needed
to become C++. Simple rename did not work since there is a new math
utility math_matrix.cc exists. Following some existing convention
the math_matrix.c is renamed to math_matrix_c.cc. Eventually all the
code should switch to use C++ style math, and the C style removed,
so it seems reasonable to not mix old and new style of API in the
same file.
There should be no functional changes.
Pull Request: https://projects.blender.org/blender/blender/pulls/121335
These nodes allow working with the raw values that make up a matrix.
This can be used to construct a 4x4 matrix directly, without using the
`Combine Transform` node. This allows building transforms with arbitrary
skew, or projection matrices.
Pull Request: https://projects.blender.org/blender/blender/pulls/121283
This is used by the brush assets branch. Though it is unused currently, the
argument is added now to reduce the trivial boilerplate changes in the diff.
This patch matches the size of the Fast Gaussian mode of blur with the
standard Gaussian mode. The sigma value was computed as half the radius,
while it should be third of the radius, since Blender's Gaussian
function is truncated at 3 of the standard deviation of the unit
Gaussian. The patch include versioning to adjust the size of existing
files.
Pull Request: https://projects.blender.org/blender/blender/pulls/121211
Implement the design discussed in #120384.
This adds two parameters. One for changing the approximation
method, and another to use the thickness from shadow map.
We pack the former in the gbuffer by dividing the 16bits
used for thickness by two and use one bit to store the
method.
The thickness from shadow map is now decoupled from the
light evaluation shader. This makes it more performant and
compatible with ray-tracing. This commit also uses the
same biases as shadow mapping to avoid aliasing artifacts
(fix#119339).
This refactors the light evaluation quite a bit to
remove unused bits bits and make the whole transmission
light evaluation without too much complexity.
Pull Request: https://projects.blender.org/blender/blender/pulls/121171
A version of "Align Euler to Vector" with the rotation socket
instead of the vector Euler socket. Other than that, and a few
cleanups to use newer math functions, the node is the same.
The old node is just "Deprecated" for now. We could remove
it with versioning, but we can also wait to do that.
In a simple test this node is about 1.7 times faster than the old one.
Pull Request: https://projects.blender.org/blender/blender/pulls/118565
The guard clauses elsewhere in the function clearly indicate that
`r_driven` should be passable as a nullptr if the caller doesn't need
it, but there is one place where the guard clause was missing.
Discovered while working on #120936.
Pull Request: https://projects.blender.org/blender/blender/pulls/121253
This changes the menu switch socket to use the socket-items system
(`NOD_socket_items.hh`) that is already used by the simulation zone, repeat
zone, bake node and index switch node. By using this system, the per-node
boilerplate can be removed significantly. This is especially important as we
plan to have dynamic socket amounts in more nodes in the future.
There are some user visible changes which make the node more consistent with
others:
* Move the menu items list into the properties panel as in 0c585a1b8a.
* Add an extend socket.
* Duplicating a menu item keeps the name of the old one.
There is also a (backward compatible) change in the Python API: It's now
possible to directly access `node.enum_items` and `node.active_index` instead of
having to use `node.enum_definition.enum_items`. This is consistent with the
other nodes. For backward compatibility, `node.enum_definition` still exists,
but simply returns the node itself.
Many API functions from `NodeEnumDefinition` like
`NodeEnumDefinition::remove_item` have been removed. Those are not used anymore
and are unnecessary boilerplate. If ever necessary, they can be implemented back
in terms of the socket-items system.
The socket-items system had to be extended a little bit to support the case for
the menu switch node where each socket item has a name but no type. Previously,
there was the case without name and type in the index switch node, and the case
with both in the bake node and zones. The system was trivial to extend to this
case.
Pull Request: https://projects.blender.org/blender/blender/pulls/121234