mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
added ability to get existing subsets for passet asset name via controller
This commit is contained in:
parent
2ab0ad9d44
commit
626cb38793
1 changed files with 20 additions and 0 deletions
|
|
@ -11,6 +11,7 @@ import pyblish.api
|
|||
from openpype.client import (
|
||||
get_assets,
|
||||
get_asset_by_id,
|
||||
get_subsets,
|
||||
)
|
||||
from openpype.lib.events import EventSystem
|
||||
from openpype.pipeline import (
|
||||
|
|
@ -837,6 +838,10 @@ class AbstractPublisherController(object):
|
|||
def get_task_names_by_asset_names(self, asset_names):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_existing_subset_names(self, asset_name):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def reset(self):
|
||||
"""Reset whole controller.
|
||||
|
|
@ -1223,6 +1228,21 @@ class PublisherController(AbstractPublisherController):
|
|||
)
|
||||
return result
|
||||
|
||||
def get_existing_subset_names(self, asset_name):
|
||||
project_name = self.project_name
|
||||
asset_doc = self._asset_docs_cache.get_asset_by_name(asset_name)
|
||||
if not asset_doc:
|
||||
return None
|
||||
|
||||
asset_id = asset_doc["_id"]
|
||||
subset_docs = get_subsets(
|
||||
project_name, asset_ids=[asset_id], fields=["name"]
|
||||
)
|
||||
return {
|
||||
subset_doc["name"]
|
||||
for subset_doc in subset_docs
|
||||
}
|
||||
|
||||
def reset(self):
|
||||
"""Reset everything related to creation and publishing."""
|
||||
# Stop publishing
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue