refactor: armature load

This commit is contained in:
Swann
2019-09-16 23:30:44 +02:00
parent 89c2328d97
commit b86f987e3e
2 changed files with 4 additions and 7 deletions

View File

@ -13,7 +13,6 @@ class BlArmature(BlDatablock):
return bpy.data.armatures.new(data["name"]) return bpy.data.armatures.new(data["name"])
def load(self, data, target): def load(self, data, target):
# Load parent object # Load parent object
if data['user'] not in bpy.data.objects.keys(): if data['user'] not in bpy.data.objects.keys():
parent_object = bpy.data.objects.new(data['user'], self.pointer) parent_object = bpy.data.objects.new(data['user'], self.pointer)
@ -46,8 +45,6 @@ class BlArmature(BlDatablock):
# override['region'] = region # override['region'] = region
# override['screen'] = bpy.data.window_managers[0].windows[0].screen # override['screen'] = bpy.data.window_managers[0].windows[0].screen
import time
time.sleep(0.1)
bpy.ops.object.mode_set(mode='EDIT') bpy.ops.object.mode_set(mode='EDIT')
for bone in data['bones']: for bone in data['bones']:
if bone not in self.pointer.edit_bones: if bone not in self.pointer.edit_bones:
@ -63,7 +60,7 @@ class BlArmature(BlDatablock):
if 'parent' in data['bones'][bone]: if 'parent' in data['bones'][bone]:
new_bone.parent = self.pointer.edit_bones[data['bones'][bone]['parent']['name']] new_bone.parent = self.pointer.edit_bones[data['bones'][bone]['parent']['name']]
new_bone.use_connect = data['bones'][bone]['use_connect'] new_bone.use_connect = data['bones'][bone]['use_connect']
bpy.ops.object.mode_set(mode='OBJECT')
# bpy_.mode = 'EDIT_ARMATURE' # bpy_.mode = 'EDIT_ARMATURE'