Commit Graph

28020 Commits

Author SHA1 Message Date
Hans Goudey
8fed30aff2 Fix #134485: Missing depsgraph tag when assigning material
Caused by 81a63153d0.

Previously this was done by BKE_objects_materials_sync_length_all.
Now that function only adds a tag when it actually does something.
2025-02-13 13:16:57 -05:00
Brecht Van Lommel
4786fbe774 Refactor: Remove extern "C" from most headers
The only remaining code in source/blender that must be compiled as C
is now datatoc generated code and the DNA defaults that use designated
initializers.

Pull Request: https://projects.blender.org/blender/blender/pulls/134469
2025-02-13 18:58:08 +01:00
Harley Acheson
83c94c6537 Merge branch 'blender-v4.4-release' 2025-02-13 09:46:08 -08:00
Fabricio Luis
afec64739a Fix #130372: Implements memory of the previous state of eSpace_Types.
This implements the memorization of the previous state of a space's
subtype for those that have multiple modes. Introduces an optional
space_subtype_prev_get callback, implemented for SPACE_ACTION,
SPACE_FILE, SPACE_GRAPH, SPACE_IMAGE and SPACE_NODE. This means we
can always return to the previous mode.

Pull Request: https://projects.blender.org/blender/blender/pulls/133846
2025-02-13 18:45:00 +01:00
Bastien Montagne
48636fcab4 Merge branch 'blender-v4.4-release' 2025-02-13 18:42:16 +01:00
Bastien Montagne
e30b78fec4 Fix (unreported) invalid usage of C-style allocation for non-trivial C++ data. 2025-02-13 18:41:41 +01:00
Campbell Barton
640e70b6e8 Cleanup: various non-functional changes for C++ 2025-02-13 13:33:09 +11:00
Brecht Van Lommel
c7a33a62a2 Cleanup: Directly include DNA_userdef_types.h and BLI_listbase.h
Instead of relying on them being included indirectly.

Pull Request: https://projects.blender.org/blender/blender/pulls/134406
2025-02-12 23:01:08 +01:00
Harley Acheson
5956752eb7 UI: Themeable RedAlert, Error, Warning, Info Colors
The "Red Alert" color is currently hard-coded, which causes problems in
themes.  It also has an Enum value of 0, which precludes using this
value as "unset". We also use Error, Warning, and Info colors that are
part of the Info Editor.  This PR moves these out of the Info Editor
and into the "State" part of the theme. And then makes TH_REDALERT use
the TH_ERROR color.

Pull Request: https://projects.blender.org/blender/blender/pulls/131127
2025-02-12 20:59:47 +01:00
Hans Goudey
33db2d372f Mesh: Optimize vertex to edge attribute domain interpolation
Instead of using `DefaultMixer`, use the simpler `mix2` function.
This just decreases the overhead of computing each value.
In a simple test storing an attribute with the position of each
edge, I observed a 1.7x performance improvement: a change from
16 ms to ~9ms for an 8 million edge mesh.

Resolves #133196.
2025-02-12 11:50:14 -05:00
Hans Goudey
89b826b2fe Object: Prevent unnecessary depsgraph tags for no-op materials resize
When the object materials array is already the correct size these
functions don't do anything. Avoiding the depsgraph tags can avoid
unnecessary re-evaluations in cases like  sculpt mode where we
purposefully avoid adding tags elsewhere. Split from !133842.
2025-02-12 10:42:29 -05:00
Campbell Barton
e96acd433d Docs: add code-comments to clarify bad-level include & developer only UI 2025-02-12 13:21:07 +11:00
Campbell Barton
07340e1093 Docs: add code-comments to clarify bad-level include & developer only UI 2025-02-12 10:59:16 +11:00
Jacques Lucke
4980dc5e29 Merge branch 'blender-v4.4-release' 2025-02-11 17:47:45 +01:00
Jacques Lucke
374604f188 Refactor: Core: simplify accessing ListBases in Main
This replaces the `set_listbasepointers` function with `BKE_main_lists_get`
which returns an array of `ListBase *`. This simplifies the caller a bit. In
some cases, it can be simplifed further by changing the order in which we iterate
over the listbase. For historical reasons, we iterate from the back to front in
most cases but sometimes the order does not matter. I did keep the iteration order
in this patch though, to avoid regressions.

Pull Request: https://projects.blender.org/blender/blender/pulls/134242
2025-02-11 17:46:07 +01:00
Jacques Lucke
d28cf7a469 Fix #134283: defer freeing tree/node/socket types
Currently, tree, node and socket types are always freed immediately when the
Python code unregisters them. This is problematic, because there may still be
references to those type pointers in evaluated data owned by potentially various
depsgraphs. It's not possible to change data in these depsgraphs, because they
may be independent from the original data and might be worked on by a separate
thread. So when the type pointers are freed directly, there will be a lot of
dangling pointers in evaluated copies. Since those are used to free the nodes,
there will be a crash when the depsgraph updates. In practice, this does not
happen that often, because typically custom node tree addons are not disabled
while in use. They still used to crash often, but only when Blender exits and
unregisters all types.

The solution is to just keep the typeinfo pointers alive and free them all at
the very end. This obviously has the downside that the list of pointers we need
to keep track of can grow endlessly, however in practice that doesn't really
happen under any normal circumstances.

I'm still getting some other crashes when enabling/disabling Sverchok while
testing, but not entirely reliably and also without this patch (the crash there
happens in RNA code). So some additional work will probably be needed later to
make this work properly in all cases.

Pull Request: https://projects.blender.org/blender/blender/pulls/134360
2025-02-11 17:25:10 +01:00
Falk David
9438597b34 Fix: Grease Pencil: Remove invisible layers from evaluated data
Previously, all the layers were part of the evaluated state, even if
they were hidden.

Hidden layers should be treated as "disabled" meaning that we should
not evaluate them and/or render them at all.

This fixes this by removing hidden layers from the evaluated data before
layer adjustments and modifier evaluation starts.

As a consequence, hidden layers are no longer accessible in Geometry
Nodes. Technically, this is a breaking change. In the unlikely case that
a user relied on hidden layers to be evaluated within modifiers, they
need to make sure that the layer is visible.

Pull Request: https://projects.blender.org/blender/blender/pulls/133973
2025-02-11 16:49:51 +01:00
Aras Pranckevicius
4f0fd32d6f VSE: Over Drop effect was not doing anything useful, map it to Alpha Over
Behavior of it was exactly the same as Alpha Over for the last 18 years (since
327d413eb3 in 2006 March), so just remap it to regular alpha over on file read.

Pull Request: https://projects.blender.org/blender/blender/pulls/134342
2025-02-10 16:10:01 +01:00
Omar Emara
bd379e1892 Refactor: Compositor: Use gpu_fn for ShaderNode class
This patch refactors the ShaderNode class to be a concrete class that
is implemented in terms of the node type gpu_fn. This is done to make it
easier to reuse existing nodes in other parts of Blender.

Pull Request: https://projects.blender.org/blender/blender/pulls/134210
2025-02-10 11:51:57 +01:00
Campbell Barton
677a643046 Merge branch 'blender-v4.4-release' 2025-02-10 19:53:53 +11:00
Campbell Barton
4276437f05 Cleanup: quiet check_spelling_* warnings 2025-02-10 19:48:42 +11:00
Campbell Barton
e659e87a67 Cleanup: cmake formatting, sort file lists 2025-02-10 19:40:06 +11:00
Sebastian Parborg
cad4b39af3 Merge branch 'blender-v4.4-release' 2025-02-08 12:03:13 +01:00
Sebastian Parborg
ea380b1efe Revert "Sound: Sync up the screen refresh timer to the audio when seeking"
This reverts commit c952b12a6e.

This caused segfaults when playing back animations and seeking.
See #133542
2025-02-08 12:01:51 +01:00
Brecht Van Lommel
709dcba98c Merge branch 'blender-v4.4-release' 2025-02-07 21:24:36 +01:00
Brecht Van Lommel
cfca7ac952 Fix #133943: Unnecessary image full update mark on file open
This would be done when the frame, layer, pass or view changes compared to
the previous value. But for cases like old files without these members or
loading the image datablock into a different scene, this considered the image
to be always be changed on file load.

Now always reset this state on file load, and don't consider the initial
state as an image update.

This could also happen in the middle of GPU rendering, causing the GPU
texture to be freed while still in use.

Pull Request: https://projects.blender.org/blender/blender/pulls/134198
2025-02-07 21:23:48 +01:00
Bastien Montagne
87a4c0d3a8 Refactor: Make Library.runtime an allocated pointer.
Move `Library.runtime` to be a pointer, move the related
`LibraryRuntime` struct to `BKE_library.hh`. Similar to e.g.
Mesh.runtime, that pointer is expected to always be valid, and is
allocated at readtime or when creating a new Library ID.

Related smaller changes:
* Write code now uses standard ID writing codepath for Library IDs too.
  * Runtime pointer is reset to nullptr before writing.
* Looking up a library by its absolute path is now handled through a
  dedicated utils, `search_filepath_abs`, instead of using
  `BLI_findstring`.

Pull Request: https://projects.blender.org/blender/blender/pulls/134188
2025-02-07 17:47:16 +01:00
Jacques Lucke
190ba72acf Cleanup: Nodes: use utility method to check if node is undefined 2025-02-07 13:40:26 +01:00
Jacques Lucke
fa912845ac Merge branch 'blender-v4.4-release' 2025-02-07 13:31:43 +01:00
Jacques Lucke
3baac1992a Fix: Nodes: handle undefined nodes more gracefully
Found while checking #134193.
2025-02-07 13:26:24 +01:00
Bastien Montagne
9fbde225da Merge branch 'blender-v4.4-release' 2025-02-07 12:45:32 +01:00
Bastien Montagne
3cbfd26bad Fix #134212: Crash when appending into an Excluded collection.
Would only happen in some specific cases. Essentially, do not consider
an excluded collection as 'editable'.

Also refactored `BKE_collection_parent_editable_find_recursive` on the
way, as it was applying the same checks twice to all but the initial
processed collections.
2025-02-07 12:45:12 +01:00
Falk David
445ae53c8e Merge branch 'blender-v4.4-release' 2025-02-07 12:22:59 +01:00
Falk David
8c01a59411 Fix: Grease Pencil: Use ensure_selection_attribute in vgroup_select_verts
This was implemented in the kernel but it shouldn't have been.
Since the function operates at the editor level and doesn't
only work at the low-level, it should be in the `object_vgroup.cc` file
in the `editor` context.

This also means that we can use `ensure_selection_attribute` which
fixes a crash when the selection attribute is on the wrong domain.

Pull Request: https://projects.blender.org/blender/blender/pulls/134060
2025-02-07 12:22:29 +01:00
Campbell Barton
b113e848ef NDOF: implement new methods to pick the orbit-center
Note: this is a back-port from `main`, details below,
Original message:

Add support for dynamic NDOF orbit center calculation.

- When "Auto" NDOF preference is enabled:
  All visible objects in the viewport are used to calculate a
  bounding box center, if the bounds are outside the view or the center
  is behind the viewport, use a Z-Buffer test to calculate the depth in
  the middle of the region.

- When "Use Selected Items" NDOF preferences is enabled,
  calculating the bounds from the selection.

- An option to show the orbit center as a guide has also been added.

Ref !129594

Co-authored-by: Kamil Galik <kgalik@3dconnexion.com>

Back-ported as this change as this only missed the 4.4 branch by hours
and is considered an important feature for 4.4 by 3dconnexion.

This includes the following commits from main:

1a14d69498
30399fd165
3a8658958f
da8d9d989e
2a0ce11104
fb539baa89
2025-02-07 10:23:45 +11:00
Hans Goudey
54dc692d7b Refactor: Use StringRef for attribute API and BMesh CustomData functions
Replace `const char *` with `StringRef` for the API in `BKE_attribute.h`.
The benefits are slightly simpler code and possibly slightly improved
performance through avoiding the need to measure string length.

Pull Request: https://projects.blender.org/blender/blender/pulls/134183
2025-02-06 21:38:19 +01:00
Hans Goudey
4f833b0b5f Refactor: Add StringRef overloads to translation functions
Currently UI code always has to use char pointers when interacting with
the translation system. This makes benefiting from the use C++ strings
and StringRef more difficult. That means we're leaving some type safety
and performance on the table. This PR adds StringRef overloads to the
translation API functions and removes the few calls to `.c_str()` that
are now unnecessary.

Pull Request: https://projects.blender.org/blender/blender/pulls/133887
2025-02-06 17:47:52 +01:00
Falk David
8af27ce27e Fix #133969: Crazyspace broken with bezier curves and armature modifier
The issue was that the topology of the drawing changes when the bezier
curves get resampled to poly curves in the armature modifier.
This means that the crazyspace code fails to find deformed positions
with the same length as the original positions.

The fix does multiple things:
* First, we make sure that we create an `GeometryComponentEditData` in
  weight paint mode.
* When the armature modifier runs, we remember the current positions in
  this component.
* Then, we store the curve offsets and weights _before_ converting the
   bezier curves.
* Finally we deform the positions stored in the edit hint component
   (which have the same length as the original positions).

Since the resampling just adds new points, there might be a way to
avoid running the armature deformation a second time on the edit
hints, but I'll leave that for another day as a performance improvement.
In any case, this is only done when we actually need the deformation
(e.g. in weight paint mode when we paint the weights).

Pull Request: https://projects.blender.org/blender/blender/pulls/134030
2025-02-06 11:15:32 +01:00
Falk David
3a85ccde38 Fix #133969: Crazyspace broken with bezier curves and armature modifier
The issue was that the topology of the drawing changes when the bezier
curves get resampled to poly curves in the armature modifier.
This means that the crazyspace code fails to find deformed positions
with the same length as the original positions.

The fix does multiple things:
* First, we make sure that we create an `GeometryComponentEditData` in
  weight paint mode.
* When the armature modifier runs, we remember the current positions in
  this component.
* Then, we store the curve offsets and weights _before_ converting the
   bezier curves.
* Finally we deform the positions stored in the edit hint component
   (which have the same length as the original positions).

Since the resampling just adds new points, there might be a way to
avoid running the armature deformation a second time on the edit
hints, but I'll leave that for another day as a performance improvement.
In any case, this is only done when we actually need the deformation
(e.g. in weight paint mode when we paint the weights).

Pull Request: https://projects.blender.org/blender/blender/pulls/134030
2025-02-06 11:14:23 +01:00
Hans Goudey
93ab2813a7 Cleanup: Remove unnecessary "using" statements 2025-02-05 18:27:43 -05:00
Campbell Barton
3a8658958f Correct error bumping patch level instead of subversion
Correct mistake in 30399fd165
2025-02-06 10:08:05 +11:00
Campbell Barton
30399fd165 NDOF: enable "Auto" center & show orbit center guide by default 2025-02-06 09:54:44 +11:00
Thomas Dinges
eaef5e87c2 Revert "Release: Bump branch to 4.4 Beta."
This reverts commit 8a6e3a0bd7.
2025-02-05 11:25:54 +01:00
Thomas Dinges
50651145e4 Merge branch 'blender-v4.4-release' 2025-02-05 11:25:43 +01:00
Thomas Dinges
8a6e3a0bd7 Release: Bump branch to 4.4 Beta.
Splash screen by Flow.
2025-02-05 11:24:33 +01:00
Thomas Dinges
2fb881b65a Release: Bump main to 4.5 2025-02-05 11:09:47 +01:00
Campbell Barton
3952c58183 Fix buffer overflow from an one error accessing environment variables 2025-02-05 19:08:58 +11:00
Campbell Barton
df3d1bf506 Cleanup: use const arguments & variables where appropriate 2025-02-05 14:38:56 +11:00
Hans Goudey
fc1fe4e78c Cleanup: Rename object materials "test" functions
"test" wasn't descriptive. Rename that part to "sync_length".
Also expose documentation from the function implementation
to describe what the functions do.

Pull Request: https://projects.blender.org/blender/blender/pulls/134058
2025-02-04 17:46:08 +01:00
Falk David
b760c5d6ef Cleanup: Grease Pencil: Add comments about attributes assumptions
In some places of the code we expect some attributes to not exist
and therefore always be created successfully.
2025-02-04 17:42:23 +01:00