Asset Pipeline v2 #145
@ -15,6 +15,8 @@ class ASSETPIPE_OT_sync_with_publish(bpy.types.Operator):
|
|||||||
bl_label = "Sync with Publish"
|
bl_label = "Sync with Publish"
|
||||||
bl_description = """Push and or Pull data from Published file. Will prompt with a list of new data found before pushing"""
|
bl_description = """Push and or Pull data from Published file. Will prompt with a list of new data found before pushing"""
|
||||||
|
|
||||||
|
_temp_ownership = None
|
||||||
|
|
||||||
save: bpy.props.BoolProperty(
|
save: bpy.props.BoolProperty(
|
||||||
name="Save Current File",
|
name="Save Current File",
|
||||||
default=True,
|
default=True,
|
||||||
@ -32,9 +34,8 @@ class ASSETPIPE_OT_sync_with_publish(bpy.types.Operator):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def invoke(self, context: bpy.types.Context, event: bpy.types.Event):
|
def invoke(self, context: bpy.types.Context, event: bpy.types.Event):
|
||||||
# TODO Store ownership in self for easier access?
|
self._temp_ownership = context.scene.temp_transfer_data_ownership
|
||||||
ownership = context.scene.temp_transfer_data_ownership
|
self._temp_ownership.clear()
|
||||||
ownership.clear()
|
|
||||||
|
|
||||||
local_col = bpy.data.collections.get(get_parent_col_name())
|
local_col = bpy.data.collections.get(get_parent_col_name())
|
||||||
if not local_col:
|
if not local_col:
|
||||||
@ -44,7 +45,7 @@ class ASSETPIPE_OT_sync_with_publish(bpy.types.Operator):
|
|||||||
if not task_layer_name:
|
if not task_layer_name:
|
||||||
self.report({'ERROR'}, "Current File Name doesn't contain valid task layer")
|
self.report({'ERROR'}, "Current File Name doesn't contain valid task layer")
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
core.get_ownership(local_col, task_layer_name, ownership)
|
core.get_ownership(local_col, task_layer_name, self._temp_ownership)
|
||||||
|
|
||||||
# Default behaviour is to pull before pushing
|
# Default behaviour is to pull before pushing
|
||||||
if self.push:
|
if self.push:
|
||||||
@ -53,22 +54,21 @@ class ASSETPIPE_OT_sync_with_publish(bpy.types.Operator):
|
|||||||
|
|
||||||
def draw(self, context: bpy.types.Context):
|
def draw(self, context: bpy.types.Context):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
ownership = context.scene.temp_transfer_data_ownership
|
|
||||||
|
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
if self.push:
|
if self.push:
|
||||||
row.prop(self, "pull")
|
row.prop(self, "pull")
|
||||||
row.prop(self, "save")
|
row.prop(self, "save")
|
||||||
|
|
||||||
if len(ownership) == 0:
|
if len(self._temp_ownership) == 0:
|
||||||
layout.label(text="No New Transfer Data found")
|
layout.label(text="No New Transfer Data found")
|
||||||
else:
|
else:
|
||||||
layout.label(text="New Transfer Data will be Pushed to Publish")
|
layout.label(text="New Transfer Data will be Pushed to Publish")
|
||||||
|
|
||||||
objs = [item.obj for item in ownership]
|
objs = [item.obj for item in self._temp_ownership]
|
||||||
|
|
||||||
for obj in set(objs):
|
for obj in set(objs):
|
||||||
obj_ownership = [item for item in ownership if item.obj == obj]
|
obj_ownership = [item for item in self._temp_ownership if item.obj == obj]
|
||||||
box = layout.box()
|
box = layout.box()
|
||||||
box.label(text=obj.name, icon="OBJECT_DATA")
|
box.label(text=obj.name, icon="OBJECT_DATA")
|
||||||
transfer_ui.draw_transfer_data(obj_ownership, box)
|
transfer_ui.draw_transfer_data(obj_ownership, box)
|
||||||
|
Loading…
Reference in New Issue
Block a user