Moving some assets around

This commit is contained in:
2023-06-20 10:54:15 -07:00
parent 0b3bae6e6c
commit e2e4732938
14 changed files with 76 additions and 63 deletions

View File

@ -10,6 +10,7 @@ using namespace Dawn;
void SceneAssetGenerator::generate(
std::map<std::string, std::string> &assetMap,
int32_t &assetNumber,
std::vector<std::string> *publicProperties,
std::vector<std::string> *initBody,
std::vector<std::string> *assetsBody,
struct SceneAsset *asset,
@ -17,6 +18,7 @@ void SceneAssetGenerator::generate(
) {
std::string assetType = "";
bool_t componentInit = true;
if(asset->ref.empty()) {
asset->usageName = "asset" + std::to_string(assetNumber++);
} else {
@ -40,6 +42,12 @@ void SceneAssetGenerator::generate(
assertUnreachable();
}
line(initBody, "auto " + asset->usageName + " = man->get<" + assetType + ">(\"" + asset->fileName + "\");", "");
if(!asset->ref.empty()) {
line(publicProperties, assetType + " *" + asset->usageName + " = nullptr;", "");
line(initBody, asset->usageName + " = man->get<" + assetType + ">(\"" + asset->fileName + "\");", "");
} else {
line(initBody, "auto " + asset->usageName + " = man->get<" + assetType + ">(\"" + asset->fileName + "\");", "");
}
line(assetsBody, "assets.push_back(man->get<" + assetType + ">(\"" + asset->fileName + "\"));", "");
}

View File

@ -13,6 +13,7 @@ namespace Dawn {
static void generate(
std::map<std::string, std::string> &assetMap,
int32_t &assetNumber,
std::vector<std::string> *publicProperties,
std::vector<std::string> *initBody,
std::vector<std::string> *assetsBody,
struct SceneAsset *asset,

View File

@ -149,6 +149,7 @@ void SceneItemGenerator::generate(
SceneAssetGenerator::generate(
assetMap,
assetNumber,
publicProperties,
initBody,
assetBody,
&(*itAssets),