In the case where the last layer is removed and all the drawings
have zero users, in the `remove_drawings_with_no_users` function
the `find_next_swap_index` lambda would return `false` on the
first call. Both `first_unused_drawing` and `last_used_drawing`
are `0` in this case. This meant that the `drawings_to_remove`
index mask would exclude the first drawing (because
`last_used_drawing` is the index of the first drawing) and not
remove it as it should.
To fix this, we check if `first_unused_drawing` is greater than zero.
If it is not, then we know all the drawings have to be removed.
Otherwise we only remove the drawings after
`last_used_drawing + 1`.
Pull Request: https://projects.blender.org/blender/blender/pulls/125318
The issue was that some `material_index` were `-1`. This meant that
the rendering code was accessing out-of-bounds memory to read
from the material pool.
The fix adds an assert to the `gpencil_material_resources_get` and
clamps the `material_index` to >= 0 to ensure that the material is
valid. It also changes the default read value for the material indices
in `create_curves_outline` and `retrieve_visible_strokes` to be 0
instead of -1.
Pull Request: https://projects.blender.org/blender/blender/pulls/125309
The code to create 'key lists' (for example to go to the next/previous
key) do so by creating fake data-structures (`bDopeSheet` and
`bAnimContext`). These are zero-initialised, very few fields are set,
and then passed to the generic animation filtering function. Because of
this, `bAnimContext::bmain` was `nullptr`, which caused the crash.
Instead of fixing the real issue (major design problems in the animation
channel/filtering code), I've made the use of `bmain` optional. The
pointer is necessary to find the animated data-blocks, in order to
resolve the RNA path of F-Curves to the animated properties, which in
turn is necessary to determine the F-Curve display name. If that name is
irrelevant (for example when finding the next/previous key) the `bmain`
is not necessary. This is now handled more or less properly, at least to
the extent that the crash is prevented.
Pull Request: https://projects.blender.org/blender/blender/pulls/125300
When using the `DrawingPlacementDepth::Stroke` or
`DrawingPlacementDepth::Surface` the placement plane was
not initialized. This leads to wrong projection values for tools
that don't support either of these depth placements.
This fixes the issue by initializing the placement plane in all
cases except for `DrawingPlacementPlane::View` which will
use the view plane.
Pull Request: https://projects.blender.org/blender/blender/pulls/125284
The outputs of the Render Layers node in the compositor in the startup
file are missing. That's because add-ons are disabled when loading the
startup file, so Cycles will not be registered by the time the node tree
of the compositor is loaded, and its passes will not exist.
To fix this, we mark the compositor node tree as needing an update after
loading the startup file.
Pull Request: https://projects.blender.org/blender/blender/pulls/125053
This patch adds support for multi-pass compositing for EEVEE. This is
done by copying the passes used by the compositor node tree to the DRW
view data, which can then be accessed by the viewport compositor.
The viewport compositor will fallback to the viewport texture or an
invalid output of the passes were not initialized, this is currently the
case for any render engine that is not EEVEE.
A future optimization that we can do is eliminate the film pass copy
shaders and only copy the data that EEVEE rendered, which can be a
subset of the viewport for border rendering. This is not done at the
moment because not all engines support passes at the moment, so the
compositor expects full viewport passes.
Depends on: #123685, #123817, #123815.
Pull Request: https://projects.blender.org/blender/blender/pulls/123378
When a new F-Curve is created on a layered Action, tag the dependency
graph for rebuilding its relationships. This is necessary as the F-Curve
may be animating a depsgraph component that was previously not animated,
and thus that relation needs to be constructed.
This was already in place for legacy Actions, and simply overlooked for
the new layered ones.
Pull Request: https://projects.blender.org/blender/blender/pulls/125236
If a user has multiple collections for which exporters are defined, then
during File->Export All Collections, multiple UI notifications will
occur, one for each collection. This is confusing because these
notifications contain a count of how many files were exported and only
the "last" notification is shown to the user. The others are still
present in the Info editor (and terminal) but users rarely look there.
The fix changes where we post the notification report. We tally up the
number of files and collections we process and only report them as a
final step in the appropriate Operator exec functions.
Pull Request: https://projects.blender.org/blender/blender/pulls/125206
If you start an action zone drag close to the edge it is possible to
leave the source area yet be under the minimum distance. If you release
at this particular pixel distance it is possible to have an invalid
or unwanted join. This PR just assumes you have dragged enough if you
manage to leave the source area.
Pull Request: https://projects.blender.org/blender/blender/pulls/125266
This patch moves the Cryptomatte weights normalization from The
Cryptomatte sorting shader to the film shader.
This is needed to support multi-pass viewport compositing because up
until now, Cryptomatte passes were only sorted and normalized for final
rendering after all samples were accumulated. So it assumed no further
accumulation of samples would take place. But for compositing, we need
to sort and normalize them for every sample, and applying normalization
multiple times will produce wrong results.
Needed by #123378.
Pull Request: https://projects.blender.org/blender/blender/pulls/123685
The Texture Properties tab is missing even if it is used in the
compositor. To fix this, we add a texture space user for texture nodes
in the compositor node tree.
Pull Request: https://projects.blender.org/blender/blender/pulls/125081
This separates a single `GeometryDataSetTreeViewItem` into separate tree view
items for the individual parts of the tree view. While requiring a bit more boilerplate
overall, this simplifies the code quite a bit and makes it more extensible.
Pull Request: https://projects.blender.org/blender/blender/pulls/125239
When erasing, sculpting or tinting, the previous key was not being
duplicated.
The `ed::greasepencil::ensure_active_keyframe` didn't have a good
mechanism to make this work. This adds a parameter to the
`ensure_active_keyframe` function so that the caller can decide
what should be done.
For the sculpting tools, eraser, and tint tool, this will now duplicate
the previous key, when auto-key is on.
Resolves#124082.
Pull Request: https://projects.blender.org/blender/blender/pulls/125224
When holding CTRL using the draw tool to erase, the size of the cursor
was using the size of the eraser brush. This is not the expected behavior
when using the eraser from the draw tool. It should respect the size
of the brush used by the draw tool instead.
This fixes the issue by computing the right size when the eraser operation
is invoked. The size is then stored in a runtime field, so that the cursor
rendering callback can use the cached size.
Pull Request: https://projects.blender.org/blender/blender/pulls/125225
Previous comments were rather vague and misleading even. For example it
is often expected that `PROP_HIDDEN` would hide properties in the keymap
editor, which it wouldn't. The term "ghost" value was not defined thus
useless as documentation. Explained the behavior instead.
Also the "Inherits #PROP_SKIP_PRESET" note added in 0d7282e69b was
confusing, what does it mean to inherit a property? Clarified that too.
Lastly the API description of `WM_operator_properties_reset()` was not
updated for 1058006e03. Fixed now.
Previously, 4e9e44ad made changes to allow GSpan and GMutableSpan to not
have a type when they are empty. This mirrors the same change in the
conversion from GArray to both span types and when converting to an
actual typed Span<> or MutableSpan<> via typed().
Fixes#125013
Pull Request: https://projects.blender.org/blender/blender/pulls/125018
VSE timeline widget drawing is done in "timeline space" (x: frames,
y: channels), but that can have precision issues at large frames,
when "pixel size features" (outlines, borders) need to get evaluated
inside a shader.
This can lead to inconsistent border sizes between neighboring strips,
e.g. sometimes it would be 2 pixels, but sometiems 3 pixels. I've seen
this mostly happen when frames get into 100'000+ range.
To address this, switch timeline widget drawing to be in window pixel
space. This avoids the issue since coordinates to draw the strip
widgets become "up to several thousand" range, not arbitrarily large.
Pull Request: https://projects.blender.org/blender/blender/pulls/125220
This adds two new nodes:
* `Grease Pencil to Curves`: Converts each grease pencil layer into an instance
that contains curves.
* `Curves to Grease Pencil`: Converts top-level curve instances into grease
pencil layers.
This opens up many new opportunities:
* Use grease pencil as input to other procedural systems that don't necessarily
output grease pencil.
* Generate grease pencil from scratch using geometry nodes.
* Temporarily convert grease pencil data to curves to use more powerful features
for curves processing.
Some data on layers are not attributes yet unfortunately, so there is some
special case handling for the `opacity` attribute. This was previously discussed
at the geometry nodes workshop:
https://devtalk.blender.org/t/2024-05-13-geometry-nodes-workshop-notes/34760#grease-pencil-14
Pull Request: https://projects.blender.org/blender/blender/pulls/124279
Crash was happening in this scenario:
- mouse was over a property in the dialog
- operator had a "check" callback that was accessing certain operator
stuff
In this case, the `UI_BUT_ACTIVE_DEFAULT` button was executed, operator
finished or canceled (but stuff was freed along the way), then code
kicked in to still handle ENTER over the property in the popup (e.g.
toggle a checkbox), the `uiAfterFunc` still had the `popup_op`, tried to
run `popup_check` again with the faulty data.
Simple way to fix this is to use `WM_UI_HANDLER_BREAK` to not handle
further buttons after executing the `UI_BUT_ACTIVE_DEFAULT`
Pull Request: https://projects.blender.org/blender/blender/pulls/125085
When 7afcfe1 removed the use of `startdisp` and `enddisp` for everything
but effect strips, not all of these variables were replaced in
`select_linked_time`, breaking the option. This option is used for the
select operator with the ctrl modifier in both LCS and RCS default
keymaps.
This patch fixes the bug, and also cleans up the old C code in the
function, replacing it with more robust logic.
- The new logic allows for the "linked time" option to be combined with
the "toggle" option -- old logic only propagated deselects if both
left and right handles were aligned.
- New logic makes sure that a selection is only propagated along the
side that you click by adding the selection handle as an argument.
(Before, you could align two strips on the left side only, "regular" select the
left handle of the top one, then "linked time" select the right
handle, and it would erroneously propagate the left handle selection
too).
This patch also fixes a bug where "both handle" selection would not work
if the linked time option was set, by making sure that if `seq2` is set
in `StripSelection`, then `select_linked_time` is run once more.
Pull Request: https://projects.blender.org/blender/blender/pulls/125039
Default easing values for pose bendy-bones should be 0.0f since it will
be added on top of edit mode values which defaults to 1.0f. This will
make sure that `Reset Default Value` gives expected result and be
consistent with `Clear Scale` operator.
Pull Request: https://projects.blender.org/blender/blender/pulls/125204
Docking allows dragging an area out of a window to empty space to make
a new window. And dragging back will close that window if empty.
However dragging an area that is alone in its window to empty space
does not close the source window so you get a duplicate. This PR just
closes that window (when empty) which feels much more natural.
Pull Request: https://projects.blender.org/blender/blender/pulls/125201
Regression from [0], drivers were tagged as being disabled with a flag
that was never cleared. Causing the label to be displayed for files
where the expressions were enabled and in use.
Resolve by clearing this flag on file load and when re-compiling
expressions - since an expressions block flag may be cleared if it
becomes a simple expression.
[0]: 1a8053939b
When docking an area into a portion of another area, the target area is
split. Currently the new section shows an icon that is bold and
outlined, while the remaining area shows a dimmed icon. This dimming
doesn't make a lot of sense since it is not closed, and it is easy
to tell the source from target with other clues. Conversely, dimming
the icon makes it harder to tell what is going on. This PR just makes
both icons show at the same opacity.
Pull Request: https://projects.blender.org/blender/blender/pulls/125199