mirror of
https://github.com/MapMakersAndProgrammers/io_scene_a3d.git
synced 2025-10-26 01:49:13 -07:00
Correct parent behaviour for both import and export on version 2 models
This commit is contained in:
@@ -79,11 +79,11 @@ class A3DBlenderExporter:
|
|||||||
transformParentIDs = []
|
transformParentIDs = []
|
||||||
for ob in self.objects:
|
for ob in self.objects:
|
||||||
parentOB = ob.parent
|
parentOB = ob.parent
|
||||||
if (parentOB == None) or (ob.name not in transforms):
|
if (parentOB == None) or (parentOB.name not in transforms):
|
||||||
transformParentIDs.append(0) #XXX: this is only for version 2
|
transformParentIDs.append(0) #XXX: this is only for version 2
|
||||||
else:
|
else:
|
||||||
parentIndex = list(transforms.keys()).index(ob.name)
|
parentIndex = list(transforms.keys()).index(parentOB.name)
|
||||||
transformParentIDs.append(parentIndex)
|
transformParentIDs.append(parentIndex+1)
|
||||||
|
|
||||||
self.modelData.materials = materials.values()
|
self.modelData.materials = materials.values()
|
||||||
self.modelData.meshes = meshes
|
self.modelData.meshes = meshes
|
||||||
|
|||||||
@@ -71,11 +71,11 @@ class A3DBlenderImporter:
|
|||||||
for obI, ob in enumerate(objects):
|
for obI, ob in enumerate(objects):
|
||||||
# Assign parents
|
# Assign parents
|
||||||
parentID = self.modelData.transformParentIDs[obI]
|
parentID = self.modelData.transformParentIDs[obI]
|
||||||
if parentID == 0 and self.modelData.version < 3:
|
if self.modelData.version < 3:
|
||||||
# version 2 models use 0 to signify empty parent
|
# version 2 models use 0 to signify empty parent
|
||||||
continue
|
parentID -= 1
|
||||||
elif parentID == -1:
|
if parentID == -1:
|
||||||
# version 3 models use -1 to signify empty parent
|
# empty parent
|
||||||
continue
|
continue
|
||||||
parentOB = objects[parentID]
|
parentOB = objects[parentID]
|
||||||
ob.parent = parentOB
|
ob.parent = parentOB
|
||||||
|
|||||||
Reference in New Issue
Block a user