Commit Graph

1492 Commits

Author SHA1 Message Date
Campbell Barton
b3dfde88f3 Cleanup: spelling in comments (check_spelling_* target)
Also uppercase acronyms: API, UTF & ASCII.
2025-05-17 10:17:37 +10:00
Philipp Oeser
d2ea328a6c Fix #138869: Select Colums on selected Keys fails in NLA tweakmode
Currently, `columnselect_action_keys` gets "raw" non-NLA-mapped keyframe
data via `ANIM_fcurve_keyframes_loop`  with the `bezt_to_cfraelem` callback,
so the list of `CfraElem` contains frames in "local" FCurve space.

Later, this would be (rightfully) NLA-unmapped to "local/strip" time, because
this is what `ANIM_editkeyframes_ok(BEZT_OK_FRAME)` expects, it also only
compares "raw" `BezTriple` data.

But this only makes sense if we would store "global/scene" frame data in
`CfraElem` `cfra` already.

This is what we now do, let `bezt_to_cfraelem` perform the NLATIME_CONVERT_MAP

Pull Request: https://projects.blender.org/blender/blender/pulls/138937
2025-05-16 17:21:42 +02:00
Guillermo Venegas
3b1e123361 Refactor: UI: Replace uiItemS and uiItemS_ex with uiLayout::separator
This merges the public `uiItemS` and `uiItemS_ex` functions into an
object oriented API (`uiLayout::separator`), matching the python API.
This reduces the difference between the C++ API with the python version,
its also helps while converting code from python to C++ code
(or vice-versa), making it almost seamless.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/138826
2025-05-13 17:54:26 +02:00
Guillermo Venegas
a017a6cc54 Refactor: UI: Replace uiItemO with class method uiLayout::op
This converts the public `uiItemO` function to an object oriented
API (`uiLayout::op`).
Also this rearranges `idname` paramether, since this the only one
required, and to make format similar to `uiItemFullO`

Note: One of the benefits of moving from a public function to class
method is to reduce API usage difference between C++ and Python. In
Python this method is called `UILayout::operator`, however `operator`
is a reserved keyword in C++.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/138776
2025-05-12 22:14:38 +02:00
Guillermo Venegas
dafdced6ab Refactor: UI: Replace uiItemR with class method uiLayout::prop
This converts the public `uiItemR` function to an object oriented
API (`uiLayout::prop`), matching the python API.
This reduces the difference between the C++ API with the python version,
its also helps while converting code from python to C++ code (or vice-versa),
making it almost seamless.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/138617
2025-05-08 20:45:37 +02:00
Jordan Henshaw
499eb133d7 Fix: Graph Editor with View Selected on 1 key
Expand the already-existing safety margin to correct for the implosion
scenario, by a factor of 100x. That way it doesn't zoom in too much,
and makes it easy for an animator to zoom out again if necessary.

Pull Request: https://projects.blender.org/blender/blender/pulls/138235
2025-05-08 17:21:39 +02:00
Guillermo Venegas
e5dcd0de99 Refactor: UI: Replace uiItemL with class method uiLayout::label
This converts the public `uiItemL` function to an object oriented
API (`uiLayout::label`), matching the python API.
This reduces the difference between the C++ API with the python version,
its also helps while converting code from python to C++ code (or vice-versa),
making it almost seamless.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/138608
2025-05-08 17:21:08 +02:00
Philipp Oeser
34050dc865 Fix #138423: Some drivers remain active after deleting single
Symptoms were drivers still being active while others seemingly
disabled. Indices in the RNA path up to the `ANIM_remove_driver` call
are correct, so it is not entirely clear to me why this goes wrong, but
forcing an update by tagging animation resolves the issue.

NOTE from @dr.sybren : Without this fix, the old copy-for-evaluation
is still there, which still has the driver (because it's a copy)

NOTE: seems we are not handling ND_FCURVES_ORDER anywhere?
Pull Request: https://projects.blender.org/blender/blender/pulls/138490
2025-05-06 17:46:52 +02:00
Guillermo Venegas
9e5151d294 Refactor: UI: Replace uiLayoutSplit with class method uiLayout::split
This converts the public `uiLayoutSplit` function to an object oriented
API (`uiLayout::split`), matching the python API.
This reduces the difference between the C++ API with the python version,
its also helps while converting code from python to C++ code (or vice-versa),
making it almost seamless.

`uiLayout::split` now returns an `uiLayout` reference instead of a pointer.
New calls to this method should use references too.

Pull Request: https://projects.blender.org/blender/blender/pulls/138361
2025-05-03 20:51:42 +02:00
Guillermo Venegas
5dc86dacda Refactor: UI: Replace uiLayoutBox with class method uiLayout::box
This converts the public `uiLayoutBox` function to an object oriented
API (`uiLayout::box`), matching the python API.
This reduces the difference between the C++ API with the python version,
its also helps while converting code from python to C++ code (or vice-versa),
making it almost seamless.

`uiLayout::box` now returns an `uiLayout` reference instead of a pointer.
New calls to this method should use references too.

Pull Request: https://projects.blender.org/blender/blender/pulls/138334
2025-05-02 19:46:26 +02:00
Campbell Barton
a37f2014fd Cleanup: sort CMake file lists 2025-05-01 12:16:00 +10:00
Guillermo Venegas
2d896877d1 Refactor: UI: Replace uiLayoutColumn with class method uiLayout::column
This converts the public `uiLayoutColumn` function to an object oriented
API (`uiLayout::column`), matching the python API.
This reduces the difference between the C++ API with the python version,
its also helps while converting code from python to C++ code (or vice-versa),
making it almost seamless.

`uiLayout::column` now returns an `uiLayout` reference instead of a pointer.
New calls to this method should use references too.

Pull Request: https://projects.blender.org/blender/blender/pulls/138034
2025-04-26 21:07:34 +02:00
Guillermo Venegas
90644b30b2 Refactor: UI: Replace uiLayoutRow with class method uiLayout::row
This converts the public `uiLayoutRow` function to an object oriented
API (`uiLayout::row`), matching the python API.
This reduces the difference between the C++ API with the python version,
its also helps while converting code from python to C++ code (or vice-versa),
making it almost seamless.

`uiLayout::row` now returns an `uiLayout` reference instead of a pointer.
New calls to this method should use references too.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/137979
2025-04-25 19:45:25 +02:00
Christoph Lendenfeld
9663d287fc Anim: merge keyframe jump operators
This merges the `GRAPH_OT_keyframe_jump` operator into the more generic
`SCREEN_OT_keyframe_jump` operator. (the former introduced with #108549)

The functionality of both operators is retained by running
a `switch/case` based on the editor type.
Doing so, we can filter out the Dope Sheet as well which fixes #93944
The `GRAPH_OT_keyframe_jump` is preserved, but when it is called,
it generates a warning stating it should not be used anymore.
It then calls directly into the `SCREEN_OT_keyframe_jump` to
ensure functionality doesn't drift apart.

Fixes #136176
Fixes #93944

Pull Request: https://projects.blender.org/blender/blender/pulls/137542
2025-04-24 18:01:05 +02:00
Brecht Van Lommel
fb2ba20b67 Refactor: Use more typed MEM_calloc<> and MEM_malloc<>
Pull Request: https://projects.blender.org/blender/blender/pulls/137822
2025-04-22 11:22:18 +02:00
Christoph Lendenfeld
145af8d45b Refactor: Add function to query editable Graph Editor curves
No functional changes intended.

This patch extracts functionality to get all `bAnimListElem`
that are editable in the Graph Editor
into a separate function so it can be re-used by other operators.
This makes it easy to ensure the same data is retrieved and
filter flags can't go out of sync.

Extracted from #135913
Part of: #135794

Pull Request: https://projects.blender.org/blender/blender/pulls/137142
2025-04-22 10:28:39 +02:00
Brecht Van Lommel
d061b00455 Refactor: Eliminate various unsafe memcpy and memset
Some of these already have warnings with clang-tidy, others are more
safe in case these structs get (copy) constructors in the future.

Pull Request: https://projects.blender.org/blender/blender/pulls/137404
2025-04-21 17:59:41 +02:00
Brecht Van Lommel
637c6497e9 Refactor: Use more typed MEM_calloc<>, avoid unnecessary size_t cast
Handle some cases that were missed in previous refactor. And eliminate
unnecessary size_t casts as these could hide issues.

Pull Request: https://projects.blender.org/blender/blender/pulls/137404
2025-04-21 17:59:41 +02:00
Campbell Barton
64f5dee6d7 Cleanup: spelling in comments (make check_spelling_*) 2025-04-17 12:06:12 +10:00
Campbell Barton
c49e6a7dd4 Cleanup: reference operators as symbols, spelling in comments 2025-04-15 15:22:53 +10:00
Harley Acheson
d6d6a7e36f Fix #137391: Do Not Restrict Marker Operations on Region Size
Remove the checks for region size in operator_markers_region_active as
that interferes too much. The only thing really interfering with
playhead movement when the area gets too narrow is MARKER_OT_select. So
this PR adds a new poll function for that in particular. That allows a
lot of simplification.

Pull Request: https://projects.blender.org/blender/blender/pulls/137399
2025-04-12 18:18:47 +02:00
Harley Acheson
0354136775 UI: Minimum Height for Timeline Marker Operations
When Timeline (and similar editors) is reduced to a just the height of
two headers you can still change the play head. Except if you have any
markers and then marker selection operator interferes. This PR sets a
minimum area height for marker operations. This minimum differs if you
hide the header.

Pull Request: https://projects.blender.org/blender/blender/pulls/137312
2025-04-12 01:38:14 +02:00
Sybren A. Stüvel
06231cc8b3 Fix #136830: When multiple F-Curves are marked as active, only one is drawn
When multiple F-Curves have the `FCURVE_ACTIVE` flag set, only one of them
was drawn in the graph editor.

Only one F-Curve should be marked with this flag, but that's not something
the datamodel enforces. Because of that, it apparently is possible to get
into a situation where multiple F-Curves are marked as such. They are now
all drawn properly.

Pull Request: https://projects.blender.org/blender/blender/pulls/137102
2025-04-07 17:48:38 +02:00
Campbell Barton
bcdcc3dbde Refactor: use enum types for event modifiers & types
Use enum types for event modifier and types,
`wmEventModifierFlag` & `wmEventType` respectively.

This helps with readability and avoids unintended mixing with other
types. To quiet GCC's `-Wswitch` warnings many `default` cases needed
to be added to switch statements on event types.

Ref !136759
2025-03-31 23:48:29 +00:00
Sybren A. Stüvel
6b62ec5b3a Fix #136736: Pasting keyframes broken when action groups are collapsed
Fix an issue where copy-paste of keyframes was broken when action groups
are collapsed. It was caused by the `ANIMFILTER_LIST_VISIBLE` filter
flag; removing it (as it was before the bug-introducing commit) resolved
the problem.

Pull Request: https://projects.blender.org/blender/blender/pulls/136768
2025-03-31 15:13:04 +02:00
Guillermo Venegas
6397a4fb9a Refactor: UI: Use typed enum class for eUIEmbossType enum
Part of incoming refactors in interface layout c++ code, this enables
forward declaring this enum type. Enum is renamed as `EmbossType` and
moved to `blender::ui` namespace. No user visible changes expected.

Pull Request: https://projects.blender.org/blender/blender/pulls/136725
2025-03-31 00:36:46 +02:00
Harley Acheson
13ef69dc6c UI: Remove Frame Stalk When Timelines Minimized
When various timeline-like editors are minimized to header size, also
remove the vertical stalk under the current frame indicator.

Pull Request: https://projects.blender.org/blender/blender/pulls/136698
2025-03-29 00:07:04 +01:00
Sybren A. Stüvel
a3fde92b54 Refactor: Replace WM_global_report() with BKE_report() in anim code
In the animation & armature editors, replace calls to
`WM_global_report()` with `BKE_report`, to ensure that the reports go to
the appropriate report list (and giving callers control over this).

There's one `WM_global_report()` call left, in
`ED_armature_bone_rename()`. That doesn't have a `ReportList` available,
so I left it as-is for now.

Pull Request: https://projects.blender.org/blender/blender/pulls/136261
2025-03-25 10:31:46 +01:00
Campbell Barton
d616c87d03 Cleanup: spelling in comments (make check_spelling_*) 2025-03-21 11:51:50 +11:00
Campbell Barton
10233e95dd Cleanup: use a typed enum for operator & gizmo callbacks
Callbacks: exec invoke & modal now use a typed enum wmOperatorStatus.

This helps avoid mistakes returning incompatible booleans or other
values which don't make sense for operators to return.

It also makes it more obvious functions in the WM API are intended
to be used to calculate return values for operator callbacks.

Operator enums have been moved into DNA_windowmanager_enums.h
so this can be used in other headers without loading other includes
indirectly.

No functional changes expected.

Ref !136227
2025-03-20 21:11:06 +00:00
Campbell Barton
bd06baf6e6 WM: rename WM_report* to WM_global_report*, note it's often bad practice
WM_report was originally added for special cases however new code
has been using this in operators for example, where reports should be
sent to the operator via BKE_report, so the caller can handle,
and so Python can catch the errors.

Rename the functions to make them less easily confused with BKE_report
and add a code-comment on why their use should be avoided.
2025-03-11 12:36:17 +11:00
Hans Goudey
d0a6189b50 Refactor: DRW: Centralize and clean up packed normals conversion
Move the code dealing with converting float3 to GPU normals
out of the vertex format header into a separate header. Use a
proper C++ namespace and remove duplication by only using
the more recently added C++ templated conversions.

Most of the diff comes from the removal of the indirect includes
from GPU_vertex_format.hh. A lot of files ended up mistakenly
depending on that.

Pull Request: https://projects.blender.org/blender/blender/pulls/134873
2025-02-24 16:08:30 +01:00
Julian Eisel
20ec789889 Merge branch 'blender-v4.4-release' 2025-02-18 14:15:28 +01:00
Julian Eisel
fa4026f2bf Revert "Fix #130372: Implements memory of the previous state of eSpace_Types."
This reverts commit afec64739a.

The commit introduces a regression where opening the Asset Browser opens
the File Browser instead, same for other editor sub-types, see
blender/blender#134630.
blender/blender!134642 proposes a different solution and reverts this,
which I prefer too. Better to the revert separately from trying a
different fix for the initial bug, makes reviewing easier too.
2025-02-18 14:09:42 +01:00
Hans Goudey
b4c9b3e87f Cleanup: Move transform editors module to C++ namespace
Pull Request: https://projects.blender.org/blender/blender/pulls/134701
2025-02-18 01:27:04 +01:00
Hans Goudey
568c791e22 Cleanup: Use StringRef for uiBut tooltips
And replace nullptr arguments for tooltips in UI button
creation functions with std::nullopt. Though the distinction
between "no tooltip" and "empty tooltip" doesn't seem to exist,
it seems safer to keep the distinction since it existed with null before.
2025-02-14 15:12:48 -05:00
Harley Acheson
83c94c6537 Merge branch 'blender-v4.4-release' 2025-02-13 09:46:08 -08:00
Fabricio Luis
afec64739a Fix #130372: Implements memory of the previous state of eSpace_Types.
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
2025-02-13 18:45:00 +01:00
Brecht Van Lommel
c7a33a62a2 Cleanup: Directly include DNA_userdef_types.h and BLI_listbase.h
Instead of relying on them being included indirectly.

Pull Request: https://projects.blender.org/blender/blender/pulls/134406
2025-02-12 23:01:08 +01:00
Campbell Barton
c3a80b5b19 Fix driver "Update Dependencies" doing nothing
Regression in [0] which disabled the functionality for an unrelated
change.

[0]: ba3f26fac5
2025-02-05 14:45:57 +11:00
Sybren A. Stüvel
2b5946da4e Anim: make copy-paste of keyframes slot-aware
Copy-paste of keyframes is now slot-aware. See [1] for the design.

[1]: https://developer.blender.org/docs/features/animation/tools/action-editor-copy-paste/

In short:

- Copy-paste still works broadly as it used to. Only the visible
  F-Curves are pasted into.
- Slot identifiers matter when copying from multiple slots. When
  copying from one slot, they don't.
- Selection of channels (either F-Curves or Slots) determines where
  keys get pasted into.
- Pasting will either copy from the slot with the same identifier
  (when identifiers matter), or paste whatever was copied (when they
  do not).
- If both F-Curves and slots are selected, only the selected F-Curves
  get pasted into, and slots without any selected F-Curves are ignored
  (i.e. target is only defined by selected F-Curves, or only by
  selected slots, never by a mixture).

Fixes #129690

Pull Request: https://projects.blender.org/blender/blender/pulls/133979
2025-02-04 16:12:57 +01:00
Sybren A. Stüvel
c7900cc905 Fix: #125354: Assert with box/lasso select in driver editor
The box/lasso select code called `evaluate_fcurve()` to evaluate the
driver F-Curve, which is not meant for drivers. It now calls
`evaluate_fcurve_only_curve()`, which is meant for this purpose (only
evaluates the F-Curve part of the F-Curve, and ignore the driver).

Pull Request: https://projects.blender.org/blender/blender/pulls/134042
2025-02-04 16:03:01 +01:00
Harley Acheson
f631607df4 UI: Status Bar Confirm Then Cancel
When displaying keymaps on the Status Bar we prefer to show Confirm and
then Cancel.  We have a few places where these are reversed
accidentally. This just makes these consistent with the rest.

Pull Request: https://projects.blender.org/blender/blender/pulls/133947
2025-02-03 01:17:12 +01:00
Brecht Van Lommel
3725fad82f Cleanup: Various clang-tidy warnings in editors
Pull Request: https://projects.blender.org/blender/blender/pulls/133734
2025-01-31 17:03:17 +01:00
Harley Acheson
46a418e7b5 UI: Status Bar Display for Key Blending
For all 12 items in the Graph Editor Key Blend menu, improve the
display of the status bar by using icons, state highlighting, etc.

Pull Request: https://projects.blender.org/blender/blender/pulls/133461
2025-01-30 18:49:26 +01:00
Sybren A. Stüvel
6d832ee5b3 Anim: refactor keyframe copy/paste code
Refactor the keyframe copy-paste code to prepare for supporting action slots.

This is a non-functional change, as the slots are stored but otherwise completely ignored. This way the refactor to the new data structure can be reviewed & tested before actually changing the behaviour.

Related: #129690
Pull Request: https://projects.blender.org/blender/blender/pulls/133497
2025-01-30 10:28:45 +01:00
Bastien Montagne
9c237af041 Refactor: RNA: add discrete suffix to RNA_pointer_create.
This is a noisy preliminary step to the 'RNA ancestors' change. The
rename helps clearly tell what each `pointer_create` function does.

Pull Request: https://projects.blender.org/blender/blender/pulls/133475
2025-01-24 16:45:32 +01:00
Campbell Barton
7e8dcf77db Cleanup: pass UnitSettings as a const reference 2025-01-08 21:22:45 +11:00
Christoph Lendenfeld
7636e6fca4 Fix #132182: Graph Editor slider increment having no visible effect
The issue was that the range for the time offset operator
was so large, that the 0.1 increment seemingly had no effect.
The solution is to add functionality to the slider to specify the increment step.
Since the time offset operator deals in frames it made sense to snap to whole numbers.

Also fixes #132187
For that the increment step has been chosen to allow for 10 steps in the slider range.

Pull Request: https://projects.blender.org/blender/blender/pulls/132554
2025-01-03 17:23:12 +01:00
Ray Molenkamp
5783950ac5 Revert: 0dc484f9cc bf_rna modernisation
This caused build errors on the docs builder, I can't seem to reproduce
locally, so revert for now and have another look at some point in the
future.

Sadly as these changes usually go, this took 5c515e26bb and
2f0fc7fc9f with it as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/132559
2025-01-02 19:56:24 +01:00