Asset Pipeline v2 #145
@ -12,7 +12,6 @@ from .naming import (
|
||||
add_suffix_to_hierarchy,
|
||||
remove_suffix_from_hierarchy,
|
||||
get_name_with_asset_prefix,
|
||||
get_task_layer_col_name,
|
||||
get_id_type_name,
|
||||
)
|
||||
|
||||
@ -63,11 +62,10 @@ def ownership_get(
|
||||
asset_pipe = scene.asset_pipeline
|
||||
asset_pipe.temp_transfer_data.clear()
|
||||
task_layer_key = asset_pipe.task_layer_name
|
||||
task_layer_col_name = get_task_layer_col_name(task_layer_key)
|
||||
task_layer_col = local_col.children.get(task_layer_col_name)
|
||||
task_layer_objs = get_task_layer_objects()
|
||||
for obj in local_col.all_objects:
|
||||
# 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.name = get_name_with_asset_prefix(obj.name)
|
||||
# Skip items that have no owner
|
||||
@ -114,17 +112,13 @@ def get_invalid_objects(
|
||||
list[bpy.types.Object]: List of Invalid Objects
|
||||
"""
|
||||
task_layer_key = scene.asset_pipeline.task_layer_name
|
||||
task_layer_col_name = get_task_layer_col_name(task_layer_key)
|
||||
task_layer_col = local_col.children.get(task_layer_col_name)
|
||||
task_layer_objs = get_task_layer_objects()
|
||||
|
||||
invalid_obj = []
|
||||
for obj in scene.objects:
|
||||
if obj.asset_id_owner == "NONE":
|
||||
invalid_obj.append(obj)
|
||||
if (
|
||||
obj not in list(task_layer_col.all_objects)
|
||||
and obj.asset_id_owner == task_layer_key
|
||||
):
|
||||
if obj not in task_layer_objs and obj.asset_id_owner == task_layer_key:
|
||||
invalid_obj.append(obj)
|
||||
return invalid_obj
|
||||
|
||||
@ -273,3 +267,14 @@ def import_data_from_lib(
|
||||
)
|
||||
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user