Blockbench Reference Docs
    Preparing search index...

    AnimationCodecs serve as a way to bundle import and export functionality of a specific animation format in one place, that way completely different animation formats can be supported. When creating a new animation codec, add it to the respective ModelFormat as animation_codec.

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    compileAnimation?: (animation: Animation) => any

    Compile a specified animation into animation file content

    Type Declaration

      • (animation: Animation): any
      • Parameters

        • animation: Animation

          Animation to compile

        Returns any

        Compiled subpart of an animation file

    id: string
    importFile?: (file: FileResult, auto_loaded?: boolean) => void

    Given a file input, imports the animations from the file into the current project, while adding undo entries and handling other logic

    Type Declaration

      • (file: FileResult, auto_loaded?: boolean): void
      • Parameters

        • file: FileResult

          File to import

        • Optionalauto_loaded: boolean

          For specific formats, set to true if the file was automatically loaded instead of based on explicit user input

        Returns void

    loadFile?: (file: FileResult, animation_filter?: string[]) => void

    Load the animations from an animation file into the project. Not required on generic codecs

    Type Declaration

      • (file: FileResult, animation_filter?: string[]): void
      • Parameters

        • file: FileResult

          File to load

        • Optionalanimation_filter: string[]

          If specified, only animations with an ID in the list get imported

        Returns void

    multiple_per_file: boolean

    Set to true if multiple animations can be included per animation file

    pickFile?: () => void

    Opens a file picker to select and import animations using the codec

    reloadAnimation?: (animation: Animation) => void

    Reload a given animation from its file on disk

    saveAnimation?: (animation: Animation, save_as?: boolean) => void

    Save the specified animation to its file. If no file exists, or save_as is true, this can open a file save dialog

    Type Declaration

      • (animation: Animation, save_as?: boolean): void
      • Parameters

        • animation: Animation

          Animation to save

        • Optionalsave_as: boolean

          If true, pick a new location to save to

        Returns void

    codecs: Record<string, AnimationCodec>

    Methods

    • Parameters

      • Optionalanimation: AnimationItem

      Returns AnimationCodec