mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 00:44:52 +01:00
Implemented boolean attribute definition
This commit is contained in:
parent
c6c7c92d0c
commit
fd2f7c9a02
1 changed files with 18 additions and 0 deletions
|
|
@ -22,3 +22,21 @@ class AbtractAttrDef:
|
|||
converted.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class BoolDef(AbtractAttrDef):
|
||||
"""Boolean representation.
|
||||
|
||||
Args:
|
||||
default(bool): Default value. Set to `False` if not defined.
|
||||
"""
|
||||
|
||||
def __init__(self, default=None):
|
||||
if default is None:
|
||||
default = False
|
||||
self.default = default
|
||||
|
||||
def convert_value(self, value):
|
||||
if isinstance(value, bool):
|
||||
return value
|
||||
return self.default
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue