Asset Pipeline v2 #145
@ -2,10 +2,7 @@ import bpy
|
||||
from . import config
|
||||
import os
|
||||
from pathlib import Path
|
||||
from .merge.publish import (
|
||||
get_next_published_file,
|
||||
)
|
||||
|
||||
from .merge.publish import get_next_published_file, find_all_published
|
||||
from .images import save_images
|
||||
from . import constants
|
||||
from .sync import (
|
||||
@ -159,6 +156,7 @@ class ASSETPIPE_OT_create_new_asset(bpy.types.Operator):
|
||||
asset_pipe.task_layer_name = "NONE"
|
||||
publish_path = os.path.join(asset_path, constants.ACTIVE_PUBLISH_KEY)
|
||||
name = self._name + "." + "v001" + ".blend"
|
||||
asset_pipe.asset_collection.asset_mark()
|
||||
publish_file = os.path.join(publish_path, name)
|
||||
bpy.ops.wm.save_as_mainfile(filepath=publish_file, copy=True)
|
||||
if starting_file:
|
||||
@ -316,9 +314,33 @@ class ASSETPIPE_OT_publish_new_version(bpy.types.Operator):
|
||||
"Please save the current file and/or Pull from last publish before creating new Publish",
|
||||
)
|
||||
return {'CANCELLED'}
|
||||
|
||||
current_file = Path(bpy.data.filepath)
|
||||
|
||||
if self.publish_types == constants.ACTIVE_PUBLISH_KEY:
|
||||
context.scene.asset_pipeline.asset_collection.asset_mark()
|
||||
|
||||
push_targets = find_all_published(
|
||||
Path(bpy.data.filepath), constants.ACTIVE_PUBLISH_KEY
|
||||
)
|
||||
|
||||
for file in push_targets:
|
||||
file_path = Path(file.__str__())
|
||||
|
||||
bpy.ops.wm.open_mainfile(filepath=file_path.__str__())
|
||||
|
||||
# Clear old Assets
|
||||
context.scene.asset_pipeline.asset_collection.asset_clear()
|
||||
bpy.ops.wm.save_as_mainfile(filepath=file_path.__str__())
|
||||
|
||||
# Re-open Current File to use as source for Publish
|
||||
bpy.ops.wm.open_mainfile(filepath=current_file.__str__())
|
||||
new_file_path = get_next_published_file(current_file, self.publish_types)
|
||||
|
||||
# Save Latest Publish File & Mark as Asset
|
||||
context.scene.asset_pipeline.asset_collection.asset_mark()
|
||||
bpy.ops.wm.save_as_mainfile(filepath=new_file_path.__str__(), copy=True)
|
||||
context.scene.asset_pipeline.asset_collection.asset_clear()
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user