Use new job setting visibility rules
Update the Blender add-on, web interface, and job compiler script to use the new visibility settings of job settings.
This commit is contained in:
parent
1086fcbc28
commit
fd0ff82352
@ -85,7 +85,7 @@ class FLAMENCO_PT_job_submission(bpy.types.Panel):
|
|||||||
propgroup: JobTypePropertyGroup,
|
propgroup: JobTypePropertyGroup,
|
||||||
setting: _AvailableJobSetting,
|
setting: _AvailableJobSetting,
|
||||||
) -> None:
|
) -> None:
|
||||||
if not setting.get("visible", True):
|
if not self.setting_is_visible(setting):
|
||||||
return
|
return
|
||||||
|
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
@ -102,6 +102,15 @@ class FLAMENCO_PT_job_submission(bpy.types.Panel):
|
|||||||
op = row.operator("flamenco3.explore_file_path", text="", icon="WINDOW")
|
op = row.operator("flamenco3.explore_file_path", text="", icon="WINDOW")
|
||||||
op.path = getattr(propgroup, setting.key)
|
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(
|
def draw_setting_editable(
|
||||||
self,
|
self,
|
||||||
layout: bpy.types.UILayout,
|
layout: bpy.types.UILayout,
|
||||||
|
@ -9,30 +9,30 @@ const JOB_TYPE = {
|
|||||||
{ key: "chunk_size", type: "int32", default: 1, description: "Number of frames to render in one Blender render task" },
|
{ key: "chunk_size", type: "int32", default: 1, description: "Number of frames to render in one Blender render task" },
|
||||||
|
|
||||||
// render_output_root + add_path_components determine the value of render_output_path.
|
// render_output_root + add_path_components determine the value of render_output_path.
|
||||||
{ key: "render_output_root", type: "string", subtype: "dir_path", required: true,
|
{ key: "render_output_root", type: "string", subtype: "dir_path", required: true, visible: "submission",
|
||||||
description: "Base directory of where render output is stored. Will have some job-specific parts appended to it"},
|
description: "Base directory of where render output is stored. Will have some job-specific parts appended to it"},
|
||||||
{ key: "add_path_components", type: "int32", required: true, default: 0, propargs: {min: 0, max: 32},
|
{ key: "add_path_components", type: "int32", required: true, default: 0, propargs: {min: 0, max: 32}, visible: "submission",
|
||||||
description: "Number of path components of the current blend file to use in the render output path"},
|
description: "Number of path components of the current blend file to use in the render output path"},
|
||||||
{ key: "render_output_path", type: "string", subtype: "file_path", editable: false,
|
{ key: "render_output_path", type: "string", subtype: "file_path", editable: false,
|
||||||
eval: "str(Path(settings.render_output_root) / last_n_dir_parts(settings.add_path_components) / jobname / '{timestamp}' / '######')",
|
eval: "str(Path(settings.render_output_root) / last_n_dir_parts(settings.add_path_components) / jobname / '{timestamp}' / '######')",
|
||||||
description: "Final file path of where render output will be saved"},
|
description: "Final file path of where render output will be saved"},
|
||||||
|
|
||||||
// Automatically evaluated settings:
|
// Automatically evaluated settings:
|
||||||
{ key: "blender_cmd", type: "string", default: "{blender}", visible: false },
|
{ key: "blender_cmd", type: "string", default: "{blender}", visible: "hidden" },
|
||||||
{ key: "blendfile", type: "string", required: true, description: "Path of the Blend file to render", visible: false },
|
{ key: "blendfile", type: "string", required: true, description: "Path of the Blend file to render", visible: "hidden" },
|
||||||
{ key: "fps", type: "float", eval: "C.scene.render.fps / C.scene.render.fps_base", visible: false },
|
{ key: "fps", type: "float", eval: "C.scene.render.fps / C.scene.render.fps_base", visible: "hidden" },
|
||||||
{
|
{
|
||||||
key: "images_or_video",
|
key: "images_or_video",
|
||||||
type: "string",
|
type: "string",
|
||||||
required: true,
|
required: true,
|
||||||
choices: ["images", "video"],
|
choices: ["images", "video"],
|
||||||
visible: false,
|
visible: "hidden",
|
||||||
eval: "'video' if C.scene.render.image_settings.file_format in {'FFMPEG', 'AVI_RAW', 'AVI_JPEG'} else 'images'"
|
eval: "'video' if C.scene.render.image_settings.file_format in {'FFMPEG', 'AVI_RAW', 'AVI_JPEG'} else 'images'"
|
||||||
},
|
},
|
||||||
{ key: "format", type: "string", required: true, eval: "C.scene.render.image_settings.file_format", visible: false },
|
{ key: "format", type: "string", required: true, eval: "C.scene.render.image_settings.file_format", visible: "web" },
|
||||||
{ key: "image_file_extension", type: "string", required: true, eval: "C.scene.render.file_extension", visible: false,
|
{ key: "image_file_extension", type: "string", required: true, eval: "C.scene.render.file_extension", visible: "hidden",
|
||||||
description: "File extension used when rendering images; ignored when images_or_video='video'" },
|
description: "File extension used when rendering images; ignored when images_or_video='video'" },
|
||||||
{ key: "video_container_format", type: "string", required: true, eval: "C.scene.render.ffmpeg.format", visible: false,
|
{ key: "video_container_format", type: "string", required: true, eval: "C.scene.render.ffmpeg.format", visible: "hidden",
|
||||||
description: "Container format used when rendering video; ignored when images_or_video='images'" },
|
description: "Container format used when rendering video; ignored when images_or_video='images'" },
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
@ -147,6 +147,11 @@ export default {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Construct a set of `setting.visible` values that should make the
|
||||||
|
// setting visible here in the web interface.
|
||||||
|
const v = new API.AvailableJobSettingVisibility();
|
||||||
|
const visible = new Set([undefined, v.visible, v.web]);
|
||||||
|
|
||||||
const filtered = {};
|
const filtered = {};
|
||||||
for (let key in newJobSettings) {
|
for (let key in newJobSettings) {
|
||||||
const setting = this.jobTypeSettings[key];
|
const setting = this.jobTypeSettings[key];
|
||||||
@ -156,7 +161,7 @@ export default {
|
|||||||
// or when the submission system simply added custom settings.
|
// or when the submission system simply added custom settings.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (setting.visible !== false) {
|
if (visible.has(setting.visible)) {
|
||||||
filtered[key] = newJobSettings[key];
|
filtered[key] = newJobSettings[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user