Asset Pipeline v2 #145
@ -190,3 +190,18 @@ def transfer_info_clean(obj, list):
|
|||||||
def transfer_info_is_missing(transfer_info, type_key, list):
|
def transfer_info_is_missing(transfer_info, type_key, list):
|
||||||
if transfer_info.type == type_key and not list.get(transfer_info["name"]):
|
if transfer_info.type == type_key and not list.get(transfer_info["name"]):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def transfer_info_init(scene, obj, list, type_key):
|
||||||
|
transfer_data = obj.transfer_data_ownership
|
||||||
|
task_layer_name = scene.asset_pipeline.task_layer_name
|
||||||
|
for item in list:
|
||||||
|
# Only add new ownership transfer_info if vertex group doesn't have an owner
|
||||||
|
matches = check_transfer_data_entry(transfer_data, item.name, type_key)
|
||||||
|
if len(matches) == 0:
|
||||||
|
scene.asset_pipeline.add_temp_trasnfer_data(
|
||||||
|
name=item.name,
|
||||||
|
owner=task_layer_name,
|
||||||
|
type=type_key,
|
||||||
|
obj=obj,
|
||||||
|
)
|
||||||
|
@ -19,20 +19,8 @@ def vertex_group_is_missing(transfer_info):
|
|||||||
|
|
||||||
|
|
||||||
def init_vertex_groups(scene, obj):
|
def init_vertex_groups(scene, obj):
|
||||||
transfer_data = obj.transfer_data_ownership
|
transfer_core.transfer_info_init(
|
||||||
task_layer_name = scene.asset_pipeline.task_layer_name
|
scene, obj, obj.vertex_groups, constants.VERTEX_GROUP_KEY
|
||||||
td_type = constants.VERTEX_GROUP_KEY
|
|
||||||
for vertex_group in obj.vertex_groups:
|
|
||||||
# Only add new ownership transfer_info if vertex group doesn't have an owner
|
|
||||||
matches = transfer_core.check_transfer_data_entry(
|
|
||||||
transfer_data, vertex_group.name, td_type
|
|
||||||
)
|
|
||||||
if len(matches) == 0:
|
|
||||||
scene.asset_pipeline.add_temp_trasnfer_data(
|
|
||||||
name=vertex_group.name,
|
|
||||||
owner=task_layer_name,
|
|
||||||
type=td_type,
|
|
||||||
obj=obj,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -78,22 +66,10 @@ def vertex_color_is_missing(transfer_info):
|
|||||||
|
|
||||||
|
|
||||||
def init_vertex_colors(scene, obj):
|
def init_vertex_colors(scene, obj):
|
||||||
transfer_data = obj.transfer_data_ownership
|
|
||||||
task_layer_name = scene.asset_pipeline.task_layer_name
|
|
||||||
td_type = constants.VERTEX_COLOR_KEY
|
|
||||||
if not obj.type == "MESH":
|
if not obj.type == "MESH":
|
||||||
return
|
return
|
||||||
for vertex_color in obj.data.vertex_colors:
|
transfer_core.transfer_info_init(
|
||||||
# Only add new ownership transfer_info if vertex color doesn't have an owner
|
scene, obj, obj.data.vertex_colors, constants.VERTEX_COLOR_KEY
|
||||||
matches = transfer_core.check_transfer_data_entry(
|
|
||||||
transfer_data, vertex_color.name, td_type
|
|
||||||
)
|
|
||||||
if len(matches) == 0:
|
|
||||||
scene.asset_pipeline.add_temp_trasnfer_data(
|
|
||||||
name=vertex_color.name,
|
|
||||||
owner=task_layer_name,
|
|
||||||
type=td_type,
|
|
||||||
obj=obj,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -133,22 +109,10 @@ def uv_layer_is_missing(transfer_info):
|
|||||||
|
|
||||||
|
|
||||||
def init_uv_layers(scene, obj):
|
def init_uv_layers(scene, obj):
|
||||||
transfer_data = obj.transfer_data_ownership
|
|
||||||
task_layer_name = scene.asset_pipeline.task_layer_name
|
|
||||||
td_type = constants.UV_LAYERS_KEY
|
|
||||||
if not obj.type == "MESH":
|
if not obj.type == "MESH":
|
||||||
return
|
return
|
||||||
for uv_layer in obj.data.uv_layers:
|
transfer_core.transfer_info_init(
|
||||||
# Only add new ownership transfer_info if vertex color doesn't have an owner
|
scene, obj, obj.data.uv_layers, constants.UV_LAYERS_KEY
|
||||||
matches = transfer_core.check_transfer_data_entry(
|
|
||||||
transfer_data, uv_layer.name, td_type
|
|
||||||
)
|
|
||||||
if len(matches) == 0:
|
|
||||||
scene.asset_pipeline.add_temp_trasnfer_data(
|
|
||||||
name=uv_layer.name,
|
|
||||||
owner=task_layer_name,
|
|
||||||
type=td_type,
|
|
||||||
obj=obj,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -186,20 +150,7 @@ def modifier_is_missing(transfer_info):
|
|||||||
|
|
||||||
|
|
||||||
def init_modifiers(scene, obj):
|
def init_modifiers(scene, obj):
|
||||||
task_layer_name = scene.asset_pipeline.task_layer_name
|
transfer_core.transfer_info_init(scene, obj, obj.modifiers, constants.MODIFIER_KEY)
|
||||||
transfer_data = obj.transfer_data_ownership
|
|
||||||
td_type = constants.MODIFIER_KEY
|
|
||||||
for mod in obj.modifiers:
|
|
||||||
matches = transfer_core.check_transfer_data_entry(
|
|
||||||
transfer_data, mod.name, td_type
|
|
||||||
)
|
|
||||||
if len(matches) == 0:
|
|
||||||
scene.asset_pipeline.add_temp_trasnfer_data(
|
|
||||||
name=mod.name,
|
|
||||||
owner=task_layer_name,
|
|
||||||
type=td_type,
|
|
||||||
obj=obj,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def transfer_modifier(modifier_name, target_obj, source_obj):
|
def transfer_modifier(modifier_name, target_obj, source_obj):
|
||||||
@ -268,19 +219,8 @@ def constraint_is_missing(transfer_info):
|
|||||||
|
|
||||||
|
|
||||||
def init_constraints(scene, obj):
|
def init_constraints(scene, obj):
|
||||||
task_layer_name = scene.asset_pipeline.task_layer_name
|
transfer_core.transfer_info_init(
|
||||||
transfer_data = obj.transfer_data_ownership
|
scene, obj, obj.constraints, constants.CONSTRAINT_KEY
|
||||||
td_type = constants.CONSTRAINT_KEY
|
|
||||||
for constraint in obj.constraints:
|
|
||||||
matches = transfer_core.check_transfer_data_entry(
|
|
||||||
transfer_data, constraint.name, td_type
|
|
||||||
)
|
|
||||||
if len(matches) == 0:
|
|
||||||
scene.asset_pipeline.add_temp_trasnfer_data(
|
|
||||||
name=constraint.name,
|
|
||||||
owner=task_layer_name,
|
|
||||||
type=td_type,
|
|
||||||
obj=obj,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -334,19 +274,8 @@ def material_slot_is_missing(transfer_info):
|
|||||||
|
|
||||||
|
|
||||||
def init_material_slots(scene, obj):
|
def init_material_slots(scene, obj):
|
||||||
task_layer_name = scene.asset_pipeline.task_layer_name
|
transfer_core.transfer_info_init(
|
||||||
transfer_data = obj.transfer_data_ownership
|
scene, obj, obj.material_slots, constants.MATERIAL_SLOT_KEY
|
||||||
td_type = constants.MATERIAL_SLOT_KEY
|
|
||||||
for slot in obj.material_slots:
|
|
||||||
matches = transfer_core.check_transfer_data_entry(
|
|
||||||
transfer_data, slot.name, td_type
|
|
||||||
)
|
|
||||||
if len(matches) == 0:
|
|
||||||
scene.asset_pipeline.add_temp_trasnfer_data(
|
|
||||||
name=slot.name,
|
|
||||||
owner=task_layer_name,
|
|
||||||
type=td_type,
|
|
||||||
obj=obj,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user