diff --git a/multi_user/bl_types/bl_datablock.py b/multi_user/bl_types/bl_datablock.py index ca87831..bd2b304 100644 --- a/multi_user/bl_types/bl_datablock.py +++ b/multi_user/bl_types/bl_datablock.py @@ -57,7 +57,7 @@ def resolve_from_root(data: dict, root: str, construct = True): if construct and not datablock_ref: name = self.data.get('name') logging.debug(f"Constructing {name}") - datablock_ref = self._construct(data=self.data) + datablock_ref = self.construct(data=self.data) if datablock_ref is not None: setattr(datablock_ref, 'uuid', self.uuid) diff --git a/multi_user/bl_types/bl_mesh.py b/multi_user/bl_types/bl_mesh.py index 01a9ccb..35b755b 100644 --- a/multi_user/bl_types/bl_mesh.py +++ b/multi_user/bl_types/bl_mesh.py @@ -63,9 +63,7 @@ class BlMesh(ReplicatedDatablock): @staticmethod def construct(data: dict) -> object: - instance = bpy.data.meshes.new(data.get("name")) - instance.uuid = data.get("uuid") - return instance + return bpy.data.meshes.new(data.get("name")) @staticmethod def load(data: dict, datablock: object): diff --git a/multi_user/bl_types/bl_object.py b/multi_user/bl_types/bl_object.py index 4148a93..d035b44 100644 --- a/multi_user/bl_types/bl_object.py +++ b/multi_user/bl_types/bl_object.py @@ -469,10 +469,7 @@ class BlObject(ReplicatedDatablock): if data_type != 'EMPTY' and object_data is None: raise Exception(f"Fail to load object {data['name']})") - instance = bpy.data.objects.new(object_name, object_data) - instance.uuid = data.get("uuid") - - return instance + return bpy.data.objects.new(object_name, object_data) @staticmethod def load(data: dict, datablock: object): diff --git a/multi_user/bl_types/bl_scene.py b/multi_user/bl_types/bl_scene.py index 172a6f9..2f1b3f0 100644 --- a/multi_user/bl_types/bl_scene.py +++ b/multi_user/bl_types/bl_scene.py @@ -381,10 +381,7 @@ class BlScene(ReplicatedDatablock): @staticmethod def construct(data: dict) -> object: - instance = bpy.data.scenes.new(data["name"]) - instance.uuid = data.get('uuid') - - return instance + return bpy.data.scenes.new(data["name"]) @staticmethod def load(data: dict, datablock: object): diff --git a/tests/test_bl_types/test_action.py b/tests/test_bl_types/test_action.py index 0c95b8c..6683d52 100644 --- a/tests/test_bl_types/test_action.py +++ b/tests/test_bl_types/test_action.py @@ -32,11 +32,11 @@ def test_action(clear_blend): # Test implementation = BlAction() - expected = implementation._dump(datablock) + expected = implementation.dump(datablock) bpy.data.actions.remove(datablock) - test = implementation._construct(expected) - implementation._load(expected, test) - result = implementation._dump(test) + test = implementation.construct(expected) + implementation.load(expected, test) + result = implementation.dump(test) assert not DeepDiff(expected, result) diff --git a/tests/test_bl_types/test_armature.py b/tests/test_bl_types/test_armature.py index 9684d14..b7a3d7c 100644 --- a/tests/test_bl_types/test_armature.py +++ b/tests/test_bl_types/test_armature.py @@ -12,11 +12,11 @@ def test_armature(clear_blend): datablock = bpy.data.armatures[0] implementation = BlArmature() - expected = implementation._dump(datablock) + expected = implementation.dump(datablock) bpy.data.armatures.remove(datablock) - test = implementation._construct(expected) - implementation._load(expected, test) - result = implementation._dump(test) + test = implementation.construct(expected) + implementation.load(expected, test) + result = implementation.dump(test) assert not DeepDiff(expected, result) diff --git a/tests/test_bl_types/test_camera.py b/tests/test_bl_types/test_camera.py index c863293..d9405b7 100644 --- a/tests/test_bl_types/test_camera.py +++ b/tests/test_bl_types/test_camera.py @@ -15,11 +15,11 @@ def test_camera(clear_blend, camera_type): datablock.type = camera_type camera_dumper = BlCamera() - expected = camera_dumper._dump(datablock) + expected = camera_dumper.dump(datablock) bpy.data.cameras.remove(datablock) - test = camera_dumper._construct(expected) - camera_dumper._load(expected, test) - result = camera_dumper._dump(test) + test = camera_dumper.construct(expected) + camera_dumper.load(expected, test) + result = camera_dumper.dump(test) assert not DeepDiff(expected, result) diff --git a/tests/test_bl_types/test_collection.py b/tests/test_bl_types/test_collection.py index d7df8a1..b3c56e5 100644 --- a/tests/test_bl_types/test_collection.py +++ b/tests/test_bl_types/test_collection.py @@ -23,11 +23,11 @@ def test_collection(clear_blend): # Test implementation = BlCollection() - expected = implementation._dump(datablock) + expected = implementation.dump(datablock) bpy.data.collections.remove(datablock) - test = implementation._construct(expected) - implementation._load(expected, test) - result = implementation._dump(test) + test = implementation.construct(expected) + implementation.load(expected, test) + result = implementation.dump(test) assert not DeepDiff(expected, result) diff --git a/tests/test_bl_types/test_curve.py b/tests/test_bl_types/test_curve.py index 4432d4d..1f564f8 100644 --- a/tests/test_bl_types/test_curve.py +++ b/tests/test_bl_types/test_curve.py @@ -19,11 +19,11 @@ def test_curve(clear_blend, curve_type): datablock = bpy.data.curves[0] implementation = BlCurve() - expected = implementation._dump(datablock) + expected = implementation.dump(datablock) bpy.data.curves.remove(datablock) - test = implementation._construct(expected) - implementation._load(expected, test) - result = implementation._dump(test) + test = implementation.construct(expected) + implementation.load(expected, test) + result = implementation.dump(test) assert not DeepDiff(expected, result) diff --git a/tests/test_bl_types/test_gpencil.py b/tests/test_bl_types/test_gpencil.py index 9e29bbe..861afbe 100644 --- a/tests/test_bl_types/test_gpencil.py +++ b/tests/test_bl_types/test_gpencil.py @@ -13,11 +13,11 @@ def test_gpencil(clear_blend): datablock = bpy.data.grease_pencils[0] implementation = BlGpencil() - expected = implementation._dump(datablock) + expected = implementation.dump(datablock) bpy.data.grease_pencils.remove(datablock) - test = implementation._construct(expected) - implementation._load(expected, test) - result = implementation._dump(test) + test = implementation.construct(expected) + implementation.load(expected, test) + result = implementation.dump(test) assert not DeepDiff(expected, result) diff --git a/tests/test_bl_types/test_lattice.py b/tests/test_bl_types/test_lattice.py index fc23e5f..059ce72 100644 --- a/tests/test_bl_types/test_lattice.py +++ b/tests/test_bl_types/test_lattice.py @@ -13,11 +13,11 @@ def test_lattice(clear_blend): datablock = bpy.data.lattices[0] implementation = BlLattice() - expected = implementation._dump(datablock) + expected = implementation.dump(datablock) bpy.data.lattices.remove(datablock) - test = implementation._construct(expected) - implementation._load(expected, test) - result = implementation._dump(test) + test = implementation.construct(expected) + implementation.load(expected, test) + result = implementation.dump(test) assert not DeepDiff(expected, result) diff --git a/tests/test_bl_types/test_lightprobes.py b/tests/test_bl_types/test_lightprobes.py index 391a391..e5d27d6 100644 --- a/tests/test_bl_types/test_lightprobes.py +++ b/tests/test_bl_types/test_lightprobes.py @@ -14,11 +14,11 @@ def test_lightprobes(clear_blend, lightprobe_type): blender_light = bpy.data.lightprobes[0] lightprobe_dumper = BlLightprobe() - expected = lightprobe_dumper._dump(blender_light) + expected = lightprobe_dumper.dump(blender_light) bpy.data.lightprobes.remove(blender_light) - test = lightprobe_dumper._construct(expected) - lightprobe_dumper._load(expected, test) - result = lightprobe_dumper._dump(test) + test = lightprobe_dumper.construct(expected) + lightprobe_dumper.load(expected, test) + result = lightprobe_dumper.dump(test) assert not DeepDiff(expected, result) diff --git a/tests/test_bl_types/test_lights.py b/tests/test_bl_types/test_lights.py index ef88327..fc87c96 100644 --- a/tests/test_bl_types/test_lights.py +++ b/tests/test_bl_types/test_lights.py @@ -13,11 +13,11 @@ def test_light(clear_blend, light_type): blender_light = bpy.data.lights[0] light_dumper = BlLight() - expected = light_dumper._dump(blender_light) + expected = light_dumper.dump(blender_light) bpy.data.lights.remove(blender_light) - test = light_dumper._construct(expected) - light_dumper._load(expected, test) - result = light_dumper._dump(test) + test = light_dumper.construct(expected) + light_dumper.load(expected, test) + result = light_dumper.dump(test) assert not DeepDiff(expected, result) diff --git a/tests/test_bl_types/test_material.py b/tests/test_bl_types/test_material.py index 953bae2..dd520e9 100644 --- a/tests/test_bl_types/test_material.py +++ b/tests/test_bl_types/test_material.py @@ -17,12 +17,12 @@ def test_material_nodes(clear_blend): datablock.node_tree.nodes.new(ntype) implementation = BlMaterial() - expected = implementation._dump(datablock) + expected = implementation.dump(datablock) bpy.data.materials.remove(datablock) - test = implementation._construct(expected) - implementation._load(expected, test) - result = implementation._dump(test) + test = implementation.construct(expected) + implementation.load(expected, test) + result = implementation.dump(test) assert not DeepDiff(expected, result) @@ -32,11 +32,11 @@ def test_material_gpencil(clear_blend): bpy.data.materials.create_gpencil_data(datablock) implementation = BlMaterial() - expected = implementation._dump(datablock) + expected = implementation.dump(datablock) bpy.data.materials.remove(datablock) - test = implementation._construct(expected) - implementation._load(expected, test) - result = implementation._dump(test) + test = implementation.construct(expected) + implementation.load(expected, test) + result = implementation.dump(test) assert not DeepDiff(expected, result) diff --git a/tests/test_bl_types/test_mesh.py b/tests/test_bl_types/test_mesh.py index 454b858..71f2e35 100644 --- a/tests/test_bl_types/test_mesh.py +++ b/tests/test_bl_types/test_mesh.py @@ -18,11 +18,11 @@ def test_mesh(clear_blend, mesh_type): # Test implementation = BlMesh() - expected = implementation._dump(datablock) + expected = implementation.dump(datablock) bpy.data.meshes.remove(datablock) - test = implementation._construct(expected) - implementation._load(expected, test) - result = implementation._dump(test) + test = implementation.construct(expected) + implementation.load(expected, test) + result = implementation.dump(test) assert not DeepDiff(expected, result) diff --git a/tests/test_bl_types/test_metaball.py b/tests/test_bl_types/test_metaball.py index cb7a1f1..7135b2e 100644 --- a/tests/test_bl_types/test_metaball.py +++ b/tests/test_bl_types/test_metaball.py @@ -13,11 +13,11 @@ def test_metaball(clear_blend, metaballs_type): datablock = bpy.data.metaballs[0] dumper = BlMetaball() - expected = dumper._dump(datablock) + expected = dumper.dump(datablock) bpy.data.metaballs.remove(datablock) - test = dumper._construct(expected) - dumper._load(expected, test) - result = dumper._dump(test) + test = dumper.construct(expected) + dumper.load(expected, test) + result = dumper.dump(test) assert not DeepDiff(expected, result) diff --git a/tests/test_bl_types/test_object.py b/tests/test_bl_types/test_object.py index db63981..8f39bf0 100644 --- a/tests/test_bl_types/test_object.py +++ b/tests/test_bl_types/test_object.py @@ -65,11 +65,11 @@ def test_object(clear_blend): datablock.shape_key_add(name='shape2') implementation = BlObject() - expected = implementation._dump(datablock) + expected = implementation.dump(datablock) bpy.data.objects.remove(datablock) - test = implementation._construct(expected) - implementation._load(expected, test) - result = implementation._dump(test) + test = implementation.construct(expected) + implementation.load(expected, test) + result = implementation.dump(test) print(DeepDiff(expected, result)) assert not DeepDiff(expected, result) diff --git a/tests/test_bl_types/test_scene.py b/tests/test_bl_types/test_scene.py index bdcc452..ab003e7 100644 --- a/tests/test_bl_types/test_scene.py +++ b/tests/test_bl_types/test_scene.py @@ -15,11 +15,11 @@ def test_scene(clear_blend): datablock.view_settings.use_curve_mapping = True # Test implementation = BlScene() - expected = implementation._dump(datablock) + expected = implementation.dump(datablock) bpy.data.scenes.remove(datablock) - test = implementation._construct(expected) - implementation._load(expected, test) - result = implementation._dump(test) + test = implementation.construct(expected) + implementation.load(expected, test) + result = implementation.dump(test) assert not DeepDiff(expected, result) diff --git a/tests/test_bl_types/test_speaker.py b/tests/test_bl_types/test_speaker.py index 81afe0e..f02649a 100644 --- a/tests/test_bl_types/test_speaker.py +++ b/tests/test_bl_types/test_speaker.py @@ -12,11 +12,11 @@ def test_speaker(clear_blend): datablock = bpy.data.speakers[0] implementation = BlSpeaker() - expected = implementation._dump(datablock) + expected = implementation.dump(datablock) bpy.data.speakers.remove(datablock) - test = implementation._construct(expected) - implementation._load(expected, test) - result = implementation._dump(test) + test = implementation.construct(expected) + implementation.load(expected, test) + result = implementation.dump(test) assert not DeepDiff(expected, result) diff --git a/tests/test_bl_types/test_texture.py b/tests/test_bl_types/test_texture.py index 462128b..77e5d18 100644 --- a/tests/test_bl_types/test_texture.py +++ b/tests/test_bl_types/test_texture.py @@ -14,11 +14,11 @@ def test_texture(clear_blend, texture_type): datablock = bpy.data.textures.new('test', texture_type) implementation = BlTexture() - expected = implementation._dump(datablock) + expected = implementation.dump(datablock) bpy.data.textures.remove(datablock) - test = implementation._construct(expected) - implementation._load(expected, test) - result = implementation._dump(test) + test = implementation.construct(expected) + implementation.load(expected, test) + result = implementation.dump(test) assert not DeepDiff(expected, result) diff --git a/tests/test_bl_types/test_volume.py b/tests/test_bl_types/test_volume.py index f4fcf6c..0c70130 100644 --- a/tests/test_bl_types/test_volume.py +++ b/tests/test_bl_types/test_volume.py @@ -11,11 +11,11 @@ def test_volume(clear_blend): datablock = bpy.data.volumes.new("Test") implementation = BlVolume() - expected = implementation._dump(datablock) + expected = implementation.dump(datablock) bpy.data.volumes.remove(datablock) - test = implementation._construct(expected) - implementation._load(expected, test) - result = implementation._dump(test) + test = implementation.construct(expected) + implementation.load(expected, test) + result = implementation.dump(test) assert not DeepDiff(expected, result) diff --git a/tests/test_bl_types/test_world.py b/tests/test_bl_types/test_world.py index 4e42a50..a083ba8 100644 --- a/tests/test_bl_types/test_world.py +++ b/tests/test_bl_types/test_world.py @@ -12,11 +12,11 @@ def test_world(clear_blend): datablock.use_nodes = True implementation = BlWorld() - expected = implementation._dump(datablock) + expected = implementation.dump(datablock) bpy.data.worlds.remove(datablock) - test = implementation._construct(expected) - implementation._load(expected, test) - result = implementation._dump(test) + test = implementation.construct(expected) + implementation.load(expected, test) + result = implementation.dump(test) assert not DeepDiff(expected, result)