Fix for converted texture output folder creation and empty filepath
This commit is contained in:
parent
661c99c9cb
commit
b89d4cd0e0
|
@ -180,7 +180,6 @@ std::shared_ptr<TextureData> TextureBuilder::simple(int rawTexIndex, const std::
|
|||
const RawTexture& rawTexture = raw.GetTexture(rawTexIndex);
|
||||
const std::string textureName = FileUtils::GetFileBase(rawTexture.name);
|
||||
const std::string relativeFilename = FileUtils::GetFileName(rawTexture.fileLocation);
|
||||
|
||||
ImageData* image = nullptr;
|
||||
if (options.outputBinary) {
|
||||
auto bufferView = gltf.AddBufferViewForFile(*gltf.defaultBuffer, rawTexture.fileLocation);
|
||||
|
|
|
@ -26,7 +26,13 @@ class TextureBuilder {
|
|||
const GltfOptions& options,
|
||||
const std::string& outputFolder,
|
||||
GltfModel& gltf)
|
||||
: raw(raw), options(options), outputFolder(outputFolder), gltf(gltf) {}
|
||||
: raw(raw), options(options), outputFolder(outputFolder), gltf(gltf) {
|
||||
if (!outputFolder.empty()) {
|
||||
if (outputFolder[outputFolder.size() - 1] == '/') {
|
||||
this->outputFolder = outputFolder.substr(0, outputFolder.size() - 1) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
~TextureBuilder() {}
|
||||
|
||||
std::shared_ptr<TextureData> combine(
|
||||
|
@ -70,7 +76,7 @@ class TextureBuilder {
|
|||
private:
|
||||
const RawModel& raw;
|
||||
const GltfOptions& options;
|
||||
const std::string outputFolder;
|
||||
std::string outputFolder;
|
||||
GltfModel& gltf;
|
||||
|
||||
std::map<std::string, std::shared_ptr<TextureData>> textureByIndicesKey;
|
||||
|
|
|
@ -50,8 +50,8 @@ inline bool FolderExists(const std::string& folderPath) {
|
|||
}
|
||||
|
||||
inline std::string getFolder(const std::string& path) {
|
||||
auto parent = boost::filesystem::path(path).parent_path().string();
|
||||
return parent == "" ? "." : parent;
|
||||
auto parent = boost::filesystem::path(path).parent_path().string();
|
||||
return parent == "" ? "." : parent;
|
||||
}
|
||||
|
||||
inline std::string GetFileName(const std::string& path) {
|
||||
|
@ -70,4 +70,8 @@ inline boost::optional<std::string> GetFileSuffix(const std::string& path) {
|
|||
return extension.string().substr(1);
|
||||
}
|
||||
|
||||
inline bool MakeDir(const std::string& path) {
|
||||
return boost::filesystem::create_directories(boost::filesystem::path(path));
|
||||
}
|
||||
|
||||
} // namespace FileUtils
|
||||
|
|
Loading…
Reference in New Issue