Blender Kitsu: fix task type filtering for the active project #216

Merged
Nick Alberelli merged 2 commits from slumber/blender-studio-pipeline:fix-project-task-filtering into main 2024-02-01 14:21:57 +01:00
Contributor

In a multi-project Kitsu instance, a given project doesn't necessary inherit all TaskTypes from the instance.

This small patch filter task type enum according to the active project.

In a multi-project Kitsu instance, a given project doesn't necessary inherit all TaskTypes from the instance. This small patch filter task type enum according to the active project.
Swann Martinez added 1 commit 2024-01-26 16:23:20 +01:00
Swann Martinez changed title from fix: filter task type for the active project to Blender Kitsu: fix task type filtering for the active project 2024-01-26 16:24:00 +01:00
Nick Alberelli requested changes 2024-01-31 19:10:21 +01:00
Nick Alberelli left a comment
Member

Hello @slumber thank you for your contribution. I do have some feedback, I would make the same change on the function get_task_types_enum_for_current_context which is called by the Kitsu Context UI & Shot Builder UI.

def get_task_types_enum_for_current_context(
    self: bpy.types.Operator, context: bpy.types.Context
) -> List[Tuple[str, str, str]]:
    global _task_types_enum_list
    global _project_active

    # Import within function to avoid circular import
    from .context import core as context_core

    items = []
    if context_core.is_shot_context():
        items = [
            (t.id, t.name, "")
            for t in TaskType.all_shot_task_types()
            if t.id in _project_active.task_types
        ]

    if context_core.is_asset_context():
        items = [
            (t.id, t.name, "")
            for t in TaskType.all_asset_task_types()
            if t.id in _project_active.task_types
        ]

    if context_core.is_sequence_context():
        items = [
            (t.id, t.name, "")
            for t in TaskType.all_sequence_task_types()
            if t.id in _project_active.task_types
        ]

    _task_types_enum_list.clear()
    _task_types_enum_list.extend(items)

    return _task_types_enum_list
Hello @slumber thank you for your contribution. I do have some feedback, I would make the same change on the function `get_task_types_enum_for_current_context` which is called by the Kitsu Context UI & Shot Builder UI. ```python def get_task_types_enum_for_current_context( self: bpy.types.Operator, context: bpy.types.Context ) -> List[Tuple[str, str, str]]: global _task_types_enum_list global _project_active # Import within function to avoid circular import from .context import core as context_core items = [] if context_core.is_shot_context(): items = [ (t.id, t.name, "") for t in TaskType.all_shot_task_types() if t.id in _project_active.task_types ] if context_core.is_asset_context(): items = [ (t.id, t.name, "") for t in TaskType.all_asset_task_types() if t.id in _project_active.task_types ] if context_core.is_sequence_context(): items = [ (t.id, t.name, "") for t in TaskType.all_sequence_task_types() if t.id in _project_active.task_types ] _task_types_enum_list.clear() _task_types_enum_list.extend(items) return _task_types_enum_list ```
Swann Martinez added 1 commit 2024-02-01 10:44:35 +01:00
Author
Contributor

Thanks for the review 🙏 I just added the modification 🙂

Thanks for the review 🙏 I just added the modification 🙂
Nick Alberelli merged commit b4e5ef7247 into main 2024-02-01 14:21:57 +01:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: studio/blender-studio-tools#216
No description provided.