Commit Graph

120055 Commits

Author SHA1 Message Date
Hans Goudey
7e0029fb65 Sculpt: Simplify BVH node flag initialization, avoid normals update
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.
2024-08-20 15:41:56 -04:00
Hans Goudey
a2d8eec834 Cleanup: Reduce indentation in PBVH construction 2024-08-20 15:41:56 -04:00
Hans Goudey
726315deba Cleanup: Sculpt: Pass BVH building data as arguments
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.
2024-08-20 15:41:56 -04:00
Sean Kim
4870ba5906 Cleanup: Isolate dyntopo detail size call
Setting the detail size is unnecessary when not using dyntopo sculpting.

Pull Request: https://projects.blender.org/blender/blender/pulls/126533
2024-08-20 21:29:18 +02:00
Sean Kim
858f91b2aa Cleanup: Use enum class and constexpr in sculpt_automask.cc
Pull Request: https://projects.blender.org/blender/blender/pulls/126111
2024-08-20 20:53:55 +02:00
Jeroen Bakker
1ba82ed139 Cleanup: Spelling 2024-08-20 20:32:48 +02:00
Hans Goudey
0277ad127a Cleanup: Reduce indentation in mesh separate operator 2024-08-20 13:41:57 -04:00
Hans Goudey
fa9aa5eab3 Cleanup: Remove unused variable 2024-08-20 13:39:27 -04:00
Hans Goudey
18a7aff3e2 Refactor: Sculpt: Simplify access to BVH nodes in undo code
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.
2024-08-20 13:34:06 -04:00
Hans Goudey
98308757cd Cleanup: Use C++ Stack for PBVH iteration 2024-08-20 13:34:06 -04:00
Hans Goudey
05bd28d123 Cleanup: Move PBVH iteration struct closer to use 2024-08-20 13:34:06 -04:00
Bastien Montagne
dcadb3301e 'Fix' crash in append code in invalid data cases (linked data using local data).
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.
2024-08-20 18:22:30 +02:00
Jacques Lucke
41acd803e4 Fix: ConcurrentMap requires the value to be copy-constructible
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.
2024-08-20 17:47:27 +02:00
Amelie Fondevilla
625ef79f57 GPv3: Soft mode for the Eraser tool
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
2024-08-20 17:24:03 +02:00
Lukas Tönne
df028d588f Fix: Build error when pugixml and haru libraries are disabled
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
2024-08-20 17:14:10 +02:00
Casey Bianco-Davis
92155db27a GPv3: Canvas overlay
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
2024-08-20 17:05:34 +02:00
Jacques Lucke
24f7b7a8fb Cleanup: Nodes: reduce coupling between socket shape and field state
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.
2024-08-20 16:15:59 +02:00
Jeroen Bakker
7f1812e335 Vulkan: Fix multi view layer selection
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
2024-08-20 16:02:32 +02:00
Jeroen Bakker
8acb2f363e Cleanup: Remove solved comment 2024-08-20 15:31:54 +02:00
Jeroen Bakker
2c6b1eb2e5 GPU: Fix static shader tests for NVIDIA
Skipping tests when workarounds are enabled due to GLSL restrictions in
the NVIDIA driver.
2024-08-20 14:52:35 +02:00
Jeroen Bakker
242271237a Vulkan: Ensure rendering ends when deleting attached framebuffer
When a frame buffer that is attached is being deleted the rendering end
event will never happen which leads to inconsistent render graphs.
2024-08-20 14:50:18 +02:00
Jeroen Bakker
df910f2417 GPU: Fix draw test on NVIDIA/OpenGL
Some workarounds cannot work on NVIDIA but are tested leading to
segfaults. Fixed by skipping in these cases.
2024-08-20 13:37:00 +02:00
Bastien Montagne
d6fa48c022 Fix #126507: GP conversion code was not updating link/append data.
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.
2024-08-20 12:51:47 +02:00
Bastien Montagne
2853a4c4db Refactor: Blendfile Link/Append: make callback of foreach item a function ref. 2024-08-20 12:51:47 +02:00
Bastien Montagne
382122f172 Cleanup: GPv3: Remove unused public GP object conversion function.
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).
2024-08-20 12:51:47 +02:00
Lukas Tönne
5a1f264d49 Fix: GPv3: Disable debug setting of the fill tool that keeps images. 2024-08-20 12:17:52 +02:00
Lukas Tönne
ec82ccb4b4 Fix #126271: Prevent comparing a curve index mask to a point span
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
2024-08-20 12:00:37 +02:00
Casey Bianco-Davis
1fb849b98e GPv3: Sculpt mode overlay.
This adds lines and points overlay to sculpt mode.
Visibly of lines and points matches legacy grease pencil.

Pull Request: https://projects.blender.org/blender/blender/pulls/126453
2024-08-20 11:57:59 +02:00
Lukas Tönne
400c738db9 GPv3: Import and export for SVG and PDF
Implements the SVG import/export and PDF export operators for GPv3.

Pull Request: https://projects.blender.org/blender/blender/pulls/123996
2024-08-20 11:41:37 +02:00
Jeroen Bakker
7a7ae5defe Vulkan: Occlusion Queries
Implements occlusion queries using VkQueryPools.

Pull Request: https://projects.blender.org/blender/blender/pulls/123883
2024-08-20 11:27:33 +02:00
casey bianco-davis
29be8ff359 GPv3: Only select visible bezier handles for Circle, Lasso and Box selection tools.
This makes so that only visible bézier handles can be selected by the
following tools: `Circle`, `Lasso` and `Box` selection.

Pull Request: https://projects.blender.org/blender/blender/pulls/125549
2024-08-20 11:00:08 +02:00
Campbell Barton
a51f6b6923 Fix #123405: Edit-mesh bridge crashes with all faces selected
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.
2024-08-20 17:46:34 +10:00
Jeroen Bakker
994e14b000 OpenGL: Enable HQ normals workaround for more AMD drivers
Allows EEVEE to be used on Legacy platforms. Fixes rendering black geometry in some cases.

Pull Request: https://projects.blender.org/blender/blender/pulls/126540
2024-08-20 08:46:55 +02:00
Campbell Barton
4cea295fcb Fix #126392: Crash loading a file with "Load UI" disabled
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
2024-08-20 16:37:34 +10:00
John Kiril Swenson
9dd2d7bd75 Fix: VSE snapping with edge panning
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
2024-08-20 07:11:45 +02:00
Campbell Barton
908d004fcc Cleanup: spelling in comments 2024-08-20 14:25:52 +10:00
Harley Acheson
7045fb6593 Refactor: Create File Browser Special Images When Needed
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
2024-08-20 03:33:53 +02:00
Sean Kim
316b5475b9 Cleanup: Fix missing-declaration error in previous commit
852b3dbff3

A few structs that were in the .cc file needed to be moved into the .hh
file so that they are visible for `restore_from_bmesh_enter_geometry`

Pull Request: https://projects.blender.org/blender/blender/pulls/126531
2024-08-20 03:23:36 +02:00
Sean Kim
baa20eb289 Cleanup: Move pose brush specific structs to sculpt_pose.hh
Pull Request: https://projects.blender.org/blender/blender/pulls/126528
2024-08-20 01:24:13 +02:00
Sean Kim
d1102ec040 Cleanup: Remove unused SculptOrigVertData struct
Pull Request: https://projects.blender.org/blender/blender/pulls/126527
2024-08-20 01:20:33 +02:00
Pratik Borhade
da57f2f3d5 Fix #124187: UI placeholder fails with None
With python API, `placeholder=None` throws an error and fails to
display the property in UI. Clear `PROP_NEVER_NULL` flag to resolve.

Pull Request: https://projects.blender.org/blender/blender/pulls/126497
2024-08-20 01:02:52 +02:00
Hans Goudey
4c37b3ea02 Cleanup: Resolved missing declaration warnings after recent cleanup
852b3dbff3
2024-08-19 17:00:29 -04:00
Hans Goudey
cc5d9387ce Fix: Build error after recent commit
c9a69f70d9
2024-08-19 16:54:36 -04:00
Hans Goudey
db265c9aac Sculpt: Specialize normal and topology mask expand operations
Use the flood fill utilities specialized per geometry type instead of
the existing abstraction which is now only used in the pose brush.
2024-08-19 16:52:41 -04:00
Hans Goudey
3afa9c8e4f Cleanup: Consistent C++ class layout 2024-08-19 16:52:41 -04:00
Sean Kim
c9a69f70d9 Refactor: Sculpt: Consolidate pbvh clearing actions
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
2024-08-19 22:15:19 +02:00
Jacques Lucke
625ba5dd82 Cleanup: remove unnecessary std::move 2024-08-19 21:56:34 +02:00
Jacques Lucke
7dbff95070 Fix #126450: crash in Sample UV Surface node 2024-08-19 21:01:15 +02:00
Jacques Lucke
354a097ce0 Volumes: improve file cache and unloading
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
2024-08-19 20:39:32 +02:00
Iliya Katueshenock
1b67be14c6 Cleanup: BKE: Nodes: Functions renaming
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
2024-08-19 20:27:37 +02:00