Asset Pipeline v2 #145
@ -7,8 +7,6 @@ from .asset_mapping import AssetTransferMapping
|
||||
|
||||
from . import constants
|
||||
|
||||
# TODO refactor merge functions into a class based on AssetBuilder class of Asset Pipeline 1
|
||||
|
||||
|
||||
def update_task_layer_objects(
|
||||
target_col: bpy.types.Collection,
|
||||
|
@ -17,9 +17,6 @@ class ASSETOWNERSHIP(bpy.types.PropertyGroup):
|
||||
name="Transfer Data Type",
|
||||
items=constants.TRANSFER_DATA_TYPES,
|
||||
)
|
||||
id: bpy.props.PointerProperty(
|
||||
type=bpy.types.Object
|
||||
) # TODO REPLACE WITH ID_DATA AND DELETE
|
||||
|
||||
|
||||
classes = (ASSETOWNERSHIP,)
|
||||
|
@ -30,7 +30,7 @@ def transfer_vertex_group(
|
||||
|
||||
def transfer_modifier(item, obj_target):
|
||||
# remove old and sync existing modifiers
|
||||
obj_source = item.id
|
||||
obj_source = item.id_data
|
||||
if obj_source == obj_target:
|
||||
return
|
||||
old_mod = obj_target.modifiers.get(item.name)
|
||||
@ -86,7 +86,7 @@ def transfer_modifier(item, obj_target):
|
||||
|
||||
|
||||
def transfer_material_slot(item, obj_target):
|
||||
obj_source = item.id
|
||||
obj_source = item.id_data
|
||||
if obj_source == obj_target:
|
||||
return
|
||||
# Delete existing material slot if exists
|
||||
|
@ -4,14 +4,15 @@ from . import transfer_functions, asset_suffix
|
||||
|
||||
|
||||
def update_transfer_data_ownership(transfer_data_item, target_obj: bpy.types.Object):
|
||||
transfer_data_ownership = target_obj.transfer_data_ownership
|
||||
transfer_items_names = [item.name for item in transfer_data_ownership]
|
||||
ownership = target_obj.transfer_data_ownership
|
||||
transfer_items_names = [item.name for item in ownership]
|
||||
if transfer_data_item.name not in transfer_items_names:
|
||||
new_item = transfer_data_ownership.add()
|
||||
new_item.name = transfer_data_item.name
|
||||
new_item.owner = transfer_data_item.owner
|
||||
new_item.type = transfer_data_item.type
|
||||
new_item.id = target_obj
|
||||
transfer_data_add_entry(
|
||||
ownership,
|
||||
transfer_data_item.name,
|
||||
transfer_data_item.type,
|
||||
transfer_data_item.owner,
|
||||
)
|
||||
|
||||
|
||||
def apply_transfer_data(
|
||||
@ -22,14 +23,14 @@ def apply_transfer_data(
|
||||
for item in transfer_data_list:
|
||||
for target_obj in target_objs:
|
||||
if asset_suffix.get_basename(target_obj.name) == asset_suffix.get_basename(
|
||||
item.id.name
|
||||
item.id_data.name
|
||||
):
|
||||
if item.type == "VERTEX_GROUP":
|
||||
transfer_functions.transfer_vertex_group(
|
||||
context=context,
|
||||
vertex_group_name=item.name,
|
||||
obj_source=target_obj,
|
||||
obj_target=item.id,
|
||||
obj_target=item.id_data,
|
||||
)
|
||||
if item.type == "MODIFIER":
|
||||
transfer_functions.transfer_modifier(item, target_obj)
|
||||
@ -47,12 +48,10 @@ def check_transfer_data_entry(ownership, key, td_type):
|
||||
|
||||
|
||||
def transfer_data_add_entry(ownership, name, td_type, task_layer_name):
|
||||
obj = ownership.id_data
|
||||
item = ownership.add()
|
||||
item.name = name
|
||||
item.owner = task_layer_name.upper()
|
||||
item.type = td_type
|
||||
item.id = obj
|
||||
|
||||
|
||||
## FUNCTIONS SPECFIC TO TRANSFER DATA TYPES
|
||||
|
@ -23,7 +23,7 @@ class ASSETPIPE_PT_TestUI(bpy.types.Panel):
|
||||
self.layout.prop(obj, "asset_id_owner")
|
||||
for my_item in ownership:
|
||||
self.layout.label(
|
||||
text=f"{my_item.name} : {my_item.owner} : {my_item.id.name}"
|
||||
text=f"{my_item.name} : {my_item.owner} : {my_item.id_data.name}"
|
||||
)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user