Asset Pipeline v2 #145
@ -480,14 +480,33 @@ def transfer_shape_key(
|
||||
|
||||
|
||||
# ATTRIBUTE
|
||||
def attributes_get_editable(attributes):
|
||||
return [item for item in attributes if not (item.is_required or item.is_internal)]
|
||||
|
||||
|
||||
def attribute_clean(obj):
|
||||
transfer_core.transfer_info_clean(obj, obj.data.attributes)
|
||||
# TODO debug clean function
|
||||
if obj.type != "MESH":
|
||||
return
|
||||
attributes = attributes_get_editable(obj.data.attributes)
|
||||
transfer_data = obj.transfer_data_ownership
|
||||
for item in attributes:
|
||||
if not asset_suffix.get_basename(item.name) in transfer_data.keys():
|
||||
print(f"Cleaning attribute {item.name}")
|
||||
obj.data.attributes.remove(item)
|
||||
|
||||
|
||||
def attribute_is_missing(transfer_info):
|
||||
return transfer_core.transfer_info_is_missing(
|
||||
transfer_info, constants.ATTRIBUTE_KEY, transfer_info.id_data.data.attributes
|
||||
)
|
||||
obj = transfer_info.id_data
|
||||
if obj.type != "MESH":
|
||||
return
|
||||
attributes = attributes_get_editable(obj.data.attributes)
|
||||
attribute_names = [attribute.name for attribute in attributes]
|
||||
if (
|
||||
transfer_info.type == constants.ATTRIBUTE_KEY
|
||||
and not transfer_info["name"] in attribute_names
|
||||
):
|
||||
return True
|
||||
|
||||
|
||||
def init_attributes(scene, obj):
|
||||
@ -496,17 +515,16 @@ def init_attributes(scene, obj):
|
||||
transfer_data = obj.transfer_data_ownership
|
||||
task_layer_name = scene.asset_pipeline.task_layer_name
|
||||
type_key = constants.ATTRIBUTE_KEY
|
||||
list = obj.data.attributes
|
||||
for item in list:
|
||||
if item.is_required or item.is_internal:
|
||||
for atttribute in attributes_get_editable(obj.data.attributes):
|
||||
if atttribute.is_required or atttribute.is_internal:
|
||||
continue
|
||||
# Only add new ownership transfer_info if vertex group doesn't have an owner
|
||||
matches = transfer_core.check_transfer_data_entry(
|
||||
transfer_data, item.name, type_key
|
||||
transfer_data, atttribute.name, type_key
|
||||
)
|
||||
if len(matches) == 0:
|
||||
scene.asset_pipeline.add_temp_trasnfer_data(
|
||||
name=item.name,
|
||||
name=atttribute.name,
|
||||
owner=task_layer_name,
|
||||
type=type_key,
|
||||
obj=obj,
|
||||
|
Loading…
Reference in New Issue
Block a user