Fix loading a single layer from an LWO file.
parent
052ad0e3de
commit
c3dad6a6b8
|
@ -180,8 +180,14 @@ void LWOImporter::InternReadFile( const std::string& pFile,
|
||||||
// The newer lightwave format allows the user to configure the
|
// The newer lightwave format allows the user to configure the
|
||||||
// loader that just one layer is used. If this is the case
|
// loader that just one layer is used. If this is the case
|
||||||
// we need to check now whether the requested layer has been found.
|
// we need to check now whether the requested layer has been found.
|
||||||
if (UINT_MAX != configLayerIndex && configLayerIndex > mLayers->size())
|
if (UINT_MAX != configLayerIndex) {
|
||||||
throw DeadlyImportError("LWO2: The requested layer was not found");
|
unsigned int layerCount = 0;
|
||||||
|
for(std::list<LWO::Layer>::iterator itLayers=mLayers->begin(); itLayers!=mLayers->end(); itLayers++)
|
||||||
|
if (!itLayers->skip)
|
||||||
|
layerCount++;
|
||||||
|
if (layerCount!=1)
|
||||||
|
throw DeadlyImportError("LWO2: The requested layer was not found");
|
||||||
|
}
|
||||||
|
|
||||||
if (configLayerName.length() && !hasNamedLayer) {
|
if (configLayerName.length() && !hasNamedLayer) {
|
||||||
throw DeadlyImportError("LWO2: Unable to find the requested layer: "
|
throw DeadlyImportError("LWO2: Unable to find the requested layer: "
|
||||||
|
@ -1285,17 +1291,15 @@ void LWOImporter::LoadLWO2File()
|
||||||
|
|
||||||
AI_LWO_VALIDATE_CHUNK_LENGTH(head->length,LAYR,16);
|
AI_LWO_VALIDATE_CHUNK_LENGTH(head->length,LAYR,16);
|
||||||
|
|
||||||
|
// layer index.
|
||||||
|
layer.mIndex = GetU2();
|
||||||
|
|
||||||
// Continue loading this layer or ignore it? Check the layer index property
|
// Continue loading this layer or ignore it? Check the layer index property
|
||||||
// NOTE: The first layer is the default layer, so the layer index is one-based now
|
if (UINT_MAX != configLayerIndex && (configLayerIndex-1) != layer.mIndex) {
|
||||||
if (UINT_MAX != configLayerIndex && configLayerIndex != mLayers->size()-1) {
|
|
||||||
skip = true;
|
skip = true;
|
||||||
}
|
}
|
||||||
else skip = false;
|
else skip = false;
|
||||||
|
|
||||||
// layer index. that's just for internal parenting, from the scope of a LWS file
|
|
||||||
// all layers are numbered in the oder in which they appear in the file
|
|
||||||
layer.mIndex = GetU2();
|
|
||||||
|
|
||||||
// pivot point
|
// pivot point
|
||||||
mFileBuffer += 2; /* unknown */
|
mFileBuffer += 2; /* unknown */
|
||||||
mCurLayer->mPivot.x = GetF4();
|
mCurLayer->mPivot.x = GetF4();
|
||||||
|
|
Loading…
Reference in New Issue