-> Path handling fix for External references in FLT import
authorGeoffrey Bantle <hairbat@yahoo.com>
Wed, 19 Mar 2008 19:23:42 +0000 (19:23 +0000)
committerGeoffrey Bantle <hairbat@yahoo.com>
Wed, 19 Mar 2008 19:23:42 +0000 (19:23 +0000)
FLT importer had problems with external references that used
relative paths. Fixed.

release/scripts/flt_import.py

index 5b1909658b1a6cb6c2d6539fc6c767faf19f7750..1df7c937842b2b05158983b98266039b6ecc9e12 100644 (file)
@@ -1328,11 +1328,17 @@ class XRef(InterNode):
                self.props['comment'] = ''
                self.parse_record()
 
                self.props['comment'] = ''
                self.parse_record()
 
-               xref_filename = self.props['3t200!filename']
+               xref_filename = self.props['3t200!filename'] #I dont even think there is a reason to keep this around...
+               
+               if not os.path.isabs(xref_filename):
+                       absname = os.path.join(os.path.dirname(self.header.filename), xref_filename) 
+               else:
+                       absname = xref_filename 
+               
                self.props['id'] = 'X: ' + Blender.sys.splitext(Blender.sys.basename(xref_filename))[0] #this is really wrong as well....
                
                self.props['id'] = 'X: ' + Blender.sys.splitext(Blender.sys.basename(xref_filename))[0] #this is really wrong as well....
                
-               if global_prefs['doxrefs'] and os.path.exists(xref_filename) and not self.header.grr.xrefs.has_key(xref_filename):
-                       self.xref = Database(xref_filename, self.header.grr, self)
+               if global_prefs['doxrefs'] and os.path.exists(absname) and not self.header.grr.xrefs.has_key(xref_filename):
+                       self.xref = Database(absname, self.header.grr, self)
                        self.header.grr.xrefs[xref_filename] = self.xref
                else:
                        self.xref = None
                        self.header.grr.xrefs[xref_filename] = self.xref
                else:
                        self.xref = None
@@ -1853,6 +1859,9 @@ class Database(InterNode):
                        print 'Parsing:', filename
                        print
                
                        print 'Parsing:', filename
                        print
                
+               #check to see if filename is a relative path
+               #filename = os.path.abspath(filename)
+               
                self.fw = flt_filewalker.FltIn(filename)
                self.filename = filename
                self.bname = os.path.splitext(os.path.basename(filename))[0]
                self.fw = flt_filewalker.FltIn(filename)
                self.filename = filename
                self.bname = os.path.splitext(os.path.basename(filename))[0]