Esempio n. 1
0
        protected override YAMLMappingNode ExportYAMLRoot()
        {
#warning TODO: provide for null values

            YAMLMappingNode node = base.ExportYAMLRoot();
            node.AddSerializedVersion(SerializedVersion);
            node.Add("m_SubMeshes", SubMeshes.ExportYAML());
            node.Add("m_Shapes", Shapes.ExportYAML());
            node.Add("m_BindPose", BindPoses.ExportYAML());
#warning ???
            node.Add("m_BoneNames", YAMLSequenceNode.Empty);
            node.Add("m_BoneNameHashes", BoneNameHashes.ExportYAML(false));
#warning ???
            node.Add("m_RootBoneName", YAMLScalarNode.Empty);
            node.Add("m_RootBoneNameHash", RootBoneNameHash);
            node.Add("m_MeshCompression", MeshCompression);
            node.Add("m_IsReadable", IsReadable);
            node.Add("m_KeepVertices", KeepVertices);
            node.Add("m_KeepIndices", KeepIndices);
            node.Add("m_IndexBuffer", IndexBuffer.ExportYAML());
            node.Add("m_Skin", Skin.ExportYAML());
            node.Add("m_VertexData", VertexData.ExportYAML());
            node.Add("m_CompressedMesh", CompressedMesh.ExportYAML());
            node.Add("m_LocalAABB", LocalAABB.ExportYAML());
            node.Add("m_MeshUsageFlags", MeshUsageFlags);
            if (IsReadCollision)
            {
                node.Add("m_BakedConvexCollisionMesh", CollisionData.BakedConvexCollisionMesh.ExportYAML());
                node.Add("m_BakedTriangleCollisionMesh", CollisionData.BakedTriangleCollisionMesh.ExportYAML());
            }
            else
            {
                node.Add("m_BakedConvexCollisionMesh", ArrayExtensions.EmptyBytes.ExportYAML());
                node.Add("m_BakedTriangleCollisionMesh", ArrayExtensions.EmptyBytes.ExportYAML());
            }
#warning ???
            node.Add("m_MeshOptimized", 0);

            return(node);
        }
Esempio n. 2
0
        protected override YAMLMappingNode ExportYAMLRoot(IAssetsExporter exporter)
        {
#warning TODO: values acording to read version (current 2017.3.0f3)
            YAMLMappingNode node = base.ExportYAMLRoot(exporter);
            node.AddSerializedVersion(GetSerializedVersion(exporter.Version));
            node.Add("m_SubMeshes", SubMeshes.ExportYAML(exporter));
            node.Add("m_Shapes", Shapes.ExportYAML(exporter));
            node.Add("m_BindPose", BindPoses.ExportYAML(exporter));
#warning ???
            node.Add("m_BoneNames", YAMLSequenceNode.Empty);
            node.Add("m_BoneNameHashes", IsReadBoneNameHashes(exporter.Version) ? BoneNameHashes.ExportYAML(false) : YAMLSequenceNode.Empty);
#warning ???
            node.Add("m_RootBoneName", YAMLScalarNode.Empty);
            node.Add("m_RootBoneNameHash", RootBoneNameHash);
            node.Add("m_MeshCompression", MeshCompression);
            node.Add("m_IsReadable", IsReadable);
            node.Add("m_KeepVertices", KeepVertices);
            node.Add("m_KeepIndices", KeepIndices);
            node.Add("m_IndexBuffer", IsReadIndexBuffer(exporter.Version) ? IndexBuffer.ExportYAML() : YAMLSequenceNode.Empty);
            node.Add("m_Skin", Skin.ExportYAML(exporter));
            node.Add("m_VertexData", VertexData.ExportYAML(exporter));
            node.Add("m_CompressedMesh", CompressedMesh.ExportYAML(exporter));
            node.Add("m_LocalAABB", LocalAABB.ExportYAML(exporter));
            node.Add("m_MeshUsageFlags", MeshUsageFlags);
            if (IsReadCollision(exporter.Version))
            {
                node.Add("m_BakedConvexCollisionMesh", CollisionData.BakedConvexCollisionMesh.ExportYAML());
                node.Add("m_BakedTriangleCollisionMesh", CollisionData.BakedTriangleCollisionMesh.ExportYAML());
            }
            else
            {
                node.Add("m_BakedConvexCollisionMesh", ArrayExtensions.EmptyBytes.ExportYAML());
                node.Add("m_BakedTriangleCollisionMesh", ArrayExtensions.EmptyBytes.ExportYAML());
            }
#warning ???
            node.Add("m_MeshOptimized", 0);

            return(node);
        }
Esempio n. 3
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);
        }