Currently object bounds (`object.runtime.bb`) are lazily initialized
when accessed. This access happens from arbitrary threads, and
is unprotected by a mutex. This can cause access to stale data at
best, and crashes at worst. Eager calculation is meant to keep this
working, but it's fragile.
Since e8f4010611, geometry bounds are cached in the geometry
itself, which makes this object-level cache redundant. So, it's clearer
to build the `BoundBox` from those cached bounds and return it by
value, without interacting with the object's cached bounding box.
The code change is is mostly a move from `const BoundBox *` to
`std::optional<BoundBox>`. This is only one step of a larger change
described in #96968. Followup steps would include switching to
a simpler and smaller `Bounds` type, removing redundant object-
level access, and eventually removing `object.runtime.bb`.
Access of bounds from the object for mesh, curves, and point cloud
objects should now be thread-safe. Other object types still lazily
initialize the object `BoundBox` cache since they don't have
a data-level cache.
Pull Request: https://projects.blender.org/blender/blender/pulls/113465
Introduced during snap code refactoring.
It seemed wrong to overwrite the calculated nearest distance based only
on the original distance.
But this is intentional, (the code could be improved since there are
unnecessary tests to detect the closest object).
`Vertex Crease`, like `Edge Crease`, is not supposed to use transform
symmetry.
So remove it.
(`Skin Resize` remains using symmetry since that case seems desirable.
See #84376)
No functional changes
`ANIM_builtin_keyingset_get_named` had a `KeyingSet *` argument
that was always passed as `nullptr`
This patch removes it to simplify the code.
Pull Request: https://projects.blender.org/blender/blender/pulls/113677
No functional changes
The keying set code was passing around a list
of `tRKS_DSource` through a lot of functions.
It turns it this was just a ListBase wrapper around `PointerRNA`.
So to make it clearer what is passed around, I replaced the
`ListBase` with a `Vector<PointerRNA>`
To make the use of `ANIM_relative_keyingset_add_source` clearer
I made two functions out of it with different parameters.
Those can take the vector as a reference and
EITHER only an `ID *`
OR an `ID *`, `StructRNA *` and a `void *`
Pull Request: https://projects.blender.org/blender/blender/pulls/113675
No functional changes
Since the functions now live in a namespace,
they no longer need the prefix
as a result there are now 2 functions named
`autokeyframe_object`
which is fine because they take different parameters
If both are needed is for a future patch to investigate
Pull Request: https://projects.blender.org/blender/blender/pulls/113612
No functional changes
The following functions have been moved
`autokeyframe_cfra_can_key`
`autokeyframe_object`
`ED_autokeyframe_object`
`ED_autokeyframe_pchan`
`ED_autokeyframe_property`
they are all in a new file
keyframing_auto.cc
while the declarations are in
ANIM_keyframing.cc
The autokeyframe makros also have been moved
Pull Request: https://projects.blender.org/blender/blender/pulls/113607
No functional changes.
Move the following keyframing functions to the animrig folder
* `insert_keyframe_direct`
* `insert_keyframe`
* `delete_keyframe`
* `clear_keyframe`
In order to disentangle the code I had to move the following as well
* `delete_keyframe_fcurve`
* `visualkey_can_use`
* `visualkey_get_values`
In order to sort the functions I made 3 files (and their header counterparts)
* fcurve.cc
* keyframing.cc
* visualkey.cc
The following functions I made public so they won't get duplicated
* `update_autoflags_fcurve_direct`
* `ANIM_setting_get_rna_values`
There are public keyframing functions that
I left in the editors/animation/keyframing.cc file
I'd like to limit the scope of this refactor, and then
clean up the moved functions before moving even more over
Part of #113278
Pull Request: https://projects.blender.org/blender/blender/pulls/113503
Simplifies the fix to #111120, because it is clearer that the threadsafe
Mesh access is used rather than the potentially problematic object-level
bounds access.
The problem is observed with the "Limit Distance" and "Limit Location"
constraints.
There is an incorrect usage of `td->mtx` and `td->smtx` when converting
`TransData` space from local to global.
In this case, the code is concatenating matrices instead of converting
the location component space.
Also, these matrices only inform the global transformation components
of rotation and scale. They do not include location.
Since the "Limit Distance" and "Limit Location" constraints only require
the location component, it is not necessary to convert the rotation and
scale components.
So, the solution is to convert the location component space instead of
concatenating matrices.
Pull Request: https://projects.blender.org/blender/blender/pulls/112601
Since different symbols are implemented, there is a distinction between
endpoint and loose point, which was partially missing in the snap code
for Mesh.
For Blender 4.0 we decided to support individual icons for different
snap elements.
This was originally contributed by Erik Abrahamsson as !107054 with
some contributions by myself (Germano).
This set of icons being simple geometric symbols, that should be
familiar to CAD artists.
Note that Face and Volume share the same icon (circle). This is
deliberate since they communicate a similar functionality - are not
aimed at precision snapping the same way the vertex or perpendicular
are.
Also note that later we should also try to change the icons shown in
the snap menu to match the symbols that the artists see in the preview
window.
———
On the decision process:
The version currently in main (and rolled back here) was an initial
attempt of aggregating more information to the icons (e.g., by aligning
the icons to the target edges) while making them more suitable to
Blender. After presenting both options to (parts of the) community,
there was nothing fundamentally broken found with either option, though
options diverged over personal preference.
With that in mind, in the latest UI module meeting it was agreed to use
the original proposal then.
This final call was proposed by Dalai Felinto on his role of
commissioner (stakeholder) for the snap polishing tasks (#73993) and
designer for the related Snap Base design #66484.
———
This commit reverts commit 9c2e768f5b.
The reverted icons (referred originally as minimalistic icons) may be
proposed later as a separate theme option.
Currently retiming is quite awkward, when you need to retime multiple
strips strips in sync. It is possible to use meta strips, but this is
still not great. This is resolved by implementing selection.
General changes:
Gizmos are removed, since they are designed to operate only on active
strip and don't support selection.
Transform operator code is implemented for retiming data, which allows
more sophisticated manipulation.
Instead of drawing marker-like symbols, keyframes are drawn to
represent retiming data. Retiming handles are now called keys. To have
consistent names, DNA structures have been renamed.
Retiming data is drawn on strip as overlay.
UI changes:
Retiming tool is removed. To edit retiming data, press Ctrl + R, select
a key and move it. When retiming is edited, retiming menu and
context menu shows more relevant features, like making transitions.
Strip and retiming key selection can not be combined. It is possible to
use box select operator to select keys, if any key is selected.
Otherwise strips are selected.
Adding retiming keys is possible with I shortcut or from menu.
Retiming keys are always drawn at strip left and right boundary. These
keys do not really exist until they are selected. This is to simplify
retiming of strips that are resized. These keys are called "fake keys"
in code.
API changes:
Functions, properties and types related to retiming handles are renamed
to retiming keys:
retiming_handle_add() -> retiming_key_add()
retiming_handle_move() -> retiming_key_move()
retiming_handle_remove() -> retiming_key_remove()
retiming_handles -> retiming_keys
RetimingHandle -> RetimingKey
Retiming editing "mode" is activated by setting `Sequence.show_retiming_keys`.
Pull Request: https://projects.blender.org/blender/blender/pulls/109044
Rename the `bPoseChannel::flag` `PCHAN_HAS_TARGET` to `PCHAN_HAS_NO_TARGET`
as that is actually the meaning of the flag (in the majority of the code).
Since the flag was so confusingly named, there were some mixups in the
armature overlay drawing code as well, which have been fixed now too.
Display the modal keymap in the status bar for modal operators that
are called within macros. Most notably, the keymap for the transform
operator is displayed when it's called as part of the duplicate,
extrude, or loopcut operators or when moving nodes.
Pull Request: https://projects.blender.org/blender/blender/pulls/108027
Before this patch the following snapping options were broken
* snap to markers
* snap to seconds with "Absolute Time Snap" turned on
* technically also snap to Frames with "Absolute Time Snap"
turned on (but made no real difference)
The issue was that each end of the strip would snap individually.
Potentially collapsing the strip.
This would happen e.g. when snapping to markers but with only 1 marker present.
This PR fixes the issue by finding out the closest snap offset and
shifting the strip as a whole by that amount.
That means either the start or the end of the strip will snap to the target.
By doing it that way the length of the strip is never changed by snapping.
This means when snapping to Seconds with "Absolute Time Snap" turned on,
the start of the strip might not be on a full second when the end is.
Pull Request: https://projects.blender.org/blender/blender/pulls/111984
When subframes were enabled, and the time cursor was at a subframe position,
the keying would still insert the key at the full frame.
This was because the value passed to the key insertion
functions was just the full frame value and not the subframe part.
Fixing it by using `BKE_scene_frame_get()` which
returns the floating point frame including the subframe part.
I've added unit tests to ensure that inserting keys at subframe values doesn't cause issues.
Pull Request: https://projects.blender.org/blender/blender/pulls/112131
Implementation of the duplicate and move operator for grease pencil frames.
The `ACTION_OT_duplicate` operator now creates duplicates of the selected frames and stores them in the layer runtime data.
The `TRANSFORM_OT_transform` operator is updated to take care of these duplicated frames.
Pull Request: https://projects.blender.org/blender/blender/pulls/111051
`5ed35e` introduced the warning:
`RNA_boolean_set: TRANSFORM_OT_transform.use_duplicated_keyframes not found`
This was because the `TRANSFORM_OT_transform` did not pass
the `P_OPTIONS` flag to `Transform_Properties` to define
the `use_duplicated_keyframes` property.
In the animation transform code, `T_AUTOMERGE` was used
to indicate that the duplicated keys need to be merged.
In perparation of #111051, this no longer makes much sense because
in grease pencil we cannot have two keys in the same channel at the same
frame.
This PR replaces the `T_AUTOMERGE` flag in the animation code to
`T_DUPLICATED_KEYS` to indicate that the transform is being called
with duplicated keyframes.
Pull Request: https://projects.blender.org/blender/blender/pulls/111268
This was introduced with #109015
The issue manifested in two ways.
* snapping did not work with rotate and scale
* the scale and rotate value would increment in steps instead of fluidly
This was caused because the snapping code would force the
mode to `SCE_SNAP_TO_INCREMENT` if the snapping
wasn't enabled for the given transform mode.
This snapping mode is not supported in the Animation Editors though,
causing the snapping `switch` to fall back to `default` which is to do no snapping.
My assumption is that this mode also causes the increments in the transform.
It would be good to support that in the future,
but for now this is just a fix to get the 3.6 behavior back.
Pull Request: https://projects.blender.org/blender/blender/pulls/112088
Remove debug asserts that don't serve a clear purpose besides testing
something that's clear from the called code, and require accessing mesh
data just for asserts.
Change the behavior of transform and set-handle-type to operate on both
handles when the knot is selected.
This was an oversight in [0] which changed selection to select the knot
without the handles.
This makes curve bezier handles picking & transform match the Graph
Editor & grease pencil bezier curves.
This fixes issues transforming a bezier knot:
- Auto handles would be converted to "Aligned".
- Vector handles would be converted to "Free"
with the vector handles being left in-place.
Resolves#111840.
Details:
Selecting only the knot vertex was done because the tweak tool no longer
de-selects when picking an already selected vertex to allow tweak to be
used to transform the selection (instead of always de-selecting all
before tweaking). Without this change, dragging a single handle required
manually de-selecting the knot and the opposite handle (3 clicks to
select a handle before dragging). Selecting only the knot solves this
but means transform needs to support tweaking a vertex (& it's handles)
without it's handles selected.
See design #96544.
[0]: 618f39fca2
Selecting a gpencil bezier vertex and move it would change the handle
type when set to "Auto".
This happened because of a mismatch between transform flag use
and BKE_nurb_bezt_handle_test which would change the handle type
when only the vertex (knot) was selected.
Resolve by treating both handles as selected when the knot is selected.
Replace use_handles with an enum that optionally uses handles
except when the vertex (knot) is selected in which case it behaves
as if both handles are selected.
Needed for nurb curves not to change handle type when only the
center point is selected (as is done in the graph editor).
No functional changes.