Add-on: evaluate visible job settings immediately
For each job setting, if it's visible and has an `eval` property, it is now evaluated immediately when switching job types. This means that properties like the frame range get filled in automatically. If there is already a value, this process is skipped, in order to not overwrite the user's choice. This resolves a common issue where the render job was rejected because the frame range was kept empty.
This commit is contained in:
parent
ca8a909e41
commit
8ddc03d6ef
@ -142,6 +142,8 @@ def update_job_type_properties(scene: bpy.types.Scene) -> None:
|
||||
description="Parameters for the Flamenco job",
|
||||
)
|
||||
|
||||
scene.flamenco_job_settings.eval_visible_settings_if_no_value(bpy.context)
|
||||
|
||||
|
||||
def _clear_available_job_types(scene: bpy.types.Scene) -> None:
|
||||
global _available_job_types
|
||||
|
@ -142,6 +142,33 @@ class JobTypePropertyGroup:
|
||||
|
||||
job.settings[setting.key] = value
|
||||
|
||||
def eval_visible_settings_if_no_value(self, context: bpy.types.Context) -> None:
|
||||
"""Assign default values to all visible, evaluatable settings.
|
||||
|
||||
If the setting already has a value, that value will not be overwritten
|
||||
in order to retain the user's input.
|
||||
|
||||
If the setting has an `eval` property, it'll be evaluated and used as
|
||||
the setting value. Otherwise it will be skipped.
|
||||
"""
|
||||
print(f"eval_visible_settings_if_no_value")
|
||||
for setting in self.job_type.settings:
|
||||
if not job_types.setting_is_visible(setting):
|
||||
# Skip those settings that will be hidden from the GUI.
|
||||
# These are evaluated at submission time anyway.
|
||||
continue
|
||||
|
||||
setting_eval = setting.get("eval", "")
|
||||
if not setting_eval:
|
||||
continue
|
||||
|
||||
if getattr(self, setting.key):
|
||||
# Non-falsey setting, so don't overwrite.
|
||||
continue
|
||||
|
||||
value = self.eval_setting(context, setting.key, setting_eval)
|
||||
setattr(self, setting.key, value)
|
||||
|
||||
@staticmethod
|
||||
def last_n_dir_parts(n: int, filepath: Union[str, Path, None] = None) -> Path:
|
||||
"""Return the last `n` parts of the directory of `filepath`.
|
||||
|
Loading…
x
Reference in New Issue
Block a user