mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
wiretap handle for metadata
This commit is contained in:
parent
8de80ce773
commit
4653de6942
1 changed files with 45 additions and 0 deletions
|
|
@ -290,3 +290,48 @@ def rescan_hooks():
|
|||
flame.execute_shortcut('Rescan Python Hooks')
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
|
||||
def get_metadata(project_name, _log=None):
|
||||
import flame
|
||||
|
||||
from adsk.libwiretapPythonClientAPI import (
|
||||
WireTapClient,
|
||||
WireTapServerHandle,
|
||||
WireTapNodeHandle,
|
||||
WireTapStr,
|
||||
WireTapInt
|
||||
)
|
||||
|
||||
class GetProjectColorPolicy(object):
|
||||
def __init__(self, host_name=None, _log=None):
|
||||
# Create a connection to the Backburner manager using the Wiretap
|
||||
# python API.
|
||||
#
|
||||
self.log = _log or log
|
||||
self.host_name = host_name or "localhost"
|
||||
self._wiretap_client = WireTapClient()
|
||||
if not self._wiretap_client.init():
|
||||
raise Exception("Could not initialize Wiretap Client")
|
||||
self._server = WireTapServerHandle(
|
||||
"{}:IFFFS".format(self.host_name))
|
||||
|
||||
def process(self, project_name):
|
||||
policy_node_handle = WireTapNodeHandle(
|
||||
self._server, "/projects/{}/syncolor/policy".format(project_name))
|
||||
self.log.info(policy_node_handle)
|
||||
|
||||
policy = WireTapStr()
|
||||
if not policy_node_handle.getNodeTypeStr(policy):
|
||||
self.log.warning(
|
||||
"Could not retrieve policy of '%s': %s" % (
|
||||
policy_node_handle.getNodeId().id(),
|
||||
policy_node_handle.lastError()
|
||||
)
|
||||
)
|
||||
|
||||
return policy.c_str()
|
||||
|
||||
policy_wiretap = GetProjectColorPolicy(_log=_log)
|
||||
return policy_wiretap.process(project_name)
|
||||
Loading…
Add table
Add a link
Reference in a new issue