diff --git a/multi_user/bl_types/bl_curve.py b/multi_user/bl_types/bl_curve.py index 1eb3bd0..e179089 100644 --- a/multi_user/bl_types/bl_curve.py +++ b/multi_user/bl_types/bl_curve.py @@ -268,5 +268,5 @@ class BlCurve(ReplicatedDatablock): else: return super().diff() -_type = bpy.types.Curve +_type = [bpy.types.Curve, bpy.types.TextCurve] _class = BlCurve \ No newline at end of file diff --git a/multi_user/bl_types/bl_font.py b/multi_user/bl_types/bl_font.py index 1edb228..34b6a8d 100644 --- a/multi_user/bl_types/bl_font.py +++ b/multi_user/bl_types/bl_font.py @@ -25,7 +25,7 @@ import bpy from replication.protocol import ReplicatedDatablock from .bl_file import get_filepath, ensure_unpacked from .dump_anything import Dumper, Loader - +from .bl_datablock import resolve_datablock_from_uuid class BlFont(ReplicatedDatablock): bl_id = "fonts" @@ -34,6 +34,7 @@ class BlFont(ReplicatedDatablock): bl_icon = 'FILE_FONT' bl_reload_parent = False + @staticmethod def construct(data: dict) -> object: filename = data.get('filename') @@ -42,31 +43,47 @@ class BlFont(ReplicatedDatablock): else: return bpy.data.fonts.load(get_filepath(filename)) - def _load(self, data, target): + @staticmethod + def load(data: dict, datablock: object): pass - def _dump(self, instance=None): - if instance.filepath == '': + @staticmethod + def dump(datablock: object) -> dict: + if datablock.filepath == '': filename = '' else: - filename = Path(instance.filepath).name + filename = Path(datablock.filepath).name if not filename: - raise FileExistsError(instance.filepath) + raise FileExistsError(datablock.filepath) return { 'filename': filename, - 'name': instance.name + 'name': datablock.name } def diff(self): return False + @staticmethod + def resolve(data: dict) -> object: + uuid = data.get('uuid') + name = data.get('name') + datablock = resolve_datablock_from_uuid(uuid, bpy.data.fonts) + if datablock is None: + datablock = bpy.data.fonts.get(name) + + return datablock + + @staticmethod def resolve_deps(datablock: object) -> [object]: deps = [] - if self.instance.filepath and self.instance.filepath != '': - ensure_unpacked(self.instance) + if datablock.filepath and datablock.filepath != '': + ensure_unpacked(datablock) - deps.append(Path(bpy.path.abspath(self.instance.filepath))) + deps.append(Path(bpy.path.abspath(datablock.filepath))) return deps + +_type = bpy.types.VectorFont +_class = BlFont \ No newline at end of file diff --git a/multi_user/libs/replication b/multi_user/libs/replication index a6b4c55..1a75bbb 160000 --- a/multi_user/libs/replication +++ b/multi_user/libs/replication @@ -1 +1 @@ -Subproject commit a6b4c5596980f22acb96e956660cf74b7191294d +Subproject commit 1a75bbba0bbc075da4efd68e2076dc167abe3b38