- more fine-grained import settings.

pull/14/head
Alexander Gessler 2012-07-21 01:00:26 +02:00
parent 67c55990cd
commit 711878567a
2 changed files with 23 additions and 3 deletions

View File

@ -261,7 +261,7 @@ private:
// one material per mesh maps easily to aiMesh. Multiple material // one material per mesh maps easily to aiMesh. Multiple material
// meshes need to be split. // meshes need to be split.
const std::vector<unsigned int>& mindices = mesh.GetMaterialIndices(); const std::vector<unsigned int>& mindices = mesh.GetMaterialIndices();
if (!mindices.empty()) { if (doc.Settings().readMaterials && !mindices.empty()) {
const unsigned int base = mindices[0]; const unsigned int base = mindices[0];
BOOST_FOREACH(unsigned int index, mindices) { BOOST_FOREACH(unsigned int index, mindices) {
if(index != base) { if(index != base) {
@ -408,7 +408,7 @@ private:
std::copy(colors.begin(),colors.end(),out_mesh->mColors[i]); std::copy(colors.begin(),colors.end(),out_mesh->mColors[i]);
} }
if(mindices.empty()) { if(!doc.Settings().readMaterials || mindices.empty()) {
FBXImporter::LogError("no material assigned to mesh, setting default material"); FBXImporter::LogError("no material assigned to mesh, setting default material");
out_mesh->mMaterialIndex = GetDefaultMaterial(); out_mesh->mMaterialIndex = GetDefaultMaterial();
} }

View File

@ -53,6 +53,10 @@ struct ImportSettings
ImportSettings() ImportSettings()
: readAllLayers(true) : readAllLayers(true)
, readAllMaterials() , readAllMaterials()
, readMaterials(true)
, readCameras(true)
, readLights(true)
, readAnimations(true)
{} {}
/** specifies whether all geometry layers are read and scanned for /** specifies whether all geometry layers are read and scanned for
@ -66,8 +70,24 @@ struct ImportSettings
/** specifies whether all materials are read, or only those that /** specifies whether all materials are read, or only those that
* are referenced by at least one mesh. Reading all materials * are referenced by at least one mesh. Reading all materials
* may make FBX reading a lot slower since all objects * may make FBX reading a lot slower since all objects
* need to be processed .*/ * need to be processed .
* This bit is ignored unless readMaterials=true*/
bool readAllMaterials; bool readAllMaterials;
/** import materials (true) or skip them and assign a default
* material. The default value is true.*/
bool readMaterials;
/** import cameras? Default value is true.*/
bool readCameras;
/** import light sources? Default value is true.*/
bool readLights;
/** import animations (i.e. animation curves, the node
* skeleton is always imported)? Default value is true. */
bool readAnimations;
}; };