Files
aego/engine/docs/export.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

107 lines
2.6 KiB
Go

//go:build !aego_runtime
package docs
import (
"errors"
"strconv"
)
const ExportVersion = 2
type Node struct {
ID string `json:"id"`
Children []Node `json:"children,omitempty"`
}
type GroupNav struct {
Group
Nav []Node `json:"nav"`
}
type Export struct {
Version int `json:"version"`
Title string `json:"title"`
Entries []Entry `json:"entries"`
Nav []Node `json:"nav"`
Groups []GroupNav `json:"groups"`
Problems []Problem `json:"problems"`
Aliases map[string]string `json:"aliases,omitempty"`
}
func (k Kind) MarshalText() ([]byte, error) {
return []byte(k.String()), nil
}
func (k *Kind) UnmarshalText(b []byte) error {
for i, n := range kindNames {
if n == string(b) {
*k = Kind(i)
return nil
}
}
return errors.New("unknown entry kind " + strconv.Quote(string(b)))
}
func (r *Registry) Export(title string) Export {
exp := Export{Version: ExportVersion, Title: title, Entries: r.All(), Problems: r.Check(false), Aliases: r.Aliases()}
for i := range exp.Entries {
hideChecks(&exp.Entries[i])
if loc, ok := r.trySources[exp.Entries[i].ID]; ok && exp.Entries[i].Try != "" {
source, err := r.exportTrySource(exp.Entries[i], loc)
if err != nil {
exp.Problems = append(exp.Problems, Problem{ID: exp.Entries[i].ID, Error: true, Message: "Try source project: " + err.Error()})
} else {
exp.Entries[i].TrySource = source
}
}
}
for _, e := range r.Roots() {
exp.Nav = append(exp.Nav, r.node(e.ID, 0))
}
exp.Groups = r.GroupNavigation()
return exp
}
// GroupNavigation builds the same grouped tree as Export without exporting
// every entry or running documentation diagnostics. The editor's reference
// panel only needs this tree; full exports still perform all checks.
func (r *Registry) GroupNavigation() []GroupNav {
var out []GroupNav
for _, g := range r.Groups() {
gn := GroupNav{Group: g}
for _, e := range r.GroupRoots(g.ID) {
gn.Nav = append(gn.Nav, r.node(e.ID, 0))
}
if len(gn.Nav) > 0 {
out = append(out, gn)
}
}
return out
}
func (r *Registry) node(id string, depth int) Node {
n := Node{ID: id}
if depth > 32 {
return n
}
for _, c := range r.Children(id) {
n.Children = append(n.Children, r.node(c.ID, depth+1))
}
return n
}
// hideChecks removes the check scenes from an exported entry and its translations, copying the map it changes.
func hideChecks(e *Entry) {
e.Body = HideChecks(e.Body)
if len(e.Translations) == 0 {
return
}
ts := make(map[string]Translation, len(e.Translations))
for l, t := range e.Translations {
t.Body = HideChecks(t.Body)
ts[l] = t
}
e.Translations = ts
}