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.
2 changed files with 37 additions and 6 deletions
Showing only changes of commit 3baa0f1439 - Show all commits

View File

@ -143,6 +143,24 @@ class AssetTransferMapping:
name = transfer_info.name + '_' + obj.name
return name, map_item
def _check_transfer_data_conflict(self, obj, transfer_info):
other_obj = bpy.data.objects.get(asset_suffix.get_target_name(obj.name))
check_transfer_info = None
if not other_obj:
return
for other_transfer_info in other_obj.transfer_data_ownership:
if (
other_transfer_info.type == transfer_info.type
and other_transfer_info.name == transfer_info.name
):
check_transfer_info = other_transfer_info
if check_transfer_info is None:
return
if check_transfer_info.owner != transfer_info.owner:
self.conflict_trasnfer_data.append(transfer_info)
print("CONFLICT FOUND")
return True
def _gen_transfer_data_map(self):
context = bpy.context
transfer_data_map: Dict[bpy.types.Collection, bpy.types.Collection] = {}
@ -155,6 +173,10 @@ class AssetTransferMapping:
if obj.name.endswith(constants.LOCAL_SUFFIX):
for transfer_info in obj.transfer_data_ownership:
if transfer_info.owner in self._local_tls:
conflict = self._check_transfer_data_conflict(
obj, transfer_info
)
if not conflict:
name, map_item = self._get_transfer_data_map_item(
obj, target_obj, transfer_info
)
@ -166,6 +188,10 @@ class AssetTransferMapping:
transfer_info.owner not in self._local_tls
and transfer_info.owner != "NONE"
):
conflict = self._check_transfer_data_conflict(
obj, transfer_info
)
if not conflict:
name, map_item = self._get_transfer_data_map_item(
obj, target_obj, transfer_info
)

View File

@ -163,6 +163,11 @@ def merge_task_layer(
map = AssetTransferMapping(local_col, external_col, local_tls)
if len(map.conflict_trasnfer_data) != 0:
error_msg = ''
for conflict in map.conflict_trasnfer_data:
error_msg += f"Transfer Data conflict found for '{conflict.name}' on obj '{conflict.id_data.name}'\n"
return error_msg
# Remove all transfer data from target objects
for source_obj in map.object_map:
target_obj = map.object_map[source_obj]