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
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.
176 lines
4.0 KiB
Go
176 lines
4.0 KiB
Go
package edit
|
|
|
|
import (
|
|
"errors"
|
|
"os"
|
|
|
|
"os/exec"
|
|
"path/filepath"
|
|
"runtime"
|
|
"strings"
|
|
|
|
"aego/app/bootstrap"
|
|
"aego/app/export"
|
|
"aego/app/projects"
|
|
"aego/asset/pipeline"
|
|
"aego/editor/core/services"
|
|
"aego/editor/core/sysopen"
|
|
"aego/engine/problems"
|
|
"aego/project"
|
|
)
|
|
|
|
type exporter struct {
|
|
preview webPreview
|
|
agentPreview webPreview
|
|
p *project.Project
|
|
pl *pipeline.Pipeline
|
|
engine string
|
|
dirtySources func() []string
|
|
}
|
|
|
|
func newExporter(p *project.Project, pl *pipeline.Pipeline, dirtySources func() []string) services.Exporter {
|
|
if pl == nil {
|
|
return nil
|
|
}
|
|
root, err := projects.EngineRoot("")
|
|
if err != nil {
|
|
return nil
|
|
}
|
|
return &exporter{p: p, pl: pl, engine: root, dirtySources: dirtySources}
|
|
}
|
|
|
|
func (x *exporter) Targets() []string {
|
|
return export.Targets()
|
|
}
|
|
|
|
func (x *exporter) Out(target, profile string) string {
|
|
t, err := export.ParseTarget(target)
|
|
if err != nil {
|
|
return ""
|
|
}
|
|
prof, err := export.ParseProfile(profile)
|
|
if err != nil {
|
|
return ""
|
|
}
|
|
return export.DefaultOut(x.p, t, prof)
|
|
}
|
|
|
|
func (x *exporter) Prepare() any {
|
|
snapshot := export.Take(x.pl)
|
|
if x.dirtySources != nil {
|
|
for _, rel := range x.dirtySources() {
|
|
switch strings.ToLower(filepath.Ext(rel)) {
|
|
case ".aemat", ".aeshader", ".glsl", ".vert", ".frag", ".meta", ".aepreset", ".aeart":
|
|
snapshot.DirtySources = append(snapshot.DirtySources, rel)
|
|
}
|
|
}
|
|
}
|
|
return snapshot
|
|
}
|
|
|
|
func (x *exporter) Check(prep any, profile string) []problems.Diagnostic {
|
|
snap, ok := prep.(*export.Snapshot)
|
|
if !ok {
|
|
return nil
|
|
}
|
|
prof, err := export.ParseProfile(profile)
|
|
if err != nil {
|
|
return nil
|
|
}
|
|
return export.Check(x.p, snap, prof, bootstrap.NeedsNative(x.p))
|
|
}
|
|
|
|
func (x *exporter) Export(prep any, req services.ExportRequest, progress func(float32, string)) (services.ExportReport, error) {
|
|
snap, _ := prep.(*export.Snapshot)
|
|
rep, err := export.Export(export.Options{
|
|
Project: x.p, Engine: x.engine, Target: req.Target, Profile: req.Profile, Out: req.Out,
|
|
Snapshot: snap, Progress: progress,
|
|
})
|
|
var out services.ExportReport
|
|
if rep != nil {
|
|
out = services.ExportReport{Out: rep.Out, Lines: rep.Lines(), Issues: rep.Diagnostics, Blocked: rep.Blocked}
|
|
}
|
|
return out, err
|
|
}
|
|
|
|
func (x *exporter) Reveal(path string) error {
|
|
var cmd *exec.Cmd
|
|
switch runtime.GOOS {
|
|
case "darwin":
|
|
cmd = exec.Command("open", path)
|
|
case "windows":
|
|
cmd = exec.Command("explorer", path)
|
|
default:
|
|
cmd = exec.Command("xdg-open", path)
|
|
}
|
|
return cmd.Start()
|
|
}
|
|
|
|
func (x *exporter) CloseAgentPreview() { x.agentPreview.close() }
|
|
func (x *exporter) Close() { x.preview.close(); x.CloseAgentPreview() }
|
|
|
|
func (x *exporter) RunVerified(out, target string, want [32]byte, valid func() bool) error {
|
|
if _, err := export.Launchable(x.p, target, out); err != nil {
|
|
return err
|
|
}
|
|
dir, err := export.VerifiedCopy(out, want)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
cleanup := func() { _ = os.RemoveAll(dir) }
|
|
if !valid() {
|
|
cleanup()
|
|
return errors.New("export request expired")
|
|
}
|
|
path, err := export.Launchable(x.p, target, dir)
|
|
if err != nil {
|
|
cleanup()
|
|
return err
|
|
}
|
|
t, _ := export.ParseTarget(target)
|
|
if t.Web() {
|
|
u, err := x.agentPreview.serve(path, cleanup, valid)
|
|
if err != nil {
|
|
cleanup()
|
|
return err
|
|
}
|
|
if err = sysopen.Open(u); err != nil {
|
|
x.agentPreview.close()
|
|
}
|
|
return err
|
|
}
|
|
var cmd *exec.Cmd
|
|
if t.OS == "darwin" {
|
|
cmd = exec.Command("open", "-W", path)
|
|
} else {
|
|
cmd = exec.Command(path)
|
|
cmd.Dir = filepath.Dir(path)
|
|
}
|
|
if err = cmd.Start(); err != nil {
|
|
cleanup()
|
|
return err
|
|
}
|
|
go func() { _ = cmd.Wait(); cleanup() }()
|
|
return nil
|
|
}
|
|
func (x *exporter) Run(out, target string) error {
|
|
path, err := export.Launchable(x.p, target, out)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
t, _ := export.ParseTarget(target)
|
|
switch {
|
|
case t.Web():
|
|
u, err := x.preview.serve(path, nil, nil)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return sysopen.Open(u)
|
|
case t.OS == "darwin":
|
|
return exec.Command("open", path).Start()
|
|
}
|
|
cmd := exec.Command(path)
|
|
cmd.Dir = filepath.Dir(path)
|
|
return cmd.Start()
|
|
}
|