-> FLT importer hierarchy transform bugs
[blender.git] / release / scripts / flt_import.py
index 3ba118c0d184149dfd2b70198e7f53f61c1b3f37..5b1909658b1a6cb6c2d6539fc6c767faf19f7750 100644 (file)
@@ -6,6 +6,8 @@ Group: 'Import'
 Tip: 'Import OpenFlight (.flt)'
 """
 
+
+
 __author__ = "Greg MacDonald, Campbell Barton, Geoffrey Bantle"
 __version__ = "2.0 11/21/07"
 __url__ = ("blender", "elysiun", "Author's homepage, http://sourceforge.net/projects/blight/")
@@ -952,8 +954,12 @@ class InterNode(Node):
                        except: #horrible...
                                pass
                
+
                if self.parent and self.parent.object and (self.header.scene == self.parent.header.scene):
-                               self.parent.object.makeParent([self.object])
+                               self.parent.object.makeParent([self.object],1)
+
+               if self.matrix:
+                       self.object.setMatrix(self.matrix)
 
                if self.vis == False:
                        self.object.restrictDisplay = True
@@ -979,8 +985,6 @@ class InterNode(Node):
                                        min= LODmin(min,lodlist[i])
                                min.vis = True
                                
-               if self.matrix:
-                       self.object.setMatrix(self.matrix)
                        
                Node.blender_import(self) # Attach faces to self.faceLs
                
@@ -1348,8 +1352,15 @@ class XRef(InterNode):
                except:
                        pass
                        
+
+
+
                if self.parent and self.parent.object:
-                       self.parent.object.makeParent([self.object])
+                       self.parent.object.makeParent([self.object],1)
+
+               if self.matrix:
+                       self.object.setMatrix(self.matrix)
+
 
                #id props import
                self.object.properties['FLT'] = dict()
@@ -1361,8 +1372,7 @@ class XRef(InterNode):
 
                self.object.Layer = current_layer
                self.object.sel = 1
-               if self.matrix:
-                       self.object.setMatrix(self.matrix)
+
                Node.blender_import(self)
                
                
@@ -1902,7 +1912,7 @@ def fixscale(root,childhash):
        for child in childhash[root]:
                fixscale(child,childhash)
        location = Blender.Mathutils.Vector(root.getLocation('worldspace'))
-       if location[0] != 0.0 and location[1] != 0.0 and location[2] != 0.0:
+       if location[0] != 0.0 or location[1] != 0.0 or location[2] != 0.0:
                #direction = Blender.Mathutils.Vector(0-location[0],0-location[1],0-location[2]) #reverse vector
                smat = Blender.Mathutils.ScaleMatrix(global_prefs['scale'],4)
                root.setLocation(location * smat)