Asset Pipeline v2 #145
@ -143,6 +143,24 @@ class AssetTransferMapping:
|
|||||||
name = transfer_info.name + '_' + obj.name
|
name = transfer_info.name + '_' + obj.name
|
||||||
return name, map_item
|
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):
|
def _gen_transfer_data_map(self):
|
||||||
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] = {}
|
||||||
@ -155,6 +173,10 @@ class AssetTransferMapping:
|
|||||||
if obj.name.endswith(constants.LOCAL_SUFFIX):
|
if obj.name.endswith(constants.LOCAL_SUFFIX):
|
||||||
for transfer_info in obj.transfer_data_ownership:
|
for transfer_info in obj.transfer_data_ownership:
|
||||||
if transfer_info.owner in self._local_tls:
|
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(
|
name, map_item = self._get_transfer_data_map_item(
|
||||||
obj, target_obj, transfer_info
|
obj, target_obj, transfer_info
|
||||||
)
|
)
|
||||||
@ -166,6 +188,10 @@ class AssetTransferMapping:
|
|||||||
transfer_info.owner not in self._local_tls
|
transfer_info.owner not in self._local_tls
|
||||||
and transfer_info.owner != "NONE"
|
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(
|
name, map_item = self._get_transfer_data_map_item(
|
||||||
obj, target_obj, transfer_info
|
obj, target_obj, transfer_info
|
||||||
)
|
)
|
||||||
|
@ -163,6 +163,11 @@ def merge_task_layer(
|
|||||||
|
|
||||||
map = AssetTransferMapping(local_col, external_col, local_tls)
|
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
|
# Remove all transfer data from target objects
|
||||||
for source_obj in map.object_map:
|
for source_obj in map.object_map:
|
||||||
target_obj = map.object_map[source_obj]
|
target_obj = map.object_map[source_obj]
|
||||||
|
Loading…
Reference in New Issue
Block a user