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 80ecf237c0 - Show all commits

View File

@ -26,16 +26,16 @@ def merge_task_layer(
): ):
local_col = bpy.data.collections[col_base_name] local_col = bpy.data.collections[col_base_name]
local_suffix = "LOCAL" local_suffix = "LOCAL"
source_suffix = "SOURCE" external_suffix = "EXTERNAL"
target_suffix = "TARGET" target_suffix = "TARGET"
asset_suffix.add_suffix_to_hierarchy(local_col, local_suffix) asset_suffix.add_suffix_to_hierarchy(local_col, local_suffix)
import_data_from_lib(target_file, "collections", col_base_name) import_data_from_lib(target_file, "collections", col_base_name)
appended_col = bpy.data.collections[col_base_name] # find appended data appended_col = bpy.data.collections[col_base_name] # find appended data
asset_suffix.add_suffix_to_hierarchy(appended_col, source_suffix) asset_suffix.add_suffix_to_hierarchy(appended_col, external_suffix)
local_col = bpy.data.collections[f"{col_base_name}.{local_suffix}"] local_col = bpy.data.collections[f"{col_base_name}.{local_suffix}"]
source_col = bpy.data.collections[f"{col_base_name}.{source_suffix}"] external_col = bpy.data.collections[f"{col_base_name}.{external_suffix}"]
target_col = bpy.data.collections.new(f"{col_base_name}.{target_suffix}") target_col = bpy.data.collections.new(f"{col_base_name}.{target_suffix}")
# TODO Make sure we preserve the collection hirearchies instead of having one flat col # TODO Make sure we preserve the collection hirearchies instead of having one flat col
@ -44,16 +44,16 @@ def merge_task_layer(
context.scene.collection.children.unlink(local_col) context.scene.collection.children.unlink(local_col)
# Find Obj owned by other Current Task Layer # Find Obj owned by other Current Task Layer
source_transfer_objs = [] external_transfer_objs = []
transfer_data = [] transfer_data = []
for obj in source_col.objects: for obj in external_col.objects:
if obj.asset_id_owner not in local_tls: if obj.asset_id_owner not in local_tls:
source_transfer_objs.append(obj) external_transfer_objs.append(obj)
# Find Transfer-Data in other Task Layers # Find Transfer-Data in other Task Layers
for item in obj.transfer_data_ownership: for item in obj.transfer_data_ownership:
if item.owner not in local_tls: if item.owner not in local_tls:
transfer_data.append(item) transfer_data.append(item)
update_task_layer_objects(target_col, source_transfer_objs) update_task_layer_objects(target_col, external_transfer_objs)
local_objs = [] local_objs = []
for obj in local_col.objects: for obj in local_col.objects:
@ -154,10 +154,10 @@ def remap_user(datablock, target_name):
def remap_external_datablocks(context): def remap_external_datablocks(context):
source_suffix = ".SOURCE" external_suffix = ".EXTERNAL"
target_suffix = ".LOCAL" target_suffix = ".LOCAL"
datablocks = remap_get_data_blocks(context, source_suffix) datablocks = remap_get_data_blocks(context, external_suffix)
for datablock in datablocks: for datablock in datablocks:
target_name = datablock.name.replace(source_suffix, target_suffix) target_name = datablock.name.replace(external_suffix, target_suffix)
remap_user(datablock, target_name) remap_user(datablock, target_name)