Before some recent refactors, normals were always calculated
when creating the sculpt BVH tree. Switching from dyntopo BMesh
back to base mesh sculpting, that didn't happen anymore.
Nowadays it makes more sense to update the normals as necessary
where they are used, so the intent of the code that uses normals
is clearer.
Pull Request: https://projects.blender.org/blender/blender/pulls/127111
The issue was that we were misinterpreting the `ANIMFILTER_FCURVESONLY`
flag in the animation filtering code. We were taking it to mean that
literally only actual fcurve channels should be included, but in fact
it should include the channel groups for those fcurve channels as well.
The graph editor code (but not the dopesheet code) depended on this
interpretation to function correctly, and doesn't display the groups
at all without it.
This fixes the issue by not excluding channel groups even when that
flag is set. This also updates the documentation of that flag to
clarify its actual semantics.
Pull Request: https://projects.blender.org/blender/blender/pulls/127108
This removes `AnonymousAttributeID` which was "attached" to every anonymous
attribute before. It adds more complexity than is justified for its
functionality.
It was originally introduced to keep the reference count of the anonymous
attribute so that it can be deleted automatically when the attribute is not
referenced anymore. For quite some time we have had deterministic attribute
life-times though which don't rely on the reference count anymore.
Anonymous attributes are sometimes shown in the UI as "friendly looking" string
like `"UV Map" from Cube`. Some information necessary for this was also stored
in `AnonymousAttributeID`. However, this can also be solved differently.
Specifically, this functionality has now been added directly to
`AttributeFieldInput`.
This refactor also allows removing `AttributeIDRef` which was mainly introduced
because we had to keep the `AnonymousAttributeID` attached with the attribute
name. Just using simple string types to identify attributes can reduce the
mental overhead quite significantly. This will be done as a separate refactor
though.
Pull Request: https://projects.blender.org/blender/blender/pulls/127081
This change does some preparations before we implement persistent
caching for static shaders.
- Move ownership of pipeline cache to the pipeline pool.
- Use two pools. one is only used for static shaders
other for non static shaders.
Related to #126229
Pull Request: https://projects.blender.org/blender/blender/pulls/127100
The term "tool" is historic from before the actual tool system got
introduced. Since then the term was already a bit confusing, because it
wasn't directly related to the tool system, but there was still some
relationship between the two. Now brushes and their types are decoupled
much more from the tool system, with a single "Brush" tool supporting
all kinds of brushes (draw, grab, cloth, smooth, ...).
For a more clear terminology, use "brush type" instead of "tool".
For #126032 we need to write the brush type to the asset metadata (done
in !124618), so we can filter brushes based on the type (so the grease
pencil eraser tool only shows eraser brushes, for example). I'd like to
use future proof names for that to avoid versioning of asset metadata in
future, so I'd rather do the full naming change now.
RNA properties (thus BPY names) are not changed for compatibility
reasons. Can be done in 5.0, see blender/blender#124201.
Pull Request: https://projects.blender.org/blender/blender/pulls/126796
Calling exit() runs temporary directory cleanup and other atexit
functions that shouldn't be called while Blender runs.
The same issue [0] addresses.
Also add clarifying comments.
[0]: e00b7c4ad4
Remove call to BM_elem_attrs_copy in face interpolation function.
This was copying custom-data which cleared the faces CD_BM_ELEM_PYPTR,
making the Python objects behave as if it was removed.
While the issue could also be fixed by skipping the PYPTR layer,
copying attributes such as the material & normal in a face-data
interpolation function isn't correct. In cases where this is needed,
it's better the caller handles copying attributes.
Port the macOS version of the `BLI_delete_soft` function from raw
runtime `objc_*` calls function to proper Objective-C for increased
readability and long-term maintainability. This new function is placed
in a new `intern/fileops_apple.mm` file, analogous to the existing
`intern/storage_apple.mm` file.
Pull Request: https://projects.blender.org/blender/blender/pulls/126766
`atan2(0, 0)` is undefined on many platforms. To ensure consistent
result across platforms, we return `0` in this case.
Note only the behavior of the shader node `Artan2` is changed here.
During shading, we might still produce `atan2(0, 0)` internally and
cause different results across platforms, but that usually happens with
single samples and is not obvious, plus checking this condition all the
time is costly. If later we find out it's indeed necessary to change all
the invocation of `atan2(0, 0)`, we could change the wrapper functions
in `metal/compat.h` and `mtl_shader_defines.msl`.
Pull Request: https://projects.blender.org/blender/blender/pulls/126951
In this case, the `PoseBackup` created by
`action_preview_render_prepare` wasnt cleaned up properly (because
`action_preview_render` was earlied out).
So to resolve, call `action_preview_render_cleanup` as well when
earlying out)
Pull Request: https://projects.blender.org/blender/blender/pulls/127067
VSE timeline, when many (hundreds/thousands) of thumbnails were visible, was
very slow to redraw. This PR makes them 3-10x faster to redraw, by stopping
doing things that are slow :) Part of #126087 thumbnail improvements task.
- No longer do mute semitransparency or corner rounding on the CPU, do it in
shader instead.
- Stop creating a separate GPU texture for each thumbnail, on every repaint,
and drawing each thumbnail as a separate draw call. Instead, put thumbnails
into a single texture atlas (using a simple shelf packing algorithm), and
draw them in batch, passing data via UBO. The atlas is still re-created every
frame, but that does not seem to be a performance issue. Thumbnails are
cropped horizontally based on how much of their parts are visible (e.g. a
narrow strip on screen), so realistically the atlas size is kinda
proportional to screen size, and ends up being just several megabytes of data
transfer between CPU -> GPU each frame.
On this Sprite Fright edit timeline view (612 visible thumbnails), time taken
to repaint the timeline window:
- Mac (M1 Max, Metal): 68.1ms -> 4.7ms
- Windows (Ryzen 5950X, RTX 3080Ti, OpenGL): 23.7ms -> 6.8ms
This also fixes a visual issue with thumbnails, where when strips are very
tall, the "rounded corners" that were poked right into the thumbnail bitmap
on the CPU were showing up due to actual bitmap being scaled up a lot.
Pull Request: https://projects.blender.org/blender/blender/pulls/126972
This commit adds a python script that can collect some of the
information necessary to fill out a bug report.
The primary use case is to help users collect system information for
a bug report in the case that Blender can't open.
CMD and sh files are included to help users use the Python script.
Ref !122191
This commit mainly replaces a lot of `memset(0)` by empty value
initialization of `PointerRNA` and related data.
It also moves a few remaining areas from C alloc/free to C++ new/delete
memory hanlding.
Part of the effort to make PointerRNA non-trivial (#122431).
This issue only applied to layered actions.
The issue was that the `restore_channel_group_invariants()` method was
being called too early in the remove fcurve function, and thus fcurves'
group pointers could end up inconsistent with the membership specified
in the groups.
This commit fixes the issue by moving the call to
`restore_channel_group_invariants()` to the end of the function, where
it belongs.
Pull Request: https://projects.blender.org/blender/blender/pulls/127075
Add two new operators, `anim.slot_new_for_id` and
`anim.slot_unassign_from_id`. These are used in the Action editor and
the Animation panels in the Properties editor, to respectively create a
new Action Slot for an ID and to unassign whatever slot is currently
assigned to that ID.
The latter operator also replaces the C++ operator
`anim.slot_unassign_object`, which was specifically made for the
Dopesheet header. The Python ones are generic enough to be used there
too.
Pull Request: https://projects.blender.org/blender/blender/pulls/126943
Fix an issue where selecting a key in the dope sheet summary line for a
channel group would deselect all corresponding keys in the F-Curves of that
group. It was caused by an accidental duplication of the `ChannelBag`.
Pull Request: https://projects.blender.org/blender/blender/pulls/127069
The issue was that slots are using `templated_selection_state_update()`
for their basic selection logic, which is used in the same places as the
`ACHANNEL_SET_FLAG` macro and was written to do the same job. However,
the logic was not properly reproduced.
Specifically, `ACHANNEL_SET_FLAG` actually *deselects* when passed
the `ACHANNEL_SETFLAG_EXTEND_RANGE` or `ACHANNEL_SETFLAG_TOGGLE`
selection mode flags. This makes no sense at all, but it turns out to
be functionally important in the case of `ACHANNEL_SETFLAG_EXTEND_RANGE`
because of how it's used, resulting in this bug.
This fixes the issue by changing `templated_selection_state_update()` to
exactly match the logic of `ACHANNEL_SET_FLAG`, in all its nonsensical
glory. I've also added a comment explaining the situation, so it's clear
why the logic is so odd.
Pull Request: https://projects.blender.org/blender/blender/pulls/126981
Use an `std::optional<int>` to return the icon from
`getname_anim_fcurve()`.
This function is used both to get the name and to get the icon of
whatever the F-Curve is animating. Sometimes the animated struct doesn't
have an icon though. In some cases we need to know whether it could
resolve the RNA path correctly or not, and checking for 'no icon' was
not enough because that may be a valid return value.
The returned icon is now wrapped in an `std::optional<int>`, and a
`std::nullopt` is returned whenever the icon cannot be determined.
No functional changes, except in the two places where the icon is
actually used. In case of error there is now always a fallback to the
struct icon of the animated ID (previously this was only a fallback when
the RNA path was there but could not be resolved; now it's also used
when the RNA path is empty, for example).
Pull Request: https://projects.blender.org/blender/blender/pulls/125666
Workbench doesn't fill all texture slots. In OpenGL it should match what
the shader is using, where some texture slots that have been defined can
be optimized away when not used. The Vulkan backend however uses all the
resources that has been defined in the shader create info.
When using a texture shader in workbench the shader would raise a
validation warning as there are slots defined that are never uploaded.
This PR fixes this by always set dummy textures in those slots.
Pull Request: https://projects.blender.org/blender/blender/pulls/127064
Add back clipping using the same GL clip planes as before.
The difference is that the clip planes are now stored in the
`GlobalsUboStorage` instead of relying on another separate
UBO.
One annoyance of the current design is that the `overlay::Instance`
has to be created with the clipping state. This could be fixed later
by making the shader module a pointer instead of a reference.
Rel #102179
Pull Request: https://projects.blender.org/blender/blender/pulls/127018
Scaling 2 points to 0 would assert. Remove the assertion
as this isn't an error.
Also ensure `anim_path_accum_length` is freed when a new
length isn't calculated.
The code for marking seams or sharp in a bevel was nonsense
for terminal edges (beveled edges that are the only beveled
edge at a vertex). It was written assuming that either the
number of segments is 1 or there is a mesh ADJ pattern, which
is not the case if there is a terminal edge with segments > 1.
The immediate fix for infinite loops is to project against trying
to execute this code for terminal edges.
Also made current code clearer and removed duplication.
It is a future TODO to make it do something sensible for terminal
edges instead of a no-op. Incidentally I notice that it also doesn't
work for mitered booleans, but it won't infinite loop in that case.
To fix both of these cases, we should try to count boundary vertices
to skip rather than edges to skip.