Implement shortcuts for viewer nodes. Viewer nodes are now activated using the operator `bpy.ops.node.activate_viewer()` instead of activating the viewer by setting the node to active.
This also unifies the behavior with viewer shortcuts in the compositor (see attachment in the original PR).
Pull Request: https://projects.blender.org/blender/blender/pulls/134555
This replaces the deprecated DrawData mechanism by the
usage of the update timestamp `last_update`.
The compositor keeps the `last_update` value of the cached ID
and compares it with the value on the ID at the time of evaluation.
Rel #134690
Pull Request: https://projects.blender.org/blender/blender/pulls/134878
If we tag positions to be changed we get a proper update (was probably
working for poly curves because the evaluated positions just reference
the original positions array when all curves are poly curves).
Pull Request: https://projects.blender.org/blender/blender/pulls/135874
Fix an issue when the NLA is used in conjunction with a directly-
assigned Action.
When the directly-assigned Action is also used in an NLA strip, that
strip would not be evaluated any more. This was even the case when
different slots were used, which entirely muted the strip when there
was no slot directly assigned. Now the "this has been handled already"
logic considers the action and the slot.
Pull Request: https://projects.blender.org/blender/blender/pulls/135911
This replaces the implicit use of the `radius` attribute on the input
curves with an input field `Scale` that gets evaluated on the point
domain of the input curves to scale the profile.
It wasn't super intuitive that the `radius` would actually act as
a scale of the profile. E.g. if the radius of the input curve was
`1 meter` the resulting profile was unscaled (scaled by 1), but
wouldn't necessarily have a size of `1 meter` (only if the profile
also had a size of 1m)! If imperial units were used, `3.28084 ft`
would correspond to a scale of 1.
This change makes this behavior a lot more clear and potentially
removes the need for the assumption that the default curve radius
is `1.0f` (Ideally, the default curve radius should be `0.01f`).
While we did consider making the `Scale` input use the `radius`
field implicitly by default, we decided against it, because it again
"hides" the dependency on the radius and the fact that the radius
is used as a scale. Letting the user make this decision seems better.
Pull Request: https://projects.blender.org/blender/blender/pulls/134187
This PR enabled GPU based subdivision on Metal.
Most work is done in #135296.
- Metal max storage bindings for compute shaders were never set.
Some performance figures: Suzanne 6 subdivision levels
| Machine | CPU Subdivision | GPU Subdivision |
| --------------- | --------------- | --------------- |
| M1 Studio Ultra | 7fps | 12 fps |
| M2 Air | 3fps | 11 fps |
Pull Request: https://projects.blender.org/blender/blender/pulls/135628
This PR enabled GPU subdivision on Vulkan backend. Measured
performance is slower compared to CPU on my system. But it is
expected that other bottlenecks should be solved in order to
fully benefit from this feature.
We enable it so we keep track of the performance bottlenecks.
Pull Request: https://projects.blender.org/blender/blender/pulls/135777
When duplicating a scene in any way other than Full Copy, the VSE data
is (apparently) not copied along. To prevent dangling F-Curves, any
animation of sequencer strips is removed. This is now done correctly for
slotted Actions, instead of looping over the legacy `action->curves`
field.
Also the F-Curve RNA path that's being tested for is updated. Instead of
deleting all F-Curves with `sequences` in the name, the code now
correctly looks for `sequence_editor.strips_all`.
Pull Request: https://projects.blender.org/blender/blender/pulls/135576
Blender already had its own copy of OpenSubDiv containing some local fixes
and code-style. This code still used gl-calls. This PR updates the calls
to use GPU module. This allows us to use OpenSubDiv to be usable on other
backends as well.
This PR was tested on OpenGL, Vulkan and Metal. Metal can be enabled,
but Vulkan requires some API changes to work with loose geometry.

# Considerations
**ShaderCreateInfo**
intern/opensubdiv now requires access to GPU module. This to create buffers
in the correct context and trigger correct dispatches. ShaderCreateInfo is used
to construct the shader for cross compilation to Metal/Vulkan. However opensubdiv
shader caching structures are still used.
**Vertex buffers vs storage buffers**
Implementation tries to keep as close to the original OSD implementation. If
they used storage buffers for data, we will use GPUStorageBuf. If it uses vertex
buffers, we will use gpu::VertBuf.
**Evaluator const**
The evaluator cannot be const anymore as the GPU module API only allows
updating SSBOs when constructing. API could be improved to support updating
SSBOs.
Current implementation has a change to use reads out of bounds when constructing
SSBOs. An API change is in the planning to remove this issue. This will be fixed in
an upcoming PR. We wanted to land this PR as the visibility of the issue is not
common and multiple other changes rely on this PR to land.
Pull Request: https://projects.blender.org/blender/blender/pulls/135296
Previously in 6f80d722c6 there was a fix for
not removing layers from evaluated data when their visibility is animated,
however it overlooked that the same thing could happen to layer groups.
This fix basically duplicated the same check for layer groups.
Pull Request: https://projects.blender.org/blender/blender/pulls/135450
Unlike the legacy type, the radius isn't included in the bounds for the new
curves type. This hasn't been obvious because the drawing is quite broken
and doesn't use the radius properly.
This commit adds a separate cache for the bounds with the radius, which
is now used by default. The old cache is kept around for backward
compatibility in the bounding box geometry node, where a new
"Use Radius" option accesses the old behavior.
Pull Request: https://projects.blender.org/blender/blender/pulls/135584
According to reports and testing in blender/blender-addons#104434, DCCs
tend to behave badly when rebuilding normals from 'bitflags'
smoothgroups, if different smoothgroups using the same bitflag value share
(are connected by) some common vertices, even if there are no common
edges between them.
This commit adds a new option to the RNA API generating smooth groups,
to also consider smooth groups only sharing vertices as neighbors.
It also makes related required change to implementation, and some
refactor of the API, splitting public functions between 'normal' and
'bitflags' versions.
This should make changes proposed in blender/blender-addons#105516
much simpler, and allow for a matching behavior in smoothgroups
generated by the OBJ exporter as well.
Pull Request: https://projects.blender.org/blender/blender/pulls/135248
Identifying layout-panels using strings and storing their open-state in their
parent panel is generally very convenient. However, right now there is no
mechanism to free the open-close state of panels that are not in use anymore.
It's generally not possible to know if a panel is not used anymore (e.g. it may
also belong to a temporarily disabled add-on). So every mechanism here will be
based on heuristics. A simple but typically very good heuristic is to just
remove the least-recently-used panel states when there are too many. So that's
what is implemented here.
This introduces a logical clock that increases whenever a panel state is used
and stores the last usage time on the panel state. This allows us to remove the
least-recently-used states later on. Specifically, that is done when the .blend
file is loaded the next time. It's not done at another time, because it quite
difficult to be sure that freeing panel states wouldn't cause dangling pointers
in such cases. I think doing it on-load should be good enough for all practical
use-cases.
Note, I don't know if the lack of such garbage collection has ever caused a
problem anywhere. However, it seems better to have some solution now than trying
to solve it after the problem has occurred and made someone's file unusable.
Pull Request: https://projects.blender.org/blender/blender/pulls/135569
This PR creates 2 namespaces for VSE code:
- `blender::seq` for sequencer core code
- `blender::ed::vse` for editor code
These names are chosen to not be in conflict with each other.
No namespace was used for RNA.
Finally, file `BKE_sequencer_offscreen.h` was moved from BKE to sequencer.
Pull Request: https://projects.blender.org/blender/blender/pulls/135500
The general idea is to keep the 'old', C-style MEM_callocN signature, and slowly
replace most of its usages with the new, C++-style type-safer template version.
* `MEM_cnew<T>` allocation version is renamed to `MEM_callocN<T>`.
* `MEM_cnew_array<T>` allocation version is renamed to `MEM_calloc_arrayN<T>`.
* `MEM_cnew<T>` duplicate version is renamed to `MEM_dupallocN<T>`.
Similar templates type-safe version of `MEM_mallocN` will be added soon
as well.
Following discussions in !134452.
NOTE: For now static type checking in `MEM_callocN` and related are slightly
different for Windows MSVC. This compiler seems to consider structs using the
`DNA_DEFINE_CXX_METHODS` macro as non-trivial (likely because their default
copy constructors are deleted). So using checks on trivially
constructible/destructible instead on this compiler/system.
Pull Request: https://projects.blender.org/blender/blender/pulls/134771
Fix an issue where imported F-Curves were allocated but not zeroed out,
when importing skeletal animation from USD.
When growing the F-Curve array, `BKE_fcurve_bezt_resize()` will now zero
out new array elements, instead of leaving the initialisation to the
caller. There are many fields in `BezTriple`, and the caller is likely
to only set those that can be imported (like the keyframe coordinates &
handles).
This fixes an issue introduced in 857743db9d.
Pull Request: https://projects.blender.org/blender/blender/pulls/135448
Adds a mode option to the node to choose between the existing
behavior and new behavior that converts each face to a cyclic curve.
Generally this is much faster than the existing mode because it's
easy to parallelize and because curve offsets and face and corner
attributes can be implicitly shared to avoid copies.
Resolves#134671.
Pull Request: https://projects.blender.org/blender/blender/pulls/134773
At this point, it is unlikely that we will revert the changes made over
a decade ago to the Dyntopo edge splitting code. The old code will still
exist in the git history, but to improve readability, this commit
flattens out the blocks and removes the `#define` statements.
Pull Request: https://projects.blender.org/blender/blender/pulls/135410
This patch refactors static cache invalidation of images by tracking an
update count. Images now store a runtime update count that is updated
every time the image is tagged for update. Cached images store a copy of
the update count at the moment they were cached, and are invalidated if
if it changed.
Compared to #134878, this is simpler and more robust, since update IDs
are isolated to images only and not to the DEG update count. Though this
only supports images specifically because they are not covered by the
copy-on-evaluation system, which means #134878 will cause multiple
depsgraph to fight over images.
Pull Request: https://projects.blender.org/blender/blender/pulls/134905
The issue was that the versioning code didn't run when loading the action.
Thus it had no slots and so was crashing trying to get the first slot.
This PR fixes that in 2 ways:
* Check the slot count of the loaded action, and return/notify the user
* Actually make sure the actions are versioned
Point 1 is important anyway because actions can have no slots (though unlikely).
Point 2 ensures that old pose assets can actually be used
Pull Request: https://projects.blender.org/blender/blender/pulls/135232