feat: progress on unsupported types

#21
This commit is contained in:
Swann Martinez 2019-11-04 17:55:41 +01:00
parent 345a5d55e7
commit cfadc91299
No known key found for this signature in database
GPG Key ID: 414CCAFD8DA720E1
6 changed files with 172 additions and 1 deletions

View File

@ -14,7 +14,10 @@ __all__ = [
'bl_armature',
'bl_action',
'bl_world',
'bl_metaball'
'bl_metaball',
'bl_lattice',
'bl_lightprobe',
'bl_speaker'
] # Order here defines execution order
from . import *

View File

@ -43,6 +43,13 @@ class BlCurve(BlDatablock):
spline_data['bezier_points'] = dumper.dump(spline.bezier_points)
spline_data['type'] = dumper.dump(spline.type)
data['splines'][index] = spline_data
if isinstance(pointer,'TextCurve'):
data['type'] = 'TEXT'
if isinstance(pointer,'SurfaceCurve'):
data['type'] = 'SURFACE'
if isinstance(pointer,'TextCurve'):
data['type'] = 'CURVE'
return data
def resolve(self):

View File

@ -0,0 +1,54 @@
import bpy
import mathutils
from .. import utils
from .bl_datablock import BlDatablock
class BlLattice(BlDatablock):
def load(self, data, target):
utils.dump_anything.load(target, data)
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(self, pointer=None):
assert(pointer)
dumper = utils.dump_anything.Dumper()
dumper.depth = 3
dumper.include_filter = [
"name",
'type',
'points_u',
'points_v',
'points_w',
'interpolation_type_u',
'interpolation_type_v',
'interpolation_type_w',
'use_outside',
'points',
'co',
'weight_softbody',
'co_deform'
]
data = dumper.dump(pointer)
return data
def resolve(self):
self.pointer = utils.find_from_attr('uuid', self.uuid, bpy.data.lattices)
def is_valid(self):
return bpy.data.lattices.get(self.data['name'])
bl_id = "lattices"
bl_class = bpy.types.Lattice
bl_rep_class = BlLattice
bl_delay_refresh = 1
bl_delay_apply = 1
bl_automatic_push = True
bl_icon = 'LATTICE_DATA'

View File

@ -0,0 +1,49 @@
import bpy
import mathutils
from .. import utils
from .bl_datablock import BlDatablock
class BlLightProbe(BlDatablock):
def load(self, data, target):
utils.dump_anything.load(target, data)
def construct(self, data):
return bpy.data.lightprobes.new(data["name"])
def dump(self, pointer=None):
assert(pointer)
dumper = utils.dump_anything.Dumper()
dumper.depth = 1
dumper.include_filter = [
"name",
'influence_type',
'influence_distance',
'falloff',
'intensity',
'clip_start',
'clip_end',
'visibility_collection',
'use_custom_parallax',
'parallax_type',
'parallax_distance',
]
return dumper.dump(pointer)
def resolve(self):
self.pointer = utils.find_from_attr('uuid', self.uuid, bpy.data.lattices)
def is_valid(self):
return bpy.data.lattices.get(self.data['name'])
bl_id = "lightprobes"
bl_class = bpy.types.LightProbe
bl_rep_class = BlLightProbe
bl_delay_refresh = 1
bl_delay_apply = 1
bl_automatic_push = True
bl_icon = 'LIGHTPROBE_GRID'

View File

@ -37,6 +37,14 @@ class BlObject(BlDatablock):
pointer = bpy.data.grease_pencils[data["data"]]
elif data["data"] in bpy.data.curves.keys():
pointer = bpy.data.curves[data["data"]]
elif data["data"] in bpy.data.lattices.keys():
pointer = bpy.data.lattices[data["data"]]
elif data["data"] in bpy.data.speakers.keys():
pointer = bpy.data.speakers[data["data"]]
elif data["data"] in bpy.data.lightprobes.keys():
pass
# bpy need to support correct lightprobe creation from python
# pointer = bpy.data.lightprobes[data["data"]]
instance = bpy.data.objects.new(data["name"], pointer)
instance.uuid = self.uuid

View File

@ -0,0 +1,50 @@
import bpy
import mathutils
from .. import utils
from .bl_datablock import BlDatablock
class BlSpeaker(BlDatablock):
def load(self, data, target):
utils.dump_anything.load(target, data)
def construct(self, data):
return bpy.data.speakers.new(data["name"])
def dump(self, pointer=None):
assert(pointer)
dumper = utils.dump_anything.Dumper()
dumper.depth = 1
dumper.include_filter = [
"muted",
'volume',
'name',
'pitch',
'volume_min',
'volume_max',
'attenuation',
'distance_max',
'distance_reference',
'cone_angle_outer',
'cone_angle_inner',
'cone_volume_outer'
]
return dumper.dump(pointer)
def resolve(self):
self.pointer = utils.find_from_attr('uuid', self.uuid, bpy.data.lattices)
def is_valid(self):
return bpy.data.lattices.get(self.data['name'])
bl_id = "speakers"
bl_class = bpy.types.Speaker
bl_rep_class = BlSpeaker
bl_delay_refresh = 1
bl_delay_apply = 1
bl_automatic_push = True
bl_icon = 'SPEAKER'