The "is edit mode" checks in the draw module have been simplified
to just check the object mode. We need to be a bit more careful to
avoid retrieving the original mesh from a non-mesh object.
This commit improves the "get pre-modified mesh" function with
better comments and checks that reflect the relatively recent cases
where the original and evaluated geometry data types don't match.
It's always called with a mesh object too.
Pull Request: https://projects.blender.org/blender/blender/pulls/130850
This workaround was against design and having conditional
sync depending on the view.
Now, the flat objects are put in a list and conditionally
put in a different pass at draw time.
Compositor: UI: remove snapping to nodes.
Snapping nodes to other nodes behaves in a very unpredictable way, which makes most snapping options useless.
The patch removes the following:
- Snapping options `Node X`, `Node Y` and `Node XY`
- Menu `Snap Node Element`
- Menu `Snap Target`
New behavior:
- Activating `Snap` always acts as 'Snap to Grid'
Part of https://projects.blender.org/blender/blender/issues/128612
Pull Request: https://projects.blender.org/blender/blender/pulls/127667
Visibility of linked collection cannot be changed after 4e907829d3 and
e494a44024. This results in failing "un-isolate" collection. To resolve
that, treat linked/overridden collections as isolated by returning true in
`outliner_collection_is_isolated()`.
Pull Request: https://projects.blender.org/blender/blender/pulls/130604
The vertex length of the batch was 1 which lead to invalid
drawcall if trying to render triangles or lines.
Setting a length of 0 allows the GPU module to bypass the
drawcall.
The viewer node is not edit mode data, it should be extracted from
a final evaluated mesh (that's just the mechanism that geometry
nodes uses to get the data to the engines. The requests were probably
just added to the bottom by mistake.
Add a new shader specifically for node sockets rather than using the
keyframe shader.
Motivation:
1. Allow easier addition of new socket shapes
2. Simplify socket drawing by avoiding special handling of multi-inputs
3. Support multi-inputs for all socket types (diamond, square, etc.)
The new shader is tweaked to look the same to the old ones.
**Comparison**
The biggest difference is that the multi socket is now more consistent
with the other sockets.
For single sockets there can be small size differences depending on zoom
level because the old socket shader always aligned the sockets to the
pixel grid. This could cause a bit of jiggling compared to the rest of
the node when slowly zooming. Therefore I left it out of the new shader
and it now scales strictly linear with the view.
**Multi Socket Types**
While there currently is no need for (.) internally, there are a few
obvious use-cases for multi-input field (diamond) sockets like
generalized math nodes with an arbitrary number of inputs (Add,
Multiply, Minimum etc.).
Co-authored-by: Jacques Lucke <jacques@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/119243
Add the base `Overlay` class for documenting the methods.
This cleans up the inconsistency in the method implementation
and add TODOs for method not complying with the interface.
Pull Request: https://projects.blender.org/blender/blender/pulls/130790
Caused by 8214109778
Before said commit, a vertexgroup `TreeElement` would take its `idcode`
in a questionable way described in the commit messages of 0c0bc61918
and 0a633a4e07.
Since 8214109778 this is not the case anymore, it is just 0.
4292bb060d made this comment (guess this never happened):
>/* We need to figure out how to deal with the idcode for non-
TSE_SOME_ID types still. Some rely on it... */
So in order to return to the prior behavior, we could just enable the
following line (even for the new type design), this will work, but feels
rather shaky (the basic question here is just "do we want idcode to
point to the owner ID for something like vertexgroups?" -- still cannot
answer this question tbh.):
`te->idcode = GS(owner_id->name);`
So one of the places where the logic relied on `idcode` is alphabetical
sorting. The logic excluded some elements from the sorting (by
explicitly setting their `idcode` to zero) and this is where we now
coughing up because... well we are always having a zero `idcode` for the
new type design.
To resolve, just explicitly enable sorting for `TSE_DEFGROUP` again by
explicitly setting their `idcode` to non-zero(one).
Pull Request: https://projects.blender.org/blender/blender/pulls/130750
We weren't handling the failure case of `IDP_AddToGroup` when the
property already exists. Arguably this is a bit bad because we're not
recording the type of the second socket with the same name, but we
don't really have the tools to solve that with IDProperties.
Add a Mesh implementation of triangulation, which is currently just
implemented for BMesh. The main benefit of this is performance and
decreased memory usage. The benefit is especially large because the
node currently converts to BMesh, triangulates, and then converts back.
But the BMesh implementation is entirely single threaded, so it will
always be much slower.
The new implementation uses the principle of "never just process a
single element at a time" but it also tries to avoid processing _too_
many elements at once, to decrease the size of temporary buffers.
Practically that means the work is organized into chunks of selected
faces, but within each chunk, each task is done in a separate loop.
Arguably I went a bit far with some optimizations, and some of the
complexity isn't necessary, but I hope everything is clear anyway.
Unlike some other Mesh ports like the extrude node or the split edges
code, this generates a new mesh. I still go back and forth on that
aspect, but reusing the same mesh would have required reallocating
face attributes from scratch anyway. Implicit sharing is used to
avoid copying vertex attributes though.
The result mesh is reorganized a bit. Unselected face data comes first,
then selected triangles, then triangulated NGons, then triangulated
quads. This makes attribute interpolation and internal calculations
more efficient.
The "Minimum Vertices" socket is replaced with versioning. In the new
implementation it would have an impact on code complexity, and for a
builtin "atomic" node it makes more sense as part of the selection.
The performance difference depends on the number of CPU threads, the
number of attributes, and the selection size. As all of those numbers
go up, the benefit will grow. The "modes" also affect the performance,
obviously.
With a Ryzen 7950x, I tested performance in a few situations (in ms):
| | Selection | Before | After | Change |
| -------------------------- | --------- | ------ | ----- | ------ |
| 1.4 m quads (fixed) | 50% | 1533 | 15.9 | 96x |
| 10 m quads (shortest) | 100% | 9700 | 165.0 | 59x |
| 1 m 10-side Ngons (beauty) | 90% | 3785 | 115.9 | 33x |
| 1 m quads many attributes | 100% | 54600 | 332.3 | 164x |
In follow-up commits, I'll move other areas to use mesh triangulation
instead of BMesh. This is the last geometry node using BMesh besides
the Ico Sphere primitive.
Pull Request: https://projects.blender.org/blender/blender/pulls/112264
When we enter Sculpt mode, a depsgraph evaluation is triggered. In 4.2,
a change was added in ada367a0e9 which
causes `sculpt_update_object` to exit early if it is unable to get the
evaluated mesh.
This function is responsible for ultimately ensuring the PBVH is built.
Later on when entering Sculpt Mode, we push an undo change to the stack
to signal changing and avoid a memfile undo push; this `undo::push_begin`
function was changed in 4.3 to require the PBVH, as it was expected to
only be used for cases where we needed the total number of mesh elements
(i.e. when making a stroke on the mesh)
Currently, this causes a crash because in this instance, the PBVH is now
no longer created. To fix this, this commit adds a new function to the
sculpt undo namespace to indicate that thsi special undo step is being
performed, which is similar to a geometry undo step and does not require
the PBVH.
Pull Request: https://projects.blender.org/blender/blender/pulls/130649
Affects both the Slide Relax brush when using the `shift` smooth mode
and the Relax mode of the mesh.
This commit simply changes the `calc_vert_neighbors_interior` method for
`calc_vert_neighbors` in the shared functions to avoid filtering out
boundary vertices by default.
Pull Request: https://projects.blender.org/blender/blender/pulls/130697
As part of the overall sculpt brush refactor project, the `corner_tris`
attribute was removed from the PBVH and accessed directly from the mesh
runtime data.
A new set of methods was introduced to the `TrianglesCache` `struct` to
prevent tagging the cache as dirty and requiring a subsequent evaluation
because the performance hit while in sculpt mode was significant. This
was enabled upon entering sculpt mode and disabled upon exiting it.
Unfortunately, there are some operations inside Sculpt mode which can
cause either the Mesh object itself or the MeshRuntime object to be
recreated, effectively unfreezing the cache. A few examples that cause
this are:
* Undoing the first brush operation on file load
* Performing a remesh operation
To fix this issue, this commit checks and re-freezes the cache if it
is detected to be in a bad state prior to tagging the cache as dirty.
Further changes to fix this on a more fundamental level are well
outside of the scope of a fix needed for 4.3.1.
Pull Request: https://projects.blender.org/blender/blender/pulls/130709
Changes to area splitting when dragging from a corner action zone.
Increases the distance you must drag into the area before anything
starts. Increases minimum size that you can create to about 2X the
header height. Slight snap to 50% when no modifier keys are held.
Pull Request: https://projects.blender.org/blender/blender/pulls/130706
Previously the spreadsheet always used vertex selections to figure
out which geometry elements to display. This caused unexpected
filtering because of generic domain propagation rules.
Instead, implement filtering separately for each domain. This
requires a bit more boilerplate but the code is much clearer
and should be a bit more efficient too.