mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 00:44:52 +01:00
raise PublishXmlValidationError in validate asset name
This commit is contained in:
parent
72cdaecef4
commit
4759b6db37
2 changed files with 39 additions and 6 deletions
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<root>
|
||||
<error id="main">
|
||||
<title>Subset context</title>
|
||||
<description>## Invalid subset context
|
||||
|
||||
Context of the given subset doesn't match your current scene.
|
||||
|
||||
### How to repair?
|
||||
|
||||
Yout can fix with "Repair" button on the right. This will use '{expected_asset}' asset name and overwrite '{found_asset}' asset name in scene metadata.
|
||||
|
||||
After that restart publishing with Reload button.
|
||||
</description>
|
||||
<detail>
|
||||
### How could this happen?
|
||||
|
||||
The subset was created in different scene with different context
|
||||
or the scene file was copy pasted from different context.
|
||||
</detail>
|
||||
</error>
|
||||
</root>
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
import pyblish.api
|
||||
from avalon.tvpaint import pipeline
|
||||
from openpype.pipeline import PublishXmlValidationError
|
||||
|
||||
|
||||
class FixAssetNames(pyblish.api.Action):
|
||||
|
|
@ -27,7 +28,7 @@ class FixAssetNames(pyblish.api.Action):
|
|||
pipeline._write_instances(new_instance_items)
|
||||
|
||||
|
||||
class ValidateMissingLayers(pyblish.api.ContextPlugin):
|
||||
class ValidateAssetNames(pyblish.api.ContextPlugin):
|
||||
"""Validate assset name present on instance.
|
||||
|
||||
Asset name on instance should be the same as context's.
|
||||
|
|
@ -48,8 +49,18 @@ class ValidateMissingLayers(pyblish.api.ContextPlugin):
|
|||
instance_label = (
|
||||
instance.data.get("label") or instance.data["name"]
|
||||
)
|
||||
raise AssertionError((
|
||||
"Different asset name on instance then context's."
|
||||
" Instance \"{}\" has asset name: \"{}\""
|
||||
" Context asset name is: \"{}\""
|
||||
).format(instance_label, asset_name, context_asset_name))
|
||||
|
||||
raise PublishXmlValidationError(
|
||||
self,
|
||||
(
|
||||
"Different asset name on instance then context's."
|
||||
" Instance \"{}\" has asset name: \"{}\""
|
||||
" Context asset name is: \"{}\""
|
||||
).format(
|
||||
instance_label, asset_name, context_asset_name
|
||||
),
|
||||
formatting_data={
|
||||
"expected_asset": context_asset_name,
|
||||
"found_asset": asset_name
|
||||
}
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue