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.
5 changed files with 13 additions and 19 deletions
Showing only changes of commit b3ecbcd49b - Show all commits

View File

@ -7,8 +7,6 @@ from .asset_mapping import AssetTransferMapping
from . import constants from . import constants
# TODO refactor merge functions into a class based on AssetBuilder class of Asset Pipeline 1
def update_task_layer_objects( def update_task_layer_objects(
target_col: bpy.types.Collection, target_col: bpy.types.Collection,

View File

@ -17,9 +17,6 @@ class ASSETOWNERSHIP(bpy.types.PropertyGroup):
name="Transfer Data Type", name="Transfer Data Type",
items=constants.TRANSFER_DATA_TYPES, items=constants.TRANSFER_DATA_TYPES,
) )
id: bpy.props.PointerProperty(
type=bpy.types.Object
) # TODO REPLACE WITH ID_DATA AND DELETE
classes = (ASSETOWNERSHIP,) classes = (ASSETOWNERSHIP,)

View File

@ -30,7 +30,7 @@ def transfer_vertex_group(
def transfer_modifier(item, obj_target): def transfer_modifier(item, obj_target):
# remove old and sync existing modifiers # remove old and sync existing modifiers
obj_source = item.id obj_source = item.id_data
if obj_source == obj_target: if obj_source == obj_target:
return return
old_mod = obj_target.modifiers.get(item.name) 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): def transfer_material_slot(item, obj_target):
obj_source = item.id obj_source = item.id_data
if obj_source == obj_target: if obj_source == obj_target:
return return
# Delete existing material slot if exists # Delete existing material slot if exists

View File

@ -4,14 +4,15 @@ from . import transfer_functions, asset_suffix
def update_transfer_data_ownership(transfer_data_item, target_obj: bpy.types.Object): def update_transfer_data_ownership(transfer_data_item, target_obj: bpy.types.Object):
transfer_data_ownership = target_obj.transfer_data_ownership ownership = target_obj.transfer_data_ownership
transfer_items_names = [item.name for item in transfer_data_ownership] transfer_items_names = [item.name for item in ownership]
if transfer_data_item.name not in transfer_items_names: if transfer_data_item.name not in transfer_items_names:
new_item = transfer_data_ownership.add() transfer_data_add_entry(
new_item.name = transfer_data_item.name ownership,
new_item.owner = transfer_data_item.owner transfer_data_item.name,
new_item.type = transfer_data_item.type transfer_data_item.type,
new_item.id = target_obj transfer_data_item.owner,
)
def apply_transfer_data( def apply_transfer_data(
@ -22,14 +23,14 @@ def apply_transfer_data(
for item in transfer_data_list: for item in transfer_data_list:
for target_obj in target_objs: for target_obj in target_objs:
if asset_suffix.get_basename(target_obj.name) == asset_suffix.get_basename( if asset_suffix.get_basename(target_obj.name) == asset_suffix.get_basename(
item.id.name item.id_data.name
): ):
if item.type == "VERTEX_GROUP": if item.type == "VERTEX_GROUP":
transfer_functions.transfer_vertex_group( transfer_functions.transfer_vertex_group(
context=context, context=context,
vertex_group_name=item.name, vertex_group_name=item.name,
obj_source=target_obj, obj_source=target_obj,
obj_target=item.id, obj_target=item.id_data,
) )
if item.type == "MODIFIER": if item.type == "MODIFIER":
transfer_functions.transfer_modifier(item, target_obj) 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): def transfer_data_add_entry(ownership, name, td_type, task_layer_name):
obj = ownership.id_data
item = ownership.add() item = ownership.add()
item.name = name item.name = name
item.owner = task_layer_name.upper() item.owner = task_layer_name.upper()
item.type = td_type item.type = td_type
item.id = obj
## FUNCTIONS SPECFIC TO TRANSFER DATA TYPES ## FUNCTIONS SPECFIC TO TRANSFER DATA TYPES

View File

@ -23,7 +23,7 @@ class ASSETPIPE_PT_TestUI(bpy.types.Panel):
self.layout.prop(obj, "asset_id_owner") self.layout.prop(obj, "asset_id_owner")
for my_item in ownership: for my_item in ownership:
self.layout.label( 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}"
) )