diff options
author | Jacques Lucke <jacques@blender.org> | 2021-02-15 17:30:17 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-02-15 17:30:17 +0300 |
commit | d3960164163c910d5031a8f076c41b39e0a5503d (patch) | |
tree | 2931c76ced3945e8f06c9c163cba37b69d06f640 /source/blender | |
parent | b55e7e489504f43076eec423bc8dfb7efbeb4fac (diff) |
Cleanup: clang tidy
Diffstat (limited to 'source/blender')
15 files changed, 42 insertions, 49 deletions
diff --git a/source/blender/blenkernel/BKE_displist.h b/source/blender/blenkernel/BKE_displist.h index 86145fdfb41..83adbf6f1fd 100644 --- a/source/blender/blenkernel/BKE_displist.h +++ b/source/blender/blenkernel/BKE_displist.h @@ -116,7 +116,7 @@ bool BKE_displist_surfindex_get(DispList *dl, int a, int *b, int *p1, int *p2, i void BKE_displist_fill(const struct ListBase *dispbase, struct ListBase *to, const float normal_proj[3], - const bool flipnormal); + const bool flip_normal); float BKE_displist_calc_taper( struct Depsgraph *depsgraph, struct Scene *scene, struct Object *taperobj, int cur, int tot); diff --git a/source/blender/blenkernel/intern/asset.cc b/source/blender/blenkernel/intern/asset.cc index 89c3523285d..b5a7f5e37a6 100644 --- a/source/blender/blenkernel/intern/asset.cc +++ b/source/blender/blenkernel/intern/asset.cc @@ -18,7 +18,7 @@ * \ingroup bke */ -#include <string.h> +#include <cstring> #include "DNA_ID.h" #include "DNA_asset_types.h" diff --git a/source/blender/blenlib/intern/mesh_boolean.cc b/source/blender/blenlib/intern/mesh_boolean.cc index 6ca5be743f0..bfc1e4b01d3 100644 --- a/source/blender/blenlib/intern/mesh_boolean.cc +++ b/source/blender/blenlib/intern/mesh_boolean.cc @@ -2385,7 +2385,7 @@ static void inside_shape_callback(void *userdata, std::cout << " fv2=(" << fv2[0] << "," << fv2[1] << "," << fv2[2] << ")\n"; } if (isect_ray_tri_epsilon_v3( - ray->origin, ray->direction, fv0, fv1, fv2, &dist, NULL, FLT_EPSILON)) { + ray->origin, ray->direction, fv0, fv1, fv2, &dist, nullptr, FLT_EPSILON)) { /* Count parity as +1 if ray is in the same direction as tri's normal, * and -1 if the directions are opposite. */ double3 o_db{double(ray->origin[0]), double(ray->origin[1]), double(ray->origin[2])}; diff --git a/source/blender/draw/engines/eevee/eevee_depth_of_field.c b/source/blender/draw/engines/eevee/eevee_depth_of_field.c index 8c0a44b2c9b..bd6c6242f86 100644 --- a/source/blender/draw/engines/eevee/eevee_depth_of_field.c +++ b/source/blender/draw/engines/eevee/eevee_depth_of_field.c @@ -56,12 +56,10 @@ static float coc_radius_from_camera_depth(bool is_ortho, EEVEE_EffectsInfo *fx, if (multiplier == 0.0f || bias == 0.0f) { return 0.0f; } - else if (is_ortho) { + if (is_ortho) { return (camera_depth + multiplier / bias) * multiplier; } - else { - return multiplier / camera_depth - bias; - } + return multiplier / camera_depth - bias; } static float polygon_sides_length(float sides_count) @@ -164,11 +162,11 @@ bool EEVEE_depth_of_field_jitter_get(EEVEE_EffectsInfo *fx, return true; } -int EEVEE_depth_of_field_sample_count_get(EEVEE_EffectsInfo *fx, +int EEVEE_depth_of_field_sample_count_get(EEVEE_EffectsInfo *effects, int sample_count, int *r_ring_count) { - if (fx->dof_jitter_radius == 0.0f) { + if (effects->dof_jitter_radius == 0.0f) { if (r_ring_count != NULL) { *r_ring_count = 0; } diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c index f9eba9eeb6f..af058264f25 100644 --- a/source/blender/editors/interface/interface_utils.c +++ b/source/blender/editors/interface/interface_utils.c @@ -546,19 +546,19 @@ int UI_icon_from_report_type(int type) if (type & RPT_ERROR_ALL) { return ICON_CANCEL; } - else if (type & RPT_WARNING_ALL) { + if (type & RPT_WARNING_ALL) { return ICON_ERROR; } - else if (type & RPT_INFO_ALL) { + if (type & RPT_INFO_ALL) { return ICON_INFO; } - else if (type & RPT_DEBUG_ALL) { + if (type & RPT_DEBUG_ALL) { return ICON_SYSTEM; } - else if (type & RPT_PROPERTY) { + if (type & RPT_PROPERTY) { return ICON_OPTIONS; } - else if (type & RPT_OPERATOR) { + if (type & RPT_OPERATOR) { return ICON_CHECKMARK; } return ICON_INFO; @@ -569,24 +569,22 @@ int UI_icon_colorid_from_report_type(int type) if (type & RPT_ERROR_ALL) { return TH_INFO_ERROR; } - else if (type & RPT_WARNING_ALL) { + if (type & RPT_WARNING_ALL) { return TH_INFO_WARNING; } - else if (type & RPT_INFO_ALL) { + if (type & RPT_INFO_ALL) { return TH_INFO_INFO; } - else if (type & RPT_DEBUG_ALL) { + if (type & RPT_DEBUG_ALL) { return TH_INFO_DEBUG; } - else if (type & RPT_PROPERTY) { + if (type & RPT_PROPERTY) { return TH_INFO_PROPERTY; } - else if (type & RPT_OPERATOR) { + if (type & RPT_OPERATOR) { return TH_INFO_OPERATOR; } - else { - return TH_INFO_WARNING; - } + return TH_INFO_WARNING; } int UI_text_colorid_from_report_type(int type) @@ -594,24 +592,22 @@ int UI_text_colorid_from_report_type(int type) if (type & RPT_ERROR_ALL) { return TH_INFO_ERROR_TEXT; } - else if (type & RPT_WARNING_ALL) { + if (type & RPT_WARNING_ALL) { return TH_INFO_WARNING_TEXT; } - else if (type & RPT_INFO_ALL) { + if (type & RPT_INFO_ALL) { return TH_INFO_INFO_TEXT; } - else if (type & RPT_DEBUG_ALL) { + if (type & RPT_DEBUG_ALL) { return TH_INFO_DEBUG_TEXT; } - else if (type & RPT_PROPERTY) { + if (type & RPT_PROPERTY) { return TH_INFO_PROPERTY_TEXT; } - else if (type & RPT_OPERATOR) { + if (type & RPT_OPERATOR) { return TH_INFO_OPERATOR_TEXT; } - else { - return TH_INFO_WARNING_TEXT; - } + return TH_INFO_WARNING_TEXT; } /********************************** Misc **************************************/ diff --git a/source/blender/editors/space_clip/clip_utils.c b/source/blender/editors/space_clip/clip_utils.c index bb79eb34129..dbf733413e5 100644 --- a/source/blender/editors/space_clip/clip_utils.c +++ b/source/blender/editors/space_clip/clip_utils.c @@ -509,13 +509,12 @@ static bool mask_has_selection(const bContext *C) if (BKE_mask_point_handles_mode_get(point) == MASK_HANDLE_MODE_STICK) { return true; } - else { - if ((bezt->f1 & SELECT) && (bezt->h1 != HD_VECT)) { - return true; - } - if ((bezt->f3 & SELECT) && (bezt->h2 != HD_VECT)) { - return true; - } + + if ((bezt->f1 & SELECT) && (bezt->h1 != HD_VECT)) { + return true; + } + if ((bezt->f3 & SELECT) && (bezt->h2 != HD_VECT)) { + return true; } } } diff --git a/source/blender/editors/util/ed_util_ops.cc b/source/blender/editors/util/ed_util_ops.cc index cb7ff9f3a63..5b2e1a16bc2 100644 --- a/source/blender/editors/util/ed_util_ops.cc +++ b/source/blender/editors/util/ed_util_ops.cc @@ -20,7 +20,7 @@ * Utility operators for UI data or for the UI to use. */ -#include <string.h> +#include <cstring> #include "DNA_space_types.h" #include "DNA_windowmanager_types.h" diff --git a/source/blender/io/alembic/exporter/abc_archive.cc b/source/blender/io/alembic/exporter/abc_archive.cc index 90a4baf97bc..6c6ad985c9b 100644 --- a/source/blender/io/alembic/exporter/abc_archive.cc +++ b/source/blender/io/alembic/exporter/abc_archive.cc @@ -141,13 +141,13 @@ static TimeSamplingPtr create_time_sampling(double scene_fps, std::vector<double> samples; if (params.frame_start == params.frame_end) { - return TimeSamplingPtr(new TimeSampling()); + return std::make_shared<TimeSampling>(); } get_shutter_samples(scene_fps, params, nr_of_samples, true, samples); TimeSamplingType ts(static_cast<uint32_t>(samples.size()), 1.0 / scene_fps); - return TimeSamplingPtr(new TimeSampling(ts, samples)); + return std::make_shared<TimeSampling>(ts, samples); } static void get_frames(double scene_fps, diff --git a/source/blender/nodes/geometry/nodes/node_geo_align_rotation_to_vector.cc b/source/blender/nodes/geometry/nodes/node_geo_align_rotation_to_vector.cc index 02a6ac49c29..a81adbbd754 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_align_rotation_to_vector.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_align_rotation_to_vector.cc @@ -39,7 +39,7 @@ static void geo_node_align_rotation_to_vector_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "axis", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(layout, ptr, "axis", UI_ITEM_R_EXPAND, nullptr, ICON_NONE); uiItemR(layout, ptr, "pivot_axis", 0, IFACE_("Pivot"), ICON_NONE); uiLayout *col = uiLayoutColumn(layout, false); uiItemR(col, ptr, "input_type_factor", 0, IFACE_("Factor"), ICON_NONE); diff --git a/source/blender/nodes/geometry/nodes/node_geo_attribute_color_ramp.cc b/source/blender/nodes/geometry/nodes/node_geo_attribute_color_ramp.cc index 0309fb83bd7..98bf612f589 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_attribute_color_ramp.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_color_ramp.cc @@ -37,7 +37,7 @@ static void geo_node_attribute_color_ramp_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiTemplateColorRamp(layout, ptr, "color_ramp", 0); + uiTemplateColorRamp(layout, ptr, "color_ramp", false); } namespace blender::nodes { diff --git a/source/blender/nodes/geometry/nodes/node_geo_attribute_sample_texture.cc b/source/blender/nodes/geometry/nodes/node_geo_attribute_sample_texture.cc index dd8f0adb740..d0b2595b5b9 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_attribute_sample_texture.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_sample_texture.cc @@ -43,7 +43,7 @@ static void geo_node_attribute_sample_texture_layout(uiLayout *layout, bContext *C, PointerRNA *ptr) { - uiTemplateID(layout, C, ptr, "texture", "texture.new", NULL, NULL, 0, ICON_NONE, NULL); + uiTemplateID(layout, C, ptr, "texture", "texture.new", nullptr, nullptr, 0, ICON_NONE, nullptr); } namespace blender::nodes { diff --git a/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc b/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc index 8391c4e2bc0..d8e95faec27 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc @@ -35,7 +35,7 @@ static bNodeSocketTemplate geo_node_collection_info_out[] = { static void geo_node_collection_info_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "transform_space", 0, NULL, ICON_NONE); + uiItemR(layout, ptr, "transform_space", 0, nullptr, ICON_NONE); } namespace blender::nodes { diff --git a/source/blender/nodes/geometry/nodes/node_geo_object_info.cc b/source/blender/nodes/geometry/nodes/node_geo_object_info.cc index 7249a34134f..54ecb20dae7 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_object_info.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_object_info.cc @@ -41,7 +41,7 @@ static bNodeSocketTemplate geo_node_object_info_out[] = { static void geo_node_object_info_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "transform_space", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(layout, ptr, "transform_space", UI_ITEM_R_EXPAND, nullptr, ICON_NONE); } namespace blender::nodes { diff --git a/source/blender/nodes/geometry/nodes/node_geo_point_instance.cc b/source/blender/nodes/geometry/nodes/node_geo_point_instance.cc index 5cb98901d8d..11921acdb68 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_point_instance.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_point_instance.cc @@ -44,9 +44,9 @@ static bNodeSocketTemplate geo_node_point_instance_out[] = { static void geo_node_point_instance_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "instance_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(layout, ptr, "instance_type", UI_ITEM_R_EXPAND, nullptr, ICON_NONE); if (RNA_enum_get(ptr, "instance_type") == GEO_NODE_POINT_INSTANCE_TYPE_COLLECTION) { - uiItemR(layout, ptr, "use_whole_collection", 0, NULL, ICON_NONE); + uiItemR(layout, ptr, "use_whole_collection", 0, nullptr, ICON_NONE); } } diff --git a/source/blender/nodes/geometry/nodes/node_geo_point_rotate.cc b/source/blender/nodes/geometry/nodes/node_geo_point_rotate.cc index 013dbf5045f..fc2a5edc675 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_point_rotate.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_point_rotate.cc @@ -41,8 +41,8 @@ static void geo_node_point_rotate_layout(uiLayout *layout, bContext *UNUSED(C), { NodeGeometryRotatePoints *storage = (NodeGeometryRotatePoints *)((bNode *)ptr->data)->storage; - uiItemR(layout, ptr, "type", UI_ITEM_R_EXPAND, NULL, ICON_NONE); - uiItemR(layout, ptr, "space", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(layout, ptr, "type", UI_ITEM_R_EXPAND, nullptr, ICON_NONE); + uiItemR(layout, ptr, "space", UI_ITEM_R_EXPAND, nullptr, ICON_NONE); uiLayout *col = uiLayoutColumn(layout, false); if (storage->type == GEO_NODE_POINT_ROTATE_TYPE_AXIS_ANGLE) { |