Documentation
¶
Index ¶
- Constants
- func ReparentTargetFileIDs(blocks []parser.Block, targetTransformID int64) []int64
- func RestoreFromBackup(path, backupPath string) (int, error)
- func VerifySceneDelete(data []byte, deleted []int64, parentTransform, targetTransform int64) (bool, string)
- func VerifySceneReparent(data []byte, target, oldParent, newParent int64) (bool, string)
- func WriteWithBackup(path string, updated []byte) (string, error)
- type AssetSetRequest
- type AssetSetResult
- type CommittedWriteError
- type PrefabSetRequest
- type PrefabSetResult
- type SceneApplyPlan
- type SceneApplyRequest
- type SceneDeletePlan
- type SceneDiffResult
- type SceneReparentPlan
- type SceneRepositionRequest
- type SceneRepositionResult
Constants ¶
const RepositionField = "m_LocalPosition"
RepositionField is the only field scene reposition rewrites: a Transform's (or RectTransform's) local position, serialized by Unity as an inline flow mapping {x, y, z}. The existing scalar rewriter cannot touch a nested inline mapping entry, so reposition uses the dedicated flow-mapping rewriter below.
Variables ¶
This section is empty.
Functions ¶
func ReparentTargetFileIDs ¶ added in v0.8.0
ReparentTargetFileIDs returns the set of local fileIDs that together identify the reparented object for a cross-file reference scan: the target Transform, its backing GameObject, and every component on that GameObject. An external referrer almost always points at the GameObject (`m_GameObject: {fileID: N}`) or a sibling component (a UnityEvent target, a component PPtr), NOT the Transform — so scanning the Transform fileID alone misses the common reference class. The xref scanner takes a fileID SET precisely so the consumer can pass this whole object. Returns a sorted, de-duplicated slice; the target Transform fileID is always included even if its GameObject can't be resolved.
func RestoreFromBackup ¶
RestoreFromBackup atomically overwrites path with the contents of backupPath, returning the number of bytes restored. It is the inverse of the .bak written by WriteWithBackup, used to recover from a committed write.
func VerifySceneDelete ¶ added in v0.8.0
func VerifySceneDelete(data []byte, deleted []int64, parentTransform, targetTransform int64) (bool, string)
VerifySceneDelete re-reads bytes and confirms the delete predicates: every removed fileID is absent, and the parent (if any) no longer lists the target transform. (Replaces the append-era "reserved fileID exists" verify with an absence assertion.)
func VerifySceneReparent ¶ added in v0.8.0
VerifySceneReparent re-reads bytes and confirms the three reparent predicates: target.m_Father == new parent; new parent lists target; old parent no longer lists target. (Replaces the append-era "reserved fileID exists" verify.)
Types ¶
type AssetSetRequest ¶
type AssetSetResult ¶
type AssetSetResult struct {
Field string
OldValue string
NewValue string
TypeHint string
Changed bool
UpdatedData []byte
}
func PlanAssetSet ¶
func PlanAssetSet(input []byte, blocks []parser.Block, req AssetSetRequest) (AssetSetResult, error)
type CommittedWriteError ¶
func (*CommittedWriteError) Error ¶
func (e *CommittedWriteError) Error() string
func (*CommittedWriteError) Unwrap ¶
func (e *CommittedWriteError) Unwrap() error
func (*CommittedWriteError) WriteCommitted ¶
func (e *CommittedWriteError) WriteCommitted() bool
type PrefabSetRequest ¶
type PrefabSetResult ¶
type PrefabSetResult struct {
Field string
OldValue string
NewValue string
TypeHint string
Changed bool
UpdatedData []byte
}
func PlanPrefabSet ¶
func PlanPrefabSet(input []byte, blocks []parser.Block, req PrefabSetRequest) (PrefabSetResult, error)
type SceneApplyPlan ¶
type SceneApplyPlan struct {
Status patch.Status
Operation string
Reason string
AppendOps int
ReservedIDs []int64
Changed bool
Verified bool
BackupPath string
ExpectedObjects int
ActualObjects int
UpdatedData []byte
}
func ApplyScene ¶
func ApplyScene(req SceneApplyRequest, plan SceneApplyPlan) (SceneApplyPlan, error)
func PlanSceneApply ¶
func PlanSceneApply(input []byte, req SceneApplyRequest) (SceneApplyPlan, error)
type SceneApplyRequest ¶
type SceneDeletePlan ¶ added in v0.8.0
type SceneDeletePlan struct {
Target int64
Cascade bool
DeletedFileIDs []int64
ParentTransform int64 // target transform's m_Father (0 = root)
TargetTransform int64
Changed bool
UpdatedData []byte
EndpointBlocked bool
EndpointBody string // "reason=UNSUPPORTED_ENDPOINT_CLASS ..." | "reason=MISSING_TRANSFORM ..."
PlanBlocked bool
PlanCode string // WOULD_ORPHAN_CHILDREN | STRIPPED_IN_SUBTREE | IN_FILE_REFERENCED
PlanDetail string
}
SceneDeletePlan is the result of planning a delete op. EndpointBlocked (Policy 1: target class / stripped / missing-transform) and PlanBlocked (would-orphan / stripped-in-subtree / in-file-referenced) are dry-run-time refusals surfaced as BLOCKED before any write; on success UpdatedData holds the rewritten scene and DeletedFileIDs is the full set of removed fileIDs (the cross-file scan input).
func PlanSceneDelete ¶ added in v0.8.0
func PlanSceneDelete(input []byte, blocks []parser.Block, op patch.Op, sceneGUID string) (SceneDeletePlan, error)
PlanSceneDelete removes a GameObject (op.Target) and its component blocks from one scene, unlinking its Transform from the parent's m_Children. With op.Cascade it removes the whole subtree; without it, deleting an object that still has children is refused (would orphan them). The target must be a non-stripped GameObject (Policy 1); no stripped/prefab-instance block may be in the removed set; and no SURVIVING same-file PPtr may still reference a removed fileID (would dangle in-file — the graph-check has no dangling validator, so this is checked here). Cross-file references are the apply layer's concern.
type SceneDiffResult ¶
type SceneDiffResult struct {
Status patch.Status
Operation string
Reason string
AppendOps int
ReservedIDs []int64
OverlapIDs []int64
}
func DescribeScenePatch ¶
func DescribeScenePatch(req SceneApplyRequest) (SceneDiffResult, error)
type SceneReparentPlan ¶ added in v0.8.0
type SceneReparentPlan struct {
Target int64
NewParent int64
OldParent int64
Changed bool
UpdatedData []byte
EndpointBlocked bool
EndpointBody string // "reason=UNSUPPORTED_ENDPOINT_CLASS endpoint=<role> id=<N> class=<C> is_stripped=<bool> allowed=4"
PlanBlocked bool
PlanCode string // WOULD_CREATE_CYCLE | WOULD_BREAK_SYMMETRY
PlanDetail string // "chain=a->b->a" | "reason=..."
}
SceneReparentPlan is the result of planning a reparent op. EndpointBlocked (Policy 1) and PlanBlocked (Policy 2) are dry-run-time refusals surfaced as BLOCKED before any write; on success UpdatedData holds the rewritten scene.
func PlanSceneReparent ¶ added in v0.8.0
PlanSceneReparent moves op.Target under op.NewParent (0 = root) within one scene, updating three blocks atomically: target.m_Father, the old parent's m_Children (remove), and the new parent's m_Children (add). It re-derives the old parent from the scene and rejects a stale patch. Policies 1/2 run before any byte rewrite.
type SceneRepositionRequest ¶ added in v0.8.0
type SceneRepositionResult ¶ added in v0.8.0
type SceneRepositionResult struct {
Field string
OldValue string // "x,y,z"
NewValue string // "x,y,z"
Changed bool
UpdatedData []byte
}
func PlanSceneReposition ¶ added in v0.8.0
func PlanSceneReposition(input []byte, blocks []parser.Block, req SceneRepositionRequest) (SceneRepositionResult, error)
PlanSceneReposition computes the byte-level rewrite that sets the target Transform's m_LocalPosition to req.Position. It is topology-invariant: only the three numeric axis tokens of one inline mapping change, so the fileID graph is untouched and the safety kernel's pre/temp/final checks pass for any input that was already sound.