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,13 +84,11 @@ bool node_group_poll_instance(bNode *node, bNodeTree *nodetree)
|
|||
if (grouptree) {
|
||||
return nodeGroupPoll(nodetree, grouptree);
|
||||
}
|
||||
else {
|
||||
return true; /* without a linked node tree, group node is always ok */
|
||||
}
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
|
||||
return true; /* without a linked node tree, group node is always ok */
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int nodeGroupPoll(bNodeTree *nodetree, bNodeTree *grouptree)
|
||||
|
|
|
@ -176,13 +176,12 @@ static fn::MFOutputSocket *try_find_origin(CommonMFNetworkBuilderData &common,
|
|||
}
|
||||
return nullptr;
|
||||
}
|
||||
else {
|
||||
const DGroupInput &from_group_input = *from_group_inputs[0];
|
||||
if (is_multi_function_data_socket(from_group_input.bsocket())) {
|
||||
return &common.network_map.lookup(from_group_input);
|
||||
}
|
||||
return nullptr;
|
||||
|
||||
const DGroupInput &from_group_input = *from_group_inputs[0];
|
||||
if (is_multi_function_data_socket(from_group_input.bsocket())) {
|
||||
return &common.network_map.lookup(from_group_input);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
using ImplicitConversionsMap =
|
||||
|
|
|
@ -55,17 +55,16 @@ static int node_shader_gpu_attribute(GPUMaterial *mat,
|
|||
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
GPUNodeLink *cd_attr = GPU_attribute(mat, CD_AUTO_FROM_NAME, attr->name);
|
||||
GPU_stack_link(mat, node, "node_attribute", in, out, cd_attr);
|
||||
|
||||
/* for each output. */
|
||||
for (int i = 0; sh_node_attribute_out[i].type != -1; i++) {
|
||||
node_shader_gpu_bump_tex_coord(mat, node, &out[i].link);
|
||||
}
|
||||
GPUNodeLink *cd_attr = GPU_attribute(mat, CD_AUTO_FROM_NAME, attr->name);
|
||||
GPU_stack_link(mat, node, "node_attribute", in, out, cd_attr);
|
||||
|
||||
return 1;
|
||||
/* for each output. */
|
||||
for (int i = 0; sh_node_attribute_out[i].type != -1; i++) {
|
||||
node_shader_gpu_bump_tex_coord(mat, node, &out[i].link);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* node type definition */
|
||||
|
|
|
@ -60,9 +60,8 @@ static void sh_node_clamp_expand_in_mf_network(blender::nodes::NodeMFNetworkBuil
|
|||
if (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;
|
||||
|
|
|
@ -215,20 +215,19 @@ static int gpu_shader_curve_rgb(GPUMaterial *mat,
|
|||
GPU_uniform(range_rgba),
|
||||
GPU_uniform(ext_rgba[3]));
|
||||
}
|
||||
else {
|
||||
return GPU_stack_link(mat,
|
||||
node,
|
||||
"curves_rgb",
|
||||
in,
|
||||
out,
|
||||
tex,
|
||||
GPU_constant(&layer),
|
||||
GPU_uniform(range_rgba),
|
||||
GPU_uniform(ext_rgba[0]),
|
||||
GPU_uniform(ext_rgba[1]),
|
||||
GPU_uniform(ext_rgba[2]),
|
||||
GPU_uniform(ext_rgba[3]));
|
||||
}
|
||||
|
||||
return GPU_stack_link(mat,
|
||||
node,
|
||||
"curves_rgb",
|
||||
in,
|
||||
out,
|
||||
tex,
|
||||
GPU_constant(&layer),
|
||||
GPU_uniform(range_rgba),
|
||||
GPU_uniform(ext_rgba[0]),
|
||||
GPU_uniform(ext_rgba[1]),
|
||||
GPU_uniform(ext_rgba[2]),
|
||||
GPU_uniform(ext_rgba[3]));
|
||||
}
|
||||
|
||||
void register_node_type_sh_curve_rgb(void)
|
||||
|
|
|
@ -64,10 +64,9 @@ static int gpu_shader_displacement(GPUMaterial *mat,
|
|||
return GPU_stack_link(
|
||||
mat, node, "node_displacement_object", in, out, GPU_builtin(GPU_OBJECT_MATRIX));
|
||||
}
|
||||
else {
|
||||
return GPU_stack_link(
|
||||
mat, node, "node_displacement_world", in, out, GPU_builtin(GPU_OBJECT_MATRIX));
|
||||
}
|
||||
|
||||
return GPU_stack_link(
|
||||
mat, node, "node_displacement_world", in, out, GPU_builtin(GPU_OBJECT_MATRIX));
|
||||
}
|
||||
|
||||
/* node type definition */
|
||||
|
|
|
@ -53,9 +53,8 @@ static int gpu_shader_mapping(GPUMaterial *mat,
|
|||
if (node->custom1 < ARRAY_SIZE(names) && names[node->custom1]) {
|
||||
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)
|
||||
|
|
|
@ -141,9 +141,8 @@ static int gpu_shader_math(GPUMaterial *mat,
|
|||
}
|
||||
return ret;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const blender::fn::MultiFunction &get_base_multi_function(
|
||||
|
|
|
@ -98,9 +98,8 @@ static int gpu_shader_mix_rgb(GPUMaterial *mat,
|
|||
}
|
||||
return ret;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void register_node_type_sh_mix_rgb(void)
|
||||
|
|
|
@ -45,28 +45,27 @@ static int node_shader_gpu_tangent(GPUMaterial *mat,
|
|||
return GPU_stack_link(
|
||||
mat, node, "node_tangentmap", in, out, GPU_attribute(mat, CD_TANGENT, attr->uv_map));
|
||||
}
|
||||
else {
|
||||
GPUNodeLink *orco = GPU_attribute(mat, CD_ORCO, "");
|
||||
|
||||
if (attr->axis == SHD_TANGENT_AXIS_X) {
|
||||
GPU_link(mat, "tangent_orco_x", orco, &orco);
|
||||
}
|
||||
else if (attr->axis == SHD_TANGENT_AXIS_Y) {
|
||||
GPU_link(mat, "tangent_orco_y", orco, &orco);
|
||||
}
|
||||
else {
|
||||
GPU_link(mat, "tangent_orco_z", orco, &orco);
|
||||
}
|
||||
GPUNodeLink *orco = GPU_attribute(mat, CD_ORCO, "");
|
||||
|
||||
return GPU_stack_link(mat,
|
||||
node,
|
||||
"node_tangent",
|
||||
in,
|
||||
out,
|
||||
GPU_builtin(GPU_WORLD_NORMAL),
|
||||
orco,
|
||||
GPU_builtin(GPU_OBJECT_MATRIX));
|
||||
if (attr->axis == SHD_TANGENT_AXIS_X) {
|
||||
GPU_link(mat, "tangent_orco_x", orco, &orco);
|
||||
}
|
||||
else if (attr->axis == SHD_TANGENT_AXIS_Y) {
|
||||
GPU_link(mat, "tangent_orco_y", orco, &orco);
|
||||
}
|
||||
else {
|
||||
GPU_link(mat, "tangent_orco_z", orco, &orco);
|
||||
}
|
||||
|
||||
return GPU_stack_link(mat,
|
||||
node,
|
||||
"node_tangent",
|
||||
in,
|
||||
out,
|
||||
GPU_builtin(GPU_WORLD_NORMAL),
|
||||
orco,
|
||||
GPU_builtin(GPU_OBJECT_MATRIX));
|
||||
}
|
||||
|
||||
/* node type definition */
|
||||
|
|
|
@ -170,7 +170,7 @@ static int node_shader_gpu_tex_sky(GPUMaterial *mat,
|
|||
GPU_uniform(xyz_to_rgb.g),
|
||||
GPU_uniform(xyz_to_rgb.b));
|
||||
}
|
||||
else if (tex->sky_model == 1) {
|
||||
if (tex->sky_model == 1) {
|
||||
/* Hosek / Wilkie */
|
||||
sun_angles[0] = fmin(M_PI_2, sun_angles[0]); /* clamp to horizon */
|
||||
SKY_ArHosekSkyModelState *sky_state = SKY_arhosek_xyz_skymodelstate_alloc_init(
|
||||
|
@ -210,9 +210,8 @@ static int node_shader_gpu_tex_sky(GPUMaterial *mat,
|
|||
GPU_uniform(xyz_to_rgb.g),
|
||||
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)
|
||||
|
|
|
@ -54,9 +54,8 @@ static int gpu_shader_tex_white_noise(GPUMaterial *mat,
|
|||
if (node->custom1 < ARRAY_SIZE(names) && names[node->custom1]) {
|
||||
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)
|
||||
|
|
|
@ -121,9 +121,8 @@ static int gpu_shader_valtorgb(GPUMaterial *mat,
|
|||
if (coba->ipotype == COLBAND_INTERP_CONSTANT) {
|
||||
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 {
|
||||
|
|
|
@ -55,13 +55,12 @@ static int gpu_shader_vector_displacement(GPUMaterial *mat,
|
|||
GPU_builtin(GPU_OBJECT_MATRIX),
|
||||
GPU_builtin(GPU_VIEW_MATRIX));
|
||||
}
|
||||
else if (node->custom1 == SHD_SPACE_OBJECT) {
|
||||
if (node->custom1 == SHD_SPACE_OBJECT) {
|
||||
return GPU_stack_link(
|
||||
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 */
|
||||
|
|
|
@ -103,9 +103,8 @@ static int gpu_shader_vector_math(GPUMaterial *mat,
|
|||
if (name != nullptr) {
|
||||
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)
|
||||
|
|
|
@ -53,9 +53,8 @@ static int gpu_shader_vector_rotate(GPUMaterial *mat,
|
|||
float invert = (node->custom2) ? -1.0 : 1.0;
|
||||
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)
|
||||
|
|
|
@ -42,15 +42,14 @@ static int node_shader_gpu_wireframe(GPUMaterial *mat,
|
|||
return GPU_stack_link(
|
||||
mat, node, "node_wireframe_screenspace", in, out, GPU_builtin(GPU_BARYCENTRIC_TEXCO));
|
||||
}
|
||||
else {
|
||||
return GPU_stack_link(mat,
|
||||
node,
|
||||
"node_wireframe",
|
||||
in,
|
||||
out,
|
||||
GPU_builtin(GPU_BARYCENTRIC_TEXCO),
|
||||
GPU_builtin(GPU_BARYCENTRIC_DIST));
|
||||
}
|
||||
|
||||
return GPU_stack_link(mat,
|
||||
node,
|
||||
"node_wireframe",
|
||||
in,
|
||||
out,
|
||||
GPU_builtin(GPU_BARYCENTRIC_TEXCO),
|
||||
GPU_builtin(GPU_BARYCENTRIC_DIST));
|
||||
}
|
||||
|
||||
/* node type definition */
|
||||
|
|
|
@ -145,14 +145,13 @@ void tex_output(bNode *node,
|
|||
/* do not add a delegate if the node is muted */
|
||||
return;
|
||||
}
|
||||
|
||||
if (!out->data) {
|
||||
/* Freed in tex_end_exec (node.c) */
|
||||
dg = out->data = MEM_mallocN(sizeof(TexDelegate), "tex delegate");
|
||||
}
|
||||
else {
|
||||
if (!out->data) {
|
||||
/* Freed in tex_end_exec (node.c) */
|
||||
dg = out->data = MEM_mallocN(sizeof(TexDelegate), "tex delegate");
|
||||
}
|
||||
else {
|
||||
dg = out->data;
|
||||
}
|
||||
dg = out->data;
|
||||
}
|
||||
|
||||
dg->cdata = cdata;
|
||||
|
|
Loading…
Reference in New Issue