Sync branch magefile with main #104308

Merged
Sybren A. Stüvel merged 85 commits from abelli/flamenco:magefile into magefile 2024-05-13 16:26:32 +02:00
Showing only changes of commit 3aec8b15ef - Show all commits

View File

@ -25,10 +25,22 @@ else:
_available_job_types: Optional[list[_AvailableJobType]] = None _available_job_types: Optional[list[_AvailableJobType]] = None
# Enum property value that indicates 'no job type selected'. This is used
# because an empty string seems to be handled by Blender as 'nothing', which
# never seems to match an enum item even when there is one with "" as its 'key'.
_JOB_TYPE_NOT_SELECTED = "-"
_JOB_TYPE_NOT_SELECTED_ENUM_ITEM = (
_JOB_TYPE_NOT_SELECTED,
"Select a Job Type",
"",
0,
0,
)
# Items for a bpy.props.EnumProperty() # Items for a bpy.props.EnumProperty()
_job_type_enum_items: list[ _job_type_enum_items: list[
Union[tuple[str, str, str], tuple[str, str, str, int, int]] Union[tuple[str, str, str], tuple[str, str, str, int, int]]
] = [] ] = [_JOB_TYPE_NOT_SELECTED_ENUM_ITEM]
_selected_job_type_propgroup: Optional[ _selected_job_type_propgroup: Optional[
type[job_types_propgroup.JobTypePropertyGroup] type[job_types_propgroup.JobTypePropertyGroup]
@ -106,7 +118,7 @@ def _store_available_job_types(available_job_types: _AvailableJobTypes) -> None:
_job_type_enum_items = [ _job_type_enum_items = [
(job_type.name, job_type.label, "") for job_type in job_types (job_type.name, job_type.label, "") for job_type in job_types
] ]
_job_type_enum_items.insert(0, ("", "Select a Job Type", "", 0, 0)) _job_type_enum_items.insert(0, _JOB_TYPE_NOT_SELECTED_ENUM_ITEM)
def are_job_types_available() -> bool: def are_job_types_available() -> bool:
@ -215,6 +227,7 @@ def discard_flamenco_data():
def register() -> None: def register() -> None:
bpy.types.Scene.flamenco_job_type = bpy.props.EnumProperty( bpy.types.Scene.flamenco_job_type = bpy.props.EnumProperty(
name="Job Type", name="Job Type",
default=0,
items=_get_job_types_enum_items, items=_get_job_types_enum_items,
update=_update_job_type, update=_update_job_type,
) )