コード例 #1
0
def get_temporal_type_ids():
    shot_type = shots_service.get_shot_type()
    if shot_type is None:
        cache.cache.delete_memoized(shots_service.get_shot_type)
        shot_type = shots_service.get_shot_type()

    scene_type = shots_service.get_scene_type()
    if scene_type is None:
        cache.cache.delete_memoized(shots_service.get_scene_type)
        scene_type = shots_service.get_scene_type()

    sequence_type = shots_service.get_sequence_type()
    if sequence_type is None:
        cache.cache.delete_memoized(shots_service.get_sequence_type)
        sequence_type = shots_service.get_sequence_type()

    episode_type = shots_service.get_episode_type()
    if episode_type is None:
        cache.cache.delete_memoized(shots_service.get_episode_type)
        episode_type = shots_service.get_episode_type()

    ids_to_exclude = [shot_type["id"], sequence_type["id"], episode_type["id"]]
    if scene_type is not None:
        ids_to_exclude.append(scene_type["id"])

    return ids_to_exclude
コード例 #2
0
 def get(self):
     """
     Retrieve all scene, adds project name and asset type name and all
     related tasks.
     """
     criterions = query.get_query_criterions_from_request(request)
     user_service.check_project_access(criterions.get("project_id", None))
     criterions["entity_type_id"] = shots_service.get_scene_type()["id"]
     return entities_service.get_entities_and_tasks(criterions)
コード例 #3
0
ファイル: user_service.py プロジェクト: NeroSouza/zou
def get_sequence_scenes(sequence_id):
    scene_type = shots_service.get_scene_type()
    query = Entity.query \
        .join(Task, Project, ProjectStatus, EntityType) \
        .filter(Entity.entity_type_id == scene_type["id"]) \
        .filter(Entity.parent_id == sequence_id) \
        .filter(assignee_filter()) \
        .filter(open_project_filter())

    return Entity.serialize_list(query.all(), obj_type="Scene")
コード例 #4
0
def get_assets(criterions={}):
    shot_type = shots_service.get_shot_type()
    scene_type = shots_service.get_scene_type()
    sequence_type = shots_service.get_sequence_type()
    episode_type = shots_service.get_episode_type()
    query = Entity.query.filter_by(**criterions)
    result = query.filter(~Entity.entity_type_id.in_([
        shot_type["id"], scene_type["id"], sequence_type["id"],
        episode_type["id"]
    ])).all()
    return EntityType.serialize_list(result, obj_type="Asset")
コード例 #5
0
def is_asset_type(asset_type):
    shot_type = shots_service.get_shot_type()
    sequence_type = shots_service.get_sequence_type()
    scene_type = shots_service.get_scene_type()
    episode_type = shots_service.get_episode_type()

    return str(asset_type.id) not in [
        shot_type["id"],
        sequence_type["id"],
        scene_type["id"],
        episode_type["id"],
    ]
コード例 #6
0
def is_asset(entity):
    shot_type = shots_service.get_shot_type()
    sequence_type = shots_service.get_sequence_type()
    scene_type = shots_service.get_scene_type()
    episode_type = shots_service.get_episode_type()

    return str(entity.entity_type_id) not in [
        shot_type["id"],
        scene_type["id"],
        sequence_type["id"],
        episode_type["id"],
    ]
コード例 #7
0
ファイル: scene.py プロジェクト: tokejepsen/zou
    def extract_data(self, sg_scene):
        project_id = self.get_project(sg_scene, self.project_map)
        sequence_id = self.get_sequence(sg_scene)
        scene_type = shots_service.get_scene_type()

        data = {
            "name": sg_scene["code"],
            "shotgun_id": sg_scene["id"],
            "project_id": project_id,
            "entity_type_id": scene_type["id"],
            "parent_id": sequence_id
        }
        return data
コード例 #8
0
def build_entity_type_asset_type_filter():
    """
    Generate a query filter to filter entity types that are asset types (it
    means not shot, not sequence, not episode and not scene)
    """
    shot_type = shots_service.get_shot_type()
    scene_type = shots_service.get_scene_type()
    sequence_type = shots_service.get_sequence_type()
    episode_type = shots_service.get_episode_type()
    return ~EntityType.id.in_([
        shot_type["id"], scene_type["id"], sequence_type["id"],
        episode_type["id"]
    ])
コード例 #9
0
ファイル: user_service.py プロジェクト: ricekab/zou
def get_scenes_for_sequence(sequence_id):
    """
    Get all layout scenes for given sequence and for which the user has a task
    assigned.
    """
    scene_type = shots_service.get_scene_type()
    query = (Entity.query.join(
        Task, Project, ProjectStatus,
        EntityType).filter(Entity.entity_type_id == scene_type["id"]).filter(
            Entity.parent_id == sequence_id).filter(
                build_assignee_filter()).filter(build_open_project_filter()))

    return Entity.serialize_list(query.all(), obj_type="Scene")
コード例 #10
0
def is_asset_type(entity_type):
    """
    Returns true if given entity type is an asset, not a shot.
    """
    shot_type = shots_service.get_shot_type()
    sequence_type = shots_service.get_sequence_type()
    scene_type = shots_service.get_scene_type()
    episode_type = shots_service.get_episode_type()

    return str(entity_type.id) not in [
        shot_type["id"],
        sequence_type["id"],
        scene_type["id"],
        episode_type["id"],
    ]
コード例 #11
0
def get_asset_types(criterions={}):
    shot_type = shots_service.get_shot_type()
    sequence_type = shots_service.get_sequence_type()
    episode_type = shots_service.get_episode_type()
    scene_type = shots_service.get_scene_type()
    asset_type_filter = ~EntityType.id.in_([
        shot_type["id"],
        sequence_type["id"],
        episode_type["id"],
        scene_type["id"],
    ])
    query = EntityType.query \
        .filter_by(**criterions) \
        .filter(asset_type_filter)
    return EntityType.serialize_list(query.all(), obj_type="AssetType")
コード例 #12
0
ファイル: scene.py プロジェクト: tokejepsen/zou
    def import_entry(self, data):
        scene = Entity.get_by(
            shotgun_id=data["shotgun_id"],
            entity_type_id=shots_service.get_scene_type()["id"])

        if scene is None:
            scene = Entity(**data)
            scene.save()
            current_app.logger.info("Scene created: %s" % scene)

        else:
            scene.update(data)
            scene.save()
            current_app.logger.info("Scene updated: %s" % scene)

        return scene
コード例 #13
0
ファイル: assets_service.py プロジェクト: cgwire/zou
def is_asset_dict(entity):
    """
    Returns true if given entity is an asset, not a shot.
    It supposes that the entity is represented as a dict.
    """
    shot_type = shots_service.get_shot_type()
    sequence_type = shots_service.get_sequence_type()
    scene_type = shots_service.get_scene_type()
    episode_type = shots_service.get_episode_type()

    return entity["entity_type_id"] not in [
        shot_type["id"],
        scene_type["id"],
        sequence_type["id"],
        episode_type["id"],
    ]
コード例 #14
0
def all_assets(criterions={}):
    shot_type = shots_service.get_shot_type()
    scene_type = shots_service.get_scene_type()
    sequence_type = shots_service.get_sequence_type()
    episode_type = shots_service.get_episode_type()
    query = Entity.query.filter_by(**criterions)
    query = query.filter(~Entity.entity_type_id.in_([
        shot_type["id"], scene_type["id"], sequence_type["id"],
        episode_type["id"]
    ]))
    query = query.join(Project)
    query = query.join(EntityType)
    query = query.add_columns(Project.name)
    query = query.add_columns(EntityType.name)

    data = query.all()
    assets = []
    for (asset_model, project_name, asset_type_name) in data:
        asset = asset_model.serialize(obj_type="Asset")
        asset["project_name"] = project_name
        asset["asset_type_name"] = asset_type_name
        assets.append(asset)

    return assets
コード例 #15
0
ファイル: scene.py プロジェクト: tokejepsen/zou
 def __init__(self):
     ImportRemoveShotgunBaseResource.__init__(
         self, Entity, entity_type_id=shots_service.get_scene_type()["id"])
コード例 #16
0
def all_assets_and_tasks(criterions={}, page=1):
    shot_type = shots_service.get_shot_type()
    sequence_type = shots_service.get_sequence_type()
    episode_type = shots_service.get_episode_type()
    scene_type = shots_service.get_scene_type()
    asset_map = {}
    task_map = {}

    query = Entity.query \
        .join(EntityType) \
        .outerjoin(Task) \
        .outerjoin(assignees_table) \
        .add_columns(
            EntityType.name,
            Task.id,
            Task.task_type_id,
            Task.task_status_id,
            assignees_table.columns.person
        ) \
        .order_by(
            EntityType.name,
            Entity.name
        ) \
        .filter(
            ~Entity.entity_type_id.in_([
                shot_type["id"],
                scene_type["id"],
                sequence_type["id"],
                episode_type["id"]
            ])
        )

    if "project_id" in criterions:
        query = query.filter(Entity.project_id == criterions["project_id"])

    for (asset, entity_type_name, task_id, task_type_id, task_status_id,
         person_id) in query.all():

        if asset.id not in asset_map:
            asset_map[asset.id] = {
                "id": str(asset.id),
                "name": asset.name,
                "preview_file_id": str(asset.preview_file_id or ""),
                "description": asset.description,
                "asset_type_name": entity_type_name,
                "asset_type_id": str(asset.entity_type_id),
                "canceled": asset.canceled,
                "data": fields.serialize_value(asset.data),
                "tasks": []
            }

        if task_id is not None:
            if task_id not in task_map:
                task_dict = {
                    "id": str(task_id),
                    "entity_id": str(asset.id),
                    "task_status_id": str(task_status_id),
                    "task_type_id": str(task_type_id),
                    "assignees": []
                }
                task_map[task_id] = task_dict
                asset_dict = asset_map[asset.id]
                asset_dict["tasks"].append(task_dict)

            if person_id:
                task_map[task_id]["assignees"].append(str(person_id))

    return list(asset_map.values())
コード例 #17
0
ファイル: test_shots_service.py プロジェクト: tokejepsen/zou
 def test_get_scene_type(self):
     scene_type = shots_service.get_scene_type()
     self.assertEqual(scene_type["name"], "Scene")
コード例 #18
0
def get_scene_asset_instances_for_asset(asset_id):
    return get_entity_asset_instances_for_asset(
        asset_id,
        shots_service.get_scene_type()["id"])