flame: small fixes

This commit is contained in:
Jakub Jezek 2022-01-07 16:37:37 +01:00
parent a24b43451d
commit 9913872a2a
No known key found for this signature in database
GPG key ID: D8548FBF690B100A
2 changed files with 10 additions and 28 deletions

View file

@ -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

View file

@ -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)