Merge branch 'master' into develop_kimkulling
commit
50b6c63594
|
@ -205,7 +205,7 @@ enum ErrorPolicy {
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
/** Represents a data structure in a BLEND file. A Structure defines n fields
|
/** Represents a data structure in a BLEND file. A Structure defines n fields
|
||||||
* and their locatios and encodings the input stream. Usually, every
|
* and their locations and encodings the input stream. Usually, every
|
||||||
* Structure instance pertains to one equally-named data structure in the
|
* Structure instance pertains to one equally-named data structure in the
|
||||||
* BlenderScene.h header. This class defines various utilities to map a
|
* BlenderScene.h header. This class defines various utilities to map a
|
||||||
* binary `blob` read from the file to such a structure instance with
|
* binary `blob` read from the file to such a structure instance with
|
||||||
|
|
|
@ -502,7 +502,7 @@ const FileBlockHead* Structure :: LocateFileBlockForAddress(const Pointer & ptrv
|
||||||
{
|
{
|
||||||
// the file blocks appear in list sorted by
|
// the file blocks appear in list sorted by
|
||||||
// with ascending base addresses so we can run a
|
// with ascending base addresses so we can run a
|
||||||
// binary search to locate the pointee quickly.
|
// binary search to locate the pointer quickly.
|
||||||
|
|
||||||
// NOTE: Blender seems to distinguish between side-by-side
|
// NOTE: Blender seems to distinguish between side-by-side
|
||||||
// data (stored in the same data block) and far pointers,
|
// data (stored in the same data block) and far pointers,
|
||||||
|
|
|
@ -116,7 +116,7 @@ template <> void Structure :: Convert<MTex> (
|
||||||
ReadField<ErrorPolicy_Igno>(temp,"projy",db);
|
ReadField<ErrorPolicy_Igno>(temp,"projy",db);
|
||||||
dest.projy = static_cast<Assimp::Blender::MTex::Projection>(temp);
|
dest.projy = static_cast<Assimp::Blender::MTex::Projection>(temp);
|
||||||
ReadField<ErrorPolicy_Igno>(temp,"projz",db);
|
ReadField<ErrorPolicy_Igno>(temp,"projz",db);
|
||||||
dest.projx = static_cast<Assimp::Blender::MTex::Projection>(temp);
|
dest.projz = static_cast<Assimp::Blender::MTex::Projection>(temp);
|
||||||
ReadField<ErrorPolicy_Igno>(dest.mapping,"mapping",db);
|
ReadField<ErrorPolicy_Igno>(dest.mapping,"mapping",db);
|
||||||
ReadFieldArray<ErrorPolicy_Igno>(dest.ofs,"ofs",db);
|
ReadFieldArray<ErrorPolicy_Igno>(dest.ofs,"ofs",db);
|
||||||
ReadFieldArray<ErrorPolicy_Igno>(dest.size,"size",db);
|
ReadFieldArray<ErrorPolicy_Igno>(dest.size,"size",db);
|
||||||
|
|
|
@ -428,16 +428,19 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
|
||||||
const std::vector<unsigned int>& mapping_offsets,
|
const std::vector<unsigned int>& mapping_offsets,
|
||||||
const std::vector<unsigned int>& mappings)
|
const std::vector<unsigned int>& mappings)
|
||||||
{
|
{
|
||||||
|
bool isDirect = ReferenceInformationType == "Direct";
|
||||||
|
bool isIndexToDirect = ReferenceInformationType == "IndexToDirect";
|
||||||
|
|
||||||
|
// fallback to direct data if there is no index data element
|
||||||
|
if ( isIndexToDirect && !HasElement( source, indexDataElementName ) ) {
|
||||||
|
isDirect = true;
|
||||||
|
isIndexToDirect = false;
|
||||||
|
}
|
||||||
|
|
||||||
// handle permutations of Mapping and Reference type - it would be nice to
|
// handle permutations of Mapping and Reference type - it would be nice to
|
||||||
// deal with this more elegantly and with less redundancy, but right
|
// deal with this more elegantly and with less redundancy, but right
|
||||||
// now it seems unavoidable.
|
// now it seems unavoidable.
|
||||||
if (MappingInformationType == "ByVertice" && ReferenceInformationType == "Direct") {
|
if (MappingInformationType == "ByVertice" && isDirect) {
|
||||||
if ( !HasElement( source, indexDataElementName ) ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<T> tempData;
|
std::vector<T> tempData;
|
||||||
ParseVectorDataArray(tempData, GetRequiredElement(source, dataElementName));
|
ParseVectorDataArray(tempData, GetRequiredElement(source, dataElementName));
|
||||||
|
|
||||||
|
@ -450,14 +453,11 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (MappingInformationType == "ByVertice" && ReferenceInformationType == "IndexToDirect") {
|
else if (MappingInformationType == "ByVertice" && isIndexToDirect) {
|
||||||
std::vector<T> tempData;
|
std::vector<T> tempData;
|
||||||
ParseVectorDataArray(tempData, GetRequiredElement(source, dataElementName));
|
ParseVectorDataArray(tempData, GetRequiredElement(source, dataElementName));
|
||||||
|
|
||||||
data_out.resize(vertex_count);
|
data_out.resize(vertex_count);
|
||||||
if ( !HasElement( source, indexDataElementName ) ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<int> uvIndices;
|
std::vector<int> uvIndices;
|
||||||
ParseVectorDataArray(uvIndices,GetRequiredElement(source,indexDataElementName));
|
ParseVectorDataArray(uvIndices,GetRequiredElement(source,indexDataElementName));
|
||||||
|
@ -472,7 +472,7 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (MappingInformationType == "ByPolygonVertex" && ReferenceInformationType == "Direct") {
|
else if (MappingInformationType == "ByPolygonVertex" && isDirect) {
|
||||||
std::vector<T> tempData;
|
std::vector<T> tempData;
|
||||||
ParseVectorDataArray(tempData, GetRequiredElement(source, dataElementName));
|
ParseVectorDataArray(tempData, GetRequiredElement(source, dataElementName));
|
||||||
|
|
||||||
|
@ -485,7 +485,7 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
|
||||||
|
|
||||||
data_out.swap(tempData);
|
data_out.swap(tempData);
|
||||||
}
|
}
|
||||||
else if (MappingInformationType == "ByPolygonVertex" && ReferenceInformationType == "IndexToDirect") {
|
else if (MappingInformationType == "ByPolygonVertex" && isIndexToDirect) {
|
||||||
std::vector<T> tempData;
|
std::vector<T> tempData;
|
||||||
ParseVectorDataArray(tempData, GetRequiredElement(source, dataElementName));
|
ParseVectorDataArray(tempData, GetRequiredElement(source, dataElementName));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue