Merge pull request #13 from pypeclub/feature/ftrack_group_name

Ftrack group name for custom attributes
This commit is contained in:
Milan Kolar 2021-04-01 14:14:00 +02:00 committed by GitHub
commit 8d700c1715
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View file

@ -37,7 +37,7 @@ EntitySchemas = {
}
# Group name of custom attributes
CUST_ATTR_GROUP = "pype"
CUST_ATTR_GROUP = "openpype"
# name of Custom attribute that stores mongo_id from avalon db
CUST_ATTR_ID_KEY = "avalon_mongo_id"
@ -102,11 +102,12 @@ def get_pype_attr(session, split_hierarchical=True, query_keys=None):
"is_hierarchical",
"default"
]
# TODO remove deprecated "avalon" group from query
# TODO remove deprecated "pype" group from query
cust_attrs_query = (
"select {}"
" from CustomAttributeConfiguration"
" where group.name in (\"avalon\", \"{}\")"
# Kept `pype` for Backwards Compatiblity
" where group.name in (\"pype\", \"{}\")"
).format(", ".join(query_keys), CUST_ATTR_GROUP)
all_avalon_attr = session.query(cust_attrs_query).all()
for cust_attr in all_avalon_attr:

View file

@ -6,9 +6,11 @@ from avalon import io
# Copy of constant `pype.modules.ftrack.lib.avalon_sync.CUST_ATTR_AUTO_SYNC`
CUST_ATTR_AUTO_SYNC = "avalon_auto_sync"
CUST_ATTR_GROUP = "openpype"
# Copy of `get_pype_attr` from pype.modules.ftrack.lib
# TODO import from openpype's ftrack module when possible to not break Python 2
def get_pype_attr(session, split_hierarchical=True):
custom_attributes = []
hier_custom_attributes = []
@ -16,8 +18,9 @@ def get_pype_attr(session, split_hierarchical=True):
cust_attrs_query = (
"select id, entity_type, object_type_id, is_hierarchical, default"
" from CustomAttributeConfiguration"
" where group.name in (\"avalon\", \"pype\")"
)
# Kept `pype` for Backwards Compatiblity
" where group.name in (\"pype\", \"{}\")"
).format(CUST_ATTR_GROUP)
all_avalon_attr = session.query(cust_attrs_query).all()
for cust_attr in all_avalon_attr:
if split_hierarchical and cust_attr["is_hierarchical"]: