mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 16:44:36 +00:00
Adjusts importer logic of assets to fill spaces in the names as underscores to avoid issues.
This commit is contained in:
parent
41277fe3b8
commit
7b1c083839
2 changed files with 16 additions and 6 deletions
|
|
@ -252,7 +252,11 @@ bool TerrainAsset::getAssetByFilename(StringTableEntry fileName, AssetPtr<Terrai
|
||||||
Torque::Path terrFilePath = fileName;
|
Torque::Path terrFilePath = fileName;
|
||||||
|
|
||||||
TerrainAsset* newTerrainAsset = new TerrainAsset();
|
TerrainAsset* newTerrainAsset = new TerrainAsset();
|
||||||
newTerrainAsset->setAssetName(terrFilePath.getFileName().c_str());
|
|
||||||
|
String assetName = terrFilePath.getFileName();
|
||||||
|
assetName.replace(" ", "_");
|
||||||
|
|
||||||
|
newTerrainAsset->setAssetName(assetName.c_str());
|
||||||
String terrainPathBind = terrFilePath.getFileName() + terrFilePath.getExtension();
|
String terrainPathBind = terrFilePath.getFileName() + terrFilePath.getExtension();
|
||||||
|
|
||||||
newTerrainAsset->mTerrainFilePath = StringTable->insert(terrainPathBind.c_str());
|
newTerrainAsset->mTerrainFilePath = StringTable->insert(terrainPathBind.c_str());
|
||||||
|
|
@ -267,7 +271,7 @@ bool TerrainAsset::getAssetByFilename(StringTableEntry fileName, AssetPtr<Terrai
|
||||||
// Turn-off auto-formatting.
|
// Turn-off auto-formatting.
|
||||||
taml.setAutoFormat(false);
|
taml.setAutoFormat(false);
|
||||||
|
|
||||||
String tamlPath = terrFilePath.getFullPath() + "/" + terrFilePath.getFileName() + ".asset.taml";
|
String tamlPath = terrFilePath.getFullPath() + "/" + assetName + ".asset.taml";
|
||||||
|
|
||||||
// Read object.
|
// Read object.
|
||||||
bool success = taml.write(newTerrainAsset, tamlPath.c_str());
|
bool success = taml.write(newTerrainAsset, tamlPath.c_str());
|
||||||
|
|
@ -296,7 +300,7 @@ bool TerrainAsset::getAssetByFilename(StringTableEntry fileName, AssetPtr<Terrai
|
||||||
|
|
||||||
String assetId = targetModuleDef->getModuleId();
|
String assetId = targetModuleDef->getModuleId();
|
||||||
assetId += ":";
|
assetId += ":";
|
||||||
assetId += terrFilePath.getFileName().c_str();
|
assetId += assetName.c_str();
|
||||||
|
|
||||||
StringTableEntry resultingAssetId = StringTable->insert(assetId.c_str());
|
StringTableEntry resultingAssetId = StringTable->insert(assetId.c_str());
|
||||||
|
|
||||||
|
|
@ -339,7 +343,11 @@ StringTableEntry TerrainAsset::getAssetIdByFilename(StringTableEntry fileName)
|
||||||
Torque::Path terrFilePath = fileName;
|
Torque::Path terrFilePath = fileName;
|
||||||
|
|
||||||
TerrainAsset* newTerrainAsset = new TerrainAsset();
|
TerrainAsset* newTerrainAsset = new TerrainAsset();
|
||||||
newTerrainAsset->setAssetName(terrFilePath.getFileName().c_str());
|
|
||||||
|
String assetName = terrFilePath.getFileName();
|
||||||
|
assetName.replace(" ", "_");
|
||||||
|
|
||||||
|
newTerrainAsset->setAssetName(assetName.c_str());
|
||||||
String terrainPathBind = terrFilePath.getFileName() + "." + terrFilePath.getExtension();
|
String terrainPathBind = terrFilePath.getFileName() + "." + terrFilePath.getExtension();
|
||||||
|
|
||||||
newTerrainAsset->mTerrainFilePath = StringTable->insert(terrainPathBind.c_str());
|
newTerrainAsset->mTerrainFilePath = StringTable->insert(terrainPathBind.c_str());
|
||||||
|
|
@ -354,7 +362,7 @@ StringTableEntry TerrainAsset::getAssetIdByFilename(StringTableEntry fileName)
|
||||||
// Turn-off auto-formatting.
|
// Turn-off auto-formatting.
|
||||||
taml.setAutoFormat(false);
|
taml.setAutoFormat(false);
|
||||||
|
|
||||||
String tamlPath = terrFilePath.getPath() + "/" + terrFilePath.getFileName() + ".asset.taml";
|
String tamlPath = terrFilePath.getPath() + "/" + assetName + ".asset.taml";
|
||||||
|
|
||||||
// Read object.
|
// Read object.
|
||||||
bool success = taml.write(newTerrainAsset, tamlPath.c_str());
|
bool success = taml.write(newTerrainAsset, tamlPath.c_str());
|
||||||
|
|
@ -383,7 +391,7 @@ StringTableEntry TerrainAsset::getAssetIdByFilename(StringTableEntry fileName)
|
||||||
|
|
||||||
String assetId = targetModuleDef->getModuleId();
|
String assetId = targetModuleDef->getModuleId();
|
||||||
assetId += ":";
|
assetId += ":";
|
||||||
assetId += terrFilePath.getFileName().c_str();
|
assetId += assetName.c_str();
|
||||||
|
|
||||||
StringTableEntry resultingAssetId = StringTable->insert(assetId.c_str());
|
StringTableEntry resultingAssetId = StringTable->insert(assetId.c_str());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -390,6 +390,8 @@ AssetImportObject* AssetImporter::addImportingAsset(String assetType, Torque::Pa
|
||||||
else
|
else
|
||||||
assetName = filePath.getFileName();
|
assetName = filePath.getFileName();
|
||||||
|
|
||||||
|
assetName.replace(" ", "_");
|
||||||
|
|
||||||
AssetImportObject* assetImportObj = new AssetImportObject();
|
AssetImportObject* assetImportObj = new AssetImportObject();
|
||||||
assetImportObj->registerObject();
|
assetImportObj->registerObject();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue