[Bf-blender-cvs] [5acce60] master: Compositor: Fixes for the debug pass

Sergey Sharybin noreply at git.blender.org
Fri Jul 24 23:11:13 CEST 2015


Commit: 5acce60d376292bc228211075c9fe05b41c84ccd
Author: Sergey Sharybin
Date:   Fri Jul 24 23:05:11 2015 +0200
Branches: master
https://developer.blender.org/rB5acce60d376292bc228211075c9fe05b41c84ccd

Compositor: Fixes for the debug pass

This commit fixes issues with wrong socket type being added to the Cycles debug
pass compositor operation, which lead to crashes with non-value pass types.

This commit also reverts socket renaming thing because while it's was behaving
ok on runtime file reload might have loose the links which is annoying.

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

M	source/blender/compositor/nodes/COM_RenderLayersNode.cpp
M	source/blender/compositor/operations/COM_RenderLayersProg.cpp
M	source/blender/compositor/operations/COM_RenderLayersProg.h
M	source/blender/nodes/composite/nodes/node_composite_image.c
M	source/blender/render/extern/include/RE_pipeline.h
M	source/blender/render/intern/source/render_result.c

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

diff --git a/source/blender/compositor/nodes/COM_RenderLayersNode.cpp b/source/blender/compositor/nodes/COM_RenderLayersNode.cpp
index 69d2bf8..842edcf 100644
--- a/source/blender/compositor/nodes/COM_RenderLayersNode.cpp
+++ b/source/blender/compositor/nodes/COM_RenderLayersNode.cpp
@@ -27,6 +27,10 @@
 #include "COM_ScaleOperation.h"
 #include "COM_SetValueOperation.h"
 
+#ifdef WITH_CYCLES_DEBUG
+#  include "RE_pipeline.h"
+#endif
+
 RenderLayersNode::RenderLayersNode(bNode *editorNode) : Node(editorNode)
 {
 	/* pass */
@@ -88,6 +92,11 @@ void RenderLayersNode::convertToOperations(NodeConverter &converter, const Compo
 	testSocketLink(converter, context, 30, new RenderLayersCyclesOperation(SCE_PASS_SUBSURFACE_COLOR));
 
 #ifdef WITH_CYCLES_DEBUG
-	testSocketLink(converter, context, 31, new RenderLayersCyclesDebugOperation(SCE_PASS_DEBUG));
+	{
+		Scene *scene = (Scene *)this->getbNode()->id;
+		Render *re = RE_GetRender(scene->id.name);
+		int debug_pass_type = ((re != NULL) ? RE_debug_pass_type_get(re) : scene->r.debug_pass_type);
+		testSocketLink(converter, context, 31, new RenderLayersCyclesDebugOperation(SCE_PASS_DEBUG, debug_pass_type));
+	}
 #endif
 }
diff --git a/source/blender/compositor/operations/COM_RenderLayersProg.cpp b/source/blender/compositor/operations/COM_RenderLayersProg.cpp
index d93d327..999565d 100644
--- a/source/blender/compositor/operations/COM_RenderLayersProg.cpp
+++ b/source/blender/compositor/operations/COM_RenderLayersProg.cpp
@@ -393,16 +393,24 @@ RenderLayersUVOperation::RenderLayersUVOperation() : RenderLayersBaseProg(SCE_PA
 
 #ifdef WITH_CYCLES_DEBUG
 
-RenderLayersCyclesDebugOperation::RenderLayersCyclesDebugOperation(int pass)
-    : RenderLayersBaseProg(pass, 1)
+RenderLayersCyclesDebugOperation::RenderLayersCyclesDebugOperation(
+        int pass,
+        int debug_pass_type)
+	: RenderLayersBaseProg(pass, RE_debug_pass_num_channels_get(debug_pass_type))
 {
-	this->addOutputSocket(COM_DT_VALUE);
-}
-
-void RenderLayersCyclesDebugOperation::setScene(Scene *scene)
-{
-	RenderLayersBaseProg::setScene(scene);
-	this->m_elementsize = RE_debug_pass_num_channels_get(m_scene->r.debug_pass_type);
+	switch(m_elementsize) {
+		case 1:
+			this->addOutputSocket(COM_DT_VALUE);
+			break;
+		case 3:
+			this->addOutputSocket(COM_DT_VECTOR);
+			break;
+		case 4:
+			this->addOutputSocket(COM_DT_COLOR);
+			break;
+		default:
+			BLI_assert(!"Unkown debug pass type element size.");
+	}
 }
 
 #endif
diff --git a/source/blender/compositor/operations/COM_RenderLayersProg.h b/source/blender/compositor/operations/COM_RenderLayersProg.h
index edefd9a..89eb2a6 100644
--- a/source/blender/compositor/operations/COM_RenderLayersProg.h
+++ b/source/blender/compositor/operations/COM_RenderLayersProg.h
@@ -215,8 +215,8 @@ public:
 #ifdef WITH_CYCLES_DEBUG
 class RenderLayersCyclesDebugOperation : public RenderLayersBaseProg {
 public:
-	RenderLayersCyclesDebugOperation(int pass);
-	void setScene(Scene *scene);
+	RenderLayersCyclesDebugOperation(int pass,
+	                                 int debug_pass_type);
 };
 #endif
 
diff --git a/source/blender/nodes/composite/nodes/node_composite_image.c b/source/blender/nodes/composite/nodes/node_composite_image.c
index 2114290..4f02c10 100644
--- a/source/blender/nodes/composite/nodes/node_composite_image.c
+++ b/source/blender/nodes/composite/nodes/node_composite_image.c
@@ -457,11 +457,7 @@ void node_cmp_rlayers_force_hidden_passes(bNode *node)
 	set_output_visible(node, passflag, RRES_OUT_SUBSURFACE_COLOR,       SCE_PASS_SUBSURFACE_COLOR);
 
 #ifdef WITH_CYCLES_DEBUG
-	{
-		bNodeSocket *sock = BLI_findlink(&node->outputs, RRES_OUT_DEBUG);
-		set_output_visible(node, passflag, RRES_OUT_DEBUG, SCE_PASS_DEBUG);
-		strcpy(sock->name, RE_debug_pass_name_get(scene->r.debug_pass_type));
-	}
+	set_output_visible(node, passflag, RRES_OUT_DEBUG, SCE_PASS_DEBUG);
 #endif
 }
 
diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h
index 7951248..2a679f0 100644
--- a/source/blender/render/extern/include/RE_pipeline.h
+++ b/source/blender/render/extern/include/RE_pipeline.h
@@ -366,6 +366,7 @@ struct RenderView *RE_RenderViewGetByName(struct RenderResult *res, const char *
 #ifdef WITH_CYCLES_DEBUG
 int RE_debug_pass_num_channels_get(int pass_type);
 const char *RE_debug_pass_name_get(int pass_type);
+int RE_debug_pass_type_get(struct Render *re);
 #endif
 
 #endif /* __RE_PIPELINE_H__ */
diff --git a/source/blender/render/intern/source/render_result.c b/source/blender/render/intern/source/render_result.c
index 8d63c84..639ce20 100644
--- a/source/blender/render/intern/source/render_result.c
+++ b/source/blender/render/intern/source/render_result.c
@@ -563,6 +563,11 @@ static RenderPass *render_layer_add_debug_pass(RenderResult *rr,
 	BLI_strncpy(rpass->internal_name, rpass->name, sizeof(rpass->internal_name));
 	return rpass;
 }
+
+int RE_debug_pass_type_get(Render *re)
+{
+	return re->r.debug_pass_type;
+}
 #endif
 
 /* called by main render as well for parts */




More information about the Bf-blender-cvs mailing list