Commit: cbbf991f62b7f1546771a71b3b9f14a46d1b6b61
Author: Sergey Sharybin
Date:   Fri Nov 9 16:04:53 2018 +0100
Branches: blender2.8
https://developer.blender.org/rBcbbf991f62b7f1546771a71b3b9f14a46d1b6b61

Cycles: Add name field to scene

Doesn't mean much for Cycles itself, but allows to have nice logs
and progress reports without access of original scene.

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

M       intern/cycles/blender/blender_session.cpp
M       intern/cycles/render/scene.cpp
M       intern/cycles/render/scene.h

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

diff --git a/intern/cycles/blender/blender_session.cpp 
b/intern/cycles/blender/blender_session.cpp
index 39f297d6be5..28b0f4faf63 100644
--- a/intern/cycles/blender/blender_session.cpp
+++ b/intern/cycles/blender/blender_session.cpp
@@ -140,6 +140,7 @@ void BlenderSession::create_session()
 
        /* create scene */
        scene = new Scene(scene_params, session->device);
+       scene->name = b_scene.name();
 
        /* setup callbacks for builtin image support */
        scene->image_manager->builtin_image_info_cb = 
function_bind(&BlenderSession::builtin_image_info, this, _1, _2, _3);
@@ -950,7 +951,7 @@ void BlenderSession::update_bake_progress()
 void BlenderSession::update_status_progress()
 {
        string timestatus, status, substatus;
-       string scene = "";
+       string scene_status = "";
        float progress;
        double total_time, remaining_time = 0, render_time;
        char time_str[128];
@@ -964,12 +965,12 @@ void BlenderSession::update_status_progress()
                remaining_time = (1.0 - (double)progress) * (render_time / 
(double)progress);
 
        if(background) {
-               scene += " | " + b_scene.name();
+               scene_status += " | " + scene->name;
                if(b_rlay_name != "")
-                       scene += ", "  + b_rlay_name;
+                       scene_status += ", "  + b_rlay_name;
 
                if(b_rview_name != "")
-                       scene += ", " + b_rview_name;
+                       scene_status += ", " + b_rview_name;
 
                if(remaining_time > 0) {
                        BLI_timecode_string_from_time_simple(time_str, 
sizeof(time_str), remaining_time);
@@ -988,7 +989,7 @@ void BlenderSession::update_status_progress()
        /* When rendering in a window, redraw the status at least once per 
second to keep the elapsed and remaining time up-to-date.
         * For headless rendering, only report when something significant 
changes to keep the console output readable. */
        if(status != last_status || (!headless && (current_time - 
last_status_time) > 1.0)) {
-               b_engine.update_stats("", (timestatus + scene + 
status).c_str());
+               b_engine.update_stats("", (timestatus + scene_status + 
status).c_str());
                b_engine.update_memory_stats(mem_used, mem_peak);
                last_status = status;
                last_status_time = current_time;
diff --git a/intern/cycles/render/scene.cpp b/intern/cycles/render/scene.cpp
index ccaca8707c8..2241d8d9c69 100644
--- a/intern/cycles/render/scene.cpp
+++ b/intern/cycles/render/scene.cpp
@@ -83,7 +83,10 @@ DeviceScene::DeviceScene(Device *device)
 }
 
 Scene::Scene(const SceneParams& params_, Device *device)
-: device(device), dscene(device), params(params_)
+        : name("Scene"),
+          device(device),
+          dscene(device),
+          params(params_)
 {
        memset((void *)&dscene.data, 0, sizeof(dscene.data));
 
diff --git a/intern/cycles/render/scene.h b/intern/cycles/render/scene.h
index 57ea1d471e8..69cbfe9a324 100644
--- a/intern/cycles/render/scene.h
+++ b/intern/cycles/render/scene.h
@@ -196,6 +196,9 @@ public:
 
 class Scene {
 public:
+       /* Optional name. Is used for logging and reporting. */
+       string name;
+
        /* data */
        Camera *camera;
        Camera *dicing_camera;

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

Reply via email to