Jump to content

discover actions based on asset sub component

Damien Keraudren

Recommended Posts

it was something like this @Lorenzo Angeli

    def discover(self, session, entities, event):
        '''Return True if only one asset version is selected, else the action don't show up'''

        if len(entities) != 1:
            return False

        entity_type, entity_id = entities[0]
        if entity_type == 'AssetVersion':
            query = 'AssetVersion where id = {}'.format(entity_id)
            av = session.query(query).first()
            components = av['components']
            for component in components:
                if component['name'] == 'main':
                    return True

        return False
Link to comment
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
  • Create New...