[Bf-blender-cvs] [5c07f62] master: Cycles: show remaining render time in render info text

Thomas Laroche noreply at git.blender.org
Sat Dec 7 17:11:44 CET 2013


Commit: 5c07f62fabc9b6a20c85ec5ea5e15a99353bd091
Author: Thomas Laroche
Date:   Sat Dec 7 02:22:35 2013 +0100
http://developer.blender.org/rB5c07f62fabc9b6a20c85ec5ea5e15a99353bd091

Cycles: show remaining render time in render info text

It's a simple estimate, not very precise but that isn't really possible always.
For progressive render it will become more accurate the longer you render.

Reviewed By: brecht

Differential Revision: http://developer.blender.org/D67

===================================================================

M	intern/cycles/blender/blender_session.cpp

===================================================================

diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp
index 84ff071..db673a8 100644
--- a/intern/cycles/blender/blender_session.cpp
+++ b/intern/cycles/blender/blender_session.cpp
@@ -625,28 +625,42 @@ void BlenderSession::get_progress(float& progress, double& total_time)
 void BlenderSession::update_status_progress()
 {
 	string timestatus, status, substatus;
+	string scene = "";
 	float progress;
-	double total_time;
+	double total_time, remaining_time = 0;
 	char time_str[128];
 	float mem_used = (float)session->stats.mem_used / 1024.0f / 1024.0f;
 	float mem_peak = (float)session->stats.mem_peak / 1024.0f / 1024.0f;
+	int samples = session->tile_manager.state.sample + 1;
+	int total_samples = session->tile_manager.num_samples;
 
 	get_status(status, substatus);
 	get_progress(progress, total_time);
 
-	timestatus = string_printf("Mem:%.2fM, Peak:%.2fM", mem_used, mem_peak);
+	
 
 	if(background) {
-		timestatus += " | " + b_scene.name();
+		if(progress>0)
+			remaining_time = (1-progress) * (total_time / progress);
+
+		scene += " | " + b_scene.name();
 		if(b_rlay_name != "")
-			timestatus += ", "  + b_rlay_name;
+			scene += ", "  + b_rlay_name;
 	}
 	else {
-		timestatus += " | ";
-
 		BLI_timestr(total_time, time_str, sizeof(time_str));
-		timestatus += "Time:" + string(time_str);
+		timestatus = "Time:" + string(time_str) + " | ";
+
+		if(samples > 0 && total_samples != USHRT_MAX)
+			remaining_time = (total_samples - samples) * (total_time / samples);
 	}
+	
+	if(remaining_time>0) {
+		BLI_timestr(remaining_time, time_str, sizeof(time_str));
+		timestatus += "Remaining:" + string(time_str) + " | ";
+	}
+	
+	timestatus += string_printf("Mem:%.2fM, Peak:%.2fM", mem_used, mem_peak);
 
 	if(status.size() > 0)
 		status = " | " + status;
@@ -654,12 +668,12 @@ void BlenderSession::update_status_progress()
 		status += " | " + substatus;
 
 	if(status != last_status) {
-		b_engine.update_stats("", (timestatus + status).c_str());
 		b_engine.update_memory_stats(mem_used, mem_peak);
 		last_status = status;
 	}
 	if(progress != last_progress) {
 		b_engine.update_progress(progress);
+		b_engine.update_stats("", (timestatus + scene + status).c_str());
 		last_progress = progress;
 	}
 }




More information about the Bf-blender-cvs mailing list