mirror of
https://github.com/overte-org/overte.git
synced 2025-04-08 11:54:20 +02:00
add helper to deduce texture relative URL after download
This commit is contained in:
parent
e75f17a7f9
commit
1a17da6ecc
2 changed files with 15 additions and 0 deletions
|
@ -186,6 +186,19 @@ bool FBXBaker::importScene() {
|
|||
static const QString BAKED_TEXTURE_DIRECTORY = "textures/";
|
||||
static const QString BAKED_TEXTURE_EXT = ".ktx";
|
||||
|
||||
QString texturePathRelativeToFBX(QUrl fbxURL, QUrl textureURL) {
|
||||
auto fbxPath = fbxURL.toString(QUrl::RemoveFilename | QUrl::RemoveQuery | QUrl::RemoveFragment);
|
||||
auto texturePath = textureURL.toString(QUrl::RemoveFilename | QUrl::RemoveQuery | QUrl::RemoveFragment);
|
||||
|
||||
if (texturePath.startsWith(fbxPath)) {
|
||||
// texture path is a child of the FBX path, return the texture path without the fbx path
|
||||
return texturePath.mid(fbxPath.length());
|
||||
} else {
|
||||
// the texture path was not a child of the FBX path, return the empty string
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
bool FBXBaker::rewriteAndBakeSceneTextures() {
|
||||
// get a count of the textures used in the scene
|
||||
int numTextures = _scene->GetTextureCount();
|
||||
|
|
|
@ -66,6 +66,8 @@ void TextureBaker::handleTextureNetworkReply() {
|
|||
|
||||
if (requestReply->error() == QNetworkReply::NoError) {
|
||||
qCDebug(model_baking) << "Downloaded texture at" << _textureURL;
|
||||
|
||||
// store the original texture so it can be passed along for the bake
|
||||
_originalTexture = requestReply->readAll();
|
||||
} else {
|
||||
qCDebug(model_baking) << "Error downloading texture" << requestReply->errorString();
|
||||
|
|
Loading…
Reference in a new issue