Asset Pipeline v2 #145
@ -3,7 +3,7 @@ import bpy
|
|||||||
|
|
||||||
def update_transfer_data(transfer_data_item, target_obj):
|
def update_transfer_data(transfer_data_item, target_obj):
|
||||||
transfer_data_ownership = target_obj.transfer_data_ownership
|
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 = transfer_data_ownership.add()
|
||||||
new_item.name = transfer_data_item.name
|
new_item.name = transfer_data_item.name
|
||||||
new_item.owner = transfer_data_item.owner
|
new_item.owner = transfer_data_item.owner
|
||||||
|
@ -93,10 +93,64 @@ class ASSETPIPE_OT_pull_test(bpy.types.Operator):
|
|||||||
bl_label = 'Pull from Publish'
|
bl_label = 'Pull from Publish'
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
if self.text != "test":
|
# Find current task Layer
|
||||||
self.report({'ERROR'}, "Failure")
|
obj = context.active_object
|
||||||
return {'CANCELLED'}
|
task_layer_col = context.collection
|
||||||
self.report({'INFO'}, "Success")
|
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'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:64c2d168bfc8b4c7234cbf48c1b0fdf36cafa0386ec236eaace4a02a0e3d2dae
|
oid sha256:86f69fe0a46e5fda1969db982365d9f83ce623c381b45cdc581c646f8ecc2bf5
|
||||||
size 920988
|
size 890968
|
||||||
|
Loading…
Reference in New Issue
Block a user