Asset Pipeline: Add Support for Asset Catalogs #185
@ -65,8 +65,9 @@ def get_asset_catalogues():
|
|||||||
asset_data = obj.asset_data
|
asset_data = obj.asset_data
|
||||||
asset_data.catalog_id = uuid
|
asset_data.catalog_id = uuid
|
||||||
|
|
||||||
|
|
||||||
def create_next_published_file(
|
def create_next_published_file(
|
||||||
current_file: Path, publish_type=constants.ACTIVE_PUBLISH_KEY
|
current_file: Path, publish_type=constants.ACTIVE_PUBLISH_KEY, catalog_id: str = ''
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Creates new Published version of a given Publish Type
|
"""Creates new Published version of a given Publish Type
|
||||||
|
|
||||||
@ -75,11 +76,15 @@ def create_next_published_file(
|
|||||||
publish_type (_type_, optional): Publish type, 'publish', 'staged', 'review'. Defaults to 'publish'.
|
publish_type (_type_, optional): Publish type, 'publish', 'staged', 'review'. Defaults to 'publish'.
|
||||||
"""
|
"""
|
||||||
# TODO Set Catalogue here
|
# TODO Set Catalogue here
|
||||||
|
|
||||||
new_file_path = get_next_published_file(current_file, publish_type)
|
new_file_path = get_next_published_file(current_file, publish_type)
|
||||||
|
asset_col = bpy.context.scene.asset_pipeline.asset_collection
|
||||||
if publish_type == constants.ACTIVE_PUBLISH_KEY:
|
if publish_type == constants.ACTIVE_PUBLISH_KEY:
|
||||||
bpy.context.scene.asset_pipeline.asset_collection.asset_mark()
|
asset_col.asset_mark()
|
||||||
|
if catalog_id != '':
|
||||||
|
asset_col.asset_data.catalog_id = catalog_id
|
||||||
bpy.ops.wm.save_as_mainfile(filepath=new_file_path.__str__(), copy=True)
|
bpy.ops.wm.save_as_mainfile(filepath=new_file_path.__str__(), copy=True)
|
||||||
bpy.context.scene.asset_pipeline.asset_collection.asset_clear()
|
asset_col.asset_clear()
|
||||||
|
|
||||||
|
|
||||||
def find_all_published(current_file: Path, publish_type: str) -> list[Path]:
|
def find_all_published(current_file: Path, publish_type: str) -> list[Path]:
|
||||||
|
@ -425,8 +425,12 @@ class ASSETPIPE_OT_publish_new_version(bpy.types.Operator):
|
|||||||
f"Only '{constants.REVIEW_PUBLISH_KEY}' Publish is supported when a version is staged",
|
f"Only '{constants.REVIEW_PUBLISH_KEY}' Publish is supported when a version is staged",
|
||||||
)
|
)
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
|
catalog_id = context.scene.asset_pipeline.asset_catalog_id
|
||||||
create_next_published_file(Path(bpy.data.filepath), self.publish_types)
|
create_next_published_file(
|
||||||
|
current_file=Path(bpy.data.filepath),
|
||||||
|
publish_type=self.publish_types,
|
||||||
|
catalog_id=catalog_id,
|
||||||
|
)
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
@ -465,7 +469,8 @@ class ASSETPIPE_OT_publish_staged_as_active(bpy.types.Operator):
|
|||||||
)
|
)
|
||||||
# Delete Staged File
|
# Delete Staged File
|
||||||
staged_file.unlink()
|
staged_file.unlink()
|
||||||
create_next_published_file(current_file)
|
catalog_id = context.scene.asset_pipeline.asset_catalog_id
|
||||||
|
create_next_published_file(current_file=current_file, catalog_id=catalog_id)
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
@ -861,7 +866,6 @@ class ASSETPIPE_OT_batch_ownership_change(bpy.types.Operator):
|
|||||||
layout.row(align=True).prop(self, "data_source", expand=True)
|
layout.row(align=True).prop(self, "data_source", expand=True)
|
||||||
|
|
||||||
layout.prop(self, "data_type", expand=True)
|
layout.prop(self, "data_type", expand=True)
|
||||||
|
|
||||||
filter_owner_row = layout.row()
|
filter_owner_row = layout.row()
|
||||||
filter_owner_row.enabled = grey_out
|
filter_owner_row.enabled = grey_out
|
||||||
if advanced_mode:
|
if advanced_mode:
|
||||||
|
Loading…
Reference in New Issue
Block a user