Commit Graph

152128 Commits

Author SHA1 Message Date
Campbell Barton
9d41b04aec Cleanup: quiet warnings, typo 2025-07-18 12:03:53 +10:00
Campbell Barton
98dcd0c91e Build: unbreak WITH_HEADLESS, !WITH_PYTHON configurations 2025-07-18 12:01:43 +10:00
Campbell Barton
ce5c54fef6 Fix #128169: Memory leak in bpy.data.meshes.new_from_object
Resolve leak in new_from_object when preserve_all_data_layers=True and
a sub-surfaced mesh.

A copy was made, then BKE_mesh_wrapper_ensure_subdivision would return
the "mesh_eval" of the copy, leaking the mesh passed to
BKE_mesh_wrapper_ensure_subdivision.

Ref !142176
2025-07-18 11:30:50 +10:00
Sean Kim
a3aa47ecec Cleanup: Add comment to wmWindow about pixelsize
Performing operations based on window size in terms of pixel units has a
high chance of resulting in unwanted behavior for macOS, due to HiDPI
displays.

This commit adds an API warning suggesting against usage of the raw
`sizex` and `sizey` values.

Related to #141982

Pull Request: https://projects.blender.org/blender/blender/pulls/142274
2025-07-18 01:12:15 +02:00
Sean Kim
245025480f Fix #141827: Crash when switching from edit to sculpt mode when hidden
When switching modes, the active object visibility is used to determine
whether or not the mode can be entered. Whether or not this object is
null or not is dependent on the current mode. Object Mode uses the
underlying visibility, whereas other modes do not. When
`mode_compat_set` is used, the active object is switched to object mode,
causing `CTX_data_active_base` to be null.

To fix this immediate issue and prevent further refactors from
potentially reintroducing it, this commit makes a number of changes:

* Clarifies the `object::mode_compat_set` function docstring in
  ED_object.hh
* Makes `object::mode_compat_set` the last operator check
* Uses `BKE_view_layer_base_find` instead of `CTX_data_active_base`
  since both necessary parameters are already on-hand in the function.

Pull Request: https://projects.blender.org/blender/blender/pulls/141985
2025-07-18 00:26:12 +02:00
Brecht Van Lommel
df6d6c0932 Refactor: Cycles: Use logging system for GPU error print
Pull Request: https://projects.blender.org/blender/blender/pulls/142257
2025-07-17 21:14:30 +02:00
Brecht Van Lommel
6f8eb2a1af Fix #142233: Cycles crash due to wrong node type registration order
This was exposed by NanoVDB changes. Properly ensure the base type is
created before the derived type.

Pull Request: https://projects.blender.org/blender/blender/pulls/142261
2025-07-17 21:13:59 +02:00
Jesse Yurkovich
84367f8cb9 Fix #142084: Importing broken USD skeletons can crash
The repro file in question contained invalid paths for the USD Skeleton.
This was not detected in our import code which proceeded to create bones
with empty (`""`), incorrect, names and subsequently allowed the
rest-pose setup to use non-existent bones during processing.

The primary fix here is to ensure that all incoming joint paths are both
valid and unique[1]. A secondary fix is made to the rest-pose function
to use our joint-to-bone map to ensure we are using the correct bone
names.

[1] https://openusd.org/release/api/class_usd_skel_skeleton.html#aa6bf8297f4aae6de9fbf1b784c524d30

Pull Request: https://projects.blender.org/blender/blender/pulls/142133
2025-07-17 19:49:29 +02:00
Jesse Yurkovich
1d2c1d2fa7 Fix #141718: Discontinuous rotations on some USD skeleton imports
Due to ambiguity when decomposing the incoming skeleton joint matrix,
it's possible for the returned quaternion rotation to be "flipped" from
the perspective of prior/future frames due to the quaternion
double-cover property. This would manifest as glitchy animations and
subtly incorrect motion blur results during render.

This PR implements the traditional mitigation of comparing with the
prior frame's rotation data and negating the quat if necessary. An
alternate method to instead compare with the rest positions was
attempted but it still allowed flipped/discontinuous rotations for
spinning objects like wheels and propellers.

Pull Request: https://projects.blender.org/blender/blender/pulls/142026
2025-07-17 19:44:46 +02:00
Mattias Fredriksson
50ec3cb2d4 Cleanup: Mutable Span in geom compare
Data is only accessed but variable is of type MutableSpan unlike `sorted_to_values1`.

Pull Request: https://projects.blender.org/blender/blender/pulls/142224
2025-07-17 16:59:56 +02:00
Miguel Pozo
11e423f7ef Fix #141918: Crash when playing 2 image sequences
Fix the race condition.

Pull Request: https://projects.blender.org/blender/blender/pulls/141960
2025-07-17 16:35:05 +02:00
Falk David
7d15b346d1 Cleanup: Remove GPENCIL_ANY_VERTEX_MASK macro
This replaces the `GPENCIL_ANY_VERTEX_MASK` legacy macro
with a function that is used in the Grease Pencil code.

Also removes some includes of legacy headers.
2025-07-17 16:19:03 +02:00
Falk David
c5642fc3c6 Cleanup: Remove unused legacy marco definitions
These macros were originally used by GPv2 before 4.3.
Now they are completly unused.
2025-07-17 16:19:03 +02:00
Hans Goudey
622e3d4792 Fix: Potential issue with multires bake tangent handling
Mistake in b19696c0b8

Don't reference the data from the `Array` which will just be the inline
buffer if `require_tangent` is false (for displacement baking).

I still observe a crash when multires baking, but that's deep in Cycles
code.
2025-07-17 10:08:43 -04:00
YimingWu
aa6761f65f Fix #142183: Grease Pencil: Check object type upon exporting selected frames
When only exporting "Selected Frames", we need to read frames from the
active grease pencil object. If the active object isn't a grease pencil
object, we need to return early and do not export.

Co-authored-by: Thomas Dinges <thomasdinges@noreply.localhost>
Pull Request: https://projects.blender.org/blender/blender/pulls/142188
2025-07-17 15:56:36 +02:00
YimingWu
37df7ea850 Fix #137429: GPU: Allow missing attribute in pygpu_shader_attrs_info_get
In `pygpu_shader_attrs_info_get`, it tries to check information for all
vertex attributes that are added via `VERTEX_IN`, however some drivers
will optimize compiled shaders so some vertex attributes that are not
used will be removed. This fix makes sure that the input length that
is used in `GPU_shader_get_attribute_len` does not exceed actual max
binding number.

Pull Request: https://projects.blender.org/blender/blender/pulls/137584
2025-07-17 15:54:12 +02:00
Piotr Makal
6697dc2561 Fix: Crash when Bevel operation is performed on border edges
Fix #142045 crash on performing bevel operation on border edges.
When user selected both border edges and neigboring edges
(parallel to those border egdes) for the bevel operation,
the former were omitted during construction of BevVert objects
but their initial UV connectivity were recorded during call
to determine_uv_vert_connectivity function - specifically BMLoop
pointers were stored in BevelParams::uv_vert_maps member.
This later caused issues after rebuilding existing polygons
(bevel_rebuild_existing_polygons) since previously recorded
BMLoop pointers became invalid for border edges but still were
stored in uv_vert_maps (uv_vert_map_pop function was not called
for them since those loops were not related to BevVert objects).
This caused crash when accessing UV positions, when providing
invalid loop pointer to BM_ELEM_CD_GET_FLOAT_P function in bevel_merge_uvs.
2025-07-17 09:20:34 -04:00
Philipp Oeser
2fd36b0ab7 Fix #142103: Animation decorator not working on Light Temperature value
When having a checkbox and a value both in one row together with an
animation decorator it is questionable whether the decorator should act
on animating the checkbox or the corresponding value.

We had similar cases before (e.g. 7c04ef210e)

In this case as well, one would think it is more desirable to animate
the actual Temperature **value** (instead of the checkbox), so this is
what this PR does.

Pull Request: https://projects.blender.org/blender/blender/pulls/142192
2025-07-17 15:03:50 +02:00
Christoph Lendenfeld
d64ace7799 Fix #142106: FCurve noise modifier versioning error
This issue occurred because versioning was applied twice.

The history:
* First I created 05aac73b45 which fixed the issue on main (4.5 at the time), version `405, 14`
* Then I created a backport for 4.4.3 f1e829a459 which also added versioning, version `404, 32`

That means all files created with 4.4.3 (`404, 32`) already had versioning
applied. However then opening it in 4.5 applied the versioning again since that only checked
if the version was at least `405, 14`

The fix is to exclude files that have already been saved with `404, 32`

Pull Request: https://projects.blender.org/blender/blender/pulls/142208
2025-07-17 14:22:16 +02:00
Philipp Oeser
8f605baa2e Fix #142062: Armature EditBone RNA paths incomplete
`PoseBone` and `Bone` already have their `struct_path_func` defined, but
that was missing from `EditBone`.
Since `EditBone` is usually what is visible from the UI (and only later
gets flushed to `Bone` via `ED_armature_from_edit`), it makes sense to
have complete RNA paths for `EditBone` as well.

Enables the usual context menu `Copy Data Path`, `Copy As New Driver`,
... automatically.

Pull Request: https://projects.blender.org/blender/blender/pulls/142065
2025-07-17 14:02:22 +02:00
Jacques Lucke
f2ee95843c Nodes: improve socket tooltips
The main goal of the patch is to make the socket tooltips more useful. This is
achieved in two ways:
* Use better text formatting in the tooltip to make it easier to parse and to
  better separate the current actual value from more general information about
  the socket.
* Add some more information like implicit field inputs when the node is not used
  currently or more details about a color.

This patch basically rewrites the entire tooltip generation, because it's quite
different from before (where we just created a single string for the entire
tooltip).

I'm using monospace for the actual current socket value and type, while the
normal font is used for general information about the socket like it's name,
description, allowed geometry types etc.

Pull Request: https://projects.blender.org/blender/blender/pulls/140540
2025-07-17 12:48:17 +02:00
Lukas Tönne
7495d5222b Fix: Grease Pencil interpolation on cyclic curves shifts end point
Fix for unreported issue with Grease Pencil interpolation tool: on cyclic curves
the last point is interpolated between the end points of the curve, especially
noticeable with sequence interpolation.

This required handling a corner case in the curve sample mapping function.
This function is complex and hard to verify with the operator alone, leading to
frequent issues and discovery of yet more corner cases. For this reason i
refactored the sampling function and added new unit tests.
This should help avoid regressions and make it clear how the function is
expected to behave in various corner cases.

The `sample_curve_padded` function has been moved into the geometry module,
since the `sculpt_paint` module does not have tests yet and is intended mostly
for higher-level operator code. The function has been split to separate out the
"reverse" sampling mode, which reduces complexity. Reverse sampling is done by
first reversing the input curve points, doing regular sampling, and then
reversing the resulting samples.

The function can now sample to larger or smaller sample arrays:
- Larger output arrays have a point aligned with each source point as before,
  with the rest of the points evenly distributed over the source curve.
  This ensures that the output curve matches the source as closely as possible,
  especially for poly curves.
- Smaller output arrays are uniformly sampled along the length of the source
  curve.

Pull Request: https://projects.blender.org/blender/blender/pulls/141946
2025-07-17 12:05:23 +02:00
Christoph Lendenfeld
e80ceb52df Fix #139509: Slot assignment is lost when loading file saved in tweak mode
The issue was that the `AnimData.tmp_slot_handle` had no RNA property associated with it
and so it couldn't be saved in the lib override.

The fix is to add the property. To ensure the correct code is called, most of the previous code
was replaced with a call to `blender::animrig::assign_tmpaction`

Pull Request: https://projects.blender.org/blender/blender/pulls/141395
2025-07-17 11:35:18 +02:00
Sebastian Parborg
c19218e423 Fix #141943: Correctly detect manifold libs when not in strict mode 2025-07-17 11:33:43 +02:00
Falk David
1a46806546 Fix: Grease Pencil: Missing call to finish() writing layer attributes
The `GSpanAttributeWriter` was missing a call to `finish()` to ensure
the changes are tagged and saved.
2025-07-17 11:31:10 +02:00
Christoph Lendenfeld
0191848671 Fix #141909: Creating a pose assets captures unkeyed custom properties
This was an oversight caused by 358a0479e8

Before this, only keyed custom properties were capture into the pose asset.
This behavior is now restored.

Pull Request: https://projects.blender.org/blender/blender/pulls/141937
2025-07-17 11:05:31 +02:00
Lukas Tönne
23d02ec57b Fix armature deform: Avoid accessing parameter data after moving 2025-07-17 09:42:39 +02:00
Jacques Lucke
55e2fd2929 Cleanup: unify naming for named constructors
Previously, we used an inconsistent naming scheme for such "named constructors".
Now it always uses `from_*`.

Pull Request: https://projects.blender.org/blender/blender/pulls/142175
2025-07-17 09:09:16 +02:00
Jacques Lucke
cbb76f21a1 Geometry Nodes: forbid some special characters in bundle item names
The goal is to be able to form bundle value paths like `Group/Sub/Geometry` in
the future. Additionally we might want to be able to use these paths in some
kind of expression for selecting a set of bundle paths. This requires us to
constrain what characters are allowed to be used in bundle paths. This patch
forbids using various special characters. Since we don't know exactly which
characters we'll need exactly in the future, I added more characters to the
forbidden-list than likely necessary. It's easier to make them available later
on than to try to forbid them later.

The forbidden chars are the following currently:
`/*&|"^~!,{}()+$#@[];:?<>.-%\=`.
Those are automatically replaced by an underscore if used.

Pull Request: https://projects.blender.org/blender/blender/pulls/142168
2025-07-17 08:00:15 +02:00
Campbell Barton
eee549f882 Docs: add readme for extensions
This intends to give an overview of the extensions implementation.

Co-authored-by: Sybren A. Stüvel <sybren@blender.org>

Ref !134785
2025-07-17 03:20:16 +00:00
Campbell Barton
989af38c93 Docs: add some code-comments regarding the default exclusions 2025-07-17 13:11:43 +10:00
Nika Kutsniashvili
169dbdd60f Extensions: exclude backup blend files when building an extension
Ref !142091
2025-07-17 13:11:29 +10:00
Campbell Barton
e8e188cb7d Cleanup: various non-functional changes for C++ 2025-07-17 12:32:30 +10:00
Campbell Barton
fc07a4d45e Cleanup: quiet ignored qualifier & unused warnings 2025-07-17 12:30:39 +10:00
Campbell Barton
c034c928fe Cleanup: correct spelling, typos & remove outdated comment 2025-07-17 12:30:37 +10:00
Campbell Barton
4d227dd593 GHOST: show assertion failures even when WITH_ASERT_ABORT=OFF
This makes GHOST_ASSERT behave like BLI_assert, where any non release
build shows an error even when assert doesn't abort.
2025-07-17 11:43:43 +10:00
Mattias Fredriksson
219d327b80 Fix: Memleak importing NURBS through OBJ node importer
Fixes a memleak and a double initiation introduced in #123967. Patch missed to
free the temp  Curve object and called `curve_init_data` from `BKE_curve_init`
which is already called in `BKE_id_new_nomain` from IDTypeInfo::init_data.

Pull Request: https://projects.blender.org/blender/blender/pulls/141924
2025-07-17 02:26:17 +02:00
Hans Goudey
b19696c0b8 Mesh: Simplify tangents calculation
- Tangent calculation functions no longer use the CustomData struct as
  an input and output.
- The "orco" and UV map calculations are exposed as separate API
  functions to avoid a confusing internal choice between the two
- Redundancy in the API is removed, function names are clarified
- Code is moved to C++ namespace
- The "orco" case is clarified in the mesh draw tangent VBO extraction
- CD_TANGENT layers are not stored in CustomData anymore, so some of
  that infrastructure is removed.
- Broken logic for caching tangents in CustomData is removed. That
  hasn't worked for many years, if it every worked. We could investigate
  adding caching again later if that's helpful.

Overall the change is motivated by the need to move away from CustomData
for #122398. But the changes should be a general improvement that makes
the code easier to understand either way.

Testing for this PR included using the default render UV in materials,
referencing specific UV tangents by name, using the spherical position-
based tangents in a material, and baking textures (multires and normal
baking).

Pull Request: https://projects.blender.org/blender/blender/pulls/141799
2025-07-17 02:24:09 +02:00
Hans Goudey
e3c5070dfe Cleanup: Remove unused data transfer code
Shape key interpolation was never implemented. Nowadays it's
probably better to implement similar features in different ways
rather than extending this system. Also some layer mapping
generation was unused. The motivation for this is easing some
cleanups to make this modifier less directly reliant on CustomData.

Pull Request: https://projects.blender.org/blender/blender/pulls/142131
2025-07-16 22:53:21 +02:00
Hans Goudey
d669f28e05 Fix: Overlapping data transfer enum values
This code is really weird, I'm not sure if this caused user-visible
errors but these values shouldn't overlap.

Pull Request: https://projects.blender.org/blender/blender/pulls/142130
2025-07-16 22:53:11 +02:00
Hans Goudey
65131f22f8 Cleanup: Use Span arguments for some mesh remapping functions
Pull Request: https://projects.blender.org/blender/blender/pulls/142123
2025-07-16 21:59:25 +02:00
Ray Molenkamp
d56ff67896 Win: Add some context to access violations
The Windows exception record is well documented [1] but it's not
the easiest information to remember. Every time i see a crash log
i still have to manually pull up the docs to check if the first
argument being 0 means read or write.

This PR adds this trivial information to our crash log, so I don't
have to look it up any more.

[1] https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-exception_record

Pull Request: https://projects.blender.org/blender/blender/pulls/142109
2025-07-16 20:57:37 +02:00
Hans Goudey
63a3499674 Cleanup: Use StringRef, std::string for node panel toggles
Just a slight simplification of this code to make a null
check unnecessary and avoid using char arrays.

Pull Request: https://projects.blender.org/blender/blender/pulls/141939
2025-07-16 20:22:55 +02:00
Brecht Van Lommel
9cbc44d6fd Fix #142060: Cycles simple adaptive subdivision UVs wrong for non-quads
Also fixes #141983.

Pull Request: https://projects.blender.org/blender/blender/pulls/142111
2025-07-16 19:18:52 +02:00
Bastien Montagne
899df7e3f0 Fix compilation after recent changes: missing include. 2025-07-16 18:53:10 +02:00
Hans Goudey
b20ecee555 Mesh: Move freestyle tags to generic attributes
This commit moves the freestyle edge and face mark tags to become
generic attributes, similar to other changes over the past years. The
attributes are called "freestyle_edge" and "freestyle_face", and they're
now propagated like regular boolean attributes.

Compatibility wise, forward and backward blend file compatibility are
maintained (for forward compatibility this is implemented a bit
differently than in the past because of the ongoing `AttributeStorage`
transition). In the Python API, `use_freestyle_mark` has been removed;
the attribute API should be used instead (just like bevel weights).
The BMesh (`freestyle`) accessors are removed too.

The conversions benefit from the fact that bit-wise, the old structs are
the same as `bool`, so we can convert to the old and new formats without
reallocating arrays.

Pull Request: https://projects.blender.org/blender/blender/pulls/141996
2025-07-16 18:26:26 +02:00
Jacques Lucke
feb4122f62 Geometry Nodes: add descriptions to various built-in geometry sockets
In some cases the description is more useful than in others. But overall it's
nice if users can expect there to be some description instead of nothing.

The goal is also to not show the supported geometry types as a separate line
in the tooltip as that can be misleading sometimes and is often redundant
with the socket name and description already. Now the description is expected
to contain the relevant data for the user. It can also be more detailed than
just mentioning which geometry types are supported.
2025-07-16 18:19:11 +02:00
Julian Eisel
c2497d16e3 Cleanup: Remove redundant parameter in new UI layout function
Mistake in 2658754324.

This was changed from a free standing to a member function during review. But
forgot to update the parameters accordingly. This can be confusing since you
can call the function on one layout, but pass it another one that it will
actually operate on.
2025-07-16 17:10:11 +02:00
Alaska
736559f320 Fix #139718: Always treat OSL cameras as inside a volume
Cycles automatically tries to decide if the camera ray should be a
surface or a volume + surface camera ray by checking to see if the
scene contains a volumetric material, and if it does, is it near
where the camera rays are expected to spawn. This step is done
during scene intialization.

With the OSL camera, it is impratical to predict where the
camera rays will spawn during scene intialization, which makes it
impratical to predict if the OSL camera ray will spawn near a
volumetric object. So this commit marks all OSL cameras as
"inside a volume", leading to the spawning of volume + surface camera
rays for OSL cameras while the scene contains a volumetric material.

This leads to increased render times ranging between 1% - 5% in scenes
that use a OSL camera, has a volumetric object in it, and the
volumetric object is far away from the camera. Every other scene should
see no performance impact.

Testing was done on a AMD Ryzen 9 5950X and a NVIDIA GeForce RTX 4090.

Pull Request: https://projects.blender.org/blender/blender/pulls/142036
2025-07-16 16:25:38 +02:00
Sebastian Parborg
89f966df4d PointCache: Explicitly warn when loading older incompatible compression settings
This should make it more obvious to the end user that they need to delete and rebake older caches.

Pull Request: https://projects.blender.org/blender/blender/pulls/142059
2025-07-16 15:55:24 +02:00