Fix #118509: Grease Pencil frames no longer disappearing while being transformed in the timeline #119337

Merged
Lukas Tönne merged 5 commits from amelief/blender:gpv3-fix-disappearing-frames into main 2024-04-09 16:44:44 +02:00

While selecting and transforming multiple grease pencil frames in the timeline, frames would sometimes disappear.
This happened when the transformation overlapped, meaning when a frame replaced another moving one in the timeline.
The frames transformation was happening in place and in series, and thus leaded to the initial position
of the frame to be removed, even if it was occupied by a freshly transformed framed.

This commit fixes the issue by storing two separate maps in the transform data structure instead of one,
one map to store the static data, meaning the frames that are not affected by the transform,
and another one for the moving data, meaning the frames that are affected by the transform.

Some changes were made to account for the potential duplication of the frames (move + duplicate) :

  • the map of the duplicated frames was renamed to a more explicit name,
  • when a duplication occurs, the original frame is stored in the static frames map,
    and the duplicate is stored in the moving frames map,
  • thus the check for the duplicate flag of the operator is now done at the
    init step of the transform, instead of the update step, so that the maps are initialized accordingly.
While selecting and transforming multiple grease pencil frames in the timeline, frames would sometimes disappear. This happened when the transformation overlapped, meaning when a frame replaced another moving one in the timeline. The frames transformation was happening in place and in series, and thus leaded to the initial position of the frame to be removed, even if it was occupied by a freshly transformed framed. This commit fixes the issue by storing two separate maps in the transform data structure instead of one, one map to store the static data, meaning the frames that are not affected by the transform, and another one for the moving data, meaning the frames that are affected by the transform. Some changes were made to account for the potential duplication of the frames (move + duplicate) : * the map of the duplicated frames was renamed to a more explicit name, * when a duplication occurs, the original frame is stored in the static frames map, and the duplicate is stored in the moving frames map, * thus the check for the duplicate flag of the operator is now done at the init step of the transform, instead of the update step, so that the maps are initialized accordingly.
Amélie Fondevilla added 3 commits 2024-03-11 18:14:38 +01:00
Amélie Fondevilla added this to the Grease Pencil project 2024-03-11 18:14:43 +01:00
Amélie Fondevilla requested review from Lukas Tönne 2024-03-11 18:15:01 +01:00
Amélie Fondevilla requested review from Falk David 2024-03-11 18:15:01 +01:00
Hans Goudey changed title from Fix #118509 : Grease Pencil frames not longer disappearing while being transformed in the timeline to Fix #118509: Grease Pencil frames not longer disappearing while being transformed in the timeline 2024-03-11 20:17:42 +01:00
Amélie Fondevilla changed title from Fix #118509: Grease Pencil frames not longer disappearing while being transformed in the timeline to Fix #118509: Grease Pencil frames no longer disappearing while being transformed in the timeline 2024-03-12 09:03:07 +01:00
Falk David approved these changes 2024-03-13 17:52:39 +01:00
Falk David left a comment
Member

Thanks! Code looks ok to me. Also gave this a quick test and it works well 👍

Thanks! Code looks ok to me. Also gave this a quick test and it works well 👍
Member

I managed to make it crash, looks like the issue with invalidated drawing_index is still around.
Steps:

  1. make a bunch of keyframes
  2. scale keyframes so they collapse onto the same frames
  3. translate keyframes until they overlap the current frame
I managed to make it crash, looks like the issue with invalidated `drawing_index` is still around. Steps: 1. make a bunch of keyframes 2. __scale__ keyframes so they collapse onto the same frames 3. __translate__ keyframes until they overlap the current frame
Falk David reviewed 2024-03-20 10:51:19 +01:00
Falk David left a comment
Member

While talking with @LukasTonne about this we agree that it might be better to switch out the runtime Map representation for one that just uses two Arrays (an array for the sorted keys and one for the values/frames). That would likely make it possible to deal with duplicate keys on the same frame gracefully. I'll look at this again when I have more time to come up with a design.

While talking with @LukasTonne about this we agree that it might be better to switch out the runtime `Map` representation for one that just uses two `Array`s (an array for the sorted keys and one for the values/frames). That would likely make it possible to deal with duplicate keys on the same frame gracefully. I'll look at this again when I have more time to come up with a design.
Member

@amelief I'll continue working on this, hope you don't mind!

@amelief I'll continue working on this, hope you don't mind!
Author
Member

Thank you @LukasTonne , I don't mind at all.

Thank you @LukasTonne , I don't mind at all.
Member

Ok, so it turned out there are actually two independent issues here, one them fixed by this PR and the other by #120433:

  • The disappearing keyframes during transform are fixed here. This is not, however, causing a crash by itself.
  • The remove_drawings_with_no_users function was broken when removing more than one drawing (e.g. when scaling down a range of keyframes). This is what causes the invalid drawing indices and is fixed by #120433.

Thanks for working on this! It should be fine as is. I will update the branch with current main, do a test run and finish it.

Ok, so it turned out there are actually two independent issues here, one them fixed by this PR and the other by #120433: - The disappearing keyframes during transform are fixed here. This is not, however, causing a crash by itself. - The `remove_drawings_with_no_users` function was broken when removing more than one drawing (e.g. when scaling down a range of keyframes). This is what causes the invalid drawing indices and is fixed by #120433. Thanks for working on this! It should be fine as is. I will update the branch with current main, do a test run and finish it.
Lukas Tönne added 2 commits 2024-04-09 16:17:58 +02:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
7375d13b80
Merge branch 'main' into gpv3-fix-disappearing-frames
Lukas Tönne approved these changes 2024-04-09 16:18:22 +02:00
Member

@blender-bot build

@blender-bot build
Lukas Tönne merged commit d0d4bf2068 into main 2024-04-09 16:44:44 +02:00
Sign in to join this conversation.
No reviewers
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
Interest: X11
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
No Assignees
3 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#119337
No description provided.