Skip to content

Commit

Permalink
[2972343] LightWave/modo patch. See http://sourceforge.net/tracker/in…
Browse files Browse the repository at this point in the history
  • Loading branch information
aramis_acg committed Mar 18, 2010
1 parent 762a7df commit 5026494
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
1 change: 1 addition & 0 deletions code/LWOFileData.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ namespace LWO {
#define AI_LWO_PTCH AI_IFF_FOURCC('P','T','C','H')
#define AI_LWO_MBAL AI_IFF_FOURCC('M','B','A','L')
#define AI_LWO_BONE AI_IFF_FOURCC('B','O','N','E')
#define AI_LWO_SUBD AI_IFF_FOURCC('S','U','B','D')

/* polygon tags */
#define AI_LWO_SURF AI_IFF_FOURCC('S','U','R','F')
Expand Down
21 changes: 17 additions & 4 deletions code/LWOLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,17 @@ void LWOImporter::InternReadFile( const std::string& pFile,
DefaultLogger::get()->info("LWO file format: LWOB (<= LightWave 5.5)");

mIsLWO2 = false;
mIsLXOB = false;
LoadLWOBFile();
}

// New lightwave format
else if (AI_LWO_FOURCC_LWO2 == fileType) {
mIsLXOB = false;
DefaultLogger::get()->info("LWO file format: LWO2 (>= LightWave 6)");
}
// MODO file format
else if (AI_LWO_FOURCC_LXOB == fileType) {
mIsLXOB = true;
DefaultLogger::get()->info("LWO file format: LXOB (Modo)");
}
// we don't know this format
Expand Down Expand Up @@ -727,9 +729,6 @@ void LWOImporter::LoadLWO2Polygons(unsigned int length)
switch (type)
{
// read unsupported stuff too (although we wont process it)
case AI_LWO_BONE:
DefaultLogger::get()->warn("LWO2: Encountered unsupported primitive chunk (BONE)");
break;
case AI_LWO_MBAL:
DefaultLogger::get()->warn("LWO2: Encountered unsupported primitive chunk (METABALL)");
break;
Expand All @@ -740,6 +739,8 @@ void LWOImporter::LoadLWO2Polygons(unsigned int length)
// These are ok with no restrictions
case AI_LWO_PTCH:
case AI_LWO_FACE:
case AI_LWO_BONE:
case AI_LWO_SUBD:
break;
default:

Expand Down Expand Up @@ -1144,6 +1145,18 @@ void LWOImporter::LoadLWO2Envelope(unsigned int length)
// Get the index of the envelope
envelope.index = ReadVSizedIntLWO2(mFileBuffer);

// It looks like there might be an extra U4 right after the index,
// at least in modo (LXOB) files: we'll ignore it if it's zero,
// otherwise it represents the start of a subchunk, so we backtrack.
if (mIsLXOB)
{
uint32_t extra = GetU4();
if (extra)
{
mFileBuffer -= 4;
}
}

// ... and read all subchunks
while (true)
{
Expand Down
3 changes: 3 additions & 0 deletions code/LWOLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,9 @@ class LWOImporter : public BaseImporter
/** true if the file is a LWO2 file*/
bool mIsLWO2;

/** true if the file is a LXOB file*/
bool mIsLXOB;

/** Temporary list of layers from the file */
LayerList* mLayers;

Expand Down
4 changes: 3 additions & 1 deletion contrib/ConvertUTF/ConvertUTF.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
* for internal or external distribution as long as this notice
* remains attached.
*/

#ifndef CONVERTUTF_H
#define CONVERTUTF_H
/* ---------------------------------------------------------------------
Conversions between UTF32, UTF-16, and UTF-8. Header file.
Expand Down Expand Up @@ -147,3 +148,4 @@ Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd);
#endif

/* --------------------------------------------------------------------- */
#endif // CONVERTUTF_H

0 comments on commit 5026494

Please sign in to comment.