Issue found here at the studio in some production files using dirty
hacks. Ideally we could fully forbid such assignement in BPY/RNA API
too, but there is no 'proper' way to achieve this without this dirty
hack currenlty.
So instead, check for this case and print a nice error about it for now.
It's not entirely clear why TBB requires this. I couldn't find this restriction
in their documentation yet. It is mentioned in a code comment in
`allocate_node_default_construct` in `tbb/concurrent_hash_map.h` though.
Implementation of the soft mode of the eraser tool for GPv3.
In this mode, the eraser decreases the opacity of the points it hits.
If the opacity of a point falls below a threshold, then the point
is removed from the curves.
Pull Request: https://projects.blender.org/blender/blender/pulls/110310
These libraries are used for grease pencil import/export. If both of
them are disabled the SVG import operator is still built but needs a
function that was hidden.
Pull Request: https://projects.blender.org/blender/blender/pulls/126555
This implements the "Canvas" overlay for GPv3.
Some things of note:
- The color and subdivision are hard coded for now
- The scale and offset have been removed for now
Pull Request: https://projects.blender.org/blender/blender/pulls/126248
Previously, the inferencing result was only stored in the socket shape.
However, that was conflicting with experiments where the socket shape and
the field state was not related.
When using multi view only the first layer could be selected as the
rendering info only had a single layer in its main struct.
- Add failsafe for unsupported platforms
Code executed in `BLO_read_do_version_after_setup` would not update in
any ways the info in link/append context data.
NOTE: this could potentially be extended to other code in this 'complex
do version' area. However, other versionning did not cause issues
apparently so far, so would rather until such changes are proven needed.
This was used during development for the conversion operator. now that
all data is systematically converted on load, it was not needed anymore
(and already unused).
The `has_anything_selected` function has a variant that takes just an
index mask and compares that to all selection attributes it can find,
regardless of which domain they are on. In this case the bezier handle
selection attributes were stored on the Curve domain while the selection
domain has already been switched to Point.
Now the `has_anything_selected` function always expects a domain so it
can check for attributes on that same domain.
Bezier handle selection does not make sense on the point domain, but the
way curve selection is written makes it difficult to prevent the
creation of the attribute on Curve domain. It's also not generally
prohibited (user can still create that attribute) so selection code
should handle this case robustly.
Pull Request: https://projects.blender.org/blender/blender/pulls/126543
Bridge could delete all faces & then fail to perform the bridge
operation. In this case the mesh was still modified.
Resolve by tracking the changed state, run updates when any changes are
made.
Resolve regression in [0].
Loading a blend file from the command line with "Load UI" disabled
was crashing.
Resolve by including the window in the temporary context override.
[0]: 7fcd4e2429
Ever since it was added to the VSE in e49fef45ce, edge panning would
break snapping -- edge panning a strip and then bringing it back would
cause snap code to trigger at incorrect locations. This is because the
edge pan system would update the `View2D` in `t->region->v2d.cur`, but
not mouse values, and so `t->values` would end up unchanged even while
the strip was moving.
e6a557952e fixed the issue for the node editor by recalculating mouse
input values when the view changed with `transformViewUpdate()`, but
since the code was separate from VSE, that fix did not get also get
applied here.
Although the code in `view2d_edge_pan_loc_compensate()` is mostly
identical between the two and so one possibility is to move it to
`transform_generics.cc`, adapting it to allow it to be used by both
spaces, custom transform data in the node editor additionally stores and
updates a `viewrect_prev` as mentioned in e040aea7bf, which VSE custom
data does not have. Since the fix is small enough and I don't want to
risk messing with other module code, I've opted to just copy the fix
over to VSE. If further bugs crop up in the future, we can consider
combining the code.
Also fix typo in `tranformViewUpdate()`.
Pull Request: https://projects.blender.org/blender/blender/pulls/126471
During startup we render 7 large icons used by File Browser in
thumbnail view, even though we only ever use 3. This change only
renders any the first time it is requested. Saves a tiny amount
of startup time and 1 MB of RAM.
Pull Request: https://projects.blender.org/blender/blender/pulls/126532
This commit introduces a number of changes to make PBVH and related
attribute lifecycle more predictable.
A common method, `BKE_sculptsession_free_pbvh` is introduced to manage
freeing related resources that are stored in `SculptSession`
Prior to this commit, the `active_vert_` attribute was only ever
changed when a raycast successfully hit the mesh. This commit changes
the behavior to not store a stale reference in the following cases:
* When dyntopo is enabled or disabled
* When a mesh with the subdivision modifier is subdivided further
* When the sculpt level of a subdiv modifier is changed
* When the subdivision modifier is removed from a mesh
Pull Request: https://projects.blender.org/blender/blender/pulls/126341
This changes how the lazy-loading and unloading of volume grids works. With that
it should also fix#124164.
The cache is now moved to a deeper and more global level. This allows reloadable
volume grids to be unloaded automatically when a memory limit is reached. The
previous system for automatically unloading grids only worked in fairly specific
cases and also did not work all that well with caching (parts of) volume
sequences.
At its core, this patch adds a general cache system in `BLI_memory_cache.hh`. It
has a simple interface of the form `get(key, compute_if_not_cached_fn) ->
value`. To avoid growing the cache indefinitly, it uses the new
`BLI_memory_counter.hh` API to detect when the cache size limit is reached. In
this case it can automatically free some cached values. Currently, this uses an
LRU system, where the items that have not been used in a while are removed
first. Other heuristics can be implemented too, but especially for caches for
loading files from disk this works well already.
The new memory cache is internally used by `volume_grid_file_cache.cc` for
loading individual volume grids and their simplified variants. It could
potentially also be used to cache which grids are stored in a file.
Additionally, it can potentially also be used as caching layer in more places
like loading bakes or in import geometry nodes. It's not clear yet whether this
will need an extension to the API which currently is fairly minimal.
To allow different systems to use the same memory cache, it has to support
arbitrary identifiers for the cached data. Therefore, this patch also introduces
`GenericKey`, which is an abstract base class for any kind of key that is
comparable, hashable and copyable.
The implementation of the cache currently relies on a new `ConcurrentMap`
data-structure which is a thin wrapper around `tbb::concurrent_hash_map` with a
fallback implementation for when `tbb` is not available. This data structure
allows concurrent reads and writes to the cache. Note that adding data to the
cache is still serialized because of the memory counting.
The size of the cache depends on the `memory_cache_limit` property that's
already shown in the user preferences. While it has a generic name, it's
currently only used by the VSE which is currently using the `MEM_CacheLimiter`
API which has a similar purpose but seems to be less automatic, thread-safe and
also has no idea of implicit-sharing. It also seems to be designed in a way
where one is expected to create multiple "cache limiters" each of which has its
own limit. Longer term, we should probably strive towards unifying these
systems, which seems feasible but a bit out of scope right now. While it's not
ideal that these cache systems don't use a shared memory limit, it's essentially
what we already have for all cache systems in Blender, so it's nothing new.
Some tests for lazy-loading had to be removed because this behavior is more
implicit now and is not as easily observable from the outside.
Pull Request: https://projects.blender.org/blender/blender/pulls/126411
Use snake style naming for all the kernel nodes functions.
Omit kernel prefix in the names since of the using namespace.
Use full forms of the terms
('iter' -> 'iterator', 'ntree' -> 'node_tree', 'rem' -> 'remove', ...).
Pull Request: https://projects.blender.org/blender/blender/pulls/126416
Just-introduced in #126390, when source image size is just two pixels
it should not advance to the third pixel after reading the first two.
Was pointed out by randomly failing tests, yay tests.
This commit takes the namespaces used in `sculpt_intern.hh` and splits
them into their own header files to better logically separate data and
avoid pulling in so many transitive dependencies by needing to include
`sculpt_intern.hh`
Actual removal of `sculpt_intern.hh` from other files is pending
further cleanup of the methods contained within.
A quick summary of the other changes included in this commit:
* `enum` to `enum class` cleanup for enums to enable forward
declarations
* `FilterCache` default destructor to allow forward declaration of
other dependent `struct`s contained in `unique_ptr`s
* Cleanup of unused headers
* Move `SculptBoundary` into the `boundary` namespace
* Move misc brush method forward declarations into `types.hh`
For a given `.cc` file that corresponds to a specific `.hh` file, the
header has been placed at the very top to try and ensure that the
needed data is self contained.
Forward declaration is preferred in most of these files outside of the
templates, classes, and structs in BLI headers.
---
Manual testing done:
- Enter Sculpt mode and perform strokes
- Use automasking for some strokes
- Use mesh filter
Pull Request: https://projects.blender.org/blender/blender/pulls/126443
For the boid Fight rule (and when determining friend/enemy health), we
need to check if other `ParticleTarget` psys is actually boids as well
(their health data is accessed -- which is only present on boid particle
systems), otherwise NULL data access crashes.
I know, EOL, but simple crash fixers should still get a chance to get in
I think.
Could also go into LTSes.
Pull Request: https://projects.blender.org/blender/blender/pulls/126494
API: merged IMB_scalefastImBuf, IMB_scaleImBuf, IMB_scaleImBuf_threaded
into one function IMB_scale with enum IMBScaleFilter {Nearest, Bilinear, Box}
and bool "threaded" param.
Performance:
- Box filtering (nee IMB_scaleImBuf) can be multi-threaded now.
- Nearest filtering (nee IMB_scalefastImBuf) can be multi-threaded now.
Also fix performance regression on float images caused by fix in #126234
- Bilinear filtering (nee IMB_scaleImBuf_threaded) is several times faster now.
Correctness:
- Nearest and Box filtering: no longer loses half of edge pixels when scaling
up.
- Box: fixed garbage results (and possible out of bounds reads) for non-4
channel float images.
- Bilinear: no longer shifts image when scaling up.
- Bilinear: properly filters when scaling down by 2x2.
Test coverage:
- Add gtest coverage for various IMB_scale modes.
- Add a IMB_performance_test performance test, ran manually.
More details, images and performance numbers in PR.
Pull Request: https://projects.blender.org/blender/blender/pulls/126390
This PR implements #126353; In short: keep discard list as part of swap chain images. This allows
better determination when resources are actually not in use anymore.
## Resource pool
Resource pools keep track of the resources for a swap chain image.
In Blender this is a bit more complicated due to the way GPUContext work. A single thread can have
multiple contexts. Some of them have a swap chain (GHOST Window) other don't (draw manager). The
resource pool should be shared between the contexts running on the same thread.
When opening multiple windows there are also multiple swap chains to consider.
### Discard pile
Resource handles that are deleted and stored in the discard pile. When we are sure that these
resources are not used on the GPU anymore these are destroyed.
### Reusable resources
There are other resources as well like:
- Descriptor sets
- Descriptor pools
## Open issues
There are some limitations that require future PRs to fix including:
- Background rendering
- Handling multiple windows
- Improve CPU/GPU synchronization
- Reuse staging buffers
Pull Request: https://projects.blender.org/blender/blender/pulls/126353
The `drawing_index` in frame data can become invalid during transform if
a frame overwrites another. This is very difficult to keep track of
explicitly, so instead this fix just "freezes" drawing indices by adding
a user at the beginning of the transform to every existing drawing and
removing it at the end after all frame data has been updated.
No `drawing_index` needs to be updated during the transform.
Pull Request: https://projects.blender.org/blender/blender/pulls/126312