mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 13:24:54 +01:00
copied code and constant as it is not possible to import pype's ftrack module in python 2
This commit is contained in:
parent
325206a433
commit
b68a40cdff
1 changed files with 28 additions and 5 deletions
|
|
@ -1,13 +1,36 @@
|
|||
import sys
|
||||
import six
|
||||
import collections
|
||||
import six
|
||||
import pyblish.api
|
||||
from avalon import io
|
||||
|
||||
from pype.modules.ftrack.lib.avalon_sync import (
|
||||
CUST_ATTR_AUTO_SYNC,
|
||||
get_pype_attr
|
||||
)
|
||||
# Copy of constant `pype.modules.ftrack.lib.avalon_sync.CUST_ATTR_AUTO_SYNC`
|
||||
CUST_ATTR_AUTO_SYNC = "avalon_auto_sync"
|
||||
|
||||
|
||||
# Copy of `get_pype_attr` from pype.modules.ftrack.lib
|
||||
def get_pype_attr(session, split_hierarchical=True):
|
||||
custom_attributes = []
|
||||
hier_custom_attributes = []
|
||||
# TODO remove deprecated "avalon" group from query
|
||||
cust_attrs_query = (
|
||||
"select id, entity_type, object_type_id, is_hierarchical, default"
|
||||
" from CustomAttributeConfiguration"
|
||||
" where group.name in (\"avalon\", \"pype\")"
|
||||
)
|
||||
all_avalon_attr = session.query(cust_attrs_query).all()
|
||||
for cust_attr in all_avalon_attr:
|
||||
if split_hierarchical and cust_attr["is_hierarchical"]:
|
||||
hier_custom_attributes.append(cust_attr)
|
||||
continue
|
||||
|
||||
custom_attributes.append(cust_attr)
|
||||
|
||||
if split_hierarchical:
|
||||
# return tuple
|
||||
return custom_attributes, hier_custom_attributes
|
||||
|
||||
return custom_attributes
|
||||
|
||||
|
||||
class IntegrateHierarchyToFtrack(pyblish.api.ContextPlugin):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue