This introduces `MemoryCount` which can be used across multiple
`MemoryCounter`. Generally, `MemoryCount` is expected to live
longer (e.g. over the entire life-time of a cache), while `MemoryCounter`
is expected to only exists when actually counting the memory.
When the preserve_all_data_layers argument was passed, the object
would be reevaluated, assuming the type of the original object data.
However, the evaluated object type can change compared to the
original, so to reevaluate the original mesh we need to check that
the original object was also a mesh object.
Pull Request: https://projects.blender.org/blender/blender/pulls/126407
The issue was that the code path for layered actions never hit the
function `remap_cyclic_keyframe_location`.
The solution is to move that logic into `insert_vert_fcurve`.
My reason for why this is the correct solution is that
the remapping happens on a per FCurve basis, so it should be within `fcurve.cc`.
Doing so ensures that the layered actions also hit that code.
Pull Request: https://projects.blender.org/blender/blender/pulls/126399
This patch supports the viewer node in the new CPU compositor. To do
that, the context viewer output mechanism was refactored to allow CPU
storage by utilizing the result class as opposed to a GPU texture.
The reasoning in the comment applies to "Save as..." as well, because
the destination file becomes the active one and opened data and active
file on disk match.
When saving a copy the active file is not updated, so existing
compatibility issues would remain.
Pull Request: https://projects.blender.org/blender/blender/pulls/126266
Over the year, changes in how image packedfiles were handled broke the
fallback case of missing packed data in a few places, this commit fixes
proper cleanup of invalid packed files in the Image's list of
packedfiles.
In addition, also do not create inplicit sharing info when the read data
is `nullptr`.
The second time the operator ran without a depdency graph
evaluation happening for another reason, the object's evaluated
transform matrices weren't calculated. The fix is to make sure the
depsgraph is evaluated when the operator is executed.
Cancel operator when active vgroup is locked.
Use new poll function to check if vgroup exists, otherwise grey out the
operator.
And some cleanup.
This addresses the points from !126275
Pull Request: https://projects.blender.org/blender/blender/pulls/126313
The issue was that the animation filtering code for layered actions did not take
the `ANIMFILTER_FOREDIT` and `ANIMFILTER_SELEDIT` flags into account.
This also fixes another issue where it was possible to select and edit keys
on locked fcurves.
Pull Request: https://projects.blender.org/blender/blender/pulls/126373
Needed to implement GPv3 version of "Bake Object Transform to Grease
Pencil"
Doesn't implement the `Surface` option, as that is not used in the
previously mentioned operator.
Pull Request: https://projects.blender.org/blender/blender/pulls/126255
Parallelize loops to calculate max falloff and transfer
falloff from vertices to faces. These aren't a bottleneck
but performance should be slightly improved anyway.
This operator sets the new default group node width (from e842966c5e) based on
the parent group node. This makes it easier to initialize the value. Without
this, one had to create and delete the group node potentially many times to find
a good default width.
Pull Request: https://projects.blender.org/blender/blender/pulls/126239
Part of #118145.
In preparation for removing the duplicated position arrays from the
pbvh::Tree structure, change the API functions that access the arrays
to require object arguments. This will allow retrieving data from the
original mesh or the evaluated deform mesh as necessary.
The pbvh code isn't really the right place for this, but neither is the
sculpt or paint code in my opinion, since this concept is not specific
to sculpting or painting. For now keep the API in the same place. It
probably makes sense to move a bunch of these functions at some point.
Pull Request: https://projects.blender.org/blender/blender/pulls/126370
71f2229b0 added a workaround for video files that contain entirely
incorrect stream duration, and corrects that by using container
duration instead. However it used math of `seconds=frames*rate` instead
`seconds=frames/rate`, effectively always ending up falling back to
container instead of stream duration.
Pull Request: https://projects.blender.org/blender/blender/pulls/126368
There is a reason for the bitwise operator but it's not explained:
The attribute_foreach function callback has side-effects that the
compiler does not know about (everything is const). Simply replacing
the bitwise operator will cause the second term to be skipped, which
breaks tests due to missing attributes.
Now the term is explicitly evaluated first, then combined with actual
boolean operator.
Pull Request: https://projects.blender.org/blender/blender/pulls/126366
Previously when renaming an IDProperty the existing paths in the
animation/driver system isn't updated, this leads to missing animation
after renaming the property. Now `BKE_animdata_fix_paths_rename_all`
will be called so the animation system records the updated name.
Pull Request: https://projects.blender.org/blender/blender/pulls/125474
The issues was that the `get_item_transform_flags` iterated over the `curves`
list of the action, ignoring the new structure.
Fixed by using the `action_foreach_fcurve` and modifying that to work on legacy actions as well.
Pull Request: https://projects.blender.org/blender/blender/pulls/126357
We often have the situation where it would be good if we could easily estimate
the memory usage of some value (e.g. a mesh, or volume). Examples of where we
ran into this in the past:
* Undo step size.
* Caching of volume grids.
* Caching of loaded geometries for import geometry nodes.
Generally, most caching systems would benefit from the ability to know how much
memory they currently use to make better decisions about which data to free and
when. The goal of this patch is to introduce a simple general API to count the
memory usage that is independent of any specific caching system. I'm doing this
to "fix" the chicken and egg problem that caches need to know the memory usage,
but we don't really need to count the memory usage without using it for caches.
Implementing caching and memory counting at the same time make both harder than
implementing them one after another.
The main difficulty with counting memory usage is that some memory may be shared
using implicit sharing. We want to avoid double counting such memory. How
exactly shared memory is treated depends a bit on the use case, so no specific
assumptions are made about that in the API. The gathered memory usage is not
expected to be exact. It's expected to be a decent approximation. It's neither a
lower nor an upper bound unless specified by some specific type. Cache systems
generally build on top of heuristics to decide when to free what anyway.
There are two sides to this API:
1. Get the amount of memory used by one or more values. This side is used by
caching systems and/or systems that want to present the used memory to the
user.
2. Tell the caller how much memory is used. This side is used by all kinds of
types that can report their memory usage such as meshes.
```cpp
/* Get how much memory is used by two meshes together. */
MemoryCounter memory;
mesh_a->count_memory(memory);
mesh_b->count_memory(memory);
int64_t bytes_used = memory.counted_bytes();
/* Tell the caller how much memory is used. */
void Mesh::count_memory(blender::MemoryCounter &memory) const
{
memory.add_shared(this->runtime->face_offsets_sharing_info,
this->face_offsets().size_in_bytes());
/* Forward memory counting to lower level types. This should be fairly common. */
CustomData_count_memory(this->vert_data, this->verts_num, memory);
}
void CustomData_count_memory(const CustomData &data,
const int totelem,
blender::MemoryCounter &memory)
{
for (const CustomDataLayer &layer : Span{data.layers, data.totlayer}) {
memory.add_shared(layer.sharing_info, [&](blender::MemoryCounter &shared_memory) {
/* Not quite correct for all types, but this is only a rough approximation anyway. */
const int64_t elem_size = CustomData_get_elem_size(&layer);
shared_memory.add(totelem * elem_size);
});
}
}
```
Pull Request: https://projects.blender.org/blender/blender/pulls/126295
No functional changes expected.
This PR refactors the code by:
* passing things by reference if they cannot be a `nullptr`
* Managing indentation by returning early or continuing.
* Cleaning up comments
* Indicating ListBase element types in the declaration
This is in service of #126125 for which the `get_item_transform_flags`
needs to be passed a slot handle as well.
Pull Request: https://projects.blender.org/blender/blender/pulls/126291
There were a couple of regressions when using the environment render
pass.
- Not working when film transparency was enabled
- Deferred geometry didn't occlude the background
This PR splits the world background shader (eevee_surf_world) into two
shaders. One clears background and render passes and a second one that renders
the background and the environment render pass.
The second shader is moved after the deferred pipeline and an early
depth test is used to occlude the background and environment pass.
NOTE: render test reference images needs to be updated.
Pull Request: https://projects.blender.org/blender/blender/pulls/126274
Regression in [0] which displays the filename for the active
theme but still used the label internally.
This meant actions such as removing the theme would not always apply
to the name being displayed.
- Adding a new theme was not setting it active.
- Detecting if a theme was built-in used the run-time label as a lookup.
- Theme removal first require it to be re-selected.
[0]: 0bb6317035
Part of #118145.
Similar in concept to recent commits removing the usage of
this mesh pointer in favor of fetching the data as necessary.
Also see recent discussion in a recent fix for this area:
https://projects.blender.org/blender/blender/pulls/122850.
And also note the comment for `Tree::mesh_` was incorrect.
The mesh was the original mesh, not the evaluated mesh.