refactor: temporary remove name resolution

This commit is contained in:
Swann 2021-06-01 15:47:05 +02:00
parent ad89a4e389
commit c2d2db78e6
No known key found for this signature in database
GPG Key ID: E1D3641A7C43AACB
21 changed files with 21 additions and 125 deletions

View File

@ -317,10 +317,7 @@ class BlAction(ReplicatedDatablock):
@staticmethod
def resolve(data: dict) -> object:
uuid = data.get('uuid')
name = data.get('name')
datablock = resolve_datablock_from_uuid(uuid, bpy.data.actions)
if datablock is None:
bpy.data.actions.get(name)
return resolve_datablock_from_uuid(uuid, bpy.data.actions)
@staticmethod
def resolve_deps(datablock: object) -> [object]:

View File

@ -129,12 +129,7 @@ class BlCamera(ReplicatedDatablock):
@staticmethod
def resolve(data: dict) -> object:
uuid = data.get('uuid')
name = data.get('name')
datablock = resolve_datablock_from_uuid(uuid, bpy.data.cameras)
if datablock is None:
datablock = bpy.data.cameras.get(name)
return datablock
return resolve_datablock_from_uuid(uuid, bpy.data.cameras)
@staticmethod
def resolve_deps(datablock: object) -> [object]:

View File

@ -133,12 +133,7 @@ class BlCollection(ReplicatedDatablock):
@staticmethod
def resolve(data: dict) -> object:
uuid = data.get('uuid')
name = data.get('name')
datablock = resolve_datablock_from_uuid(uuid, bpy.data.collections)
if datablock is None:
datablock = bpy.data.collections.get(name)
return datablock
return resolve_datablock_from_uuid(uuid, bpy.data.collections)
@staticmethod

View File

@ -232,12 +232,7 @@ class BlCurve(ReplicatedDatablock):
@staticmethod
def resolve(data: dict) -> object:
uuid = data.get('uuid')
name = data.get('name')
datablock = resolve_datablock_from_uuid(uuid, bpy.data.curves)
if datablock is None:
datablock = bpy.data.curves.get(name)
return datablock
return resolve_datablock_from_uuid(uuid, bpy.data.curves)
@staticmethod
def resolve_deps(datablock: object) -> [object]:

View File

@ -65,12 +65,7 @@ class BlFont(ReplicatedDatablock):
@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
return resolve_datablock_from_uuid(uuid, bpy.data.fonts)
@staticmethod
def resolve_deps(datablock: object) -> [object]:

View File

@ -307,12 +307,7 @@ class BlGpencil(ReplicatedDatablock):
@staticmethod
def resolve(data: dict) -> object:
uuid = data.get('uuid')
name = data.get('name')
datablock = resolve_datablock_from_uuid(uuid, bpy.data.grease_pencils)
if datablock is None:
datablock = bpy.data.grease_pencils.get(name)
return datablock
return resolve_datablock_from_uuid(uuid, bpy.data.grease_pencils)
@staticmethod
def resolve_deps(datablock: object) -> [object]:

View File

@ -103,12 +103,7 @@ class BlImage(ReplicatedDatablock):
@staticmethod
def resolve(data: dict) -> object:
uuid = data.get('uuid')
name = data.get('name')
datablock = resolve_datablock_from_uuid(uuid, bpy.data.images)
if datablock is None:
datablock = bpy.data.images.get(name)
return datablock
return resolve_datablock_from_uuid(uuid, bpy.data.images)
@staticmethod
def resolve_deps(datablock: object) -> [object]:

View File

@ -77,12 +77,7 @@ class BlLattice(ReplicatedDatablock):
@staticmethod
def resolve(data: dict) -> object:
uuid = data.get('uuid')
name = data.get('name')
datablock = resolve_datablock_from_uuid(uuid, bpy.data.lattices)
if datablock is None:
datablock = bpy.data.lattices.get(name)
return datablock
return resolve_datablock_from_uuid(uuid, bpy.data.lattices)
@staticmethod
def resolve_deps(datablock: object) -> [object]:

View File

@ -81,12 +81,7 @@ class BlLight(ReplicatedDatablock):
@staticmethod
def resolve(data: dict) -> object:
uuid = data.get('uuid')
name = data.get('name')
datablock = resolve_datablock_from_uuid(uuid, bpy.data.lights)
if datablock is None:
datablock = bpy.data.lights.get(name)
return datablock
return resolve_datablock_from_uuid(uuid, bpy.data.lights)
@staticmethod
def resolve_deps(datablock: object) -> [object]:

View File

@ -78,12 +78,7 @@ class BlLightprobe(ReplicatedDatablock):
@staticmethod
def resolve(data: dict) -> object:
uuid = data.get('uuid')
name = data.get('name')
datablock = resolve_datablock_from_uuid(uuid, bpy.data.lightprobes)
if datablock is None:
datablock = bpy.data.lightprobes.get(name)
return datablock
return resolve_datablock_from_uuid(uuid, bpy.data.lightprobes)
@staticmethod
def resolve_deps(datablock: object) -> [object]:

View File

@ -501,13 +501,7 @@ class BlMaterial(ReplicatedDatablock):
@staticmethod
def resolve(data: dict) -> object:
uuid = data.get('uuid')
name = data.get('name')
datablock = resolve_datablock_from_uuid(uuid, bpy.data.materials)
if datablock is None:
datablock = bpy.data.materials.get(name)
return datablock
return resolve_datablock_from_uuid(uuid, bpy.data.materials)
@staticmethod
def resolve_deps(datablock: object) -> [object]:

View File

@ -189,12 +189,7 @@ class BlMesh(ReplicatedDatablock):
@staticmethod
def resolve(data: dict) -> object:
uuid = data.get('uuid')
name = data.get('name')
datablock = resolve_datablock_from_uuid(uuid, bpy.data.meshes)
if datablock is None:
datablock = bpy.data.meshes.get(name)
return datablock
return resolve_datablock_from_uuid(uuid, bpy.data.meshes)
@staticmethod
def needs_update(datablock: object, data: dict) -> bool:

View File

@ -113,12 +113,7 @@ class BlMetaball(ReplicatedDatablock):
@staticmethod
def resolve(data: dict) -> object:
uuid = data.get('uuid')
name = data.get('name')
datablock = resolve_datablock_from_uuid(uuid, bpy.data.metaballs)
if datablock is None:
datablock = bpy.data.metaballs.get(name)
return datablock
return resolve_datablock_from_uuid(uuid, bpy.data.metaballs)
@staticmethod
def resolve_deps(datablock: object) -> [object]:

View File

@ -49,12 +49,7 @@ class BlNodeGroup(ReplicatedDatablock):
@staticmethod
def resolve(data: dict) -> object:
uuid = data.get('uuid')
name = data.get('name')
datablock = resolve_datablock_from_uuid(uuid, bpy.data.node_groups)
if datablock is None:
datablock = bpy.data.node_groups.get(name)
return datablock
return resolve_datablock_from_uuid(uuid, bpy.data.node_groups)
@staticmethod
def resolve_deps(datablock: object) -> [object]:

View File

@ -772,12 +772,7 @@ class BlObject(ReplicatedDatablock):
@staticmethod
def resolve(data: dict) -> object:
uuid = data.get('uuid')
name = data.get('name')
datablock = resolve_datablock_from_uuid(uuid, bpy.data.objects)
if datablock is None:
datablock = bpy.data.objects.get(name)
return datablock
return resolve_datablock_from_uuid(uuid, bpy.data.objects)
_type = bpy.types.Object
_class = BlObject

View File

@ -92,12 +92,7 @@ class BlParticle(ReplicatedDatablock):
@staticmethod
def resolve(data: dict) -> object:
uuid = data.get('uuid')
name = data.get('name')
datablock = resolve_datablock_from_uuid(uuid, bpy.data.particles)
if datablock is None:
datablock = bpy.data.particles.get(name)
return datablock
return resolve_datablock_from_uuid(uuid, bpy.data.particles)
@staticmethod
def resolve_deps(datablock: object) -> [object]:

View File

@ -71,12 +71,7 @@ class BlSound(ReplicatedDatablock):
@staticmethod
def resolve(data: dict) -> object:
uuid = data.get('uuid')
name = data.get('name')
datablock = resolve_datablock_from_uuid(uuid, bpy.data.sounds)
if datablock is None:
datablock = bpy.data.sounds.get(name)
return datablock
return resolve_datablock_from_uuid(uuid, bpy.data.sounds)
@staticmethod
def needs_update(datablock: object, data:dict)-> bool:

View File

@ -68,12 +68,7 @@ class BlSpeaker(ReplicatedDatablock):
@staticmethod
def resolve(data: dict) -> object:
uuid = data.get('uuid')
name = data.get('name')
datablock = resolve_datablock_from_uuid(uuid, bpy.data.speakers)
if datablock is None:
datablock = bpy.data.speakers.get(name)
return datablock
return resolve_datablock_from_uuid(uuid, bpy.data.speakers)
@staticmethod
def resolve_deps(datablock: object) -> [object]:

View File

@ -71,12 +71,7 @@ class BlTexture(ReplicatedDatablock):
@staticmethod
def resolve(data: dict) -> object:
uuid = data.get('uuid')
name = data.get('name')
datablock = resolve_datablock_from_uuid(uuid, bpy.data.textures)
if datablock is None:
datablock = bpy.data.textures.get(name)
return datablock
return resolve_datablock_from_uuid(uuid, bpy.data.textures)
@staticmethod
def resolve_deps(datablock: object) -> [object]:

View File

@ -76,12 +76,7 @@ class BlVolume(ReplicatedDatablock):
@staticmethod
def resolve(data: dict) -> object:
uuid = data.get('uuid')
name = data.get('name')
datablock = resolve_datablock_from_uuid(uuid, bpy.data.volumes)
if datablock is None:
datablock = bpy.data.volumes.get(name)
return datablock
return resolve_datablock_from_uuid(uuid, bpy.data.volumes)
@staticmethod
def resolve_deps(datablock: object) -> [object]:

View File

@ -71,12 +71,7 @@ class BlWorld(ReplicatedDatablock):
@staticmethod
def resolve(data: dict) -> object:
uuid = data.get('uuid')
name = data.get('name')
datablock = resolve_datablock_from_uuid(uuid, bpy.data.worlds)
if datablock is None:
datablock = bpy.data.worlds.get(name)
return datablock
return resolve_datablock_from_uuid(uuid, bpy.data.worlds)
@staticmethod
def resolve_deps(datablock: object) -> [object]: