2
0
Эх сурвалжийг харах

- Bugfix: fixed Collada parser to accept empty data elements again
- Workaround: added a little extra code to handle texture filenames of Maxon Cinema Collada Exporter

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1231 67173fc5-114c-0410-ac8e-9d2fd5bffc1f

ulfjorensen 13 жил өмнө
parent
commit
5975f3eff2

+ 9 - 0
code/ColladaLoader.cpp

@@ -1399,6 +1399,15 @@ void ColladaLoader::ConvertPath (aiString& ss)
 		ss.data[ss.length] = '\0';
 		ss.data[ss.length] = '\0';
 	}
 	}
 
 
+  // Maxon Cinema Collada Export writes "file:///C:\andsoon" with three slashes... 
+  // I need to filter it without destroying linux paths starting with "/somewhere"
+  if( ss.data[0] == '/' && isalpha( ss.data[1]) && ss.data[2] == ':' )
+  {
+    ss.length--;
+    memmove( ss.data, ss.data+1, ss.length);
+    ss.data[ss.length] = 0;
+  }
+
   // find and convert all %xyz special chars
   // find and convert all %xyz special chars
   char* out = ss.data;
   char* out = ss.data;
   for( const char* it = ss.data; it != ss.data + ss.length; /**/ )
   for( const char* it = ss.data; it != ss.data + ss.length; /**/ )

+ 6 - 6
code/ColladaParser.cpp

@@ -1695,10 +1695,10 @@ void ColladaParser::ReadDataArray()
 				SkipSpacesAndLineEnd( &content);
 				SkipSpacesAndLineEnd( &content);
 			}
 			}
 		}
 		}
-	}
 
 
-	// test for closing tag
-	TestClosing( elmName.c_str());
+    // test for closing tag
+    TestClosing( elmName.c_str());
+	}
 }
 }
 
 
 // ------------------------------------------------------------------------------------------------
 // ------------------------------------------------------------------------------------------------
@@ -2705,11 +2705,11 @@ const char* ColladaParser::TestTextContent()
 {
 {
 	// present node should be the beginning of an element
 	// present node should be the beginning of an element
 	if( mReader->getNodeType() != irr::io::EXN_ELEMENT || mReader->isEmptyElement())
 	if( mReader->getNodeType() != irr::io::EXN_ELEMENT || mReader->isEmptyElement())
-		ThrowException( "Expected opening element");
+		return NULL;
 
 
 	// read contents of the element
 	// read contents of the element
-	if( !mReader->read())
-		ThrowException( "Unexpected end of file while reading n element.");
+	if( !mReader->read() )
+		return NULL;
 	if( mReader->getNodeType() != irr::io::EXN_TEXT)
 	if( mReader->getNodeType() != irr::io::EXN_TEXT)
 		return NULL;
 		return NULL;