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 18 additions and 23 deletions
Showing only changes of commit 0802febdda - Show all commits

View File

@ -47,20 +47,17 @@ def ownership_get(
list[bpy.types.Object]: Returns a list of objects that have no owner and will not be included list[bpy.types.Object]: Returns a list of objects that have no owner and will not be included
in the merge process in the merge process
""" """
task_layer_name = scene.asset_pipeline.task_layer_name task_layer_key = scene.asset_pipeline.task_layer_name
task_layer_col_name = get_dict_tuple_item(
constants.TASK_LAYER_TYPES, task_layer_name
)[1]
scene.asset_pipeline.temp_transfer_data.clear() scene.asset_pipeline.temp_transfer_data.clear()
task_layer_col = local_col.children.get(task_layer_col_name) task_layer_col = local_col.children.get(task_layer_col_name)
for obj in local_col.all_objects: for obj in local_col.all_objects:
# Mark Asset ID Owner for objects in the current task layers collection # Mark Asset ID Owner for objects in the current task layers collection
if obj.asset_id_owner == "NONE" and obj in list(task_layer_col.all_objects): if obj.asset_id_owner == "NONE" and obj in list(task_layer_col.all_objects):
obj.asset_id_owner = task_layer_name obj.asset_id_owner = task_layer_key
# Skip items that have no owner # Skip items that have no owner
if obj.asset_id_owner == "NONE": if obj.asset_id_owner == "NONE":
continue continue
ownership_transfer_data_cleanup(obj, task_layer_name) ownership_transfer_data_cleanup(obj, task_layer_key)
transfer_core.init_transfer_data(scene, obj) transfer_core.init_transfer_data(scene, obj)
@ -85,10 +82,7 @@ def get_invalid_objects(
) -> list[bpy.types.Object]: ) -> list[bpy.types.Object]:
# TODO Add Docstring # TODO Add Docstring
# TODO Make common function to get task layer col via task layer name # TODO Make common function to get task layer col via task layer name
task_layer_name = scene.asset_pipeline.task_layer_name task_layer_key = scene.asset_pipeline.task_layer_name
task_layer_col_name = get_dict_tuple_item(
constants.TASK_LAYER_TYPES, task_layer_name
)[1]
task_layer_col = local_col.children.get(task_layer_col_name) task_layer_col = local_col.children.get(task_layer_col_name)
invalid_obj = [] invalid_obj = []
@ -97,7 +91,7 @@ def get_invalid_objects(
invalid_obj.append(obj) invalid_obj.append(obj)
if ( if (
obj not in list(task_layer_col.all_objects) obj not in list(task_layer_col.all_objects)
and obj.asset_id_owner == task_layer_name and obj.asset_id_owner == task_layer_key
): ):
invalid_obj.append(obj) invalid_obj.append(obj)
return invalid_obj return invalid_obj

View File

@ -125,8 +125,8 @@ class ASSETPIPE_OT_sync_with_publish(bpy.types.Operator):
if not local_col: if not local_col:
self.report({'ERROR'}, "Top level collection could not be found") self.report({'ERROR'}, "Top level collection could not be found")
return {'CANCELLED'} return {'CANCELLED'}
task_layer_name = context.scene.asset_pipeline.task_layer_name task_layer_key = context.scene.asset_pipeline.task_layer_name
if task_layer_name == "NONE": if task_layer_key == "NONE":
self.report({'ERROR'}, "Current File Name doesn't contain valid task layer") self.report({'ERROR'}, "Current File Name doesn't contain valid task layer")
return {'CANCELLED'} return {'CANCELLED'}
@ -183,8 +183,8 @@ class ASSETPIPE_OT_sync_with_publish(bpy.types.Operator):
core.ownership_set(temp_transfer_data) core.ownership_set(temp_transfer_data)
current_file = Path(bpy.data.filepath) current_file = Path(bpy.data.filepath)
temp_dir = Path(bpy.app.tempdir).parent temp_dir = Path(bpy.app.tempdir).parent
task_layer_name = context.scene.asset_pipeline.task_layer_name task_layer_key = context.scene.asset_pipeline.task_layer_name
if task_layer_name == "NONE": if task_layer_key == "NONE":
self.report({'ERROR'}, "Current File Name doesn't contain valid task layer") self.report({'ERROR'}, "Current File Name doesn't contain valid task layer")
return {'CANCELLED'} return {'CANCELLED'}
@ -200,7 +200,7 @@ class ASSETPIPE_OT_sync_with_publish(bpy.types.Operator):
bpy.ops.wm.save_as_mainfile(filepath=temp_file.__str__(), copy=True) bpy.ops.wm.save_as_mainfile(filepath=temp_file.__str__(), copy=True)
error_msg = core.merge_task_layer( error_msg = core.merge_task_layer(
context, context,
local_tls=[task_layer_name], local_tls=[task_layer_key],
external_file=sync_target, external_file=sync_target,
) )
@ -231,7 +231,7 @@ class ASSETPIPE_OT_sync_with_publish(bpy.types.Operator):
local_tls = [ local_tls = [
task_layer task_layer
for task_layer in constants.TASK_LAYER_KEYS for task_layer in constants.TASK_LAYER_KEYS
if task_layer != task_layer_name if task_layer != task_layer_key
] ]
error_msg = core.merge_task_layer( error_msg = core.merge_task_layer(

View File

@ -51,6 +51,7 @@ class AssetPipeline(bpy.types.PropertyGroup):
temp_transfer_data: bpy.props.CollectionProperty(type=AssetTransferDataTemp) temp_transfer_data: bpy.props.CollectionProperty(type=AssetTransferDataTemp)
# TODO Rename to Current_Task_Layer
task_layer_name: bpy.props.EnumProperty( task_layer_name: bpy.props.EnumProperty(
name="Task Layer Name", items=constants.TASK_LAYER_TYPES name="Task Layer Name", items=constants.TASK_LAYER_TYPES
) )

View File

@ -226,14 +226,14 @@ def transfer_info_is_missing(transfer_info, type_key, list):
def transfer_info_init(scene, obj, list, type_key): def transfer_info_init(scene, obj, list, type_key):
transfer_data = obj.transfer_data_ownership transfer_data = obj.transfer_data_ownership
task_layer_name = scene.asset_pipeline.task_layer_name task_layer_key = scene.asset_pipeline.task_layer_name
for item in list: for item in list:
# Only add new ownership transfer_info if vertex group doesn't have an owner # Only add new ownership transfer_info if vertex group doesn't have an owner
matches = check_transfer_data_entry(transfer_data, item.name, type_key) matches = check_transfer_data_entry(transfer_data, item.name, type_key)
if len(matches) == 0: if len(matches) == 0:
scene.asset_pipeline.add_temp_trasnfer_data( scene.asset_pipeline.add_temp_trasnfer_data(
name=item.name, name=item.name,
owner=task_layer_name, owner=task_layer_key,
type=type_key, type=type_key,
obj=obj, obj=obj,
) )

View File

@ -311,7 +311,7 @@ def material_slots_is_missing(transfer_info):
def init_material_slots(scene, obj): def init_material_slots(scene, obj):
task_layer_name = scene.asset_pipeline.task_layer_name task_layer_key = scene.asset_pipeline.task_layer_name
type_key = constants.MATERIAL_SLOT_KEY type_key = constants.MATERIAL_SLOT_KEY
name = constants.MATERIAL_TRANSFER_INFO_NAME name = constants.MATERIAL_TRANSFER_INFO_NAME
transfer_data = obj.transfer_data_ownership transfer_data = obj.transfer_data_ownership
@ -324,7 +324,7 @@ def init_material_slots(scene, obj):
if len(matches) == 0: if len(matches) == 0:
scene.asset_pipeline.add_temp_trasnfer_data( scene.asset_pipeline.add_temp_trasnfer_data(
name=name, name=name,
owner=task_layer_name, owner=task_layer_key,
type=type_key, type=type_key,
obj=obj, obj=obj,
) )
@ -549,7 +549,7 @@ def init_attributes(scene, obj):
if obj.type != "MESH": if obj.type != "MESH":
return return
transfer_data = obj.transfer_data_ownership transfer_data = obj.transfer_data_ownership
task_layer_name = scene.asset_pipeline.task_layer_name task_layer_key = scene.asset_pipeline.task_layer_name
type_key = constants.ATTRIBUTE_KEY type_key = constants.ATTRIBUTE_KEY
for atttribute in attributes_get_editable(obj.data.attributes): for atttribute in attributes_get_editable(obj.data.attributes):
# Only add new ownership transfer_info if vertex group doesn't have an owner # Only add new ownership transfer_info if vertex group doesn't have an owner
@ -559,7 +559,7 @@ def init_attributes(scene, obj):
if len(matches) == 0: if len(matches) == 0:
scene.asset_pipeline.add_temp_trasnfer_data( scene.asset_pipeline.add_temp_trasnfer_data(
name=atttribute.name, name=atttribute.name,
owner=task_layer_name, owner=task_layer_key,
type=type_key, type=type_key,
obj=obj, obj=obj,
) )