Exemplo n.º 1
0
        public override void Deserialize(FAssetArchive Ar, long validPos)
        {
            base.Deserialize(Ar, validPos);
            _parent = GetOrDefault <ResolvedObject>(nameof(Parent));
            bHasStaticPermutationResource = GetOrDefault <bool>("bHasStaticPermutationResource");
            BasePropertyOverrides         = GetOrDefault <FMaterialInstanceBasePropertyOverrides>(nameof(BasePropertyOverrides));
            StaticParameters = GetOrDefault <FStaticParameterSet>(nameof(StaticParameters));

            var bSavedCachedData = FUE5MainStreamObjectVersion.Get(Ar) >= FUE5MainStreamObjectVersion.Type.MaterialSavedCachedData && Ar.ReadBoolean();

            if (bSavedCachedData)
            {
                CachedData = new FStructFallback(Ar, "MaterialInstanceCachedData");
            }

            if (bHasStaticPermutationResource)
            {
                if (Ar.Ver >= EUnrealEngineObjectUE4Version.PURGED_FMATERIAL_COMPILE_OUTPUTS)
                {
                    if (FRenderingObjectVersion.Get(Ar) < FRenderingObjectVersion.Type.MaterialAttributeLayerParameters)
                    {
                        StaticParameters = new FStaticParameterSet(Ar);
                    }

#if READ_SHADER_MAPS
                    DeserializeInlineShaderMaps(Ar, LoadedMaterialResources);
#else
                    Ar.Position = validPos; // TODO This skips every data after the inline shader map data, find a way to properly skip it
#endif
                }
            }

#if !READ_SHADER_MAPS
            Ar.Position = validPos;
#endif
        }
Exemplo n.º 2
0
 public override void Deserialize(FAssetArchive Ar, long validPos)
 {
     base.Deserialize(Ar, validPos);
     Parent = GetOrDefault <UUnrealMaterial>(nameof(Parent));
     BasePropertyOverrides = GetOrDefault <FMaterialInstanceBasePropertyOverrides>(nameof(BasePropertyOverrides));
 }