diff --git a/schemes/skeleton.scheme b/schemes/skeleton.scheme index 1775dcaa..9fd83653 100644 --- a/schemes/skeleton.scheme +++ b/schemes/skeleton.scheme @@ -6,13 +6,3 @@ index = 5 display = bake model type = bool default = false - -[axes] -display = axes -type = string -default = +x+y+z - -[scale] -display = scale -type = real -default = 1 diff --git a/sources/asset-processor/model.cpp b/sources/asset-processor/model.cpp index 662b6e9f..15d1aaba 100644 --- a/sources/asset-processor/model.cpp +++ b/sources/asset-processor/model.cpp @@ -71,18 +71,6 @@ namespace return result; } - void transformSkeleton(SkeletonRig *skel, const Mat3 &axesScale_) - { - const Mat4 axesScale = Mat4(axesScale_); - const Mat4 axesScaleInv = inverse(axesScale); - Mat4 gi = skel->globalInverse(); - std::vector is(skel->invRests().begin(), skel->invRests().end()); - gi = gi * axesScale; - for (Mat4 &t : is) - t = t * axesScaleInv; - skel->skeletonData(gi, skel->parents(), skel->bases(), is); - } - void transformMesh(Mesh *msh, const Mat3 &axes, const Mat3 &axesScale) { std::vector p(msh->positions().begin(), msh->positions().end()); @@ -102,9 +90,9 @@ void meshImportTransform(MeshImportResult &result) const Mat3 axesScale = axes * toFloat(properties("scale")); if (axesScale == Mat3()) return; - CAGE_LOG(SeverityEnum::Warning, logComponentName, Stringizer() + "using axes/scale conversion matrix: " + axesScale); + CAGE_LOG(SeverityEnum::Info, logComponentName, Stringizer() + "using axes/scale conversion matrix: " + axesScale); if (result.skeleton) - transformSkeleton(+result.skeleton, axesScale); + CAGE_THROW_ERROR(Exception, "meshes with skeletal animations cannot have axes/scale transformation"); for (auto &it : result.parts) { transformMesh(+it.mesh, axes, axesScale); @@ -255,12 +243,14 @@ void processModel() config.trianglesOnly = toBool(properties("trianglesOnly")); config.passInvalidVectors = toBool(properties("passInvalidNormals")); MeshImportResult result = meshImportFiles(inputFileName, config); + meshImportTransform(result); CAGE_LOG(SeverityEnum::Info, logComponentName, "converting materials to cage format"); meshImportConvertToCageFormats(result); - meshImportTransform(result); meshImportNotifyUsedFiles(result); const uint32 partIndex = meshImportSelectIndex(result); const MeshImportPart &part = result.parts[partIndex]; + if (part.mesh->verticesCount() == 0) + CAGE_THROW_ERROR(Exception, "the mesh is empty"); ModelDataFlags flags = ModelDataFlags::None; setFlags(flags, ModelDataFlags::Uvs2, !part.mesh->uvs().empty() || !part.mesh->uvs3().empty(), "uvs"); diff --git a/sources/asset-processor/skeleton.cpp b/sources/asset-processor/skeleton.cpp index 7160f77f..343e749f 100644 --- a/sources/asset-processor/skeleton.cpp +++ b/sources/asset-processor/skeleton.cpp @@ -4,13 +4,11 @@ #include MeshImportConfig meshImportConfig(); -void meshImportTransform(MeshImportResult &result); void meshImportNotifyUsedFiles(const MeshImportResult &result); void processSkeleton() { MeshImportResult result = meshImportFiles(inputFileName, meshImportConfig()); - meshImportTransform(result); meshImportNotifyUsedFiles(result); if (!result.skeleton) CAGE_THROW_ERROR(Exception, "loaded no skeleton");