raise PublishXmlValidationError in validate marks

This commit is contained in:
iLLiCiTiT 2021-12-22 11:57:31 +01:00
parent 3417dc716a
commit fba2191226
3 changed files with 54 additions and 7 deletions

View file

@ -8,7 +8,7 @@ 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.
Yout can fix this 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>

View file

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<root>
<error id="main">
<title>Frame range</title>
<description>## Invalid render frame range
Scene frame range which will be rendered is defined by MarkIn and MarkOut. Expected frame range is {expected_frame_range} and current frame range is {current_frame_range}.
It is also required that MarkIn and MarkOut are enabled in the scene. Their color is highlighted on timeline when are enabled.
- MarkIn is {mark_in_enable_state}
- MarkOut is {mark_out_enable_state}
### How to repair?
Yout can fix this with "Repair" button on the right. That will change MarkOut to {expected_mark_out}.
Or you can manually modify MarkIn and MarkOut in the scene timeline.
</description>
</error>
</root>

View file

@ -2,6 +2,7 @@ import json
import pyblish.api
from avalon.tvpaint import lib
from openpype.pipeline import PublishXmlValidationError
class ValidateMarksRepair(pyblish.api.Action):
@ -73,9 +74,34 @@ class ValidateMarks(pyblish.api.ContextPlugin):
"expected": expected_data[k]
}
if invalid:
raise AssertionError(
"Marks does not match database:\n{}".format(
json.dumps(invalid, sort_keys=True, indent=4)
)
)
# Validation ends
if not invalid:
return
current_frame_range = (
(current_data["markOut"] - current_data["markIn"]) + 1
)
expected_frame_range = (
(expected_data["markOut"] - expected_data["markIn"]) + 1
)
mark_in_enable_state = "disabled"
if current_data["markInState"]:
mark_in_enable_state = "enabled"
mark_out_enable_state = "disabled"
if current_data["markOutState"]:
mark_out_enable_state = "enabled"
raise PublishXmlValidationError(
self,
"Marks does not match database:\n{}".format(
json.dumps(invalid, sort_keys=True, indent=4)
),
formatting_data={
"current_frame_range": str(current_frame_range),
"expected_frame_range": str(expected_frame_range),
"mark_in_enable_state": mark_in_enable_state,
"mark_out_enable_state": mark_out_enable_state,
"expected_mark_out": expected_data["markOut"]
}
)