示例#1
0
        public override IEnumerable <Object> FetchDependencies(ISerializedFile file, bool isLog = false)
        {
            foreach (Object @object in base.FetchDependencies(file, isLog))
            {
                yield return(@object);
            }

            if (IsReadOffscreen(file.Version))
            {
                yield return(DisableAnimationWhenOffscreen.FetchDependency(file, isLog, ToLogString, "m_DisableAnimationWhenOffscreen"));
            }
            yield return(Mesh.FetchDependency(file, isLog, ToLogString, "m_Mesh"));

            foreach (PPtr <Transform> ptr in Bones)
            {
                if (!ptr.IsNull)
                {
                    yield return(ptr.GetAsset(file));
                }
            }
            if (!RootBone.IsNull)
            {
                yield return(RootBone.GetAsset(file));
            }
        }
示例#2
0
        public override IEnumerable <Object> FetchDependencies(bool isLog = false)
        {
            foreach (Object @object in base.FetchDependencies(isLog))
            {
                yield return(@object);
            }

            if (IsReadOffscreen)
            {
                if (!DisableAnimationWhenOffscreen.IsNull)
                {
                    Animation anim = DisableAnimationWhenOffscreen.GetObject();
                    if (anim == null)
                    {
                        if (isLog)
                        {
                            Logger.Log(LogType.Warning, LogCategory.Export, $"{ToLogString()} m_DisableAnimationWhenOffscreen {DisableAnimationWhenOffscreen.ToLogString()} wasn't found ");
                        }
                    }
                    else
                    {
                        yield return(anim);
                    }
                }
            }
            if (!Mesh.IsNull)
            {
                Mesh mesh = Mesh.FindObject();
                if (mesh == null)
                {
                    Logger.Log(LogType.Warning, LogCategory.Export, $"{ToLogString()} m_Mesh {Mesh.ToLogString()} wasn't found ");
                }
                else
                {
                    yield return(mesh);
                }
            }
            foreach (PPtr <Transform> ptr in Bones)
            {
                yield return(ptr.GetObject());
            }
            if (!RootBone.IsNull)
            {
                yield return(RootBone.GetObject());
            }
        }
        public override void Read(AssetReader reader)
        {
            if (IsReadRenderer(reader.Version))
            {
                base.Read(reader);
            }
            else
            {
                ReadBase(reader);
            }

            if (IsReadUpdateWhenOffscreen(reader.Version))
            {
                if (IsReadQualityFirst(reader.Version))
                {
                    Quality = reader.ReadInt32();
                }
                UpdateWhenOffscreen = reader.ReadBoolean();
                if (!IsReadQualityFirst(reader.Version))
                {
                    Quality = reader.ReadInt32();
                }
            }

            if (IsReadSkinNormals(reader.Version))
            {
                SkinNormals = reader.ReadBoolean();
            }
            if (IsReadSkinMotionVector(reader.Version))
            {
                SkinnedMotionVectors = reader.ReadBoolean();
            }
            if (IsAlignBools(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
            }

            if (IsReadOffscreen(reader.Version))
            {
                DisableAnimationWhenOffscreen.Read(reader);
            }

            if (IsReadMeshFirst(reader.Version))
            {
                Mesh.Read(reader);
            }

            if (IsReadAnimation(reader.Version))
            {
                Animation.Read(reader);
            }

            m_bones = reader.ReadAssetArray <PPtr <Transform> >();
            if (IsAlignBones(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
            }

            if (!IsReadMeshFirst(reader.Version))
            {
                Mesh.Read(reader);
            }

            if (IsReadBindPose(reader.Version))
            {
                m_bindPose = reader.ReadAssetArray <Matrix4x4f>();
            }
            if (IsReadCurrentPose(reader.Version))
            {
                CurrentPose.Read(reader);
            }

            if (IsReadWeights(reader.Version))
            {
                m_blendShapeWeights = reader.ReadSingleArray();
            }
            if (IsReadRootBone(reader.Version))
            {
                RootBone.Read(reader);
            }
            if (IsReadAABB(reader.Version))
            {
                AABB.Read(reader);
                DirtyAABB = reader.ReadBoolean();
                if (IsAlignDirty(reader.Version))
                {
                    reader.AlignStream(AlignType.Align4);
                }
            }
        }
示例#4
0
        public override void Read(EndianStream stream)
        {
            base.Read(stream);

            Quality             = stream.ReadInt32();
            UpdateWhenOffscreen = stream.ReadBoolean();

            if (IsReadSkinNormals)
            {
                SkinNormals = stream.ReadBoolean();
            }
            if (IsReadSkinMotionVector)
            {
                SkinnedMotionVectors = stream.ReadBoolean();
            }
            stream.AlignStream(AlignType.Align4);

            if (IsReadOffscreen)
            {
                DisableAnimationWhenOffscreen.Read(stream);
            }

            Mesh.Read(stream);

            int bonesCount = stream.ReadInt32();

            m_bones = new PPtr <Transform> [bonesCount];
            for (int i = 0; i < bonesCount; i++)
            {
                PPtr <Transform> bone = new PPtr <Transform>(AssetsFile);
                bone.Read(stream);
                m_bones[i] = bone;
            }
            stream.AlignStream(AlignType.Align4);

            if (IsReadBindPose)
            {
                BindPose.Read(stream);
            }

            if (IsReadAABB)
            {
                if (IsReadWeights)
                {
                    int weightCount = stream.ReadInt32();
                    m_blendShapeWeights = new float[weightCount];
                    for (int i = 0; i < weightCount; i++)
                    {
                        float weight = stream.ReadSingle();
                        m_blendShapeWeights[i] = weight;
                    }
                }

                if (IsReadRootBone)
                {
                    RootBone.Read(stream);
                }

                AABB.Read(stream);
                DirtyAABB = stream.ReadBoolean();
                stream.AlignStream(AlignType.Align4);
            }
        }