Example #1
0
        public FSkeletalMaterial(FAssetArchive Ar)
        {
            Material = new FPackageIndex(Ar).ResolvedObject;
            if (FEditorObjectVersion.Get(Ar) >= FEditorObjectVersion.Type.RefactorMeshEditorMaterials)
            {
                MaterialSlotName = Ar.ReadFName();
                var bSerializeImportedMaterialSlotName = !Ar.Owner.HasFlags(EPackageFlags.PKG_FilterEditorOnly);
                if (FCoreObjectVersion.Get(Ar) >= FCoreObjectVersion.Type.SkeletalMaterialEditorDataStripping)
                {
                    bSerializeImportedMaterialSlotName = Ar.ReadBoolean();
                }

                if (bSerializeImportedMaterialSlotName)
                {
                    ImportedMaterialSlotName = Ar.ReadFName();
                }
            }
            else
            {
                if (Ar.Ver >= EUnrealEngineObjectUE4Version.MOVE_SKELETALMESH_SHADOWCASTING)
                {
                    Ar.Position += 4;
                }

                if (FRecomputeTangentCustomVersion.Get(Ar) >= FRecomputeTangentCustomVersion.Type.RuntimeRecomputeTangent)
                {
                    var bRecomputeTangent = Ar.ReadBoolean();
                }
            }
            if (FRenderingObjectVersion.Get(Ar) >= FRenderingObjectVersion.Type.TextureStreamingMeshUVChannelData)
            {
                UVChannelData = new FMeshUVChannelInfo(Ar);
            }
        }
        public FSkeletalMeshVertexBuffer(FAssetArchive Ar)
        {
            var stripDataFlags = new FStripDataFlags(Ar, (int)UE4Version.VER_UE4_STATIC_SKELETAL_MESH_SERIALIZATION_FIX);

            NumTexCoords         = Ar.Read <int>();
            bUseFullPrecisionUVs = Ar.ReadBoolean();

            if (Ar.Ver >= UE4Version.VER_UE4_SUPPORT_GPUSKINNING_8_BONE_INFLUENCES &&
                FSkeletalMeshCustomVersion.Get(Ar) < FSkeletalMeshCustomVersion.Type.UseSeparateSkinWeightBuffer)
            {
                bExtraBoneInfluences = Ar.ReadBoolean();
            }

            MeshExtension = Ar.Read <FVector>();
            MeshOrigin    = Ar.Read <FVector>();

            if (!bUseFullPrecisionUVs)
            {
                VertsHalf = Ar.ReadBulkArray(() => new FGPUVertHalf(Ar, NumTexCoords));
            }
            else
            {
                VertsFloat = Ar.ReadBulkArray(() => new FGPUVertFloat(Ar, NumTexCoords));
            }
        }
Example #3
0
        }                                                        // UMaterialInterface[]

        public override void Deserialize(FAssetArchive Ar, long validPos)
        {
            base.Deserialize(Ar, validPos);

            var stripDataFlags = Ar.Read <FStripDataFlags>();

            bCooked   = Ar.ReadBoolean();
            BodySetup = new FPackageIndex(Ar);
            if (Ar.Ver >= EUnrealEngineObjectUE4Version.STATIC_MESH_STORE_NAV_COLLISION)
            {
                NavCollision = new FPackageIndex(Ar);
            }

            if (!stripDataFlags.IsEditorDataStripped())
            {
                Log.Warning("Static Mesh with Editor Data not implemented yet");
                Ar.Position = validPos;
                return;
                // if (Ar.Ver < UE4Version.VER_UE4_DEPRECATED_STATIC_MESH_THUMBNAIL_PROPERTIES_REMOVED)
                // {
                //     var dummyThumbnailAngle = Ar.Read<FRotator>();
                //     var dummyThumbnailDistance = Ar.Read<float>();
                // }
                // var highResSourceMeshName = Ar.ReadFString();
                // var highResSourceMeshCRC = Ar.Read<uint>();
            }

            LightingGuid = Ar.Read <FGuid>(); // LocalLightingGuid
            Sockets      = Ar.ReadArray(() => new FPackageIndex(Ar));
            RenderData   = new FStaticMeshRenderData(Ar, bCooked);

            if (bCooked && Ar.Game is >= EGame.GAME_UE4_20 and < EGame.GAME_UE5_0)
            {
                var bHasOccluderData = Ar.ReadBoolean();
                if (bHasOccluderData)
                {
                    Ar.ReadArray <FVector>(); // Vertices
                    Ar.ReadArray <ushort>();  // Indices
                }
            }

            if (Ar.Game >= EGame.GAME_UE4_14)
            {
                var bHasSpeedTreeWind = Ar.ReadBoolean();
                if (bHasSpeedTreeWind)
                {
                    Ar.Position = validPos;
                    return;
                }

                if (FEditorObjectVersion.Get(Ar) >= FEditorObjectVersion.Type.RefactorMeshEditorMaterials)
                {
                    // UE4.14+ - "Materials" are deprecated, added StaticMaterials
                    StaticMaterials = Ar.ReadArray(() => new FStaticMaterial(Ar));
                }
            }

            if (StaticMaterials is { Length : > 0 })
Example #4
0
        public override void Deserialize(FAssetArchive Ar, long validPos)
        {
            base.Deserialize(Ar, validPos);

            const int StripVertexBufferFlag = 1;
            var       stripData             = new FStripDataFlags(Ar);

            Bounds = Ar.Read <FBoxSphereBounds>();

            Vectors = Ar.ReadBulkArray <FVector>();
            Points  = Ar.ReadBulkArray <FVector>();
            Nodes   = Ar.ReadBulkArray <FBspNode>();

            if (Ar.Ver < EUnrealEngineObjectUE4Version.BSP_UNDO_FIX)
            {
                var surfsOwner = new FPackageIndex(Ar);
                Surfs = Ar.ReadArray(() => new FBspSurf(Ar));
            }
            else
            {
                Surfs = Ar.ReadArray(() => new FBspSurf(Ar));
            }
            Verts = Ar.ReadBulkArray <FVert>();

            NumSharedSides = Ar.Read <int>();
            if (Ar.Ver < EUnrealEngineObjectUE4Version.REMOVE_ZONES_FROM_MODEL)
            {
                var dummyZones = Ar.ReadArray <FZoneProperties>();
            }

            var bHasEditorOnlyData = !Ar.IsFilterEditorOnly || Ar.Ver < EUnrealEngineObjectUE4Version.REMOVE_UNUSED_UPOLYS_FROM_UMODEL;

            if (bHasEditorOnlyData)
            {
                var dummyPolys = new FPackageIndex(Ar);
                Ar.SkipBulkArrayData(); // DummyLeafHulls
                Ar.SkipBulkArrayData(); // DummyLeaves
            }

            RootOutside = Ar.ReadBoolean();
            Linked      = Ar.ReadBoolean();

            if (Ar.Ver < EUnrealEngineObjectUE4Version.REMOVE_ZONES_FROM_MODEL)
            {
                var dummyPortalNodes = Ar.ReadBulkArray <int>();
            }

            NumUniqueVertices = Ar.Read <uint>();

            if (!stripData.IsEditorDataStripped() || !stripData.IsClassDataStripped(StripVertexBufferFlag))
            {
                VertexBuffer = new FModelVertexBuffer(Ar);
            }

            LightingGuid      = Ar.Read <FGuid>();
            LightmassSettings = Ar.ReadArray(() => new FLightmassPrimitiveSettings(Ar));
        }
Example #5
0
 public FNumberFormattingOptions(FAssetArchive Ar)
 {
     AlwaysSign              = Ar.ReadBoolean();
     UseGrouping             = Ar.ReadBoolean();
     RoundingMode            = Ar.Read <ERoundingMode>();
     MinimumIntegralDigits   = Ar.Read <int>();
     MaximumIntegralDigits   = Ar.Read <int>();
     MinimumFractionalDigits = Ar.Read <int>();
     MaximumFractionalDigits = Ar.Read <int>();
 }
        public FSkeletalMaterial(FAssetArchive Ar)
        {
            Material = Ar.ReadObject <UMaterialInterface>();
            if (FEditorObjectVersion.Get(Ar) >= FEditorObjectVersion.Type.RefactorMeshEditorMaterials)
            {
                MaterialSlotName = Ar.ReadFName();
                var bSerializeImportedMaterialSlotName = false;
                if (FCoreObjectVersion.Get(Ar) >= FCoreObjectVersion.Type.SkeletalMaterialEditorDataStripping)
                {
                    bSerializeImportedMaterialSlotName = Ar.ReadBoolean();
                }

                if (bSerializeImportedMaterialSlotName)
                {
                    ImportedMaterialSlotName = Ar.ReadFName();
                }
            }
            else
            {
                if (Ar.Ver >= UE4Version.VER_UE4_MOVE_SKELETALMESH_SHADOWCASTING)
                {
                    Ar.Position += 4;
                }

                if (FRecomputeTangentCustomVersion.Get(Ar) >= FRecomputeTangentCustomVersion.Type.RuntimeRecomputeTangent)
                {
                    Ar.Position += 4;
                }
            }
            if (FRenderingObjectVersion.Get(Ar) >= FRenderingObjectVersion.Type.TextureStreamingMeshUVChannelData)
            {
                UVChannelData = new FMeshUVChannelInfo(Ar);
            }
        }
Example #7
0
 public None(FAssetArchive Ar)
 {
     if (Ar.ReadBoolean()) // bHasCultureInvariantString
     {
         CultureInvariantString = Ar.ReadFString();
     }
 }
Example #8
0
        public override void Deserialize(FAssetArchive Ar, long validPos)
        {
            base.Deserialize(Ar, validPos);
            bStreaming = Ar.Game >= EGame.GAME_UE4_25;
            if (TryGetValue(out bool s, nameof(bStreaming))) // will return false if not found
            {
                bStreaming = s;
            }
            else if (TryGetValue(out FName loadingBehavior, "LoadingBehavior"))
            {
                bStreaming = !loadingBehavior.IsNone && loadingBehavior.Text != "ESoundWaveLoadingBehavior::ForceInline";
            }

            bCooked = Ar.ReadBoolean();
            if (!bStreaming)
            {
                if (bCooked)
                {
                    CompressedFormatData = new FFormatContainer(Ar);
                }
                else
                {
                    RawData = new FByteBulkData(Ar);
                }
                CompressedDataGuid = Ar.Read <FGuid>();
            }
            else
            {
                CompressedDataGuid  = Ar.Read <FGuid>();
                RunningPlatformData = new FStreamedAudioPlatformData(Ar);
            }
        }
Example #9
0
        public FPackageIndex AreaClass; // UNavArea

        public override void Deserialize(FAssetArchive Ar, long validPos)
        {
            base.Deserialize(Ar, validPos);

            var startPos = Ar.Position;
            int version;
            var myMagic = Ar.Read <uint>();

            if (myMagic != Consts.Magic)
            {
                version     = Consts.Initial;
                Ar.Position = startPos;
            }
            else
            {
                version = Ar.Read <int>();
            }

            var _       = Ar.Read <FGuid>(); // Zeroed GUID, unused
            var bCooked = Ar.ReadBoolean();

            if (bCooked)
            {
                CookedFormatData = new FFormatContainer(Ar);
            }

            if (version >= Consts.AreaClass)
            {
                AreaClass = new FPackageIndex(Ar);
            }
        }
Example #10
0
        public override void Deserialize(FAssetArchive Ar, long validPos)
        {
            base.Deserialize(Ar, validPos);

            var bCooked = false;

            if (FFortniteMainBranchObjectVersion.Get(Ar) >= FFortniteMainBranchObjectVersion.Type.SerializeInstancedStaticMeshRenderData ||
                FEditorObjectVersion.Get(Ar) >= FEditorObjectVersion.Type.SerializeInstancedStaticMeshRenderData)
            {
                bCooked = Ar.ReadBoolean();
            }

            PerInstanceSMData = Ar.ReadBulkArray(() => new FInstancedStaticMeshInstanceData(Ar));

            if (FRenderingObjectVersion.Get(Ar) >= FRenderingObjectVersion.Type.PerInstanceCustomData)
            {
                PerInstanceSMCustomData = Ar.ReadBulkArray(Ar.Read <float>);
            }

            if (bCooked && (FFortniteMainBranchObjectVersion.Get(Ar) >= FFortniteMainBranchObjectVersion.Type.SerializeInstancedStaticMeshRenderData ||
                            FEditorObjectVersion.Get(Ar) >= FEditorObjectVersion.Type.SerializeInstancedStaticMeshRenderData))
            {
                var renderDataSizeBytes = Ar.Read <long>();

                if (renderDataSizeBytes > 0)
                {
                    // idk what to do here... But it fixes the warnings ­ЪциРђЇ
                    Ar.Position = validPos;
                }
            }
        }
Example #11
0
 public FMovieSceneSegment(FAssetArchive Ar)
 {
     Range       = Ar.Read <TRange <FFrameNumber> >();
     ID          = Ar.Read <FMovieSceneSegmentIdentifier>();
     bAllowEmpty = Ar.ReadBoolean();
     Impls       = Ar.ReadArray <FSectionEvaluationData>();
 }
        public FTexture2DMipMap(FAssetArchive Ar)
        {
            SizeZ = 1;
            var cooked = Ar.Ver >= UE4Version.VER_UE4_TEXTURE_SOURCE_ART_REFACTOR && Ar.ReadBoolean();

            Data = new FByteBulkData(Ar);

            if (Ar.Game == EGame.GAME_BORDERLANDS3)
            {
                SizeX = Ar.Read <ushort>();
                SizeY = Ar.Read <ushort>();
                SizeZ = Ar.Read <ushort>();
            }
            else
            {
                SizeX = Ar.Read <int>();
                SizeY = Ar.Read <int>();
                if (Ar.Game >= EGame.GAME_UE4_20)
                {
                    SizeZ = Ar.Read <int>();
                }
            }

            if (Ar.Ver >= UE4Version.VER_UE4_TEXTURE_DERIVED_DATA2 && !cooked)
            {
                var derivedDataKey = Ar.ReadFString();
            }
        }
Example #13
0
        public FObjectExport(FAssetArchive Ar)
        {
            ClassIndex    = new FPackageIndex(Ar);
            SuperIndex    = new FPackageIndex(Ar);
            TemplateIndex = Ar.Ver >= EUnrealEngineObjectUE4Version.TemplateIndex_IN_COOKED_EXPORTS ? new FPackageIndex(Ar) : new FPackageIndex();
            OuterIndex    = new FPackageIndex(Ar);
            ObjectName    = Ar.ReadFName();
            ObjectFlags   = Ar.Read <uint>();

            if (Ar.Ver < EUnrealEngineObjectUE4Version.e64BIT_EXPORTMAP_SERIALSIZES)
            {
                SerialSize   = Ar.Read <int>();
                SerialOffset = Ar.Read <int>();
            }
            else
            {
                SerialSize   = Ar.Read <long>();
                SerialOffset = Ar.Read <long>();
            }

            ForcedExport = Ar.ReadBoolean();
            NotForClient = Ar.ReadBoolean();
            NotForServer = Ar.ReadBoolean();
            PackageGuid  = Ar.Read <FGuid>();
            PackageFlags = Ar.Read <uint>();
            NotAlwaysLoadedForEditorGame = Ar.Ver < EUnrealEngineObjectUE4Version.LOAD_FOR_EDITOR_GAME || Ar.ReadBoolean();
            IsAsset = Ar.Ver >= EUnrealEngineObjectUE4Version.COOKED_ASSETS_IN_EDITOR_SUPPORT && Ar.ReadBoolean();

            if (Ar.Ver >= EUnrealEngineObjectUE4Version.PRELOAD_DEPENDENCIES_IN_COOKED_EXPORTS)
            {
                FirstExportDependency = Ar.Read <int>();
                SerializationBeforeSerializationDependencies = Ar.Read <int>();
                CreateBeforeSerializationDependencies        = Ar.Read <int>();
                SerializationBeforeCreateDependencies        = Ar.Read <int>();
                CreateBeforeCreateDependencies = Ar.Read <int>();
            }
            else
            {
                FirstExportDependency = -1;
                SerializationBeforeSerializationDependencies = 0;
                CreateBeforeSerializationDependencies        = 0;
                SerializationBeforeCreateDependencies        = 0;
                CreateBeforeCreateDependencies = 0;
            }

            ClassName = ClassIndex.Name;
        }
Example #14
0
 public FDistanceFieldVolumeData5(FAssetArchive Ar)
 {
     LocalSpaceMeshBounds = Ar.Read <FBox>();
     bMostlyTwoSided      = Ar.ReadBoolean();
     Mips            = Ar.ReadArray <FSparseDistanceFieldMip>(DistanceField.NumMips);
     AlwaysLoadedMip = Ar.ReadArray <byte>();
     StreamableMips  = new FByteBulkData(Ar);
 }
Example #15
0
        // UE4.23-4.24 has changed compressed data layout for streaming, so it's worth making a separate
        // serializer function for it.
        private void SerializeCompressedData2(FAssetArchive Ar)
        {
            var compressedRawDataSize = Ar.Read <int>();

            CompressedTrackToSkeletonMapTable = Ar.ReadArray <FTrackToSkeletonMap>();
            var compressedCurveNames = Ar.ReadArray(() => new FSmartName(Ar));

            // Since 4.23, this is FUECompressedAnimData::SerializeCompressedData
            KeyEncodingFormat            = Ar.Read <AnimationKeyFormat>();
            TranslationCompressionFormat = Ar.Read <AnimationCompressionFormat>();
            RotationCompressionFormat    = Ar.Read <AnimationCompressionFormat>();
            ScaleCompressionFormat       = Ar.Read <AnimationCompressionFormat>();

            var compressedNumFrames = Ar.Read <int>();

            // SerializeView() just serializes array size
            var compressedTrackOffsetsNum = Ar.Read <int>();
            var compressedScaleOffsetsNum = Ar.Read <int>();

            CompressedScaleOffsets = new FCompressedOffsetData(Ar.Read <int>());
            var compressedByteStreamNum = Ar.Read <int>();
            // ... end of FUECompressedAnimData::SerializeCompressedData

            var numBytes            = Ar.Read <int>();
            var bUseBulkDataForLoad = Ar.ReadBoolean();

            // In UE4.23 CompressedByteStream field exists in FUECompressedAnimData (as TArrayView) and in
            // FCompressedAnimSequence (as byte array). Serialization is done in FCompressedAnimSequence,
            // either as TArray or as bulk, and then array is separated onto multiple "views" for
            // FUECompressedAnimData. We'll use a different name for "joined" serialized array here to
            // avoid confuse.
            byte[] serializedByteStream;

            if (bUseBulkDataForLoad)
            {
                throw new NotImplementedException("Anim: bUseBulkDataForLoad not implemented");
                //todo: read from bulk to serializedByteStream
            }
            else
            {
                serializedByteStream = Ar.ReadBytes(numBytes);
            }

            // Setup all array views from single array. In UE4 this is done in FUECompressedAnimData::InitViewsFromBuffer.
            // We'll simply copy array data away from SerializedByteStream, and then SerializedByteStream
            // will be released from memory as it is a local variable here.
            // Note: copying is not byte-order wise, so if there will be any problems in the future,
            // should use byte swap functions.
            using (var tempAr = new FByteArchive("SerializedByteStream", serializedByteStream, Ar.Versions))
            {
                CompressedTrackOffsets            = tempAr.ReadArray <int>(compressedTrackOffsetsNum);
                CompressedScaleOffsets.OffsetData = tempAr.ReadArray <int>(compressedScaleOffsetsNum);
                CompressedByteStream = tempAr.ReadBytes(compressedByteStreamNum);
            }

            var curveCodecPath            = Ar.ReadFString();
            var compressedCurveByteStream = Ar.ReadArray <byte>();
        }
Example #16
0
        public override void Deserialize(FAssetArchive Ar, long validPos)
        {
            base.Deserialize(Ar, validPos);

            BodySetupGuid = Ar.Read <FGuid>();

            var bCooked = Ar.ReadBoolean();

            if (!bCooked)
            {
                return;
            }
            if (Ar.Ver >= EUnrealEngineObjectUE4Version.STORE_HASCOOKEDDATA_FOR_BODYSETUP)
            {
                var _ = Ar.ReadBoolean(); // bTemp
            }

            CookedFormatData = new FFormatContainer(Ar);
        }
Example #17
0
 public None(FAssetArchive Ar)
 {
     if (FEditorObjectVersion.Get(Ar) >= FEditorObjectVersion.Type.CultureInvariantTextSerializationKeyStability)
     {
         var bHasCultureInvariantString = Ar.ReadBoolean();
         if (bHasCultureInvariantString)
         {
             CultureInvariantString = Ar.ReadFString();
         }
     }
 }
Example #18
0
        public override void Deserialize(FAssetArchive Ar, long validPos)
        {
            base.Deserialize(Ar, validPos);

            var bSaveInlineData = Ar.ReadBoolean();

            if (bSaveInlineData)
            {
                FontFaceData = new FFontFaceData(Ar);
            }
        }
Example #19
0
        public override void Deserialize(FAssetArchive Ar, long validPos)
        {
            base.Deserialize(Ar, validPos);
            bHasVertexColors       = GetOrDefault <bool>(nameof(bHasVertexColors));
            NumVertexColorChannels = GetOrDefault <byte>(nameof(NumVertexColorChannels));

            var stripDataFlags = Ar.Read <FStripDataFlags>();

            ImportedBounds    = Ar.Read <FBoxSphereBounds>();
            Materials         = Ar.ReadArray(() => new FSkeletalMaterial(Ar));
            ReferenceSkeleton = new FReferenceSkeleton(Ar);

            if (FSkeletalMeshCustomVersion.Get(Ar) < FSkeletalMeshCustomVersion.Type.SplitModelAndRenderData)
            {
                LODModels = Ar.ReadArray(() => new FStaticLODModel(Ar, bHasVertexColors));
            }
            else
            {
                if (!stripDataFlags.IsEditorDataStripped())
                {
                    LODModels = Ar.ReadArray(() => new FStaticLODModel(Ar, bHasVertexColors));
                }

                var bCooked = Ar.ReadBoolean();
                if (Ar.Game >= EGame.GAME_UE4_27)
                {
                    var minMobileLODIdx = Ar.Read <int>();
                }

                if (bCooked && LODModels == null)
                {
                    LODModels = new FStaticLODModel[Ar.Read <int>()];
                    for (var i = 0; i < LODModels.Length; i++)
                    {
                        LODModels[i] = new FStaticLODModel();
                        LODModels[i].SerializeRenderItem(Ar, bHasVertexColors, NumVertexColorChannels);
                    }

                    if (Ar.Game >= EGame.GAME_UE4_24)
                    {
                        var numInlinedLODs     = Ar.Read <byte>();
                        var numNonOptionalLODs = Ar.Read <byte>();
                    }
                }
            }

            if (Ar.Ver < UE4Version.VER_UE4_REFERENCE_SKELETON_REFACTOR)
            {
                var length = Ar.Read <int>();
                Ar.Position += 12 * length; // TMap<FName, int32> DummyNameIndexMap
            }

            var dummyObjs = Ar.ReadArray(() => new FPackageIndex(Ar));
        }
Example #20
0
        public override void Deserialize(FAssetArchive Ar, long validPos)
        {
            base.Deserialize(Ar, validPos);

            // serialize the function map
            FuncMap = new Dictionary <FName, FPackageIndex>();
            var funcMapNum = Ar.Read <int>();

            for (var i = 0; i < funcMapNum; i++)
            {
                FuncMap[Ar.ReadFName()] = new FPackageIndex(Ar);
            }

            // Class flags first.
            ClassFlags = Ar.Read <uint>();

            // Variables.
            if (Ar.Game == EGame.GAME_StarWarsJediFallenOrder)
            {
                Ar.Position += 4;
            }
            ClassWithin     = new FPackageIndex(Ar);
            ClassConfigName = Ar.ReadFName();

            ClassGeneratedBy = new FPackageIndex(Ar);

            // Load serialized interface classes
            Interfaces = Ar.ReadArray(() => new FImplementedInterface(Ar));

            var bDeprecatedForceScriptOrder = Ar.ReadBoolean();
            var dummy = Ar.ReadFName();

            if (Ar.Ver >= EUnrealEngineObjectUE4Version.ADD_COOKED_TO_UCLASS)
            {
                bCooked = Ar.ReadBoolean();
            }

            // Defaults.
            ClassDefaultObject = new FPackageIndex(Ar);
        }
Example #21
0
        public void SerializeRenderItem(FAssetArchive Ar)
        {
            var stripDataFlags = Ar.Read <FStripDataFlags>();

            MaterialIndex = Ar.Read <short>();
            BaseIndex     = Ar.Read <int>();
            NumTriangles  = Ar.Read <int>();

            var bRecomputeTangent = Ar.ReadBoolean();

            if (FRecomputeTangentCustomVersion.Get(Ar) >= FRecomputeTangentCustomVersion.Type.RecomputeTangentVertexColorMask)
            {
                Ar.Position += 1;
            }

            bCastShadow     = Ar.ReadBoolean();
            BaseVertexIndex = Ar.Read <uint>();

            var clothMappingData = Ar.ReadArray(() => new FApexClothPhysToRenderVertData(Ar));

            HasClothData = clothMappingData.Length > 0;

            BoneMap           = Ar.ReadArray <ushort>();
            NumVertices       = Ar.Read <int>();
            MaxBoneInfluences = Ar.Read <int>();

            var correspondClothAssetIndex = Ar.Read <short>();
            var clothingData = Ar.Read <FClothingSectionData>();

            if (Ar.Game < EGame.GAME_UE4_23 || !stripDataFlags.IsClassDataStripped(1)) // DuplicatedVertices, introduced in UE4.23
            {
                Ar.SkipFixedArray(4);
                Ar.SkipFixedArray(8);
            }
            bDisabled = Ar.ReadBoolean();
            if (Ar.Game == EGame.GAME_ROGUECOMPANY)
            {
                Ar.Position += 4;
            }
        }
        public FTexturePlatformData(FAssetArchive Ar)
        {
            if (Ar.Game >= EGame.GAME_UE5_0 && Ar.IsFilterEditorOnly)
            {
                const long PlaceholderDerivedDataSize = 16;
                Ar.Position += PlaceholderDerivedDataSize;
            }

            if (Ar.Game == EGame.GAME_PlayerUnknownsBattlegrounds)
            {
                SizeX = Ar.Read <short>();
                SizeY = Ar.Read <short>();
                var data = Ar.ReadBytes(3); // int24
                PackedData = data[0] + (data[1] << 8) + (data[2] << 16);
            }
            else
            {
                SizeX      = Ar.Read <int>();
                SizeY      = Ar.Read <int>();
                PackedData = Ar.Read <int>();
            }

            PixelFormat = Ar.ReadFString();

            if ((PackedData & BitMask_HasOptData) == BitMask_HasOptData)
            {
                OptData = Ar.Read <FOptTexturePlatformData>();
            }

            FirstMipToSerialize = Ar.Read <int>(); // only for cooked, but we don't read FTexturePlatformData for non-cooked textures

            var mipCount = Ar.Read <int>();

            if (mipCount != 1 && Ar.Platform == ETexturePlatform.Playstation)
            {
                mipCount /= 3;                                                               // TODO: Some mips are corrupted, so this doesn't work 100% of the time.
            }
            Mips = new FTexture2DMipMap[mipCount];
            for (var i = 0; i < Mips.Length; i++)
            {
                Mips[i] = new FTexture2DMipMap(Ar);
            }

            if (Ar.Versions["VirtualTextures"])
            {
                var bIsVirtual = Ar.ReadBoolean();
                if (bIsVirtual)
                {
                    VTData = new FVirtualTextureBuiltData(Ar, FirstMipToSerialize);
                }
            }
        }
Example #23
0
        public override void Deserialize(FAssetArchive Ar, long validPos)
        {
            base.Deserialize(Ar, validPos);

            var _ = Ar.ReadBoolean(); // bLegacyGeneratedClassIsAuthoritative

            if (Ar.Ver < EUnrealEngineObjectUE4Version.BLUEPRINT_SKEL_CLASS_TRANSIENT_AGAIN &&
                Ar.Ver != EUnrealEngineObjectUE4Version.BLUEPRINT_SKEL_TEMPORARY_TRANSIENT)
            {
                SkeletonGeneratedClass = new FPackageIndex(Ar);
                GeneratedClass         = new FPackageIndex(Ar);
            }
        }
Example #24
0
        public override void Deserialize(FAssetArchive Ar, long validPos)
        {
            base.Deserialize(Ar, validPos);

            var numRows = Ar.Read <int>();

            CollisionDisableTable = new Dictionary <FRigidBodyIndexPair, bool>(numRows);
            for (var i = 0; i < numRows; i++)
            {
                var rowKey = new FRigidBodyIndexPair(Ar);
                CollisionDisableTable[rowKey] = Ar.ReadBoolean();
            }
        }
 public FStreamedAudioChunk(FAssetArchive Ar)
 {
     if (Ar.ReadBoolean()) // bCooked
     {
         BulkData      = new FByteBulkData(Ar);
         DataSize      = Ar.Read <int>();
         AudioDataSize = Ar.Read <int>();
     }
     else
     {
         Ar.Position -= sizeof(int);
         throw new ParserException(Ar, "StreamedAudioChunks must be cooked");
     }
 }
Example #26
0
        public override void Deserialize(FAssetArchive Ar, long validPos)
        {
            base.Deserialize(Ar, validPos);

            // serialize the function map
            FuncMap = new Dictionary <FName, FPackageIndex>();
            var funcMapNum = Ar.Read <int>();

            for (var i = 0; i < funcMapNum; i++)
            {
                FuncMap[Ar.ReadFName()] = new FPackageIndex(Ar);
            }

            // Class flags first.
            ClassFlags = Ar.Read <uint>();

            // Variables.
            ClassWithin     = new FPackageIndex(Ar);
            ClassConfigName = Ar.ReadFName();

            ClassGeneratedBy = new FPackageIndex(Ar);

            // Load serialized interface classes
            Interfaces = Ar.ReadArray(() => new FImplementedInterface(Ar));

            var bDeprecatedScriptOrder = Ar.ReadBoolean();
            var dummy = Ar.ReadFName();

            if ((int)Ar.Ver >= 241 /*VER_UE4_ADD_COOKED_TO_UCLASS*/)
            {
                bCooked = Ar.ReadBoolean();
            }

            // Defaults.
            ClassDefaultObject = new FPackageIndex(Ar);
        }
        public override void Deserialize(FAssetArchive Ar, long validPos)
        {
            base.Deserialize(Ar, validPos);

            if (FRenderingObjectVersion.Get(Ar) < FRenderingObjectVersion.Type.MovedParticleCutoutsToRequiredModule)
            {
                return;
            }
            var bCooked = Ar.ReadBoolean();

            if (bCooked)
            {
                BoundingGeometry = Ar.ReadArray <FVector2D>();
            }
        }
Example #28
0
            public FormatNumber(FAssetArchive Ar, ETextHistoryType historyType)
            {
                if (historyType == ETextHistoryType.AsCurrency &&
                    Ar.Ver >= UE4Version.VER_UE4_ADDED_CURRENCY_CODE_TO_FTEXT)
                {
                    CurrencyCode = Ar.ReadFString();
                }

                SourceValue = new FFormatArgumentValue(Ar);
                if (Ar.ReadBoolean()) // bHasFormatOptions
                {
                    FormatOptions = new FNumberFormattingOptions(Ar);
                }

                TargetCulture = Ar.ReadFString();
            }
Example #29
0
        private void SerializeInlineDataRepresentations(FAssetArchive Ar)
        {
            // Defined class flags for possible stripping
            const byte CardRepresentationDataStripFlag = 2;

            var stripFlags = new FStripDataFlags(Ar);

            if (!stripFlags.IsDataStrippedForServer() && !stripFlags.IsClassDataStripped(CardRepresentationDataStripFlag))
            {
                foreach (var lod in LODs)
                {
                    var bValid = Ar.ReadBoolean();
                    if (bValid)
                    {
                        lod.CardRepresentationData = new FCardRepresentationData(Ar);
                    }
                }
            }
        }
Example #30
0
        public FTexturePlatformData(FAssetArchive Ar)
        {
            SizeX     = Ar.Read <int>();
            SizeY     = Ar.Read <int>();
            NumSlices = Ar.Read <int>();

            PixelFormat = Ar.ReadFString();

            FirstMip = Ar.Read <int>();       // only for cooked, but we don't read FTexturePlatformData for non-cooked textures
            Mips     = Ar.ReadArray(() => new FTexture2DMipMap(Ar));

            if (Ar.Game >= EGame.GAME_UE4_23) // bIsVirtual
            {
                bIsVirtual = Ar.ReadBoolean();
                if (bIsVirtual)
                {
                    VTData = new FVirtualTextureBuiltData(Ar, FirstMip);
                }
            }
        }