Asset Pipeline v2 #145

Closed
Nick Alberelli wants to merge 431 commits from (deleted):feature/asset-pipeline-v2 into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Showing only changes of commit d8cb7eceba - Show all commits

View File

@ -25,6 +25,7 @@ class AssetTransferMapping:
external_coll: bpy.types.Collection, external_coll: bpy.types.Collection,
local_tls: Set[str], local_tls: Set[str],
): ):
# TODO Check if any of the below properties can be removed
self._local_col = local_coll self._local_col = local_coll
self._external_col = external_coll self._external_col = external_coll
self._local_tls = local_tls self._local_tls = local_tls
@ -59,6 +60,10 @@ class AssetTransferMapping:
return return
return external_obj return external_obj
def _check_obj_conflict(self, external_obj, local_obj):
if external_obj.asset_id_owner != local_obj.asset_id_owner:
self.conflict_objects.append(local_obj)
def _gen_object_map(self) -> Dict[bpy.types.Object, bpy.types.Object]: def _gen_object_map(self) -> Dict[bpy.types.Object, bpy.types.Object]:
""" """
Tries to link all objects in source collection to an object in Tries to link all objects in source collection to an object in
@ -69,24 +74,18 @@ class AssetTransferMapping:
# Skip items with no owner # Skip items with no owner
if local_obj.asset_id_owner == "NONE": if local_obj.asset_id_owner == "NONE":
continue continue
external_obj = self._get_external_object(local_obj)
if not external_obj:
continue
# IF ITEM IS OWNED BY LOCAL TASK LAYERS # IF ITEM IS OWNED BY LOCAL TASK LAYERS
if local_obj.asset_id_owner in self._local_tls: if local_obj.asset_id_owner in self._local_tls:
external_obj = self._get_external_object(local_obj) self._check_obj_conflict(external_obj, local_obj)
if external_obj:
if external_obj.asset_id_owner != local_obj.asset_id_owner:
self.conflict_objects.append(local_obj)
object_map[external_obj] = local_obj object_map[external_obj] = local_obj
# IF ITEM IS NOT OWNED BY LOCAL TASK LAYERS # IF ITEM IS NOT OWNED BY LOCAL TASK LAYERS
else: else:
external_obj = self._get_external_object(local_obj) self._check_obj_conflict(external_obj, local_obj)
if external_obj:
if external_obj.asset_id_owner != local_obj.asset_id_owner:
self.conflict_objects.append(local_obj)
object_map[local_obj] = external_obj object_map[local_obj] = external_obj
else:
# REMOVE OBJ NOT OWNED BY LOCAL TASK LAYER THAT HAS NO MATCH
self.local_obj_to_remove.add(local_obj)
# Find new objects to add to local_col # Find new objects to add to local_col
for external_obj in self._external_col.all_objects: for external_obj in self._external_col.all_objects:
@ -168,6 +167,7 @@ class AssetTransferMapping:
return True return True
def _gen_transfer_data_map(self): def _gen_transfer_data_map(self):
# TODO Clean up this mess
context = bpy.context context = bpy.context
transfer_data_map: Dict[bpy.types.Collection, bpy.types.Collection] = {} transfer_data_map: Dict[bpy.types.Collection, bpy.types.Collection] = {}
temp_transfer_data = context.scene.asset_pipeline.temp_transfer_data temp_transfer_data = context.scene.asset_pipeline.temp_transfer_data