GPv3: Conversion: Initial animation handling. #118500

Merged
Bastien Montagne merged 5 commits from mont29/blender:tmp-gp-conversion-animation into main 2024-02-22 10:53:51 +01:00

Add generic handling of all potential FCurves, with custom callbacks to
perform the actual conversion (typically, some RNA paths will need to
be updated).

Currently implements only remapping of modifiers' animation.

This commit only handles Object-level animations, not sure whether
GreasePencil data also needs to be covered?

Add generic handling of all potential FCurves, with custom callbacks to perform the actual conversion (typically, some RNA paths will need to be updated). Currently implements only remapping of modifiers' animation. This commit only handles Object-level animations, not sure whether GreasePencil data also needs to be covered?
Bastien Montagne added 1 commit 2024-02-20 12:57:59 +01:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-linux-x86_64 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-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
e0794ee931
GPv3: Conversion: Initial animation handling.
Add generic handling of all potential FCurves, with custom callbacks to
perform the actual conversion (typically, some RNA paths will need to
be updated).

Currently implements only remapping of modifiers' animation.

This commit only handles Object-level animations, not sure whether
GreasePencil data also needs to be covered?
Bastien Montagne added this to the Grease Pencil project 2024-02-20 12:58:28 +01:00
Bastien Montagne requested review from Falk David 2024-02-20 12:58:39 +01:00
Bastien Montagne requested review from Hans Goudey 2024-02-20 12:58:39 +01:00
Author
Owner

@blender-bot build

@blender-bot build
Falk David requested changes 2024-02-20 13:12:59 +01:00
Falk David left a comment
Member

Thanks, I added some comments.

Thanks, I added some comments.
@ -6,6 +6,12 @@
* \ingroup bke
*/
#include <functional>
Member

I think we can use FunctionRef from BLI_function_ref.hh instead. Maybe @JacquesLucke can confirm? Any ideas?

I think we can use `FunctionRef` from `BLI_function_ref.hh` instead. Maybe @JacquesLucke can confirm? Any ideas?
Member
Have a look at this: https://developer.blender.org/docs/features/core/blenlib/functions/
Author
Owner

That doc does not really help me understanding why FunctionRef should be used here instead of std::function here?

That doc does not really help me understanding why `FunctionRef` should be used here instead of `std::function` here?
Member

It's cheaper:

  • never requires an allocation
  • is less expensive to call
  • essentially free to copy
It's cheaper: * never requires an allocation * is less expensive to call * essentially free to copy
mont29 marked this conversation as resolved
@ -7,2 +7,4 @@
*/
#include <functional>
#include <iostream>
Member

Looks like this include is not needed?

Looks like this include is not needed?
mont29 marked this conversation as resolved
@ -620,0 +696,4 @@
/* Convert animation data if needed. */
AnimData *anim_data = BKE_animdata_from_id(&object.id);
if (anim_data) {
auto modifier_path_update = [&](FCurve *fcurve) -> bool {
Member

I suppose this could be useful in other areas as well? I imagine that you just need the legacy_root_path and the new_rna_path to be different? Maybe I'm wrong...

I suppose this could be useful in other areas as well? I imagine that you just need the `legacy_root_path` and the `new_rna_path` to be different? Maybe I'm wrong...
Author
Owner

Yes it likely will, but would rather wait until we hit the case before factorizing this logic out into its own util.

Yes it likely will, but would rather wait until we hit the case before factorizing this logic out into its own util.
Member

Makes sense 👍

Makes sense 👍
Member

Makes sense 👍

Makes sense 👍
mont29 marked this conversation as resolved
Bastien Montagne added 1 commit 2024-02-20 14:14:21 +01:00
Bastien Montagne requested review from Falk David 2024-02-20 14:14:45 +01:00
Falk David approved these changes 2024-02-20 14:17:23 +01:00
Falk David left a comment
Member

Looks good to me.

Looks good to me.
Member

This commit only handles Object-level animations, not sure whether GreasePencil data also needs to be covered?

It's possible to e.g. animate the opacity or the position of a layer. I'm fine if this would be handled in a separate PR though.

> This commit only handles Object-level animations, not sure whether GreasePencil data also needs to be covered? It's possible to e.g. animate the opacity or the position of a layer. I'm fine if this would be handled in a separate PR though.
Hans Goudey reviewed 2024-02-20 15:02:56 +01:00
@ -40,3 +46,4 @@
namespace blender::bke::greasepencil::convert {
/**************************************************************************************************
Member

Might as well use doxygen syntax here like:

/* -------------------------------------------------------------------- */
/** \name Listener (Relative Motion), #zwp_relative_pointer_v1_listener
 *
 * These callbacks are registered for Wayland interfaces and called when
 * an event is received from the compositor.
 * \{ */
Might as well use doxygen syntax here like: ``` /* -------------------------------------------------------------------- */ /** \name Listener (Relative Motion), #zwp_relative_pointer_v1_listener * * These callbacks are registered for Wayland interfaces and called when * an event is received from the compositor. * \{ */
mont29 marked this conversation as resolved
@ -43,0 +52,4 @@
* These utils will call given callback over all relavant fcurves (also includes drivers, and
* actions linked through the NLA).
*
* Note that by using `std::bind`, it is possible to pass more contextual data to a specific
Member

std::bind doesn't seem to be used here

`std::bind` doesn't seem to be used here
Author
Owner

It's not in this patch no, but I would bet there will be cases where we cannot use a lambda and its captured variables?

It's not in this patch no, but I would bet there will be cases where we cannot use a lambda and its captured variables?
Member

I've never run into that situation before TBH. Not sure it makes sense to comment about that now before it's actually necessary.

I've never run into that situation before TBH. Not sure it makes sense to comment about that now before it's actually necessary.
mont29 marked this conversation as resolved
@ -620,0 +710,4 @@
const std::string new_rna_path = fmt::format(
"modifiers[\"{}\"]{}", new_md.name, rna_path.substr(int64_t(legacy_root_path.size())));
MEM_freeN(fcurve->rna_path);
fcurve->rna_path = BLI_strdup(new_rna_path.c_str());
Member

BLI_strdupn would avoid the need to recalculate the string length

`BLI_strdupn` would avoid the need to recalculate the string length
mont29 marked this conversation as resolved
Bastien Montagne added 2 commits 2024-02-20 15:28:19 +01:00
Bastien Montagne added 1 commit 2024-02-20 15:29:40 +01:00
Hans Goudey approved these changes 2024-02-20 15:48:54 +01:00
Bastien Montagne merged commit e850cca0a7 into main 2024-02-22 10:53:51 +01:00
Bastien Montagne deleted branch tmp-gp-conversion-animation 2024-02-22 10:53:54 +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
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#118500
No description provided.