python.shotgun_model.simple_shotgun_hierarchy_model module

class SimpleShotgunHierarchyModel(parent, schema_generation=0, bg_task_manager=None, include_root=None)[source]

Bases: python.shotgun_model.shotgun_hierarchy_model.ShotgunHierarchyModel

Convenience wrapper around the Shotgun Hierarchy model for quick and easy access.

All you need to do is to instantiate the class (typically once, in your constructor) and then call load_data() to specify which shotgun nav_expand() query to load up the top-level items in the hierarchy. The remaining items will be queried asynchronously as items are expanded.

Subsequently call load_data() whenever you wish to change the nav_expand() query associated with the model.

This class derives from ShotgunHierarchyModel so all the customization methods available in the normal ShotgunHierarchyModel can also be subclassed from this class.

load_data(seed_entity_field, root=None, entity_fields=None)[source]

Loads shotgun data into the model, using the cache if possible.

Parameters:
  • seed_entity_field (str) –

    This is a string that corresponds to the field on an entity used to seed the hierarchy. For example, a value of Version.entity would cause the model to display a hierarchy where the leaves match the entity value of Version entities.

    NOTE: This value is currently limited to either Version.entity or PublishedFile.entity

  • root (dict) – This is the entity that will be at the root of the hierarchy view. By default, this value is None, which means the root of the hierarchy will be at the site level. Only projects can be set as the root of a hierarchy model.
  • entity_fields (dict) – A dictionary that identifies what fields to include on returned entities. Since the hierarchy can include any entity structure, this argument allows for specification of additional fields to include as these entities are returned. The dict’s keys correspond to the entity type and the value is a list of field names to return.