Asset Pipeline v2 #145

Closed
Nick Alberelli wants to merge 431 commits from (deleted):feature/asset-pipeline-v2 into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
2 changed files with 32 additions and 19 deletions
Showing only changes of commit 32ff159916 - Show all commits

View File

@ -0,0 +1,12 @@
import bpy
from pathlib import Path
def save_images():
# TODO Make customizable
save_path = Path(bpy.data.filepath).parent.joinpath("images")
for img in bpy.data.images:
if img.is_dirty:
filepath = save_path.joinpath(img.name).__str__()
img.filepath = filepath
img.save(filepath=filepath)

View File

@ -8,6 +8,7 @@ from .merge.publish import (
from .merge.naming import get_task_layer_col_name
from .merge.transfer_data.transfer_ui import draw_transfer_data
from .images import save_images
from . import constants
from .sync import (
sync_poll,
@ -157,25 +158,24 @@ class ASSETPIPE_OT_sync_pull(bpy.types.Operator):
default=False,
description="Show New Transfer Data",
)
@classmethod
def poll(cls, context: bpy.types.Context) -> bool:
if any([img.is_dirty for img in bpy.data.images]):
cls.poll_message_set("Please save unsaved Images")
return False
if bpy.data.is_dirty:
cls.poll_message_set("Please save current .blend file")
return False
return True
save: bpy.props.BoolProperty(
name="Save File & Images",
default=True,
description="Save Current File and Images before Push",
)
def invoke(self, context: bpy.types.Context, event: bpy.types.Event):
sync_invoke(self, context)
return context.window_manager.invoke_props_dialog(self, width=400)
def draw(self, context: bpy.types.Context):
self.layout.prop(self, "save")
sync_draw(self, context)
def execute(self, context: bpy.types.Context):
if self.save:
save_images()
bpy.ops.wm.save_mainfile()
# Find current task Layer
sync_execute_update_ownership(self, context)
sync_execute_prepare_sync(self, context)
@ -207,15 +207,11 @@ class ASSETPIPE_OT_sync_push(bpy.types.Operator):
description="Pull in any new data from the Published file before Pushing",
)
@classmethod
def poll(cls, context: bpy.types.Context) -> bool:
if any([img.is_dirty for img in bpy.data.images]):
cls.poll_message_set("Please save unsaved Images")
return False
if bpy.data.is_dirty:
cls.poll_message_set("Please save current .blend file")
return False
return True
save: bpy.props.BoolProperty(
name="Save File & Images",
default=True,
description="Save Current File and Images before Push",
)
def invoke(self, context: bpy.types.Context, event: bpy.types.Event):
sync_invoke(self, context)
@ -223,9 +219,14 @@ class ASSETPIPE_OT_sync_push(bpy.types.Operator):
def draw(self, context: bpy.types.Context):
self.layout.prop(self, "pull")
self.layout.prop(self, "save")
sync_draw(self, context)
def execute(self, context: bpy.types.Context):
if self.save:
save_images()
bpy.ops.wm.save_mainfile()
# Find current task Layer
sync_execute_update_ownership(self, context)
sync_execute_prepare_sync(self, context)