mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 00:44:52 +01:00
emit BeforeWorkfileSave event in workfiles tool
This commit is contained in:
parent
4aa096d5bc
commit
4e904288ad
3 changed files with 10 additions and 2 deletions
|
|
@ -218,7 +218,8 @@ def on_task_changed(*args):
|
|||
)
|
||||
|
||||
|
||||
def before_workfile_save(workfile_path, workdir_path):
|
||||
def before_workfile_save(event):
|
||||
workdir_path = event.workdir_path
|
||||
if workdir_path:
|
||||
copy_workspace_mel(workdir_path)
|
||||
|
||||
|
|
|
|||
|
|
@ -31,10 +31,16 @@ class BaseEvent(object):
|
|||
|
||||
@classmethod
|
||||
def emit(cls, *args, **kwargs):
|
||||
"""Create object of event and emit.
|
||||
|
||||
Args:
|
||||
Same args as '__init__' expects which may be class specific.
|
||||
"""
|
||||
from avalon import pipeline
|
||||
|
||||
obj = cls(*args, **kwargs)
|
||||
pipeline.emit(obj.topic, [obj])
|
||||
return obj
|
||||
|
||||
|
||||
class BeforeWorkfileSave(BaseEvent):
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ from Qt import QtWidgets, QtCore
|
|||
from avalon import io, api, pipeline
|
||||
|
||||
from openpype import style
|
||||
from openpype.pipeline.lib import BeforeWorkfileSave
|
||||
from openpype.tools.utils.lib import (
|
||||
qt_app_context
|
||||
)
|
||||
|
|
@ -670,7 +671,7 @@ class FilesWidget(QtWidgets.QWidget):
|
|||
os.path.normpath(self._workfiles_root), work_file
|
||||
)
|
||||
|
||||
pipeline.emit("before.workfile.save", [file_path, self._workdir_path])
|
||||
BeforeWorkfileSave.emit(file_path, self._workdir_path)
|
||||
|
||||
self._enter_session() # Make sure we are in the right session
|
||||
self.host.save_file(file_path)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue