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.
3 changed files with 61 additions and 7 deletions
Showing only changes of commit a07866ec41 - Show all commits

View File

@ -3,7 +3,7 @@ import bpy
def update_transfer_data(transfer_data_item, target_obj):
transfer_data_ownership = target_obj.transfer_data_ownership
if transfer_data_item not in transfer_data_ownership.items():
if transfer_data_item.name not in transfer_data_ownership.items():
new_item = transfer_data_ownership.add()
new_item.name = transfer_data_item.name
new_item.owner = transfer_data_item.owner

View File

@ -93,10 +93,64 @@ class ASSETPIPE_OT_pull_test(bpy.types.Operator):
bl_label = 'Pull from Publish'
def execute(self, context):
if self.text != "test":
self.report({'ERROR'}, "Failure")
return {'CANCELLED'}
self.report({'INFO'}, "Success")
# Find current task Layer
obj = context.active_object
task_layer_col = context.collection
current_task_layer = task_layer_col.name.split('.')[-1]
# Find PUBLUSH Collection
for col in context.scene.collection.children_recursive:
if "PUB" in col.name:
publish_col = col
# Find Obj owned by other Current Task Layer
pull_objs = []
transfer_data = []
for obj in publish_col.objects:
if obj.asset_id_owner != current_task_layer:
pull_objs.append(obj)
# Find Transfer-Data in other Task Layers
for item in obj.transfer_data_ownership:
if item.owner != current_task_layer:
transfer_data.append(item)
# Delete existing root OBJ
# TODO FIX
# for obj in publish_col.objects:
# obj_root_name = obj.name.split('.')[0]
# for pull_obj in pull_objs:
# if f"{obj_root_name}.{current_task_layer}" == pull_obj.name:
# bpy.data.objects.remove(obj)
# # Link new obj to collection
for obj in pull_objs:
obj_root_name = obj.name.split('.')[0]
new_obj = obj.copy()
new_obj.data = obj.data.copy()
new_obj.name = f"{obj_root_name}.{current_task_layer}"
task_layer_col.objects.link(new_obj)
# Cosmetically move the obj for easier organization
# TODO Remove this step
new_obj.location[0] = 3
new_obj.location[2] = 0
# TODO Move transferrable data onto obj owned by others
for item in transfer_data:
for obj in task_layer_col.objects:
if obj.name.split(".")[0] == item.id.name.split(".")[0]:
transfer_functions.transfer_vertex_group(
context=context,
vertex_group_name=item.name,
source_obj=bpy.data.objects[
f"{item.id.name.split('.')[0]}.PUB"
],
target_obj=obj,
)
core.update_transfer_data(
transfer_data_item=item,
target_obj=obj,
)
return {'FINISHED'}

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:64c2d168bfc8b4c7234cbf48c1b0fdf36cafa0386ec236eaace4a02a0e3d2dae
size 920988
oid sha256:86f69fe0a46e5fda1969db982365d9f83ce623c381b45cdc581c646f8ecc2bf5
size 890968