better queue render
This commit is contained in:
@@ -11,6 +11,7 @@ const App = {
|
||||
ProgressBar.init();
|
||||
UpdateBanner.init();
|
||||
BlenderPath.init();
|
||||
NotificationConfig.init();
|
||||
|
||||
App._bind_events();
|
||||
App._bind_render_events();
|
||||
@@ -44,6 +45,11 @@ const App = {
|
||||
App._stop_render();
|
||||
});
|
||||
|
||||
let obj_btn_check = document.getElementById("btn_check_queue");
|
||||
obj_btn_check.addEventListener("click", () => {
|
||||
App._check_queue();
|
||||
});
|
||||
|
||||
let obj_btn_save = document.getElementById("btn_save_config");
|
||||
obj_btn_save.addEventListener("click", () => {
|
||||
App._save_config();
|
||||
@@ -218,6 +224,51 @@ const App = {
|
||||
});
|
||||
},
|
||||
|
||||
_check_queue: () => {
|
||||
let obj_btn_check = document.getElementById("btn_check_queue");
|
||||
if (obj_btn_check.disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!App.str_output_path) {
|
||||
ConsoleLog.add("Veuillez selectionner un dossier de sortie.");
|
||||
return;
|
||||
}
|
||||
|
||||
let str_mode = document.querySelector('input[name="render_mode"]:checked').value;
|
||||
let str_output_mode = document.querySelector('input[name="output_mode"]:checked').value;
|
||||
let list_cameras = CameraList.list_cameras;
|
||||
let str_frame_prefix = document.getElementById("input_frame_prefix").value || "";
|
||||
let nb_frame_padding = parseInt(document.getElementById("input_frame_padding").value, 10) || 5;
|
||||
|
||||
let obj_config = {
|
||||
str_blend_file: App.str_blend_path,
|
||||
str_render_mode: str_mode,
|
||||
str_output_mode: str_output_mode,
|
||||
str_frame_prefix: str_frame_prefix,
|
||||
nb_frame_padding: nb_frame_padding,
|
||||
str_output_path: App.str_output_path,
|
||||
list_cameras: list_cameras,
|
||||
};
|
||||
|
||||
RenderQueue.build_display(str_mode, list_cameras);
|
||||
obj_btn_check.disabled = true;
|
||||
ConsoleLog.add("Verification des fichiers existants...");
|
||||
|
||||
window.api.check_queue(obj_config)
|
||||
.then((obj_result) => {
|
||||
obj_btn_check.disabled = false;
|
||||
RenderQueue.mark_existing(obj_result.list_existing);
|
||||
let nb_existing = obj_result.list_existing.length;
|
||||
let nb_to_render = obj_result.nb_total - nb_existing;
|
||||
ConsoleLog.add("Verification terminee : " + nb_existing + " fichier(s) existant(s), " + nb_to_render + " a rendre.");
|
||||
})
|
||||
.catch((obj_err) => {
|
||||
obj_btn_check.disabled = false;
|
||||
ConsoleLog.add("Erreur verification : " + obj_err.message);
|
||||
});
|
||||
},
|
||||
|
||||
_save_config: () => {
|
||||
let str_mode = document.querySelector('input[name="render_mode"]:checked').value;
|
||||
let str_output_mode = document.querySelector('input[name="output_mode"]:checked').value;
|
||||
@@ -311,15 +362,18 @@ const App = {
|
||||
let obj_btn_start = document.getElementById("btn_start");
|
||||
let obj_btn_pause = document.getElementById("btn_pause");
|
||||
let obj_btn_stop = document.getElementById("btn_stop");
|
||||
let obj_btn_check = document.getElementById("btn_check_queue");
|
||||
|
||||
if (str_state === "running") {
|
||||
obj_btn_start.disabled = true;
|
||||
obj_btn_pause.disabled = false;
|
||||
obj_btn_stop.disabled = false;
|
||||
obj_btn_check.disabled = true;
|
||||
} else if (str_state === "paused") {
|
||||
obj_btn_start.disabled = false;
|
||||
obj_btn_pause.disabled = true;
|
||||
obj_btn_stop.disabled = false;
|
||||
obj_btn_check.disabled = true;
|
||||
} else {
|
||||
App._update_start_button();
|
||||
obj_btn_pause.disabled = true;
|
||||
@@ -329,10 +383,12 @@ const App = {
|
||||
|
||||
_update_start_button: () => {
|
||||
let obj_btn_start = document.getElementById("btn_start");
|
||||
let obj_btn_check = document.getElementById("btn_check_queue");
|
||||
let is_ready = App.str_blend_path
|
||||
&& App.str_output_path
|
||||
&& CameraList.get_enabled_cameras().length > 0;
|
||||
obj_btn_start.disabled = !is_ready;
|
||||
obj_btn_check.disabled = !is_ready;
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user