Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1864 from pypeclub/feature/anatomy_schema_validation
Browse files Browse the repository at this point in the history
Anatomy schema validation
  • Loading branch information
iLLiCiTiT authored Jul 27, 2021
2 parents 63a7604 + 3f97ee1 commit 95f9e6f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
23 changes: 23 additions & 0 deletions openpype/settings/entities/anatomy_entities.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from .dict_immutable_keys_entity import DictImmutableKeysEntity
from .lib import OverrideState
from .exceptions import EntitySchemaError


class AnatomyEntity(DictImmutableKeysEntity):
Expand All @@ -23,3 +24,25 @@ 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."
" 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()
9 changes: 9 additions & 0 deletions openpype/settings/entities/schemas/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 95f9e6f

Please sign in to comment.