[Bf-blender-cvs] [add1da52ad7] master: Fix T97362: forward slashes in USD texture paths

Michael Kowalski noreply at git.blender.org
Fri Jun 10 21:10:52 CEST 2022


Commit: add1da52ad783e33e8abb0a790ddc97dd89dab92
Author: Michael Kowalski
Date:   Fri Jun 10 15:07:45 2022 -0400
Branches: master
https://developer.blender.org/rBadd1da52ad783e33e8abb0a790ddc97dd89dab92

Fix T97362: forward slashes in USD texture paths

Ensuring that relative paths to textures in exported USDs use
forward slash separators, for cross-platform compatibility.

===================================================================

M	source/blender/io/usd/intern/usd_writer_material.cc

===================================================================

diff --git a/source/blender/io/usd/intern/usd_writer_material.cc b/source/blender/io/usd/intern/usd_writer_material.cc
index 857896b9330..6862f3835cf 100644
--- a/source/blender/io/usd/intern/usd_writer_material.cc
+++ b/source/blender/io/usd/intern/usd_writer_material.cc
@@ -590,6 +590,7 @@ static std::string get_tex_image_asset_path(bNode *node,
       BLI_split_dir_part(stage_path.c_str(), dir_path, FILE_MAX);
       BLI_path_join(exp_path, FILE_MAX, dir_path, "textures", file_path, nullptr);
     }
+    BLI_str_replace_char(exp_path, '\\', '/');
     return exp_path;
   }
 
@@ -608,7 +609,7 @@ static std::string get_tex_image_asset_path(bNode *node,
     if (!BLI_path_is_rel(rel_path)) {
       return path;
     }
-
+    BLI_str_replace_char(rel_path, '\\', '/');
     return rel_path + 2;
   }



More information about the Bf-blender-cvs mailing list