|
@@ -1983,7 +1983,8 @@ void ColladaParser::ReadIndexData( Mesh* pMesh)
|
|
}
|
|
}
|
|
|
|
|
|
// small sanity check
|
|
// small sanity check
|
|
- if (primType != Prim_TriFans && primType != Prim_TriStrips)
|
|
|
|
|
|
+ if (primType != Prim_TriFans && primType != Prim_TriStrips &&
|
|
|
|
+ primType != Prim_Lines) // this is ONLY to workaround a bug in SketchUp 15.3.331 where it writes the wrong 'count' when it writes out the 'lines'.
|
|
ai_assert(actualPrimitives == numPrimitives);
|
|
ai_assert(actualPrimitives == numPrimitives);
|
|
|
|
|
|
// only when we're done reading all <p> tags (and thus know the final vertex count) can we commit the submesh
|
|
// only when we're done reading all <p> tags (and thus know the final vertex count) can we commit the submesh
|
|
@@ -2091,9 +2092,15 @@ size_t ColladaParser::ReadPrimitives( Mesh* pMesh, std::vector<InputChannel>& pP
|
|
}
|
|
}
|
|
|
|
|
|
// complain if the index count doesn't fit
|
|
// complain if the index count doesn't fit
|
|
- if( expectedPointCount > 0 && indices.size() != expectedPointCount * numOffsets)
|
|
|
|
- ThrowException( "Expected different index count in <p> element.");
|
|
|
|
- else if( expectedPointCount == 0 && (indices.size() % numOffsets) != 0)
|
|
|
|
|
|
+ if( expectedPointCount > 0 && indices.size() != expectedPointCount * numOffsets) {
|
|
|
|
+ if (pPrimType == Prim_Lines) {
|
|
|
|
+ // HACK: We just fix this number since SketchUp 15.3.331 writes the wrong 'count' for 'lines'
|
|
|
|
+ ReportWarning( "Expected different index count in <p> element, %d instead of %d.", indices.size(), expectedPointCount * numOffsets);
|
|
|
|
+ pNumPrimitives = (indices.size() / numOffsets) / 2;
|
|
|
|
+ } else
|
|
|
|
+ ThrowException( "Expected different index count in <p> element.");
|
|
|
|
+
|
|
|
|
+ } else if( expectedPointCount == 0 && (indices.size() % numOffsets) != 0)
|
|
ThrowException( "Expected different index count in <p> element.");
|
|
ThrowException( "Expected different index count in <p> element.");
|
|
|
|
|
|
// find the data for all sources
|
|
// find the data for all sources
|
|
@@ -2696,6 +2703,21 @@ AI_WONT_RETURN void ColladaParser::ThrowException( const std::string& pError) co
|
|
throw DeadlyImportError( boost::str( boost::format( "Collada: %s - %s") % mFileName % pError));
|
|
throw DeadlyImportError( boost::str( boost::format( "Collada: %s - %s") % mFileName % pError));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void ColladaParser::ReportWarning(const char* msg,...)
|
|
|
|
+{
|
|
|
|
+ ai_assert(NULL != msg);
|
|
|
|
+
|
|
|
|
+ va_list args;
|
|
|
|
+ va_start(args,msg);
|
|
|
|
+
|
|
|
|
+ char szBuffer[3000];
|
|
|
|
+ const int iLen = vsprintf(szBuffer,msg,args);
|
|
|
|
+ ai_assert(iLen > 0);
|
|
|
|
+
|
|
|
|
+ va_end(args);
|
|
|
|
+ DefaultLogger::get()->warn("Validation warning: " + std::string(szBuffer,iLen));
|
|
|
|
+}
|
|
|
|
+
|
|
// ------------------------------------------------------------------------------------------------
|
|
// ------------------------------------------------------------------------------------------------
|
|
// Skips all data until the end node of the current element
|
|
// Skips all data until the end node of the current element
|
|
void ColladaParser::SkipElement()
|
|
void ColladaParser::SkipElement()
|