|
@@ -420,8 +420,7 @@ IMPLEMENT_CONOBJECT(AssetImportObject);
|
|
|
|
|
|
AssetImportObject::AssetImportObject() :
|
|
|
dirty(false),
|
|
|
- skip(false),
|
|
|
- processed(false),
|
|
|
+ importStatus(AssetImportObject::NotProcessed),
|
|
|
generatedAsset(false),
|
|
|
parentAssetItem(nullptr),
|
|
|
tamlFilePath(""),
|
|
@@ -463,8 +462,6 @@ void AssetImportObject::initPersistFields()
|
|
|
addField("statusInfo", TypeRealString, Offset(statusInfo, AssetImportObject), "What is the articulated information of the status of the asset. Contains the error or warning log data");
|
|
|
|
|
|
addField("dirty", TypeBool, Offset(dirty, AssetImportObject), "Is the asset item currently flagged as dirty");
|
|
|
- addField("skip", TypeBool, Offset(skip, AssetImportObject), "Is this asset item marked to be skipped. If it is, it's usually due to being marked as deleted");
|
|
|
- addField("processed", TypeBool, Offset(processed, AssetImportObject), "Has the asset item been processed");
|
|
|
addField("generatedAsset", TypeBool, Offset(generatedAsset, AssetImportObject), "Is this specific asset item generated as part of the import process of another item");
|
|
|
|
|
|
addField("tamlFilePath", TypeRealString, Offset(tamlFilePath, AssetImportObject), "What is the ultimate asset taml file path for this import item");
|
|
@@ -622,8 +619,7 @@ AssetImportObject* AssetImporter::addImportingAsset(String assetType, Torque::Pa
|
|
|
assetImportObj->statusInfo = "";
|
|
|
|
|
|
assetImportObj->dirty = false;
|
|
|
- assetImportObj->skip = false;
|
|
|
- assetImportObj->processed = false;
|
|
|
+ assetImportObj->importStatus = AssetImportObject::NotProcessed;
|
|
|
assetImportObj->generatedAsset = false;
|
|
|
|
|
|
if (parentItem != nullptr)
|
|
@@ -656,7 +652,7 @@ AssetImportObject* AssetImporter::addImportingAsset(String assetType, Torque::Pa
|
|
|
|
|
|
void AssetImporter::deleteImportingAsset(AssetImportObject* assetItem)
|
|
|
{
|
|
|
- assetItem->skip = true;
|
|
|
+ assetItem->importStatus = AssetImportObject::Skipped;
|
|
|
|
|
|
//log it
|
|
|
dSprintf(importLogBuffer, sizeof(importLogBuffer), "Deleting Importing Asset %s and all it's child items", assetItem->assetName.c_str());
|
|
@@ -665,36 +661,21 @@ void AssetImporter::deleteImportingAsset(AssetImportObject* assetItem)
|
|
|
|
|
|
AssetImportObject* AssetImporter::findImportingAssetByName(String assetName, AssetImportObject* assetItem)
|
|
|
{
|
|
|
- if (assetItem == nullptr)
|
|
|
- {
|
|
|
- for (U32 i = 0; i < importingAssets.size(); i++)
|
|
|
- {
|
|
|
- if (importingAssets[i]->cleanAssetName == assetName)
|
|
|
- {
|
|
|
- return importingAssets[i];
|
|
|
- }
|
|
|
+ Vector<AssetImportObject*> itemList = importingAssets;
|
|
|
+ if (assetItem != nullptr)
|
|
|
+ itemList = assetItem->childAssetItems;
|
|
|
|
|
|
- //If it wasn't a match, try recusing on the children(if any)
|
|
|
- AssetImportObject* retItem = findImportingAssetByName(assetName, importingAssets[i]);
|
|
|
- if (retItem != nullptr)
|
|
|
- return retItem;
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
+ for (U32 i = 0; i < itemList.size(); i++)
|
|
|
{
|
|
|
- //this is the child recursing section
|
|
|
- for (U32 i = 0; i < assetItem->childAssetItems.size(); i++)
|
|
|
+ if (itemList[i]->cleanAssetName == assetName)
|
|
|
{
|
|
|
- if (assetItem->childAssetItems[i]->cleanAssetName == assetName)
|
|
|
- {
|
|
|
- return assetItem->childAssetItems[i];
|
|
|
- }
|
|
|
-
|
|
|
- //If it wasn't a match, try recusing on the children(if any)
|
|
|
- AssetImportObject* retItem = findImportingAssetByName(assetName, assetItem->childAssetItems[i]);
|
|
|
- if (retItem != nullptr)
|
|
|
- return retItem;
|
|
|
+ return itemList[i];
|
|
|
}
|
|
|
+
|
|
|
+ //If it wasn't a match, try recusing on the children(if any)
|
|
|
+ AssetImportObject* retItem = findImportingAssetByName(assetName, itemList[i]);
|
|
|
+ if (retItem != nullptr)
|
|
|
+ return retItem;
|
|
|
}
|
|
|
|
|
|
return nullptr;
|
|
@@ -1385,109 +1366,53 @@ void AssetImportConfig::loadSISFile(Torque::Path filePath)
|
|
|
|
|
|
void AssetImporter::processImportAssets(AssetImportObject* assetItem)
|
|
|
{
|
|
|
- if (assetItem == nullptr)
|
|
|
- {
|
|
|
- assetHeirarchyChanged = false;
|
|
|
-
|
|
|
- for (U32 i = 0; i < importingAssets.size(); i++)
|
|
|
- {
|
|
|
- AssetImportObject* item = importingAssets[i];
|
|
|
- if (item->skip)
|
|
|
- continue;
|
|
|
+ Vector<AssetImportObject*> itemList = importingAssets;
|
|
|
+ if (assetItem != nullptr)
|
|
|
+ itemList = assetItem->childAssetItems;
|
|
|
|
|
|
- if (!item->processed)
|
|
|
- {
|
|
|
- //Sanitize before modifying our asset name(suffix additions, etc)
|
|
|
- if (item->assetName != item->cleanAssetName)
|
|
|
- item->assetName = item->cleanAssetName;
|
|
|
-
|
|
|
- //handle special pre-processing here for any types that need it
|
|
|
+ assetHeirarchyChanged = false;
|
|
|
|
|
|
- //process the asset items
|
|
|
- if (item->assetType == String("ImageAsset"))
|
|
|
- {
|
|
|
- processImageAsset(item);
|
|
|
- }
|
|
|
- else if (item->assetType == String("ShapeAsset"))
|
|
|
- {
|
|
|
- processShapeAsset(item);
|
|
|
- }
|
|
|
- else if (item->assetType == String("SoundAsset"))
|
|
|
- {
|
|
|
- processSoundAsset(item);
|
|
|
- }
|
|
|
- else if (item->assetType == String("MaterialAsset"))
|
|
|
- {
|
|
|
- processMaterialAsset(item);
|
|
|
- }
|
|
|
- /*else if (item->assetType == String("ShapeAnimationAsset"))
|
|
|
- ShapeAnimationAsset::prepareAssetForImport(this, item);*/
|
|
|
- else
|
|
|
- {
|
|
|
- String processCommand = "process";
|
|
|
- processCommand += item->assetType;
|
|
|
- if(isMethod(processCommand.c_str()))
|
|
|
- Con::executef(this, processCommand.c_str(), item);
|
|
|
- }
|
|
|
-
|
|
|
- item->processed = true;
|
|
|
- }
|
|
|
-
|
|
|
- //try recusing on the children(if any)
|
|
|
- processImportAssets(item);
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
+ for (U32 i = 0; i < itemList.size(); i++)
|
|
|
{
|
|
|
- //this is the child recursing section
|
|
|
- for (U32 i = 0; i < assetItem->childAssetItems.size(); i++)
|
|
|
- {
|
|
|
- AssetImportObject* childItem = assetItem->childAssetItems[i];
|
|
|
-
|
|
|
- if (childItem->skip)
|
|
|
- continue;
|
|
|
-
|
|
|
- if (!childItem->processed)
|
|
|
- {
|
|
|
- //Sanitize before modifying our asset name(suffix additions, etc)
|
|
|
- //if (childItem->assetName != childItem->cleanAssetName)
|
|
|
- // childItem->assetName = childItem->cleanAssetName;
|
|
|
-
|
|
|
- //handle special pre-processing here for any types that need it
|
|
|
-
|
|
|
- //process the asset items
|
|
|
- if (childItem->assetType == String("ImageAsset"))
|
|
|
- {
|
|
|
- processImageAsset(childItem);
|
|
|
- }
|
|
|
- else if (childItem->assetType == String("ShapeAsset"))
|
|
|
- {
|
|
|
- processShapeAsset(childItem);
|
|
|
- }
|
|
|
- else if (childItem->assetType == String("SoundAsset"))
|
|
|
- {
|
|
|
- processSoundAsset(childItem);
|
|
|
- }
|
|
|
- else if (childItem->assetType == String("MaterialAsset"))
|
|
|
- {
|
|
|
- processMaterialAsset(childItem);
|
|
|
- }
|
|
|
- /*else if (item->assetType == String("ShapeAnimationAsset"))
|
|
|
- ShapeAnimationAsset::prepareAssetForImport(this, item);*/
|
|
|
- else
|
|
|
- {
|
|
|
- String processCommand = "process";
|
|
|
- processCommand += childItem->assetType;
|
|
|
- if (isMethod(processCommand.c_str()))
|
|
|
- Con::executef(this, processCommand.c_str(), childItem);
|
|
|
- }
|
|
|
-
|
|
|
- childItem->processed = true;
|
|
|
- }
|
|
|
+ AssetImportObject* item = itemList[i];
|
|
|
+ if (item->importStatus != AssetImportObject::NotProcessed)
|
|
|
+ continue;
|
|
|
|
|
|
- //try recusing on the children(if any)
|
|
|
- processImportAssets(childItem);
|
|
|
- }
|
|
|
+ //Sanitize before modifying our asset name(suffix additions, etc)
|
|
|
+ if (item->assetName != item->cleanAssetName)
|
|
|
+ item->assetName = item->cleanAssetName;
|
|
|
+
|
|
|
+ //process the asset items
|
|
|
+ if (item->assetType == String("ImageAsset"))
|
|
|
+ {
|
|
|
+ processImageAsset(item);
|
|
|
+ }
|
|
|
+ else if (item->assetType == String("ShapeAsset"))
|
|
|
+ {
|
|
|
+ processShapeAsset(item);
|
|
|
+ }
|
|
|
+ else if (item->assetType == String("SoundAsset"))
|
|
|
+ {
|
|
|
+ processSoundAsset(item);
|
|
|
+ }
|
|
|
+ else if (item->assetType == String("MaterialAsset"))
|
|
|
+ {
|
|
|
+ processMaterialAsset(item);
|
|
|
+ }
|
|
|
+ /*else if (item->assetType == String("ShapeAnimationAsset"))
|
|
|
+ ShapeAnimationAsset::prepareAssetForImport(this, item);*/
|
|
|
+ else
|
|
|
+ {
|
|
|
+ String processCommand = "process";
|
|
|
+ processCommand += item->assetType;
|
|
|
+ if(isMethod(processCommand.c_str()))
|
|
|
+ Con::executef(this, processCommand.c_str(), item);
|
|
|
+ }
|
|
|
+
|
|
|
+ item->importStatus == AssetImportObject::Processed;
|
|
|
+
|
|
|
+ //try recusing on the children(if any)
|
|
|
+ processImportAssets(item);
|
|
|
}
|
|
|
|
|
|
//If our hierarchy changed, it's because we did so during processing
|
|
@@ -1610,7 +1535,7 @@ void AssetImporter::processImageAsset(AssetImportObject* assetItem)
|
|
|
assetItem->cleanAssetName = assetItem->assetName;
|
|
|
}
|
|
|
|
|
|
- assetItem->processed = true;
|
|
|
+ assetItem->importStatus = AssetImportObject::Processed;
|
|
|
}
|
|
|
|
|
|
void AssetImporter::processMaterialAsset(AssetImportObject* assetItem)
|
|
@@ -1633,7 +1558,7 @@ void AssetImporter::processMaterialAsset(AssetImportObject* assetItem)
|
|
|
String ignoredName = StringUnit::getUnit(activeImportConfig->IgnoreMaterials, i, ",;\t");
|
|
|
if (FindMatch::isMatch(ignoredName.c_str(), assetName, false))
|
|
|
{
|
|
|
- assetItem->skip = true;
|
|
|
+ assetItem->importStatus = AssetImportObject::Skipped;
|
|
|
|
|
|
dSprintf(importLogBuffer, sizeof(importLogBuffer), "Material %s has been ignored due to it's name being listed in the IgnoreMaterials list in the Import Config.", assetItem->assetName.c_str());
|
|
|
activityLog.push_back(importLogBuffer);
|
|
@@ -1649,9 +1574,9 @@ void AssetImporter::processMaterialAsset(AssetImportObject* assetItem)
|
|
|
//check to see if the definition for this already exists
|
|
|
StringTableEntry existingMatAsset = MaterialAsset::getAssetIdByMaterialName(StringTable->insert(assetName));
|
|
|
|
|
|
- if (existingMatAsset != StringTable->EmptyString())
|
|
|
+ if (existingMatAsset != StringTable->EmptyString() && existingMatAsset != StringTable->insert("Core_Rendering:NoMaterial"))
|
|
|
{
|
|
|
- assetItem->skip = true;
|
|
|
+ assetItem->importStatus = AssetImportObject::UseForDependencies;
|
|
|
dSprintf(importLogBuffer, sizeof(importLogBuffer), "Material %s has been skipped because we already found an asset Id that uses that material definition. The found assetId is: %s", assetItem->assetName.c_str(), existingMatAsset);
|
|
|
activityLog.push_back(importLogBuffer);
|
|
|
return;
|
|
@@ -1700,7 +1625,7 @@ void AssetImporter::processMaterialAsset(AssetImportObject* assetItem)
|
|
|
{
|
|
|
AssetImportObject* childAssetItem = assetItem->childAssetItems[i];
|
|
|
|
|
|
- if (childAssetItem->skip || childAssetItem->assetType != String("ImageAsset"))
|
|
|
+ if (childAssetItem->importStatus == AssetImportObject::Skipped || childAssetItem->assetType != String("ImageAsset"))
|
|
|
continue;
|
|
|
|
|
|
for (S32 t = 0; t < ImageAsset::ImageTypeCount; t++)
|
|
@@ -1852,7 +1777,7 @@ void AssetImporter::processMaterialAsset(AssetImportObject* assetItem)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- assetItem->processed = true;
|
|
|
+ assetItem->importStatus = AssetImportObject::Processed;
|
|
|
}
|
|
|
|
|
|
void AssetImporter::processShapeAsset(AssetImportObject* assetItem)
|
|
@@ -1948,7 +1873,7 @@ void AssetImporter::processShapeAsset(AssetImportObject* assetItem)
|
|
|
cachedConfig->CopyTo(activeImportConfig);
|
|
|
cachedConfig->deleteObject();
|
|
|
|
|
|
- assetItem->processed = true;
|
|
|
+ assetItem->importStatus = AssetImportObject::Processed;
|
|
|
}
|
|
|
|
|
|
void AssetImporter::processShapeMaterialInfo(AssetImportObject* assetItem, S32 materialItemId)
|
|
@@ -2053,7 +1978,7 @@ void AssetImporter::processSoundAsset(AssetImportObject* assetItem)
|
|
|
dSprintf(importLogBuffer, sizeof(importLogBuffer), "Preparing Sound for Import: %s", assetItem->assetName.c_str());
|
|
|
activityLog.push_back(importLogBuffer);
|
|
|
|
|
|
- assetItem->processed = true;
|
|
|
+ assetItem->importStatus = AssetImportObject::Processed;
|
|
|
}
|
|
|
|
|
|
//
|
|
@@ -2077,7 +2002,7 @@ bool AssetImporter::validateAssets()
|
|
|
|
|
|
void AssetImporter::validateAsset(AssetImportObject* assetItem)
|
|
|
{
|
|
|
- if (assetItem->skip)
|
|
|
+ if (assetItem->importStatus == AssetImportObject::Skipped || assetItem->importStatus == AssetImportObject::NotProcessed)
|
|
|
return;
|
|
|
|
|
|
bool hasCollision = checkAssetForCollision(assetItem);
|
|
@@ -2157,36 +2082,21 @@ void AssetImporter::validateAsset(AssetImportObject* assetItem)
|
|
|
|
|
|
void AssetImporter::resetAssetValidationStatus(AssetImportObject* assetItem)
|
|
|
{
|
|
|
- if (assetItem == nullptr)
|
|
|
- {
|
|
|
- for (U32 i = 0; i < importingAssets.size(); i++)
|
|
|
- {
|
|
|
- if (importingAssets[i]->skip)
|
|
|
- continue;
|
|
|
+ Vector<AssetImportObject*> itemList = importingAssets;
|
|
|
+ if (assetItem != nullptr)
|
|
|
+ itemList = assetItem->childAssetItems;
|
|
|
|
|
|
- importingAssets[i]->status = "";
|
|
|
- importingAssets[i]->statusType = "";
|
|
|
- importingAssets[i]->statusInfo = "";
|
|
|
-
|
|
|
- //If it wasn't a match, try recusing on the children(if any)
|
|
|
- resetAssetValidationStatus(importingAssets[i]);
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
+ for (U32 i = 0; i < itemList.size(); i++)
|
|
|
{
|
|
|
- //this is the child recursing section
|
|
|
- for (U32 i = 0; i < assetItem->childAssetItems.size(); i++)
|
|
|
- {
|
|
|
- if (assetItem->childAssetItems[i]->skip)
|
|
|
- continue;
|
|
|
+ if (itemList[i]->importStatus == AssetImportObject::Skipped)
|
|
|
+ continue;
|
|
|
|
|
|
- assetItem->childAssetItems[i]->status = "";
|
|
|
- assetItem->childAssetItems[i]->statusType = "";
|
|
|
- assetItem->childAssetItems[i]->statusInfo = "";
|
|
|
+ itemList[i]->status = "";
|
|
|
+ itemList[i]->statusType = "";
|
|
|
+ itemList[i]->statusInfo = "";
|
|
|
|
|
|
- //If it wasn't a match, try recusing on the children(if any)
|
|
|
- resetAssetValidationStatus(assetItem->childAssetItems[i]);
|
|
|
- }
|
|
|
+ //If it wasn't a match, try recusing on the children(if any)
|
|
|
+ resetAssetValidationStatus(itemList[i]);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -2194,68 +2104,37 @@ bool AssetImporter::checkAssetForCollision(AssetImportObject* assetItemToCheck,
|
|
|
{
|
|
|
bool results = false;
|
|
|
|
|
|
- if (assetItem == nullptr)
|
|
|
- {
|
|
|
- for (U32 i = 0; i < importingAssets.size(); i++)
|
|
|
- {
|
|
|
- AssetImportObject* importingAsset = importingAssets[i];
|
|
|
-
|
|
|
- if (importingAsset->skip)
|
|
|
- continue;
|
|
|
-
|
|
|
- if ((assetItemToCheck->assetName.compare(importingAsset->assetName) == 0) && (assetItemToCheck->getId() != importingAsset->getId()))
|
|
|
- {
|
|
|
- //we do have a collision, note the collsion and bail out
|
|
|
- assetItemToCheck->status = "Warning";
|
|
|
- assetItemToCheck->statusType = "DuplicateImportAsset";
|
|
|
- assetItemToCheck->statusInfo = "Duplicate asset names found with importing assets!\nAsset \"" + importingAsset->assetName + "\" of the type \"" + importingAsset->assetType + "\" and \"" +
|
|
|
- assetItemToCheck->assetName + "\" of the type \"" + assetItemToCheck->assetType + "\" have matching names.\nPlease rename one of them.";
|
|
|
-
|
|
|
- dSprintf(importLogBuffer, sizeof(importLogBuffer), "Warning! Asset %s, type %s has a naming collision with another importing asset: %s, type %s",
|
|
|
- assetItemToCheck->assetName.c_str(), assetItemToCheck->assetType.c_str(),
|
|
|
- importingAsset->assetName.c_str(), importingAsset->assetType.c_str());
|
|
|
- activityLog.push_back(importLogBuffer);
|
|
|
-
|
|
|
- return true;
|
|
|
- }
|
|
|
+ Vector<AssetImportObject*> itemList = importingAssets;
|
|
|
+ if (assetItem != nullptr)
|
|
|
+ itemList = assetItem->childAssetItems;
|
|
|
|
|
|
- //If it wasn't a match, try recusing on the children(if any)
|
|
|
- results = checkAssetForCollision(assetItemToCheck, importingAsset);
|
|
|
- if (results)
|
|
|
- return results;
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
+ for (U32 i = 0; i < itemList.size(); i++)
|
|
|
{
|
|
|
- //this is the child recursing section
|
|
|
- for (U32 i = 0; i < assetItem->childAssetItems.size(); i++)
|
|
|
- {
|
|
|
- AssetImportObject* childAsset = assetItem->childAssetItems[i];
|
|
|
+ AssetImportObject* importingAsset = itemList[i];
|
|
|
|
|
|
- if (childAsset->skip)
|
|
|
- continue;
|
|
|
+ if (importingAsset->importStatus == AssetImportObject::Skipped)
|
|
|
+ continue;
|
|
|
|
|
|
- if ((assetItemToCheck->assetName.compare(childAsset->assetName) == 0) && (assetItemToCheck->getId() != childAsset->getId()))
|
|
|
- {
|
|
|
- //we do have a collision, note the collsion and bail out
|
|
|
- assetItemToCheck->status = "Warning";
|
|
|
- assetItemToCheck->statusType = "DuplicateImportAsset";
|
|
|
- assetItemToCheck->statusInfo = "Duplicate asset names found with importing assets!\nAsset \"" + assetItem->assetName + "\" of the type \"" + assetItem->assetType + "\" and \"" +
|
|
|
- assetItemToCheck->assetName + "\" of the type \"" + assetItemToCheck->assetType + "\" have matching names.\nPlease rename one of them.";
|
|
|
+ if ((assetItemToCheck->assetName.compare(importingAsset->assetName) == 0) && (assetItemToCheck->getId() != importingAsset->getId()))
|
|
|
+ {
|
|
|
+ //we do have a collision, note the collsion and bail out
|
|
|
+ assetItemToCheck->status = "Warning";
|
|
|
+ assetItemToCheck->statusType = "DuplicateImportAsset";
|
|
|
+ assetItemToCheck->statusInfo = "Duplicate asset names found with importing assets!\nAsset \"" + importingAsset->assetName + "\" of the type \"" + importingAsset->assetType + "\" and \"" +
|
|
|
+ assetItemToCheck->assetName + "\" of the type \"" + assetItemToCheck->assetType + "\" have matching names.\nPlease rename one of them.";
|
|
|
|
|
|
dSprintf(importLogBuffer, sizeof(importLogBuffer), "Warning! Asset %s, type %s has a naming collision with another importing asset: %s, type %s",
|
|
|
assetItemToCheck->assetName.c_str(), assetItemToCheck->assetType.c_str(),
|
|
|
- childAsset->assetName.c_str(), childAsset->assetType.c_str());
|
|
|
+ importingAsset->assetName.c_str(), importingAsset->assetType.c_str());
|
|
|
activityLog.push_back(importLogBuffer);
|
|
|
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- //If it wasn't a match, try recusing on the children(if any)
|
|
|
- results = checkAssetForCollision(assetItemToCheck, childAsset);
|
|
|
- if (results)
|
|
|
- return results;
|
|
|
+ return true;
|
|
|
}
|
|
|
+
|
|
|
+ //If it wasn't a match, try recusing on the children(if any)
|
|
|
+ results = checkAssetForCollision(assetItemToCheck, importingAsset);
|
|
|
+ if (results)
|
|
|
+ return results;
|
|
|
}
|
|
|
|
|
|
return results;
|
|
@@ -2271,7 +2150,16 @@ void AssetImporter::resolveAssetItemIssues(AssetImportObject* assetItem)
|
|
|
if (activeImportConfig->DuplicateAutoResolution == String("AutoPrune"))
|
|
|
{
|
|
|
//delete the item
|
|
|
- deleteImportingAsset(assetItem);
|
|
|
+ if (assetItem->parentAssetItem == nullptr)
|
|
|
+ {
|
|
|
+ //if there's no parent, just delete
|
|
|
+ deleteImportingAsset(assetItem);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //otherwise, we'll likely want to retain our dependency for our parent
|
|
|
+ assetItem->importStatus = AssetImportObject::UseForDependencies;
|
|
|
+ }
|
|
|
|
|
|
//log it's deletion
|
|
|
dSprintf(importLogBuffer, sizeof(importLogBuffer), "Asset %s was autopruned due to %s as part of the Import Configuration", assetItem->assetName.c_str(), humanReadableReason.c_str());
|
|
@@ -2460,161 +2348,102 @@ void AssetImporter::importAssets(AssetImportObject* assetItem)
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if (assetItem == nullptr)
|
|
|
+ Vector<AssetImportObject*> itemList = importingAssets;
|
|
|
+ if (assetItem != nullptr)
|
|
|
+ itemList = assetItem->childAssetItems;
|
|
|
+
|
|
|
+ for (U32 i = 0; i < itemList.size(); i++)
|
|
|
{
|
|
|
- for (U32 i = 0; i < importingAssets.size(); i++)
|
|
|
+ AssetImportObject* item = itemList[i];
|
|
|
+ if (!item->canImport())
|
|
|
+ continue;
|
|
|
+
|
|
|
+ Torque::Path assetPath;
|
|
|
+ if (item->assetType == String("ImageAsset"))
|
|
|
{
|
|
|
- if (importingAssets[i]->skip)
|
|
|
- continue;
|
|
|
+ assetPath = importImageAsset(item);
|
|
|
+ }
|
|
|
+ else if (item->assetType == String("ShapeAsset"))
|
|
|
+ {
|
|
|
+ assetPath = importShapeAsset(item);
|
|
|
+ }
|
|
|
+ else if (item->assetType == String("SoundAsset"))
|
|
|
+ {
|
|
|
+ assetPath = importSoundAsset(item);
|
|
|
+ }
|
|
|
+ else if (item->assetType == String("MaterialAsset"))
|
|
|
+ {
|
|
|
+ assetPath = importMaterialAsset(item);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ finalImportedAssetPath = String::EmptyString;
|
|
|
|
|
|
- Torque::Path assetPath;
|
|
|
- if (importingAssets[i]->assetType == String("ImageAsset"))
|
|
|
- {
|
|
|
- assetPath = importImageAsset(importingAssets[i]);
|
|
|
- }
|
|
|
- else if (importingAssets[i]->assetType == String("ShapeAsset"))
|
|
|
- {
|
|
|
- assetPath = importShapeAsset(importingAssets[i]);
|
|
|
- }
|
|
|
- else if (importingAssets[i]->assetType == String("SoundAsset"))
|
|
|
+ String processCommand = "import";
|
|
|
+ processCommand += item->assetType;
|
|
|
+ if (isMethod(processCommand.c_str()))
|
|
|
{
|
|
|
- assetPath = importSoundAsset(importingAssets[i]);
|
|
|
- }
|
|
|
- else if (importingAssets[i]->assetType == String("MaterialAsset"))
|
|
|
- {
|
|
|
- assetPath = importMaterialAsset(importingAssets[i]);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- finalImportedAssetPath = String::EmptyString;
|
|
|
-
|
|
|
- String processCommand = "import";
|
|
|
- processCommand += importingAssets[i]->assetType;
|
|
|
- if (isMethod(processCommand.c_str()))
|
|
|
- {
|
|
|
- Con::executef(this, processCommand.c_str(), importingAssets[i]);
|
|
|
+ Con::executef(this, processCommand.c_str(), item);
|
|
|
|
|
|
- assetPath = finalImportedAssetPath;
|
|
|
- }
|
|
|
+ assetPath = finalImportedAssetPath;
|
|
|
}
|
|
|
- /*else if (importingAssets[i]->assetType == String("ShapeAnimationAsset"))
|
|
|
- assetPath = ShapeAnimationAsset::importAsset(importingAssets[i]);*/
|
|
|
+ }
|
|
|
+ /*else if (importingAssets[i]->assetType == String("ShapeAnimationAsset"))
|
|
|
+ assetPath = ShapeAnimationAsset::importAsset(importingAssets[i]);*/
|
|
|
|
|
|
- if (assetPath.isEmpty() && importingAssets[i]->assetType != String("MaterialAsset"))
|
|
|
- {
|
|
|
- dSprintf(importLogBuffer, sizeof(importLogBuffer), "AssetImporter::importAssets - Import attempt of %s failed, so skipping asset.", importingAssets[i]->assetName.c_str());
|
|
|
- activityLog.push_back(importLogBuffer);
|
|
|
+ if (assetPath.isEmpty() && item->assetType != String("MaterialAsset"))
|
|
|
+ {
|
|
|
+ dSprintf(importLogBuffer, sizeof(importLogBuffer), "AssetImporter::importAssets - Import attempt of %s failed, so skipping asset.", item->assetName.c_str());
|
|
|
+ activityLog.push_back(importLogBuffer);
|
|
|
|
|
|
- continue;
|
|
|
- }
|
|
|
- else
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //If we got a valid filepath back from the import action, then we know we're good to go and we can go ahead and register the asset!
|
|
|
+ if (!isReimport)
|
|
|
{
|
|
|
- //If we got a valid filepath back from the import action, then we know we're good to go and we can go ahead and register the asset!
|
|
|
- if (!isReimport)
|
|
|
- {
|
|
|
- bool registerSuccess = AssetDatabase.addDeclaredAsset(moduleDef, assetPath.getFullPath().c_str());
|
|
|
+ bool registerSuccess = AssetDatabase.addDeclaredAsset(moduleDef, assetPath.getFullPath().c_str());
|
|
|
|
|
|
- if (!registerSuccess)
|
|
|
- {
|
|
|
- dSprintf(importLogBuffer, sizeof(importLogBuffer), "AssetImporter::importAssets - Failed to successfully register new asset at path %s to moduleId %s", assetPath.getFullPath().c_str(), targetModuleId.c_str());
|
|
|
- activityLog.push_back(importLogBuffer);
|
|
|
- }
|
|
|
+ if (!registerSuccess)
|
|
|
+ {
|
|
|
+ dSprintf(importLogBuffer, sizeof(importLogBuffer), "AssetImporter::importAssets - Failed to successfully register new asset at path %s to moduleId %s", assetPath.getFullPath().c_str(), targetModuleId.c_str());
|
|
|
+ activityLog.push_back(importLogBuffer);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- String assetId = importingAssets[i]->moduleName + ":" + importingAssets[i]->assetName;
|
|
|
- bool refreshSuccess = AssetDatabase.refreshAsset(assetId.c_str());
|
|
|
-
|
|
|
- if (!refreshSuccess)
|
|
|
+ //Any special-case post-reg stuff here
|
|
|
+ if (item->assetType == String("ShapeAsset"))
|
|
|
{
|
|
|
- dSprintf(importLogBuffer, sizeof(importLogBuffer), "AssetImporter::importAssets - Failed to refresh reimporting asset %s.", importingAssets[i]->assetName.c_str());
|
|
|
- activityLog.push_back(importLogBuffer);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ String assetIdStr = item->moduleName + ":" + item->assetName;
|
|
|
+ StringTableEntry assetId = StringTable->insert(assetIdStr.c_str());
|
|
|
|
|
|
- //recurse if needed
|
|
|
- importAssets(importingAssets[i]);
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- //this is the child recursing section
|
|
|
- for (U32 i = 0; i < assetItem->childAssetItems.size(); i++)
|
|
|
- {
|
|
|
- AssetImportObject* childItem = assetItem->childAssetItems[i];
|
|
|
-
|
|
|
- if (childItem->skip)
|
|
|
- continue;
|
|
|
-
|
|
|
- Torque::Path assetPath;
|
|
|
- if (childItem->assetType == String("ImageAsset"))
|
|
|
- {
|
|
|
- assetPath = importImageAsset(childItem);
|
|
|
- }
|
|
|
- else if (childItem->assetType == String("ShapeAsset"))
|
|
|
- {
|
|
|
- assetPath = importShapeAsset(childItem);
|
|
|
- }
|
|
|
- else if (childItem->assetType == String("SoundAsset"))
|
|
|
- {
|
|
|
- assetPath = importSoundAsset(childItem);
|
|
|
- }
|
|
|
- else if (childItem->assetType == String("MaterialAsset"))
|
|
|
- {
|
|
|
- assetPath = importMaterialAsset(childItem);
|
|
|
- }
|
|
|
- /*else if (childItem->assetType == String("ShapeAnimationAsset"))
|
|
|
- assetPath = ShapeAnimationAsset::importAsset(childItem);*/
|
|
|
- else
|
|
|
- {
|
|
|
- finalImportedAssetPath = String::EmptyString;
|
|
|
+ //forcefully update it's shape constructor
|
|
|
+ TSShapeConstructor* tss = TSShapeConstructor::findShapeConstructorByAssetId(assetId);
|
|
|
|
|
|
- String processCommand = "import";
|
|
|
- processCommand += childItem->assetType;
|
|
|
- if (isMethod(processCommand.c_str()))
|
|
|
- {
|
|
|
- const char* importReturnVal = Con::executef(this, processCommand.c_str(), childItem).getString();
|
|
|
- assetPath = Torque::Path(importReturnVal);
|
|
|
+ if(tss)
|
|
|
+ tss->setShapeAssetId(assetId);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- if (assetPath.isEmpty() && childItem->assetType != String("MaterialAsset"))
|
|
|
- {
|
|
|
- dSprintf(importLogBuffer, sizeof(importLogBuffer), "AssetImporter::importAssets - Import attempt of %s failed, so skipping asset.", childItem->assetName.c_str());
|
|
|
- activityLog.push_back(importLogBuffer);
|
|
|
-
|
|
|
- continue;
|
|
|
- }
|
|
|
else
|
|
|
{
|
|
|
- //If we got a valid filepath back from the import action, then we know we're good to go and we can go ahead and register the asset!
|
|
|
- if (!isReimport)
|
|
|
- {
|
|
|
- bool registerSuccess = AssetDatabase.addDeclaredAsset(moduleDef, assetPath.getFullPath().c_str());
|
|
|
+ String assetId = item->moduleName + ":" + item->assetName;
|
|
|
+ bool refreshSuccess = AssetDatabase.refreshAsset(assetId.c_str());
|
|
|
|
|
|
- if (!registerSuccess)
|
|
|
- {
|
|
|
- dSprintf(importLogBuffer, sizeof(importLogBuffer), "AssetImporter::importAssets - Failed to successfully register new asset at path %s to moduleId %s", assetPath.getFullPath().c_str(), targetModuleId.c_str());
|
|
|
- activityLog.push_back(importLogBuffer);
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
+ if (!refreshSuccess)
|
|
|
{
|
|
|
- String assetId = childItem->moduleName + ":" + childItem->assetName;
|
|
|
- bool refreshSuccess = AssetDatabase.refreshAsset(assetId.c_str());
|
|
|
-
|
|
|
- if (!refreshSuccess)
|
|
|
- {
|
|
|
- dSprintf(importLogBuffer, sizeof(importLogBuffer), "AssetImporter::importAssets - Failed to refresh reimporting asset %s.", childItem->assetName.c_str());
|
|
|
- activityLog.push_back(importLogBuffer);
|
|
|
- }
|
|
|
+ dSprintf(importLogBuffer, sizeof(importLogBuffer), "AssetImporter::importAssets - Failed to refresh reimporting asset %s.", item->assetName.c_str());
|
|
|
+ activityLog.push_back(importLogBuffer);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- //recurse if needed
|
|
|
- importAssets(childItem);
|
|
|
}
|
|
|
+
|
|
|
+ //Mark us as successfully imported
|
|
|
+ item->importStatus = AssetImportObject::Imported;
|
|
|
+
|
|
|
+ //recurse if needed
|
|
|
+ importAssets(item);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -2719,7 +2548,7 @@ Torque::Path AssetImporter::importMaterialAsset(AssetImportObject* assetItem)
|
|
|
{
|
|
|
AssetImportObject* childItem = assetItem->childAssetItems[i];
|
|
|
|
|
|
- if (childItem->skip || !childItem->processed || childItem->assetType.compare("ImageAsset") != 0)
|
|
|
+ if ((!childItem->canImport() && childItem->importStatus != AssetImportObject::UseForDependencies) || childItem->assetType.compare("ImageAsset") != 0)
|
|
|
continue;
|
|
|
|
|
|
char dependencyFieldName[64];
|
|
@@ -2756,7 +2585,7 @@ Torque::Path AssetImporter::importMaterialAsset(AssetImportObject* assetItem)
|
|
|
{
|
|
|
AssetImportObject* childItem = assetItem->childAssetItems[i];
|
|
|
|
|
|
- if (childItem->skip || childItem->assetType.compare("ImageAsset") != 0)
|
|
|
+ if (childItem->canImport() || childItem->assetType.compare("ImageAsset") != 0)
|
|
|
continue;
|
|
|
|
|
|
if (childItem->imageSuffixType.compare("ORMConfig") == 0)
|
|
@@ -2813,7 +2642,7 @@ Torque::Path AssetImporter::importMaterialAsset(AssetImportObject* assetItem)
|
|
|
{
|
|
|
AssetImportObject* childItem = assetItem->childAssetItems[i];
|
|
|
|
|
|
- if (childItem->skip || !childItem->processed || childItem->assetType.compare("ImageAsset") != 0)
|
|
|
+ if (childItem->canImport() || childItem->assetType.compare("ImageAsset") != 0)
|
|
|
continue;
|
|
|
|
|
|
String path = childItem->filePath.getFullFileName();
|
|
@@ -2890,7 +2719,7 @@ Torque::Path AssetImporter::importMaterialAsset(AssetImportObject* assetItem)
|
|
|
{
|
|
|
AssetImportObject* childItem = assetItem->childAssetItems[i];
|
|
|
|
|
|
- if (childItem->skip || !childItem->processed || childItem->assetType.compare("ImageAsset") != 0)
|
|
|
+ if ((!childItem->canImport() && childItem->importStatus != AssetImportObject::UseForDependencies) || childItem->assetType.compare("ImageAsset") != 0)
|
|
|
continue;
|
|
|
|
|
|
String mapFieldName = "";
|
|
@@ -3013,7 +2842,7 @@ Torque::Path AssetImporter::importShapeAsset(AssetImportObject* assetItem)
|
|
|
{
|
|
|
AssetImportObject* childItem = assetItem->childAssetItems[i];
|
|
|
|
|
|
- if (childItem->skip || !childItem->processed)
|
|
|
+ if (!childItem->canImport() && childItem->importStatus != AssetImportObject::UseForDependencies)
|
|
|
continue;
|
|
|
|
|
|
if (childItem->assetType.compare("MaterialAsset") == 0)
|
|
@@ -3118,7 +2947,8 @@ Torque::Path AssetImporter::importShapeAsset(AssetImportObject* assetItem)
|
|
|
TSShapeConstructor* constructor = TSShapeConstructor::findShapeConstructorByFilename(Torque::Path(qualifiedToFile).getFullPath());
|
|
|
if (constructor == nullptr)
|
|
|
{
|
|
|
- constructor = new TSShapeConstructor(StringTable->insert(qualifiedToFile));
|
|
|
+ String fullAssetName = assetItem->moduleName + ":" + assetItem->assetName;
|
|
|
+ constructor = new TSShapeConstructor(StringTable->insert(fullAssetName.c_str()));
|
|
|
|
|
|
String constructorName = assetItem->filePath.getFileName() + assetItem->filePath.getExtension().substr(0, 3);
|
|
|
constructorName.replace(" ", "_");
|