Rythe-Engine icon indicating copy to clipboard operation
Rythe-Engine copied to clipboard

OBJ material importer fails to properly join paths

Open LeonBrands opened this issue 3 years ago • 3 comments

Describe the bug The OBJ loader fails to load textures that are stored in relative paths to the obj file. If such a path occurs, it simply adds the model's path to the path.

For example:

  • Model path: "assets:\some_folder\model.obj"
  • Texture described in mtl file: "..\texture_folder\texture.png"
  • Resulting texture path: "assets:\some_folder..\texture_folder\texture.png"

Include a MRE Load any model where the mtl uses a relative texture path with ../

Expected behavior The relative filepath should be resolved appropriately by checking for .. before combining the paths

Desktop (please complete the following information):

  • OS: Windows 10

LeonBrands avatar Aug 09 '21 09:08 LeonBrands

looking at the source code for mesh_importers.cpp I suspect that the lines 411, 415, 419 and others alike should use strpath_manip::subdir instead of + @GlynLeine ?

Algo-ryth-mix avatar Aug 09 '21 17:08 Algo-ryth-mix

this also warants the question if strpath_manip might need a public interface and should be moved out of the detail namespace, seeing as it is quite usefull for most applications

Algo-ryth-mix avatar Aug 09 '21 17:08 Algo-ryth-mix

this also warants the question if strpath_manip might need a public interface and should be moved out of the detail namespace, seeing as it is quite usefull for most applications

probably yeah, i can't do anything about it untill beginning september tho. until then I'll be without laptop and most times without internet as well.

GlynLeine avatar Aug 09 '21 23:08 GlynLeine