Support segment mode in Grease Pencil v3 selection operators.
This is a continuation of #109221.
Segment selection works in multiple stages:
1. When enabled, the 2D evaluated lines for all visible curves are
entered into a BVH tree. This tree is used to find intersections later
on. All the visible drawings are in the tree, an `OffsetIndices` array
is used to record ranges of BVH elements for each drawing.
2. Primary selection functions get alternative versions that produce an
`IndexMask` instead of writing directly to selection attributes. This
makes it possible to detect select actions on points that are already
selected. Using a delta of selection attributes for this is not enough
to detect such user actions (and inefficient).
3. In segment mode the `IndexMask` is extended to fully cover segment
points (or exclude them when deselecting respectively). This first
performs and intersection test using the BVH tree, then finds all point
range with selected elements.
4. Finally the extended index mask is applied to selection attributes as
usual.
Pull Request: https://projects.blender.org/blender/blender/pulls/126027
Without a proper redraw, the outliner (in `Blender File` mode) would
only *partially* update on mouse hover, refreshing the user-count of
the old datablock without listing the newly added datablock.
Pull Request: https://projects.blender.org/blender/blender/pulls/126386
The preview rendering would fall back to the shader preview rendering
pipeline, which is not suitable for objects. Instead, don't render any
preview (use an empty preview) for such object types. This case could be
handled a bit nicer by the code triggering the preview rendering (e.g.
the "Render Active Object" operator poll could return false), but
keeping that separate from fixing the lower level logic to ensure crash
free behavior.
Pull Request: https://projects.blender.org/blender/blender/pulls/126235
Looks like this use to 'work' because lower-level code would refuse to
delete an embedded scene collection, but the operator should not have
been active at all in the first place.
Fixed by adding a proper `poll` callback to the `collection unlink`
operator.
Changes similar to f9c6fe30db.
- Calculate node bounds after building the tree.
- Calculate node visibility after building the tree.
- Avoid redundant normals recalculation. They are already calculated
when first building the dynamic topology BMesh.
- Avoid clearing the default node flags.
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