Added shader sharing mechanism; added "cook all dirty packages" button; other various tweaks and fixes

This commit is contained in:
Aruki
2017-02-09 10:54:38 -07:00
parent 9b6376af68
commit 6d77604667
19 changed files with 139 additions and 145 deletions

View File

@@ -49,7 +49,7 @@ void CPackage::Cook()
CPackageDependencyListBuilder Builder(this);
std::list<CAssetID> AssetList;
Builder.BuildDependencyList(true, AssetList);
Log::Write(TString::FromInt32(AssetList.size(), 0, 10) + " assets in pak");
Log::Write(TString::FromInt32(AssetList.size(), 0, 10) + " assets in " + Name() + ".pak");
// Get named resources
std::list<const SNamedResource*> NamedResources;
@@ -207,6 +207,9 @@ void CPackage::Cook()
mNeedsRecook = false;
Save();
Log::Write("Finished writing " + PakPath.ToUTF8());
// Update resource store in case we recooked any assets
mpProject->ResourceStore()->ConditionalSaveStore();
}
void CPackage::CompareOriginalAssetList(const std::list<CAssetID>& rkNewList)

View File

@@ -214,6 +214,8 @@ bool CResourceEntry::Save(bool SkipCacheSave /*= false*/)
}
// Resource has been saved; now make sure dependencies, cache data, and packages are all up to date
mFlags |= eREF_HasBeenModified;
UpdateDependencies();
mpStore->SetCacheDataDirty();
@@ -257,7 +259,11 @@ bool CResourceEntry::Cook()
bool Success = CResourceCooker::CookResource(this, File);
if (Success)
mFlags.ClearFlag(eREF_NeedsRecook);
{
mFlags &= ~eREF_NeedsRecook;
mFlags |= eREF_HasBeenModified;
mpStore->SetCacheDataDirty();
}
return Success;
}
@@ -281,6 +287,7 @@ CResource* CResourceEntry::Load()
CXMLReader Reader(RawAssetPath());
mpResource->Serialize(Reader);
mpStore->TrackLoadedResource(this);
gpResourceStore = pOldStore;
}

View File

@@ -19,8 +19,9 @@ enum EResEntryFlag
eREF_Transient = 0x00000002, // Resource is transient (not part of a game project resource DB)
eREF_Hidden = 0x00000004, // Resource is hidden, doesn't show up in resource browser
eREF_HasBeenModified = 0x00000008, // Resource has been modified and resaved by the user
eREF_IsUserResource = 0x00000010, // Resource was created by the user (i.e. isn't a Retro Studios asset)
// Flags that save to the cache file
eREF_SavedFlags = eREF_NeedsRecook | eREF_Hidden | eREF_HasBeenModified
eREF_SavedFlags = eREF_NeedsRecook | eREF_Hidden | eREF_HasBeenModified | eREF_IsUserResource
};
DECLARE_FLAGS(EResEntryFlag, FResEntryFlags)

View File

@@ -14,6 +14,7 @@ using namespace tinyxml2;
CResourceStore *gpResourceStore = nullptr;
CResourceStore *gpEditorStore = nullptr;
// Constructor for editor store
CResourceStore::CResourceStore(const TWideString& rkDatabasePath)
: mpProj(nullptr)
, mGame(eUnknownGame)
@@ -26,6 +27,7 @@ CResourceStore::CResourceStore(const TWideString& rkDatabasePath)
mDatabaseName = rkDatabasePath.GetFileName();
}
// Constructor for game exporter
CResourceStore::CResourceStore(CGameProject *pProject, CGameExporter *pExporter, const TWideString& rkRawDir, const TWideString& rkCookedDir, EGame Game)
: mpProj(nullptr)
, mGame(Game)
@@ -38,6 +40,7 @@ CResourceStore::CResourceStore(CGameProject *pProject, CGameExporter *pExporter,
SetProject(pProject);
}
// Main constructor for game projects
CResourceStore::CResourceStore(CGameProject *pProject)
: mpProj(nullptr)
, mGame(eUnknownGame)