Animation & Rigging
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Rationale: Animation-hook-up Pointer Direction The [animation data model from the 2023 workshop](https://code.blender.org/2023/07/animation-workshop-june-2023/#Data-Model) proposed that `Animation` datablocks and `ID`s get hooked up with a bidirectional pointer relationship (`ID <—> Animation`). The `ID` would point to an `Animation` datablock to use it, and the `Animation` datablock's outputs would point back at `ID`s to determined which output an `ID` uses when attached. Sybren, Nathan, and Bastien recently revisited this, and came to the conclusion that a unidirectional approach with just the `ID` pointing to the `Animation` datablock (`ID —> Animation`) would probably be better. (There is also a third option, unidirectional `Animation -> ID`. That was not explored.) Below is a summary of the two approaches we discussed, the trade offs we identified, and our rationale for choosing the unidirectional `ID —> Animation` model. ## The Two Models :::info Note: the diagrams below only show the minimum parts relevant to this discussion, and do not represent the complete data model. See the [workshop blog post for the full data model](https://code.blender.org/2023/07/animation-workshop-june-2023/#Data-Model). ::: ### 1. Bidirectional: ID <—> Animation #### ID pointers as output identifiers: ```mermaid classDiagram direction LR class ID { Animation* anim ... } class Animation { list~OutputIdentifier~ outputs list~Layer~ layers } class Layer { list strips } class KeyframeStrip { map[OutputIdentifier → array~AnimChannel~] channels } class AnimStrip { Animation *reference; map[OutputIdentifier → OutputIdentifier] output_mapping } class OutputIdentifier { ID * id_pointer string fallback_string } ID --> Animation Animation --> ID Animation --> Layer Layer --> KeyframeStrip Layer --> AnimStrip KeyframeStrip --> ID AnimStrip --> ID ``` The bidirectional model uses `ID` pointers as the primary identifier for animation outputs. The original model from the workshop put these `ID` pointers only at the top-level, in the list of outputs in the `Animation` datablock. For everything else internally, it then used indices into that list. However, during prototyping it was discovered that using indices everywhere internally isn't feasible, because when the output list changes, the indices change. For example, removing the first output in the list would offset all the other output indices by one. Within the `Animation` datablock itself that wouldn't be an issue: the code that removes outputs can just update the indices in all the strips as well. But output indices in that design are also used to map outputs between `Animation` datablocks in `AnimStrip`s, which can't be so easily found and updated. And in some library linking situations it would be *impossible* to update them. So to make the bidirectional model work, `ID` pointers must be used essentially everywhere that outputs are identified. This is reflected in the diagram above. Additionally, a fallback string is necessary to identify outputs when there is no associated `ID` yet. This could happen with imported animations, for example. So the complete `{ID, fallback_string}` pair needs to be carried around everywhere, and kept up-to-date everywhere. This is also reflected in the diagram. (Another solution would be to still use indices in `KeyframeStrips`, but use full `OutputIdentifer`s at data interface boundaries like `AnimStrip`s. This doesn't affect the trade offs discussed further below, however, and would mean that different strip types identify outputs in different ways.) ### 2. Unidirectional: ID —> Animation #### Stable indices as output identifiers: ```mermaid classDiagram direction LR class ID { Animation* anim OutputIdentifier anim_output ... } class Animation { int stable_index_counter set~OutputIdentifier~ outputs list~Layer~ layers } class Layer { list strips } class KeyframeStrip { map[output_stable_index → array~AnimChannel~] channels } class AnimStrip { Animation *reference; map[output_stable_index → output_stable_index] output_mapping } class OutputIdentifier { int stable_index String name } ID --> Animation Animation --> Layer Layer --> KeyframeStrip Layer --> AnimStrip ``` This variant of the unidirectional model was born from the observation that the above `ID`-pointer-based model actually *can* use simple indices (including at data interface boundaries) if those indices are *stable*. The idea of stable indices is as follows: store the top-level output list as a map instead of an array, with integers as the keys. Those integers are handed out by an incrementing counter in the `Animation` datablock. No integer is ever reused within the same `Animation` datablock, and the integer associated with an output never changes. Those integers are the "stable output indices". With that design, using indices into the output list as originally planned works fine. However, once you've gone that far, **the indices themselves become a stable identifier of the outputs**, and can just be used directly for everything. To make that work, `ID`s also store which output index they're using in addition to a pointer to the `Animation` datablock they're using. This model is the result of doing that. ## Commonalities Both models assume that all outputs also have a name or fallback string. In both models, these strings should be unique within the outputs of the `Animation` datablock. In the case of the bidirectional model, this is because the string serves as a backup identifier if the `ID` pointer is null (e.g. imported animation that isn't hooked up to anything yet). In the case of the unidirectional model, this is because it serves as the *display* identifier in the UI (and possibly the *Python API* identifier as well), because—much like raw `ID` pointer values—the stable indices won't be meaningful to the user. During discussion we also realized that these strings could be used strategically by productions if `ID`s also contain a corresponding user-settable animation output string. For example, both a proxy and full character rig could store the string "Frankie", and all `Animation` datablocks would set the string for that character's output to "Frankie" as well. Then the animation can be automatically hooked up correctly regardless of whether it's the proxy or full rig. This would work for both the bidirectional and unidirectional models. ## Trade Offs ### Swapping `Animation` Datablocks A handy feature of the current `Action` system is that it's easy to swap out `Action`s on an `ID`. This is relevant to both animator workflows and to production pipelines. Both the bidirectional and unidirectional model support this. However, the new data model supports animation for multiple `ID`s in a single `Animation` datablock, which introduces the new challenge of swapping out an `Animation` datablock on multiple `ID`s at once. Observations: * In the bidirectional model, outputs know what `ID` they're for, which makes it easier to swap out `Animation` datablocks on `ID`s en mass, without having to manually reconnect each `ID` to the right output. * However, this doesn't help when the `ID`s involved aren't the original `ID`s. This comes up in production when the models in the animation file are proxies, but the models in the lighting file are the full-res versions. * As discussed in the "Commonalities" section above, by using the output name/fallback strings, we get most of the benefits of `ID`-based reconnecting while also being more flexible for production. * Swapping is also used by animators for managing different "takes". However, for that use case we plan to have a takes system within the `Animation` datablock anyway, which is both more flexible and makes it unnecessary to swap `Animation` datablocks. In practice this seems like a toss-up, since the (apparently) best solutions to this problem are independent of the bidirectional vs unidirectional decision. ### Fancy Features Eventually we want to have features like animation-level constraints, mid-animation-swappable control rigs, simulation layers, etc. Observations: * In the bidirectional model, the `Animation` datablock has insight into what `ID`s it's animating. This would be valuable in implementing such fancy features, which in general need to know this kind of information. * However, for the unidirectional model this information could be provided by a run-time data structure. And run-time data structures will likely be necessary for fancy features even with the bidirectional model. For example, for maintaining evaluation dependencies. The specifics of how this will play out are still quite fuzzy and unknown. But it seems likely that there are ways forward regardless of the bidirectional vs unidirectional decision, and that the primary challenges won't be due to this decision. ### Output Connection Validation When outputs and/or `ID`s are removed, the connections between them need to be invalidated and updated. Observations: * In the bidrectional model we can take advantage of the existing `ID` management infrastructure for this, because `ID` pointers are used as the output identifiers. Whereas in the unidirectional model we need to manage this ourselves with new code. * The unidirectional model doesn't have to deal with the `ID` removal case *at all*, since nothing in the `Animation` datablock references `ID`s, and all connection data is stored in the `ID`. Whereas the bidirectional model has to deal with both `ID` and output removal. The unidirectional model is conceptually simpler here (fewer cases that need validation in the first place), but may also require writing more custom code. ### Connecting Library-linked `Animation` and `ID`s In production workflows, `Animation` datablocks are often linked from animation blend files, and hooked up to sometimes different `ID`s (e.g. full-res characters and props) in the lighting file. This means that both the `Animation` and the `ID` are library-linked assets, and need to be hooked up. Observations: * In the bidirectional model, both the `ID` *and* `Animation` datablock have to be overridden to connect them to each other, because the `ID` pointers in the `Animation` datablock also have to be changed. * In the unidirectional model, only the `ID` needs to be overridden, and it's very straightforward/low-complexity. This is a clear advantage in favor of the unidirectional model. ### Connection Stability In the same library-linked `Animation` and `ID` situation described above, what happens to the animation in the lighting file when the outputs in the animation file change? Observations: * Example: an animator completely deletes the output used by a character or prop to start over. * In the bidirectional model, even if an output is completely removed and recreated in the animation file, the connection in the lighting file remains stable because the `ID` connected to it remains the same. * In the unidirectional model, the connection in the lighting file is lost because the original output no longer exists, and it's the stable index of that output that defined the connection. * Example: an animator swaps out a temporary stand-in prop with the final one. * In the bidirectional model, the connection in the lighting file is lost because the `ID` pointer of the output changes. * In the unidirectional model, the connection in the lighting file remains stable because the output's stable index doesn't change. * With the output name/fallback string set appropriately, automated re-hooking up of broken connections is possible with both the bidirectional and unidirectional models. The trade off here is basically that in the bidirectional model *what the output is attached to* in the animation file determines the attachment in the lighting file, whereas in the unidirectional model *the output itself* is stable and determines the connection. Both approaches have failure cases, but the latter seems *probably* easier to understand and more straightforward from a UX perspective. And we need to provide good tooling/solutions for the failure cases either way. ### Connecting Multiple `ID`s to an Output With `Action`s it's trivial to connect multiple `ID`s to the same animation data: you just assign the same `Action` to multiple `ID`s. The unidirectional model keeps this very simple: you just assign the same `Animation` datablock and output index to multiple `ID`s. The bidirectional model, on the other hand, makes this more complex. Outputs need to store a *list* of `ID` pointers, corresponding to all connected `ID`s. And that, in turn, raises further questions that need to be answered. For example, which `ID` pointer (or do all of them?) identifies the output when library linking and overrides are involved? These aren't unanswerable questions, but they become design tasks themselves, with their own trade offs to make. Arguably, *directly* connecting multiple `ID`s to the same `Animation` datablock output (as opposed to doing so via e.g. an intermediate `AnimStrip`) might not be super useful. But it is a capability of the current animation system that would be good to preserve if we reasonably can, even if for no other reason than having an easy upgrade path for old animation data. ### Suzanne Principle As far as we know, there is nowhere else in Blender that uses bidirectional `ID` pointers to specify a single connection between `ID`s. There is a clear unidirectional flow of all `ID` connections in Blender. This makes the bidirectional model a departure from the current norm in Blender. Whereas the unidirectional model is consistent with the existing data models already present in Blender. This doesn't mean we should be afraid to break from current Blender norms. But we *should* have a good justification for it if we do. ## Decision We have decided to use the `ID -> Animation` unidirectional model with stable indices. For all of the trade offs we identified and explored, the unidirectional model was either better than or (nearly) on par with the bidirectional model. Additionally, it seems to generally be simpler and provide more straightforward answers to secondary design questions.

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully