Supress information output when doing serialized ouput for PsychoBlend.
This commit is contained in:
parent
13ee6066b8
commit
2a66485595
|
@ -45,9 +45,9 @@ class PsychopathRender(bpy.types.RenderEngine):
|
||||||
if crop != None:
|
if crop != None:
|
||||||
args += ["--crop", str(crop[0]), str(self.size_y - crop[3]), str(crop[2] - 1), str(self.size_y - crop[1] - 1)]
|
args += ["--crop", str(crop[0]), str(self.size_y - crop[3]), str(crop[2] - 1), str(self.size_y - crop[1] - 1)]
|
||||||
if use_stdin:
|
if use_stdin:
|
||||||
args += ["--spb", str(scene.psychopath.max_samples_per_bucket), "--blender_output", "--use_stdin"]
|
args += ["--spb", str(scene.psychopath.max_samples_per_bucket), "--serialized_output", "--use_stdin"]
|
||||||
else:
|
else:
|
||||||
args += ["--spb", str(scene.psychopath.max_samples_per_bucket), "--blender_output", "-i", psy_filepath]
|
args += ["--spb", str(scene.psychopath.max_samples_per_bucket), "--serialized_output", "-i", psy_filepath]
|
||||||
|
|
||||||
# Start Rendering!
|
# Start Rendering!
|
||||||
try:
|
try:
|
||||||
|
|
41
src/main.rs
41
src/main.rs
|
@ -158,9 +158,9 @@ fn main() {
|
||||||
.help("Show useful dev/debug info.")
|
.help("Show useful dev/debug info.")
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("blender_output")
|
Arg::with_name("serialized_output")
|
||||||
.long("blender_output")
|
.long("serialized_output")
|
||||||
.help("Used by PsychoBlend to pass render output through standard in/out.")
|
.help("Serialize and send render output to standard output.")
|
||||||
.hidden(true)
|
.hidden(true)
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
|
@ -200,9 +200,11 @@ fn main() {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Parse data tree of scene file
|
// Parse data tree of scene file
|
||||||
println!(
|
if !args.is_present("serialized_output") {
|
||||||
"Parsing scene file...",
|
println!(
|
||||||
);
|
"Parsing scene file...",
|
||||||
|
);
|
||||||
|
}
|
||||||
t.tick();
|
t.tick();
|
||||||
let psy_contents = if args.is_present("use_stdin") {
|
let psy_contents = if args.is_present("use_stdin") {
|
||||||
// Read from stdin
|
// Read from stdin
|
||||||
|
@ -244,14 +246,18 @@ fn main() {
|
||||||
};
|
};
|
||||||
|
|
||||||
let dt = DataTree::from_str(&psy_contents).unwrap();
|
let dt = DataTree::from_str(&psy_contents).unwrap();
|
||||||
println!("\tParsed scene file in {:.3}s", t.tick());
|
if !args.is_present("serialized_output") {
|
||||||
|
println!("\tParsed scene file in {:.3}s", t.tick());
|
||||||
|
}
|
||||||
|
|
||||||
// Iterate through scenes and render them
|
// Iterate through scenes and render them
|
||||||
if let DataTree::Internal { ref children, .. } = dt {
|
if let DataTree::Internal { ref children, .. } = dt {
|
||||||
for child in children {
|
for child in children {
|
||||||
t.tick();
|
t.tick();
|
||||||
if child.type_name() == "Scene" {
|
if child.type_name() == "Scene" {
|
||||||
println!("Building scene...");
|
if !args.is_present("serialized_output") {
|
||||||
|
println!("Building scene...");
|
||||||
|
}
|
||||||
|
|
||||||
let arena = MemArena::with_min_block_size((1 << 20) * 4);
|
let arena = MemArena::with_min_block_size((1 << 20) * 4);
|
||||||
let mut r = parse_scene(&arena, child).unwrap_or_else(
|
let mut r = parse_scene(&arena, child).unwrap_or_else(
|
||||||
|
@ -262,7 +268,9 @@ fn main() {
|
||||||
);
|
);
|
||||||
|
|
||||||
if let Some(spp) = args.value_of("spp") {
|
if let Some(spp) = args.value_of("spp") {
|
||||||
println!("\tOverriding scene spp: {}", spp);
|
if !args.is_present("serialized_output") {
|
||||||
|
println!("\tOverriding scene spp: {}", spp);
|
||||||
|
}
|
||||||
r.spp = usize::from_str(&spp).unwrap();
|
r.spp = usize::from_str(&spp).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,17 +286,21 @@ fn main() {
|
||||||
num_cpus::get() as u32
|
num_cpus::get() as u32
|
||||||
};
|
};
|
||||||
|
|
||||||
println!("\tBuilt scene in {:.3}s", t.tick());
|
if !args.is_present("serialized_output") {
|
||||||
|
println!("\tBuilt scene in {:.3}s", t.tick());
|
||||||
|
}
|
||||||
|
|
||||||
println!("Rendering scene with {} threads...", thread_count);
|
if !args.is_present("serialized_output") {
|
||||||
|
println!("Rendering scene with {} threads...", thread_count);
|
||||||
|
}
|
||||||
let (mut image, rstats) = r.render(
|
let (mut image, rstats) = r.render(
|
||||||
max_samples_per_bucket,
|
max_samples_per_bucket,
|
||||||
crop,
|
crop,
|
||||||
thread_count,
|
thread_count,
|
||||||
args.is_present("blender_output"),
|
args.is_present("serialized_output"),
|
||||||
);
|
);
|
||||||
// Print render stats
|
// Print render stats
|
||||||
{
|
if !args.is_present("serialized_output") {
|
||||||
let rtime = t.tick();
|
let rtime = t.tick();
|
||||||
let ntime = rtime as f64 / rstats.total_time;
|
let ntime = rtime as f64 / rstats.total_time;
|
||||||
println!("\tRendered scene in {:.3}s", rtime);
|
println!("\tRendered scene in {:.3}s", rtime);
|
||||||
|
@ -314,7 +326,8 @@ fn main() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if !args.is_present("blender_output") {
|
// Write to disk
|
||||||
|
if !args.is_present("serialized_output") {
|
||||||
println!("Writing image to disk...");
|
println!("Writing image to disk...");
|
||||||
if r.output_file.ends_with(".png") {
|
if r.output_file.ends_with(".png") {
|
||||||
let _ = image.write_png(Path::new(&r.output_file));
|
let _ = image.write_png(Path::new(&r.output_file));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user