patch

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OpReparent = "reparent"
	OpDelete   = "delete"
)

Op tags supported in a v2 ops[] patch. Mixing multiple ops in one patch is deliberately out of scope; a patch carries exactly one op.

View Source
const (
	ReasonNeedPrefabGUID = "NEED_PREFAB_GUID"
	AppendOpAppend       = "append"
)
View Source
const FileSchemaVersion = 1
View Source
const FileSchemaVersionV2 = 2

FileSchemaVersionV2 is the ops[] patch schema introduced for structural scene mutations (S4a reparent). v1 (place_prefab append) and v2 (ops[]) coexist; readers dispatch on schema_version.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppendIntent

type AppendIntent struct {
	Op       string `json:"op"`
	ClassID  int    `json:"class_id"`
	FileID   int64  `json:"file_id"`
	TypeName string `json:"type_name"`
}

type File

type File struct {
	SchemaVersion int `json:"schema_version"`
	core.Result
	PatchPlan PlacePrefabPlan `json:"patch_plan"` // v1 (place_prefab)
	Ops       []Op            `json:"ops,omitempty"`
}

func LoadFile

func LoadFile(path string) (File, error)

type Op added in v0.8.0

type Op struct {
	Op        string `json:"op"`
	Target    int64  `json:"target"`
	NewParent int64  `json:"new_parent"`
	OldParent int64  `json:"old_parent"`
	Cascade   bool   `json:"cascade,omitempty"`
}

Op is one structural mutation in a v2 ops[] patch.

For reparent:

  • Target is the Transform being moved.
  • NewParent is its new m_Father (0 = move to scene root).
  • OldParent is its current m_Father captured at plan time (0 = was at root).

For delete:

  • Target is the GameObject being removed (its Transform and components go with it; NewParent/OldParent are unused and must be 0).
  • Cascade removes the whole Transform subtree; without it, deleting an object that still has children is refused (would orphan them).

type PlacePrefabPlan

type PlacePrefabPlan struct {
	Status          Status         `json:"status"`
	Reason          string         `json:"reason,omitempty"`
	PrefabPath      string         `json:"prefab_path"`
	PrefabGUID      string         `json:"prefab_guid,omitempty"`
	Position        bounds.Vec3    `json:"position"`
	OverlapIDs      []int64        `json:"overlap_ids"`
	ReservedFileIDs []int64        `json:"reserved_file_ids"`
	Appends         []AppendIntent `json:"appends"`
}

func PlanPlacePrefab

func PlanPlacePrefab(req PlacePrefabRequest) (PlacePrefabPlan, error)

type PlacePrefabRequest

type PlacePrefabRequest struct {
	SceneBlocks []parser.Block
	Manifest    bounds.Manifest
	PrefabPath  string
	PrefabRef   PrefabReference
	Position    bounds.Vec3
}

type PrefabReference

type PrefabReference struct {
	GUID string `json:"guid"`
}

type Status

type Status string
const (
	StatusOK      Status = "OK"
	StatusWarn    Status = "WARN"
	StatusUnknown Status = "UNKNOWN"
)

Jump to

Keyboard shortcuts

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