OgreImporter: Mirror bool return for XmlSerializer as it is in BinarySerializer. Document its meaning.
parent
1129ae5a6e
commit
f8e1dcb102
|
@ -62,7 +62,8 @@ public:
|
|||
|
||||
/// Imports skeleton to @c mesh into Mesh::skeleton.
|
||||
/** If mesh does not have a skeleton reference or the skeleton file
|
||||
cannot be found it is not a fatal DeadlyImportError. */
|
||||
cannot be found it is not a fatal DeadlyImportError.
|
||||
@return If skeleton import was successful. */
|
||||
static bool ImportSkeleton(Assimp::IOSystem *pIOHandler, Mesh *mesh);
|
||||
static bool ImportSkeleton(Assimp::IOSystem *pIOHandler, MeshXml *mesh);
|
||||
|
||||
|
|
|
@ -675,49 +675,50 @@ void OgreXmlSerializer::ReadBoneAssignments(VertexDataXml *dest)
|
|||
|
||||
// Skeleton
|
||||
|
||||
void OgreXmlSerializer::ImportSkeleton(Assimp::IOSystem *pIOHandler, MeshXml *mesh)
|
||||
bool OgreXmlSerializer::ImportSkeleton(Assimp::IOSystem *pIOHandler, MeshXml *mesh)
|
||||
{
|
||||
if (!mesh || mesh->skeletonRef.empty())
|
||||
return;
|
||||
return false;
|
||||
|
||||
// Highly unusual to see in read world cases but support
|
||||
// XML mesh referencing a binary skeleton file.
|
||||
if (EndsWith(mesh->skeletonRef, ".skeleton", false))
|
||||
{
|
||||
if (OgreBinarySerializer::ImportSkeleton(pIOHandler, mesh))
|
||||
return;
|
||||
return true;
|
||||
|
||||
/** Last fallback if .skeleton failed to be read.
|
||||
Try reading from .skeleton.xml even if the XML file
|
||||
referenced a binary skeleton.
|
||||
@note This logic was in the previous version and
|
||||
I don't want to break old code that depends on it. */
|
||||
/** Last fallback if .skeleton failed to be read. Try reading from
|
||||
.skeleton.xml even if the XML file referenced a binary skeleton.
|
||||
@note This logic was in the previous version and I don't want to break
|
||||
old code that might depends on it. */
|
||||
mesh->skeletonRef = mesh->skeletonRef + ".xml";
|
||||
}
|
||||
|
||||
XmlReaderPtr reader = OpenReader(pIOHandler, mesh->skeletonRef);
|
||||
if (!reader.get())
|
||||
return;
|
||||
return false;
|
||||
|
||||
Skeleton *skeleton = new Skeleton();
|
||||
OgreXmlSerializer serializer(reader.get());
|
||||
serializer.ReadSkeleton(skeleton);
|
||||
mesh->skeleton = skeleton;
|
||||
return true;
|
||||
}
|
||||
|
||||
void OgreXmlSerializer::ImportSkeleton(Assimp::IOSystem *pIOHandler, Mesh *mesh)
|
||||
bool OgreXmlSerializer::ImportSkeleton(Assimp::IOSystem *pIOHandler, Mesh *mesh)
|
||||
{
|
||||
if (!mesh || mesh->skeletonRef.empty())
|
||||
return;
|
||||
return false;
|
||||
|
||||
XmlReaderPtr reader = OpenReader(pIOHandler, mesh->skeletonRef);
|
||||
if (!reader.get())
|
||||
return;
|
||||
return false;
|
||||
|
||||
Skeleton *skeleton = new Skeleton();
|
||||
OgreXmlSerializer serializer(reader.get());
|
||||
serializer.ReadSkeleton(skeleton);
|
||||
mesh->skeleton = skeleton;
|
||||
return true;
|
||||
}
|
||||
|
||||
XmlReaderPtr OgreXmlSerializer::OpenReader(Assimp::IOSystem *pIOHandler, const std::string &filename)
|
||||
|
|
|
@ -63,9 +63,10 @@ public:
|
|||
|
||||
/// Imports skeleton to @c mesh.
|
||||
/** If mesh does not have a skeleton reference or the skeleton file
|
||||
cannot be found it is not a fatal DeadlyImportError. */
|
||||
static void ImportSkeleton(Assimp::IOSystem *pIOHandler, MeshXml *mesh);
|
||||
static void ImportSkeleton(Assimp::IOSystem *pIOHandler, Mesh *mesh);
|
||||
cannot be found it is not a fatal DeadlyImportError.
|
||||
@return If skeleton import was successful. */
|
||||
static bool ImportSkeleton(Assimp::IOSystem *pIOHandler, MeshXml *mesh);
|
||||
static bool ImportSkeleton(Assimp::IOSystem *pIOHandler, Mesh *mesh);
|
||||
|
||||
private:
|
||||
OgreXmlSerializer(XmlReader *reader) :
|
||||
|
|
Loading…
Reference in New Issue