Skip to content

Commit

Permalink
if mtl not specified, try to get from obj's mtllib
Browse files Browse the repository at this point in the history
  • Loading branch information
Spyduck committed Feb 8, 2018
1 parent 57620ed commit e88b78f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions vr_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,17 @@ def load(self):

if self.src is not None:
self.src = self.retrieve(self.src)
if self.mtl is None:
with open(self.src,'r') as f:
contents = f.read()
mtllibs = re.findall(r"mtllib (.*?)", mtlfile.read())
for mtllib in mtllibs:
try:
self.mtl = abs_source( abs_source(self.basepath, self.tag["src"]), mtllib[0])
except Exception as e:
print(e)
self.mtl = None
print(self.mtl)
if self.mtl is not None:
#mtlpath = os.path.dirname(self.mtl)
mtlpath = os.path.dirname(self.abs_source(self.basepath,self.mtl))
Expand Down

0 comments on commit e88b78f

Please sign in to comment.