better queue render
This commit is contained in:
@@ -13,13 +13,56 @@ const BlenderProcess = {
|
||||
|
||||
let str_safe_name = str_camera_name.replace(/\\/g, "\\\\").replace(/'/g, "\\'");
|
||||
|
||||
let str_python_expr = [
|
||||
let list_python_lines = [
|
||||
"import bpy",
|
||||
"scene=bpy.context.scene",
|
||||
"scene.camera=bpy.data.objects['" + str_safe_name + "']",
|
||||
"scene.render.resolution_x=" + nb_resolution_x,
|
||||
"scene.render.resolution_y=" + nb_resolution_y,
|
||||
].join(";");
|
||||
];
|
||||
|
||||
if (obj_params.obj_render_settings) {
|
||||
let obj_rs = obj_params.obj_render_settings;
|
||||
if (obj_rs.str_engine) {
|
||||
list_python_lines.push("scene.render.engine='" + obj_rs.str_engine + "'");
|
||||
}
|
||||
if (obj_rs.nb_resolution_percentage !== undefined) {
|
||||
list_python_lines.push("scene.render.resolution_percentage=" + obj_rs.nb_resolution_percentage);
|
||||
}
|
||||
if (obj_rs.is_film_transparent !== undefined) {
|
||||
list_python_lines.push("scene.render.film_transparent=" + (obj_rs.is_film_transparent ? "True" : "False"));
|
||||
}
|
||||
if (obj_rs.str_engine === "CYCLES") {
|
||||
if (obj_rs.nb_samples !== undefined) {
|
||||
list_python_lines.push("scene.cycles.samples=" + obj_rs.nb_samples);
|
||||
}
|
||||
if (obj_rs.str_device) {
|
||||
list_python_lines.push("scene.cycles.device='" + obj_rs.str_device + "'");
|
||||
}
|
||||
if (obj_rs.is_denoise !== undefined) {
|
||||
list_python_lines.push("scene.cycles.use_denoising=" + (obj_rs.is_denoise ? "True" : "False"));
|
||||
}
|
||||
} else if (obj_rs.str_engine === "BLENDER_EEVEE" || obj_rs.str_engine === "BLENDER_EEVEE_NEXT") {
|
||||
if (obj_rs.nb_samples !== undefined) {
|
||||
list_python_lines.push("try:\n scene.eevee.taa_render_samples=" + obj_rs.nb_samples + "\nexcept:\n try:\n scene.eevee.samples=" + obj_rs.nb_samples + "\n except:pass");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let str_python_expr = list_python_lines.join(";");
|
||||
|
||||
if (obj_params.list_collections && obj_params.list_collections.length > 0) {
|
||||
str_python_expr += "\ndef _slc(lc,n,v):"
|
||||
+ "\n for c in lc.children:"
|
||||
+ "\n if c.name==n:c.exclude=v;return"
|
||||
+ "\n _slc(c,n,v)\n";
|
||||
for (let obj_col of obj_params.list_collections) {
|
||||
let str_col_safe = obj_col.str_name.replace(/\\/g, "\\\\").replace(/'/g, "\\'");
|
||||
let str_val = obj_col.is_hide_render ? "True" : "False";
|
||||
str_python_expr += "bpy.data.collections['" + str_col_safe + "'].hide_render=" + str_val
|
||||
+ ";_slc(bpy.context.view_layer.layer_collection,'" + str_col_safe + "'," + str_val + ")\n";
|
||||
}
|
||||
}
|
||||
|
||||
let list_args = [
|
||||
"-b", str_blend_path,
|
||||
|
||||
Reference in New Issue
Block a user