Addon: fix issue where invisible settings were not evaluated on submission
The code was still using the old `visible: true/false` approach, which was replaced with a visibility string. The GUI and job submission code now use the same function to determine visibility.
This commit is contained in:
parent
3541248551
commit
a833064fc1
@ -3,7 +3,7 @@
|
||||
|
||||
from typing import Optional, TYPE_CHECKING
|
||||
|
||||
from . import preferences
|
||||
from . import preferences, job_types
|
||||
from .job_types_propgroup import JobTypePropertyGroup
|
||||
|
||||
import bpy
|
||||
@ -85,7 +85,7 @@ class FLAMENCO_PT_job_submission(bpy.types.Panel):
|
||||
propgroup: JobTypePropertyGroup,
|
||||
setting: _AvailableJobSetting,
|
||||
) -> None:
|
||||
if not self.setting_is_visible(setting):
|
||||
if not job_types.setting_is_visible(setting):
|
||||
return
|
||||
|
||||
row = layout.row(align=True)
|
||||
@ -102,15 +102,6 @@ class FLAMENCO_PT_job_submission(bpy.types.Panel):
|
||||
op = row.operator("flamenco3.explore_file_path", text="", icon="WINDOW")
|
||||
op.path = getattr(propgroup, setting.key)
|
||||
|
||||
@staticmethod
|
||||
def setting_is_visible(setting: _AvailableJobSetting) -> bool:
|
||||
try:
|
||||
visibility = setting.visible
|
||||
except AttributeError:
|
||||
# The default is 'visible'.
|
||||
return True
|
||||
return str(visibility) in {"visible", "submission"}
|
||||
|
||||
def draw_setting_editable(
|
||||
self,
|
||||
layout: bpy.types.UILayout,
|
||||
|
@ -13,6 +13,7 @@ _log = logging.getLogger(__name__)
|
||||
if TYPE_CHECKING:
|
||||
from flamenco.manager import ApiClient as _ApiClient
|
||||
from flamenco.manager.models import (
|
||||
AvailableJobSetting as _AvailableJobSetting,
|
||||
AvailableJobType as _AvailableJobType,
|
||||
AvailableJobTypes as _AvailableJobTypes,
|
||||
SubmittedJob as _SubmittedJob,
|
||||
@ -20,6 +21,7 @@ if TYPE_CHECKING:
|
||||
)
|
||||
else:
|
||||
_ApiClient = object
|
||||
_AvailableJobSetting = object
|
||||
_AvailableJobType = object
|
||||
_AvailableJobTypes = object
|
||||
_JobSettings = object
|
||||
@ -57,6 +59,15 @@ def fetch_available_job_types(api_client: _ApiClient, scene: bpy.types.Scene) ->
|
||||
_store_available_job_types(response)
|
||||
|
||||
|
||||
def setting_is_visible(setting: _AvailableJobSetting) -> bool:
|
||||
try:
|
||||
visibility = setting.visible
|
||||
except AttributeError:
|
||||
# The default is 'visible'.
|
||||
return True
|
||||
return str(visibility) in {"visible", "submission"}
|
||||
|
||||
|
||||
def _store_available_job_types(available_job_types: _AvailableJobTypes) -> None:
|
||||
global _available_job_types
|
||||
global _job_type_enum_items
|
||||
|
@ -9,6 +9,8 @@ from typing import TYPE_CHECKING, Callable, Optional, Any, Union
|
||||
|
||||
import bpy
|
||||
|
||||
from . import job_types
|
||||
|
||||
_log = logging.getLogger(__name__)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@ -124,7 +126,7 @@ class JobTypePropertyGroup:
|
||||
setting value. Otherwise the default is used.
|
||||
"""
|
||||
for setting in self.job_type.settings:
|
||||
if setting.get("visible", True):
|
||||
if job_types.setting_is_visible(setting):
|
||||
# Skip those settings that will be visible in the GUI.
|
||||
continue
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user