Skip to content

Commit

Permalink
Fix mtl search
Browse files Browse the repository at this point in the history
  • Loading branch information
deakcor committed Oct 12, 2021
1 parent d6fb7f1 commit 2439cd6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion obj-parse/ObjParse.gd
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,10 @@ static func get_mtl_tex(mtl_path:String)->Dictionary:

static func parse_obj(obj_path:String, mtl_path:String="")->Mesh:
if mtl_path=="":
mtl_path=obj_path.get_base_dir().plus_file(obj_path.get_file().split(".")[0]+".mtl")
mtl_path=obj_path.get_base_dir().plus_file(obj_path.get_file().rsplit(".",false,1)[1]+".mtl")
var file:File=File.new()
if !file.file_exists(mtl_path):
mtl_path=obj_path.get_base_dir().plus_file(obj_path.get_file()+".mtl")
var obj := get_data(obj_path)
var mats := _create_mtl(get_data(mtl_path),get_mtl_tex(mtl_path))
return _create_obj(obj,mats) if obj and mats else null

0 comments on commit 2439cd6

Please sign in to comment.