Skip to content

Commit

Permalink
fix get path
Browse files Browse the repository at this point in the history
  • Loading branch information
deakcor committed Oct 15, 2021
1 parent 12630fc commit 0b9fc0e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion obj-parse/ObjParse.gd
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ static func get_data(path:String)->String:
var err:=file.open(path, File.READ)
if err==OK:
var res:=file.get_as_text()
file.close()
return res
return ""

Expand All @@ -208,7 +209,7 @@ static func get_mtl_tex(mtl_path:String)->Dictionary:
return {}
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().rsplit(".",false,1)[1]+".mtl")
mtl_path=obj_path.get_base_dir().plus_file(obj_path.get_file().rsplit(".",false,1)[0]+".mtl")
var dir:Directory=Directory.new()
if !dir.file_exists(mtl_path):
mtl_path=obj_path.get_base_dir().plus_file(obj_path.get_file()+".mtl")
Expand Down

0 comments on commit 0b9fc0e

Please sign in to comment.