-> FLT importer hierarchy transform bugs

Several transform bugs in the flt importer have been fixed. This included
parent/child relationships and matrices not importing correctly along with
some problems with the import scale option.
This commit is contained in:
Geoffrey Bantle 2008-03-18 23:16:47 +00:00
parent 34c4ac219c
commit 7015700e99

@ -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)