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 7cd96b68e6 - Show all commits

View File

@ -167,67 +167,31 @@ class AssetTransferMapping:
if not other_obj: if not other_obj:
return return
for other_transfer_data_item in other_obj.transfer_data_ownership: for other_transfer_data_item in other_obj.transfer_data_ownership:
if ( if other_transfer_data_item.type == transfer_data_item.type and (
other_transfer_data_item.type == transfer_data_item.type task_layer_prefix_basename_get(other_transfer_data_item.name)
and other_transfer_data_item.name == transfer_data_item.name == task_layer_prefix_basename_get(transfer_data_item.name)
): ):
check_transfer_data_item = other_transfer_data_item check_transfer_data_item = other_transfer_data_item
if check_transfer_data_item is None: if check_transfer_data_item is None:
return return
if check_transfer_data_item.owner != transfer_data_item.owner: if check_transfer_data_item.owner != transfer_data_item.owner and not (
check_transfer_data_item.surrender or transfer_data_item.surrender
):
self.conflict_transfer_data.append(transfer_data_item) self.conflict_transfer_data.append(transfer_data_item)
print("CONFLICT FOUND") print("CONFLICT FOUND")
return True return True
def transfer_data_map_surrendered(self, transfer_data_item): def transfer_data_get_other(self, transfer_data_item):
# THIS IS FOR WHEN SURRENDERED DATA HAS BEEN REPLACED
obj = transfer_data_item.id_data obj = transfer_data_item.id_data
other_obj = bpy.data.objects.get(get_target_name(obj.name)) other_obj = bpy.data.objects.get(get_target_name(obj.name))
other_transfer_data_item = None
# Find Related Transfer Data Item on Target/Source Object # Find Related Transfer Data Item on Target/Source Object
for other_obj_transfer_data_item in other_obj.transfer_data_ownership: for other_obj_transfer_data_item in other_obj.transfer_data_ownership:
if task_layer_prefix_basename_get( if task_layer_prefix_basename_get(
other_obj_transfer_data_item.name other_obj_transfer_data_item.name
) == task_layer_prefix_basename_get(transfer_data_item.name): ) == task_layer_prefix_basename_get(transfer_data_item.name):
other_transfer_data_item = other_obj_transfer_data_item return other_obj_transfer_data_item
return None
# TODO CONSIDER PREFIXES
if not other_transfer_data_item:
return None, None
# If the other transfer data is surrendered map it accordingly
if (
other_transfer_data_item.surrender
and not transfer_data_item.surrender
and other_transfer_data_item.owner != transfer_data_item.owner
):
if transfer_data_item.owner in self._local_tls:
target_obj = obj
source_obj = other_obj
else:
target_obj = other_obj
source_obj = obj
return self._get_transfer_data_map_item(
source_obj, target_obj, transfer_data_item
)
if (
transfer_data_item.surrender
and not other_transfer_data_item.surrender
and other_transfer_data_item.owner != transfer_data_item.owner
):
if other_transfer_data_item.owner in self._local_tls:
target_obj = obj
source_obj = other_obj
else:
target_obj = other_obj
source_obj = obj
return self._get_transfer_data_map_item(
source_obj, target_obj, other_transfer_data_item
)
return None, None
def _gen_transfer_data_map(self): def _gen_transfer_data_map(self):
context = bpy.context context = bpy.context
@ -239,18 +203,19 @@ class AssetTransferMapping:
objs = [source_obj, target_obj] objs = [source_obj, target_obj]
for obj in objs: for obj in objs:
for transfer_data_item in obj.transfer_data_ownership: for transfer_data_item in obj.transfer_data_ownership:
name, map_item = self.transfer_data_map_surrendered(
transfer_data_item
)
if bool(name and map_item):
transfer_data_map[name] = map_item
continue
self._check_transfer_data_conflict(obj, transfer_data_item) self._check_transfer_data_conflict(obj, transfer_data_item)
if ( if (
transfer_data_item.owner in self._local_tls transfer_data_item.owner in self._local_tls
and obj.name.endswith(constants.LOCAL_SUFFIX) and obj.name.endswith(constants.LOCAL_SUFFIX)
): ):
other_td = self.transfer_data_get_other(transfer_data_item)
if other_td:
if (
transfer_data_item.surrender
and not other_td.surrender
and transfer_data_item.owner != other_td.owner
):
continue
name, map_item = self._get_transfer_data_map_item( name, map_item = self._get_transfer_data_map_item(
obj, target_obj, transfer_data_item obj, target_obj, transfer_data_item
) )
@ -261,6 +226,15 @@ class AssetTransferMapping:
and transfer_data_item.owner != "NONE" and transfer_data_item.owner != "NONE"
and obj.name.endswith(constants.EXTERNAL_SUFFIX) and obj.name.endswith(constants.EXTERNAL_SUFFIX)
): ):
other_td = self.transfer_data_get_other(transfer_data_item)
if other_td:
if (
transfer_data_item.surrender
and not other_td.surrender
and transfer_data_item.owner != other_td.owner
):
continue
name, map_item = self._get_transfer_data_map_item( name, map_item = self._get_transfer_data_map_item(
obj, target_obj, transfer_data_item obj, target_obj, transfer_data_item
) )