Commit Graph

122050 Commits

Author SHA1 Message Date
Hans Goudey
74a2211f95 Geometry Nodes: Increase parallelism in Geometry Proximity node
The default grain size of 10000 for multi function execution was much
too large for the fairly expensive BVH traversal. In the file from
#143455, reducing te grain size to 512 increase the playback FPS from
8 to 20.
2025-08-03 11:18:59 -04:00
Hans Goudey
1229fba5c9 Fix #143856: Data race in curves/point cloud selection
Depsgraph tags cannot be added in parallel.
2025-08-03 10:47:39 -04:00
Hans Goudey
e59fb784ff Geometry Nodes: Use standard node width for face neighbors node 2025-08-03 10:03:30 -04:00
YimingWu
250e809d6f Fix #143870: Grease Pencil: Fix typo in dash modifier
Previously modified by e7a3f0758e, should be `!joined_geo.has_curves()`.

Pull Request: https://projects.blender.org/blender/blender/pulls/143889
2025-08-03 14:09:08 +02:00
Jacques Lucke
77563587cd Geometry Nodes: trace bundles/closures through repeat zone, simulation zone and bake node
This adds support for tracing bundle and closure structures through repeat zones,
simulation zones and bake nodes. Previously, syncing through these nodes just
didn't work.

Pull Request: https://projects.blender.org/blender/blender/pulls/143860
2025-08-02 22:28:17 +02:00
Casey Bianco-Davis
dfeeaa98fd Grease Pencil: Use Curve overlay for Bezier handles
This makes it so that Grease Pencil Bezier handles use the same colors and shaders as `Curves` Objects.

This also makes the handles follow `handle_display` and add the option the the edit mode overlay.

Pull Request: https://projects.blender.org/blender/blender/pulls/141524
2025-08-02 15:37:59 +02:00
Jacques Lucke
f271a48b6b Geometry Nodes: improve link-drag-search for bundle and closure nodes
This adds support for creating Combine Bundle, Separate Bundle and Evaluate Closure
nodes using link drag search in some cases that were not previously supported.

Pull Request: https://projects.blender.org/blender/blender/pulls/143835
2025-08-02 14:09:06 +02:00
Jacques Lucke
69dee02d4f Cleanup: quiet unused variable warning 2025-08-02 13:38:44 +02:00
Jacques Lucke
4f9b66fe4a Fix: Nodes: restore active node after copy-pasting nodes
This remembers which node was active when copying nodes. When pasting, the node
that was active when copied is made active again.

Pull Request: https://projects.blender.org/blender/blender/pulls/143832
2025-08-02 13:24:12 +02:00
Jacques Lucke
99984b3b05 Nodes: optimize freeing all nodes
We generally expect `bNodeTreeRuntime::nodes_by_id` to be valid at all times, so
it also has to have the same order `bNodeTree.nodes`. When freeing a node, the
entire vector set was rebuild currently to ensure that invariant. This leads
O(n^2) behavior when all nodes are freed as is commonly the case with depsgraph
copies etc.

This patch implements an optimization where `nodes_by_id` is not rebuild if only
the last node was removed. In this case, that not can just be popped from
`nodes_by_id` without affecting the order of the other nodes. To use this
optimization, the node tree freeing code now frees nodes in reverse order.

Pull Request: https://projects.blender.org/blender/blender/pulls/143831
2025-08-02 12:35:16 +02:00
Jacques Lucke
9fd877e174 Fix: Nodes: copied node not always added to nodes_by_id 2025-08-02 11:34:09 +02:00
Jacques Lucke
644a1791b9 Fix: Nodes: shader socket missing in some places 2025-08-02 11:14:32 +02:00
Jacques Lucke
9cb50ea83b Refactor: Nodes: pass tree type to supports_socket_type function for socket items
This allows us to support a different set of sockets per tree type in e.g. the
repeat zone as in #141936.
2025-08-02 11:13:38 +02:00
Jacques Lucke
5b73f798d0 Refactor: Nodes: allow passing already unique name/identifier to node copy function
This is useful when the src node name is not unique, but the caller can provide
a unique name more efficiently then if the function has to compute the name
automatically.
2025-08-02 11:02:10 +02:00
Jacques Lucke
252b983c0c Geometry Nodes: change idnames of experimental bundle and closure nodes
This removes the "Geometry" part from their name because we want to use them in
other node tree types too (see #141936).

Usually, we don't change idnames because they are the primary identifier of
nodes and is expected to stay the same. Since they are generally not shown to
users (just Python developers), it's also not urgent to change them. However, in
this specific case we have the opportunity to update the idname before the node
becomes an official feature, so it's not as bad to change it.

This patch has full backward compatibility, but no forward compatibility (for
files that used the experimental feature).

Pull Request: https://projects.blender.org/blender/blender/pulls/143823
2025-08-02 10:17:39 +02:00
Jacques Lucke
9579bca13f Geometry Nodes: disallow leading or trailing whitespace in bundle item names
This makes sure that a bundle item has a more well defined beginning
and end when using e.g. a comma separated list for bundle items.
This allows using e.g. `, ` instead of just `,` as separator (note the
extra space in the first separator).
2025-08-02 06:57:08 +02:00
Campbell Barton
d72e7f9d6e Cleanup: only handle selection when BM_mesh_esubdivide uses selection
While all callers currently operate on the selection, the function
supports other header-flags, so check the selection is being used
before updating & flushing the selection.
2025-08-02 04:41:40 +00:00
Campbell Barton
619d370703 Cleanup: rename click_drag to press_drag functions, variables 2025-08-02 14:04:56 +10:00
Campbell Barton
62aac627a5 Cleanup: rename KM_CLICK_DRAG to KM_PRESS_DRAG for clarity
"Press drag" more accurately describes what the action does.
2025-08-02 13:41:38 +10:00
Campbell Barton
a3bf386d43 Cleanup: use full sentences in text editor code-comments
Also minor improvements, clarifications.
2025-08-02 13:33:05 +10:00
Campbell Barton
6d899a6726 Cleanup: naming & reduce declaration scope in the PyAPI for lib loading
Use terms source/destination instead of from/to.
2025-08-02 02:10:59 +00:00
Campbell Barton
58c7bb3fc7 Cleanup: minor corrections to library loading logic, improve docs
- Share the initialization size for library dictionaries &
  assert this size is up to date.
- Improve doc strings.
2025-08-02 12:05:13 +10:00
Jesse Yurkovich
bdc0d39aa4 Fix #143722: Set a default exposure for Hydra dome/world light
The Storm hydra delegate requests this property and USD will trace, per
the bug report, if it is not present.

This started happening with the library update for 4.4 which is odd.
The code[1] in Storm has existed forever and so has the USD trace for
requesting data from an empty VtValue.

[1] https://github.com/PixarAnimationStudios/OpenUSD/blame/release/pxr/imaging/hdSt/light.cpp#L305

Pull Request: https://projects.blender.org/blender/blender/pulls/143746
2025-08-01 20:48:23 +02:00
Bastien Montagne
aa50de76a7 Fix assert when assigning active material of an object through RNA.
This is yet another fully virtual property (it does not exist as-is in
DNA, and requires both getter and setter) that does handle ID
refcounting of the affected materials. Now these require an explicit
definition of `PROP_ID_REFCOUNT`, as this flag cannot be defined
automatically by makesrna.
2025-08-01 18:24:54 +02:00
Miguel Pozo
5725176312 Fix: GPU: Shader cache clearing on subprocess crash
`delete_cached_binary` didn't work correctly since the cache hash could
be overwritten before the subprocess crashed.
This fix requires an extra memory copy, but it doesn't seem to incur any
measurable overhead.
An alternative could be to store the cache name in its own variable in
ShaderBinaryHeader, but that would break cache files compatibility.

Pull Request: https://projects.blender.org/blender/blender/pulls/143649
2025-08-01 17:50:44 +02:00
Miguel Pozo
89380338c0 Cleanup: Remove unused variable 2025-08-01 17:44:05 +02:00
Habib Gahbiche
a64083d6e4 Cleanup: use version_node_* for Map Value
Pull Request: https://projects.blender.org/blender/blender/pulls/143796
2025-08-01 17:35:01 +02:00
Miguel Pozo
e8ddaff8ea Fix #143087: OpenGL: Startup crash on old AMD drivers
Try to cover more cases for detecting workarounds,
and prefer false positives.

(4.5 backport candidate)

Pull Request: https://projects.blender.org/blender/blender/pulls/143106
2025-08-01 16:42:49 +02:00
Jacques Lucke
e6c12f19b5 Fix: Geometry Nodes: wrong socket syncing for nested bundles 2025-08-01 16:34:52 +02:00
Nika Kutsniashvili
7158e02aed Modeling: Set shape key default value to 1.0
When adding a shape key, set its blend value to 1.0 / 100%.

There is no practical use case where user wants to add shape key but
not work on it. New shape keys at value 0 have no purpose. Adding
shape key should be interpreted by Blender as user wanting to
sculpt/model on it. Also, being at 1.0 initially doesn't change
anything visually, because key isn't edited yet and it doesn't deform
mesh.

The default value of the shape key is also set to 1.0. When using
right-click to reset values, user most often wants to return to 1
(which is "correct" state of deformation without multiplication)
rather than 0 (which is no deformation at all).

Co-authored-by: Sybren A. Stüvel <sybren@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/133399
2025-08-01 15:43:31 +02:00
Philipp Oeser
8678766c5a Fix #143648: Cannot add collection instances to light linking
Since c6c127bfd3, objects for which `OB_TYPE_IS_GEOMETRY` fails (e.g.
Empties) were skipped.
However, empties instancing collections works well with light linking if
they contain geometry so we should be supporting these.

In order to do this use an existing function from preview rendering
(`collection_preview_contains_geometry_recursive`), move that to BKE and
use that from light linking operators.

Pull Request: https://projects.blender.org/blender/blender/pulls/143776
2025-08-01 15:43:00 +02:00
Miguel Pozo
34db9bd087 Fix: OpenGL: Invalid GL info on GPUSecondaryContexts
When creating `GPUSecondaryContext`s, `epoxy_gl_version` returns 0 and
`epoxy_has_gl_extension` always returns false.
This is caused by `GPU_context_create` being called without the ghost
context being activated.

Activating it fixes the issue.

Pull Request: https://projects.blender.org/blender/blender/pulls/142715
2025-08-01 15:32:50 +02:00
Bastien Montagne
f4ae983dfb RNA: Improve handling of ID refcounting by Pointer properties.
This commit works on two related issues:
1. It is too easy to forget to handle ID refcounting in custom RNA setters.
2. It is not possible to fully force RNA refcounting ON or OFF for some
   properties.

Issue 1. has bit us several times recently (e.g. in animation or
compositor areas, see latest fix blender/blender!143577).

This commit addresses it by adding some debug-only checks around the
call to `PointerPropertyRNA::set()` in `RNA_property_pointer_set()`,
that validates that usercount of both previously and newly assigned IDs
matches expected (changes of) values.

While not ideal, this should make it way easier for developers to catch
that issue in the future.

The second issue was discovered while working on the first, leading to
e.g. questionable work-arounds like the `rna_DriverTarget_id_set`
setter, only defined to by-pass the automatically assigned
`PROP_ID_USERCOUNT` flag (and related automatic refcounting of the
default setter code).

It is addressed by adding an internal `PROP_INTERN_PTR_ID_REFCOUNT_FORCED`
flag, which keeps track of calls to
`RNA_def_property_flag`/`RNA_def_property_clear_flag` which explicitely
sets or clears the `PROP_ID_USERCOUNT` flag, and prevents automatic
setting of that flag in that case.

Pull Request: https://projects.blender.org/blender/blender/pulls/143660
2025-08-01 14:01:24 +02:00
Campbell Barton
2c27d2be54 Cleanup: grammar corrections, minor improvements to wording 2025-08-01 21:41:24 +10:00
Jacques Lucke
3905cdd89a Fix #143455: crash in Grease Pencil Shrinkwrap modifier when there is a dependency cycle
The case when no mesh can be retrieved from the shrinkwrap target object can be
retrieved was not handled. It was handled by `ensure_shrinkwrap_cache_data` but
the calling function didn't check if the cache was actually created.
`BKE_modifier_get_evaluated_mesh_from_evaluated_object` can return null for an
object that would usually have a mesh but the object has not been evaluated yet,
as can be the case when there is a depsgraph cycle.

From my current understanding, the issue existed without 83325d1fd. Changing the
hash just made the depsgraph do different scheduling decisions so that now the
shrinkwrap was evaluated before the target object. The order in which these two
things are evaluated is arbitrary when there is a depsgraph cycle.

Pull Request: https://projects.blender.org/blender/blender/pulls/143757
2025-08-01 12:58:31 +02:00
Sybren A. Stüvel
bd7b8bbeaf Shape Keys: expand tooltip of Make Basis Key operator
Expand the tooltip of the "Make Shape Key the Basis Key" to clarify that
the chosen shape key will be applied at 100%, and not at the current
blend value.

Pull Request: https://projects.blender.org/blender/blender/pulls/143466

Pull Request: https://projects.blender.org/blender/blender/pulls/143466
2025-08-01 12:54:50 +02:00
Sybren A. Stüvel
abb0c49870 Shape Keys: let Make Basis Key also update the "relative to" fields
When a shape key is made the new basis key, also update the "Relative
To" setting on the old & new basis keys. Both are made relative to the
new basis shape key.

Without this, the old basis key would still be relative to itself, which
effectively disables it. By making it relative to the new basis key, you
can increase its blend value to invert the effect of the new basis key.

Pull Request: https://projects.blender.org/blender/blender/pulls/143466
2025-08-01 12:54:46 +02:00
Benjamin Beilharz
53832755ae Compositor: Adds extension modes to map UV node
This commit introduces the extension modes for the map UV node. The
drop-down for the extension modes is only shown if the interpolation
mode is not set to anisotropic. This is due to extension modes currently
not being supported for the anisotropic filtering.

Pull Request: https://projects.blender.org/blender/blender/pulls/143415
2025-08-01 11:00:24 +02:00
Christoph Neuhauser
f03392a09a Fix #141436: Dilate node Feather mode has artifacts
The Dilate node Feather mode has artifacts on Intel Windows GPUs. This
is due to a wrong shader image format. So this patch fixes that by using
the correct single channel format.

Pull Request: https://projects.blender.org/blender/blender/pulls/143748
2025-08-01 10:52:33 +02:00
Habib Gahbiche
d04ae09aff Compositor: remove scene.node_tree from Python API
Since we are removing `scene.use_nodes` in #143578, most developers
will have to update their python script by replacing `scene.node_tree`
by `scene.compositing_node_group` in order to create a new compositing
 node tree anyways. So we remove `scene.node_tree`.

Note: `scene->nodetree` in `scene_blend_write()` is still being written
to the blend file, so forward compatibility is not affected by this PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/143619
2025-08-01 10:30:11 +02:00
Bastien Montagne
d415890708 RNA: Improve handling of bitflags enum properties.
* Remove the 'set default from all bitflags items' behavior of
  `RNA_def_property_enum_bitflag_sdna`.
* Add some minimal sanity check regarding bitflag enums that also define
  an `items` runtime callback.
  It currently assumes that if a valid set of items is also statically
  defined, the items callback will return a subset of these.

Implements #143538.

Pull Request: https://projects.blender.org/blender/blender/pulls/143733
2025-08-01 10:25:41 +02:00
tariqsulley
b9958fa4da Modeling: mirror support for the hide operator
Use EditMeshSymmetryHelper so hiding operates on mirrored geometry.

Ref !142698
2025-08-01 05:02:08 +00:00
tariqsulley
0720f90606 Edit Mesh: add EditMeshSymmetryHelper utility class
This class simplifies supporting mirror functionality for edit-mesh
operators.

No functional changes.

Ref !142698
2025-08-01 15:00:13 +10:00
Mattias Fredriksson
e191d3d243 IO: OBJ improvements for NURBS curves
* Bezier (NURBS) import, supporting both Blender and external variants.
* Cleaner Bezier export, with better results importing in Rhino.
* Internal support for exporting the new Curves type.
* Tests covering a broad number of related cases.

The current NURBS exporter writes curve data directly, without accounting
for internal padding or how knots are generated from modes. This adjusts the
export behavior to omit data that does not influence the geometry of the
curve. The result is a simplified output that is easier to parse during import,
both for the importer and when importing to other platforms (Rhino).
Visual explanation to the adjustment can be found in #139174.

Importer is also adjusted to support variations in knot patterns. Extending
it to support the data generated by the exporter and by other platforms (Rhino).
This should resolve some issues in relation to #138732.

Integrated tests are added to broadly validate the common cases generated
by the exporter, including variations of different modes and NURBS order.

Regression tests are added to validate that the NURBS generated in Rhino
are imported as expected.

More details in the PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/139174
2025-08-01 06:37:28 +02:00
Campbell Barton
2b97043379 Cleanup: use doxygen comments for BLF headers 2025-08-01 04:08:30 +00:00
Campbell Barton
62dc34621a Cleanup: quiet warning in GCC 2025-08-01 14:02:26 +10:00
Campbell Barton
c04310d69f Fix memory leak when loading libraries fails from Python 2025-08-01 13:40:56 +10:00
Sean Kim
531d3d0a9c Cleanup: Rename sculpt_undo.cc NodeGeometry variables
Pull Request: https://projects.blender.org/blender/blender/pulls/143760
2025-08-01 00:24:21 +02:00
Sean Kim
e7378f1efd Fix: Avoid CLG_Level warning when -1 is used as CLI parameter
This commit prevents the UBSAN `-fsanitize=enum` warning from being
printed when `--log-level -1` is used on the command line.

Pull Request: https://projects.blender.org/blender/blender/pulls/143755
2025-07-31 22:23:16 +02:00
Jacques Lucke
c91a21d42b Fix: Geometry Nodes: crash when linking closure/bundle to group in/output extent socket
The issue was that the parent node group was not necessarily updated already
when the tracing code ran. So use socket identifiers instead of indices to try
to find corresponding sockets between group nodes and their corresponding
node groups.
2025-07-31 22:06:30 +02:00