feat: resolve definition for each implementation

This commit is contained in:
Swann
2019-08-10 00:17:43 +02:00
parent 4291a20e57
commit 1ee124e5b1
10 changed files with 36 additions and 6 deletions

View File

@ -22,6 +22,10 @@ class BlCamera(ReplicatedDatablock):
return utils.dump_datablock(pointer, 1)
def resolve(self):
assert(self.buffer)
self.pointer = bpy.data.cameras.get(self.buffer['name'])
bl_id = "cameras"
bl_class = bpy.types.Camera
bl_rep_class = BlCamera

View File

@ -46,6 +46,9 @@ class BlCollection(ReplicatedDatablock):
assert(pointer)
return utils.dump_datablock(pointer, 4)
def resolve(self):
assert(self.buffer)
self.pointer = bpy.data.collections.get(self.buffer['name'])
bl_id = "collections"
bl_class = bpy.types.Collection

View File

@ -36,7 +36,6 @@ class BlCurve(ReplicatedDatablock):
utils.dump_anything.load(
new_spline.points[point_index], data['splines'][spline]["points"][point_index])
def dump(self, pointer=None):
assert(pointer)
data = utils.dump_datablock(pointer, 1)
@ -44,6 +43,10 @@ class BlCurve(ReplicatedDatablock):
pointer, ['splines'], 5, data)
return data
def resolve(self):
assert(self.buffer)
self.pointer = bpy.data.curves.get(self.buffer['name'])
bl_id = "curves"
bl_class = bpy.types.Curve
bl_rep_class = BlCurve

View File

@ -68,6 +68,10 @@ class BlGpencil(ReplicatedDatablock):
pointer, ['layers'], 9, data)
return data
def resolve(self):
assert(self.buffer)
self.pointer = bpy.data.grease_pencils.get(self.buffer['name'])
bl_id = "grease_pencils"
bl_class = bpy.types.GreasePencil
bl_rep_class = BlGpencil

View File

@ -45,6 +45,10 @@ class BlImage(ReplicatedDatablock):
data)
return data
def resolve(self):
assert(self.buffer)
self.pointer = bpy.data.images.get(self.buffer['name'])
bl_id = "images"
bl_class = bpy.types.Image
bl_rep_class = BlImage

View File

@ -22,6 +22,10 @@ class BlLight(ReplicatedDatablock):
return utils.dump_datablock(pointer, 3)
def resolve(self):
assert(self.buffer)
self.pointer = bpy.data.lights.get(self.buffer['name'])
bl_id = "lights"
bl_class = bpy.types.Light
bl_rep_class = BlLight

View File

@ -77,6 +77,10 @@ class BlMaterial(ReplicatedDatablock):
utils.dump_datablock_attibutes(pointer, ["grease_pencil"], 3, data)
return data
def resolve(self):
assert(self.buffer)
self.pointer = bpy.data.materials.get(self.buffer['name'])
bl_id = "materials"
bl_class = bpy.types.Material
bl_rep_class = BlMaterial

View File

@ -158,6 +158,10 @@ class BlMesh(ReplicatedDatablock):
return data
def resolve(self):
assert(self.buffer)
self.pointer = bpy.data.meshes.get(self.buffer['name'])
bl_id = "meshes"
bl_class = bpy.types.Mesh
bl_rep_class = BlMesh

View File

@ -62,10 +62,10 @@ context = None
def add_datablock(datablock):
global client
child=None
child=[]
if hasattr(datablock,"data"):
child = add_datablock(datablock.data)
child.append(add_datablock(datablock.data))
if datablock.uuid and client.exist(datablock.uuid) :
return datablock.uuid