Asset Pipeline v2 #145
@ -480,14 +480,33 @@ def transfer_shape_key(
|
|||||||
|
|
||||||
|
|
||||||
# ATTRIBUTE
|
# 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):
|
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):
|
def attribute_is_missing(transfer_info):
|
||||||
return transfer_core.transfer_info_is_missing(
|
obj = transfer_info.id_data
|
||||||
transfer_info, constants.ATTRIBUTE_KEY, transfer_info.id_data.data.attributes
|
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):
|
def init_attributes(scene, obj):
|
||||||
@ -496,17 +515,16 @@ def init_attributes(scene, obj):
|
|||||||
transfer_data = obj.transfer_data_ownership
|
transfer_data = obj.transfer_data_ownership
|
||||||
task_layer_name = scene.asset_pipeline.task_layer_name
|
task_layer_name = scene.asset_pipeline.task_layer_name
|
||||||
type_key = constants.ATTRIBUTE_KEY
|
type_key = constants.ATTRIBUTE_KEY
|
||||||
list = obj.data.attributes
|
for atttribute in attributes_get_editable(obj.data.attributes):
|
||||||
for item in list:
|
if atttribute.is_required or atttribute.is_internal:
|
||||||
if item.is_required or item.is_internal:
|
|
||||||
continue
|
continue
|
||||||
# Only add new ownership transfer_info if vertex group doesn't have an owner
|
# Only add new ownership transfer_info if vertex group doesn't have an owner
|
||||||
matches = transfer_core.check_transfer_data_entry(
|
matches = transfer_core.check_transfer_data_entry(
|
||||||
transfer_data, item.name, type_key
|
transfer_data, atttribute.name, type_key
|
||||||
)
|
)
|
||||||
if len(matches) == 0:
|
if len(matches) == 0:
|
||||||
scene.asset_pipeline.add_temp_trasnfer_data(
|
scene.asset_pipeline.add_temp_trasnfer_data(
|
||||||
name=item.name,
|
name=atttribute.name,
|
||||||
owner=task_layer_name,
|
owner=task_layer_name,
|
||||||
type=type_key,
|
type=type_key,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
|
Loading…
Reference in New Issue
Block a user