Files
aego/scene/sceneio/unknown.go
T
sanspie f22242e5aa
ci / release (push) Successful in 5m5s
ci-platforms / build (amd64, windows, windows-2022) (push) Skipped
ci-platforms / build (arm64, darwin, macos-15) (push) Skipped
ci-platforms / build (amd64, darwin, macos-15-intel) (push) Skipped
ci / checks (push) Successful in 4m41s
ci / build (amd64, linux, ubuntu-24.04) (push) Successful in 7m14s
Stage 11g2–11g3: registry texts, CLI and the site in Russian (D348)
The remaining editor strings and undo step names; component, field, enum, setting, diagnostic and Script API texts under schema.*, enum.*, setting.*, diag.* and api.*; the launcher, the in-game Settings View with a Language setting, the CLI and aego schema show --lang. Every documentation page has a .ru.md translation; the site has a full Russian tree with hreflang, a language switch and ru/llms.txt; aego docs check --lang ru. New doc.tutorial and doc.recipe icons. Fix: an animator restored by a rewind prepares its controller before the replayed step.
2026-10-25 15:31:22 +03:00

63 lines
1.2 KiB
Go

package sceneio
import (
"aego/format/aetext"
"aego/scene"
"aego/schema"
)
type UnknownComponent struct {
TypeName string
Version int
Fields []aetext.Field
Blocks []*aetext.Node
}
type Unknown struct {
Components []UnknownComponent `aego:"-"`
}
func RegisterUnknown(t *scene.Types) error {
if err := scene.RegisterComponent[Unknown](t,
schema.Name("engine.Unknown"),
schema.Doc("Holds components whose type is not registered in this build."), schema.Clone(cloneUnknown)); err != nil {
return err
}
return RegisterPrefab(t)
}
func cloneUnknown(dst, src *Unknown) {
if src.Components == nil {
dst.Components = nil
return
}
dst.Components = make([]UnknownComponent, len(src.Components))
for i, c := range src.Components {
c.Fields = cloneFields(c.Fields)
c.Blocks = cloneNodes(c.Blocks)
dst.Components[i] = c
}
}
func cloneFields(fs []aetext.Field) []aetext.Field {
if fs == nil {
return nil
}
out := make([]aetext.Field, len(fs))
for i, f := range fs {
out[i] = aetext.Field{Name: f.Name, Value: f.Value.Clone(), Pos: f.Pos}
}
return out
}
func cloneNodes(ns []*aetext.Node) []*aetext.Node {
if ns == nil {
return nil
}
out := make([]*aetext.Node, len(ns))
for i, n := range ns {
out[i] = n.Clone()
}
return out
}