Jump to content

Status changed event -- which entity was changed?


mark

Recommended Posts

Hi,

From an event listener I can see when a status is changed, but there's not context (that I'm aware of) on what type of entity it was changed on. Is there a way to find out what entity type (task, version, shot, etc) that status was changed on?

 

Thanks!

-Mark

Link to comment
Share on other sites

12 hours ago, mark said:

From an event listener I can see when a status is changed, but there's not context (that I'm aware of) on what type of entity it was changed on. Is there a way to find out what entity type (task, version, shot, etc) that status was changed on?

In the new API we have a common base class called TypedContext that represents objects like Task, Shot, Sequence. In events these are identified as "task" - a legacy name that should ultimately be changed.

To know what type of object it is you can simply do:

if legacy_entity_type == 'task':
    # The entity variable is now the correct subclass, i.e. Shot, Task, et.c.
    entity = session.get('TypedContext', entity_id)

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...