Merge branch 'master' into master
This commit is contained in:
@@ -77,7 +77,7 @@ namespace Assimp {
|
||||
|
||||
#define CONVERT_FBX_TIME(time) static_cast<double>(time) / 46186158000L
|
||||
|
||||
FBXConverter::FBXConverter(aiScene* out, const Document& doc)
|
||||
FBXConverter::FBXConverter(aiScene* out, const Document& doc, bool removeEmptyBones)
|
||||
: defaultMaterialIndex()
|
||||
, lights()
|
||||
, cameras()
|
||||
@@ -90,7 +90,8 @@ namespace Assimp {
|
||||
, mNodeNames()
|
||||
, anim_fps()
|
||||
, out(out)
|
||||
, doc(doc) {
|
||||
, doc(doc)
|
||||
, mRemoveEmptyBones( removeEmptyBones ) {
|
||||
// animations need to be converted first since this will
|
||||
// populate the node_anim_chain_bits map, which is needed
|
||||
// to determine which nodes need to be generated.
|
||||
@@ -388,6 +389,7 @@ namespace Assimp {
|
||||
break;
|
||||
default:
|
||||
ai_assert(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -978,7 +980,9 @@ namespace Assimp {
|
||||
unsigned int epcount = 0;
|
||||
for (unsigned i = 0; i < indices.size(); i++)
|
||||
{
|
||||
if (indices[i] < 0) epcount++;
|
||||
if (indices[i] < 0) {
|
||||
epcount++;
|
||||
}
|
||||
}
|
||||
unsigned int pcount = static_cast<unsigned int>( indices.size() );
|
||||
unsigned int scount = out_mesh->mNumFaces = pcount - epcount;
|
||||
@@ -1408,7 +1412,7 @@ namespace Assimp {
|
||||
|
||||
const WeightIndexArray& indices = cluster->GetIndices();
|
||||
|
||||
if (indices.empty()) {
|
||||
if (indices.empty() && mRemoveEmptyBones ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1440,13 +1444,11 @@ namespace Assimp {
|
||||
|
||||
if (index_out_indices.back() == no_index_sentinel) {
|
||||
index_out_indices.back() = out_indices.size();
|
||||
|
||||
}
|
||||
|
||||
if (no_mat_check) {
|
||||
out_indices.push_back(out_idx[i]);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// this extra lookup is in O(logn), so the entire algorithm becomes O(nlogn)
|
||||
const std::vector<unsigned int>::iterator it = std::lower_bound(
|
||||
outputVertStartIndices->begin(),
|
||||
@@ -1462,11 +1464,11 @@ namespace Assimp {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// if we found at least one, generate the output bones
|
||||
// XXX this could be heavily simplified by collecting the bone
|
||||
// data in a single step.
|
||||
if (ok) {
|
||||
if (ok && mRemoveEmptyBones) {
|
||||
ConvertCluster(bones, model, *cluster, out_indices, index_out_indices,
|
||||
count_out_indices, node_global_transform);
|
||||
}
|
||||
@@ -3533,9 +3535,9 @@ void FBXConverter::SetShadingPropertiesRaw(aiMaterial* out_mat, const PropertyTa
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void ConvertToAssimpScene(aiScene* out, const Document& doc)
|
||||
void ConvertToAssimpScene(aiScene* out, const Document& doc, bool removeEmptyBones)
|
||||
{
|
||||
FBXConverter converter(out, doc);
|
||||
FBXConverter converter(out, doc, removeEmptyBones);
|
||||
}
|
||||
|
||||
} // !FBX
|
||||
|
||||
Reference in New Issue
Block a user