Asset Pipeline: Improve Performance #235
@ -235,12 +235,17 @@ class AssetTransferMapping:
|
||||
source_obj, target_obj, transfer_data_item
|
||||
)
|
||||
if not source_obj in self.transfer_data_map:
|
||||
self.transfer_data_map[source_obj] = {td_type_key: [transfer_data_dict]}
|
||||
self.transfer_data_map[source_obj] = {
|
||||
"target_obj": target_obj,
|
||||
"td_types": {td_type_key: [transfer_data_dict]},
|
||||
}
|
||||
return
|
||||
|
||||
if not td_type_key in self.transfer_data_map[source_obj]:
|
||||
self.transfer_data_map[source_obj][td_type_key] = [transfer_data_dict]
|
||||
if not td_type_key in self.transfer_data_map[source_obj]["td_types"]:
|
||||
self.transfer_data_map[source_obj]["td_types"][td_type_key] = [transfer_data_dict]
|
||||
return
|
||||
else:
|
||||
self.transfer_data_map[source_obj][td_type_key].append(transfer_data_dict)
|
||||
self.transfer_data_map[source_obj]["td_types"][td_type_key].append(transfer_data_dict)
|
||||
|
||||
def _transfer_data_map_item(self, source_obj, target_obj, transfer_data_item):
|
||||
"""Verifies if Transfer Data Item is valid/can be mapped"""
|
||||
@ -278,25 +283,25 @@ class AssetTransferMapping:
|
||||
index_map = {}
|
||||
|
||||
for source_obj in self.transfer_data_map:
|
||||
for td_type_key, td_items in self.transfer_data_map[source_obj].items():
|
||||
for td_item in td_items:
|
||||
target_obj = td_item["target_obj"]
|
||||
if td_type_key != constants.MATERIAL_SLOT_KEY:
|
||||
continue
|
||||
if source_obj.type != 'MESH':
|
||||
continue
|
||||
target_obj = self.transfer_data_map[source_obj]["target_obj"]
|
||||
td_types = self.transfer_data_map[source_obj]["td_types"]
|
||||
for td_type_key, _ in td_types.items():
|
||||
if td_type_key != constants.MATERIAL_SLOT_KEY:
|
||||
continue
|
||||
if source_obj.type != 'MESH':
|
||||
continue
|
||||
|
||||
active_uv_name = (
|
||||
source_obj.data.uv_layers.active.name
|
||||
if source_obj.data.uv_layers.active
|
||||
else ''
|
||||
)
|
||||
active_color_attribute_name = source_obj.data.color_attributes.active_color_name
|
||||
index_map[source_obj] = {
|
||||
'active_uv_name': active_uv_name,
|
||||
'active_color_attribute_name': active_color_attribute_name,
|
||||
'target_obj': target_obj,
|
||||
}
|
||||
active_uv_name = (
|
||||
source_obj.data.uv_layers.active.name
|
||||
if source_obj.data.uv_layers.active
|
||||
else ''
|
||||
)
|
||||
active_color_attribute_name = source_obj.data.color_attributes.active_color_name
|
||||
index_map[source_obj] = {
|
||||
'active_uv_name': active_uv_name,
|
||||
'active_color_attribute_name': active_color_attribute_name,
|
||||
'target_obj': target_obj,
|
||||
}
|
||||
|
||||
return index_map
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user