Expose debug type into the interface

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.
This commit is contained in:
Sergey Sharybin 2015-06-11 11:27:39 +02:00
parent 2bd6de5bbb
commit 102e18d05c
6 changed files with 25 additions and 8 deletions

@ -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"

@ -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;

@ -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[];

@ -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", "");

@ -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);

@ -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
}