Asset Pipeline v2 #145
@ -144,6 +144,12 @@ def apply_transfer_data(context: bpy.types.Context, transfer_data_map) -> None:
|
|||||||
source_obj=source_obj,
|
source_obj=source_obj,
|
||||||
shape_key_name=transfer_info.name,
|
shape_key_name=transfer_info.name,
|
||||||
)
|
)
|
||||||
|
if transfer_info.type == constants.ATTRIBUTE_KEY:
|
||||||
|
transfer_functions.transfer_attribute(
|
||||||
|
target_obj=target_obj,
|
||||||
|
source_obj=source_obj,
|
||||||
|
attribute_name=transfer_info.name,
|
||||||
|
)
|
||||||
|
|
||||||
copy_transfer_data_ownership(
|
copy_transfer_data_ownership(
|
||||||
transfer_data_item=transfer_info,
|
transfer_data_item=transfer_info,
|
||||||
|
@ -529,3 +529,33 @@ def init_attributes(scene, obj):
|
|||||||
type=type_key,
|
type=type_key,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def transfer_attribute(
|
||||||
|
attribute_name: str,
|
||||||
|
target_obj: bpy.types.Object,
|
||||||
|
source_obj: bpy.types.Object,
|
||||||
|
):
|
||||||
|
source_attributes = source_obj.data.attributes
|
||||||
|
target_attributes = target_obj.data.attributes
|
||||||
|
source_attribute = source_attributes.get(attribute_name)
|
||||||
|
|
||||||
|
target_attribute = target_attributes.get(attribute_name)
|
||||||
|
if target_attribute:
|
||||||
|
target_attributes.remove(target_attribute)
|
||||||
|
|
||||||
|
target_attribute = target_attributes.new(
|
||||||
|
name=attribute_name,
|
||||||
|
type=source_attribute.data_type,
|
||||||
|
domain=source_attribute.domain,
|
||||||
|
)
|
||||||
|
|
||||||
|
for source_data_item in source_attribute.data.items():
|
||||||
|
index = source_data_item[0]
|
||||||
|
source_data = source_data_item[1]
|
||||||
|
keys = set(source_data.bl_rna.properties.keys()) - set(
|
||||||
|
bpy.types.Attribute.bl_rna.properties.keys()
|
||||||
|
)
|
||||||
|
for key in list(keys):
|
||||||
|
target_data = target_attribute.data[index]
|
||||||
|
setattr(target_data, key, getattr(source_data, key))
|
||||||
|
Loading…
Reference in New Issue
Block a user