From 330f3cc4d3a98359f6b7a963ab5ff91afbe93194 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 10 Mar 2021 12:55:29 +0100 Subject: [PATCH] there is no need of overriding taskChanged event only add new callback --- pype/hosts/maya/api/__init__.py | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/pype/hosts/maya/api/__init__.py b/pype/hosts/maya/api/__init__.py index 27e15e0b25..ea100dda0f 100644 --- a/pype/hosts/maya/api/__init__.py +++ b/pype/hosts/maya/api/__init__.py @@ -7,7 +7,7 @@ from maya import utils, cmds from avalon import api as avalon from avalon import pipeline from avalon.maya import suspended_refresh -from avalon.maya.pipeline import IS_HEADLESS, _on_task_changed +from avalon.maya.pipeline import IS_HEADLESS from avalon.tools import workfiles from pyblish import api as pyblish from pype.lib import any_outdated @@ -45,9 +45,7 @@ def install(): avalon.on("open", on_open) avalon.on("new", on_new) avalon.before("save", on_before_save) - - log.info("Overriding existing event 'taskChanged'") - override_event("taskChanged", on_task_changed) + avalon.on("taskChanged", on_task_changed) log.info("Setting default family states for loader..") avalon.data["familiesStateToggled"] = ["imagesequence"] @@ -61,24 +59,6 @@ def uninstall(): menu.uninstall() -def override_event(event, callback): - """ - Override existing event callback - Args: - event (str): name of the event - callback (function): callback to be triggered - - Returns: - None - - """ - - ref = weakref.WeakSet() - ref.add(callback) - - pipeline._registered_event_handlers[event] = ref - - def on_init(_): avalon.logger.info("Running callback on init..") @@ -215,7 +195,6 @@ def on_new(_): def on_task_changed(*args): """Wrapped function of app initialize and maya's on task changed""" # Run - _on_task_changed() with suspended_refresh(): lib.set_context_settings() lib.update_content_on_context_change()