示例#1
0
        public YAMLNode ExportYAML(IExportContainer container)
        {
            YAMLMappingNode node = new YAMLMappingNode();

            node.Add(VerticesName, Vertices.ExportYAML(container));
            node.Add(UVName, UV.ExportYAML(container));
            if (HasBindPoses(container.ExportVersion))
            {
                node.Add(BindPosesName, BindPoses.ExportYAML(container));
            }

            node.Add(NormalsName, Normals.ExportYAML(container));
            node.Add(TangentsName, Tangents.ExportYAML(container));
            node.Add(WeightsName, Weights.ExportYAML(container));
            node.Add(NormalSignsName, NormalSigns.ExportYAML(container));
            node.Add(TangentSignsName, TangentSigns.ExportYAML(container));
            if (HasFloatColors(container.ExportVersion))
            {
                node.Add(FloatColorsName, FloatColors.ExportYAML(container));
            }

            node.Add(BoneIndicesName, BoneIndices.ExportYAML(container));
            node.Add(TrianglesName, Triangles.ExportYAML(container));
            if (HasColors(container.ExportVersion))
            {
                node.Add(ColorsName, Colors.ExportYAML(container));
            }
            if (HasUVInfo(container.ExportVersion))
            {
                node.Add(UVInfoName, UVInfo);
            }
            return(node);
        }
示例#2
0
        public YAMLNode ExportYAML(IExportContainer container)
        {
            YAMLMappingNode node = new YAMLMappingNode();

            node.Add("m_Vertices", Vertices.ExportYAML(container));
            node.Add("m_UV", UV.ExportYAML(container));
            node.Add("m_Normals", Normals.ExportYAML(container));
            node.Add("m_Tangents", Tangents.ExportYAML(container));
            node.Add("m_Weights", Weight.ExportYAML(container));
            node.Add("m_NormalSigns", NormalSigns.ExportYAML(container));
            node.Add("m_TangentSigns", TangentSigns.ExportYAML(container));
            node.Add("m_FloatColors", IsReadFloatColors(container.Version) ? FloatColors.ExportYAML(container) : default(PackedFloatVector).ExportYAML(container));
            node.Add("m_BoneIndices", BoneIndices.ExportYAML(container));
            node.Add("m_Triangles", Triangles.ExportYAML(container));
            node.Add("m_UVInfo", UVInfo);
            return(node);
        }
示例#3
0
        public YAMLNode ExportYAML(IAssetsExporter exporter)
        {
#warning TODO: values acording to read version (current 2017.3.0f3)
            YAMLMappingNode node = new YAMLMappingNode();
            node.Add("m_Vertices", Vertices.ExportYAML(exporter));
            node.Add("m_UV", UV.ExportYAML(exporter));
            node.Add("m_Normals", Normals.ExportYAML(exporter));
            node.Add("m_Tangents", Tangents.ExportYAML(exporter));
            node.Add("m_Weights", Weight.ExportYAML(exporter));
            node.Add("m_NormalSigns", NormalSigns.ExportYAML(exporter));
            node.Add("m_TangentSigns", TangentSigns.ExportYAML(exporter));
            node.Add("m_FloatColors", IsReadFloatColors(exporter.Version) ? FloatColors.ExportYAML(exporter) : default(PackedFloatVector).ExportYAML(exporter));
            node.Add("m_BoneIndices", BoneIndices.ExportYAML(exporter));
            node.Add("m_Triangles", Triangles.ExportYAML(exporter));
            node.Add("m_UVInfo", UVInfo);
            return(node);
        }
示例#4
0
        public YAMLNode ExportYAML()
        {
#warning TODO: support different versions
            YAMLMappingNode node = new YAMLMappingNode();
            node.Add("m_Vertices", Vertices.ExportYAML());
            node.Add("m_UV", UV.ExportYAML());
            node.Add("m_Normals", Normals.ExportYAML());
            node.Add("m_Tangents", Tangents.ExportYAML());
            node.Add("m_Weights", Weight.ExportYAML());
            node.Add("m_NormalSigns", NormalSigns.ExportYAML());
            node.Add("m_TangentSigns", TangentSigns.ExportYAML());
            if (IsReadFloatColors)
            {
                node.Add("m_FloatColors", FloatColors.ExportYAML());
            }
            else
            {
                node.Add("m_FloatColors", PackedFloatVector.Empty.ExportYAML());
            }
            node.Add("m_BoneIndices", BoneIndices.ExportYAML());
            node.Add("m_Triangles", Triangles.ExportYAML());
            node.Add("m_UVInfo", UVInfo);
            return(node);
        }
示例#5
0
        protected override YAMLMappingNode ExportYAMLRoot(IExportContainer container)
        {
            YAMLMappingNode node = base.ExportYAMLRoot(container);

            node.AddSerializedVersion(ToSerializedVersion(container.ExportVersion));
            if (HasLODData(container.ExportVersion))
            {
                node.Add(LODDataName, LODData.ExportYAML(container));
            }
            else
            {
                if (HasUse16bitIndices(container.ExportVersion))
                {
                    node.Add(Use16BitIndicesName, Use16BitIndices);
                }
                if (IsIndexBufferFirst(container.ExportVersion))
                {
                    node.Add(IndexBufferName, IndexBuffer.ExportYAML());
                }
                node.Add(SubMeshesName, SubMeshes.ExportYAML(container));
            }

            if (HasBlendShapes(container.ExportVersion))
            {
                if (HasBlendChannels(container.ExportVersion))
                {
                    node.Add(ShapesName, Shapes.ExportYAML(container));
                }
                else
                {
                    node.Add(ShapesName, BlendShapes.ExportYAML(container));
                    node.Add(ShapeVerticesName, ShapeVertices.ExportYAML(container));
                }
            }
            if (HasBindPose(container.ExportVersion))
            {
                if (IsBindPoseFirst(container.ExportVersion))
                {
                    node.Add(BindPoseName, BindPose.ExportYAML(container));
                }
            }
            if (HasBoneNameHashes(container.ExportVersion))
            {
                node.Add(BoneNameHashesName, BoneNameHashes.ExportYAML(true));
                node.Add(RootBoneNameHashName, RootBoneNameHash);
            }
            if (HasBonesAABB(container.ExportVersion))
            {
                node.Add(BonesAABBName, BonesAABB.ExportYAML(container));
                node.Add(VariableBoneCountWeightsName, VariableBoneCountWeights.ExportYAML(container));
            }

            if (HasMeshCompression(container.ExportVersion))
            {
                node.Add(MeshCompressionName, (byte)MeshCompression);
            }
            if (HasStreamCompression(container.ExportVersion))
            {
                node.Add(StreamCompressionName, StreamCompression);
            }
            if (HasIsReadable(container.ExportVersion))
            {
                node.Add(IsReadableName, IsReadable);
                node.Add(KeepVerticesName, KeepVertices);
                node.Add(KeepIndicesName, KeepIndices);
            }

            if (HasIndexFormat(container.ExportVersion))
            {
                node.Add(IndexFormatName, (int)IndexFormat);
            }

            if (!HasLODData(container.ExportVersion))
            {
                if (!IsIndexBufferFirst(container.ExportVersion))
                {
                    node.Add(IndexBufferName, IndexBuffer.ExportYAML());
                }
            }

            if (HasVertexData(container.ExportVersion))
            {
                if (!IsOnlyVertexData(container.ExportVersion))
                {
                    if (MeshCompression != MeshCompression.Off)
                    {
                        node.Add(VerticesName, Vertices.ExportYAML(container));
                    }
                }
            }
            else
            {
                node.Add(VerticesName, Vertices.ExportYAML(container));
            }

            if (HasSkin(container.ExportVersion))
            {
                node.Add(SkinName, Skin.ExportYAML(container));
            }
            if (HasBindPose(container.ExportVersion))
            {
                if (!IsBindPoseFirst(container.ExportVersion))
                {
                    node.Add(BindPoseName, BindPose.ExportYAML(container));
                }
            }

            if (HasVertexData(container.ExportVersion))
            {
                if (IsOnlyVertexData(container.ExportVersion))
                {
                    node.Add(VertexDataName, VertexData.ExportYAML(container));
                }
                else
                {
                    if (MeshCompression == MeshCompression.Off)
                    {
                        node.Add(VertexDataName, VertexData.ExportYAML(container));
                    }
                    else
                    {
                        node.Add(UVName, UV.ExportYAML(container));
                        node.Add(UV1Name, UV1.ExportYAML(container));
                        node.Add(TangentsName, Tangents.ExportYAML(container));
                        node.Add(NormalsName, Normals.ExportYAML(container));
                        node.Add(ColorsName, Colors.ExportYAML(container));
                    }
                }
            }
            else
            {
                node.Add(UVName, UV.ExportYAML(container));
                if (HasUV1(container.ExportVersion))
                {
                    node.Add(UV1Name, UV1.ExportYAML(container));
                }
                if (HasTangentSpace(container.ExportVersion))
                {
                    node.Add(TangentSpaceName, Tangents.ExportYAML(container));
                }
                else
                {
                    node.Add(TangentsName, Tangents.ExportYAML(container));
                    node.Add(NormalsName, Normals.ExportYAML(container));
                }
            }

            if (HasCompressedMesh(container.ExportVersion))
            {
                node.Add(CompressedMeshName, CompressedMesh.ExportYAML(container));
            }

            node.Add(LocalAABBName, LocalAABB.ExportYAML(container));
            if (!HasVertexData(container.ExportVersion))
            {
                node.Add(ColorsName, Colors.ExportYAML(container));
            }
            if (HasCollisionTriangles(container.ExportVersion))
            {
                node.Add(CollisionTrianglesName, CollisionTriangles.ExportYAML(true));
                node.Add(CollisionVertexCountName, CollisionVertexCount);
            }
            if (HasMeshUsageFlags(container.ExportVersion))
            {
                node.Add(MeshUsageFlagsName, MeshUsageFlags);
            }

            if (HasCollision(container.ExportVersion))
            {
                node.Add(BakedConvexCollisionMeshName, CollisionData.BakedConvexCollisionMesh.ExportYAML());
                node.Add(BakedTriangleCollisionMeshName, CollisionData.BakedTriangleCollisionMesh.ExportYAML());
            }
            if (HasMeshMetrics(container.ExportVersion))
            {
                node.Add(MeshMetricsName + "[0]", MeshMetrics[0]);
                node.Add(MeshMetricsName + "[1]", MeshMetrics[1]);
            }
            if (HasMeshOptimization(container.ExportVersion, container.ExportFlags))
            {
                if (IsMeshOptimizationFlags(container.ExportVersion))
                {
                    node.Add(MeshOptimizationFlagsName, (int)MeshOptimizationFlags);
                }
                else
                {
                    node.Add(MeshOptimizedName, MeshOptimized);
                }
            }
            if (HasStreamData(container.ExportVersion))
            {
                StreamingInfo streamData = new StreamingInfo(true);
                node.Add(StreamDataName, streamData.ExportYAML(container));
            }
            return(node);
        }