Asset Pipeline v2 #145
@ -9,9 +9,26 @@ from .asset_mapping import AssetTransferMapping
|
||||
from . import constants
|
||||
|
||||
|
||||
def remove_old_ownership(obj, task_layer_name):
|
||||
ownership = obj.transfer_data_ownership
|
||||
to_remove = []
|
||||
for item in ownership:
|
||||
if constants.TASK_LAYER_KEYS[item["owner"]] == task_layer_name:
|
||||
if not (
|
||||
transfer_functions.verify_vertex_group(item)
|
||||
or transfer_functions.verify_modifiers(item)
|
||||
or transfer_functions.verify_modifiers(item)
|
||||
):
|
||||
to_remove.append(item.name)
|
||||
|
||||
for name in to_remove:
|
||||
ownership.remove(ownership.keys().index(name))
|
||||
|
||||
|
||||
def get_ownership(local_col: str, task_layer_name: str):
|
||||
new_transfer_data: Dict[bpy.props.CollectionProperty, str, str, str, str] = {}
|
||||
for obj in local_col.all_objects:
|
||||
remove_old_ownership(obj, task_layer_name)
|
||||
transfer_functions.get_vertex_groups(obj, task_layer_name, new_transfer_data)
|
||||
transfer_functions.get_material_slots(obj, task_layer_name, new_transfer_data)
|
||||
transfer_functions.get_modifiers(obj, task_layer_name, new_transfer_data)
|
||||
|
@ -8,6 +8,12 @@ from .. import asset_suffix, constants
|
||||
|
||||
|
||||
# VERTEX GROUPS
|
||||
def verify_vertex_group(item):
|
||||
obj = item.id_data
|
||||
if item.type == constants.VERTEX_GROUP_KEY and obj.vertex_groups.get(item["name"]):
|
||||
return True
|
||||
|
||||
|
||||
def get_vertex_groups(obj, task_layer_name, new_transfer_data):
|
||||
ownership = obj.transfer_data_ownership
|
||||
for vertex_group in obj.vertex_groups:
|
||||
@ -55,6 +61,12 @@ def transfer_vertex_group(
|
||||
|
||||
|
||||
# MODIFIERS
|
||||
def verify_modifiers(item):
|
||||
obj = item.id_data
|
||||
if item.type == constants.MODIFIER_KEY and obj.modifiers.get(item["name"]):
|
||||
return True
|
||||
|
||||
|
||||
def get_modifiers(obj, task_layer_name, new_transfer_data):
|
||||
ownership = obj.transfer_data_ownership
|
||||
for mod in obj.modifiers:
|
||||
@ -130,6 +142,14 @@ def transfer_modifier(item, obj_target):
|
||||
|
||||
|
||||
# MATERIAL SLOT
|
||||
def verify_material_slot(item):
|
||||
obj = item.id_data
|
||||
if item.type == constants.MATERIAL_SLOT_KEY and obj.material_slots.get(
|
||||
item["name"]
|
||||
):
|
||||
return True
|
||||
|
||||
|
||||
def get_material_slots(obj, task_layer_name, new_transfer_data):
|
||||
ownership = obj.transfer_data_ownership
|
||||
for slot in obj.material_slots:
|
||||
|
Loading…
Reference in New Issue
Block a user