Adjusts getUtilizedAssets writeout so it more consistently prints out the dependent assets

Adds handling for prefabs with getUtilizedAssets
This commit is contained in:
Areloch 2020-09-08 01:04:41 -05:00
parent 0b954459a3
commit c5bccd8ff4
5 changed files with 27 additions and 6 deletions

View file

@ -260,7 +260,14 @@ bool Scene::saveScene(StringTableEntry fileName)
for (U32 i = 0; i < utilizedAssetsList.size(); i++) for (U32 i = 0; i < utilizedAssetsList.size(); i++)
{ {
levelAssetDef->addAssetDependencyField("staticObjectAssetDependency", utilizedAssetsList[i]); char depSlotName[50];
dSprintf(depSlotName, sizeof(depSlotName), "%s%d", "staticObjectAssetDependency", i);
char depValue[255];
dSprintf(depValue, sizeof(depValue), "@Asset=%s", utilizedAssetsList[i]);
levelAssetDef->setDataField(StringTable->insert(depSlotName), NULL, StringTable->insert(depValue));
} }
saveSuccess = levelAssetDef->saveAsset(); saveSuccess = levelAssetDef->saveAsset();
@ -280,8 +287,6 @@ void Scene::getUtilizedAssetsFromSceneObject(SimObject* object, Vector<StringTab
for (U32 c = 0; c < group->size(); c++) for (U32 c = 0; c < group->size(); c++)
{ {
SceneObject* childObj = dynamic_cast<SceneObject*>(group->getObject(c)); SceneObject* childObj = dynamic_cast<SceneObject*>(group->getObject(c));
if (childObj)
childObj->getUtilizedAssets(usedAssetsList);
//Recurse down //Recurse down
getUtilizedAssetsFromSceneObject(childObj, usedAssetsList); getUtilizedAssetsFromSceneObject(childObj, usedAssetsList);

View file

@ -558,6 +558,19 @@ bool Prefab::buildExportPolyList(ColladaUtils::ExportData* exportData, const Box
return true; return true;
} }
void Prefab::getUtilizedAssets(Vector<StringTableEntry>* usedAssetsList)
{
Vector<SceneObject*> foundObjects;
mChildGroup->findObjectByType(foundObjects);
for (S32 i = 0; i < foundObjects.size(); i++)
{
SceneObject* child = foundObjects[i];
child->getUtilizedAssets(usedAssetsList);
}
}
ExplodePrefabUndoAction::ExplodePrefabUndoAction( Prefab *prefab ) ExplodePrefabUndoAction::ExplodePrefabUndoAction( Prefab *prefab )
: UndoAction( "Explode Prefab" ) : UndoAction( "Explode Prefab" )
{ {

View file

@ -100,6 +100,8 @@ public:
bool buildExportPolyList(ColladaUtils::ExportData* exportData, const Box3F &box, const SphereF &); bool buildExportPolyList(ColladaUtils::ExportData* exportData, const Box3F &box, const SphereF &);
virtual void getUtilizedAssets(Vector<StringTableEntry>* usedAssetsList);
protected: protected:
void _closeFile( bool removeFileNotify ); void _closeFile( bool removeFileNotify );

View file

@ -1692,8 +1692,9 @@ void TSStatic::updateMaterials()
void TSStatic::getUtilizedAssets(Vector<StringTableEntry>* usedAssetsList) void TSStatic::getUtilizedAssets(Vector<StringTableEntry>* usedAssetsList)
{ {
if(!mShapeAsset.isNull()) if(!mShapeAsset.isNull() && mShapeAsset->getAssetId() != StringTable->insert("Core_Rendering:noShape"))
usedAssetsList->push_back_unique(mShapeAssetId); usedAssetsList->push_back_unique(mShapeAsset->getAssetId());
} }
//------------------------------------------------------------------------ //------------------------------------------------------------------------

View file

@ -1423,7 +1423,7 @@ void TerrainBlock::getMinMaxHeight( F32 *minHeight, F32 *maxHeight ) const
void TerrainBlock::getUtilizedAssets(Vector<StringTableEntry>* usedAssetsList) void TerrainBlock::getUtilizedAssets(Vector<StringTableEntry>* usedAssetsList)
{ {
if (!mTerrainAsset.isNull()) if (!mTerrainAsset.isNull())
usedAssetsList->push_back_unique(mTerrainAssetId); usedAssetsList->push_back_unique(mTerrainAsset->getAssetId());
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Console Methods // Console Methods