The merge by distance operator now has an optional merge centroid
option, when it is enabled, groups of merged vertices are averaged
and moved to their centroid position.
This allows for more predictable results in cases where vertices that
form loops would have otherwise collapsed unevenly and ended up with
jagged lines.
Ref !146478
Previously the method of picking the "target" duplicate wasn't
deterministic from a user perspective.
The behavior has been changed so:
- For a cluster of 3 or more vertices,
use the vertex closest to the centroid.
- For a cluster of 2 use the lowest index.
This mitigates #78916, solving some cases where clusters have a
central vertex although can't be considered fixed as the 2 vertex
case doesn't work so well.
Added a BLI_kdtree_{N}d_calc_duplicates_cb function that lets the
caller choose the index to keep from a cluster of duplicates.
Refactored from !145851.
Ref !146492
Co-authored-by: tariqsulley <tariqsulley3c@gmail.com>
Adds comprehensive logging system for temp_override context manager to
help developers debug "context is incorrect" operator poll failures.
The logging tracks all context member access during temp_override
sessions and provides detailed summaries to identify context
availability issues.
Features:
- Command-line logging: `./blender --log-level trace --log "context" `
- Python programmatic control: `temp_override_handle.logging_set(True)`
- C-level API: CTX_temp_override_logging_set/get() functions
- Tracks individual member access
- Uses CLOG logging infrastructure
The logging helps identify which context members are accessed during
temp_override sessions and whether they return valid data, making it
easier to debug operator poll functions that fail with context errors.
Ref !144810
The previous implementation used KDTree duplicate search with
BLI_kdtree_3d_calc_duplicates_fast(). The survivor was always
one of the input vertices, not the centroid of the cluster.
This caused cases where merging a line of vertices did not
collapse to their average position, resulting in jagged loops.
Now vertices within the threshold are clustered, their centroid
is computed, and the chosen survivor is snapped to this centroid.
This ensures predictable and consistent merge results.
Ref !145851
Support adding lattices to selected objects,
deforming them with with the lattice modifier.
By default the lattice fits to the object bounds and is oriented
to the active object (if it's set).
Resolves#144076
Ref !144888
There was an incorrect assumption that the display colorspace of a
view + display transform uniquely identifies it. But with modern OCIO
configs there is no longer a unique display colorspace per view.
The same wrong assumption was made in the code that refreshes the image
editor after save, and that was fixed as well.
Ref #145519
Pull Request: https://projects.blender.org/blender/blender/pulls/146449
error: ‘INT_MAX’ was not declared in this scope
compiler hints to include missing header `#include <climits>`
but replaced with `std::numeric_limits<int>::max()` / min
**ONLY** in cases where the errors were thrown
Pull Request: https://projects.blender.org/blender/blender/pulls/146212
This removes unused closure branches in the principled BSDF
code using the Material flags.
On top of this, use constants for weights to use compiler
dead code eliminitation for unused branches when there
is different variants of the principled BSDF node used.
Finally, remove Gbuffer packing cases that are not present
inside the nodetree.
Testing with the same setup as #145347:
| | main (ms) | PR (ms) | Delta (ms) |
| -------- | ----------- | ------------ |------------ |
| Nvidia | 174 | 132 (1.31x) | 42 |
| Mesa AMD | 191 | 170 (1.12x) | 21 |
Barbershop compilation time is almost equal because it is not using
the principled BSDF.
Rel #145347
Pull Request: https://projects.blender.org/blender/blender/pulls/146324
Can happen if you set cursor location by snapping or manually.
In order to really skip drawing in `draw_output`, we have to set
`enabled_` to false in `begin_sync`.
This is already done for the "simple" cases covered by
`is_cursor_visible_XXX` but not for the "special" case where the cursor
is clipped in the view.
This is what this PR does.
Pull Request: https://projects.blender.org/blender/blender/pulls/146354
Currently, when a python error is encountered when rendering the UI, the
corresponding message is printed to stdout / stderr via `PyErr_Print`,
this patch modifies behavior so that a cursory message is also printed
with CLOG
This has the benefit of allowing for testing via
`--debug-exit-on-error`, which aborts Blender when an error message is
printed.
Pull Request: https://projects.blender.org/blender/blender/pulls/146296
Unlike some other UI types, specifying the space type with this property
doesn't guarantee the asset shelf will only be shown in this space type. This
is an important behavioral detail that's easily missed.
The bug was there before, which is now found by an assert added in
84511b8509.
This used to be an integer property in the past before there were
boolean id properties.
Caused by ab43c57a2a
The VSE allows for "no scene", prior to above commit an "arbitrary"
framerate of 25 was hardcoded to display "something" in that case.
To resolve, pick what we defined as default for framerate (getting rid
of the "arbitrary") in case we have no (VSE) scene.
NOTE: that is 24 atm (instead of the hardcoded 25 we had before)
Pull Request: https://projects.blender.org/blender/blender/pulls/146300
When texture painting a non-manifold mesh, various artifacts are created
on the image texture.
To add seams to the edges of non-manifold UV islands, the texture
painting system reads and writes pixels near the edge of the UV islands.
The offset calculations used to find pixel positions for reading and
writing were not accounting for color channels (RGBA) in the pixel data.
Because of this, the reading function corrupted the color data for the
seams, and the writing function caused the seams to be scaled down and
repeated.
Pull Request: https://projects.blender.org/blender/blender/pulls/146110
Same situation as in #138793, so same solution as 1cb20d444e
Converting from text (via legacy curves) to grease pencil with "Keep
Original" option enabled can cause the new grease pencil ID to not be
evaluated, leading to an situation where a evaluated grease pencil
object would point to the original legacy curve ID as its object data.
This fix added a depsgraph tag so it ensures the COW ID is the latest.
Pull Request: https://projects.blender.org/blender/blender/pulls/146314
The Vectorcall protocol avoids creating a tuple, and also provides the
number of arguments in advance, providing a ~1.6x speedup for creation
of mathutils types.
Ref !146237
Each dupli is given a PersistentId which is 8 integers, 1 for each level
of recursive duplication that Blender supports. When an instance belongs
to fewer than 8 levels, the id is padded with sentinel values for the
remaining levels. For example, a 2 level dupli may have a persistent id
like:`[7, 4, INT_MAX, INT_MAX, INT_MAX, INT_MAX, INT_MAX, INT_MAX]`
When calculating the instance's `random_id` we were considering all 8
values of the Persistent Id which is unnecessary and wasteful. Now we
only use the minimal values necessary. This does mean that the Object
Info: Random material socket changes values from prior versions however.
This improves the performance of the viewport in some instancing
scenes by roughly 4-6%.
Co-authored-by: Bastien Montagne <mont29@noreply.localhost>
Pull Request: https://projects.blender.org/blender/blender/pulls/145150
A aspect ratio less than or equal to zero will cause point to not be
displayed.
This behavior problematic because use strokes create by Geometry Nodes
(or bugs) can cause the `aspect_ratio` to default to zero.
And as there is currently no operator to set `aspect_ratio` this
invisible geometry can not be fixed by most users.
This PR fixes this by returning `1.0f` when the `aspect_ratio` is
invalided.
Pull Request: https://projects.blender.org/blender/blender/pulls/146279