Cycles: progress printing in background mode, print finished at the end and

avoid duplicate prints.
This commit is contained in:
Brecht Van Lommel 2011-10-30 10:12:34 +00:00
parent 238f3a7d34
commit bb379c06e9
3 changed files with 21 additions and 4 deletions

@ -76,6 +76,10 @@ void BlenderSession::create_session()
SceneParams scene_params = BlenderSync::get_scene_params(b_scene);
SessionParams session_params = BlenderSync::get_session_params(b_scene, background);
/* reset status/progress */
last_status= "";
last_progress= -1.0f;
/* create scene */
scene = new Scene(scene_params);
@ -264,8 +268,14 @@ void BlenderSession::update_status_progress()
if(substatus.size() > 0)
status += " | " + substatus;
RE_engine_update_stats((RenderEngine*)b_engine.ptr.data, "", status.c_str());
RE_engine_update_progress((RenderEngine*)b_engine.ptr.data, progress);
if(status != last_status) {
RE_engine_update_stats((RenderEngine*)b_engine.ptr.data, "", status.c_str());
last_status = status;
}
if(progress != last_progress) {
RE_engine_update_progress((RenderEngine*)b_engine.ptr.data, progress);
last_progress = progress;
}
}
void BlenderSession::tag_update()

@ -70,6 +70,9 @@ public:
BL::SpaceView3D b_v3d;
BL::RegionView3D b_rv3d;
string last_status;
float last_progress;
int width, height;
};

@ -170,8 +170,10 @@ void Session::run_gpu()
if(params.background) {
/* if no work left and in background mode, we can stop immediately */
if(no_tiles)
if(no_tiles) {
progress.set_status("Finished");
break;
}
}
else {
/* if in interactive mode, and we are either paused or done for now,
@ -305,8 +307,10 @@ void Session::run_cpu()
if(params.background) {
/* if no work left and in background mode, we can stop immediately */
if(no_tiles)
if(no_tiles) {
progress.set_status("Finished");
break;
}
}
else {
/* if in interactive mode, and we are either paused or done for now,