Files
aego/schema/descriptor.go
T
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

185 lines
3.4 KiB
Go

package schema
import "unsafe"
type FieldFlags uint32
const (
FlagSerialize FieldFlags = 1 << iota
FlagEditor
FlagReadOnly
FlagTransient
FlagScript
FlagReplicated
FlagLive
FlagPersist
// FlagOmitEmpty keeps optional zero-valued fields absent from source files.
FlagOmitEmpty
)
func (f FieldFlags) Has(o FieldFlags) bool {
return f&o == o
}
type FieldDescriptor struct {
ID FieldID
Name string
Former []string
Kind Kind
Elem Kind
Struct TypeID
Enum []EnumValue
EnumName string
AssetKind string
Component string
Flags FieldFlags
Offset uintptr
Size uintptr
Fast bool
Direct bool
Unsigned bool
Min, Max float64
HasMin bool
HasMax bool
Hints EditorHints
Doc string
Default Value
HasDefault bool
Get func(p unsafe.Pointer, dst *Value)
Set func(p unsafe.Pointer, src Value) error
}
func (f *FieldDescriptor) EnumNameOf(v int64) (string, bool) {
for i := range f.Enum {
if f.Enum[i].Value == v {
return f.Enum[i].Name, true
}
}
return "", false
}
func (f *FieldDescriptor) EnumValueOf(name string) (int64, bool) {
for i := range f.Enum {
if f.Enum[i].Name == name {
return f.Enum[i].Value, true
}
}
return 0, false
}
type TypeKind uint8
const (
TypeComponent TypeKind = iota
TypeStruct
TypeAsset
TypeScript
)
type TemplateDesc struct {
ID string
Name string
Node string
Category string
Menu string
Icon string
Space SpaceKind
Owner string
Builtin bool
Setup any
}
type ScriptMethod struct {
Name string
Fn any
Bind any
Opts []any
}
type TypeDescriptor struct {
ID TypeID
FullName string
Former []string
Version uint32
Size uintptr
Kind TypeKind
Space SpaceKind
Doc string
Hidden bool
DisplayName string
// SearchAliases are display-name aliases only; they never rename serialized types.
SearchAliases []string
Category string
Icon string
NodeIcon int
Owner string
Builtin bool
SceneUnique bool
Requires []string
RequiresAny [][]string
Suggests []string
Conflicts []string
Default func() unsafe.Pointer
Template *TemplateDesc
ScriptFields []FieldID
ScriptMethods []ScriptMethod
Signals []SignalDesc
Inspector any
OnAdd any
OnRemoving any
OnChanged any
Validate any
Fields []FieldDescriptor
index map[string]int
byID map[FieldID]int
New func() unsafe.Pointer
Copy func(dst, src unsafe.Pointer)
Flat bool
CloneInto func(dst, src unsafe.Pointer)
CheckedLiterals bool
}
func (t *TypeDescriptor) Scripted(fd *FieldDescriptor) bool {
if t.ScriptFields == nil {
return fd.Flags.Has(FlagScript)
}
for _, id := range t.ScriptFields {
if id == fd.ID {
return true
}
}
return false
}
func (t *TypeDescriptor) Field(name string) (*FieldDescriptor, bool) {
i, ok := t.index[name]
if !ok {
return nil, false
}
return &t.Fields[i], true
}
func (t *TypeDescriptor) FieldByID(id FieldID) (*FieldDescriptor, bool) {
i, ok := t.byID[id]
if !ok {
return nil, false
}
return &t.Fields[i], true
}
func (t *TypeDescriptor) Serializable(fn func(*FieldDescriptor)) {
for i := range t.Fields {
if t.Fields[i].Flags.Has(FlagSerialize) {
fn(&t.Fields[i])
}
}
}
type SignalDesc struct {
Name string
Params []string
Names []string
Doc string
}