Files
sanspie 515f4ca1b3 Stage 11a: animation (D333–D340, D344, D354–D357)
Clips (.aeanim) and controllers (.aectrl) with importers, AnimationPlayer and Animator with crossfades, root motion and events on fixed steps, rewind support. Editor: Animation panel (dope sheet, curves, record, preview, trajectory), Animator panel, sprite sheet slicer and flipbooks, Programming workspace, export panel redesign. Motion 2D ledge climb. 11c: the component and Create palette.
2026-10-25 15:31:22 +03:00

39 lines
753 B
Go

package animedit
import (
"os"
"aego/asset/pipeline"
"aego/project"
)
type pipelineFiles struct {
p *pipeline.Pipeline
apply func(*pipeline.Batch)
}
// PipelineFiles reads clips from the project and reimports what it writes through apply.
func PipelineFiles(p *pipeline.Pipeline, apply func(*pipeline.Batch)) Files {
return pipelineFiles{p: p, apply: apply}
}
func (f pipelineFiles) Read(rel string) ([]byte, error) {
return os.ReadFile(f.p.Abs(rel))
}
func (f pipelineFiles) Write(rel string, data []byte) error {
if err := project.WriteAtomic(f.p.Abs(rel), data); err != nil {
return err
}
id, ok := f.p.Lookup(rel)
if !ok {
return nil
}
b, err := f.p.Reimport(id)
if err != nil {
return err
}
f.apply(b)
return nil
}