Started fixing texture tool (incomplete)
This commit is contained in:
@@ -32,6 +32,7 @@ target_include_directories(prefabtool
|
||||
# Definitions
|
||||
target_compile_definitions(prefabtool
|
||||
PUBLIC
|
||||
${DAWN_SHARED_DEFINITIONS}
|
||||
DAWN_TOOL_INSTANCE=PrefabTool
|
||||
DAWN_TOOL_HEADER="PrefabTool.hpp"
|
||||
)
|
||||
|
@@ -34,17 +34,19 @@ void PrefabGen::generate(
|
||||
|
||||
// Process assets
|
||||
int32_t assetNumber = 0;
|
||||
std::map<std::string, std::string> assetMap;
|
||||
auto processAsset = [&](struct PrefabAsset a) {
|
||||
std::string assetType = "";
|
||||
a.usageName = "asset" + std::to_string(assetNumber++);
|
||||
switch(a.type) {
|
||||
case PREFAB_ASSET_TYPE_TEXTURE:
|
||||
assetType = "TextureAsset";
|
||||
assetMap[a.fileName] = "&" + a.usageName + "->texture";
|
||||
break;
|
||||
|
||||
default:
|
||||
assertUnreachable();
|
||||
}
|
||||
a.usageName = "asset" + std::to_string(assetNumber++);
|
||||
line(&methodInit.body, "auto " + a.usageName + " = man->get<" + assetType + ">(\"" + a.fileName + "\");", "");
|
||||
line(&methodAssets.body, "assets.push_back(man->get<" + assetType + ">(\"" + a.fileName + "\"));", "");
|
||||
};
|
||||
@@ -77,7 +79,11 @@ void PrefabGen::generate(
|
||||
// Now set each property
|
||||
auto itValues = c.values.begin();
|
||||
while(itValues != c.values.end()) {
|
||||
line(&methodInit.body, componentName + "->" + itValues->first + " = " + itValues->second + ";", "");
|
||||
auto value = itValues->second;
|
||||
if(assetMap.find(value) != assetMap.end()) {
|
||||
value = assetMap[value];
|
||||
}
|
||||
line(&methodInit.body, componentName + "->" + itValues->first + " = " + value + ";", "");
|
||||
++itValues;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user