mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 00:44:52 +01:00
added emit function
This commit is contained in:
parent
7a1edd6b1e
commit
4aa096d5bc
1 changed files with 9 additions and 1 deletions
|
|
@ -1,7 +1,8 @@
|
|||
"""Events holding data about specific event."""
|
||||
|
||||
|
||||
class BaseEvent:
|
||||
# Inherit from 'object' for Python 2 hosts
|
||||
class BaseEvent(object):
|
||||
"""Base event object.
|
||||
|
||||
Can be used to anything because data are not much specific. Only required
|
||||
|
|
@ -28,6 +29,13 @@ class BaseEvent:
|
|||
def topic(self):
|
||||
return self._topic
|
||||
|
||||
@classmethod
|
||||
def emit(cls, *args, **kwargs):
|
||||
from avalon import pipeline
|
||||
|
||||
obj = cls(*args, **kwargs)
|
||||
pipeline.emit(obj.topic, [obj])
|
||||
|
||||
|
||||
class BeforeWorkfileSave(BaseEvent):
|
||||
"""Before workfile changes event data."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue