mirror of
https://github.com/godotengine/FBX2glTF.git
synced 2026-01-06 02:09:48 +03:00
Sync conan versions and Texturebuilder work.
This commit is contained in:
@@ -202,27 +202,24 @@ std::shared_ptr<TextureData> TextureBuilder::simple(int rawTexIndex, const std::
|
||||
image = new ImageData(relativeFilename, *bufferView, mimeType);
|
||||
}
|
||||
|
||||
} else if (!relativeFilename.empty()) {
|
||||
} else if (!relativeFilename.empty()) {
|
||||
std::string outputPath = outputFolder + "/" + relativeFilename;
|
||||
auto dstAbs = FileUtils::GetAbsolutePath(outputPath);
|
||||
image = new ImageData(relativeFilename, relativeFilename);
|
||||
auto srcAbs = FileUtils::GetAbsolutePath(rawTexture.fileLocation);
|
||||
if (!FileUtils::FileExists(outputPath) && srcAbs != dstAbs) {
|
||||
if (FileUtils::CopyFile(rawTexture.fileLocation, outputPath, true)) {
|
||||
if (verboseOutput) {
|
||||
fmt::printf("Copied texture '%s' to output folder: %s\n", textureName, outputPath);
|
||||
}
|
||||
} else {
|
||||
// no point commenting further on read/write error; CopyFile() does enough of that, and we
|
||||
// certainly want to to add an image struct to the glTF JSON, with the correct relative
|
||||
// path reference, even if the copy failed.
|
||||
}
|
||||
if (FileUtils::FileExists(outputPath) || srcAbs == dstAbs)) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
if (!FileUtils::CopyFile(rawTexture.fileLocation, outputPath, true)) {
|
||||
return nullptr;
|
||||
}
|
||||
if (verboseOutput) {
|
||||
fmt::printf("Copied texture '%s' to output folder: %s\n", textureName, outputPath);
|
||||
}
|
||||
}
|
||||
if (!image) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<TextureData> texDat = gltf.textures.hold(
|
||||
new TextureData(textureName, *gltf.defaultSampler, *gltf.images.hold(image)));
|
||||
textureByIndicesKey.insert(std::make_pair(key, texDat));
|
||||
|
||||
Reference in New Issue
Block a user