Commit Graph

28773 Commits

Author SHA1 Message Date
Julian Eisel
4b2d60a2c3 Ghost: Make special user directory query thread safe
Similar to e0ff7731e0.

Noticed a data race when working on blender/blender!130543, which calls
this function from a thread. Make this thread safe by avoiding returning
of static memory, instead use an optional `std::string`.

Pull Request: https://projects.blender.org/blender/blender/pulls/141083
2025-06-27 15:16:35 +02:00
Nathan Vegdahl
56d8c11304 Core: Add more variables for path templates
This PR adds several more built-in variables for path templates:

- `scene_name`: name of the current scene.
- `camera_name`: name of the current camera.
- `node_name`: only for paths owned by a node; the name of the node.
- `blend_name_lib`: name of the blend file of the ID the path property
  is on, sans file extension.
- `blend_dir`: path up to (but not including) the currently open blend
  file.
- `blend_dir_lib`: path up to (but not including) the blend file of the
  ID the path property is on.

Additionally, adding support for `node_name` required re-thinking the
"path template type" system a bit:

Previously, the the `PropertyPathTemplateType` of a property completely
dictated what variables were made available to it. However, if we stuck
with that system then we would need to split
`PROP_VARIABLES_RENDER_OUTPUT` into two enum items: one for "normal"
render output paths like the one that lives on the `Scene`, and one for
"node" render output paths like the ones on the File Output node.

Instead of doing that, this PR makes `PropertyPathTemplateType` only
responsible for dictating the "purpose-specific" variables. In this
case, render-specific variables like fps, resolution, etc. Then the
availability of variables like `node_name` are instead based on what
owns the path (a node or not, in this case). There are also general
variables, like `blend_name`, that are now available to all path
templates.

(Part of #133001)

Pull Request: https://projects.blender.org/blender/blender/pulls/139438
2025-06-27 11:07:04 +02:00
Sean Kim
524e4879e5 Cleanup: Remove unused BKE_multires.hh methods
Pull Request: https://projects.blender.org/blender/blender/pulls/140951
2025-06-26 21:01:40 +02:00
Sean Kim
6531ba34f0 Cleanup: Use blender::Array instead of manually allocated int arrays
Pull Request: https://projects.blender.org/blender/blender/pulls/140949
2025-06-26 21:00:01 +02:00
Hans Goudey
f74e304b00 Attributes: Use AttributeStorage instead of CustomData for Instances
Part of #122398.

This commit moves the runtime instances type to use `AttributeStorage`.
Besides sharing some utility functions with point clouds, a resize
method is implemented.

Pull Request: https://projects.blender.org/blender/blender/pulls/140991
2025-06-26 17:03:56 +02:00
quackarooni
28bd5a7832 Fix #140933: "Group Socket Node" theme property left unset
The theme property for group socket nodes was set to `#000000` for
default themes, which looked out of place against the other node
header colors. This patch adds colors to both the Blender Dark & Light
themes that should resemble their counterparts before 2ea3cd2188.

Colors:
Blender Dark - `#1d1d1d`
Blender Light - `#3d3d3d`

Pull Request: https://projects.blender.org/blender/blender/pulls/141011
2025-06-26 15:05:37 +02:00
Sybren A. Stüvel
d17f5c09d5 Merge remote-tracking branch 'origin/blender-v4.5-release' 2025-06-26 10:49:57 +02:00
Pratik Borhade
7e17ec5562 Fix #140747: Ignore armature from custom shape list
When armature is selected for custom shape of a bone, we run into
stack overflow due to recursive calls. To prevent this situation,
exclude armature object type from the custom shape list.

This also clears the `pchan->custom` pointer after loading/linking a
blend file. Otherwise a linked Armature object can still be assigned
indirectly, by renaming objects in the library file.

Fixes: #140747
Fixes: #140959

Co-authored-by: Sybren A. Stüvel <sybren@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/140851
2025-06-26 10:48:06 +02:00
Campbell Barton
c71b314565 Cleanup: return a boolean from BPY_context_member_get, check it's result 2025-06-26 14:28:40 +10:00
Bastien Montagne
0b52dcb0e0 Fix (unreported) logical error in Array IDProp copy code.
`IDP_ARRAY` properties storing `IDP_GROUP` data would not duplicate
these on copying, leading to two different array properties sharing the
same groups data...

NOTE: Uunclear how bad this issue was actually, since Blender itself will
never create such arrays of group IDProps afaik. At least could not find
any.

We really need to cleanup this code and add actual cpp-level unittests.
2025-06-25 16:19:31 +02:00
Omar Emara
3b1d252431 Compositor: Support structure type
This patch adds support for the experimental structure types currently
used bu Geometry Nodes. Pixel nodes were declared as function nodes,
which gives dynamic structures for all their sockets. Other nodes now
explicitly declared their inputs as dynamic if not single value, while
the compositor_expects_single_value marker was removed in favor of the
StructureType::Single type.

Pull Request: https://projects.blender.org/blender/blender/pulls/140910
2025-06-25 11:54:48 +02:00
Habib Gahbiche
f2d95e758d Fix: Crash when opening files with animated compositor normal node
Saved files in 4.5 with a compositing node tree containing a Normal
Node with animated 'Dot' input crash in 5.0.

A test case with animated dot and normal inputs was added as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/140908
2025-06-25 11:04:29 +02:00
Richard Antalik
ee0f7ad521 Merge branch 'blender-v4.5-release' 2025-06-25 07:16:38 +02:00
Richard Antalik
62e25e315a Fix #140740: Blender fails to output video
Caused by change in `AVCodecID` enum. Our `IMB_Ffmpeg_Codec_ID` enum,
which was stored in .blend file did match `AVCodecID`. But after change
in external library headers it fails to initialize correct codec.

Function `MOV_av_codec_id_get()` was added to map these 2 enums and
the values are no longer hard coded.

Functions, that accepted `int codec_id` argument were modified to accept
`IMB_Ffmpeg_Codec_ID` or `AVCodecID` types.

Because `codec_id` was still stored as integer in DNA, get/set struct functions
were added. This way, compiler always knows what type is used and emit
error/warning when incompatible types are used.

Unfortunately, there is no way to ensure, that DNA `codec_id` field is not
accessed directly in future code other than comment.

Pull Request: https://projects.blender.org/blender/blender/pulls/140745
2025-06-25 07:15:13 +02:00
Hans Goudey
a12f7717a1 Refactor: Attributes: Add assign_data function
Prevent an extra copy that could happen when calling
data_for_write() to retrieve mutable access, only to just
replace the data.

Pull Request: https://projects.blender.org/blender/blender/pulls/140946
2025-06-25 05:08:20 +02:00
Hans Goudey
25e0957f8e Cleanup: Attributes: Resolve reference binding to null warning
The sharing info might be null if the array is null / empty.
2025-06-25 05:08:18 +02:00
Hans Goudey
eadb259aee Fix: Attributes: Data potentially lost in versioning
For files saved with the new format, the versioning can incorrectly
replace the AttributeStorage data with whatever is inside of CustomData,
even if that's nothing. So far this is only in one unlikely case for
point clouds, but these functions will soon be used for Grease Pencil
and curves.
2025-06-25 05:08:18 +02:00
Hans Goudey
4e7ee26cb3 Cleanup: Attributes: Implement get_builtin_default for PointCloud
This is currently only used for curves, but it may be used elsewhere
in the future, so it's best to make sure it's implemented consistently.
2025-06-25 05:08:18 +02:00
Hans Goudey
b915da45d8 Cleanup: Attributes: AttributeOwner utility to retrieve storage
This helps share the implementation of many functions between
geometry types (in the future, now only point clouds at runtime).
2025-06-25 05:08:18 +02:00
Hans Goudey
94c2a7e0b5 Cleanup: Attributes: Add AttributeOwner function for accessor
This is a better way to make the existing static function available
outside of `attribute.cc`.
2025-06-25 05:08:18 +02:00
Hans Goudey
4b4314483d Cleanup: Attributes: Properly use unitialized memory for copy
Add a "ForUninitialized" utility function and use copy construction
correctly. This doesn't make a difference yet because we only
have trivially constructible attribute types so far.
2025-06-25 05:08:18 +02:00
Sean Kim
27433106cd Cleanup: Use C++ types and functions for multires_reshape_apply_base
Also converts a manually managed temporary array with `blender::Array`

Pull Request: https://projects.blender.org/blender/blender/pulls/140784
2025-06-25 01:06:48 +02:00
Sean Kim
9d3c038a27 Cleanup: Use C++ math types and functions for displacement Evaluator
Pull Request: https://projects.blender.org/blender/blender/pulls/140789
2025-06-25 01:05:06 +02:00
Sean Kim
64e237d074 Cleanup: Use C++ math types and functions for multires_reshape_smooth.cc
This doesn't yet touch lines that use the `ReshapeGridElement` or
`ReshapeConstGridElement` structs, those require further cleanup
elsewhere before making such changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/140782
2025-06-24 23:56:10 +02:00
Sean Kim
1a7ebffeca Cleanup: Use C++ math types and functions for multires_reshape_util.cc
This commit does not change lines that access the `ReshapeGridElement` or
`ReshapeConstGridElement`, that cleanup will follow in a later commit.

Pull Request: https://projects.blender.org/blender/blender/pulls/140783
2025-06-24 23:50:55 +02:00
Habib Gahbiche
8e966cceaa Compositor: Support rotation for split node
The split is now defined by a line that can have an arbitrary angle.

This PR implements the node only, the gizmo is implemented in #140356

Pull Request: https://projects.blender.org/blender/blender/pulls/140208
2025-06-24 17:18:15 +02:00
Omar Emara
383c8860a2 Compositor: Remove Texture node
This patch removes the Texture node from the compositor, which was based
on the legacy Internal Textures system in Blender. The main motivation
for removing this node is as follows:

- Procedural texturing nodes that previously existed in shading and
  geometry nodes are now supported in the compositor, which cover 95% of
  what is previously possible using and even adds new possibilities like
  Gabor, Bricks, and various improvements to existing texture types.
- The old texture system did not support GPU evaluation, so it was
  always computed and cached on the CPU, which causes bad performance
  especially for interactive use in the viewport compositor. While the
  new nodes are fully GPU accelerated and do not require any caching.
- The Texture node didn't support Texture nodes, so it was not fully
  supported and we so far had a warning about that.
- The general direction in Blender is to remove the old texture system,
  and the compositor was one of the last main users of it. 5.0 is thus
  the ideal time to remove such use.
- The Texture node was always and still is a source of bugs, since it
  relies on proper tagging for cache invalidation and updates, which is
  so far not perfect. It also suffers from UI/UX issues, since it needs
  to be adjusted from the properties panel, which can break if there are
  other texture nodes in the context.

This is a breaking change and no versioning was attempted since:

1. It is impossible to get the same results as before due to the use of
different random number generators, so any versioning would just give us
the general look.
2. The Texture node supports a lot of possible configurations. For
instance, each general texture can have many options for the basis type,
and each basis type might have multiple options. So versioning all of
that will take a lot of time, code, and effort.

Pull Request: https://projects.blender.org/blender/blender/pulls/140545
2025-06-24 11:54:39 +02:00
Campbell Barton
a88ff71148 Merge branch 'blender-v4.5-release' 2025-06-24 17:58:50 +10:00
Campbell Barton
cda9ce9777 Fix #136396: Metaball Cube can't be selected with solid shading
The metaball selection radius was inside the cube and could only
be selected with wire-frame shading.

Resolve by expanding the radius by the dimensions of the cube.
2025-06-24 07:56:50 +00:00
Jacques Lucke
7b7c630018 Refactor: Nodes: use structure type inferencing for field links
The goal here is to reduce our reliance on the existing field inferencing code
and use the new and more general structure inferencing code instead.

This patch changes patch refactors link drawing so that whether links are drawn
dashed does not depend on field inferencing anymore. Same for the invalid field
links.

I don't expect that this changes the drawing of any existing links. It just
makes it easier to fully remove the old field inferencing in the future.

Pull Request: https://projects.blender.org/blender/blender/pulls/140869
2025-06-24 07:25:15 +02:00
Bastien Montagne
7276b2009a Core: Add new 'system IDprops' storage for runtime-generated RNA properties.
This commit cleanly splits IDProperties storage for its two very different
usages:
* "User-defined" data, also known as "custom properties". Mostly exposed
  in UI and as 'dictionary' in Python scripting, these are unique to each data
  (each object can have its own set of custom properties).
* "System-defined" data, mainly as backend-storage for runtime RNA
  structures and properties. While these are not necessarily present in the
  storage, they are registered for a data type, and therefore always available
  to all data of that type through RNA access.

See #123232 for rationales, designs and alternative investigated solutions.

## User-facing Changes

When using Blender, the only noticeable change is that python-defined RNA
data are not listed anymore in the Custom Properties panels (e.g. Cycles
data).

From a Python API perspective, the main changes are:
* Runtime RNA structs defined by sub-classing `PropertyGroup` and
  registering them are no more accessible through the 'dict' syntax.
  * They remain accessible through a dedicated 'bl_system_properties_get()`
    callback, but its usages are only expected to be for testing and
    debugging.
  * The result of this call will be `None` by default when there has been
    nothing written into it yet, unless its optional `do_create` parameter
    is set to `True`.
* Some types (like `Node`, `UIList`, etc.) cannot store raw IDProperties
  anymore (using the 'dict' syntax).

## Technical Details

* Adds System idprops to some data types (IDs, ViewLayer...).
* Moves some other containers (e.g operator properties, or some UI types like
  UILists) to only have system-defined properties.
* For a few specific types (like `PropertyGroup`), the same storage is used,
  but exposed in RNA as both user and system properties.
* Adds RNA API accessor callback to system idprops.
* Adds a function `bl_system_properties_get()`, which wraps system-defined
  idprops and gives 'dict-like' access to them. Currently mainly used by some
  unittests.
* System IDProps are always ignored by RNA diffing code (and therefore
  liboverride processing), as their value is already exposed through RNA
  properties, and should always be processed through these RNA properties.
* Modifies bpy rna binding to use these new system idprops for property
  accesses, and keeps using user-defined idprops for 'dict-type' accesses.
* Handles versioning by copying 'user idprops' (existing ones) into new
  'system idprops'.

### IDProperties Split

These types keep their historic IDProperty storage for user properties,
and get a new `system_id_properties` storage for system properties:

`ID`, `ViewLayers`, `Bone`, `EditBone`, `BoneCollection`, `PoseBone`, `Strip`

These types can both be extended with registrable RNA properties, and
expose Custom Properties in the UI.

### IDProperties become System Ones

These types keep a single IDProperties storage (their DNA struct does not
change), but it is now exclusively used for system-defined properties.

`OperatorProperty`, `View3DShading`, `UIList`, `AddonPreferences`,
`KeyConfigPreferences`, `GizmoProperties`, `GizmoGroupProperties`,
`Node`, `NodeSocket`, `NodeTreeInterfaceSocket`, `TimelineMarker`,
`AssetMetaData``

Since user properties were never available in the UI for them, they lose
their 'dict-like' IDProperties access in the Python API.

### Single Storage, Exposed as Both in API

These types still use a single IDProperty storage, but expose it both as
user properties and as system ones through RNA API.

* `PropertyGroup`: They need both access APIs since they are both
  used for raw IDProperty groups (the 'dict-like' access), and
  internally to access data of runtime-defined RNA structs.
* `IDPropertyWrapPtr`: Done mainly to follow `PropertyGroup`.
* `NodesModifier`: cannot become purely system idprops currently, as
  there is no other access than the 'raw ID properties' paths to their
  values. This can be changed once #132129 is finally implemented.

Pull Request: https://projects.blender.org/blender/blender/pulls/135807
2025-06-23 18:25:24 +02:00
Omar Emara
c2356b6f27 Fix: Math node from old file is undefined
Maths nodes in files saved in late v4.5 will load as undefined in 5.0.
That's because versioning ran for versions before 4.5, not after. To fix
this, we move versioning to 5.0 to cover such cases.

Pull Request: https://projects.blender.org/blender/blender/pulls/140868
2025-06-23 18:22:26 +02:00
Lukas Tönne
8dd3bc48cb Animation: New test for armature deformation
This tests code in `armature_deform.cc` under various combinations
of input options.

- Interpolation:
    - [x] Linear
    - [x] Dual-Quaternion (aka. "Preserve Volume", `ARM_DEF_QUATERNION`)
- Bone weighting:
    - [x] disabled (no `ARM_DEF_*` flags)
    - [x] envelopes (`ARM_DEF_ENVELOPE`)
    - [x] vertex groups (`ARM_DEF_VGROUP`)
    - [x] envelopes + vertex groups
    - [x] single vertex group (`defgrp_name` parameter)
- Outputs:
    - [x] Position-only
    - [x] "Full" (deform matrix, for crazyspace)
- Target object types:
    - [x] mesh
    - [x] edit-mesh (bmesh)
    - [x] curves
    - [x] unsupported ID type (should pass through)
- [ ] Inverted vertex group (`ARM_DEF_INVERT_VGROUP`)
- [ ] Multi-modifier feature

Pull Request: https://projects.blender.org/blender/blender/pulls/140541
2025-06-23 18:11:33 +02:00
Jacques Lucke
a33881286a Cleanup: extract function determining whether socket is always single 2025-06-23 18:11:06 +02:00
Julian Eisel
1045a1b910 Cleanup: Simplify context asset query logic 2025-06-23 13:51:45 +02:00
Jacques Lucke
ea618c2027 Refactor: Nodes: improve socket value variant construction
Previously, there was the issue that `SocketValueVariant` had a constructor that
took a forwarding reference as parameter. This was problematic, because this
could potentially hide copy/move constructors which is not intentional. This
patch makes sure that these special constructors are not overridden and adds two
static utility functions to make sure it's still straight forward to construct
the `SocketValueVariant` on a single line.

Clangd also warned about this case.

Pull Request: https://projects.blender.org/blender/blender/pulls/140842
2025-06-23 10:08:43 +02:00
Campbell Barton
776dbe942c Cleanup: spelling (make check_spelling_*) 2025-06-22 11:34:32 +00:00
Campbell Barton
5e1a048294 Cleanup: resolve undeclared function warning 2025-06-22 21:26:36 +10:00
Aaron Carlisle
98d11bf445 Cleanup: Use "Custom Normals" in code comments
Follows up on f0675f05a7 and corrects the terminology in some code comments.
2025-06-21 19:42:04 -04:00
Sean Kim
17f5c826bb Fix: Incorrect UnifiedPaintSettings compatibility writing
Mistake in 582c7d94b8.

The `ToolSetting` struct needs to be written after changing the
in-memory value.

Pull Request: https://projects.blender.org/blender/blender/pulls/140775
2025-06-22 00:03:16 +02:00
Sean Kim
3d507c4afe Merge branch 'blender-v4.5-release' 2025-06-21 15:02:38 -07:00
Sean Kim
99d4e7e330 Fix: Incorrect file version for brush forward compatibility code
Mistake in 6a03e8249d

Pull Request: https://projects.blender.org/blender/blender/pulls/140777
2025-06-22 00:02:03 +02:00
Sean Kim
a59ee6b2d0 Cleanup: Replace init/free functions for MultiresReshapeSmoothContext
Pull Request: https://projects.blender.org/blender/blender/pulls/140513
2025-06-21 02:42:36 +02:00
Sean Kim
ae8b2a827d Cleanup: Use Span<float3> instead of pointers for multires_reshape.cc
* Converts the old `vertcos` to a `Span<float3>`
* Reduces visibility of helper function.

Pull Request: https://projects.blender.org/blender/blender/pulls/140512
2025-06-21 02:40:56 +02:00
Sean Kim
4434a30d40 Paint: Make UnifiedPaintSettings a per-mode instead of scene-wide value
Historically, the `UnifiedPaintSettings` struct has been used to
provide users the ability to set brush values at a scene level. Examples
of such attributes are the brush size, strength, and color, to name a
few.

Instead of these values being shared across all of the grease pencil,
mesh painting, and curves sculpting modes. This commit migrates the
data to the `Paint` struct, meaning that each individual mode (e.g.
Sculpt, Vertex Paint, Grease Pencil Draw) now has the ability to change
these values without affecting other modes.

While this change is large, the majority of the work is simply
refactoring access to the `UnifiedPaintSetting` struct. to ensure the
correct property is being retrieved.

Resolves #134077

Pull Request: https://projects.blender.org/blender/blender/pulls/139766
2025-06-21 02:35:14 +02:00
Pablo Vazquez
695a03d9f4 UI: Theme: Add text color settings to panels
Recently, panel styling was moved to a global setting instead of being
per-editor. However, the panel's title and labels inside still rely on
the per-editor region's text and title settings.

Move panel title and text colors to the global "Panel" settings.

See PR for details and screenshots.

Part of #135192

Pull Request: https://projects.blender.org/blender/blender/pulls/140726
2025-06-20 21:03:08 +02:00
Pablo Vazquez
dbba0baa03 Fix: Theme: Properties editor missing region style
The Properties editor does not have a sidebar, but it has a navigation bar.
Missed this in fe0fe0a5ed

Pull Request: https://projects.blender.org/blender/blender/pulls/140728
2025-06-20 18:58:00 +02:00
Hans Goudey
417f8dee40 Merge branch 'blender-v4.5-release' 2025-06-20 11:46:56 -04:00
Hans Goudey
19ef847647 Fix #140689: Paint mode crash with empty Grease Pencil layer
In this case an empty CurvesGeometry didn't contain the position
attribute. Skipping the lookup in that case should be harmless.
2025-06-20 11:40:42 -04:00
Hans Goudey
5d184bd1d6 Fix: Potential memory leak reading AttributeStorage
For unsupported domains, storage types, or other issues with
reading the attribute data, the attribute name and data struct
could be leaked.
2025-06-20 11:40:42 -04:00