def get_handle_msg(json_msg): if tp.is_houdini(): try: msg = json.loads(json_msg) except Exception: LOGGER.warning('Unknown command!') else: return handleMessage(json_msg)
def _setup_host(self): """ Internal function that sets the host of the tool :return: """ # TODO: Should we do this in a central place (not per tool)? if tp.is_maya(): pyblish.api.register_host('maya') elif tp.is_houdini(): pyblish.api.register_host('houdini')
def __init__(self, name='SolsticeShelf', label_background=(0, 0, 0, 0), label_color=(0.9, 0.9, 0.9), category_icon=None): enable_labels = False if tpDcc.is_houdini(): enable_labels = True super(SolsticeShelf, self).__init__(name=name, label_background=label_background, label_color=label_color, category_icon=category_icon, enable_labels=enable_labels)
def connect_artella_app_to_spigot(cli=None, app_identifier=None): """ Creates a new Spigot Client instance and makes it to listen to our current installed (and launched) Artella app """ # TODO: Check if Artella App is launched and, is not, launch it def get_handle_msg(json_msg): if tp.is_houdini(): try: msg = json.loads(json_msg) except Exception: LOGGER.warning('Unknown command!') else: return handleMessage(json_msg) if cli is None: cli = get_artella_client() artella_app_identifier = get_artella_app_identifier() if not artella_app_identifier and app_identifier: artella_app_identifier = app_identifier if tp.is_maya(): pass_msg_fn = passMsgToMainThread elif tp.is_houdini(): def pass_msg_to_main_thread(json_msg): from tpDcc.dccs.houdini.core import helpers main_thread_fn = helpers.get_houdini_pass_main_thread_function() main_thread_fn(get_handle_msg, json_msg) pass_msg_fn = pass_msg_to_main_thread else: def pass_msg(json_msg): get_handle_msg(json_msg) pass_msg_fn = pass_msg if tp.Dccs.Unknown: spigot_listen(cli, artella_app_identifier, pass_msg_fn) else: cli.listen(artella_app_identifier, pass_msg_fn) return cli
import tpDcc as tp import artellapipe.register from artellapipe.core import toolbox class HoudiniToolBox(toolbox.ToolBox, object): def __init__(self, project, parent=None): if parent is None: parent = tp.Dcc.get_main_window() super(HoudiniToolBox, self).__init__(project=project, parent=parent) if tp.is_houdini(): artellapipe.register.register_class('ToolBox', HoudiniToolBox)