From 9913872a2a36bfac2e625e04194a994fd7f97d85 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Fri, 7 Jan 2022 16:37:37 +0100 Subject: [PATCH] flame: small fixes --- openpype/hosts/flame/api/pipeline.py | 20 +++---------------- openpype/hosts/flame/hooks/pre_flame_setup.py | 18 +++++++---------- 2 files changed, 10 insertions(+), 28 deletions(-) diff --git a/openpype/hosts/flame/api/pipeline.py b/openpype/hosts/flame/api/pipeline.py index f454c33209..9be59990d2 100644 --- a/openpype/hosts/flame/api/pipeline.py +++ b/openpype/hosts/flame/api/pipeline.py @@ -27,13 +27,6 @@ log = Logger.get_logger(__name__) def install(): - from .. import ( - PUBLISH_PATH, - LOAD_PATH, - CREATE_PATH, - INVENTORY_PATH - ) - # Disable all families except for the ones we explicitly want to see family_states = [ "imagesequence", @@ -60,13 +53,6 @@ def install(): log.info("OpenPype Flame host installed ...") def uninstall(): - from .. import ( - PUBLISH_PATH, - LOAD_PATH, - CREATE_PATH, - INVENTORY_PATH - ) - pyblish.deregister_host("flame") log.info("Deregistering Flame plug-ins..") @@ -167,11 +153,11 @@ def imprint(segment, data=None): @contextlib.contextmanager def maintained_selection(): import flame - from .. import selection + from .lib import CTX # check if segment is selected - if isinstance(selection[0], flame.PySegment): - sequence = get_current_sequence(selection) + if isinstance(CTX.selection[0], flame.PySegment): + sequence = get_current_sequence(CTX.selection) try: with maintained_segment_selection(sequence): yield diff --git a/openpype/hosts/flame/hooks/pre_flame_setup.py b/openpype/hosts/flame/hooks/pre_flame_setup.py index fc6b65c958..6c13638f35 100644 --- a/openpype/hosts/flame/hooks/pre_flame_setup.py +++ b/openpype/hosts/flame/hooks/pre_flame_setup.py @@ -19,20 +19,17 @@ class FlamePrelaunch(PreLaunchHook): """ app_groups = ["flame"] - # todo: replace version number with avalon launch app version - flame_python_exe = os.getenv("OPENPYPE_FLAME_PYTHON_EXEC") - flame_pythonpath = os.getenv("OPENPYPE_FLAME_PYTHONPATH") - wtc_script_path = os.path.join( opflame.HOST_DIR, "api", "scripts", "wiretap_com.py") def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - + self._env = self.launch_context.env + self.flame_python_exe = self._env["OPENPYPE_FLAME_PYTHON_EXEC"] + self.flame_pythonpath = self._env["OPENPYPE_FLAME_PYTHONPATH"] self.signature = "( {} )".format(self.__class__.__name__) def execute(self): - _env = self.launch_context.env """Hook entry method.""" project_doc = self.data["project_doc"] user_name = get_openpype_username() @@ -60,9 +57,9 @@ class FlamePrelaunch(PreLaunchHook): data_to_script = { # from settings - "host_name": _env.get("FLAME_WIRETAP_HOSTNAME") or hostname, - "volume_name": _env.get("FLAME_WIRETAP_VOLUME"), - "group_name": _env.get("FLAME_WIRETAP_GROUP"), + "host_name": self._env.get("FLAME_WIRETAP_HOSTNAME") or hostname, + "volume_name": self._env.get("FLAME_WIRETAP_VOLUME"), + "group_name": self._env.get("FLAME_WIRETAP_GROUP"), "color_policy": "ACES 1.1", # from project @@ -71,7 +68,7 @@ class FlamePrelaunch(PreLaunchHook): "project_data": project_data } - self.log.info(pformat(dict(_env))) + self.log.info(pformat(dict(self._env))) self.log.info(pformat(data_to_script)) # add to python path from settings @@ -92,7 +89,6 @@ class FlamePrelaunch(PreLaunchHook): self.launch_context.env["PYTHONPATH"] = os.pathsep.join(new_pythonpath) - def _get_launch_arguments(self, script_data): # Dump data to string dumped_script_data = json.dumps(script_data)