Revision: 41382
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41382
Author:   blendix
Date:     2011-10-30 10:12:34 +0000 (Sun, 30 Oct 2011)
Log Message:
-----------
Cycles: progress printing in background mode, print finished at the end and
avoid duplicate prints.

Modified Paths:
--------------
    branches/cycles/intern/cycles/blender/blender_session.cpp
    branches/cycles/intern/cycles/blender/blender_session.h
    branches/cycles/intern/cycles/render/session.cpp

Modified: branches/cycles/intern/cycles/blender/blender_session.cpp
===================================================================
--- branches/cycles/intern/cycles/blender/blender_session.cpp   2011-10-30 
09:48:59 UTC (rev 41381)
+++ branches/cycles/intern/cycles/blender/blender_session.cpp   2011-10-30 
10:12:34 UTC (rev 41382)
@@ -76,6 +76,10 @@
        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 @@
        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()

Modified: branches/cycles/intern/cycles/blender/blender_session.h
===================================================================
--- branches/cycles/intern/cycles/blender/blender_session.h     2011-10-30 
09:48:59 UTC (rev 41381)
+++ branches/cycles/intern/cycles/blender/blender_session.h     2011-10-30 
10:12:34 UTC (rev 41382)
@@ -70,6 +70,9 @@
        BL::SpaceView3D b_v3d;
        BL::RegionView3D b_rv3d;
 
+       string last_status;
+       float last_progress;
+
        int width, height;
 };
 

Modified: branches/cycles/intern/cycles/render/session.cpp
===================================================================
--- branches/cycles/intern/cycles/render/session.cpp    2011-10-30 09:48:59 UTC 
(rev 41381)
+++ branches/cycles/intern/cycles/render/session.cpp    2011-10-30 10:12:34 UTC 
(rev 41382)
@@ -170,8 +170,10 @@
 
                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 @@
 
                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,

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to