Implementation: Modal Key Manipulation Operators #81785

Closed
opened 2020-10-16 22:54:41 +02:00 by Christoph Lendenfeld · 26 comments

Status: Implement generic slider


Description
Big picture:
Blender already has the pose sliding tools, that allow you to interactively create breakdowns in Pose mode.
It uses a modal operator and the mouse cursor to interactively set the pose. Using the same interaction, we could add similar functionality to the graph editor to manipulate multiple keyframes.

Use cases:

  • During animation when using the graph editor and trying to change multiple keyframes.

Design:

Engineer plan:
In order to implement the new operators efficiently there is some cleanup work to do

  • Create a new file for all the keyframe operators to live in and move GRAPH_OT_decimate in there
  • Extract functions from GRAPH_OT_decimate into generic functions that can be shared between all new operators
  • Implement a generic slider that calculates the percentage based on cursor position
    Then implement all new operators, with each new operator being a new patch.

Issues

  • Bezier keyframes with free or aligned tangent handles cause problems where the tangent handles don't follow the keyframe. Might be related to #81813
  • Use LISTBASE_FOREACH when iterating through lists. There are a lot of places where this could be used. Refactor at the end.
  • Decimate/Sample can be combined on one slider "Key Density"

Work plan

Cleanup

  • The sliding functionality should only exist once in code. At the moment it does exist in the pose sliding tools and also for the keyframe decimate operator. Maybe also in different areas that I haven’t found yet.
  • All the keyframe operators will work on selection and most of them on keyframe segments (a segment being a continuous selection of keyframes) Some operators already calculate segments, but I think this would be better in a function as well.
  • Make it easy to implement new operators, that will share a lot of functionality
  • Phase 1 (Moving code around. Commits are independent)

  • D9312 Break up graph_edit.c. This file is scraping the 4000 lines and if I recall correctly that is the limit for files defined in the docs.

  • D9313 Create editors/util/ed_draw.c as the place in which the generic slider will be located

  • Phase 2 (Implement generic slider)

  • D9314 Implement generic slider as it currently is in Blender

  • D11878 Change color of slider to make proper use of theme

  • D11883 Remove auto hiding when using the pose sliding tools

  • D9361 Change GRAPH_OT_decimate to use the generic slider

  • D12024 Fix hiding bones instantly when hitting 'H'

  • Phase 3 (Refactoring Code. Dependent on Phase 1 and dependent on patches coming before)

  • D12486 D12487 D12489 D12490 Extract helper functions from GRAPH_OT_decimate so they can be reused for future ops

  • D9326 Implement generic ´invoke´, ´modal´ and ´exec´ for GRAPH_OT_decimate

  • D9360 Function to calculate keyframe selection segments in keyframes_general.c

  • D13476 Renames

  • D13477 fix one line

Implement keyframe manipulation operators

  • D13531 create function to get segment list
  • D9374 Blend to neighbour (blend to left or right keyframe from currrent keyframe value)
  • D9375 Tween (similar to Pose Slide Breakdowner but for keyframes)
  • D9376 Blend to default
  • D9477 Smooth (There is a smooth operator already, but it would be better if it is interactive)
  • D9478 Sample keyframes (Decimate already exists, but the other way is useful as well)
  • D9479 Ease (Align keyframe segments in a gamma curve that either favors the left or the right key)

Improvements

  • TODO Change Generic slider to make use of keymap
  • TODO Cleanup code to use const as much as possible (graph_slider_ops: remove_ratio)
  • TODO Move code that throws a warning to invoke of the decimate OP
  • TODO Refactor ..._draw_status_header to use common code

UI and UX
Once all operators are implemented it is time for user testing. Apart from general feedback I'd like to test multiple ways of calling the tools:

  • Floating panel like the quick favorites panel. This would scale quite well, but it is not as fast or intuitive as pie menus. An option to improve that would be to add hotkeys to the entries.
  • Embedded in a pie menu. This would make a lot of them accessible with only one hotkey. However I think the pie menu would be quite crowded and if more operators get added where would we put them?
  • I will definitely put them in a menu in the graph editor, but I think this is just for discoverability. They are not easy to access there. However the hotkeys will be listed there as well for the user to discover.
  • An idea by @LucianoMunoz is that there would be a dropdown to choose the active slider, which can then be called with just a hotkey
  • D9512 add operators to menu and pie menu
**Status:** `Implement generic slider` --- **Description** **Big picture:** Blender already has the pose sliding tools, that allow you to interactively create breakdowns in Pose mode. It uses a modal operator and the mouse cursor to interactively set the pose. Using the same interaction, we could add similar functionality to the graph editor to manipulate multiple keyframes. **Use cases**: * During animation when using the graph editor and trying to change multiple keyframes. **Design:** * #81836 **Engineer plan:** In order to implement the new operators efficiently there is some cleanup work to do * Create a new file for all the keyframe operators to live in and move `GRAPH_OT_decimate` in there * Extract functions from `GRAPH_OT_decimate` into generic functions that can be shared between all new operators * Implement a generic slider that calculates the percentage based on cursor position Then implement all new operators, with each new operator being a new patch. **Issues** * Bezier keyframes with *free* or *aligned* tangent handles cause problems where the tangent handles don't follow the keyframe. Might be related to #81813 * Use LISTBASE_FOREACH when iterating through lists. There are a lot of places where this could be used. Refactor at the end. * Decimate/Sample can be combined on one slider "Key Density" **Work plan** **Cleanup** * The sliding functionality should only exist once in code. At the moment it does exist in the pose sliding tools and also for the keyframe decimate operator. Maybe also in different areas that I haven’t found yet. * All the keyframe operators will work on selection and most of them on keyframe segments (a segment being a continuous selection of keyframes) Some operators already calculate segments, but I think this would be better in a function as well. * Make it easy to implement new operators, that will share a lot of functionality - [x] Phase 1 (Moving code around. Commits are independent) - [x] [D9312](https://archive.blender.org/developer/D9312) Break up `graph_edit.c`. This file is scraping the 4000 lines and if I recall correctly that is the limit for files defined in the docs. - [x] [D9313](https://archive.blender.org/developer/D9313) Create `editors/util/ed_draw.c` as the place in which the generic slider will be located - [x] Phase 2 (Implement generic slider) - [x] [D9314](https://archive.blender.org/developer/D9314) Implement generic slider as it currently is in Blender - [x] [D11878](https://archive.blender.org/developer/D11878) Change color of slider to make proper use of theme - [x] [D11883](https://archive.blender.org/developer/D11883) Remove auto hiding when using the pose sliding tools - [x] [D9361](https://archive.blender.org/developer/D9361) Change `GRAPH_OT_decimate` to use the generic slider - [x] [D12024](https://archive.blender.org/developer/D12024) Fix hiding bones instantly when hitting 'H' - [x] Phase 3 (Refactoring Code. Dependent on Phase 1 and dependent on patches coming before) - [x] [D12486](https://archive.blender.org/developer/D12486) [D12487](https://archive.blender.org/developer/D12487) [D12489](https://archive.blender.org/developer/D12489) [D12490](https://archive.blender.org/developer/D12490) Extract helper functions from `GRAPH_OT_decimate` so they can be reused for future ops - [x] [D9326](https://archive.blender.org/developer/D9326) Implement generic ´invoke´, ´modal´ and ´exec´ for `GRAPH_OT_decimate` - [x] [D9360](https://archive.blender.org/developer/D9360) Function to calculate keyframe selection segments in `keyframes_general.c` - [x] [D13476](https://archive.blender.org/developer/D13476) Renames - [x] [D13477](https://archive.blender.org/developer/D13477) fix one line **Implement keyframe manipulation operators** - [x] [D13531](https://archive.blender.org/developer/D13531) create function to get segment list - [x] [D9374](https://archive.blender.org/developer/D9374) Blend to neighbour (blend to left or right keyframe from currrent keyframe value) - [x] [D9375](https://archive.blender.org/developer/D9375) Tween (similar to Pose Slide Breakdowner but for keyframes) - [x] [D9376](https://archive.blender.org/developer/D9376) Blend to default - [ ] [D9477](https://archive.blender.org/developer/D9477) Smooth (There is a smooth operator already, but it would be better if it is interactive) - [ ] [D9478](https://archive.blender.org/developer/D9478) Sample keyframes (Decimate already exists, but the other way is useful as well) - [x] [D9479](https://archive.blender.org/developer/D9479) Ease (Align keyframe segments in a gamma curve that either favors the left or the right key) **Improvements** - [ ] TODO Change Generic slider to make use of keymap - [ ] TODO Cleanup code to use const as much as possible (graph_slider_ops: remove_ratio) - [ ] TODO Move code that throws a warning to invoke of the decimate OP - [ ] TODO Refactor ..._draw_status_header to use common code **UI and UX** Once all operators are implemented it is time for user testing. Apart from general feedback I'd like to test multiple ways of calling the tools: * Floating panel like the quick favorites panel. This would scale quite well, but it is not as fast or intuitive as pie menus. An option to improve that would be to add hotkeys to the entries. * Embedded in a pie menu. This would make a lot of them accessible with only one hotkey. However I think the pie menu would be quite crowded and if more operators get added where would we put them? * I will definitely put them in a menu in the graph editor, but I think this is just for discoverability. They are not easy to access there. However the hotkeys will be listed there as well for the user to discover. * An idea by @LucianoMunoz is that there would be a dropdown to choose the active slider, which can then be called with just a hotkey - [x] [D9512](https://archive.blender.org/developer/D9512) add operators to menu and pie menu
Christoph Lendenfeld self-assigned this 2020-10-16 22:54:41 +02:00
Author
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Author
Member

Added subscriber: @ChrisLend

Added subscriber: @ChrisLend
Contributor

Added subscriber: @RedMser

Added subscriber: @RedMser
Christoph Lendenfeld changed title from New Graph Editor Key Manipulation Operators to Implementation: Modal Key Manipulation Operators 2020-10-20 14:42:42 +02:00
Author
Member

Added subscriber: @LucianoMunoz

Added subscriber: @LucianoMunoz
First-time contributor

This issue was referenced by 1f09dcc121

This issue was referenced by 1f09dcc121ab31fe08c76947820ed59ec8f76788
Member

Added subscriber: @wbmoss_dev

Added subscriber: @wbmoss_dev
First-time contributor

This issue was referenced by fdb2c24c09

This issue was referenced by fdb2c24c097d9a4613493659533863efc3c6f809
First-time contributor

This issue was referenced by fafd21b14c

This issue was referenced by fafd21b14c2337c2a5ca580d444d05cb1bb92566
First-time contributor

This issue was referenced by 6a903d9088

This issue was referenced by 6a903d90887848803decd5242e25df5d24f85970
First-time contributor

This issue was referenced by adbafe3b43

This issue was referenced by adbafe3b43d6131c74d96128b23ed24ae904d487
First-time contributor

This issue was referenced by a06abbac92

This issue was referenced by a06abbac92f2029269375ced69a2c4f75ecce5e1
First-time contributor

This issue was referenced by 1b6daa871d

This issue was referenced by 1b6daa871da9acc7c17aae9965633a4da604ba63
First-time contributor

This issue was referenced by b2e9f35c5e

This issue was referenced by b2e9f35c5eb21f63f5c20e06e910ef03965556ce
First-time contributor

This issue was referenced by 6986b43b3d

This issue was referenced by 6986b43b3d2d633fe4bf3be96d0da474cc6ba333
First-time contributor

This issue was referenced by 3364a5bea6

This issue was referenced by 3364a5bea6c977069210c3325111dc28051ee1cb
First-time contributor

This issue was referenced by 6b4405d757

This issue was referenced by 6b4405d7579da65c35d8f9424440d58002aa1f9c
First-time contributor

This issue was referenced by d5920744f4

This issue was referenced by d5920744f4429423e89a56112ede8a8ea87ccbbb
First-time contributor

This issue was referenced by ae6f3056fc

This issue was referenced by ae6f3056fcb4d0b952b2c55abdb505d51725ca05
First-time contributor

This issue was referenced by b1696702cd

This issue was referenced by b1696702cdb74c2b6d7c8c3f9d204f108607a8ab
First-time contributor

This issue was referenced by 8e31e53aa0

This issue was referenced by 8e31e53aa0ee9693582ad5b72cfe5732b57c72fd
First-time contributor

This issue was referenced by 9085b4a731

This issue was referenced by 9085b4a731fd5315eb97c00fc4bbf7c163698ebc
First-time contributor

This issue was referenced by f7ddb1ed8a

This issue was referenced by f7ddb1ed8a2a646e3d04d5e2e46929673084149c
First-time contributor

This issue was referenced by b626edd751

This issue was referenced by b626edd751d64b269da12ef8e774ced2836c3c9e
First-time contributor

This issue was referenced by 37b93b5df8

This issue was referenced by 37b93b5df85c9e7acac989c86cf658bf8a0bc1e5
First-time contributor

This issue was referenced by 76a68649c1

This issue was referenced by 76a68649c1c1f3db28b069397c71daf10f1c4ea4
Philipp Oeser removed the
Interest
Animation & Rigging
label 2023-02-09 14:36:09 +01:00
Author
Member

Work continues in #106639

Work continues in #106639
Blender Bot added
Status
Archived
and removed
Status
Confirmed
labels 2023-04-14 09:44:19 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#81785
No description provided.