Asset Pipeline v2 #145
@ -22,10 +22,46 @@ class ASSETPIPE_OT_push_test(bpy.types.Operator):
|
||||
bl_label = 'Push to 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 Current Task Layer
|
||||
push_obj = []
|
||||
for obj in task_layer_col.objects:
|
||||
if obj.asset_id_owner == current_task_layer:
|
||||
push_obj.append(obj)
|
||||
|
||||
# Delete existing root OBJ
|
||||
for obj in publish_col.objects:
|
||||
obj_root_name = obj.name.split('.')[0]
|
||||
if f"{obj_root_name}.PUB" in obj.name:
|
||||
bpy.data.objects.remove(obj)
|
||||
|
||||
# Link new obj to collection
|
||||
for obj in push_obj:
|
||||
obj_root_name = obj.name.split('.')[0]
|
||||
new_obj = obj.copy()
|
||||
new_obj.data = obj.data.copy()
|
||||
new_obj.name = f"{obj_root_name}.PUB"
|
||||
publish_col.objects.link(new_obj)
|
||||
|
||||
# Cosmetically move the obj for easier organization
|
||||
# TODO Remove this step
|
||||
new_obj.location[0] = 0
|
||||
new_obj.location[2] = 3
|
||||
|
||||
# TODO Move transferrable data onto obj owned by others
|
||||
# Find Transfer-Data in current TL
|
||||
# Find matching Target Object in Publish
|
||||
# Copy Transfer-Data
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
|
@ -20,7 +20,7 @@ def register():
|
||||
bpy.types.Object.asset_ownership = bpy.props.CollectionProperty(type=ASSETOWNERSHIP)
|
||||
bpy.types.Object.asset_id_owner = bpy.props.EnumProperty(
|
||||
name="ID Owner",
|
||||
items=[("NONE", "None", ""), ("MODEL", "Rigging", ""), ("RIG", "Modeling", "")],
|
||||
items=[("NONE", "None", ""), ("MODEL", "Modeling", ""), ("RIG", "Rigging", "")],
|
||||
)
|
||||
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:cb034f7920e413371c56f11d73735f36cf7c2c1302e6696b46b701b9dbde4b31
|
||||
size 891200
|
||||
oid sha256:9224d4dbb2b5f169ca9cf98d3da89dfd550167c7384575ecdc1a473adbb9e814
|
||||
size 901508
|
||||
|
@ -8,6 +8,9 @@ class ASSETPIPE_PT_TestUI(bpy.types.Panel):
|
||||
bl_label = "Test UI"
|
||||
|
||||
def draw(self, context: bpy.types.Context) -> None:
|
||||
self.layout.label(
|
||||
text=f"Active Task Layer: {context.collection.name.split('.')[-1]}"
|
||||
)
|
||||
self.layout.label(text="Test UI")
|
||||
self.layout.operator("assetpipe.update_ownership")
|
||||
self.layout.operator("assetpipe.push_test", icon="TRIA_UP")
|
||||
|
Loading…
Reference in New Issue
Block a user