public static void GenerateTypeTree(TypeTreeContext context, string name) { PrefabInstanceLayout layout = context.Layout.PrefabInstance; context.AddNode(layout.Name, name, layout.Version); context.BeginChildren(); if (layout.IsModificationFormat) { ObjectLayout.GenerateTypeTree(context); if (layout.HasRootGameObject && layout.IsRootGameObjectFirst) { context.AddPPtr(context.Layout.GameObject.Name, layout.RootGameObjectName); } PrefabModificationLayout.GenerateTypeTree(context, layout.ModificationName); if (layout.HasSourcePrefab) { context.AddPPtr(layout.Name, layout.SourcePrefabName); } else { context.AddPPtr(layout.Name, layout.ParentPrefabName); } if (!layout.IsRootGameObjectFirst) { context.AddPPtr(context.Layout.GameObject.Name, layout.RootGameObjectName); } if (layout.HasIsPrefabAsset) { context.AddBool(layout.IsPrefabAssetName); } else { context.AddBool(layout.IsPrefabParentName); } if (layout.HasIsExploded) { context.AddBool(layout.IsExplodedName); } context.Align(); } else { GUIDLayout.GenerateTypeTree(context, layout.LastMergeIdentifierName); if (layout.HasLastTemplateIdentifier) { GUIDLayout.GenerateTypeTree(context, layout.LastTemplateIdentifierName); } context.AddArray(layout.ObjectsName, (c, n) => c.AddPPtr(c.Layout.EditorExtension.Name, n)); context.AddPPtr(layout.Name, layout.FatherName); context.AddBool(layout.IsDataTemplateName, TransferMetaFlags.AlignBytesFlag); NamedObjectLayout.GenerateTypeTree(context); } context.EndChildren(); }
public static void GenerateTypeTree(TypeTreeContext context, string name) { PrefabModificationLayout layout = context.Layout.PrefabInstance.PrefabModification; context.AddNode(layout.Name, name); context.BeginChildren(); context.AddPPtr(context.Layout.Transform.Name, layout.TransformParentName); context.AddArray(layout.ModificationsName, PropertyModificationLayout.GenerateTypeTree); if (layout.IsComponentPointer) { context.AddArray(layout.RemovedComponentsName, (c, n) => c.AddPPtr(c.Layout.Component.Name, n)); } else { context.AddArray(layout.RemovedComponentsName, (c, n) => c.AddPPtr(c.Layout.Object.Name, n)); } context.EndChildren(); }
public PrefabInstanceLayout(LayoutInfo info) { PrefabModification = new PrefabModificationLayout(info); PropertyModification = new PropertyModificationLayout(info); if (info.Version.IsGreaterEqual(3, 5)) { // NOTE: unknown conversion Version = 2; } else { Version = 1; } // Fields if (info.Version.IsGreaterEqual(3, 5)) { if (info.Version.IsLess(2018, 3) || !info.Flags.IsEditorScene()) { HasRootGameObject = true; } HasModification = true; if (info.Version.IsGreaterEqual(2018, 2)) { HasSourcePrefab = true; } else { HasParentPrefab = true; } if (info.Version.IsLess(2018, 3)) { HasIsPrefabAssetInvariant = true; if (info.Version.IsGreaterEqual(2018, 2)) { HasIsPrefabAsset = true; } else { HasIsPrefabParent = true; } } if (info.Version.IsLess(5)) { HasIsExploded = true; } } else { HasLastMergeIdentifier = true; if (info.Version.IsLess(2, 6)) { HasLastTemplateIdentifier = true; } HasObjects = true; HasFather = true; HasIsPrefabAssetInvariant = true; HasIsDataTemplate = true; } // Flags if (info.Version.IsGreaterEqual(3, 5)) { IsModificationFormat = true; } if (info.Version.IsGreaterEqual(2018, 3)) { IsRootGameObjectFirst = true; } // Names if (info.Version.IsGreaterEqual(2018, 3)) { Name = nameof(ClassIDType.PrefabInstance); } else if (info.Version.IsGreaterEqual(3, 5)) { Name = nameof(ClassIDType.Prefab); } else { Name = nameof(ClassIDType.DataTemplate); } if (info.Version.IsGreaterEqual(2018, 2)) { SourcePrefabInvariantName = SourcePrefabName; } else if (info.Version.IsGreaterEqual(3, 5)) { SourcePrefabInvariantName = ParentPrefabName; } else { SourcePrefabInvariantName = FatherName; } if (info.Version.IsGreaterEqual(2018, 2)) { IsPrefabAssetInvariantName = IsPrefabAssetName; } else if (info.Version.IsGreaterEqual(3, 5)) { IsPrefabAssetInvariantName = IsPrefabParentName; } else { IsPrefabAssetInvariantName = IsDataTemplateName; } }