Compositor: Cleanup, get rid of nested ternary operators

Having single switch statement is much more readable.
This commit is contained in:
Sergey Sharybin 2017-09-13 15:00:14 +05:00
parent 17a117c7a0
commit f472aea922
Notes: blender-bot 2023-02-14 06:17:18 +01:00
Referenced by issue #53683, 2.79a release
1 changed files with 10 additions and 1 deletions

View File

@ -94,7 +94,16 @@ void RenderLayersNode::testRenderLink(NodeConverter &converter,
is_preview = false;
}
else {
DataType type = ((rpass->channels == 4)? COM_DT_COLOR : ((rpass->channels == 3)? COM_DT_VECTOR : COM_DT_VALUE));
DataType type;
switch (rpass->channels) {
case 4: type = COM_DT_COLOR; break;
case 3: type = COM_DT_VECTOR; break;
case 1: type = COM_DT_VALUE; break;
default:
BLI_assert(!"Unexpected number of channels for pass");
type = COM_DT_VALUE;
break;
}
operation = new RenderLayersProg(rpass->name,
type,
rpass->channels);