editor

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2026 License: MIT Imports: 85 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildProject

func BuildProject(options BuildOptions) (artifact string, resultErr error)

func CheckModuleProject

func CheckModuleProject(directory string) (*project.ProjectPlan, error)

CheckModuleProject performs the same checks without changing generated files.

func CreateModuleProject

func CreateModuleProject(directory string, options project.CreateProjectOptions) (*project.ProjectPlan, error)

CreateModuleProject supplies the local engine dependency for independent projects. Projects inside an existing Go module keep that module unchanged.

func GenerateModuleProject

func GenerateModuleProject(directory string) (*project.ProjectPlan, error)

GenerateModuleProject validates source boundaries and signatures before replacing generated files. The user's entry and behavior sources are read only.

func Run

func Run(directory string) error

Types

type BuildArchitecture

type BuildArchitecture string
const (
	BuildArchitectureUniversal BuildArchitecture = "universal"
	BuildArchitectureAMD64     BuildArchitecture = "amd64"
	BuildArchitectureARM64     BuildArchitecture = "arm64"
)

type BuildMode

type BuildMode string
const (
	BuildModeDebug   BuildMode = "debug"
	BuildModeRelease BuildMode = "release"
)

type BuildOptions

type BuildOptions struct {
	Progress      func(BuildProgress)
	AppName       string
	JavaPackage   string
	Mode          BuildMode
	PackageFormat BuildPackageFormat
	Architecture  BuildArchitecture
	Backend       render.Backend
	// Icon is only used when a project does not declare window.icon.
	Icon          string
	Platform      BuildPlatform
	ProjectDir    string
	AndroidSDK    string
	AndroidNDK    string
	WebTitle      string
	WeChatAppID   string
	AndroidMinSDK int
}

func DefaultBuildOptions

func DefaultBuildOptions(projectDir string) BuildOptions

type BuildPackageFormat

type BuildPackageFormat string
const (
	BuildPackagePortable BuildPackageFormat = "portable"
	BuildPackageApp      BuildPackageFormat = "app"
	BuildPackageDMG      BuildPackageFormat = "dmg"
	BuildPackageMSI      BuildPackageFormat = "msi"
)

type BuildPlatform

type BuildPlatform string
const (
	BuildPlatformWindows BuildPlatform = "windows"
	BuildPlatformMacOS   BuildPlatform = "macos"
	BuildPlatformLinux   BuildPlatform = "linux"
	BuildPlatformAndroid BuildPlatform = "android"
	BuildPlatformIOS     BuildPlatform = "ios"
	BuildPlatformWeb     BuildPlatform = "web"
	BuildPlatformWeChat  BuildPlatform = "wechat"
)

type BuildProgress

type BuildProgress struct {
	Message       string
	Value         float32
	Indeterminate bool
}

BuildProgress reports completed work within build phases. Indeterminate marks work whose remaining amount the tool cannot measure.

type DataPreview

type DataPreview struct {
	Scene    project.SceneID
	Local    project.ModID
	Items    []PreviewItem
	Revision uint64
	// contains filtered or unexported fields
}

func (*DataPreview) Sync

func (p *DataPreview) Sync(w *WorkspaceDocument, local project.ModID)

type DevelopmentBuild

type DevelopmentBuild struct {
	ProjectImportPath string
	OverlayPath       string
	ExecutableDir     string
	ResourceDir       string
	// contains filtered or unexported fields
}

DevelopmentBuild contains the generated resource package and Go overlay used to compile a project directly from the repository.

func PrepareDevelopmentBuild

func PrepareDevelopmentBuild(projectDir string, progress func(BuildProgress)) (DevelopmentBuild, error)

PrepareDevelopmentBuild preprocesses and packages a project for the command-line builder. The caller owns the returned build and must call Cleanup when the child process exits. Pass nil to disable resource progress.

func (DevelopmentBuild) Cleanup

func (build DevelopmentBuild) Cleanup() error

Cleanup removes generated development resources and the Go overlay.

type DocumentID

type DocumentID string

DocumentID is the project-relative file that owns an edit and its undo state.

type DocumentPatch

type DocumentPatch struct {
	Pointer string
	Value   json.RawMessage
	Remove  bool
}

type ModDocument

type ModDocument struct {
	Plan     *project.ModPlan
	ID       project.ModID
	Spec     project.ModSpec
	Revision uint64

	Dirty   bool
	Deleted bool
	// contains filtered or unexported fields
}

type ModuleEditor

type ModuleEditor struct {
	Document *WorkspaceDocument

	Selected string

	Local project.ModID

	Preview DataPreview
	// contains filtered or unexported fields
}

ModuleEditor edits module definitions and scene instances without running project behavior.

func NewModuleEditor

func NewModuleEditor(directory string) (*ModuleEditor, error)

func (*ModuleEditor) ResolveHTMLImage

func (a *ModuleEditor) ResolveHTMLImage(name string, width, height float32) (*graphics.Texture, bool)

type ModuleMigrationIssue

type ModuleMigrationIssue struct {
	File    string `json:"file"`
	Element string `json:"element,omitempty"`
	Reason  string `json:"reason"`
}

type ModuleMigrationReport

type ModuleMigrationReport struct {
	Source string                 `json:"source"`
	Output string                 `json:"output"`
	Issues []ModuleMigrationIssue `json:"issues,omitempty"`
	Ready  bool                   `json:"ready"`
}

func MigrateModuleProject

func MigrateModuleProject(source, output string) (ModuleMigrationReport, error)

MigrateModuleProject writes a reviewable draft to a new, separate directory. Scripts, controls and external entity bindings become explicit report items; they are never silently retained as runtime compatibility code.

type NagaShaderCompiler

type NagaShaderCompiler struct{}

NagaShaderCompiler compiles WGSL with the pure Go gogpu/naga package.

func (NagaShaderCompiler) CompileShader

type PreviewItem

type PreviewItem struct {
	ID              string
	Mod             project.ModID
	Parent          int32
	Placement       mgl32.Mat4
	Content         mgl32.Mat4
	Visible         bool
	Enabled         bool
	Revision        uint64
	ContentRevision uint64
}

PreviewItem is pure authoring data. No module registry, events, requests or Go behavior is installed by the editor. Placement ancestors exclude mod locals.

type SceneDocument

type SceneDocument struct {
	Plan     *project.ScenePlan
	ID       project.SceneID
	Spec     project.SceneSpec
	Revision uint64
	Dirty    bool
}

type TextureTarget

type TextureTarget uint8

TextureTarget selects the block-compressed format family a build encodes project textures into. It mirrors ShaderTarget: the project stays platform-neutral and the build resolves one native format per platform, so a single manifest ships to every store.

const (
	// TextureTargetSource keeps source images uncompressed.
	TextureTargetSource TextureTarget = iota
	// TextureTargetBC targets desktop GPUs, where D3D, Vulkan, and Metal all
	// sample the BC family.
	TextureTargetBC
	// TextureTargetASTC targets mobile GPUs that expose ASTC.
	TextureTargetASTC
)

func (TextureTarget) Encodable

func (target TextureTarget) Encodable() bool

Encodable reports whether this build can actually encode the target.

func (TextureTarget) String

func (target TextureTarget) String() string

type WorkspaceDocument

type WorkspaceDocument struct {
	Scenes map[project.SceneID]*SceneDocument
	Mods   map[project.ModID]*ModDocument

	Plan   *project.ProjectPlan
	Active project.SceneID

	ProjectDir string
	Files      []WorkspaceFile

	Spec project.ProjectSpec

	Revision uint64
	// contains filtered or unexported fields
}

WorkspaceDocument loads the new format exclusively. Files and plans are retained; idle frames never read or rediscover the project.

func LoadWorkspaceDocument

func LoadWorkspaceDocument(directory string) (*WorkspaceDocument, error)

func (*WorkspaceDocument) Absolute

func (w *WorkspaceDocument) Absolute(file string) string

func (*WorkspaceDocument) AddElement

func (w *WorkspaceDocument) AddElement(mod project.ModID) (string, error)

AddElement appends a private element to the module definition with the first unused elementN name. The new ID is returned so callers can report it.

func (*WorkspaceDocument) AddInstance

func (w *WorkspaceDocument) AddInstance(id string, mod project.ModID, parent string) error

func (*WorkspaceDocument) AddResource

func (w *WorkspaceDocument) AddResource(mod project.ModID, kind, file string) (string, error)

AddResource declares a file that already lives inside the module directory, keyed by a name derived from its filename and suffixed when that name is taken.

func (*WorkspaceDocument) CopyMod

func (w *WorkspaceDocument) CopyMod(source, target project.ModID) error

CopyMod clones the complete private directory layout, including mod.go. It never rewrites main.go; registration of a new behavior is a build-stage task.

func (*WorkspaceDocument) CreateFolder

func (w *WorkspaceDocument) CreateFolder(dir string) error

CreateFolder makes a plain directory inside the project and refreshes the cached inventory so the file browser shows it immediately.

func (*WorkspaceDocument) CreateMod

func (w *WorkspaceDocument) CreateMod(id project.ModID, spec project.ModSpec) error

func (*WorkspaceDocument) CreateScene

func (w *WorkspaceDocument) CreateScene(id project.SceneID) error

func (*WorkspaceDocument) CreateSceneModule

func (w *WorkspaceDocument) CreateSceneModule(id string, mod project.ModID, parent string) error

CreateSceneModule creates a definition and its placement as one undoable edit. Existing definitions are reused through the usual instance wiring rules.

func (*WorkspaceDocument) DeleteDocument

func (w *WorkspaceDocument) DeleteDocument(file string) error

DeleteDocument removes one JSON document. Scenes also leave the project's scene list; files move to editor trash on save.

func (*WorkspaceDocument) DeleteInstance

func (w *WorkspaceDocument) DeleteInstance(id string) error

func (*WorkspaceDocument) DeleteInstances

func (w *WorkspaceDocument) DeleteInstances(selected map[string]bool) error

DeleteInstances removes selected subtrees in one undoable edit.

func (*WorkspaceDocument) DeleteMod

func (w *WorkspaceDocument) DeleteMod(id project.ModID) error

func (*WorkspaceDocument) Dirty

func (w *WorkspaceDocument) Dirty() bool

func (*WorkspaceDocument) Dispose

func (w *WorkspaceDocument) Dispose() error

Dispose removes only this document's temporary copies. Saved editor trash remains recoverable independently of the editor session.

func (*WorkspaceDocument) DuplicateInstance

func (w *WorkspaceDocument) DuplicateInstance(id, newID string) error

DuplicateInstance clones placement/overrides while reusing each definition. Descendant identities are remapped as one scene-document command.

func (*WorkspaceDocument) EditInstance

func (w *WorkspaceDocument) EditInstance(id, label string, edit func(*project.ModInstanceSpec) error) error

func (*WorkspaceDocument) EditMod

func (w *WorkspaceDocument) EditMod(id project.ModID, label string, edit func(*project.ModSpec) error) error

func (*WorkspaceDocument) EditScene

func (w *WorkspaceDocument) EditScene(id project.SceneID, label string, edit func(*project.SceneSpec) error) error

func (*WorkspaceDocument) Instance

func (*WorkspaceDocument) ModuleFiles

func (w *WorkspaceDocument) ModuleFiles(id project.ModID) []WorkspaceFile

ModuleFiles uses the cached inventory and includes unsaved definitions/copies.

func (*WorkspaceDocument) MoveInstance

func (w *WorkspaceDocument) MoveInstance(id, parent string, index int) error

MoveInstance uses the destination index after removal when reordering or reparenting an instance through the scene tree.

func (*WorkspaceDocument) PatchDocuments

func (w *WorkspaceDocument) PatchDocuments(label string, patches map[DocumentID][]DocumentPatch) error

PatchDocuments applies a form containing scene and definition edits as one validated transaction. Each history entry still records the owning files.

func (*WorkspaceDocument) Redo

func (w *WorkspaceDocument) Redo() error

func (*WorkspaceDocument) Refresh

func (w *WorkspaceDocument) Refresh() error

Refresh discovers new definitions while preserving all open document drafts. Existing external document edits remain conflicts until the project is reopened.

func (*WorkspaceDocument) RefreshFiles

func (w *WorkspaceDocument) RefreshFiles() error

func (*WorkspaceDocument) RemoveElement

func (w *WorkspaceDocument) RemoveElement(mod project.ModID, id string) error

RemoveElement deletes an element and its descendants from the definition.

func (*WorkspaceDocument) Save

func (w *WorkspaceDocument) Save() error

Save writes only changed owning documents, after checking external edits. Module removal moves the complete private folder into recoverable editor trash.

func (*WorkspaceDocument) Scene

func (w *WorkspaceDocument) Scene() *SceneDocument

func (*WorkspaceDocument) SelectScene

func (w *WorkspaceDocument) SelectScene(id project.SceneID) error

func (*WorkspaceDocument) Undo

func (w *WorkspaceDocument) Undo() error

type WorkspaceFile

type WorkspaceFile struct {
	Path  string
	IsDir bool
}

Source Files

Directories

Path Synopsis
cmd
builder command
Command builder preprocesses a project resource package before compiling it.
Command builder preprocesses a project resource package before compiling it.
onix command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL