Status changed event -- which entity was changed?
2 2

2 posts in this topic

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

Share this post


Link to post
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)

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
2 2