diff --git a/gzbridge/ConfigLoader.cc b/gzbridge/ConfigLoader.cc index ff438033..d548a128 100644 --- a/gzbridge/ConfigLoader.cc +++ b/gzbridge/ConfigLoader.cc @@ -252,7 +252,12 @@ void ConfigLoader::_parseNodes(std::ifstream &stream, ConfigNode *parent) } else { - key = newNode->getName() + ' ' + newNode->getValues().front(); + key = newNode->getName(); + for (auto value : newNode->getValues()) + { + key += ' ' + value; + } + key.erase(std::remove(key.begin(), key.end(), '"'), key.end()); } m_scriptList.insert(ScriptItem(key, newNode)); diff --git a/gzbridge/OgreMaterialParser.cc b/gzbridge/OgreMaterialParser.cc index 8b0c54a7..f9187447 100644 --- a/gzbridge/OgreMaterialParser.cc +++ b/gzbridge/OgreMaterialParser.cc @@ -1,3 +1,4 @@ +#include #include #include @@ -50,7 +51,7 @@ std::string OgreMaterialParser::GetMaterialAsJson() const else first = false; - std::size_t index = name.rfind(" "); + std::size_t index = name.find(" "); if (index != std::string::npos) { name = name.substr(index+1); @@ -150,7 +151,17 @@ std::string OgreMaterialParser::GetMaterialAsJson() const ConfigNode *textureNode = textureUnitNode->findChild("texture"); if (textureNode) { - std::string textureStr = textureNode->getValue(0); + std::string textureStr; + for (auto i = 0u; i < textureNode->getValues().size(); ++i) + { + textureStr += textureNode->getValue(i); + if (i + 1 != textureNode->getValues().size()) + textureStr += " "; + } + + textureStr.erase(std::remove(textureStr.begin(), + textureStr.end(), '"'), textureStr.end()); + index = textureStr.rfind("."); if (index != std::string::npos) { diff --git a/gzbridge/server.js b/gzbridge/server.js index 29523063..a1d721be 100755 --- a/gzbridge/server.js +++ b/gzbridge/server.js @@ -53,10 +53,11 @@ let staticServe = function(req, res) { if (req.url === '/') req.url = '/index.html'; - fileLoc = path.join(fileLoc, req.url); + fileLoc = unescape(path.join(fileLoc, req.url)); fs.readFile(fileLoc, function(err, data) { if (err) { + console.error('File not found [', fileLoc, ']'); res.writeHead(404, 'Not Found'); res.write('404: File Not Found!'); return res.end(); diff --git a/webify_models_v2.py b/webify_models_v2.py index 572c0bfc..b23a9444 100755 --- a/webify_models_v2.py +++ b/webify_models_v2.py @@ -20,10 +20,8 @@ path = sys.argv[1] -files = os.listdir(path) - find_cmd = ['find', path, '-name','*'] -files = subprocess.check_output(find_cmd).split() +files = subprocess.check_output(find_cmd).split('\n') for file in files: try: @@ -66,6 +64,11 @@ print sed_cmd subprocess.check_call(sed_cmd) + # Decode whitespace + sed_cmd = ["sed", "-i", "-e", 's/%20/ /g', file] + print sed_cmd + subprocess.check_call(sed_cmd) + # find relatvie path to texture dir texture_dir = path if (texture_dir.find('materials/textures') == -1 and @@ -83,7 +86,7 @@ subprocess.check_call(sed_cmd) sed_cmd = ["sed", "-i","-e", - '/[a-zA-Z0-9_\.\/\-]\+materials\/textures/!s/\([a-zA-Z0-9_\-]\+\)\(\.png\W\)/'+ relative_path + 'materials\/textures\/\\1\\2/g', file] + '/[a-zA-Z0-9_\.\/\-]\+materials\/textures/!s/\([a-zA-Z0-9_ \-]\+\)\(\.png\W\)/'+ relative_path + 'materials\/textures\/\\1\\2/g', file] print sed_cmd subprocess.check_call(sed_cmd)