fix: objects parenting error

This commit is contained in:
Swann 2021-01-26 15:40:00 +01:00
parent 790f145022
commit 2983195af4
No known key found for this signature in database
GPG Key ID: E1D3641A7C43AACB

View File

@ -235,6 +235,9 @@ class BlObject(BlDatablock):
and 'cycles_visibility' in data: and 'cycles_visibility' in data:
loader.load(target.cycles_visibility, data['cycles_visibility']) loader.load(target.cycles_visibility, data['cycles_visibility'])
if 'parent' in data:
target.parent = bpy.data.objects[data['parent']]
def _dump_implementation(self, data, instance=None): def _dump_implementation(self, data, instance=None):
assert(instance) assert(instance)
@ -251,7 +254,6 @@ class BlObject(BlDatablock):
"rotation_mode", "rotation_mode",
"parent", "parent",
"data", "data",
"children",
"library", "library",
"empty_display_type", "empty_display_type",
"empty_display_size", "empty_display_size",
@ -370,13 +372,6 @@ class BlObject(BlDatablock):
bone_groups[group.name] = dumper.dump(group) bone_groups[group.name] = dumper.dump(group)
data['pose']['bone_groups'] = bone_groups data['pose']['bone_groups'] = bone_groups
# CHILDS
if len(instance.children) > 0:
childs = []
for child in instance.children:
childs.append(child.name)
data["children"] = childs
# VERTEx GROUP # VERTEx GROUP
if len(instance.vertex_groups) > 0: if len(instance.vertex_groups) > 0:
@ -459,8 +454,8 @@ class BlObject(BlDatablock):
# Avoid Empty case # Avoid Empty case
if self.instance.data: if self.instance.data:
deps.append(self.instance.data) deps.append(self.instance.data)
if len(self.instance.children) > 0: if self.instance.parent :
deps.extend(list(self.instance.children)) deps.append(self.instance.parent)
if self.is_library: if self.is_library:
deps.append(self.instance.library) deps.append(self.instance.library)