Expose debug type into the interface
authorSergey Sharybin <sergey.vfx@gmail.com>
Thu, 11 Jun 2015 09:27:39 +0000 (11:27 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Thu, 11 Jun 2015 12:53:15 +0000 (14:53 +0200)
This way it is now possible to select which exact debug pass is to be used
by the render engine. Accessible from the Passes panel.

Currently it could only be one debug pass, in the future we can make menus
and image users smarter and support multiple passes of the same type.

intern/cycles/blender/addon/ui.py
source/blender/makesdna/DNA_scene_types.h
source/blender/makesrna/RNA_enum_types.h
source/blender/makesrna/intern/rna_render.c
source/blender/makesrna/intern/rna_scene.c
source/blender/render/intern/source/render_result.c

index 7fa71397271e4f0a25b805c109f4f1b70607c09d..e643bd4ee5e661ea3d5afc9d3354b5a3821ff551 100644 (file)
@@ -431,6 +431,9 @@ class CyclesRender_PT_layer_passes(CyclesButtonsPanel, Panel):
         col.prop(rl, "use_pass_emit", text="Emission")
         col.prop(rl, "use_pass_environment")
 
+        if hasattr(rd, "debug_pass_type"):
+            layout.prop(rd, "debug_pass_type")
+
 
 class CyclesRender_PT_views(CyclesButtonsPanel, Panel):
     bl_label = "Views"
index ef0e98a14c972a21b039d2cf8d35325e81e0ddc6..397751d85e9334d015abaa624b1487d2a6d3e4b8 100644 (file)
@@ -689,7 +689,13 @@ typedef struct RenderData {
        struct BakeData bake;
 
        int preview_start_resolution;
-       int pad;
+
+       /* Type of the debug pass to use.
+        * Only used when built with debug passes support.
+        */
+       short debug_pass_type;
+
+       short pad;
 
        /* MultiView */
        ListBase views;
index d3d3578e8b0d01868fea9357f0a08ade68449582..061133a9fcf714c84acc02a97e3c15ee22270d14 100644 (file)
@@ -132,6 +132,7 @@ extern EnumPropertyItem object_axis_unsigned_items[];
 extern EnumPropertyItem controller_type_items[];
 
 extern EnumPropertyItem render_pass_type_items[];
+extern EnumPropertyItem render_pass_debug_type_items[];
 
 extern EnumPropertyItem keymap_propvalue_items[];
 
index 7ec2619d2df0f622c8a31ffd41d03ec64e1bdc64..a759779d6a3ebce40bbed2b8931f8cc9fd4a29c8 100644 (file)
@@ -77,6 +77,12 @@ EnumPropertyItem render_pass_type_items[] = {
        {0, NULL, 0, NULL, NULL}
 };
 
+EnumPropertyItem render_pass_debug_type_items[] = {
+       {RENDER_PASS_DEBUG_BVH_TRAVERSAL_STEPS, "BVH_TRAVERSAL_STEPS", 0, "BVH Traversal Steps", ""},
+       {RENDER_PASS_DEBUG_RAY_BOUNCES, "RAY_BOUNCES", 0, "Ray Steps", ""},
+       {0, NULL, 0, NULL, NULL}
+};
+
 #ifdef RNA_RUNTIME
 
 #include "MEM_guardedalloc.h"
@@ -767,12 +773,6 @@ static void rna_def_render_pass(BlenderRNA *brna)
        StructRNA *srna;
        PropertyRNA *prop;
 
-       static EnumPropertyItem render_pass_debug_type_items[] = {
-               {RENDER_PASS_DEBUG_BVH_TRAVERSAL_STEPS, "BVH_TRAVERSAL_STEPS", 0, "BVH Traversal Steps", ""},
-               {RENDER_PASS_DEBUG_RAY_BOUNCES, "RAY_BOUNCES", 0, "Ray Steps", ""},
-               {0, NULL, 0, NULL, NULL}
-       };
-
        srna = RNA_def_struct(brna, "RenderPass", NULL);
        RNA_def_struct_ui_text(srna, "Render Pass", "");
 
index 00114d1125c5d6c925d7265114a75db578c9c35f..ea7267113279d809bff07449e31f299f06ee542a 100644 (file)
@@ -5873,6 +5873,13 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
        RNA_def_property_struct_type(prop, "BakeSettings");
        RNA_def_property_ui_text(prop, "Bake Data", "");
 
+       /* Debugging settings. */
+#ifdef WITH_CYCLES_DEBUG
+       prop = RNA_def_property(srna, "debug_pass_type", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_items(prop, render_pass_debug_type_items);
+       RNA_def_property_ui_text(prop, "Debug Pass Type", "Type of the debug pass to use");
+#endif
+
        /* Nestled Data  */
        /* *** Non-Animated *** */
        RNA_define_animate_sdna(false);
index ea7b32d2da9a31a96dc2844d9f8c936bae409dd3..7f54bebd673bbe68ad419cc8acc8661f854daa14 100644 (file)
@@ -705,7 +705,7 @@ RenderResult *render_result_new(Render *re, rcti *partrct, int crop, int savebuf
 #ifdef WITH_CYCLES_DEBUG
                        if (BKE_scene_use_new_shading_nodes(re->scene)) {
                                render_layer_add_debug_pass(rr, rl, 1, SCE_PASS_DEBUG,
-                                       RENDER_PASS_DEBUG_BVH_TRAVERSAL_STEPS, view);
+                                       re->r.debug_pass_type, view);
                        }
 #endif
                }