Asset Pipeline v2 #145

Closed
Nick Alberelli wants to merge 431 commits from (deleted):feature/asset-pipeline-v2 into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Showing only changes of commit 79915cf19c - Show all commits

View File

@ -263,12 +263,14 @@ def transfer_constraint(constraint_name, target_obj, source_obj):
# MATERIAL SLOT
def material_slot_clean(obj):
# Material slots cannot use generic transfer_info_clean() function
context = bpy.context # TODO pass context here
transfer_data = obj.transfer_data_ownership
for mat_slot in obj.material_slots:
if not asset_suffix.get_basename(mat_slot.name) in transfer_data.keys():
index = obj.material_slots.keys().index(mat_slot.name)
obj.active_material_index = index
bpy.ops.object.material_slot_remove({"object": obj})
with context.temp_override(object=obj):
bpy.ops.object.material_slot_remove()
def material_slot_is_missing(transfer_info):
@ -285,11 +287,13 @@ def init_material_slots(scene, obj):
def transfer_material_slot(material_slot_name, target_obj, source_obj):
# Delete existing material slot if exists
context = bpy.context # TODO pass context here
for idx in range(len(source_obj.material_slots)):
slot = source_obj.material_slots[idx]
if asset_suffix.get_basename(slot.material.name) == material_slot_name:
target_obj.active_material_index = idx
bpy.ops.object.material_slot_remove({"object": target_obj})
with context.temp_override(object=target_obj):
bpy.ops.object.material_slot_remove()
# Transfer material slots
@ -297,7 +301,8 @@ def transfer_material_slot(material_slot_name, target_obj, source_obj):
if idx >= len(target_obj.material_slots):
slot = source_obj.material_slots[idx]
if asset_suffix.get_basename(slot.material.name) == material_slot_name:
bpy.ops.object.material_slot_add({"object": target_obj})
with context.temp_override(object=target_obj):
bpy.ops.object.material_slot_add()
target_obj.material_slots[idx].link = source_obj.material_slots[
idx
].link