Asset Pipeline v2 #145
@ -1,7 +1,7 @@
|
|||||||
import bpy
|
import bpy
|
||||||
from . import transfer_functions
|
from . import transfer_functions
|
||||||
|
|
||||||
from .. import constants
|
from .. import constants, asset_suffix
|
||||||
|
|
||||||
|
|
||||||
def copy_transfer_data_ownership(
|
def copy_transfer_data_ownership(
|
||||||
@ -178,3 +178,10 @@ def transfer_data_add_entry(
|
|||||||
transfer_info.owner = task_layer_name.upper()
|
transfer_info.owner = task_layer_name.upper()
|
||||||
transfer_info.type = td_type
|
transfer_info.type = td_type
|
||||||
return transfer_info
|
return transfer_info
|
||||||
|
|
||||||
|
|
||||||
|
def transfer_info_clean(obj, list):
|
||||||
|
transfer_data = obj.transfer_data_ownership
|
||||||
|
for item in list:
|
||||||
|
if not asset_suffix.get_basename(item.name) in transfer_data.keys():
|
||||||
|
list.remove(item)
|
||||||
|
@ -5,14 +5,13 @@ from .. import asset_suffix, constants
|
|||||||
|
|
||||||
|
|
||||||
## FUNCTIONS SPECFIC TO TRANSFER DATA TYPES
|
## FUNCTIONS SPECFIC TO TRANSFER DATA TYPES
|
||||||
def vertex_groups_clean(obj):
|
|
||||||
transfer_data = obj.transfer_data_ownership
|
|
||||||
for vertex_group in obj.vertex_groups:
|
|
||||||
if not vertex_group.name in transfer_data.keys():
|
|
||||||
obj.vertex_groups.remove(vertex_group)
|
|
||||||
|
|
||||||
|
|
||||||
# VERTEX GROUPS
|
# VERTEX GROUPS
|
||||||
|
def vertex_groups_clean(obj):
|
||||||
|
transfer_core.transfer_info_clean(obj, obj.vertex_groups)
|
||||||
|
|
||||||
|
|
||||||
def vertex_group_is_missing(transfer_info):
|
def vertex_group_is_missing(transfer_info):
|
||||||
obj = transfer_info.id_data
|
obj = transfer_info.id_data
|
||||||
if transfer_info.type == constants.VERTEX_GROUP_KEY and not obj.vertex_groups.get(
|
if transfer_info.type == constants.VERTEX_GROUP_KEY and not obj.vertex_groups.get(
|
||||||
@ -71,10 +70,7 @@ def transfer_vertex_group(
|
|||||||
def vertex_colors_clean(obj):
|
def vertex_colors_clean(obj):
|
||||||
if not obj.type == "MESH":
|
if not obj.type == "MESH":
|
||||||
return
|
return
|
||||||
transfer_data = obj.transfer_data_ownership
|
transfer_core.transfer_info_clean(obj, obj.data.vertex_colors)
|
||||||
for vertex_color in obj.data.vertex_colors:
|
|
||||||
if not asset_suffix.get_basename(vertex_color.name) in transfer_data.keys():
|
|
||||||
obj.vertex_colors.data.remove(vertex_color)
|
|
||||||
|
|
||||||
|
|
||||||
def vertex_color_is_missing(transfer_info):
|
def vertex_color_is_missing(transfer_info):
|
||||||
@ -132,10 +128,7 @@ def transfer_vertex_color(
|
|||||||
def uv_layer_clean(obj):
|
def uv_layer_clean(obj):
|
||||||
if not obj.type == "MESH":
|
if not obj.type == "MESH":
|
||||||
return
|
return
|
||||||
transfer_data = obj.transfer_data_ownership
|
transfer_core.transfer_info_clean(obj, obj.data.uv_layers)
|
||||||
for uv_layer in obj.data.uv_layers:
|
|
||||||
if not asset_suffix.get_basename(uv_layer.name) in transfer_data.keys():
|
|
||||||
obj.data.uv_layers.remove(uv_layer)
|
|
||||||
|
|
||||||
|
|
||||||
def uv_layer_is_missing(transfer_info):
|
def uv_layer_is_missing(transfer_info):
|
||||||
@ -190,10 +183,7 @@ def transfer_uv_layer(source_obj, target_obj, uv_name):
|
|||||||
|
|
||||||
# MODIFIERS
|
# MODIFIERS
|
||||||
def modifiers_clean(obj):
|
def modifiers_clean(obj):
|
||||||
transfer_data = obj.transfer_data_ownership
|
transfer_core.transfer_info_clean(obj, obj.modifiers)
|
||||||
for modifiers in obj.modifiers:
|
|
||||||
if not modifiers.name in transfer_data.keys():
|
|
||||||
obj.modifiers.remove(modifiers)
|
|
||||||
|
|
||||||
|
|
||||||
def modifier_is_missing(transfer_info):
|
def modifier_is_missing(transfer_info):
|
||||||
@ -277,10 +267,7 @@ def transfer_modifier(modifier_name, target_obj, source_obj):
|
|||||||
|
|
||||||
# CONSTRAINTS
|
# CONSTRAINTS
|
||||||
def constraints_clean(obj):
|
def constraints_clean(obj):
|
||||||
transfer_data = obj.transfer_data_ownership
|
transfer_core.transfer_info_clean(obj, obj.constraints)
|
||||||
for constraint in obj.constraints:
|
|
||||||
if not constraint.name in transfer_data.keys():
|
|
||||||
obj.constraints.remove(constraint)
|
|
||||||
|
|
||||||
|
|
||||||
def constraint_is_missing(transfer_info):
|
def constraint_is_missing(transfer_info):
|
||||||
@ -342,6 +329,7 @@ def transfer_constraint(constraint_name, target_obj, source_obj):
|
|||||||
|
|
||||||
# MATERIAL SLOT
|
# MATERIAL SLOT
|
||||||
def material_slot_clean(obj):
|
def material_slot_clean(obj):
|
||||||
|
# Material slots cannot use generic transfer_info_clean() function
|
||||||
transfer_data = obj.transfer_data_ownership
|
transfer_data = obj.transfer_data_ownership
|
||||||
for mat_slot in obj.material_slots:
|
for mat_slot in obj.material_slots:
|
||||||
if not asset_suffix.get_basename(mat_slot.name) in transfer_data.keys():
|
if not asset_suffix.get_basename(mat_slot.name) in transfer_data.keys():
|
||||||
|
Loading…
Reference in New Issue
Block a user