Files
aego/tools/artstudio/release/effect_templates.go
sanspie 50be5c04bc
ci-platforms / darwin amd64 smoke (push) Skipped
GitHub / linux amd64 native GitHub-hosted native CI: success
ci-platforms / windows amd64 smoke (push) Skipped
GitHub / windows amd64 native GitHub-hosted native CI: success
GitHub / darwin arm64 native GitHub-hosted native CI: success
GitHub / darwin amd64 native GitHub-hosted native CI: success
ci / checks (push) Failing after 1h21m34s
ci / native-authoring (push) Skipped
ci-platforms / darwin arm64 smoke (push) Skipped
github-native / gitea-pending (push) Skipped
github-native / darwin amd64 native (push) Skipped
github-native / linux amd64 native (push) Skipped
github-native / windows amd64 native (push) Skipped
github-native / darwin arm64 native (push) Skipped
github-native / gitea-result (push) Skipped
ci / build (amd64, linux, ubuntu-24.04) (push) Successful in 12m4s
ci / release (push) Skipped
Stage 12.5: Art Workspace and asset authoring
Add dockable Art tools, animation and previews, guarded asset workflows,
and the Web Asset Studio built on the shared Art Core. Expand English and
Russian documentation, interactive Try scenes, examples and editor icons.

Add audio waveform navigation, source analysis, guarded previews and a
browser Worker mixer. Preserve source changes and recovery with bounded
checks, and strengthen native, browser and interoperability CI.

Prepare version 0.12.5 and manually built native artifact candidates.
Fix the production site image demo build dependency.
Reuse immutable scene indices when capturing keyframes.
Wait for real Persist save/load completion in component tests.
Stabilize browser Game View captures outside pointer hover.
Aseprite interchange and persistent Audio EDL recovery remain limited;
the artifact workflow does not publish releases or change stable.
2026-11-15 10:37:50 +03:00

77 lines
2.5 KiB
Go

package main
import (
"bytes"
"fmt"
"image/png"
"os"
"path/filepath"
"strings"
"aego/art"
)
// The downloadable starters and thumbnails come from the same checked-in art
// documents used by both native New Effect and the Go/WASM New dialog.
func writeEffectTemplates(out, fixtures string) ([]effectTemplate, error) {
// Read the selected source tree, not bytes embedded in a builder executable
// that may have been compiled from another checkout.
entries, err := os.ReadDir(fixtures)
if err != nil {
return nil, err
}
found := make(map[string]bool)
for _, entry := range entries {
if !strings.HasSuffix(entry.Name(), art.SourceExtension) {
continue
}
id := strings.TrimSuffix(entry.Name(), art.SourceExtension)
if _, ok := art.EffectTemplateOf(id); !ok || !entry.Type().IsRegular() {
return nil, fmt.Errorf("unexpected effect template source %q", entry.Name())
}
found[id] = true
}
if len(found) != len(art.EffectTemplates()) {
return nil, fmt.Errorf("source tree does not contain the complete effect template catalog")
}
var result []effectTemplate
for _, item := range art.EffectTemplates() {
data, err := readBounded(filepath.Join(fixtures, item.ID+art.SourceExtension), maxFileBytes)
if err != nil {
return nil, err
}
doc, err := art.Decode(data, art.Limits{})
if err != nil {
return nil, err
}
info := doc.Info()
if info.Properties[art.EffectTemplateProperty] != item.ID {
doc.Close()
return nil, fmt.Errorf("effect template %q has a different document identity", item.ID)
}
frames := info.Frames
im, err := doc.Render(frames[len(frames)/2].ID, art.RenderOptions{})
doc.Close()
if err != nil {
return nil, err
}
var thumbnail bytes.Buffer
if err = png.Encode(&thumbnail, im); err != nil {
return nil, err
}
file, thumb := "templates/"+item.ID+"/start.aeart", "templates/"+item.ID+"/preview.png"
if err = writeNew(filepath.Join(out, filepath.FromSlash(file)), data); err != nil {
return nil, err
}
if err = writeNew(filepath.Join(out, filepath.FromSlash(thumb)), thumbnail.Bytes()); err != nil {
return nil, err
}
result = append(result, effectTemplate{example: example{
ID: item.ID, Version: 1, Title: map[string]string{"en": item.NameEN, "ru": item.NameRU},
Description: map[string]string{"en": "Editable flipbook with an Aego particle preset.", "ru": "Редактируемый flipbook с пресетом частиц Aego."},
File: file, Thumbnail: thumb, SHA256: digest(data), Bytes: len(data),
}, ParticlePreset: item.ParticlePreset})
}
return result, nil
}