From 834d6b681697c2cd93f862789a8ba5d2666f2a71 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Tue, 27 Jul 2021 14:30:21 +0200 Subject: [PATCH 1/3] all anatomy children must be groups otherwise schema error is raised --- .../settings/entities/anatomy_entities.py | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/openpype/settings/entities/anatomy_entities.py b/openpype/settings/entities/anatomy_entities.py index d048ffabba7..9edd0d943cd 100644 --- a/openpype/settings/entities/anatomy_entities.py +++ b/openpype/settings/entities/anatomy_entities.py @@ -1,5 +1,6 @@ from .dict_immutable_keys_entity import DictImmutableKeysEntity from .lib import OverrideState +from .exceptions import EntitySchemaError class AnatomyEntity(DictImmutableKeysEntity): @@ -23,3 +24,22 @@ def on_child_change(self, child_obj): if not child_obj.has_project_override: child_obj.add_to_project_override() return super(AnatomyEntity, self).on_child_change(child_obj) + + def schema_validations(self): + non_group_children = [] + for key, child_obj in self.non_gui_children.items(): + if not child_obj.is_group: + non_group_children.append(key) + + if non_group_children: + _non_group_children = [ + "project_anatomy/{}".format(key) + for key in non_group_children + ] + reason = ( + "Anatomy must have all children as groups." + " Non-group children {}" + ).format(", ".join(_non_group_children)) + raise EntitySchemaError(self, reason) + + return super(AnatomyEntity, self).schema_validations() From 13f6661a7c88bde185d6033159227c92da3c0891 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Tue, 27 Jul 2021 14:32:26 +0200 Subject: [PATCH 2/3] added brief description to readme --- openpype/settings/entities/schemas/README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/openpype/settings/entities/schemas/README.md b/openpype/settings/entities/schemas/README.md index d457e44e746..e5122094f63 100644 --- a/openpype/settings/entities/schemas/README.md +++ b/openpype/settings/entities/schemas/README.md @@ -577,6 +577,15 @@ How output of the schema could look like on save: } ``` +## Anatomy +Anatomy represents data stored on project document. + +### anatomy +- entity works similarly to `dict` +- anatomy has always all keys overriden with overrides + - overrides are not applied as all anatomy data must be available from project document + - all children must be groups + ## Proxy wrappers - should wraps multiple inputs only visually - these does not have `"key"` key and do not allow to have `"is_file"` or `"is_group"` modifiers enabled From 3f97ee17b3d141663576aa238a70affef10a89e4 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Tue, 27 Jul 2021 16:53:10 +0200 Subject: [PATCH 3/3] modified error message --- openpype/settings/entities/anatomy_entities.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/openpype/settings/entities/anatomy_entities.py b/openpype/settings/entities/anatomy_entities.py index 9edd0d943cd..489e1f82943 100644 --- a/openpype/settings/entities/anatomy_entities.py +++ b/openpype/settings/entities/anatomy_entities.py @@ -38,8 +38,11 @@ def schema_validations(self): ] reason = ( "Anatomy must have all children as groups." - " Non-group children {}" - ).format(", ".join(_non_group_children)) + " Set 'is_group' to `true` on > {}" + ).format(", ".join([ + '"{}"'.format(item) + for item in _non_group_children + ])) raise EntitySchemaError(self, reason) return super(AnatomyEntity, self).schema_validations()