Example #1
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            DefaultAnimation.Read(reader);
            if (IsReadAnimationsPaired(reader.Version))
            {
                m_animationsPaired = reader.ReadTupleStringTArray <PPtr <AnimationClip> >();
            }
            else
            {
                m_animations = reader.ReadArray <PPtr <AnimationClip> >();
            }
            WrapMode          = (WrapMode)reader.ReadInt32();
            PlayAutomatically = reader.ReadBoolean();
            AnimatePhysics    = reader.ReadBoolean();
            if (IsReadAnimateOnlyIfVisible(reader.Version))
            {
                AnimateOnlyIfVisible = reader.ReadBoolean();
            }
            if (IsAlign(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
            }

            if (IsReadCullingType(reader.Version))
            {
                CullingType = (AnimationCullingType)reader.ReadInt32();
            }

            if (IsReadUserAABB(reader.Version))
            {
                UserAABB.Read(reader);
            }
        }
Example #2
0
        protected override YAMLMappingNode ExportYAMLRoot(IExportContainer container)
        {
            YAMLMappingNode node   = base.ExportYAMLRoot(container);
            AnimationLayout layout = container.ExportLayout.Animation;

            node.AddSerializedVersion(layout.Version);
            node.Add(layout.AnimationName, DefaultAnimation.ExportYAML(container));
            if (layout.HasAnimations)
            {
                node.Add(layout.AnimationsName, Animations.ExportYAML(container));
            }
            else
            {
                node.Add(layout.AnimationsName, AnimationsPaired.ExportYAML(container));
            }

            node.Add(layout.WrapModeName, (int)WrapMode);
            node.Add(layout.PlayAutomaticallyName, PlayAutomatically);
            node.Add(layout.AnimatePhysicsInvariantName, AnimatePhysics);
            if (layout.HasAnimateOnlyIfVisible)
            {
                node.Add(layout.CullingTypeName, AnimateOnlyIfVisible);
            }
            if (layout.HasCullingType)
            {
                node.Add(layout.CullingTypeName, (int)CullingType);
            }
            if (layout.HasUserAABB)
            {
                node.Add(layout.UserAABBName, UserAABB.ExportYAML(container));
            }
            return(node);
        }
Example #3
0
        public override void Write(AssetWriter writer)
        {
            base.Write(writer);

            AnimationLayout layout = writer.Layout.Animation;

            DefaultAnimation.Write(writer);
            if (layout.HasAnimations)
            {
                Animations.Write(writer);
            }
            else
            {
                AnimationsPaired.Write(writer);
            }

            writer.Write((int)WrapMode);
            writer.Write(PlayAutomatically);
            writer.Write(AnimatePhysics);
            if (layout.HasAnimateOnlyIfVisible)
            {
                writer.Write(AnimateOnlyIfVisible);
            }
            if (layout.IsAlign)
            {
                writer.AlignStream();
            }

            if (layout.HasCullingType)
            {
                writer.Write((int)CullingType);
            }
            if (layout.HasUserAABB)
            {
                UserAABB.Write(writer);
            }
        }
Example #4
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            AnimationLayout layout = reader.Layout.Animation;

            DefaultAnimation.Read(reader);
            if (layout.HasAnimations)
            {
                Animations = reader.ReadAssetArray <PPtr <AnimationClip> >();
            }
            else
            {
                AnimationsPaired = reader.ReadTupleStringTArray <PPtr <AnimationClip> >();
            }

            WrapMode          = (WrapMode)reader.ReadInt32();
            PlayAutomatically = reader.ReadBoolean();
            AnimatePhysics    = reader.ReadBoolean();
            if (layout.HasAnimateOnlyIfVisible)
            {
                AnimateOnlyIfVisible = reader.ReadBoolean();
            }
            if (layout.IsAlign)
            {
                reader.AlignStream();
            }

            if (layout.HasCullingType)
            {
                CullingType = (AnimationCullingType)reader.ReadInt32();
            }
            if (layout.HasUserAABB)
            {
                UserAABB.Read(reader);
            }
        }