Skip to content

Commit

Permalink
Use profiles instead
Browse files Browse the repository at this point in the history
  • Loading branch information
BigRoy committed Sep 6, 2024
1 parent a5e3dc6 commit 6534f1c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
16 changes: 11 additions & 5 deletions client/ayon_blender/api/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
from ayon_core.lib import (
Logger,
register_event_callback,
emit_event
emit_event,
filter_profiles
)
from ayon_core.settings import get_project_settings
from ayon_blender import BLENDER_ADDON_ROOT
Expand Down Expand Up @@ -278,10 +279,15 @@ def set_frame_range(entity: dict):
task_type = entity.get("taskType")
include_handles_settings = settings["blender"]["include_handles"]
include_handles = include_handles_settings["include_handles_default"]
for item in include_handles_settings["per_task_type"]:
if task_type in item["task_types"]:
include_handles = item["include_handles"]
break
profile = filter_profiles(
include_handles_settings["profiles"],
key_values={
"task_types": task_type,
"task_names": entity["name"]
}
)
if profile:
include_handles = profile["include_handles"]
if include_handles:
frame_start -= int(attrib.get("handleStart", 0))
frame_end += int(attrib.get("handleEnd", 0))
Expand Down
18 changes: 12 additions & 6 deletions server/settings/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,17 @@ class UnitScaleSettingsModel(BaseSettingsModel):
)


class IncludeByTaskTypeModel(BaseSettingsModel):
class IncludeHandlesProfilesModel(BaseSettingsModel):
task_types: list[str] = SettingsField(
default_factory=list,
title="Task types",
enum_resolver=task_types_enum
title="Task Types",
description="Filter by task types",
enum_resolver=task_types_enum,
)
task_names: list[str] = SettingsField(
default_factory=list,
title="Task Names",
description="Filter by task names.",
)
include_handles: bool = SettingsField(True, title="Include handles")

Expand All @@ -37,9 +43,9 @@ class IncludeHandlesModel(BaseSettingsModel):
include_handles_default: bool = SettingsField(
False, title="Include handles by default"
)
per_task_type: list[IncludeByTaskTypeModel] = SettingsField(
profiles: list[IncludeHandlesProfilesModel] = SettingsField(
default_factory=list,
title="Include/exclude handles by task type"
title="Include/exclude handles by profiles"
)


Expand Down Expand Up @@ -86,7 +92,7 @@ class BlenderSettings(BaseSettingsModel):
"set_resolution_startup": True,
"include_handles": {
"include_handles_default": False,
"per_task_type": []
"profiles": []
},
"RenderSettings": DEFAULT_RENDER_SETTINGS,
"publish": DEFAULT_BLENDER_PUBLISH_SETTINGS,
Expand Down

0 comments on commit 6534f1c

Please sign in to comment.