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.
3 changed files with 14 additions and 6 deletions
Showing only changes of commit 2e737daae5 - Show all commits

View File

@ -43,6 +43,8 @@ PUBLISH_TYPES = [
), ),
] ]
PUBLISH_KEYS = [item[0] for item in PUBLISH_TYPES] PUBLISH_KEYS = [item[0] for item in PUBLISH_TYPES]
ACTIVE_PUBLISH_KEY = PUBLISH_KEYS[0]
STAGED_PUBLISH_KEY = PUBLISH_KEYS[1]
LOCAL_SUFFIX = "LOCAL" LOCAL_SUFFIX = "LOCAL"
EXTERNAL_SUFFIX = "EXTERNAL" EXTERNAL_SUFFIX = "EXTERNAL"

View File

@ -114,7 +114,9 @@ def find_file_version(file):
return int(file.name.split(".")[1].replace("v", "")) return int(file.name.split(".")[1].replace("v", ""))
def get_next_published_file(current_file: Path, publish_type="publish"): def get_next_published_file(
current_file: Path, publish_type=constants.ACTIVE_PUBLISH_KEY
):
last_publish = find_latest_publish(current_file, publish_type) last_publish = find_latest_publish(current_file, publish_type)
base_name = current_file.name.split(".")[0] base_name = current_file.name.split(".")[0]
publish_dir = current_file.parent.joinpath(publish_type) publish_dir = current_file.parent.joinpath(publish_type)
@ -136,17 +138,19 @@ def find_all_published(current_file, publish_type):
return published_files return published_files
def find_latest_publish(current_file: Path, publish_type="publish"): def find_latest_publish(current_file: Path, publish_type=constants.ACTIVE_PUBLISH_KEY):
published_files = find_all_published(current_file, publish_type) published_files = find_all_published(current_file, publish_type)
if published_files: if published_files:
return published_files[-1] return published_files[-1]
def find_sync_target(current_file: Path): def find_sync_target(current_file: Path):
latest_staged = find_latest_publish(current_file, publish_type="staged") latest_staged = find_latest_publish(
current_file, publish_type=constants.STAGED_PUBLISH_KEY
)
if latest_staged: if latest_staged:
return latest_staged return latest_staged
return find_latest_publish(current_file, publish_type="publish") return find_latest_publish(current_file, publish_type=constants.ACTIVE_PUBLISH_KEY)
def import_data_from_lib( def import_data_from_lib(

View File

@ -74,7 +74,7 @@ class ASSETPIPE_OT_create_new_asset(bpy.types.Operator):
bpy.ops.wm.save_as_mainfile(filepath=task_layer_file, copy=True) bpy.ops.wm.save_as_mainfile(filepath=task_layer_file, copy=True)
# Creata intial publish based on task layers # Creata intial publish based on task layers
publish_path = os.path.join(asset_path, "publish") # TODO FIX HARD CODE VALUE publish_path = os.path.join(asset_path, constants.ACTIVE_PUBLISH_KEY)
name = self._name + "." + "v001" + ".blend" name = self._name + "." + "v001" + ".blend"
publish_file = os.path.join(publish_path, name) publish_file = os.path.join(publish_path, name)
bpy.ops.wm.save_as_mainfile(filepath=publish_file, copy=True) bpy.ops.wm.save_as_mainfile(filepath=publish_file, copy=True)
@ -191,7 +191,9 @@ class ASSETPIPE_OT_sync_with_publish(bpy.types.Operator):
if not self.push: if not self.push:
return {'FINISHED'} return {'FINISHED'}
push_targets = core.find_all_published(current_file, "publish") push_targets = core.find_all_published(
current_file, constants.ACTIVE_PUBLISH_KEY
)
if sync_target not in push_targets: if sync_target not in push_targets:
push_targets.append(sync_target) push_targets.append(sync_target)