Cleanup: Nodes, Clang-Tidy else-after-return fixes
This addresses warnings from Clang-Tidy's `readability-else-after-return` rule in the `source/blender/nodes` module. No functional changes.
This commit is contained in:
parent
47f8c444a4
commit
44b7354742
|
@ -84,14 +84,12 @@ bool node_group_poll_instance(bNode *node, bNodeTree *nodetree)
|
||||||
if (grouptree) {
|
if (grouptree) {
|
||||||
return nodeGroupPoll(nodetree, grouptree);
|
return nodeGroupPoll(nodetree, grouptree);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return true; /* without a linked node tree, group node is always ok */
|
return true; /* without a linked node tree, group node is always ok */
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
int nodeGroupPoll(bNodeTree *nodetree, bNodeTree *grouptree)
|
int nodeGroupPoll(bNodeTree *nodetree, bNodeTree *grouptree)
|
||||||
{
|
{
|
||||||
|
|
|
@ -176,14 +176,13 @@ static fn::MFOutputSocket *try_find_origin(CommonMFNetworkBuilderData &common,
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
const DGroupInput &from_group_input = *from_group_inputs[0];
|
const DGroupInput &from_group_input = *from_group_inputs[0];
|
||||||
if (is_multi_function_data_socket(from_group_input.bsocket())) {
|
if (is_multi_function_data_socket(from_group_input.bsocket())) {
|
||||||
return &common.network_map.lookup(from_group_input);
|
return &common.network_map.lookup(from_group_input);
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
using ImplicitConversionsMap =
|
using ImplicitConversionsMap =
|
||||||
Map<std::pair<fn::MFDataType, fn::MFDataType>, const fn::MultiFunction *>;
|
Map<std::pair<fn::MFDataType, fn::MFDataType>, const fn::MultiFunction *>;
|
||||||
|
|
|
@ -55,7 +55,7 @@ static int node_shader_gpu_attribute(GPUMaterial *mat,
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
GPUNodeLink *cd_attr = GPU_attribute(mat, CD_AUTO_FROM_NAME, attr->name);
|
GPUNodeLink *cd_attr = GPU_attribute(mat, CD_AUTO_FROM_NAME, attr->name);
|
||||||
GPU_stack_link(mat, node, "node_attribute", in, out, cd_attr);
|
GPU_stack_link(mat, node, "node_attribute", in, out, cd_attr);
|
||||||
|
|
||||||
|
@ -66,7 +66,6 @@ static int node_shader_gpu_attribute(GPUMaterial *mat,
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* node type definition */
|
/* node type definition */
|
||||||
void register_node_type_sh_attribute(void)
|
void register_node_type_sh_attribute(void)
|
||||||
|
|
|
@ -60,9 +60,8 @@ static void sh_node_clamp_expand_in_mf_network(blender::nodes::NodeMFNetworkBuil
|
||||||
if (a < b) {
|
if (a < b) {
|
||||||
return clamp_f(value, a, b);
|
return clamp_f(value, a, b);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return clamp_f(value, b, a);
|
return clamp_f(value, b, a);
|
||||||
}
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
int clamp_type = builder.bnode().custom1;
|
int clamp_type = builder.bnode().custom1;
|
||||||
|
|
|
@ -215,7 +215,7 @@ static int gpu_shader_curve_rgb(GPUMaterial *mat,
|
||||||
GPU_uniform(range_rgba),
|
GPU_uniform(range_rgba),
|
||||||
GPU_uniform(ext_rgba[3]));
|
GPU_uniform(ext_rgba[3]));
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return GPU_stack_link(mat,
|
return GPU_stack_link(mat,
|
||||||
node,
|
node,
|
||||||
"curves_rgb",
|
"curves_rgb",
|
||||||
|
@ -229,7 +229,6 @@ static int gpu_shader_curve_rgb(GPUMaterial *mat,
|
||||||
GPU_uniform(ext_rgba[2]),
|
GPU_uniform(ext_rgba[2]),
|
||||||
GPU_uniform(ext_rgba[3]));
|
GPU_uniform(ext_rgba[3]));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void register_node_type_sh_curve_rgb(void)
|
void register_node_type_sh_curve_rgb(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -64,11 +64,10 @@ static int gpu_shader_displacement(GPUMaterial *mat,
|
||||||
return GPU_stack_link(
|
return GPU_stack_link(
|
||||||
mat, node, "node_displacement_object", in, out, GPU_builtin(GPU_OBJECT_MATRIX));
|
mat, node, "node_displacement_object", in, out, GPU_builtin(GPU_OBJECT_MATRIX));
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return GPU_stack_link(
|
return GPU_stack_link(
|
||||||
mat, node, "node_displacement_world", in, out, GPU_builtin(GPU_OBJECT_MATRIX));
|
mat, node, "node_displacement_world", in, out, GPU_builtin(GPU_OBJECT_MATRIX));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* node type definition */
|
/* node type definition */
|
||||||
void register_node_type_sh_displacement(void)
|
void register_node_type_sh_displacement(void)
|
||||||
|
|
|
@ -53,10 +53,9 @@ static int gpu_shader_mapping(GPUMaterial *mat,
|
||||||
if (node->custom1 < ARRAY_SIZE(names) && names[node->custom1]) {
|
if (node->custom1 < ARRAY_SIZE(names) && names[node->custom1]) {
|
||||||
return GPU_stack_link(mat, node, names[node->custom1], in, out);
|
return GPU_stack_link(mat, node, names[node->custom1], in, out);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static void node_shader_update_mapping(bNodeTree *UNUSED(ntree), bNode *node)
|
static void node_shader_update_mapping(bNodeTree *UNUSED(ntree), bNode *node)
|
||||||
{
|
{
|
||||||
|
|
|
@ -141,10 +141,9 @@ static int gpu_shader_math(GPUMaterial *mat,
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static const blender::fn::MultiFunction &get_base_multi_function(
|
static const blender::fn::MultiFunction &get_base_multi_function(
|
||||||
blender::nodes::NodeMFNetworkBuilder &builder)
|
blender::nodes::NodeMFNetworkBuilder &builder)
|
||||||
|
|
|
@ -98,10 +98,9 @@ static int gpu_shader_mix_rgb(GPUMaterial *mat,
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void register_node_type_sh_mix_rgb(void)
|
void register_node_type_sh_mix_rgb(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,7 +45,7 @@ static int node_shader_gpu_tangent(GPUMaterial *mat,
|
||||||
return GPU_stack_link(
|
return GPU_stack_link(
|
||||||
mat, node, "node_tangentmap", in, out, GPU_attribute(mat, CD_TANGENT, attr->uv_map));
|
mat, node, "node_tangentmap", in, out, GPU_attribute(mat, CD_TANGENT, attr->uv_map));
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
GPUNodeLink *orco = GPU_attribute(mat, CD_ORCO, "");
|
GPUNodeLink *orco = GPU_attribute(mat, CD_ORCO, "");
|
||||||
|
|
||||||
if (attr->axis == SHD_TANGENT_AXIS_X) {
|
if (attr->axis == SHD_TANGENT_AXIS_X) {
|
||||||
|
@ -67,7 +67,6 @@ static int node_shader_gpu_tangent(GPUMaterial *mat,
|
||||||
orco,
|
orco,
|
||||||
GPU_builtin(GPU_OBJECT_MATRIX));
|
GPU_builtin(GPU_OBJECT_MATRIX));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* node type definition */
|
/* node type definition */
|
||||||
void register_node_type_sh_tangent(void)
|
void register_node_type_sh_tangent(void)
|
||||||
|
|
|
@ -170,7 +170,7 @@ static int node_shader_gpu_tex_sky(GPUMaterial *mat,
|
||||||
GPU_uniform(xyz_to_rgb.g),
|
GPU_uniform(xyz_to_rgb.g),
|
||||||
GPU_uniform(xyz_to_rgb.b));
|
GPU_uniform(xyz_to_rgb.b));
|
||||||
}
|
}
|
||||||
else if (tex->sky_model == 1) {
|
if (tex->sky_model == 1) {
|
||||||
/* Hosek / Wilkie */
|
/* Hosek / Wilkie */
|
||||||
sun_angles[0] = fmin(M_PI_2, sun_angles[0]); /* clamp to horizon */
|
sun_angles[0] = fmin(M_PI_2, sun_angles[0]); /* clamp to horizon */
|
||||||
SKY_ArHosekSkyModelState *sky_state = SKY_arhosek_xyz_skymodelstate_alloc_init(
|
SKY_ArHosekSkyModelState *sky_state = SKY_arhosek_xyz_skymodelstate_alloc_init(
|
||||||
|
@ -210,10 +210,9 @@ static int node_shader_gpu_tex_sky(GPUMaterial *mat,
|
||||||
GPU_uniform(xyz_to_rgb.g),
|
GPU_uniform(xyz_to_rgb.g),
|
||||||
GPU_uniform(xyz_to_rgb.b));
|
GPU_uniform(xyz_to_rgb.b));
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return GPU_stack_link(mat, node, "node_tex_sky_nishita", in, out);
|
return GPU_stack_link(mat, node, "node_tex_sky_nishita", in, out);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static void node_shader_update_sky(bNodeTree *UNUSED(ntree), bNode *node)
|
static void node_shader_update_sky(bNodeTree *UNUSED(ntree), bNode *node)
|
||||||
{
|
{
|
||||||
|
|
|
@ -54,10 +54,9 @@ static int gpu_shader_tex_white_noise(GPUMaterial *mat,
|
||||||
if (node->custom1 < ARRAY_SIZE(names) && names[node->custom1]) {
|
if (node->custom1 < ARRAY_SIZE(names) && names[node->custom1]) {
|
||||||
return GPU_stack_link(mat, node, names[node->custom1], in, out);
|
return GPU_stack_link(mat, node, names[node->custom1], in, out);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static void node_shader_update_tex_white_noise(bNodeTree *UNUSED(ntree), bNode *node)
|
static void node_shader_update_tex_white_noise(bNodeTree *UNUSED(ntree), bNode *node)
|
||||||
{
|
{
|
||||||
|
|
|
@ -121,10 +121,9 @@ static int gpu_shader_valtorgb(GPUMaterial *mat,
|
||||||
if (coba->ipotype == COLBAND_INTERP_CONSTANT) {
|
if (coba->ipotype == COLBAND_INTERP_CONSTANT) {
|
||||||
return GPU_stack_link(mat, node, "valtorgb_nearest", in, out, tex, GPU_constant(&layer));
|
return GPU_stack_link(mat, node, "valtorgb_nearest", in, out, tex, GPU_constant(&layer));
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return GPU_stack_link(mat, node, "valtorgb", in, out, tex, GPU_constant(&layer));
|
return GPU_stack_link(mat, node, "valtorgb", in, out, tex, GPU_constant(&layer));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
class ColorBandFunction : public blender::fn::MultiFunction {
|
class ColorBandFunction : public blender::fn::MultiFunction {
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -55,14 +55,13 @@ static int gpu_shader_vector_displacement(GPUMaterial *mat,
|
||||||
GPU_builtin(GPU_OBJECT_MATRIX),
|
GPU_builtin(GPU_OBJECT_MATRIX),
|
||||||
GPU_builtin(GPU_VIEW_MATRIX));
|
GPU_builtin(GPU_VIEW_MATRIX));
|
||||||
}
|
}
|
||||||
else if (node->custom1 == SHD_SPACE_OBJECT) {
|
if (node->custom1 == SHD_SPACE_OBJECT) {
|
||||||
return GPU_stack_link(
|
return GPU_stack_link(
|
||||||
mat, node, "node_vector_displacement_object", in, out, GPU_builtin(GPU_OBJECT_MATRIX));
|
mat, node, "node_vector_displacement_object", in, out, GPU_builtin(GPU_OBJECT_MATRIX));
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return GPU_stack_link(mat, node, "node_vector_displacement_world", in, out);
|
return GPU_stack_link(mat, node, "node_vector_displacement_world", in, out);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* node type definition */
|
/* node type definition */
|
||||||
void register_node_type_sh_vector_displacement(void)
|
void register_node_type_sh_vector_displacement(void)
|
||||||
|
|
|
@ -103,10 +103,9 @@ static int gpu_shader_vector_math(GPUMaterial *mat,
|
||||||
if (name != nullptr) {
|
if (name != nullptr) {
|
||||||
return GPU_stack_link(mat, node, name, in, out);
|
return GPU_stack_link(mat, node, name, in, out);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static void node_shader_update_vector_math(bNodeTree *UNUSED(ntree), bNode *node)
|
static void node_shader_update_vector_math(bNodeTree *UNUSED(ntree), bNode *node)
|
||||||
{
|
{
|
||||||
|
|
|
@ -53,10 +53,9 @@ static int gpu_shader_vector_rotate(GPUMaterial *mat,
|
||||||
float invert = (node->custom2) ? -1.0 : 1.0;
|
float invert = (node->custom2) ? -1.0 : 1.0;
|
||||||
return GPU_stack_link(mat, node, names[node->custom1], in, out, GPU_constant(&invert));
|
return GPU_stack_link(mat, node, names[node->custom1], in, out, GPU_constant(&invert));
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static void node_shader_update_vector_rotate(bNodeTree *UNUSED(ntree), bNode *node)
|
static void node_shader_update_vector_rotate(bNodeTree *UNUSED(ntree), bNode *node)
|
||||||
{
|
{
|
||||||
|
|
|
@ -42,7 +42,7 @@ static int node_shader_gpu_wireframe(GPUMaterial *mat,
|
||||||
return GPU_stack_link(
|
return GPU_stack_link(
|
||||||
mat, node, "node_wireframe_screenspace", in, out, GPU_builtin(GPU_BARYCENTRIC_TEXCO));
|
mat, node, "node_wireframe_screenspace", in, out, GPU_builtin(GPU_BARYCENTRIC_TEXCO));
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return GPU_stack_link(mat,
|
return GPU_stack_link(mat,
|
||||||
node,
|
node,
|
||||||
"node_wireframe",
|
"node_wireframe",
|
||||||
|
@ -51,7 +51,6 @@ static int node_shader_gpu_wireframe(GPUMaterial *mat,
|
||||||
GPU_builtin(GPU_BARYCENTRIC_TEXCO),
|
GPU_builtin(GPU_BARYCENTRIC_TEXCO),
|
||||||
GPU_builtin(GPU_BARYCENTRIC_DIST));
|
GPU_builtin(GPU_BARYCENTRIC_DIST));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* node type definition */
|
/* node type definition */
|
||||||
void register_node_type_sh_wireframe(void)
|
void register_node_type_sh_wireframe(void)
|
||||||
|
|
|
@ -145,7 +145,7 @@ void tex_output(bNode *node,
|
||||||
/* do not add a delegate if the node is muted */
|
/* do not add a delegate if the node is muted */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
if (!out->data) {
|
if (!out->data) {
|
||||||
/* Freed in tex_end_exec (node.c) */
|
/* Freed in tex_end_exec (node.c) */
|
||||||
dg = out->data = MEM_mallocN(sizeof(TexDelegate), "tex delegate");
|
dg = out->data = MEM_mallocN(sizeof(TexDelegate), "tex delegate");
|
||||||
|
@ -153,7 +153,6 @@ void tex_output(bNode *node,
|
||||||
else {
|
else {
|
||||||
dg = out->data;
|
dg = out->data;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
dg->cdata = cdata;
|
dg->cdata = cdata;
|
||||||
dg->fn = texfn;
|
dg->fn = texfn;
|
||||||
|
|
Loading…
Reference in New Issue