Commit Graph

41 Commits

Author SHA1 Message Date
Nika Kutsniashvili
ede675705e UI: Reorganize 'Select' menus in editors
Reorganizes (and in some cases add missing operators to) all 'Select'
menus in all editors except 3D Viewport (done in a separate patch).

The goal of this change is to make menus as consistent as possible, and
to group & sort items according to a certain logic, which should be easy to
remember and users can always expect certain items to be always at same
place in every editor.

More details and images in the pull request.

Pull Request: https://projects.blender.org/blender/blender/pulls/121337
2024-05-13 16:27:23 +02:00
Campbell Barton
37475d252f Cleanup: use "use_" prefix for RNA boolean 2024-02-16 14:26:47 +11:00
Christoph Lendenfeld
446b92d2ce Anim: Graph Editor - automatically lock key translation to a single axis
When moving keys in the Graph Editor animators
usually only want to move them on one axis.
While this is possible in a few ways (G+X, or G + Middle Mouse Button click),
we could default the behavior to always lock on an axis.
This was suggested by Dreamworks animators during the
Animation & Rigging module meeting.
https://devtalk.blender.org/t/2024-01-26-animation-rigging-module-meeting/33081#patch-review-decision-time-5

This PR adds an option with which the movement is
always locked to a single axis by default.
The option can be found in the Graph Editor under "View->Auto-Lock Axis".

The movement will then be restricted to the axis along
which you've moved the cursor the most.
You can still manually override the lock behavior by pressing `X` or `Y`.

I am piggybacking off the auto locking feature you get when pressing the middle mouse button.
When the new feature is enabled I call that at the start of the transformation.
Except when:
* only handles are selected
* the tweak mode has been started on a handle

This is to not snap handles, which is a behavior that has
been requested by the artists.

Pull Request: https://projects.blender.org/blender/blender/pulls/117669
2024-02-06 23:31:09 +01:00
Nika Kutsniashvili
f2c8f31a3c UI: Add 'Channels' region toggle in animation editors
This way users can also assign shortcut to it or add it to quick favourites.

Pull Request: https://projects.blender.org/blender/blender/pulls/117837
2024-02-05 12:13:31 +01:00
Nika Kutsniashvili
5a0b50e0a6 Anim: Reorganize items in 'View' menus in animation and video editors
View menu in animation and video editors are too
different from each other and unorganized.
Same operators appear in different places in different editors.
That makes navigating them harder, because for example
you expect framing operators at the bottom because they're
at the bottom in graph editor, but they're at the top in Sequencer
and 3D Viewport. It's important that ordering of operators
match as well as possible, so that users can expect certain
operators in certain places and dont spend time searching
for buttons in messy menus.

I tried to match ordering to 3D viewport menu
as much as possible, and also to use separators right,
so that grouping of items is logical and can be shareable between editors.

This grouping also looks better and makes navigation easier,
because it splits huge pile of toggles at the top of the menus
in smaller chunks and puts operators between them,
so they're esier to separate them in one glance.

Split off from #116492

Pull Request: https://projects.blender.org/blender/blender/pulls/117162
2024-01-23 12:11:22 +01:00
Alexander Gavrilov
d0ef66ddff Drivers: implement fallback values for RNA path based variables.
As discussed in #105407, it can be useful to support returning
a fallback value specified by the user instead of failing the driver
if a driver variable cannot resolve its RNA path. This especially
applies to context variables referencing custom properties, since
when the object with the driver is linked into another scene, the
custom property can easily not exist there.

This patch adds an optional fallback value setting to properties
based on RNA path (including ordinary Single Property variables
due to shared code and similarity). When enabled, RNA path lookup
failures (including invalid array index) cause the fallback value
to be used instead of marking the driver invalid.

A flag is added to track when this happens for UI use. It is
also exposed to python for lint type scripts.

When the fallback value is used, the input field containing
the property RNA path that failed to resolve is highlighted in red
(identically to the case without a fallback), and the driver
can be included in the With Errors filter of the Drivers editor.
However, the channel name is not underlined in red, because
the driver as a whole evaluates successfully.

Pull Request: https://projects.blender.org/blender/blender/pulls/110135
2024-01-08 15:24:59 +01:00
Christoph Lendenfeld
b27718a9e7 Anim: Graph Editor Scale From Neighbor
Combination of two operators by Ares Deveaux
#106524 and #106523

Introduces a new operator "Scale from Neighbor"
that scales selected keyframe segments from either
the left or right keyframe neighbor.

Pressing "D" during modal operation will switch
from which end of the segment the scaling happens.

This is useful to make a section of animation closer to a pose on either side.

Co-authored-by: Ares Deveaux <aresdevo@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/112387
2023-12-21 10:46:43 +01:00
Christoph Lendenfeld
1e931f5bd7 Anim: Bake Channel operator
This is a replacement for the workflow that uses
"Bake Curve" and "Unbake Curve" to quickly generate
dense key data.

Compared to the existing workflow it has the advantage
of allowing the user more control over the key types,
and distance between keys, as well as the frame range affected.

Operator options

* Range: the range that will be baked.
Defaults to the scene range or preview range.

* Step: Distance between keyframes.
Can be used to bake on 2s or even bake to subframes.

* Remove Existing Keys: Boolean option that
if enabled also removes keys outside the specified baking range

* Interpolation Type: Choose a interpolation mode used
for new keys e.g. Constant or Bezier

* Bake Modifiers: If enabled bakes the effect of the
modifier stack to keys and deletes the modifier stack.
If false, the code disables the modifiers before baking,
so the resulting keys will behave as if the modifiers didn't exist

The operator can be found in the Graph Editor under `Channel->Bake Channels`

Part of: #111050

Pull Request: https://projects.blender.org/blender/blender/pulls/111263
2023-12-14 11:35:25 +01:00
Campbell Barton
6bd57e1f1f Cleanup: use static set for contains checks
Also replace contains check with equality for a single item.
2023-10-05 13:53:20 +11:00
Philipp Oeser
e781a3bfdb Anim: remove unused GRAPH_MT_channel_context_menu
Noticed GRAPH_MT_channel_context_menu is unused (since
DOPESHEET_MT_channel_context_menu is used in both Dopesheet & Graph/
Drivers Editor).

This patch removes GRAPH_MT_channel_context_menu but adds the entries
which were in that menu (but not in DOPESHEET_MT_channel_context_menu)
back to the later.

Namely:
- Hide Selected Curves
- Hide Unselected Curves
- Reveal Curves
- (Delete Invalid Drivers -- if in Drivers Editor)

Pull Request: https://projects.blender.org/blender/blender/pulls/111384
2023-09-27 09:29:44 +02:00
Nate Rupsis
8199132551 UI: Updating Animation Editors snapping from 'Modes' to no icon
Updates the animations editors (NLA, Dope Sheet, Graph editor) to have no icon instead of "Modes" (in absence of icon set).

Pull Request: https://projects.blender.org/blender/blender/pulls/112633
2023-09-26 20:28:57 +02:00
Pablo Vazquez
05fc31f27f UI: Remove redundant "Context Menu" in menu titles
Context menus are a type of menu, like header menus, there is no need to mention
the type as part of the name since it is implied by context.

Pull Request: https://projects.blender.org/blender/blender/pulls/112662
2023-09-25 16:25:55 +02:00
Christoph Lendenfeld
01927e1e45 Anim: Time Offset Slider
This patch has been originally authored by Ares Deveaux #106520
I am just finishing it up.

This is a new operator for the Graph Editor.
It shifts the value of the keys in time,
while keeping the actual key positions in the same place.
It supports wrapping, so when offsetting beyond the range
of the F-Curve it will take values from the other end,
but offset in y-value so there is no jump.

This works best with dense key data.

Co-authored-by: Ares Deveaux <aresdevo@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/110540
2023-09-21 15:11:16 +02:00
Nathan Vegdahl
be5cf8f8a1 Anim: add graph editor key/handles selection operator
This adds an operator `graph.select_key_handles` to the graph editor
that changes the selection of the different parts of a bezier keyframe.  It
operates on all keys that are either themselves selected or have either of
their handles selected, and changes whether the key itself and/or its handles
are selected.

The operator has three options:

- `left_handle_action`
- `right_handle_action`
- `key_action`

Each of which can be set to:

- Select
- Deselect
- Keep (do nothing)

Co-authored-by: cgtinker <Denys.Hsu@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/111143
2023-09-21 15:05:30 +02:00
Christoph Lendenfeld
25031f8a86 Anim: Graph Editor Push/Pull operator
This finishes the work that Ares Deveaux started here #106527

Scales the selected keys from an imaginary line that
runs from the start to the end of the segment.

Co-authored-by: Ares Deveaux <aresdevo@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/112388
2023-09-21 12:46:27 +02:00
Christoph Lendenfeld
614fe73712 Fix: Wrong operator call in Graph Editor menu
During the recent operator renames, the menu
entry for "Sound to Samples" was missed and
left as "graph.sound_bake"
This fixes it to be the correct "graph.sound_to_samples"
2023-09-12 10:51:29 +02:00
Christoph Lendenfeld
9e5e04e915 Animation: Rename Graph_OT_sample
After Renaming "Bake Curve" to "Samples to Keys" in #111049,
the name of the `GRAPH_OT_sample` operator needed renaming.
That is because the word "sample" is now used to describe FCurve
data in an uneditable state.

Rename to `GRAPH_OT_bake_keys` since baking is the term
used in animation to describe the action of creating dense key data.

Pull Request: https://projects.blender.org/blender/blender/pulls/112148
2023-09-12 09:32:18 +02:00
Christoph Lendenfeld
d3d19e8be9 Animation: Rename "Bake Curve" to "Keys to Samples"
Breaking change since the operator name changes.

Users have been confused about this for a long time.
The term "bake" in the context of animation usually means
to add keys at a given interval without changing the shape of the curve.

The fact that the curve isn't editable after baking was the main issue.

In order to stop the confusion the operator is renamed to "Keys to Samples"
to indicate that there is a conversion happening and that there are no keys afterwards.

The Un-Bake operator has also been changed to "Samples to Keys"

The operator description has been updated to mention that after the conversion
the data is no longer editable.

The "Bake Sound to F-Curves" has been renamed to "Create Samples from Sound"

Pull Request: https://projects.blender.org/blender/blender/pulls/111049
2023-09-08 14:01:47 +02:00
Christoph Lendenfeld
1a73039499 Animation: Scale Average slider for Graph Editor
This patch has been originally authored by Ares Deveaux #106526

Scale the selected key segments to their average
Unlike just scaling using the transform tools, this scales to the average of each individual F-Curve segment.

Co-authored-by: Ares Deveaux <aresdevo@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/111744
2023-09-08 13:07:30 +02:00
Christoph Lendenfeld
9d4edd3565 Cleanup: Make format 2023-09-05 14:23:54 +02:00
Christoph Lendenfeld
11fe57cab8 Animation: Move Snapping to Scene
Part of #91973

Moving the snapping code for the
* Graph Editor
* Action Editor
* and NLA editor

into the common system that lives on the scene.
This includes the Magnet icon for turning
snapping on and off.

The old settings translate to the new in the following way:
* `Frame Step` -> `Frame`
* `Second Step` -> `Second`
* `Nearest Frame` -> `Frame` + `Absolute Time Snap`
* `Nearest Second` -> `Second` + `Absolute Time Snap`
* `Nearest Marker` -> `Nearest Marker`

Since this moves the location of the snapping settings
from the editor to the scene, it changes the behavior.
Previously each editor could have different snapping
settings, where now they are all synced.

Pull Request: https://projects.blender.org/blender/blender/pulls/109015
2023-09-05 10:06:55 +02:00
Christoph Lendenfeld
9d0aed6589 Animation: Shear operator for Graph Editor
This is a combination of two PRs from Ares Deveaux: #106521 and #106522

This adds a new operator that allows shearing keys
based on the position of the segment ends.
By pressing `D` while the operator is in modal you can
switch if the operator takes the left or the right segment end as a reference.

Co-authored-by: Ares Deveaux <aresdevo@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/111735
2023-08-31 17:09:01 +02:00
Christoph Lendenfeld
bb8766ef01 Animation: Match Slope slider
It blends selected keys to the slope of neighboring ones.
It is used to push the segment closer to the values of the next or previous pose.

Co-authored-by: Ares Deveaux <aresdevo@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/110567
2023-08-17 10:28:46 +02:00
Campbell Barton
e955c94ed3 License Headers: Set copyright to "Blender Authors", add AUTHORS
Listing the "Blender Foundation" as copyright holder implied the Blender
Foundation holds copyright to files which may include work from many
developers.

While keeping copyright on headers makes sense for isolated libraries,
Blender's own code may be refactored or moved between files in a way
that makes the per file copyright holders less meaningful.

Copyright references to the "Blender Foundation" have been replaced with
"Blender Authors", with the exception of `./extern/` since these this
contains libraries which are more isolated, any changed to license
headers there can be handled on a case-by-case basis.

Some directories in `./intern/` have also been excluded:

- `./intern/cycles/` it's own `AUTHORS` file is planned.
- `./intern/opensubdiv/`.

An "AUTHORS" file has been added, using the chromium projects authors
file as a template.

Design task: #110784

Ref !110783.
2023-08-16 00:20:26 +10:00
Christoph Lendenfeld
8ddb8e0d05 Animation: Blend To Ease Slider
This PR blends the selected keyframes to an ease-in or ease-out curve.
The difference to the existing ease slider is that this one blends,
while the other snaps to the ease curve

Co-authored-by: Ares Deveaux <aresdevo@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/110566
2023-08-10 17:51:14 +02:00
Christoph Lendenfeld
a0aa5480b1 Animation: Blend Offset Slider
Adds an operator to the Graph Editor that moves the selected
segment up/down so it aligns with the keys before/after the segment.

Co-authored-by: Ares Deveaux <aresdevo@gmail.com>
Co-authored-by: Sybren A. Stüvel <sybren@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/110544
2023-08-10 16:09:39 +02:00
Christoph Lendenfeld
7acd6e61ab Animation: Butterworth Smoothing filter
Implements the Butterworth Filter
(https://en.wikipedia.org/wiki/Butterworth_filter) for smoothing FCurves.

This filter is ideal for smoothing dense data, like motion capture recordings.
It has the advantage of keeping the shape of the curve
intact while reducing minimal fluctuations.
The disadvantage is the impulse response has a twang,
meaning extreme spikes cause fluctuations to either side.

The implementation is based on the GPL code found here:
https://exstrom.com/journal/sigproc/dsigproc.html

In order to avoid phase shifting, the filter is run forward and backward,
effectively doubling the filter order.

The Redo panel offers the following options

* Frequency Cutoff: 0-n value, where 0 means it cuts everything
so the curve will become straight, the max value is the Nyquist frequency
and depends on the frame rate and the "Samples per Frame" option

* Filter Order: Higher values mean the frequency cutoff is steeper

* Samples per Frame: Before the filter is applied, the curve is resampled
at this interval to avoid errors when there are uneven spaces between frames.
If the keys are on subframes, e.g. a 60fps file in a 30fps scene, increase this value to 2

* Blend: 0-1 value to blend between the original curve and the filter result

* Blend In/Out: The number of frames at the start and end for which
to blend between the filtered and unfiltered curve.
This can help reduce any resulting jumps in the animation at the selection border

The operator can be called from the Key menu. (Key->Smooth->Butterworth Smooth)

Pull Request: https://projects.blender.org/blender/blender/pulls/106952
2023-07-13 09:10:42 +02:00
Campbell Barton
65f99397ec License headers: use SPDX-FileCopyrightText in all sources 2023-06-15 13:35:34 +10:00
Christoph Lendenfeld
e2a75814ac Animation: change Slider Popup menu hotkeys
Since the change in #106113 the Slider menu which was called with the D hotkey was no longer in any menu.
This made it really hard to discover.

Since there is now more than 1 menu popup, it needs more than 1 hotkey.
The idea is that the ALT key is used in combination with keys that are easy to reach with the left hand.
Right now it is ALT+S and ALT+D but if needed in the future it can be extended to f, w and e

Pull Request: https://projects.blender.org/blender/blender/pulls/107866
2023-05-26 09:03:08 +02:00
Campbell Barton
a85ad2d0eb Cleanup: remove f-string use, single quote enums 2023-05-15 20:58:00 +10:00
Germano Cavalcante
6b5b777ca3 UI: add Proportional Size to Proportional Edit popover
Rather than forcing the user to initiate a transform operation to edit the `Proportional Size`, allow editing of the `Proportional Size` through the UI.

The affected headers are:
- View 3D
- Dop Sheet
- Image Editor
- Graph Editor
- Mask Editor

Pull Request: https://projects.blender.org/blender/blender/pulls/107507
2023-05-04 16:39:22 +02:00
Christoph Lendenfeld
5e1470d1b3 Animation: Clean up "Key" menu in Graph Editor
* remove "Keyframe" label from the Key menu
* "Jump To Keyframe" -> "Jump to Selected"
* added a new menu "Density" with Decimate, Sample and Clean operators
* removed the "Clean Channels" entry. It does the same as the "Clean" operator but also removes channels IF the remaining keys are at the default value. The feature is still available in the redo panel
* Split the slider operators out by functionality
* Move Euler filter to Channel menu
* Remove "Add F-Curve modifier" from Key menu (it already is in the Channel menu)
* Move Bake/Unbake Curve functions to Channel menu
* Move "Bake Sound to FCurves" to Channel menu

Pull Request: https://projects.blender.org/blender/blender/pulls/106113
2023-05-04 14:10:27 +02:00
Campbell Barton
b0edd63752 Cleanup: avoid early imports, remove unused variable 2023-04-13 13:13:59 +10:00
Sybren A. Stüvel
d85520f297 Python: bl_ui_utils.layout.operator_context context manager
Introduce a context manager that temporarily overrides a UILayout's
operator context.

Instead of writing this:

```py
default_op_context = layout.context
layout.context = 'OTHER_VALUE'
layout.do_stuff()
layout.context = default_op_context
```

you can now write this:

```py
from bl_ui_utils.layout import operator_context

with operator_context(layout, 'OTHER_VALUE'):
    layout.do_stuff()
```

This is also exception-safe; it will always ensure the layout's operator
context is restored when the `with` body is exited, regardless of
whether that's done with an exception or regularly.

Idea in-the-hallway approved by @Sergey.
2023-04-07 11:34:48 +02:00
Christoph Lendenfeld
5d5027db03 Animation: Gaussian Smooth operator for Graph Editor
Add a Gaussian smoothing operator to supersede the current
smoothing operator in the graph editor.

Advantage over the current implementation:
* Supports modal operations
* Is independent of key density
* More options in the redo panel
* More predictable Impulse Response

Option in the redo panel to change

Filter Width: How far out on each side of a key the code checks
to average key values

Sigma: The shape of the bell curve, lower values make a sharper bell curve
reducing the smoothing effect.
Too High values will make the code behave like an average filter as the
curve in the -1/1 range will almost be flat.

On a technical note, the operator needs to store additional data when running in modal
to avoid allocating/deallocating data on every modal run.
For that reason the `tGraphSliderOp` struct has been extended with
`void *operator_data` and `void (*free_operator_data)(void *operator_data)`.
The former is the data and the latter is a function responsible for freeing that data.

Pull Request: https://projects.blender.org/blender/blender/pulls/105635
2023-03-24 12:11:20 +01:00
Sybren A. Stüvel
097492b326 Merge remote-tracking branch 'origin/blender-v3.5-release' 2023-03-13 15:24:19 +01:00
Sybren A. Stüvel
6e4bcb7c87 Fix #100659: "Add F-Curve Modifier" applies only to Active F-Curve
In most places where it appears in a menu, the operator would already
apply to all selected F-Curves. Now it is done consistently and explicitly
from all menu items. The default of the operator is now also set to 'all
selected', so that it also behaves like that when called from the operator
search menu.
2023-03-13 15:23:57 +01:00
Christoph Lendenfeld
3b900048f1 Animation: Move Graph Editor settings to User Preferences
Move two settings that were previously in the "View" menu of the Graph Editor into User Preferences.

It has been mentioned in the meeting by Luciano Muñoz Sessarego that it would be good to move that to the preferences so you can set it once and then forget about it.

The Settings moved are:

    Only Selected Curve Keyframes
    Use High Quality Display

Pull Request: https://projects.blender.org/blender/blender/pulls/104532
2023-03-09 14:15:23 +01:00
Christoph Lendenfeld
8756671084 Animation: Add Slider operators to hotkey menu
Before that patch, the slider operators for the Graph Editor are not easily accessible since they don't have a hotkey.
This adds the "d" hotkey for the already existing slider operator menu.

Using the popup menu means that your last used operator will always be under the cursor, so it's quick to access.

Pull Request #104530
2023-02-23 09:29:18 +01:00
Sergey Sharybin
ecb88eff7e Merge branch 'blender-v3.5-release' 2023-02-21 16:41:47 +01:00
Sergey Sharybin
03806d0b67 Re-design of submodules used in blender.git
This commit implements described in the #104573.

The goal is to fix the confusion of the submodule hashes change, which are not
ideal for any of the supported git-module configuration (they are either always
visible causing confusion, or silently staged and committed, also causing
confusion).

This commit replaces submodules with a checkout of addons and addons_contrib,
covered by the .gitignore, and locale and developer tools are moved to the
main repository.

This also changes the paths:
- /release/scripts are moved to the /scripts
- /source/tools are moved to the /tools
- /release/datafiles/locale is moved to /locale

This is done to avoid conflicts when using bisect, and also allow buildbot to
automatically "recover" wgen building older or newer branches/patches.

Running `make update` will initialize the local checkout to the changed
repository configuration.

Another aspect of the change is that the make update will support Github style
of remote organization (origin remote pointing to thy fork, upstream remote
pointing to the upstream blender/blender.git).

Pull Request #104755
2023-02-21 16:39:58 +01:00