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.
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
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
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.
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.
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
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
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
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
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
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
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.
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
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:
1a14d6949830399fd1653a8658958fda8d9d989e2a0ce11104fb539baa89
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
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
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
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