mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-25 02:05:43 +08:00
refs #928 Parse and load OBJ8 CSL packages.
This commit is contained in:
@@ -128,11 +128,11 @@ namespace BlackMisc
|
|||||||
|
|
||||||
QString CAircraftModelLoaderXPlane::CSLPlane::getModelName() const
|
QString CAircraftModelLoaderXPlane::CSLPlane::getModelName() const
|
||||||
{
|
{
|
||||||
const QString modelName =
|
QString modelName =
|
||||||
dirNames.join(' ') %
|
dirNames.join(' ') %
|
||||||
QLatin1Char(' ') % objectName %
|
QLatin1Char(' ') % objectName %
|
||||||
QLatin1Char(' ') % textureName;
|
QLatin1Char(' ') % textureName;
|
||||||
return modelName;
|
return std::move(modelName).trimmed();
|
||||||
}
|
}
|
||||||
|
|
||||||
CAircraftModelList CAircraftModelLoaderXPlane::performParsing(const QString &rootDirectory, const QStringList &excludeDirectories)
|
CAircraftModelList CAircraftModelLoaderXPlane::performParsing(const QString &rootDirectory, const QStringList &excludeDirectories)
|
||||||
@@ -476,9 +476,13 @@ namespace BlackMisc
|
|||||||
CLogMessage(this).warning("%1 - %2: OBJ8_AIRCARFT command requires 1 argument.") << path << lineNum;
|
CLogMessage(this).warning("%1 - %2: OBJ8_AIRCARFT command requires 1 argument.") << path << lineNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
// RW: I need an example of the file to properly implement and test it.
|
package.planes.push_back(CSLPlane());
|
||||||
CLogMessage(this).warning("Not implemented yet.");
|
package.planes.back().dirNames << package.path.mid(package.path.lastIndexOf('/') + 1);
|
||||||
return false;
|
package.planes.back().objectName = tokens[1];
|
||||||
|
package.planes.back().filePath = package.path;
|
||||||
|
// Package name and object name uniquely identify an OBJ8 aircraft.
|
||||||
|
// File path just points to the package root.
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CAircraftModelLoaderXPlane::parseObj8Command(const QStringList &tokens, CSLPackage &package, const QString &path, int lineNum)
|
bool CAircraftModelLoaderXPlane::parseObj8Command(const QStringList &tokens, CSLPackage &package, const QString &path, int lineNum)
|
||||||
@@ -487,12 +491,11 @@ namespace BlackMisc
|
|||||||
// OBJ8 <group> <animate YES|NO> <filename>
|
// OBJ8 <group> <animate YES|NO> <filename>
|
||||||
if (tokens.size() != 4)
|
if (tokens.size() != 4)
|
||||||
{
|
{
|
||||||
CLogMessage(this).warning("%1 - %2: OBJ8_AIRCARFT command requires 3 arguments.") << path << lineNum;
|
CLogMessage(this).warning("%1 - %2: OBJ8 command requires 3 arguments.") << path << lineNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
// RW: I need an example of the file to properly implement and test it.
|
// command contains no useful information for us
|
||||||
CLogMessage(this).warning("Not implemented yet.");
|
return true;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CAircraftModelLoaderXPlane::parseHasGearCommand(const QStringList &tokens, CSLPackage &package, const QString &path, int lineNum)
|
bool CAircraftModelLoaderXPlane::parseHasGearCommand(const QStringList &tokens, CSLPackage &package, const QString &path, int lineNum)
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ namespace BlackMisc
|
|||||||
// Model name parts
|
// Model name parts
|
||||||
QStringList dirNames; //!< List dir names starting from xsb_aircrafts.txt parent down to obj folder
|
QStringList dirNames; //!< List dir names starting from xsb_aircrafts.txt parent down to obj folder
|
||||||
QString objectName; //!< Complete basename of the object file
|
QString objectName; //!< Complete basename of the object file
|
||||||
QString textureName; //!< Complete basename of the texture file
|
QString textureName; //!< Complete basename of the texture file. Can be empty.
|
||||||
|
|
||||||
QString filePath; //!< object filePath
|
QString filePath; //!< object filePath
|
||||||
QString icao; //!< Icao type of this model
|
QString icao; //!< Icao type of this model
|
||||||
|
|||||||
@@ -476,7 +476,8 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
QString CSimulatorXPlane::findCslPackage(const QString &modelFile)
|
QString CSimulatorXPlane::findCslPackage(const QString &modelFile)
|
||||||
{
|
{
|
||||||
QDir dir = QFileInfo(modelFile).dir();
|
const QFileInfo info(modelFile);
|
||||||
|
QDir dir = info.isDir() ? QDir(modelFile) : info.dir();
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (dir.exists(QStringLiteral("xsb_aircraft.txt")))
|
if (dir.exists(QStringLiteral("xsb_aircraft.txt")))
|
||||||
|
|||||||
Submodule src/xbus/libxplanemp updated: 5ee5b89909...ff760ecffb
Reference in New Issue
Block a user