Commit Graph

26669 Commits

Author SHA1 Message Date
Philipp Oeser
e2c3bfde4f Fix #146535: 3d Text selection is broken
Typo in 6d92bf00a6

Pull Request: https://projects.blender.org/blender/blender/pulls/146561
2025-09-22 11:50:19 +02:00
Hans Goudey
ef08810493 Cleanup: Remove unused data transfer argument
Pull Request: https://projects.blender.org/blender/blender/pulls/146544
2025-09-21 22:13:13 +02:00
Hans Goudey
113d91aba8 Mesh: Restructure join operator for simplicity, speed, consistency
Previously the joining code put the final data into temporary mesh
data, which meant more complexity because it couldn't use the slightly
higher level APIs more commonly used for transferring data.

The process can be simplified by just merging into the active mesh
directly (though some care must be taken when that is used by
multiple selected objects).

This process avoids iterating over attribute data twice, by processing
values at the same time as copying them. Also some of the inner hot
loops are parallelized. There is more opportunity for trivial multi-
threading in the future.

Mismatched attribute types and domains will now choose the higher
complexity type and domain, which should help avoid information loss.

There was a bug with the existing face set processing which would
modify the source meshes. That is now fixed.
2025-09-21 19:11:19 +02:00
Campbell Barton
4a6268e092 Cleanup: various non functional changes for C++ 2025-09-20 16:28:02 +10:00
Nick Alberelli
439fe8a1a0 PyAPI: support logging for Context.temp_override
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
2025-09-19 06:48:07 +00:00
Campbell Barton
c2766d2058 Cleanup: use a typed enum for context data type
Ensure all types are handled in switch statements (see !144810).
2025-09-19 08:21:30 +10:00
Brecht Van Lommel
6bef804d17 Fix: Save as Render does not work for some OCIO configs
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
2025-09-18 19:39:29 +02:00
Campbell Barton
2e85163d10 Cleanup: use std::trunc(..) 2025-09-16 16:44:14 +10:00
Jesse Yurkovich
d26a79b144 Core: Reduce cost of DupliObject random_id generation
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
2025-09-16 02:15:43 +02:00
Omar Emara
e9638b4a0a Compositor: Turn Double Edge Mask node menus into inputs
This patch turns the double edge mask node menus into two boolean
inputs.

Pull Request: https://projects.blender.org/blender/blender/pulls/146304
2025-09-15 13:45:34 +02:00
Omar Emara
3b1faf7594 Compositor: Turn menu options to sockets for pixel nodes
This patch turns node Menu options into menu inputs for Pixel nodes.

Pull Request: https://projects.blender.org/blender/blender/pulls/145596
2025-09-15 12:47:06 +02:00
Bastien Montagne
678be7a703 Fix #146077: Pointers to Duplicated Scenes in Duplicated IDs are not updated.
The new duplicate copy of the scene itself was not properly set-up to
allow the usages of its source to be remapped to the new copy.

Pull Request: https://projects.blender.org/blender/blender/pulls/146177
2025-09-15 10:30:38 +02:00
Habib Gahbiche
1b4daf9d2e Nodes: remove "Use Nodes" in Shader Editor for Object Materials
"Use Nodes" was removed in the compositor to simplify the compositing
workflow. This introduced a slight inconsistency with the Shader Node
Editor.

This PR removes "Use Nodes" for object materials.

For Line Style, no changes are planned (not sure how to preserve
compatibility yet).
This simplifies the state of objects; either they have a material or
they don't.

Backward compatibility:
- If Use Nodes is turned Off, new nodes are added to the node tree to
simulate the same material:
- DNA: Only `use_nodes` is marked deprecated
- Python API:
  - `material.use_nodes` is marked deprecated and will be removed in
6.0. Reading it always returns `True` and setting it has no effect.
  - `material.diffuse_color`, `material.specular` etc.. Are not used by
EEVEE anymore but are kept because they are used by Workbench.

Forward compatibility:
Always enable 'Use Nodes' when writing blend files.

Known Issues:
Some UI tests are failing on macOS

Pull Request: https://projects.blender.org/blender/blender/pulls/141278
2025-09-14 17:53:54 +02:00
Campbell Barton
62d791c8d6 Cleanup: only use "r_" prefix for return arguments 2025-09-14 23:03:01 +10:00
Campbell Barton
d1b76b6554 Cleanup: only use "r_" prefix for return arguments
Ref !146253
2025-09-14 11:08:50 +00:00
Sean Kim
1104c69a0e Fix #146153: Sculpt tools do not work after duplicating scene
Introduced with 7f3aa617ce

The `PaintMode` is needed when activating the default tool. There were
two things that caused this field on the `PaintRuntime` to be in an
invalid state on duplication:

* The original values for `PaintRuntime` were not copied to the new
  instance.
* When copying `ToolSettings`, the incorrect old value of `Paint` was
  passed to `BKE_paint_copy`, leading to the inability to copy the right
  data.

Pull Request: https://projects.blender.org/blender/blender/pulls/146199
2025-09-14 09:37:48 +02:00
Campbell Barton
e6c0a204f6 Cleanup: use of doxygen params in doc-strings 2025-09-14 15:15:33 +10:00
Jacques Lucke
ad27211b77 Refactor: Geometry Nodes: use faster IDProperty group lookup instead of custom VectorSet
Geometry Nodes used a `PropertiesVectorSet` in some places to allow
constant-time `IDProperty` access by name in a group. This used to be a
bottleneck in node groups with hundreds of inputs. Now this separate hash table
is not necessary anymore, because it's `IDProperty` groups now support this
directly since 6cb2226f13.

This also adds a `IDP_GetPropertyFromGroup_null` utility function to be able to
do this refactor more safely. Null pointers were allowed before.

Pull Request: https://projects.blender.org/blender/blender/pulls/146152
2025-09-12 15:43:14 +02:00
Campbell Barton
1e2ed785f7 Cleanup: use assume attribute to quiet array bounds warning for GCC 15
Ref !146150
2025-09-12 22:03:35 +10:00
Bastien Montagne
8d985f38de Fix broken build.
Broken by 6cb2226f13, due to very recent refactor in 84511b8509...
2025-09-12 12:05:21 +02:00
Jacques Lucke
6cb2226f13 Refactor: IDProperty: accelerate looking up properties by name
Currently, `IDP_GetPropertyFromGroup` is a common bottleneck because it has to
iterate over all properties to find the one with the right name.

This patch adds a hash table to id property groups that finding properties by
name in O(1) instead of O(n). The main tricky aspect is to find all the places
where this needs to be created/updated/freed. I tried to find all places but if
I missed some place, it should be easy to fix.

Pull Request: https://projects.blender.org/blender/blender/pulls/140907
2025-09-12 11:34:38 +02:00
Campbell Barton
84511b8509 Core: add type checks to ID property accessors
Since moving the C++ ID property access macros cast "const" away,
replace with get/set accessors and add asserts that correct types
are used.
2025-09-12 06:29:42 +00:00
Campbell Barton
975f42b7b2 Cleanup: use doxygen comments to end groups 2025-09-12 10:19:56 +10:00
Sean Kim
a426e70bf6 Fix: Use new USER_DEVELOPER_TOOL_TEST macro where appropriate
Missed in fb91e576ca

Changes all of the non-sanitized, always available options to use the
new macro to match previous behavior.

Pull Request: https://projects.blender.org/blender/blender/pulls/146118
2025-09-12 01:42:52 +02:00
Sean Kim
0b19cb35b6 Cleanup: Various organizational changes for brush.cc
* Reformats comment, moves it near related code
* Adds doxygen section
* Reorganizes function order

Pull Request: https://projects.blender.org/blender/blender/pulls/146050
2025-09-11 05:01:37 +02:00
Sean Kim
e9295fad65 Sculpt: Avoid setting vertex normal to the zero vector
It is possible for the simple vertex normal calculated during Paint
BVH normal updates to have a length of 0 if the connected faces cancel
each other out. This is a generally unlikely scenario, but will almost
always lead to further corruption of the mesh with the new normal.

If we detect this case, set the vertex normal to (0, 0, 1)

Pull Request: https://projects.blender.org/blender/blender/pulls/146004
2025-09-11 01:20:10 +02:00
Hans Goudey
5afaa1c4bd Nodes: Move value to Combine XYZ from link-drag-search
Same as was implemented for some other cases in commits like
1a4c16a784

Pull Request: https://projects.blender.org/blender/blender/pulls/146033
2025-09-10 16:59:29 +02:00
Brecht Van Lommel
6d25aad41f Cycles: Remove Alembic procedural
This was added for a fairly specialezed use case and is no longer being used
as far as we know. A future replacement would be to add a USD/Hydra procedural,
for which most of the groundwork already exists.

Pull Request: https://projects.blender.org/blender/blender/pulls/146021
2025-09-10 16:39:01 +02:00
Jacques Lucke
0484738f8b Fix: Geometry Nodes: false warning when passing gizmo data through instance-only nodes
There was a `Realized data in input geometry is ignored` warning when passing
gizmo data through instance-only nodes. This was because the node thought that
this data is "realized data" (like a mesh, curves, etc). This patch removes the
warning by making the check for realized data more precise.

Pull Request: https://projects.blender.org/blender/blender/pulls/146014
2025-09-10 11:29:43 +02:00
Jacques Lucke
32c301e3cf Shader Nodes: support repeat zones, closures and bundles
This adds a function that can turn an existing `bNodeTree` into an inlined one.
The new node tree has all node groups, repeat zones, closures and bundles
inlined. So it's just a flat tree that ideally can be consumed easily by render
engines. As part of the process, it also does constant folding.

The goal is to support more advanced features from geometry nodes (repeat zones,
etc.) in shader nodes which the evaluator is more limited because it has to be
able to run on the GPU. Creating an inlined `bNodeTree` is likely the most
direct way to get but may also be limiting in the future. Since this is a fairly
local change, it's likely still worth it to support these features in all render
engines without having to make their evaluators significantly more complex.

Some limitations apply here that do not apply in Geometry Nodes. For example,
the iterations count in a repeat zone has to be a constant after constant
folding.

There is also a `Test Inlining Shader Nodes` operator that creates the inlined
tree and creates a group node for it. This is just for testing purposes.

#145811 will make this functionality available to the Python API as well so that
external renderers can use it too.
2025-09-09 16:15:43 +02:00
Sybren A. Stüvel
78032d57e7 Fix #145753: Crash deleting a keyframe for another slot when tweaking
When deleting the last key of an F-Curve, the F-Curve itself also gets
deleted. This is now done via the same code as deleting F-Curves from
the channel list.

Before this fix, a deletion function was used that's not capable of
deleting from Actions in NLA strips, which is why it crashed.

Pull Request: https://projects.blender.org/blender/blender/pulls/145929
2025-09-09 10:14:46 +02:00
Jacques Lucke
6066a0f83c Mesh: Optimize sparse face to vertex attribute interpolation
This was found to be a bottleneck in #136477. Before this conversion would
always convert the entire attribute. However, the caller only required a single
index. Now the attribute is interpolated lazily when specific indices are
requested later.

Pull Request: https://projects.blender.org/blender/blender/pulls/145934
2025-09-09 07:58:44 +02:00
Sybren A. Stüvel
6bf8685628 Anim: drop versioning code for pre-2.50 animation
Drop all support for animation data from Blender versions 2.49 and
older.

- The `IPO` DNA struct is deleted, as is the `IDType_ID_IP` type
  definition.
- Versioning code has been removed in its entirety.
- Loading a pre-2.50 blend file will issue a warning, stating that any
  animation data that was there is now lost, and that the file should
  be loaded & re-saved with Blender 4.5 to properly port the data.

Note that versioning of Action assignments (as in, picking a slot)
still uses the tagging + updating all tagged assignments as a
post-processing step. This is necessary because picking the right slot
is only possible after all Actions (also those from libraries) have
been versioned. We might be able to address this as well, by upgrading
legacy → slotted Actions "on the fly" versioning these Action
assignments. If we do that, I think that would be better in a separate
PR though, as it could introduce issues by itself.

Ref: #134219
Pull Request: https://projects.blender.org/blender/blender/pulls/145188
2025-09-08 14:09:21 +02:00
Brecht Van Lommel
10027d9a6d Color Management: Use working space from custom OCIO config in startup blend
When using the default Blender config use what was saved in the startup blend.
But when using a custom config it's likely the scene linear space from that config
is wanted. And not using it can lead to some confusing situations, where you end
up with an ACES config and the Linear Rec.709 working space.

Pull Request: https://projects.blender.org/blender/blender/pulls/145884
2025-09-07 21:32:17 +02:00
Sean Kim
9cae162597 Cleanup: Rename various multires functions
* `multires_reshape_evaluate_limit_at_grid` to
  `multires_reshape_evaluate_base_mesh_limit_at_grid`

Pull Request: https://projects.blender.org/blender/blender/pulls/145457
2025-09-06 23:55:16 +02:00
Campbell Barton
c17f676966 Fix: 3D text line end misses last character
Regression in [0] caused line-end not to select the last character.

[0]: 98fd1a942c
2025-09-06 21:11:13 +10:00
Jesse Yurkovich
3e3ee35e9d Fix #145711: Packed images may fail to export with USD
Certain packed images, like those loaded directly into memory with
`BKE_image_packfiles_from_mem`, would cause USD to process the images as
"in memory" rather than as "packed" because the API was not removing the
IMG_GEN_TILE flag.

Additionally, be sure to use the packed filepath whenever possible
rather than the name given to the Image datablock as this ensures the
correct file names are used inside the USD file and for the resulting
file on disk after export.

This also fixes 2 render tests which now match when compared to the
native renders.

Pull Request: https://projects.blender.org/blender/blender/pulls/145749
2025-09-05 19:41:20 +02:00
Brecht Van Lommel
6a083a5464 Color Management: Add working color space for blend files
* Store scene linear to XYZ conversion matrix in each blend file, along
  with the colorspace name. The matrix is the source of truth. The name
  is currently only used for error logging about unknown color spaces.
* Add Working Space option in color management panel, to change the
  working space for the entire blend file. Changing this will pop up
  a dialog, with a default enabled option to convert all colors in
  the blend file to the new working space. Note this is necessarily only
  an approximation.
* Link and append automatically converts to the color space of the main
  open blend file.
* There is builtin support for Rec.709, Rec.2020 and ACEScg working spaces,
  in addition to the working space of custom OpenColorIO configs.
* Undo of working space for linked datablocks isn't quite correct when going
  to a smaller gamut working space. This can be fixed by reloading the file
  so the linked datablocks are reloaded.

Compatibility with blend files saved with a custom OpenColorIO config
is tricky, as we can not detect this.

* We assume that if the blend file has no information about the scene
  linear color space, it is the default one from the active OCIO config.
  And the same for any blend files linked or appended. This is effectively
  the same behavior as before.
* Now that there is a warning when color spaces are missing, it is more
  likely that a user will notice something is wrong and only save the
  blend file with the correct config active.
* As no automatic working space conversion happens on file load, there is
  an opportunity to correct things by changing the working space with
  "Convert Colors" disabled. This can also be scripted for all blend files
  in a project.

Ref #144911

Pull Request: https://projects.blender.org/blender/blender/pulls/145476
2025-09-05 19:04:47 +02:00
Brecht Van Lommel
a4e9e4869d Refactor: Add foreach_working_space_color to ID type
Left for future work:
* Freestyle modifiers, dynamic paint, legacy texture mapping
* Editor colors: should be changed to sRGB?
* Studio light preferences: also sRGB, though less clear

Pull Request: https://projects.blender.org/blender/blender/pulls/145476
2025-09-05 19:03:32 +02:00
Hans Goudey
d939de98a9 Cleanup: Formatting 2025-09-05 11:10:28 -04:00
luz paz
0760b2d5aa Fix typos in source/blender/blenkernel
Fixes various user-facing and non-user-facing typos.

Pull Request: https://projects.blender.org/blender/blender/pulls/145767
2025-09-05 16:25:32 +02:00
Brecht Van Lommel
ffa4f8c7ad Refactor: Split off lighter BLI_color_types.hh from BLI_color.hh
Functions for convert between the color types and ostream support are
now outside the classes.

Many files were changed to fix cases where direct includes for headers
were missing.

Pull Request: https://projects.blender.org/blender/blender/pulls/145756
2025-09-05 11:11:32 +02:00
Brecht Van Lommel
9d2058eb1e Color Management: Warn when OpenColorIO config for blend file is likely missing
If any display, view or colorspace is not found, these would be changed to an
existing one and show warnings in the console. Now also warn about this in the
user interface using the same mechanism as loading new blend files in older Blender
versions, with a warning in the status bar and on file save.

Ref #145476

Pull Request: https://projects.blender.org/blender/blender/pulls/145756
2025-09-05 11:11:32 +02:00
Brecht Van Lommel
76a446deba Fix: Wrong color space for gizmo, fluid grid line and stamp colors
Mark these as sRGB, as they already were or should be interpreted this way.

Pull Request: https://projects.blender.org/blender/blender/pulls/145755
2025-09-05 11:11:32 +02:00
Mattias Fredriksson
ccd8926717 Curves: Simplify calculation of NURBS basis functions
Replaces current basis function calculation which seems to be a direct
implementation of the recursive NURBS formulation. New implementation
avoids the need to check for zero divisions during iteration. Out of
bounds checks are also converted to asserts, assuming input provides
valid span index.

Performance wise this nets a 7+% performance improvement with the
average result being as fast or faster then the fastest execution
from previous implementation!

Pull Request: https://projects.blender.org/blender/blender/pulls/144457
2025-09-04 21:49:58 +02:00
Campbell Barton
7250eef0a3 Cleanup: pass const context to CTX_py_init_get 2025-09-04 23:05:17 +10:00
Hans Goudey
5418f0bc68 Fix: Geometry nodes reorders attributes in some cases
Currently attribute names are often added to a hash map that doesn't
maintain the original order. This is convenient for developers but it's
better for users if attributes aren't arbitrarily reordered. Instead,
use `VectorSet` which gives the benefit of a hash map but maintains the
insertion order. The main downside is the loss of O(1) removal which we
benefited from in a few cases. I used string comparison instead for now.

Fixes #144491, #122994

Pull Request: https://projects.blender.org/blender/blender/pulls/145668
2025-09-04 13:59:44 +02:00
Campbell Barton
75a3dad4b9 Fix #145714: mesh.validate() asserts editing immutable layers
Ensure corners layers are mutable, was only called on face-data.
2025-09-04 19:00:30 +10:00
Jacques Lucke
df68dc5768 Nodes: remove writing legacy node group interface
When panels in node groups were introduced, the interface data of a tree was
moved from `tree.inputs_legacy/outputs_legacy` to `tree.tree_interface`. For
forward compatibility, the old interface was still written. Since Blender 4.5
can read the new format and older versions are not able to open files created in
5.0 directly anymore, it's fine to remove this forward-compatibility code now.

Also fixes #145278.

Pull Request: https://projects.blender.org/blender/blender/pulls/145489
2025-09-04 06:45:32 +02:00
илья _
6c51993aa3 Geometry Nodes: COW Elision for attribute default filling
Avoid `*_for_write` calls if will not perform any write actions later.
This is a theoretical optimization, only in some fairly specific
situations though.

Pull Request: https://projects.blender.org/blender/blender/pulls/145540
2025-09-04 02:41:55 +02:00