Asset Pipeline v2 #145
@ -32,7 +32,7 @@ def ownership_transfer_data_cleanup(
|
||||
def ownership_get(
|
||||
local_col: bpy.types.Collection,
|
||||
scene: bpy.types.Scene,
|
||||
) -> list[bpy.types.Object]:
|
||||
) -> None:
|
||||
"""Find new transfer data owned by the local task layer.
|
||||
Marks items as owned by the local task layer if they are in the
|
||||
corrisponding task layer collection and have no owner.
|
||||
@ -47,7 +47,6 @@ def ownership_get(
|
||||
list[bpy.types.Object]: Returns a list of objects that have no owner and will not be included
|
||||
in the merge process
|
||||
"""
|
||||
invalid_objs = []
|
||||
task_layer_name = scene.asset_pipeline.task_layer_name
|
||||
task_layer_col_name = get_dict_tuple_item(
|
||||
constants.TASK_LAYER_TYPES, task_layer_name
|
||||
@ -60,13 +59,10 @@ def ownership_get(
|
||||
obj.asset_id_owner = task_layer_name
|
||||
# Skip items that have no owner
|
||||
if obj.asset_id_owner == "NONE":
|
||||
invalid_objs.append(obj)
|
||||
continue
|
||||
ownership_transfer_data_cleanup(obj, task_layer_name)
|
||||
transfer_core.init_transfer_data(scene, obj)
|
||||
|
||||
return invalid_objs
|
||||
|
||||
|
||||
def ownership_set(temp_transfer_data: bpy.types.CollectionProperty) -> None:
|
||||
"""Add new transfer data items on each object found in the
|
||||
@ -83,6 +79,30 @@ def ownership_set(temp_transfer_data: bpy.types.CollectionProperty) -> None:
|
||||
)
|
||||
|
||||
|
||||
def get_invalid_objects(
|
||||
local_col: bpy.types.Collection,
|
||||
scene: bpy.types.Scene,
|
||||
) -> list[bpy.types.Object]:
|
||||
# TODO Add Docstring
|
||||
# TODO Make common function to get task layer col via task layer name
|
||||
task_layer_name = 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)
|
||||
|
||||
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_name
|
||||
):
|
||||
invalid_obj.append(obj)
|
||||
return invalid_obj
|
||||
|
||||
|
||||
def remap_user(source_datablock: bpy.data, target_datablock: bpy.data) -> None:
|
||||
"""Remap datablock and append name to datablock that has been remapped
|
||||
|
||||
|
@ -130,7 +130,8 @@ class ASSETPIPE_OT_sync_with_publish(bpy.types.Operator):
|
||||
self.report({'ERROR'}, "Current File Name doesn't contain valid task layer")
|
||||
return {'CANCELLED'}
|
||||
|
||||
self._invalid_objs = core.ownership_get(local_col, context.scene)
|
||||
core.ownership_get(local_col, context.scene)
|
||||
self._invalid_objs = core.get_invalid_objects(local_col, context.scene)
|
||||
|
||||
# Default behaviour is to pull before pushing
|
||||
if self.push:
|
||||
|
Loading…
Reference in New Issue
Block a user