public static void GenerateTypeTree(TypeTreeContext context, string name)
        {
            PropertyModificationLayout layout = context.Layout.PrefabInstance.PropertyModification;

            context.AddNode(layout.Name, name);
            context.BeginChildren();
            context.AddPPtr(context.Layout.Object.Name, layout.TargetName);
            context.AddString(layout.PropertyPathName);
            context.AddString(layout.ValueName);
            context.AddPPtr(context.Layout.Object.Name, layout.ObjectReferenceName);
            context.EndChildren();
        }
示例#2
0
        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;
            }
        }