mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +00:00
Added fallback handling to MaterialAssets if the asset was found but the matDef was not
Added import config handling for prepending Directory to asset name Added handling for import config of appending a sound suffix Integrated handling of directory prepend and asset type suffix to rename issue resolution of asset importing Corrected miswording of warn message for duplicate object names Correct GUI issues with verve tools Convert verve tools to utilize assets for their GUI elements Fix window binding/naming issue depending on window mode for verve Fix popup menus formatting for verve WIP fix for material swap in Material editor. Corrects crash, but swap action is unreliable depending on object type Fix display issue with mission area editor toolbar button image Fix tooltip display of SFXEmitters in editor tree to correctly show the bound asset Changed network graph accelerator keybind from just N to Ctrl N to avoid keybind issues when typing Fixed Create New Emitter button in particle emitter that was showing as no texture
This commit is contained in:
parent
59bebe0bb4
commit
0fab2ebf54
34 changed files with 590 additions and 636 deletions
|
|
@ -319,6 +319,12 @@ U32 MaterialAsset::getAssetByMaterialName(StringTableEntry matName, AssetPtr<Mat
|
|||
AssetDatabase.releaseAsset(query.mAssetList[i]); //cleanup if that's not the one we needed
|
||||
}
|
||||
}
|
||||
|
||||
//Somehow we failed to bind an asset, so just use the fallback and mark the failure
|
||||
matAsset->setAssetId(MaterialAsset::smNoMaterialAssetFallback);
|
||||
(*matAsset)->mLoadedState = AssetErrCode::UsingFallback;
|
||||
return AssetErrCode::UsingFallback;
|
||||
|
||||
}
|
||||
|
||||
StringTableEntry MaterialAsset::getAssetIdByMaterialName(StringTableEntry matName)
|
||||
|
|
|
|||
|
|
@ -104,7 +104,9 @@ AssetImportConfig::AssetImportConfig() :
|
|||
importSounds(true),
|
||||
VolumeAdjust(false),
|
||||
PitchAdjust(false),
|
||||
SoundsCompressed(false)
|
||||
SoundsCompressed(false),
|
||||
AlwaysAddSoundSuffix(false),
|
||||
AddedSoundSuffix("_sound")
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -316,6 +318,8 @@ void AssetImportConfig::loadImportConfig(Settings* configSettings, String config
|
|||
VolumeAdjust = dAtof(configSettings->value(String(configName + "/Sounds/VolumeAdjust").c_str()));
|
||||
PitchAdjust = dAtof(configSettings->value(String(configName + "/Sounds/PitchAdjust").c_str()));
|
||||
SoundsCompressed = dAtob(configSettings->value(String(configName + "/Sounds/Compressed").c_str()));
|
||||
AlwaysAddSoundSuffix = dAtob(configSettings->value(String(configName + "/Sounds/AlwaysAddSoundSuffix").c_str()));
|
||||
AddedSoundSuffix = configSettings->value(String(configName + "/Sounds/AddedSoundSuffix").c_str());
|
||||
}
|
||||
|
||||
void AssetImportConfig::CopyTo(AssetImportConfig* target) const
|
||||
|
|
@ -406,6 +410,8 @@ void AssetImportConfig::CopyTo(AssetImportConfig* target) const
|
|||
target->VolumeAdjust = VolumeAdjust;
|
||||
target->PitchAdjust = PitchAdjust;
|
||||
target->SoundsCompressed = SoundsCompressed;
|
||||
target->AlwaysAddSoundSuffix = AlwaysAddSoundSuffix;
|
||||
target->AddedSoundSuffix = AddedSoundSuffix;
|
||||
}
|
||||
|
||||
ConsoleDocClass(AssetImportObject,
|
||||
|
|
@ -607,6 +613,7 @@ AssetImportObject* AssetImporter::addImportingAsset(String assetType, Torque::Pa
|
|||
assetName.replace('*', '_');
|
||||
assetName.replace('-', '_');
|
||||
assetName.replace('+', '_');
|
||||
assetName.replace('&', '_');
|
||||
|
||||
assetImportObj->assetType = assetType;
|
||||
assetImportObj->filePath = filePath;
|
||||
|
|
@ -622,6 +629,14 @@ AssetImportObject* AssetImporter::addImportingAsset(String assetType, Torque::Pa
|
|||
assetImportObj->importStatus = AssetImportObject::NotProcessed;
|
||||
assetImportObj->generatedAsset = false;
|
||||
|
||||
//If the config is marked to always set the directory prefix, do that now
|
||||
if (activeImportConfig->AddDirectoryPrefixToAssetName)
|
||||
{
|
||||
assetName = getFolderPrefixedName(assetImportObj);
|
||||
assetImportObj->assetName = assetName;
|
||||
assetImportObj->cleanAssetName = assetName;
|
||||
}
|
||||
|
||||
if (parentItem != nullptr)
|
||||
{
|
||||
dSprintf(importLogBuffer, sizeof(importLogBuffer), "Added Child Importing Asset to %s", parentItem->assetName.c_str());
|
||||
|
|
@ -1976,6 +1991,12 @@ void AssetImporter::processSoundAsset(AssetImportObject* assetItem)
|
|||
dSprintf(importLogBuffer, sizeof(importLogBuffer), "Preparing Sound for Import: %s", assetItem->assetName.c_str());
|
||||
activityLog.push_back(importLogBuffer);
|
||||
|
||||
if (activeImportConfig->AlwaysAddSoundSuffix)
|
||||
{
|
||||
assetItem->assetName += activeImportConfig->AddedSoundSuffix;
|
||||
assetItem->cleanAssetName = assetItem->assetName;
|
||||
}
|
||||
|
||||
assetItem->importStatus = AssetImportObject::Processed;
|
||||
}
|
||||
|
||||
|
|
@ -2165,7 +2186,49 @@ void AssetImporter::resolveAssetItemIssues(AssetImportObject* assetItem)
|
|||
{
|
||||
//Set trailing number
|
||||
String renamedAssetName = assetItem->assetName;
|
||||
renamedAssetName = Sim::getUniqueName(renamedAssetName.c_str());
|
||||
String renamedAssetId = assetItem->moduleName + ":" + renamedAssetName;
|
||||
|
||||
String addedSuffix;
|
||||
|
||||
if (assetItem->assetType == String("ShapeAsset"))
|
||||
addedSuffix = activeImportConfig->AddedShapeSuffix;
|
||||
else if (assetItem->assetType == String("MaterialAsset"))
|
||||
addedSuffix = activeImportConfig->AddedMaterialSuffix;
|
||||
else if (assetItem->assetType == String("ImageAsset"))
|
||||
addedSuffix = activeImportConfig->AddedImageSuffix;
|
||||
else if (assetItem->assetType == String("SoundAsset"))
|
||||
addedSuffix = activeImportConfig->AddedSoundSuffix;
|
||||
|
||||
//do the suffix if it isn't already on it
|
||||
if (!renamedAssetName.endsWith(addedSuffix.c_str()))
|
||||
{
|
||||
renamedAssetName += addedSuffix;
|
||||
renamedAssetId = assetItem->moduleName + ":" + renamedAssetName;
|
||||
assetItem->assetName = renamedAssetName;
|
||||
}
|
||||
|
||||
//if still conflicted
|
||||
//add the directory prefix
|
||||
if (AssetDatabase.isDeclaredAsset(renamedAssetId.c_str()))
|
||||
{
|
||||
renamedAssetName = getFolderPrefixedName(assetItem);
|
||||
renamedAssetId = assetItem->moduleName + ":" + renamedAssetName;
|
||||
assetItem->assetName = renamedAssetName;
|
||||
}
|
||||
|
||||
bool appendedNumber = false;
|
||||
U32 uniqueNumber = 0;
|
||||
while (AssetDatabase.isDeclaredAsset(renamedAssetId.c_str()))
|
||||
{
|
||||
uniqueNumber++;
|
||||
renamedAssetId = assetItem->moduleName + ":" + renamedAssetName + String::ToString(uniqueNumber);
|
||||
appendedNumber = true;
|
||||
}
|
||||
|
||||
if (appendedNumber)
|
||||
{
|
||||
renamedAssetName += String::ToString(uniqueNumber);
|
||||
}
|
||||
|
||||
//Log it's renaming
|
||||
dSprintf(importLogBuffer, sizeof(importLogBuffer), "Asset %s was renamed due to %s as part of the Import Configuration", assetItem->assetName.c_str(), humanReadableReason.c_str());
|
||||
|
|
@ -2186,25 +2249,7 @@ void AssetImporter::resolveAssetItemIssues(AssetImportObject* assetItem)
|
|||
}
|
||||
else if (activeImportConfig->DuplicateAutoResolution == String("FolderPrefix"))
|
||||
{
|
||||
String renamedAssetName = assetItem->assetName;
|
||||
|
||||
//Set trailing number
|
||||
S32 dirIndex = assetItem->filePath.getDirectoryCount() - 1;
|
||||
while (dirIndex > -1)
|
||||
{
|
||||
renamedAssetName = assetItem->assetName;
|
||||
String owningFolder = assetItem->filePath.getDirectory(dirIndex);
|
||||
|
||||
renamedAssetName = owningFolder + "_" + renamedAssetName;
|
||||
|
||||
if (AssetDatabase.isDeclaredAsset(renamedAssetName))
|
||||
{
|
||||
dirIndex--;
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
String renamedAssetName = getFolderPrefixedName(assetItem);
|
||||
|
||||
//Log it's renaming
|
||||
dSprintf(importLogBuffer, sizeof(importLogBuffer), "Asset %s was renamed due to %s as part of the Import Configuration", assetItem->assetName.c_str(), humanReadableReason.c_str());
|
||||
|
|
|
|||
|
|
@ -409,6 +409,15 @@ public:
|
|||
/// </summary>
|
||||
bool SoundsCompressed;
|
||||
|
||||
/// When importing an image, this indicates if it should automatically add a standard suffix onto the name
|
||||
/// </summary>
|
||||
bool AlwaysAddSoundSuffix;
|
||||
|
||||
/// <summary>
|
||||
/// If AlwaysAddSoundSuffix is on, this is the suffix to be added
|
||||
/// </summary>
|
||||
String AddedSoundSuffix;
|
||||
|
||||
public:
|
||||
AssetImportConfig();
|
||||
virtual ~AssetImportConfig();
|
||||
|
|
@ -934,4 +943,27 @@ public:
|
|||
//
|
||||
void setTargetModuleId(const String& moduleId) { targetModuleId = moduleId; }
|
||||
const String& getTargetModuleId() { return targetModuleId; }
|
||||
|
||||
String getFolderPrefixedName(AssetImportObject* assetItem)
|
||||
{
|
||||
String renamedAssetName = assetItem->assetName;
|
||||
S32 dirIndex = assetItem->filePath.getDirectoryCount() - 1;
|
||||
while (dirIndex > -1)
|
||||
{
|
||||
renamedAssetName = assetItem->assetName;
|
||||
String owningFolder = assetItem->filePath.getDirectory(dirIndex);
|
||||
|
||||
renamedAssetName = owningFolder + "_" + renamedAssetName;
|
||||
|
||||
if (AssetDatabase.isDeclaredAsset(renamedAssetName))
|
||||
{
|
||||
dirIndex--;
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return renamedAssetName;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ void SimNameDictionary::insert(SimObject* obj)
|
|||
SimObject* checkForDup = find(obj->getName());
|
||||
|
||||
if (checkForDup)
|
||||
Con::warnf("Warning! You have a duplicate datablock name of %s. This can cause problems. You should rename one of them.", obj->getName());
|
||||
Con::warnf("Warning! You have a duplicate object name of %s. This can cause problems. You should rename one of them.", obj->getName());
|
||||
|
||||
Mutex::lockMutex(mutex);
|
||||
#ifndef USE_NEW_SIMDICTIONARY
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue