mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Merge pull request #4098 from moonyuet/bugfix/OP-4302-Layout-publish-more-than-one-container-issue
This commit is contained in:
commit
8465e96245
2 changed files with 25 additions and 5 deletions
|
|
@ -8,3 +8,9 @@ class CreateLayout(plugin.Creator):
|
|||
label = "Layout"
|
||||
family = "layout"
|
||||
icon = "cubes"
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(CreateLayout, self).__init__(*args, **kwargs)
|
||||
# enable this when you want to
|
||||
# publish group of loaded asset
|
||||
self.data["groupLoadedAssets"] = False
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ class ExtractLayout(publish.Extractor):
|
|||
label = "Extract Layout"
|
||||
hosts = ["maya"]
|
||||
families = ["layout"]
|
||||
project_container = "AVALON_CONTAINERS"
|
||||
optional = True
|
||||
|
||||
def process(self, instance):
|
||||
|
|
@ -33,12 +34,25 @@ class ExtractLayout(publish.Extractor):
|
|||
|
||||
for asset in cmds.sets(str(instance), query=True):
|
||||
# Find the container
|
||||
grp_name = asset.split(':')[0]
|
||||
project_container = self.project_container
|
||||
container_list = cmds.ls(project_container)
|
||||
if len(container_list) == 0:
|
||||
self.log.warning("Project container is not found!")
|
||||
self.log.warning("The asset(s) may not be properly loaded after published") # noqa
|
||||
continue
|
||||
|
||||
grp_loaded_ass = instance.data.get("groupLoadedAssets", False)
|
||||
if grp_loaded_ass:
|
||||
asset_list = cmds.listRelatives(asset, children=True)
|
||||
for asset in asset_list:
|
||||
grp_name = asset.split(':')[0]
|
||||
else:
|
||||
grp_name = asset.split(':')[0]
|
||||
containers = cmds.ls("{}*_CON".format(grp_name))
|
||||
|
||||
assert len(containers) == 1, \
|
||||
"More than one container found for {}".format(asset)
|
||||
|
||||
if len(containers) == 0:
|
||||
self.log.warning("{} isn't from the loader".format(asset))
|
||||
self.log.warning("It may not be properly loaded after published") # noqa
|
||||
continue
|
||||
container = containers[0]
|
||||
|
||||
representation_id = cmds.getAttr(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue