mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
make sure the validator skips checking when the value of the attribute sets to zero
This commit is contained in:
parent
b0ad17a929
commit
3c878ccc3e
3 changed files with 17 additions and 4 deletions
|
|
@ -18,7 +18,7 @@ class ValidateCameraAttributes(OptionalPyblishPluginMixin,
|
|||
order = pyblish.api.ValidatorOrder
|
||||
families = ['camera']
|
||||
hosts = ['max']
|
||||
label = 'Camera Attributes'
|
||||
label = 'Validate Camera Attributes'
|
||||
actions = [SelectInvalidAction]
|
||||
optional = True
|
||||
|
||||
|
|
@ -42,9 +42,14 @@ class ValidateCameraAttributes(OptionalPyblishPluginMixin,
|
|||
continue
|
||||
for attr in cls.DEFAULTS:
|
||||
default_value = cam_attr_settings.get(attr)
|
||||
if default_value == 0:
|
||||
cls.log.debug(
|
||||
f"the value of {attr} in setting set to"
|
||||
" zero. Skipping the check..")
|
||||
continue
|
||||
if rt.getProperty(camera, attr) != default_value:
|
||||
cls.log.error(
|
||||
f"Invalid attribute value: {attr} "
|
||||
f"Invalid attribute value for {camera.name}:{attr} "
|
||||
f"(should be: {default_value}))")
|
||||
invalid.append(camera)
|
||||
|
||||
|
|
@ -58,4 +63,4 @@ class ValidateCameraAttributes(OptionalPyblishPluginMixin,
|
|||
|
||||
if invalid:
|
||||
raise PublishValidationError(
|
||||
f"Invalid camera attributes: {invalid}")
|
||||
"Invalid camera attributes found. See log.")
|
||||
|
|
|
|||
|
|
@ -79,6 +79,10 @@
|
|||
"minimum": 0,
|
||||
"maximum": 100.0
|
||||
},
|
||||
{
|
||||
"type": "label",
|
||||
"label": "If the value of the camera attributes set to 0, the system automatically skips checking it"
|
||||
},
|
||||
{
|
||||
"type": "number",
|
||||
"key": "nearrange",
|
||||
|
|
|
|||
|
|
@ -76,7 +76,11 @@ class PublishersModel(BaseSettingsModel):
|
|||
)
|
||||
ValidateCameraAttributes: ValidateCameraAttributesModel = Field(
|
||||
default_factory=ValidateCameraAttributesModel,
|
||||
title="Validate Camera Attributes"
|
||||
title="Validate Camera Attributes",
|
||||
description=(
|
||||
"If the value of the camera attributes set to 0, "
|
||||
"the system automatically skips checking it"
|
||||
)
|
||||
)
|
||||
ValidateLoadedPlugin: ValidateLoadedPluginModel = Field(
|
||||
default_factory=ValidateLoadedPluginModel,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue