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.
This commit is contained in:
parent
7c5c7b5ef6
commit
5acce60d37
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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__ */
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue