refactor: cleanup lattice

This commit is contained in:
Swann
2020-04-01 10:23:28 +02:00
parent 31feb2439d
commit fef088e39b

View File

@ -19,9 +19,11 @@
import bpy
import mathutils
from .. import utils
from ..libs.dump_anything import Dumper, Loader, np_dump_collection, np_load_collection
from .bl_datablock import BlDatablock
POINT = ['co', 'weight_softbody', 'co_deform']
class BlLattice(BlDatablock):
bl_id = "lattices"
@ -32,18 +34,19 @@ class BlLattice(BlDatablock):
bl_icon = 'LATTICE_DATA'
def _load_implementation(self, data, target):
utils.dump_anything.load(target, data)
loader = Loader()
loader.load(target, data)
np_load_collection(data['points'], target.points, POINT)
for point in data['points']:
utils.dump_anything.load(target.points[point], data["points"][point])
def _construct(self, data):
return bpy.data.lattices.new(data["name"])
def _dump_implementation(self, data, pointer=None):
assert(pointer)
dumper = utils.dump_anything.Dumper()
dumper.depth = 3
dumper = Dumper()
dumper.depth = 1
dumper.include_filter = [
"name",
'type',
@ -53,17 +56,10 @@ class BlLattice(BlDatablock):
'interpolation_type_u',
'interpolation_type_v',
'interpolation_type_w',
'use_outside',
'points',
'co',
'weight_softbody',
'co_deform'
'use_outside'
]
data = dumper.dump(pointer)
data['points'] = np_dump_collection(pointer.points, POINT)
return data