// Look for a target submesh assuming that the COLLADA exporter did not // do any special name mangling. I've tested this against files emitted // from Maya; I expect it will work for DAE files from other sources, too, // such as Blender or XSI. Time will tell... private static string GetTargetSubmeshGeneralStyle(Mesh mesh, string collisionSubmesh) { string targetName = String.Empty; CvNameParser parser = new CvNameParser(); parser.AnalyzeName(collisionSubmesh); if (parser.IsValid) { // Form the target name as the first submesh name and see if // there is actually matching submesh. string candidate = parser.Target + ".0"; for (int i = 0; i < mesh.SubMeshCount; i++) { if (mesh.GetSubMesh(i).Name.Equals(candidate)) { targetName = candidate; break; } } } return(targetName); }
// Look for a target submesh assuming that the COLLADA exporter did not // do any special name mangling. I've tested this against files emitted // from Maya; I expect it will work for DAE files from other sources, too, // such as Blender or XSI. Time will tell... private static string GetTargetSubmeshGeneralStyle( Mesh mesh, string collisionSubmesh ) { string targetName = String.Empty; CvNameParser parser = new CvNameParser(); parser.AnalyzeName( collisionSubmesh ); if( parser.IsValid ) { // Form the target name as the first submesh name and see if // there is actually matching submesh. string candidate = parser.Target + ".0"; for( int i = 0; i < mesh.SubMeshCount; i++ ) { if( mesh.GetSubMesh( i ).Name.Equals( candidate ) ) { targetName = candidate; break; } } } return targetName; }