From fd2f7c9a02815e97ec48db099b14a36dcd66a1aa Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Tue, 15 Jun 2021 15:11:00 +0200 Subject: [PATCH] Implemented boolean attribute definition --- openpype/pipeline/lib/attribute_definitions.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/openpype/pipeline/lib/attribute_definitions.py b/openpype/pipeline/lib/attribute_definitions.py index b0e9acade2..780cc2a743 100644 --- a/openpype/pipeline/lib/attribute_definitions.py +++ b/openpype/pipeline/lib/attribute_definitions.py @@ -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