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