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.
Showing only changes of commit f7078b26f3 - Show all commits

View File

@ -12,7 +12,6 @@ from .naming import (
add_suffix_to_hierarchy, add_suffix_to_hierarchy,
remove_suffix_from_hierarchy, remove_suffix_from_hierarchy,
get_name_with_asset_prefix, get_name_with_asset_prefix,
get_task_layer_col_name,
get_id_type_name, get_id_type_name,
) )
@ -63,11 +62,10 @@ def ownership_get(
asset_pipe = scene.asset_pipeline asset_pipe = scene.asset_pipeline
asset_pipe.temp_transfer_data.clear() asset_pipe.temp_transfer_data.clear()
task_layer_key = asset_pipe.task_layer_name task_layer_key = asset_pipe.task_layer_name
task_layer_col_name = get_task_layer_col_name(task_layer_key) task_layer_objs = get_task_layer_objects()
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 task_layer_objs:
obj.asset_id_owner = task_layer_key obj.asset_id_owner = task_layer_key
obj.name = get_name_with_asset_prefix(obj.name) obj.name = get_name_with_asset_prefix(obj.name)
# Skip items that have no owner # Skip items that have no owner
@ -114,17 +112,13 @@ def get_invalid_objects(
list[bpy.types.Object]: List of Invalid Objects list[bpy.types.Object]: List of Invalid Objects
""" """
task_layer_key = scene.asset_pipeline.task_layer_name task_layer_key = scene.asset_pipeline.task_layer_name
task_layer_col_name = get_task_layer_col_name(task_layer_key) task_layer_objs = get_task_layer_objects()
task_layer_col = local_col.children.get(task_layer_col_name)
invalid_obj = [] invalid_obj = []
for obj in scene.objects: for obj in scene.objects:
if obj.asset_id_owner == "NONE": if obj.asset_id_owner == "NONE":
invalid_obj.append(obj) invalid_obj.append(obj)
if ( if obj not in task_layer_objs and obj.asset_id_owner == task_layer_key:
obj not in list(task_layer_col.all_objects)
and obj.asset_id_owner == task_layer_key
):
invalid_obj.append(obj) invalid_obj.append(obj)
return invalid_obj return invalid_obj
@ -273,3 +267,14 @@ def import_data_from_lib(
) )
return eval(f"bpy.data.{data_category}['{data_name}']") return eval(f"bpy.data.{data_category}['{data_name}']")
def get_task_layer_objects():
asset_pipe = bpy.context.scene.asset_pipeline
task_layer_key = asset_pipe.task_layer_name
local_col = asset_pipe.asset_collection
task_layer_objs = []
for col in local_col.children:
if col.asset_id_owner == task_layer_key:
task_layer_objs = task_layer_objs + list(col.all_objects)
return task_layer_objs