Merge pull request #565 from Areloch/BugfixQOL_20210909

Bugfix qol 20210909
This commit is contained in:
Brian Roberts 2021-09-11 01:52:19 -05:00 committed by GitHub
commit 86fbb3748b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
44 changed files with 694 additions and 755 deletions

View file

@ -221,6 +221,13 @@ DefineEngineStaticMethod(GUIAsset, getAssetIdByGUIName, const char*, (const char
{
return GUIAsset::getAssetIdByGUIName(StringTable->insert(guiName));
}
DefineEngineMethod(GUIAsset, getScriptPath, const char*, (), ,
"Gets the script file path associated to this asset.\n"
"@return The full script file path.")
{
return object->getScriptPath();
}
#endif
//-----------------------------------------------------------------------------

View file

@ -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)
Vector<AssetImportObject*> itemList = importingAssets;
if (assetItem != nullptr)
itemList = assetItem->childAssetItems;
assetHeirarchyChanged = false;
for (U32 i = 0; i < itemList.size(); i++)
{
assetHeirarchyChanged = false;
AssetImportObject* item = itemList[i];
if (item->importStatus != AssetImportObject::NotProcessed)
continue;
for (U32 i = 0; i < importingAssets.size(); i++)
{
AssetImportObject* item = importingAssets[i];
if (item->skip)
continue;
//Sanitize before modifying our asset name(suffix additions, etc)
if (item->assetName != item->cleanAssetName)
item->assetName = item->cleanAssetName;
if (!item->processed)
{
//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);
}
//handle special pre-processing here for any types that need it
item->importStatus == AssetImportObject::Processed;
//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
{
//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;
}
//try recusing on the children(if any)
processImportAssets(childItem);
}
//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)
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++)
{
if (importingAssets[i]->skip)
continue;
if (itemList[i]->importStatus == AssetImportObject::Skipped)
continue;
importingAssets[i]->status = "";
importingAssets[i]->statusType = "";
importingAssets[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(importingAssets[i]);
}
}
else
{
//this is the child recursing section
for (U32 i = 0; i < assetItem->childAssetItems.size(); i++)
{
if (assetItem->childAssetItems[i]->skip)
continue;
assetItem->childAssetItems[i]->status = "";
assetItem->childAssetItems[i]->statusType = "";
assetItem->childAssetItems[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)
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* importingAsset = itemList[i];
if (importingAsset->importStatus == AssetImportObject::Skipped)
continue;
if ((assetItemToCheck->assetName.compare(importingAsset->assetName) == 0) && (assetItemToCheck->getId() != importingAsset->getId()))
{
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;
}
//If it wasn't a match, try recusing on the children(if any)
results = checkAssetForCollision(assetItemToCheck, importingAsset);
if (results)
return results;
}
}
else
{
//this is the child recursing section
for (U32 i = 0; i < assetItem->childAssetItems.size(); i++)
{
AssetImportObject* childAsset = assetItem->childAssetItems[i];
if (childAsset->skip)
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.";
//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"))
String processCommand = "import";
processCommand += item->assetType;
if (isMethod(processCommand.c_str()))
{
assetPath = importImageAsset(importingAssets[i]);
}
else if (importingAssets[i]->assetType == String("ShapeAsset"))
{
assetPath = importShapeAsset(importingAssets[i]);
}
else if (importingAssets[i]->assetType == String("SoundAsset"))
{
assetPath = importSoundAsset(importingAssets[i]);
}
else if (importingAssets[i]->assetType == String("MaterialAsset"))
{
assetPath = importMaterialAsset(importingAssets[i]);
}
else
{
finalImportedAssetPath = String::EmptyString;
Con::executef(this, processCommand.c_str(), item);
String processCommand = "import";
processCommand += importingAssets[i]->assetType;
if (isMethod(processCommand.c_str()))
assetPath = finalImportedAssetPath;
}
}
/*else if (importingAssets[i]->assetType == String("ShapeAnimationAsset"))
assetPath = ShapeAnimationAsset::importAsset(importingAssets[i]);*/
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
{
//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());
if (!registerSuccess)
{
Con::executef(this, processCommand.c_str(), importingAssets[i]);
assetPath = finalImportedAssetPath;
}
}
/*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);
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());
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);
}
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());
//forcefully update it's shape constructor
TSShapeConstructor* tss = TSShapeConstructor::findShapeConstructorByAssetId(assetId);
if(tss)
tss->setShapeAssetId(assetId);
}
}
}
//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;
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 (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(" ", "_");

View file

@ -492,15 +492,20 @@ public:
/// </summary>
bool dirty;
enum
{
NotProcessed=0,
Processed,
Skipped,
UseForDependencies,
Error,
Imported
};
/// <summary>
/// Is this asset item marked to be skipped. If it is, it's usually due to being marked as deleted
/// </summary>
bool skip;
/// <summary>
/// Has the asset item been processed
/// </summary>
bool processed;
U32 importStatus;
/// <summary>
/// Is this specific asset item generated as part of the import process of another item
@ -564,6 +569,10 @@ public:
{
return o.getId() == this->getId();
}
bool canImport() {
return (importStatus == AssetImportObject::Processed);
}
};
/// <summary>

View file

@ -1015,7 +1015,7 @@ U32 TSStatic::packUpdate(NetConnection* con, U32 mask, BitStream* stream)
con->packNetStringHandleU(stream, matNameStr);
}
mChangingMaterials.clear();
//mChangingMaterials.clear();
}
return retMask;
@ -1670,53 +1670,49 @@ void TSStatic::onInspect(GuiInspector* inspector)
{
StringTableEntry materialname = StringTable->insert(mShapeAsset->getShape()->materialList->getMaterialName(i).c_str());
//Iterate through our assetList to find the compliant entry in our matList
for (U32 m = 0; m < mShapeAsset->getMaterialCount(); m++)
AssetPtr<MaterialAsset> matAsset;
if(MaterialAsset::getAssetByMaterialName(materialname, &matAsset) == MaterialAsset::Ok)
{
AssetPtr<MaterialAsset> matAsset = mShapeAsset->getMaterialAsset(m);
dSprintf(matFieldName, 128, "MaterialSlot%d", i);
if (matAsset->getMaterialDefinitionName() == materialname)
//addComponentField(matFieldName, "A material used in the shape file", "Material", matAsset->getAssetId(), "");
//Con::executef(this, "onConstructComponentField", mTargetComponent, field->mFieldName);
Con::printf("Added material field for MaterialSlot %d", i);
GuiInspectorField* fieldGui = materialGroup->constructField(TypeMaterialAssetPtr);
fieldGui->init(inspector, materialGroup);
fieldGui->setSpecialEditField(true);
fieldGui->setTargetObject(this);
StringTableEntry fldnm = StringTable->insert(matFieldName);
fieldGui->setSpecialEditVariableName(fldnm);
fieldGui->setInspectorField(NULL, fldnm);
fieldGui->setDocs("");
if (fieldGui->registerObject())
{
dSprintf(matFieldName, 128, "MaterialSlot%d", i);
StringTableEntry fieldValue = matAsset->getAssetId();
//addComponentField(matFieldName, "A material used in the shape file", "Material", matAsset->getAssetId(), "");
//Con::executef(this, "onConstructComponentField", mTargetComponent, field->mFieldName);
Con::printf("Added material field for MaterialSlot %d", i);
GuiInspectorField* fieldGui = materialGroup->constructField(TypeMaterialAssetPtr);
fieldGui->init(inspector, materialGroup);
fieldGui->setSpecialEditField(true);
fieldGui->setTargetObject(this);
StringTableEntry fldnm = StringTable->insert(matFieldName);
fieldGui->setSpecialEditVariableName(fldnm);
fieldGui->setInspectorField(NULL, fldnm);
fieldGui->setDocs("");
if (fieldGui->registerObject())
//Check if we'd already actually changed it, and display the modified value
for (U32 c = 0; c < mChangingMaterials.size(); c++)
{
fieldGui->setValue(materialname);
stack->addObject(fieldGui);
}
else
{
SAFE_DELETE(fieldGui);
if (mChangingMaterials[c].slot == i)
{
fieldValue = StringTable->insert(mChangingMaterials[i].assetId.c_str());
break;
}
}
/*if (materialGroup->isMethod("onConstructField"))
{
//ensure our stack variable is bound if we need it
//Con::evaluatef("%d.stack = %d;", materialGroup->getId(), materialGroup->at(0)->getId());
fieldGui->setValue(fieldValue);
Con::executef(materialGroup, "onConstructField", matFieldName,
matFieldName, "material", matFieldName,
materialname, "", "", this);
}*/
break;
stack->addObject(fieldGui);
}
else
{
SAFE_DELETE(fieldGui);
}
}
}

View file

@ -236,7 +236,7 @@ void GuiConvexEditorCtrl::setVisible( bool val )
bool isPortal = (scene->at(c)->getClassName() == StringTable->insert("Portal"));
bool isOccluder = (scene->at(c)->getClassName() == StringTable->insert("OcclusionVolume"));
if (isZone || isPortal || isOccluder)
if (isTrigger || isZone || isPortal || isOccluder)
{
SceneObject* sceneObj = static_cast<SceneObject*>(scene->at(c));
if (!sceneObj)
@ -247,15 +247,18 @@ void GuiConvexEditorCtrl::setVisible( bool val )
ConvexShape* proxyShape = createConvexShapeFrom(sceneObj);
if (proxyShape == NULL)
continue;
//Set the texture to a representatory one so we know what's what
if (isTrigger)
proxyShape->mMaterialName = "ToolsModule:TriggerProxyMaterial";
proxyShape->_setMaterial(StringTable->insert("ToolsModule:TriggerProxyMaterial"));
else if (isPortal)
proxyShape->mMaterialName = "ToolsModule:PortalProxyMaterial";
proxyShape->_setMaterial(StringTable->insert("ToolsModule:PortalProxyMaterial"));
else if (isZone)
proxyShape->mMaterialName = "ToolsModule:ZoneProxyMaterial";
proxyShape->_setMaterial(StringTable->insert("ToolsModule:ZoneProxyMaterial"));
else if (isOccluder)
proxyShape->mMaterialName = "ToolsModule:OccluderProxyMaterial";
proxyShape->_setMaterial(StringTable->insert("ToolsModule:OccluderProxyMaterial"));
proxyShape->_updateMaterial();
@ -707,8 +710,6 @@ void GuiConvexEditorCtrl::on3DMouseDragged(const Gui3DMouseEvent & event)
float zRot = mRadToDeg(newSufRot.z - curSufRot.z);
float curZRot = mConvexSEL->mSurfaceUVs[mFaceSEL].zRot;
mConvexSEL->mSurfaceUVs[mFaceSEL].zRot += zRot;
}
@ -2005,8 +2006,6 @@ void GuiConvexEditorCtrl::setSelectedFaceMaterial(const char* materialName)
//run through and find out if there are any other faces still using the old mat texture
if (oldmatID != 0)
{
S32 curMatCount = mConvexSEL->mSurfaceTextures.size();
bool used = false;
for (U32 i = 0; i < mConvexSEL->mSurfaceUVs.size(); i++)
{

View file

@ -631,12 +631,13 @@ void SceneObject::setHidden( bool hidden )
void SceneObject::initPersistFields()
{
addGroup("GameObject");
//Disabled temporarily
/*addGroup("GameObject");
addField("GameObject", TypeGameObjectAssetPtr, Offset(mGameObjectAsset, SceneObject), "The asset Id used for the game object this entity is based on.");
addField("dirtyGameObject", TypeBool, Offset(mDirtyGameObject, SceneObject), "If this entity is a GameObject, it flags if this instance delinates from the template.",
AbstractClassRep::FieldFlags::FIELD_HideInInspectors);
endGroup("GameObject");
endGroup("GameObject");*/
addGroup( "Transform" );

View file

@ -556,6 +556,24 @@ void TSShapeConstructor::_onUnload()
mShape = NULL;
}
//-----------------------------------------------------------------------------
void TSShapeConstructor::setShapeAssetId(StringTableEntry assetId)
{
mShapeAssetId = assetId;
mShapeAsset = mShapeAssetId;
if (mShapeAsset.notNull())
{
Resource<TSShape> shape = mShapeAsset->getShapeResource();
if (shape)
_onLoad(shape);
}
if (mShape && mShape->needsReinit())
{
mShape->init();
}
}
//-----------------------------------------------------------------------------
// Storage

View file

@ -222,6 +222,8 @@ public:
void notifyShapeChanged();
void setShapeAssetId(StringTableEntry assetId);
/// @name Shape paths for MeshFit
///@{
static const String& getCapsuleShapePath() { return smCapsuleShapePath; }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View file

@ -0,0 +1,8 @@
<ImageAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="prefabIcon_image"
imageFile="@assetFile=prefabIcon.png"
UseMips="true"
isHDRImage="false"
imageType="Albedo" />

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.8 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 9 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View file

@ -0,0 +1,8 @@
<ImageAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="terrainMaterialIcon_image"
imageFile="@assetFile=terrainMaterialIcon.png"
UseMips="true"
isHDRImage="false"
imageType="Albedo" />

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Before After
Before After

View file

@ -84,6 +84,7 @@ function initializeAssetBrowser()
exec("./scripts/directoryHandling." @ $TorqueScriptFileExtension);
exec("./scripts/selectPath." @ $TorqueScriptFileExtension);
exec("./scripts/looseFileAudit." @ $TorqueScriptFileExtension);
exec("./scripts/creator." @ $TorqueScriptFileExtension);
//Processing for the different asset types
exec("./scripts/assetTypes/component." @ $TorqueScriptFileExtension);
@ -152,6 +153,9 @@ function initializeAssetBrowser()
ImportAssetWindow.importingFilesArray = new ArrayObject();
ImportAssetWindow.importer = new AssetImporter();
if(!isObject(AssetBrowserCreatorGroupsList))
new ArrayObject(AssetBrowserCreatorGroupsList);
AssetBrowser.buildPopupMenus();

View file

@ -514,7 +514,7 @@ function AssetBrowser::buildAssetPreview( %this, %asset, %moduleName )
AssetBrowser-->previewSlider.setValue(1);
}
if(%previewScaleSize == 0)
if(%previewScaleSize == 0 || startsWith(AssetBrowser.dirHandler.currentAddress, "Creator"))
{
%previewButton.iconLocation = "Left";
%previewButton.textLocation = "Right";
@ -833,139 +833,6 @@ function AssetBrowser::setTagActive(%this, %tag)
%this.rebuildAssetArray();
}
function AssetBrowser::loadCreatorClasses(%this)
{
// Just so we can recall this method for testing changes
// without restarting.
if ( isObject( %this.creatorClassArray ) )
%this.creatorClassArray.delete();
%this.creatorClassArray = new ArrayObject();
%this.creatorClassArray.caseSensitive = true;
//%this.setListView( true );
%this.beginCreatorGroup( "Environment" );
// Removed Prefab as there doesn't really seem to be a point in creating a blank one
//%this.addCreatorClass( "Prefab", "Prefab" );
%this.addCreatorClass( "SkyBox", "Sky Box" );
%this.addCreatorClass( "CloudLayer", "Cloud Layer" );
%this.addCreatorClass( "BasicClouds", "Basic Clouds" );
%this.addCreatorClass( "ScatterSky", "Scatter Sky" );
%this.addCreatorClass( "Sun", "Basic Sun" );
%this.addCreatorClass( "Lightning" );
%this.addCreatorClass( "WaterBlock", "Water Block" );
%this.addCreatorClass( "SFXEmitter", "Sound Emitter" );
%this.addCreatorClass( "Precipitation" );
%this.addCreatorClass( "ParticleEmitterNode", "Particle Emitter" );
// Legacy features. Users should use Ground Cover and the Forest Editor.
//%this.addCreatorClass( "fxShapeReplicator", "Shape Replicator" );
//%this.addCreatorClass( "fxFoliageReplicator", "Foliage Replicator" );
%this.addCreatorClass( "PointLight", "Point Light" );
%this.addCreatorClass( "SpotLight", "Spot Light" );
%this.addCreatorClass( "GroundCover", "Ground Cover" );
%this.addCreatorClass( "TerrainBlock", "Terrain Block" );
%this.addCreatorClass( "GroundPlane", "Ground Plane" );
%this.addCreatorClass( "WaterPlane", "Water Plane" );
%this.addCreatorClass( "PxCloth", "Cloth" );
%this.addCreatorClass( "ForestWindEmitter", "Wind Emitter" );
%this.addCreatorClass( "DustEmitter", "Dust Emitter" );
%this.addCreatorClass( "DustSimulation", "Dust Simulation" );
%this.addCreatorClass( "DustEffecter", "Dust Effecter" );
%this.endCreatorGroup();
%this.beginCreatorGroup( "Level" );
%this.addCreatorClass("MissionArea", "Mission Area" );
%this.addCreatorClass("Path" );
%this.addCreatorClass("Marker", "Path Node" );
%this.addCreatorClass("Trigger" );
%this.addCreatorClass("PhysicalZone", "Physical Zone" );
%this.addCreatorClass("Camera" );
%this.addCreatorClass( "LevelInfo", "Level Info" );
%this.addCreatorClass( "TimeOfDay", "Time of Day" );
%this.addCreatorClass( "Zone", "Zone" );
%this.addCreatorClass( "Portal", "Zone Portal" );
%this.addCreatorClass( "SpawnSphere", "Player Spawn Sphere"/*, "PlayerDropPoint"*/ );
%this.addCreatorClass( "SpawnSphere", "Observer Spawn Sphere"/*, "ObserverDropPoint"*/ );
%this.addCreatorClass( "SFXSpace", "Sound Space" );
%this.addCreatorClass( "OcclusionVolume", "Occlusion Volume" );
%this.endCreatorGroup();
%this.beginCreatorGroup( "System" );
%this.addCreatorClass( "SimGroup" );
%this.addCreatorClass( "AIPathGroup" );
%this.endCreatorGroup();
%this.beginCreatorGroup( "ExampleObjects" );
%this.addCreatorClass( "RenderObjectExample" );
%this.addCreatorClass( "RenderMeshExample" );
%this.addCreatorClass( "RenderShapeExample" );
%this.endCreatorGroup();
%this.creatorClassArray.sortk();
}
function AssetBrowser::beginCreatorGroup(%this, %group)
{
AssetBrowser-->filterTree.insertItem(AssetBrowser-->filterTree.creatorIdx, %group);
%this.currentCreatorGroup = %group;
}
function AssetBrowser::endCreatorGroup(%this, %group)
{
%this.currentCreatorGroup = "";
}
function AssetBrowser::addCreatorClass(%this, %class, %name, %buildfunc)
{
if( !isClass(%class) )
return;
if ( %name $= "" )
%name = %class;
// TODO
%group = "";
if ( %this.currentCreatorGroup !$= "" && %group $= "" )
%group = %this.currentCreatorGroup;
if ( %class $= "" || %group $= "" )
{
warn( "AssetBrowser::addCreatorClass, invalid parameters!" );
return;
}
if(%buildfunc $= "")
{
%method = "build" @ %buildfunc;
if( !ObjectBuilderGui.isMethod( %method ) )
%method = "build" @ %class;
if( !ObjectBuilderGui.isMethod( %method ) )
%cmd = "return new " @ %class @ "();";
else
%cmd = "ObjectBuilderGui." @ %method @ "();";
%buildfunc = "ObjectBuilderGui.newObjectCallback = \"AssetBrowser.onFinishCreateObject\"; EWCreatorWindow.createObject( \"" @ %cmd @ "\" );";
}
%args = new ScriptObject();
%args.val[0] = %class;
%args.val[1] = %name;
%args.val[2] = %buildfunc;
%this.creatorClassArray.push_back( %group, %args );
}
//
//needs to be deleted with the persistence manager and needs to be blanked out of the matmanager
//also need to update instances... i guess which is the tricky part....
@ -1489,47 +1356,6 @@ function AssetBrowser::doRebuildAssetArray(%this)
%assetType = AssetDatabase.getAssetType(%assetId);
}
/*%validType = false;
if(AssetBrowser.assetTypeFilter $= "")
{
if(AssetTypeListPopup.isItemChecked(0))
{
%validType = true;
}
else
{
for(%f=1; %f < AssetFilterTypeList.Count(); %f++)
{
%isChecked = AssetTypeListPopup.isItemChecked(%f+1);
if(%isChecked)
{
%filterTypeName = AssetFilterTypeList.getKey(%f);
if(%activeTypeFilterList $= "")
%activeTypeFilterList = %filterTypeName;
else
%activeTypeFilterList = %activeTypeFilterList @ ", " @ %filterTypeName;
if(%filterTypeName @ "Asset" $= %assetType)
{
%validType = true;
break;
}
}
}
}
if(!%validType)
continue;
}
else
{
if(%assetType !$= AssetBrowser.assetTypeFilter)
continue;
}*/
//stop adding after previewsPerPage is hit
%assetName = AssetDatabase.getAssetName(%assetId);
@ -1604,7 +1430,7 @@ function AssetBrowser::doRebuildAssetArray(%this)
}
//Add Non-Asset Scripted Objects. Datablock, etc based
if(AssetBrowser.assetTypeFilter $= "" && %breadcrumbPath !$= "" && !startsWith(%breadcrumbPath, "Creator/"))
if(AssetBrowser.assetTypeFilter $= "" && %breadcrumbPath !$= "" && isDirectory(%breadcrumbPath))
{
%category = getWord( %breadcrumbPath, 1 );
%dataGroup = "DataBlockGroup";
@ -1794,11 +1620,28 @@ function AssetBrowser::doRebuildAssetArray(%this)
//One of the creator folders was selected
%creatorGroup = AssetBrowserFilterTree.getItemText(AssetBrowserFilterTree.getSelectedItem(0));
if(%creatorGroup $= "Creator")
{
//add folders for the groups
%placeholderVar = "";
}
else
{
for ( %i = 0; %i < AssetBrowser.creatorClassArray.count(); %i++ )
{
%group = AssetBrowser.creatorClassArray.getKey( %i );
if ( %group $= %creatorGroup )
//Do some filter logic do skip out of groups if we're in the wrong editor mode for it
%creatorEditorFilter = "WorldEditor";
if(GuiEditorIsActive())
{
%creatorEditorFilter = "GuiEditor";
}
%creatorGroupIndex = AssetBrowserCreatorGroupsList.getIndexFromValue(%group);
%creatorGroupKey = AssetBrowserCreatorGroupsList.getKey(%creatorGroupIndex);
if ( %group $= %creatorGroup && %creatorGroupKey $= %creatorEditorFilter )
{
%creatorObj = AssetBrowser.creatorClassArray.getValue( %i );
%class = %creatorObj.val[0];
@ -1809,6 +1652,7 @@ function AssetBrowser::doRebuildAssetArray(%this)
}
}
}
}
for(%i=0; %i < $AssetBrowser::AssetArray.count(); %i++)
AssetBrowser.buildAssetPreview( $AssetBrowser::AssetArray.getValue(%i), $AssetBrowser::AssetArray.getKey(%i) );
@ -2534,6 +2378,9 @@ function AssetBrowserFilterTree::onDragDropped( %this )
function AssetBrowser::hasLooseFilesInDir(%this)
{
if(!isDirectory(%this.dirHandler.currentAddress))
return false;
//First, wipe out any files inside the folder first
%file = findFirstFileMultiExpr( %this.dirHandler.currentAddress @ "/*.*", false);

View file

@ -413,63 +413,6 @@ function ImportAssetWindow::reloadImportOptionConfigs(%this)
//ImportAssetConfigList.setSelected(%importConfigIdx);
}
//
/*function importLooseFile(%filePath, %forceAutoImport)
{
%assetType = getAssetTypeByFilename(%filePath);
if(%forceAutoImport)
{
//If we're attempting to fast-track the import, check that that's even an option
if(ImportAssetWindow.importConfigsList.count() == 0 ||
EditorSettings.value("Assets/AssetImporDefaultConfig") $= "" ||
EditorSettings.value("Assets/AutoImport", false) == false)
{
toolsMessageBoxOK("Unable to AutoImport", "Attempted to import a loose file " @ %filePath @ " with AutoImport but was unable to either due to lacking a valid import config, or the editor settings are not set to auto import.");
return false;
}
if(%assetType $= "folder" || %assetType $= "zip")
{
toolsMessageBoxOK("Unable to AutoImport", "Unable to auto import folders or zips at this time");
return false;
}
if(%assetType $= "")
{
toolsMessageBoxOK("Unable to AutoImport", "Unable to auto import unknown file type for file " @ %filePath);
return false;
}
}
%assetItem = AssetBrowser.addImportingAsset(%assetType, %filePath, "", "");
ImportAssetItems.add(%assetItem);
if(%forceAutoImport)
{
%targetModule = AssetBrowser.dirHandler.getModuleFromAddress(filePath(%filePath)).ModuleId;
AssetImportTargetModule.text = %targetModule;
%assetItem.moduleName = %targetModule;
%assetName = %assetItem.assetName;
AssetBrowser.dirHandler.currentAddress = filePath(%filePath);
//skip the refresh delay, we'll force it here
ImportAssetWindow.doRefresh();
ImportAssetItems.empty();
if(ImportAssetWindow.hasImportIssues)
return false;
}
$importedLooseFileAsset = %assetItem.moduleName @ ":" @ %assetItem.assetName;
return true;
}*/
//
function assetImportUpdatePath(%newPath)
{
@ -478,91 +421,6 @@ function assetImportUpdatePath(%newPath)
AssetImportTargetModule.text = AssetBrowser.dirHandler.getModuleFromAddress(AssetBrowser.dirHandler.currentAddress).ModuleId;
}
//
/*function ImportAssetWindow::processImportAssets(%this, %assetItem)
{
if(!isObject(%assetItem))
{
//Zero this out
ImportAssetWindow.assetHeirarchyChanged = false;
for(%i=0; %i < ImportAssetItems.count(); %i++)
{
%assetItem = ImportAssetItems.getKey(%i);
if(!isObject(%assetItem) || %assetItem.skip )
return;
if(%assetItem.processed == false)
{
//sanetize before modifying our asset name(suffix additions, etc)
if(%assetItem.assetName !$= %assetItem.cleanAssetName)
%assetItem.assetName = %assetItem.cleanAssetName;
if(%assetItem.assetType $= "AnimationAsset")
{
//if we don't have our own file, that means we're gunna be using our parent shape's file so reference that
if(!isFile(%assetItem.filePath))
{
%assetItem.filePath = %assetItem.parentAssetItem.filePath;
}
}
if(AssetBrowser.isMethod("prepareImport" @ %assetItem.assetType))
{
%command = AssetBrowser @ ".prepareImport" @ %assetItem.assetType @ "(" @ %assetItem @ ");";
eval(%command);
}
%assetItem.processed = true;
}
%this.processImportAssets(%assetItem);
}
}
else
{
for(%i=0; %i < %assetItem.childAssetItems.count(); %i++)
{
%childAssetItem = %assetItem.childAssetItems.getKey(%i);
if(!isObject(%childAssetItem) || %childAssetItem.skip)
return;
if(%childAssetItem.processed == false)
{
//sanetize before modifying our asset name(suffix additions, etc)
if(%childAssetItem.assetName !$= %childAssetItem.cleanAssetName)
%childAssetItem.assetName = %childAssetItem.cleanAssetName;
if(%childAssetItem.assetType $= "AnimationAsset")
{
//if we don't have our own file, that means we're gunna be using our parent shape's file so reference that
if(!isFile(%childAssetItem.filePath))
{
%childAssetItem.filePath = %childAssetItem.parentAssetItem.filePath;
}
}
if(AssetBrowser.isMethod("prepareImport" @ %childAssetItem.assetType))
{
%command = AssetBrowser @ ".prepareImport" @ %childAssetItem.assetType @ "(" @ %childAssetItem @ ");";
eval(%command);
}
%childAssetItem.processed = true;
}
%this.processImportAssets(%childAssetItem);
}
}
//If our hierarchy changed, it's because we did so during processing
//so we'll loop back through again until everything has been processed
if(ImportAssetWindow.assetHeirarchyChanged)
%this.processImportAssets();
}*/
function ImportAssetWindow::findImportingAssetByName(%this, %assetName, %assetItem)
{
if(!isObject(%assetItem))

View file

@ -11,6 +11,19 @@ function AssetBrowser::buildCppPreview(%this, %assetDef, %previewData)
%previewData.tooltip = %assetDef.assetName;
}
function AssetBrowser::buildCppAssetPreview(%this, %assetDef, %previewData)
{
%previewData.assetName = %assetDef.assetName;
%previewData.assetPath = %assetDef.codeFilePath;
%previewData.doubleClickCommand = "echo(\"Not yet implemented to edit C++ files from the editor\");";//"EditorOpenFileInTorsion( "@%previewData.assetPath@", 0 );";
%previewData.previewImage = "ToolsModule:cppIcon_image";
%previewData.assetFriendlyName = %assetDef.assetName;
%previewData.assetDesc = %assetDef.description;
%previewData.tooltip = %assetDef.assetName;
}
function AssetBrowser::createCpp(%this)
{
%moduleName = AssetBrowser.newAssetSettings.moduleName;

View file

@ -9,6 +9,14 @@ function AssetBrowser::buildCreatorPreview(%this, %assetDef, %previewData)
%previewData.previewImage = "ToolsModule:" @ %class @ "_image";
if(!AssetDatabase.isDeclaredAsset(%previewData.previewImage))
{
if(EditorIsActive())
%previewData.previewImage = "ToolsModule:SceneObject_image";
else if(GuiEditorIsActive())
%previewData.previewImage = "ToolsModule:GuiControl_image";
}
//%previewData.assetFriendlyName = %assetDef.assetName;
%previewData.assetDesc = %assetDef;
%previewData.tooltip = "This creates a new object of the class " @ %class;
@ -22,6 +30,8 @@ function AssetBrowser::onFinishCreateObject(%this, %objId)
function AssetBrowser::onCreatorEditorDropped(%this, %assetDef, %position)
{
if(EditorIsActive())
{
%targetPosition = EWorldEditor.unproject(%position SPC 1000);
%camPos = LocalClientConnection.camera.getPosition();
%rayResult = containerRayCast(%camPos, %targetPosition, -1);
@ -41,4 +51,9 @@ function AssetBrowser::onCreatorEditorDropped(%this, %assetDef, %position)
%this.createdObjectPos = %pos;
%newObj = eval(%func);
}
else if(GuiEditorIsActive())
{
%placeholderVar = "";
}
}

View file

@ -434,10 +434,20 @@ function AssetBrowser::buildMaterialAssetPreview(%this, %assetDef, %previewData)
%generatePreview = false;
%previewFilePath = %previewPath @ %assetDef.assetName @ "_Preview.png";
if(!isFile(%previewFilePath) || (compareFileTimes(%assetDef.getImagePath(), %previewFilePath) == 1))
if(!isFile(%previewFilePath))
{
%generatePreview = true;
}
else
{
if(isObject(%assetDef.materialDefinitionName))
{
if(compareFileTimes(%assetDef.materialDefinitionName.getDiffuseMap(0), %previewFilePath) == 1 ||
compareFileTimes(%assetDef.materialDefinitionName.getFilename(), %previewFilePath) == 1)
%generatePreview = true;
}
}
%previewAssetName = %module.moduleId @ "_" @ %assetDef.assetName @ "_PreviewImage";
@ -479,7 +489,7 @@ function AssetBrowser::buildMaterialAssetPreview(%this, %assetDef, %previewData)
//Revalidate. If it didn't work, just use the default placeholder one
if(!isFile(%previewFilePath))
%previewAssetName = "ToolsModule:genericAssetIcon_image";
%previewAssetName = "ToolsModule:materialIcon_image";
%previewData.assetName = %assetDef.assetName;
%previewData.assetPath = %assetDef.scriptFile;

View file

@ -21,7 +21,7 @@ function AssetBrowser::buildPrefabPreview(%this, %assetDef, %previewData)
%previewData.assetName = %assetDef.assetName;
%previewData.assetPath = %fullPath;
%previewData.previewImage = "ToolsModule:genericAssetIcon_image";
%previewData.previewImage = "ToolsModule:prefabIcon_image";
//%previewData.assetFriendlyName = %assetDef.assetName;
%previewData.assetDesc = %assetDef.description;

View file

@ -89,6 +89,22 @@ function AssetBrowser::moveScriptAsset(%this, %assetDef, %destination)
AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath);
}
function AssetBrowser::buildScriptAssetPreview(%this, %assetDef, %previewData)
{
%previewData.assetName = %assetDef.assetName;
%previewData.assetPath = %assetDef.scriptFile;
%previewData.doubleClickCommand = "EditorOpenFileInTorsion( \""@%previewData.assetPath@"\", 0 );";
if(%assetDef.isServerSide)
%previewData.previewImage = "ToolsModule:serverScriptIcon_image";
else
%previewData.previewImage = "ToolsModule:clientScriptIcon_image";
%previewData.assetFriendlyName = %assetDef.assetName;
%previewData.assetDesc = %assetDef.description;
%previewData.tooltip = "Asset Name: " @ %assetDef.assetName @ "\nDefinition Path: " @ %assetDef.getFilename();
}
function AssetBrowser::buildTScriptPreview(%this, %assetDef, %previewData)
{
%previewData.assetName = %assetDef.assetName;

View file

@ -357,6 +357,7 @@ function AssetBrowser::onShapeAssetEditorDropped(%this, %assetDef, %position)
EWorldEditor.isDirty = true;
MECreateUndoAction::submit(%newStatic );
}
function GuiInspectorTypeShapeAssetPtr::onControlDropped( %this, %payload, %position )
@ -371,15 +372,15 @@ function GuiInspectorTypeShapeAssetPtr::onControlDropped( %this, %payload, %posi
if(%assetType $= "ShapeAsset")
{
//echo("DROPPED A SHAPE ON A SHAPE ASSET COMPONENT FIELD!");
%module = %payload.moduleName;
%asset = %payload.assetName;
%targetComponent = %this.targetObject;
%targetComponent.shapeAsset = %module @ ":" @ %asset;
%oldValue = %this.targetObject.shapeAsset;
%arrayIndex = "";
//Inspector.refresh();
%targetObject = %this.targetObject;
%targetObject.shapeAsset = %module @ ":" @ %asset;
}
EWorldEditor.isDirty = true;

View file

@ -166,7 +166,7 @@ function AssetBrowser::buildTerrainAssetPreview(%this, %assetDef, %previewData)
%previewData.assetName = %assetDef.assetName;
%previewData.assetPath = "";
%previewData.previewImage = "ToolsModule:gameObjectIcon_image";
%previewData.previewImage = "ToolsModule:terrainIcon_image";
%previewData.assetFriendlyName = %assetDef.gameObjectName;
%previewData.assetDesc = %assetDef.description;

View file

@ -0,0 +1,192 @@
function AssetBrowser::loadCreatorClasses(%this)
{
// Just so we can recall this method for testing changes
// without restarting.
if ( isObject( %this.creatorClassArray ) )
%this.creatorClassArray.delete();
AssetBrowserCreatorGroupsList.empty();
%this.creatorClassArray = new ArrayObject();
%this.creatorClassArray.caseSensitive = true;
//%this.setListView( true );
//World Editor Creator Groups
%this.beginCreatorGroup( "Environment" );
%this.addCreatorClass( "BasicClouds", "Basic Clouds" );
%this.addCreatorClass( "PxCloth", "Cloth" );
%this.addCreatorClass( "CloudLayer", "Cloud Layer" );
%this.addCreatorClass( "GroundCover", "Ground Cover" );
%this.addCreatorClass( "Lightning" );
%this.addCreatorClass( "ParticleEmitterNode","Particle Emitter" );
%this.addCreatorClass( "Precipitation" );
// Legacy features. Users should use Ground Cover and the Forest Editor.
//%this.addCreatorClass( "fxShapeReplicator", "Shape Replicator" );
//%this.addCreatorClass( "fxFoliageReplicator", "Foliage Replicator" );
%this.addCreatorClass( "RibbonNode", "Ribbon Emitter" );
%this.addCreatorClass( "ScatterSky", "Scatter Sky" );
%this.addCreatorClass( "SkyBox", "Sky Box" );
%this.addCreatorClass( "SFXEmitter", "Sound Emitter" );
%this.addCreatorClass( "TerrainBlock", "Terrain Block" );
%this.addCreatorClass( "VolumetricFog", "Volumetric Fog" );
%this.addCreatorClass( "TimeOfDay", "Time of Day" );
%this.addCreatorClass( "WaterBlock", "Water Block" );
%this.addCreatorClass( "WaterPlane", "Water Plane" );
%this.addCreatorClass( "ForestWindEmitter", "Wind Emitter" );
%this.endCreatorGroup();
%this.beginCreatorGroup( "ExampleObjects" );
%this.addCreatorClass( "RenderMeshExample" );
%this.addCreatorClass( "RenderObjectExample" );
%this.addCreatorClass( "RenderShapeExample" );
%this.endCreatorGroup();
%this.beginCreatorGroup( "Level" );
%this.addCreatorClass("Camera" );
%this.addCreatorClass("GroundPlane", "Ground Plane" );
%this.addCreatorClass("LevelInfo", "Level Info" );
%this.addCreatorClass("Marker", "Path Node" );
%this.addCreatorClass("MissionArea", "Mission Area" );
%this.addCreatorClass("Note", "Note" );
%this.addCreatorClass("Path" );
%this.addCreatorClass("SpawnSphere", "General Spawn Sphere" );
%this.addCreatorClass("SpawnSphere", "Player Spawn Sphere"/*, "PlayerDropPoint"*/ );
%this.addCreatorClass("SpawnSphere", "Observer Spawn Sphere"/*, "ObserverDropPoint"*/ );
%this.addCreatorClass("VPath", "Verve Path" );
%this.endCreatorGroup();
%this.beginCreatorGroup( "Lighting" );
%this.addCreatorClass( "BoxEnvironmentProbe", "Box Env. Probe" );
%this.addCreatorClass( "PointLight", "Point Light" );
%this.addCreatorClass( "Skylight", "Skylight" );
%this.addCreatorClass( "SphereEnvironmentProbe", "Sphere Env. Probe" );
%this.addCreatorClass( "SpotLight", "Spot Light" );
%this.addCreatorClass( "Sun", "Basic Sun" );
%this.endCreatorGroup();
%this.beginCreatorGroup( "Navigation" );
%this.addCreatorClass( "AIPathGroup" );
%this.addCreatorClass( "CoverPoint", "Cover Point" );
%this.addCreatorClass( "NavMesh", "Navigation Mesh" );
%this.addCreatorClass( "NavPath", "Navigation Path" );
%this.endCreatorGroup();
%this.beginCreatorGroup( "System" );
%this.addCreatorClass( "SimGroup" );
%this.endCreatorGroup();
%this.beginCreatorGroup( "Volumes" );
%this.addCreatorClass("AccumulationVolume", "Accumulation Volume" );
%this.addCreatorClass("OcclusionVolume", "Occlusion Volume" );
%this.addCreatorClass("PhysicalZone", "Physical Zone" );
%this.addCreatorClass("Portal", "Zone Portal" );
%this.addCreatorClass("SFXSpace", "Sound Space" );
%this.addCreatorClass("Trigger" );
%this.addCreatorClass("Zone", "Zone" );
%this.endCreatorGroup();
//Gui Editor Creator Groups
%controls = enumerateConsoleClassesByCategory( "Gui" );
%guiClasses = new ArrayObject();
foreach$( %className in %controls )
{
if( GuiEditor.isFilteredClass( %className )
|| !isMemberOfClass( %className, "GuiControl" ) )
continue;
%category = getWord( getCategoryOfClass( %className ), 1 );
if( %category $= "" )
continue;
%guiClasses.add(%category, %className);
}
%guiClasses.sortk(true);
%guiClasses.echo();
%currentCat = "";
for(%i=0; %i < %guiClasses.count(); %i++)
{
%guiCat = %guiClasses.getKey(%i);
if(%currentCat !$= %guiCat)
{
if(%currentCat !$= "")
%this.endCreatorGroup();
%this.beginCreatorGroup( %guiCat, "GuiEditor" );
%currentCat = %guiCat;
}
%guiClass = %guiClasses.getValue(%i);
%this.addCreatorClass( %guiClass );
}
%this.endCreatorGroup();
%this.creatorClassArray.sortk(true);
%this.creatorClassArray.sort(true);
%guiClasses.delete();
}
function AssetBrowser::beginCreatorGroup(%this, %group, %editor)
{
if(%editor $= "")
%editor = "WorldEditor";
if((GuiEditorIsActive() && %editor $= "GuiEditor") || (EditorIsActive() && %editor $= "WorldEditor"))
{
AssetBrowser-->filterTree.insertItem(AssetBrowser-->filterTree.creatorIdx, %group);
}
%this.currentCreatorGroup = %group;
AssetBrowserCreatorGroupsList.add(%editor, %group);
}
function AssetBrowser::endCreatorGroup(%this, %group)
{
%this.currentCreatorGroup = "";
}
function AssetBrowser::addCreatorClass(%this, %class, %name, %buildfunc)
{
if( !isClass(%class) )
return;
if ( %name $= "" )
%name = %class;
%group = %this.currentCreatorGroup;
if ( %class $= "" || %group $= "" )
{
warn( "AssetBrowser::addCreatorClass, invalid parameters!" );
return;
}
if(%buildfunc $= "")
{
%method = "build" @ %buildfunc;
if( !ObjectBuilderGui.isMethod( %method ) )
%method = "build" @ %class;
if( !ObjectBuilderGui.isMethod( %method ) )
%cmd = "return new " @ %class @ "();";
else
%cmd = "ObjectBuilderGui." @ %method @ "();";
%buildfunc = "ObjectBuilderGui.newObjectCallback = \"AssetBrowser.onFinishCreateObject\"; EWCreatorWindow.createObject( \"" @ %cmd @ "\" );";
}
%args = new ScriptObject();
%args.val[0] = %class;
%args.val[1] = %name;
%args.val[2] = %buildfunc;
%this.creatorClassArray.push_back( %group, %args );
}

View file

@ -24,4 +24,67 @@ singleton GuiControlProfile(AssetBrowserPreviewShapeAsset : ToolsGuiDefaultProfi
border = true;
borderColor = "0 0 200 255";
borderColorNA = "0 0 200 255";
};
singleton GuiControlProfile(AssetBrowserPreviewShapeAnimationAsset : ToolsGuiDefaultProfile)
{
fillColor = "128 128 128 255"; //hovered/selected
border = true;
borderColor = "0 0 200 255";
borderColorNA = "0 0 200 255";
};
singleton GuiControlProfile(AssetBrowserPreviewSoundAsset : ToolsGuiDefaultProfile)
{
fillColor = "128 128 128 255"; //hovered/selected
border = true;
borderColor = "75 101 135 255";
borderColorNA = "75 101 135 255";
};
singleton GuiControlProfile(AssetBrowserPreviewTerrainAsset : ToolsGuiDefaultProfile)
{
fillColor = "128 128 128 255"; //hovered/selected
border = true;
borderColor = "200 198 198 255";
borderColorNA = "200 198 198 255";
};
singleton GuiControlProfile(AssetBrowserPreviewTerrainMaterialAsset : ToolsGuiDefaultProfile)
{
fillColor = "128 128 128 255"; //hovered/selected
border = true;
borderColor = "200 198 198 255";
borderColorNA = "200 198 198 255";
};
singleton GuiControlProfile(AssetBrowserPreviewStateMachineAsset : ToolsGuiDefaultProfile)
{
fillColor = "128 128 128 255"; //hovered/selected
border = true;
borderColor = "0 76 135 255";
borderColorNA = "0 76 135 255";
};
singleton GuiControlProfile(AssetBrowserPreviewGUIAsset : ToolsGuiDefaultProfile)
{
fillColor = "128 128 128 255"; //hovered/selected
border = true;
borderColor = "17 5 44 255";
borderColorNA = "17 5 44 255";
};
singleton GuiControlProfile(AssetBrowserPreviewLevelAsset : ToolsGuiDefaultProfile)
{
fillColor = "128 128 128 255"; //hovered/selected
border = true;
borderColor = "0 208 186 255";
borderColorNA = "0 208 186 255";
};

View file

@ -289,6 +289,11 @@ function ESettingsWindow::getAxisSettings(%this)
function ESettingsWindow::getGeneralSettings(%this)
{
SettingsInspector.startGroup("Level Load");
SettingsInspector.addSettingsField("WorldEditor/LevelLoad/LoadMode", "Editor Startup Scene", "list", "When the editor loads, this setting dictates what scene is loaded first",
"Last Edited Level,Editor Default Scene");
SettingsInspector.endGroup();
SettingsInspector.startGroup("Autosave");
SettingsInspector.addSettingsField("WorldEditor/AutosaveInterval", "Autosave Interval(in minutes)", "int", "");
SettingsInspector.endGroup();

View file

Before

Width:  |  Height:  |  Size: 276 B

After

Width:  |  Height:  |  Size: 276 B

Before After
Before After

View file

@ -2,7 +2,7 @@
canSave="true"
canSaveDynamicFields="true"
AssetName="tab_border_image"
imageFile="@assetFile=tab-border.png"
imageFile="@assetFile=tab_border.png"
UseMips="true"
isHDRImage="false"
imageType="Albedo" />

View file

@ -672,16 +672,21 @@ function GuiEditor::onControlDropped(%this, %payload, %position)
{
// Make sure we have the right kind of D&D.
if( !%payload.parentGroup.isInNamespaceHierarchy( "GuiDragAndDropControlType_GuiControl" ) )
if( !%payload.parentGroup.isInNamespaceHierarchy( "GuiDragAndDropControlType_GuiControl" ) &&
!%payload.parentGroup.isInNamespaceHierarchy( "AssetPreviewControlType_AssetDrop" ))
return;
%pos = %payload.getGlobalPosition();
%x = getWord(%pos, 0);
%y = getWord(%pos, 1);
%this.addNewCtrl(%payload);
%asset = %payload.assetName;
%cmd = "return new " @ %asset @ "();";
%ctrl = eval( %cmd );
%this.addNewCtrl(%ctrl);
%payload.setPositionGlobal(%x, %y);
%ctrl.setPositionGlobal(%x, %y);
%this.setFirstResponder();
}
@ -846,6 +851,8 @@ function GuiEditorTabBook::onWake( %this )
item[ 0 ] = "Alphabetical View" TAB "" TAB "GuiEditorToolbox.setViewType( \"Alphabetical\" );";
item[ 1 ] = "Categorized View" TAB "" TAB "GuiEditorToolbox.setViewType( \"Categorized\" );";
};
GlobalActionMap.bindCmd( keyboard, space, "", "AssetBrowser.toggleDialog();" );
}
//---------------------------------------------------------------------------------------------
@ -1010,6 +1017,8 @@ function GuiEditorGui::onWake( %this )
function GuiEditorGui::onSleep( %this)
{
GlobalActionMap.unbind( keyboard, space );
// If we are editing a control, store its guide state.
%content = GuiEditor.getContentControl();

View file

@ -278,7 +278,35 @@ function fastLoadWorldEdit(%val)
if( !$missionRunning )
{
if(EditorSettings.value("WorldEditor/LevelLoad/LoadMode", "Editor Default Scene") $= "Editor Default Scene")
{
EditorNewLevel("ToolsModule:DefaultEditorLevel");
}
else
{
//go back through our recent levels list to find the most recent valid editor level.
//if NONE work, then just load the default editor scene
%recentLevels = EditorSettings.value("WorldEditor/recentLevelsList");
%recentCount = getTokenCount(%recentLevels, ",");
%loadedScene = false;
for(%i=0; %i < %recentCount; %i++)
{
%recentEntry = getToken(%recentLevels, ",", %i);
if(AssetDatabase.isDeclaredAsset(%recentEntry))
{
EditorOpenMission(%recentEntry);
%loadedScene = true;
break;
}
}
if(!%loadedScene)
{
EditorNewLevel("ToolsModule:DefaultEditorLevel");
}
}
}
else
{

View file

@ -315,7 +315,7 @@ function ShapeEditor::selectShape( %this, %shapeAsset, %saveOld )
ShapeEditor.shape = findShapeConstructorByAssetId( %shapeAsset.getAssetId() );
if ( ShapeEditor.shape <= 0 )
{
ShapeEditor.shape = %this.createConstructor( %shapeAsset );
ShapeEditor.shape = %this.createConstructor( %shapeAsset.getAssetId() );
if ( ShapeEditor.shape <= 0 )
{
error( "ShapeEditor: Error - could not select " @ %shapeAsset.getAssetId() );
@ -2338,7 +2338,7 @@ function ShapeEdMaterials::updateSelectedMaterial( %this, %highlight )
%this.savedMap = %this.selectedMaterial.diffuseMap[1];
if ( %highlight && isObject( %this.selectedMaterial ) )
{
%this.selectedMaterial.diffuseMap[1] = "tools/shapeEditor/images/highlight_material";
%this.selectedMaterial.setDiffuseMap("ToolsModule:highlight_material_image", 1);
%this.selectedMaterial.reload();
}
}
@ -3068,7 +3068,7 @@ function ShapeEditor::addLODFromFile( %this, %dest, %assetId, %size, %allowUnmat
%source = findShapeConstructorByAssetId( %assetId );
if ( %source == -1 )
%source = ShapeEditor.createConstructor( %filename );
%source = ShapeEditor.createConstructor( %assetId );
%source.lodType = "SingleSize";
%source.singleDetailSize = %size;