Asset Pipeline v2 #145
@ -28,6 +28,12 @@ class ASSETPIPE_OT_push_test(bpy.types.Operator):
|
||||
description="Save the Current File (after pulling if enabled) before Pushing to Publish",
|
||||
)
|
||||
|
||||
pull: bpy.props.BoolProperty(
|
||||
name="Pull before Pushing",
|
||||
default=True,
|
||||
description="Pull in any new data from the Published file before Pushing",
|
||||
)
|
||||
|
||||
def invoke(self, context: bpy.types.Context, event: bpy.types.Event):
|
||||
local_col = bpy.data.collections.get(get_parent_col_name())
|
||||
if not local_col:
|
||||
@ -57,7 +63,9 @@ class ASSETPIPE_OT_push_test(bpy.types.Operator):
|
||||
|
||||
def draw(self, context: bpy.types.Context):
|
||||
layout = self.layout
|
||||
|
||||
row = layout.row()
|
||||
row.prop(self, "pull")
|
||||
row.prop(self, "save")
|
||||
|
||||
if self._new_transfer_data:
|
||||
@ -70,7 +78,6 @@ class ASSETPIPE_OT_push_test(bpy.types.Operator):
|
||||
|
||||
def execute(self, context: bpy.types.Context):
|
||||
# Find current task Layer
|
||||
|
||||
core.set_ownership(self._new_transfer_data)
|
||||
current_file = Path(bpy.data.filepath)
|
||||
task_layer_name = get_task_layer_name_from_file()
|
||||
@ -78,11 +85,24 @@ class ASSETPIPE_OT_push_test(bpy.types.Operator):
|
||||
self.report({'ERROR'}, "Current File Name doesn't contain valid task layer")
|
||||
return {'CANCELLED'}
|
||||
|
||||
pub_file = core.find_published_file(current_file)
|
||||
pub_file_path = pub_file.__str__()
|
||||
|
||||
if self.pull:
|
||||
error_msg = core.merge_task_layer(
|
||||
context,
|
||||
col_base_name=get_parent_col_name(),
|
||||
local_tls=[task_layer_name],
|
||||
target_file=pub_file,
|
||||
)
|
||||
|
||||
if error_msg:
|
||||
self.report({'ERROR'}, error_msg)
|
||||
return {'CANCELLED'}
|
||||
|
||||
if self.save:
|
||||
bpy.ops.wm.save_as_mainfile(filepath=current_file.__str__())
|
||||
|
||||
pub_file = core.find_published_file(current_file)
|
||||
pub_file_path = pub_file.__str__()
|
||||
bpy.ops.wm.open_mainfile(filepath=pub_file_path)
|
||||
|
||||
local_tls = [
|
||||
|
Loading…
Reference in New Issue
Block a user