Use the default constructor of `Node` to set the default new flag value.
Remove the normals update flag which was added in f9c6fe30db.
This should avoid recalculating all the normals after just building the
BVH tree.
Rather than retrieving the data from the BVH. This opens up the
possibility that the BVH building produces a slightly different
data structure that's then converted to the final format in a
separate pass.
Use the same method for retrieving "all nodes" that we do elsewhere.
Even though this requires a temporary vector, it makes it an easier
target for optimization later and makes the sculpt BVH iteration
easier to refactor in the meantime.
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