GPv3: Conversion: Add some support for GPData animation itself. #119214

Merged
Falk David merged 3 commits from mont29/blender:tmp-gp-anim-conversion into main 2024-03-28 13:52:32 +01:00

Handling animation of GPv3 in itself is relatively straightforward, it's
mainly a matter of duplicating animdata into the new GreasePencil ID.

In case some propoerties need to be remapped, this will be done in a
similar way as e.g. GP object's modifiers animation for Object-level
animation.

The complex and ugly part of this PR is in the need to move animation
from GPdata to Object level for some properties. This PR tackles the
'layer adjustments to modifiers' aspect (i.e. adjustments on tint and
thickness).

Known limitations currently with these GPData to Object animation:

  • NLA is not supported (i.e. if an NLA in legacy GP data controls these
    adjustments animations, it won't be converted to Object-level NLA to
    control matching modifiers settings).
  • Drivers targets are not handled either, i.e. in case a driver is using
    data from legacy GPdata as input, these will be left as-is (this is
    true for all anim handling currently).
  • There is no adjustments of values for animation (e.g. the thickness
    adjustment values would need to be devided by 2000).

Most of these limitations can be addressed at some point, depending on
how critical they are to support. This would have a cost (in time and
code complexity) though.

Handling animation of GPv3 in itself is relatively straightforward, it's mainly a matter of duplicating animdata into the new GreasePencil ID. In case some propoerties need to be remapped, this will be done in a similar way as e.g. GP object's modifiers animation for Object-level animation. The complex and ugly part of this PR is in the need to move animation from GPdata to Object level for some properties. This PR tackles the 'layer adjustments to modifiers' aspect (i.e. adjustments on tint and thickness). Known limitations currently with these GPData to Object animation: * NLA is not supported (i.e. if an NLA in legacy GP data controls these adjustments animations, it won't be converted to Object-level NLA to control matching modifiers settings). * Drivers targets are not handled either, i.e. in case a driver is using data from legacy GPdata as input, these will be left as-is (this is true for all anim handling currently). * There is no adjustments of values for animation (e.g. the thickness adjustment values would need to be devided by 2000). Most of these limitations can be addressed at some point, depending on how critical they are to support. This would have a cost (in time and code complexity) though.
Bastien Montagne added 1 commit 2024-03-08 17:31:57 +01:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
de26a69ce3
GPv3: Conversion: Add some support for GPData animation itself.
Handling animation of GPv3 in itself is relatively straightforward, it's
mainly a matter of duplicating animdata into the new GreasePencil ID.

In case some propoerties need to be remapped, this will be done in a
similar way as e.g. GP object's modifiers animation for Object-level
animation.

The complex and ugly part of this PR is in the need to move animation
from GPdata to Object level for some properties. This PR tackles the
'layer adjustments to modifiers' aspect (i.e. adjustments on tint and
thickness).

Known limitations currently with these GPData to Object animation:
* NLA is not supported (i.e. if an NLA in legacy GP data controls these
  adjustments animations, it won't be converted to Object-level NLA to
  control matching modifiers settings).
* Drivers targets are not handled either, i.e. in case a driver is using
  data from legacy GPdata as input, these will be left as-is (this is
  true for all anim handling currently).
* There is no adjustments of values for animation (e.g. the thickness
  adjustment values would need to be devided by 2000).

Most of these limitations can be addressed at some point, depending on
how critical they are to support. This would have a cost (in time and
code complexity) though.
Author
Owner

@blender-bot build

@blender-bot build
Bastien Montagne added this to the Grease Pencil project 2024-03-08 17:32:30 +01:00
Bastien Montagne requested review from Falk David 2024-03-08 17:32:38 +01:00
Falk David requested changes 2024-03-15 16:07:44 +01:00
Falk David left a comment
Member

Added some comments

Added some comments
@ -60,0 +61,4 @@
/* Utils to move a list of fcurves from one container (Action or Drivers) to another. */
static void legacy_fcurves_move(ListBase &fcurves_dst,
ListBase &fcurves_src,
blender::Vector<FCurve *> fcurves)
Member

Use const Span<FCurve *> fcurves since we only need to iterate over the fcurves.

Use `const Span<FCurve *> fcurves` since we only need to iterate over the fcurves.
filedescriptor marked this conversation as resolved
@ -502,0 +534,4 @@
* Note that currently, Actions IDs are not duplicated. They may be needed ultimately, but for
* the time being, assuming invalid fcurves/drivers are fine here. */
AnimData *gpd_animdata = BKE_animdata_from_id(&gpd.id);
if (gpd_animdata) {
Member

Could be written on a single line like this:

if (AnimData *gpd_animdata = BKE_animdata_from_id(&gpd.id)) {
   ...
}
Could be written on a single line like this: ```cpp if (AnimData *gpd_animdata = BKE_animdata_from_id(&gpd.id)) { ... } ```
filedescriptor marked this conversation as resolved
@ -627,0 +727,4 @@
return false;
}
StringRefNull rna_path = fcurve.rna_path;
for (auto prop_path : fcurve_tint_valid_prop_paths) {
Member

Same as below

Same as below
filedescriptor marked this conversation as resolved
@ -643,0 +786,4 @@
return false;
}
StringRefNull rna_path = fcurve.rna_path;
for (auto prop_path : fcurve_tint_valid_prop_paths) {
Member

You can unpack the values directly like so:

for (const auto &[from_prop_path, to_prop_path] : fcurve_tint_valid_prop_paths) {
You can unpack the values directly like so: ```cpp for (const auto &[from_prop_path, to_prop_path] : fcurve_tint_valid_prop_paths) { ```
filedescriptor marked this conversation as resolved
@ -675,0 +862,4 @@
return false;
}
StringRefNull rna_path = fcurve.rna_path;
for (auto prop_path : fcurve_thickness_valid_prop_paths) {
Member

Same as above

Same as above
filedescriptor marked this conversation as resolved
Falk David added 1 commit 2024-03-26 11:31:05 +01:00
Falk David added 1 commit 2024-03-26 11:31:57 +01:00
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-lint 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-coordinator Build done. Details
5bcef113de
Cleanup
Member

@blender-bot build

@blender-bot build
Falk David merged commit 71fd693d22 into main 2024-03-28 13:52:32 +01:00
Bastien Montagne deleted branch tmp-gp-anim-conversion 2024-03-29 03:10:15 +01: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
2 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#119214
No description provided.