CustomEntity envoronment

Hey guys, I’m implementing a custom entity as a substructure for assets. Instead of asset type, I group assets by a custom entity that is called “asset_group”. All works fine. Folders are creating, files placed in a proper folder structure /assets/<asset_group>/…
But I have one problem. Shotgun toolkit actions are not showing in the right-click menu on the website if I’m on “Asset Group” page and clicking “asset group” entity. Shotgun starts to retrieve them but then everything disappears. I’ve added “asset_group.yml” file in the “tk-config/env” folder. And corrected “tk-config/core/hooks/” file

class PickEnvironment(Hook):
def execute(self, context, **kwargs):
The default implementation assumes there are three environments, called shot, asset
and project, and switches to these based on entity type.
if context.source_entity:
if context.source_entity[“type”] == “Version”:
return “version”
elif context.source_entity[“type”] == “PublishedFile”:
return “publishedfile”

    if context.project is None:
        # Our context is completely empty. We're going into the site context.
        return "site"

    if context.entity is None:
        # We have a project but not an entity.
        return "project"
    print context.entity["type"]
    if context.entity and context.step is None:
        # We have an entity but no step.
        if context.entity["type"] == "Shot":
            return "shot"
        if context.entity["type"] == "Asset":
            return "asset"
        if context.entity["type"] == "Sequence":
            return "sequence"
        if context.entity["type"] == "CustomEntity01":
            return "asset_group"

    if context.entity and context.step:
        # We have a step and an entity.
        if context.entity["type"] == "Shot":
            return "shot_step"
        if context.entity["type"] == "Asset":
            return "asset_step"

    return None

Still no success. Need help. How to make it work on the platform side.

1 Like

I think the menu items in shotgun Web are driven by the tk-shotgun engine so likely you’d need to make sure there are apps set up for that engine in your new environment.

Hi @grover_gol,

I think your issue might be coming from the fact that the desktopserver has an allow list of entities that it will process. The list is something like “Sequence”, “Task”, “Version”, and any entity that can be published to.

I’m hoping you can use that last bit to resolve your issue. If you go to your custom entity in your SG Site Preferences you should be able to turn on publishing on your entity.

I think this will allow you to add actions to the entity.

Thanks guys I’ve figured it out. All works now.