Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Eagar <joeedh@gmail.com>2022-09-27 20:49:47 +0300
committerJoseph Eagar <joeedh@gmail.com>2022-09-27 20:49:47 +0300
commit6e6461c84c76f47a169d561bd932011709847d33 (patch)
treec7cc3f459fbae200dc0cc91958b700c79ff56bd0 /source/blender/blenkernel
parent175bc0585ea4fc23a0ccd045135042ebcb45cc3d (diff)
parent2b88ee50fb7b3ed7e6c0704eee8b39b404219430 (diff)
Merge branch 'master' into temp-sculpt-cavity-mask
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_attribute_math.hh30
-rw-r--r--source/blender/blenkernel/BKE_blender_version.h4
-rw-r--r--source/blender/blenkernel/BKE_cryptomatte.hh4
-rw-r--r--source/blender/blenkernel/BKE_curves.hh2
-rw-r--r--source/blender/blenkernel/BKE_global.h19
-rw-r--r--source/blender/blenkernel/BKE_node.h1
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.cc4
-rw-r--r--source/blender/blenkernel/intern/armature.c2
-rw-r--r--source/blender/blenkernel/intern/armature_deform.c2
-rw-r--r--source/blender/blenkernel/intern/attribute.cc6
-rw-r--r--source/blender/blenkernel/intern/brush.cc2
-rw-r--r--source/blender/blenkernel/intern/camera.c2
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c4
-rw-r--r--source/blender/blenkernel/intern/cloth.c38
-rw-r--r--source/blender/blenkernel/intern/collection.c4
-rw-r--r--source/blender/blenkernel/intern/collision.c15
-rw-r--r--source/blender/blenkernel/intern/colortools.c60
-rw-r--r--source/blender/blenkernel/intern/constraint.c2
-rw-r--r--source/blender/blenkernel/intern/cryptomatte.cc2
-rw-r--r--source/blender/blenkernel/intern/curve.cc57
-rw-r--r--source/blender/blenkernel/intern/curve_bezier.cc2
-rw-r--r--source/blender/blenkernel/intern/curveprofile.cc24
-rw-r--r--source/blender/blenkernel/intern/customdata.cc76
-rw-r--r--source/blender/blenkernel/intern/customdata_file.c4
-rw-r--r--source/blender/blenkernel/intern/data_transfer.c4
-rw-r--r--source/blender/blenkernel/intern/deform.c10
-rw-r--r--source/blender/blenkernel/intern/displist.cc20
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c40
-rw-r--r--source/blender/blenkernel/intern/editmesh_bvh.c4
-rw-r--r--source/blender/blenkernel/intern/editmesh_tangent.cc12
-rw-r--r--source/blender/blenkernel/intern/fcurve.c6
-rw-r--r--source/blender/blenkernel/intern/fmodifier.c2
-rw-r--r--source/blender/blenkernel/intern/gpencil.c11
-rw-r--r--source/blender/blenkernel/intern/gpencil_curve.c10
-rw-r--r--source/blender/blenkernel/intern/gpencil_geom.cc66
-rw-r--r--source/blender/blenkernel/intern/gpencil_modifier.c21
-rw-r--r--source/blender/blenkernel/intern/icons.cc12
-rw-r--r--source/blender/blenkernel/intern/icons_rasterize.c4
-rw-r--r--source/blender/blenkernel/intern/idprop.c4
-rw-r--r--source/blender/blenkernel/intern/image.cc58
-rw-r--r--source/blender/blenkernel/intern/image_gen.c46
-rw-r--r--source/blender/blenkernel/intern/image_gpu.cc10
-rw-r--r--source/blender/blenkernel/intern/image_save.cc6
-rw-r--r--source/blender/blenkernel/intern/ipo.c4
-rw-r--r--source/blender/blenkernel/intern/kelvinlet.c4
-rw-r--r--source/blender/blenkernel/intern/lattice.c2
-rw-r--r--source/blender/blenkernel/intern/layer.c6
-rw-r--r--source/blender/blenkernel/intern/lib_override.cc8
-rw-r--r--source/blender/blenkernel/intern/lib_remap.c2
-rw-r--r--source/blender/blenkernel/intern/main_idmap.c4
-rw-r--r--source/blender/blenkernel/intern/main_namemap.cc4
-rw-r--r--source/blender/blenkernel/intern/mask.c2
-rw-r--r--source/blender/blenkernel/intern/mask_evaluate.c62
-rw-r--r--source/blender/blenkernel/intern/mask_rasterize.c191
-rw-r--r--source/blender/blenkernel/intern/material.c2
-rw-r--r--source/blender/blenkernel/intern/mball.cc2
-rw-r--r--source/blender/blenkernel/intern/mball_tessellate.c44
-rw-r--r--source/blender/blenkernel/intern/mesh.cc4
-rw-r--r--source/blender/blenkernel/intern/mesh_boolean_convert.cc8
-rw-r--r--source/blender/blenkernel/intern/mesh_calc_edges.cc5
-rw-r--r--source/blender/blenkernel/intern/mesh_convert.cc20
-rw-r--r--source/blender/blenkernel/intern/mesh_evaluate.cc22
-rw-r--r--source/blender/blenkernel/intern/mesh_fair.cc2
-rw-r--r--source/blender/blenkernel/intern/mesh_legacy_convert.cc30
-rw-r--r--source/blender/blenkernel/intern/mesh_mapping.cc74
-rw-r--r--source/blender/blenkernel/intern/mesh_merge_customdata.cc2
-rw-r--r--source/blender/blenkernel/intern/mesh_normals.cc54
-rw-r--r--source/blender/blenkernel/intern/mesh_remap.c4
-rw-r--r--source/blender/blenkernel/intern/mesh_remesh_voxel.cc10
-rw-r--r--source/blender/blenkernel/intern/mesh_tangent.cc42
-rw-r--r--source/blender/blenkernel/intern/mesh_tessellate.cc22
-rw-r--r--source/blender/blenkernel/intern/mesh_validate.cc2
-rw-r--r--source/blender/blenkernel/intern/movieclip.c12
-rw-r--r--source/blender/blenkernel/intern/node.cc19
-rw-r--r--source/blender/blenkernel/intern/node_tree_update.cc4
-rw-r--r--source/blender/blenkernel/intern/object.cc30
-rw-r--r--source/blender/blenkernel/intern/object_deform.c4
-rw-r--r--source/blender/blenkernel/intern/object_dupli.cc18
-rw-r--r--source/blender/blenkernel/intern/object_update.c7
-rw-r--r--source/blender/blenkernel/intern/ocean.c2
-rw-r--r--source/blender/blenkernel/intern/paint.cc2
-rw-r--r--source/blender/blenkernel/intern/particle.c8
-rw-r--r--source/blender/blenkernel/intern/particle_distribute.c2
-rw-r--r--source/blender/blenkernel/intern/pbvh.c23
-rw-r--r--source/blender/blenkernel/intern/pbvh.cc6
-rw-r--r--source/blender/blenkernel/intern/pbvh_bmesh.c4
-rw-r--r--source/blender/blenkernel/intern/pointcache.c169
-rw-r--r--source/blender/blenkernel/intern/rigidbody.c2
-rw-r--r--source/blender/blenkernel/intern/scene.cc40
-rw-r--r--source/blender/blenkernel/intern/shrinkwrap.c6
-rw-r--r--source/blender/blenkernel/intern/softbody.c10
-rw-r--r--source/blender/blenkernel/intern/sound.c2
-rw-r--r--source/blender/blenkernel/intern/studiolight.c4
-rw-r--r--source/blender/blenkernel/intern/subdiv_ccg.c10
-rw-r--r--source/blender/blenkernel/intern/subdiv_mesh.cc20
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c10
-rw-r--r--source/blender/blenkernel/intern/text.c58
-rw-r--r--source/blender/blenkernel/intern/tracking.c16
-rw-r--r--source/blender/blenkernel/intern/tracking_detect.c2
-rw-r--r--source/blender/blenkernel/intern/tracking_region_tracker.c6
-rw-r--r--source/blender/blenkernel/intern/tracking_util.c2
-rw-r--r--source/blender/blenkernel/intern/type_conversions.cc32
-rw-r--r--source/blender/blenkernel/intern/undo_system.c4
-rw-r--r--source/blender/blenkernel/intern/vfont.c8
-rw-r--r--source/blender/blenkernel/intern/vfontdata_freetype.c2
-rw-r--r--source/blender/blenkernel/intern/volume.cc6
-rw-r--r--source/blender/blenkernel/intern/volume_render.cc5
-rw-r--r--source/blender/blenkernel/intern/writeavi.c4
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c4
109 files changed, 936 insertions, 977 deletions
diff --git a/source/blender/blenkernel/BKE_attribute_math.hh b/source/blender/blenkernel/BKE_attribute_math.hh
index abd8b33b260..5c0e5f428a4 100644
--- a/source/blender/blenkernel/BKE_attribute_math.hh
+++ b/source/blender/blenkernel/BKE_attribute_math.hh
@@ -60,12 +60,12 @@ template<> inline bool mix2(const float factor, const bool &a, const bool &b)
template<> inline int8_t mix2(const float factor, const int8_t &a, const int8_t &b)
{
- return static_cast<int8_t>(std::round((1.0f - factor) * a + factor * b));
+ return int8_t(std::round((1.0f - factor) * a + factor * b));
}
template<> inline int mix2(const float factor, const int &a, const int &b)
{
- return static_cast<int>(std::round((1.0f - factor) * a + factor * b));
+ return int(std::round((1.0f - factor) * a + factor * b));
}
template<> inline float mix2(const float factor, const float &a, const float &b)
@@ -108,7 +108,7 @@ template<typename T> T mix3(const float3 &weights, const T &v0, const T &v1, con
template<>
inline int8_t mix3(const float3 &weights, const int8_t &v0, const int8_t &v1, const int8_t &v2)
{
- return static_cast<int8_t>(std::round(weights.x * v0 + weights.y * v1 + weights.z * v2));
+ return int8_t(std::round(weights.x * v0 + weights.y * v1 + weights.z * v2));
}
template<> inline bool mix3(const float3 &weights, const bool &v0, const bool &v1, const bool &v2)
@@ -118,7 +118,7 @@ template<> inline bool mix3(const float3 &weights, const bool &v0, const bool &v
template<> inline int mix3(const float3 &weights, const int &v0, const int &v1, const int &v2)
{
- return static_cast<int>(std::round(weights.x * v0 + weights.y * v1 + weights.z * v2));
+ return int(std::round(weights.x * v0 + weights.y * v1 + weights.z * v2));
}
template<>
@@ -160,10 +160,8 @@ inline ColorGeometry4b mix3(const float3 &weights,
const float4 v1_f{&v1.r};
const float4 v2_f{&v2.r};
const float4 mixed = v0_f * weights[0] + v1_f * weights[1] + v2_f * weights[2];
- return ColorGeometry4b{static_cast<uint8_t>(mixed[0]),
- static_cast<uint8_t>(mixed[1]),
- static_cast<uint8_t>(mixed[2]),
- static_cast<uint8_t>(mixed[3])};
+ return ColorGeometry4b{
+ uint8_t(mixed[0]), uint8_t(mixed[1]), uint8_t(mixed[2]), uint8_t(mixed[3])};
}
/** \} */
@@ -180,8 +178,7 @@ template<>
inline int8_t mix4(
const float4 &weights, const int8_t &v0, const int8_t &v1, const int8_t &v2, const int8_t &v3)
{
- return static_cast<int8_t>(
- std::round(weights.x * v0 + weights.y * v1 + weights.z * v2 + weights.w * v3));
+ return int8_t(std::round(weights.x * v0 + weights.y * v1 + weights.z * v2 + weights.w * v3));
}
template<>
@@ -194,8 +191,7 @@ inline bool mix4(
template<>
inline int mix4(const float4 &weights, const int &v0, const int &v1, const int &v2, const int &v3)
{
- return static_cast<int>(
- std::round(weights.x * v0 + weights.y * v1 + weights.z * v2 + weights.w * v3));
+ return int(std::round(weights.x * v0 + weights.y * v1 + weights.z * v2 + weights.w * v3));
}
template<>
@@ -244,10 +240,8 @@ inline ColorGeometry4b mix4(const float4 &weights,
const float4 v3_f{&v3.r};
float4 mixed;
interp_v4_v4v4v4v4(mixed, v0_f, v1_f, v2_f, v3_f, weights);
- return ColorGeometry4b{static_cast<uint8_t>(mixed[0]),
- static_cast<uint8_t>(mixed[1]),
- static_cast<uint8_t>(mixed[2]),
- static_cast<uint8_t>(mixed[3])};
+ return ColorGeometry4b{
+ uint8_t(mixed[0]), uint8_t(mixed[1]), uint8_t(mixed[2]), uint8_t(mixed[3])};
}
/** \} */
@@ -523,7 +517,7 @@ template<> struct DefaultMixerStruct<ColorGeometry4b> {
template<> struct DefaultMixerStruct<int> {
static int double_to_int(const double &value)
{
- return static_cast<int>(std::round(value));
+ return int(std::round(value));
}
/* Store interpolated ints in a double temporarily, so that weights are handled correctly. It
* uses double instead of float so that it is accurate for all 32 bit integers. */
@@ -542,7 +536,7 @@ template<> struct DefaultMixerStruct<bool> {
template<> struct DefaultMixerStruct<int8_t> {
static int8_t float_to_int8_t(const float &value)
{
- return static_cast<int8_t>(std::round(value));
+ return int8_t(std::round(value));
}
/* Store interpolated 8 bit integers in a float temporarily to increase accuracy. */
using type = SimpleMixerWithAccumulationType<int8_t, float, float_to_int8_t>;
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h
index 2909cac7a41..808708922f8 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -25,13 +25,13 @@ extern "C" {
/* Blender file format version. */
#define BLENDER_FILE_VERSION BLENDER_VERSION
-#define BLENDER_FILE_SUBVERSION 0
+#define BLENDER_FILE_SUBVERSION 1
/* Minimum Blender version that supports reading file written with the current
* version. Older Blender versions will test this and show a warning if the file
* was written with too new a version. */
#define BLENDER_FILE_MIN_VERSION 304
-#define BLENDER_FILE_MIN_SUBVERSION 0
+#define BLENDER_FILE_MIN_SUBVERSION 1
/** User readable version string. */
const char *BKE_blender_version_string(void);
diff --git a/source/blender/blenkernel/BKE_cryptomatte.hh b/source/blender/blenkernel/BKE_cryptomatte.hh
index dd08f7b5c4f..b24968c5c70 100644
--- a/source/blender/blenkernel/BKE_cryptomatte.hh
+++ b/source/blender/blenkernel/BKE_cryptomatte.hh
@@ -79,8 +79,8 @@ struct CryptomatteHash {
{
uint32_t mantissa = hash & ((1 << 23) - 1);
uint32_t exponent = (hash >> 23) & ((1 << 8) - 1);
- exponent = MAX2(exponent, (uint32_t)1);
- exponent = MIN2(exponent, (uint32_t)254);
+ exponent = MAX2(exponent, uint32_t(1));
+ exponent = MIN2(exponent, uint32_t(254));
exponent = exponent << 23;
uint32_t sign = (hash >> 31);
sign = sign << 31;
diff --git a/source/blender/blenkernel/BKE_curves.hh b/source/blender/blenkernel/BKE_curves.hh
index 0d67152dec8..371f6052a76 100644
--- a/source/blender/blenkernel/BKE_curves.hh
+++ b/source/blender/blenkernel/BKE_curves.hh
@@ -986,7 +986,7 @@ inline bool has_vector_handles(const int num_curve_points,
const bool cyclic,
const int resolution)
{
- return evaluated_size - !cyclic != (int64_t)segments_num(num_curve_points, cyclic) * resolution;
+ return evaluated_size - !cyclic != int64_t(segments_num(num_curve_points, cyclic)) * resolution;
}
inline float3 calculate_vector_handle(const float3 &point, const float3 &next_point)
diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h
index e28c87cd7d6..f3acb7d3746 100644
--- a/source/blender/blenkernel/BKE_global.h
+++ b/source/blender/blenkernel/BKE_global.h
@@ -189,15 +189,16 @@ enum {
* assigned to ID datablocks */
G_DEBUG_DEPSGRAPH = (G_DEBUG_DEPSGRAPH_BUILD | G_DEBUG_DEPSGRAPH_EVAL | G_DEBUG_DEPSGRAPH_TAG |
G_DEBUG_DEPSGRAPH_TIME | G_DEBUG_DEPSGRAPH_UUID),
- G_DEBUG_SIMDATA = (1 << 15), /* sim debug data display */
- G_DEBUG_GPU = (1 << 16), /* gpu debug */
- G_DEBUG_IO = (1 << 17), /* IO Debugging (for Collada, ...). */
- G_DEBUG_GPU_FORCE_WORKAROUNDS = (1 << 18), /* force gpu workarounds bypassing detections. */
- G_DEBUG_XR = (1 << 19), /* XR/OpenXR messages */
- G_DEBUG_XR_TIME = (1 << 20), /* XR/OpenXR timing messages */
-
- G_DEBUG_GHOST = (1 << 21), /* Debug GHOST module. */
- G_DEBUG_WINTAB = (1 << 22), /* Debug Wintab. */
+ G_DEBUG_SIMDATA = (1 << 15), /* sim debug data display */
+ G_DEBUG_GPU = (1 << 16), /* gpu debug */
+ G_DEBUG_IO = (1 << 17), /* IO Debugging (for Collada, ...). */
+ G_DEBUG_GPU_FORCE_WORKAROUNDS = (1 << 18), /* force gpu workarounds bypassing detections. */
+ G_DEBUG_GPU_FORCE_DISABLE_SSBO = (1 << 19), /* force disabling usage of SSBO's */
+ G_DEBUG_XR = (1 << 20), /* XR/OpenXR messages */
+ G_DEBUG_XR_TIME = (1 << 21), /* XR/OpenXR timing messages */
+
+ G_DEBUG_GHOST = (1 << 22), /* Debug GHOST module. */
+ G_DEBUG_WINTAB = (1 << 23), /* Debug Wintab. */
};
#define G_DEBUG_ALL \
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index 14cf8164b79..625c4d87bcd 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -1531,6 +1531,7 @@ struct TexResult;
#define GEO_NODE_SAMPLE_INDEX 1174
#define GEO_NODE_SAMPLE_NEAREST 1175
#define GEO_NODE_SAMPLE_NEAREST_SURFACE 1176
+#define GEO_NODE_INPUT_CONTROL_POINT_NEIGHBORS 1177
/** \} */
diff --git a/source/blender/blenkernel/intern/DerivedMesh.cc b/source/blender/blenkernel/intern/DerivedMesh.cc
index 375e7b456cd..b4cc46619a7 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.cc
+++ b/source/blender/blenkernel/intern/DerivedMesh.cc
@@ -279,8 +279,8 @@ bool DM_release(DerivedMesh *dm)
void DM_ensure_looptri_data(DerivedMesh *dm)
{
- const unsigned int totpoly = dm->numPolyData;
- const unsigned int totloop = dm->numLoopData;
+ const uint totpoly = dm->numPolyData;
+ const uint totloop = dm->numLoopData;
const int looptris_num = poly_to_tri_count(totpoly, totloop);
BLI_assert(dm->looptris.array_wip == nullptr);
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 9b00d427320..2e73cac99b5 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -698,7 +698,7 @@ void BKE_armature_refresh_layer_used(struct Depsgraph *depsgraph, struct bArmatu
bool bone_autoside_name(
char name[MAXBONENAME], int UNUSED(strip_number), short axis, float head, float tail)
{
- unsigned int len;
+ uint len;
char basename[MAXBONENAME] = "";
char extension[5] = "";
diff --git a/source/blender/blenkernel/intern/armature_deform.c b/source/blender/blenkernel/intern/armature_deform.c
index 84bb1af011a..4acbcbfb13e 100644
--- a/source/blender/blenkernel/intern/armature_deform.c
+++ b/source/blender/blenkernel/intern/armature_deform.c
@@ -314,7 +314,7 @@ static void armature_vert_task_with_dvert(const ArmatureUserdata *data,
if (use_dverts && dvert && dvert->totweight) { /* use weight groups ? */
const MDeformWeight *dw = dvert->dw;
int deformed = 0;
- unsigned int j;
+ uint j;
for (j = dvert->totweight; j != 0; j--, dw++) {
const uint index = dw->def_nr;
if (index < data->defbase_len && (pchan = data->pchan_from_defbase[index])) {
diff --git a/source/blender/blenkernel/intern/attribute.cc b/source/blender/blenkernel/intern/attribute.cc
index bd3e452b7f2..1a54454bf9a 100644
--- a/source/blender/blenkernel/intern/attribute.cc
+++ b/source/blender/blenkernel/intern/attribute.cc
@@ -354,7 +354,7 @@ CustomDataLayer *BKE_id_attribute_search(ID *id,
get_domains(id, info);
for (eAttrDomain domain = ATTR_DOMAIN_POINT; domain < ATTR_DOMAIN_NUM;
- domain = static_cast<eAttrDomain>((static_cast<int>(domain)) + 1)) {
+ domain = static_cast<eAttrDomain>(int(domain) + 1)) {
if (!(domain_mask & ATTR_DOMAIN_AS_MASK(domain))) {
continue;
}
@@ -388,7 +388,7 @@ int BKE_id_attributes_length(const ID *id, eAttrDomainMask domain_mask, eCustomD
continue;
}
- if ((1 << (int)domain) & domain_mask) {
+ if ((1 << int(domain)) & domain_mask) {
length += CustomData_number_of_layers_typemask(customdata, mask);
}
}
@@ -574,7 +574,7 @@ CustomDataLayer *BKE_id_attribute_from_index(ID *id,
for (const int domain : IndexRange(ATTR_DOMAIN_NUM)) {
CustomData *customdata = info[domain].customdata;
- if (!customdata || !((1 << (int)domain) & domain_mask)) {
+ if (!customdata || !((1 << int(domain)) & domain_mask)) {
continue;
}
diff --git a/source/blender/blenkernel/intern/brush.cc b/source/blender/blenkernel/intern/brush.cc
index 7ab8088823b..f7bbd50aafa 100644
--- a/source/blender/blenkernel/intern/brush.cc
+++ b/source/blender/blenkernel/intern/brush.cc
@@ -2373,7 +2373,7 @@ void BKE_brush_scale_unprojected_radius(float *unprojected_radius,
float scale = new_brush_size;
/* avoid division by zero */
if (old_brush_size != 0) {
- scale /= (float)old_brush_size;
+ scale /= float(old_brush_size);
}
(*unprojected_radius) *= scale;
}
diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c
index c3384239cb6..e404c982d55 100644
--- a/source/blender/blenkernel/intern/camera.c
+++ b/source/blender/blenkernel/intern/camera.c
@@ -579,7 +579,7 @@ typedef struct CameraViewFrameData {
float dist_vals[CAMERA_VIEWFRAME_NUM_PLANES]; /* distance (signed) */
float camera_no[3];
float z_range[2];
- unsigned int tot;
+ uint tot;
bool do_zrange;
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index bcdd01aa8b3..1f97f8a848c 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -115,8 +115,8 @@ static void cdDM_getVertNo(DerivedMesh *dm, int index, float r_no[3])
static void cdDM_recalc_looptri(DerivedMesh *dm)
{
CDDerivedMesh *cddm = (CDDerivedMesh *)dm;
- const unsigned int totpoly = dm->numPolyData;
- const unsigned int totloop = dm->numLoopData;
+ const uint totpoly = dm->numPolyData;
+ const uint totloop = dm->numLoopData;
DM_ensure_looptri_data(dm);
BLI_assert(totpoly == 0 || cddm->dm.looptris.array_wip != NULL);
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index f3bda8b1c99..e85e19f04c9 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -117,7 +117,7 @@ static BVHTree *bvhtree_build_from_cloth(ClothModifierData *clmd, float epsilon)
void bvhtree_update_from_cloth(ClothModifierData *clmd, bool moving, bool self)
{
- unsigned int i = 0;
+ uint i = 0;
Cloth *cloth = clmd->clothObject;
BVHTree *bvhtree;
ClothVertex *verts = cloth->verts;
@@ -252,7 +252,7 @@ static int do_step_cloth(
Cloth *cloth;
ListBase *effectors = NULL;
MVert *mvert;
- unsigned int i = 0;
+ uint i = 0;
int ret = 0;
bool vert_mass_changed = false;
@@ -576,7 +576,7 @@ void cloth_free_modifier_extern(ClothModifierData *clmd)
*/
static void cloth_to_object(Object *ob, ClothModifierData *clmd, float (*vertexCos)[3])
{
- unsigned int i = 0;
+ uint i = 0;
Cloth *cloth = clmd->clothObject;
if (clmd->clothObject) {
@@ -825,8 +825,8 @@ static void cloth_from_mesh(ClothModifierData *clmd, const Object *ob, Mesh *mes
{
const MLoop *mloop = BKE_mesh_loops(mesh);
const MLoopTri *looptri = BKE_mesh_runtime_looptri_ensure(mesh);
- const unsigned int mvert_num = mesh->totvert;
- const unsigned int looptri_num = mesh->runtime.looptris.len;
+ const uint mvert_num = mesh->totvert;
+ const uint looptri_num = mesh->runtime.looptris.len;
/* Allocate our vertices. */
clmd->clothObject->mvert_num = mvert_num;
@@ -884,7 +884,7 @@ BLI_INLINE void spring_verts_ordered_set(ClothSpring *spring, int v0, int v1)
}
}
-static void cloth_free_edgelist(LinkNodePair *edgelist, unsigned int mvert_num)
+static void cloth_free_edgelist(LinkNodePair *edgelist, uint mvert_num)
{
if (edgelist) {
for (uint i = 0; i < mvert_num; i++) {
@@ -1148,7 +1148,7 @@ static void cloth_update_springs(ClothModifierData *clmd)
/* Update rest verts, for dynamically deformable cloth */
static void cloth_update_verts(Object *ob, ClothModifierData *clmd, Mesh *mesh)
{
- unsigned int i = 0;
+ uint i = 0;
const MVert *mvert = BKE_mesh_verts(mesh);
ClothVertex *verts = clmd->clothObject->verts;
@@ -1180,9 +1180,9 @@ static void cloth_update_spring_lengths(ClothModifierData *clmd, Mesh *mesh)
{
Cloth *cloth = clmd->clothObject;
LinkNode *search = cloth->springs;
- unsigned int struct_springs = 0;
- unsigned int i = 0;
- unsigned int mvert_num = (unsigned int)mesh->totvert;
+ uint struct_springs = 0;
+ uint i = 0;
+ uint mvert_num = (uint)mesh->totvert;
float shrink_factor;
clmd->sim_parms->avg_spring_len = 0.0f;
@@ -1373,12 +1373,12 @@ BLI_INLINE bool cloth_bend_set_poly_vert_array(int **poly, int len, const MLoop
}
static bool find_internal_spring_target_vertex(BVHTreeFromMesh *treedata,
- unsigned int v_idx,
+ uint v_idx,
RNG *rng,
float max_length,
float max_diversion,
bool check_normal,
- unsigned int *r_tar_v_idx)
+ uint *r_tar_v_idx)
{
float co[3], no[3], new_co[3];
float radius;
@@ -1415,7 +1415,7 @@ static bool find_internal_spring_target_vertex(BVHTreeFromMesh *treedata,
BLI_bvhtree_ray_cast(
treedata->tree, new_co, no, radius, &rayhit, treedata->raycast_callback, treedata);
- unsigned int vert_idx = -1;
+ uint vert_idx = -1;
const MLoop *mloop = treedata->loop;
const MLoopTri *lt = NULL;
@@ -1429,7 +1429,7 @@ static bool find_internal_spring_target_vertex(BVHTreeFromMesh *treedata,
lt = &treedata->looptri[rayhit.index];
for (int i = 0; i < 3; i++) {
- unsigned int tmp_vert_idx = mloop[lt->tri[i]].v;
+ uint tmp_vert_idx = mloop[lt->tri[i]].v;
if (tmp_vert_idx == v_idx) {
/* We managed to hit ourselves. */
return false;
@@ -1453,10 +1453,10 @@ static bool cloth_build_springs(ClothModifierData *clmd, Mesh *mesh)
{
Cloth *cloth = clmd->clothObject;
ClothSpring *spring = NULL, *tspring = NULL, *tspring2 = NULL;
- unsigned int struct_springs = 0, shear_springs = 0, bend_springs = 0, struct_springs_real = 0;
- unsigned int mvert_num = (unsigned int)mesh->totvert;
- unsigned int numedges = (unsigned int)mesh->totedge;
- unsigned int numpolys = (unsigned int)mesh->totpoly;
+ uint struct_springs = 0, shear_springs = 0, bend_springs = 0, struct_springs_real = 0;
+ uint mvert_num = (uint)mesh->totvert;
+ uint numedges = (uint)mesh->totedge;
+ uint numpolys = (uint)mesh->totpoly;
float shrink_factor;
const MEdge *medge = BKE_mesh_edges(mesh);
const MPoly *mpoly = BKE_mesh_polys(mesh);
@@ -1499,7 +1499,7 @@ static bool cloth_build_springs(ClothModifierData *clmd, Mesh *mesh)
if (use_internal_springs && numpolys > 0) {
BVHTreeFromMesh treedata = {NULL};
- unsigned int tar_v_idx;
+ uint tar_v_idx;
Mesh *tmp_mesh = NULL;
RNG *rng;
diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c
index 98b1e3d0039..82b358b77a1 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -796,10 +796,10 @@ static void collection_object_cache_fill(ListBase *lb,
/* Only collection flags are checked here currently, object restrict flag is checked
* in FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN since it can be animated
* without updating the cache. */
- if (((child_restrict & COLLECTION_HIDE_VIEWPORT) == 0)) {
+ if ((child_restrict & COLLECTION_HIDE_VIEWPORT) == 0) {
base->flag |= BASE_ENABLED_VIEWPORT;
}
- if (((child_restrict & COLLECTION_HIDE_RENDER) == 0)) {
+ if ((child_restrict & COLLECTION_HIDE_RENDER) == 0) {
base->flag |= BASE_ENABLED_RENDER;
}
}
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index 0bacd657981..2acdc6543b5 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -67,7 +67,7 @@ void collision_move_object(CollisionModifierData *collmd,
const float prevstep,
const bool moving_bvh)
{
- unsigned int i = 0;
+ uint i = 0;
/* the collider doesn't move this frame */
if (collmd->is_static) {
@@ -1216,10 +1216,7 @@ static void hair_collision(void *__restrict userdata,
}
}
-static void add_collision_object(ListBase *relations,
- Object *ob,
- int level,
- unsigned int modifier_type)
+static void add_collision_object(ListBase *relations, Object *ob, int level, uint modifier_type)
{
/* only get objects with collision modifier */
ModifierData *cmd = BKE_modifiers_findby_type(ob, modifier_type);
@@ -1246,7 +1243,7 @@ static void add_collision_object(ListBase *relations,
ListBase *BKE_collision_relations_create(Depsgraph *depsgraph,
Collection *collection,
- unsigned int modifier_type)
+ uint modifier_type)
{
const Scene *scene = DEG_get_input_scene(depsgraph);
ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph);
@@ -1276,8 +1273,8 @@ void BKE_collision_relations_free(ListBase *relations)
Object **BKE_collision_objects_create(Depsgraph *depsgraph,
Object *self,
Collection *collection,
- unsigned int *numcollobj,
- unsigned int modifier_type)
+ uint *numcollobj,
+ uint modifier_type)
{
ListBase *relations = DEG_get_collision_relations(depsgraph, collection, modifier_type);
@@ -1549,7 +1546,7 @@ int cloth_bvh_collision(
ClothVertex *verts = NULL;
int ret = 0, ret2 = 0;
Object **collobjs = NULL;
- unsigned int numcollobj = 0;
+ uint numcollobj = 0;
uint *coll_counts_obj = NULL;
BVHTreeOverlap **overlap_obj = NULL;
uint coll_count_self = 0;
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c
index e4c46703f8a..cc379ebb561 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -1098,8 +1098,8 @@ void BKE_curvemapping_evaluate_premulRGBF(const CurveMapping *cumap,
}
void BKE_curvemapping_evaluate_premulRGB(const CurveMapping *cumap,
- unsigned char vecout_byte[3],
- const unsigned char vecin_byte[3])
+ uchar vecout_byte[3],
+ const uchar vecin_byte[3])
{
float vecin[3], vecout[3];
@@ -1368,7 +1368,7 @@ void BKE_histogram_update_sample_line(Histogram *hist,
{
int i, x, y;
const float *fp;
- unsigned char *cp;
+ uchar *cp;
int x1 = roundf(hist->co[0][0] * ibuf->x);
int x2 = roundf(hist->co[1][0] * ibuf->x);
@@ -1432,7 +1432,7 @@ void BKE_histogram_update_sample_line(Histogram *hist,
hist->data_a[i] = rgba[3];
}
else if (ibuf->rect) {
- cp = (unsigned char *)(ibuf->rect + y * ibuf->x + x);
+ cp = (uchar *)(ibuf->rect + y * ibuf->x + x);
hist->data_luma[i] = (float)IMB_colormanagement_get_luminance_byte(cp) / 255.0f;
hist->data_r[i] = (float)cp[0] / 255.0f;
hist->data_g[i] = (float)cp[1] / 255.0f;
@@ -1452,16 +1452,16 @@ typedef struct ScopesUpdateData {
Scopes *scopes;
const ImBuf *ibuf;
struct ColormanageProcessor *cm_processor;
- const unsigned char *display_buffer;
+ const uchar *display_buffer;
const int ycc_mode;
} ScopesUpdateData;
typedef struct ScopesUpdateDataChunk {
- unsigned int bin_lum[256];
- unsigned int bin_r[256];
- unsigned int bin_g[256];
- unsigned int bin_b[256];
- unsigned int bin_a[256];
+ uint bin_lum[256];
+ uint bin_r[256];
+ uint bin_g[256];
+ uint bin_b[256];
+ uint bin_a[256];
float min[3], max[3];
} ScopesUpdateDataChunk;
@@ -1474,20 +1474,20 @@ static void scopes_update_cb(void *__restrict userdata,
Scopes *scopes = data->scopes;
const ImBuf *ibuf = data->ibuf;
struct ColormanageProcessor *cm_processor = data->cm_processor;
- const unsigned char *display_buffer = data->display_buffer;
+ const uchar *display_buffer = data->display_buffer;
const int ycc_mode = data->ycc_mode;
ScopesUpdateDataChunk *data_chunk = tls->userdata_chunk;
- unsigned int *bin_lum = data_chunk->bin_lum;
- unsigned int *bin_r = data_chunk->bin_r;
- unsigned int *bin_g = data_chunk->bin_g;
- unsigned int *bin_b = data_chunk->bin_b;
- unsigned int *bin_a = data_chunk->bin_a;
+ uint *bin_lum = data_chunk->bin_lum;
+ uint *bin_r = data_chunk->bin_r;
+ uint *bin_g = data_chunk->bin_g;
+ uint *bin_b = data_chunk->bin_b;
+ uint *bin_a = data_chunk->bin_a;
float *min = data_chunk->min;
float *max = data_chunk->max;
const float *rf = NULL;
- const unsigned char *rc = NULL;
+ const uchar *rc = NULL;
const int rows_per_sample_line = ibuf->y / scopes->sample_lines;
const int savedlines = y / rows_per_sample_line;
const bool do_sample_line = (savedlines < scopes->sample_lines) &&
@@ -1571,16 +1571,16 @@ static void scopes_update_reduce(const void *__restrict UNUSED(userdata),
ScopesUpdateDataChunk *join_chunk = chunk_join;
const ScopesUpdateDataChunk *data_chunk = chunk;
- unsigned int *bin_lum = join_chunk->bin_lum;
- unsigned int *bin_r = join_chunk->bin_r;
- unsigned int *bin_g = join_chunk->bin_g;
- unsigned int *bin_b = join_chunk->bin_b;
- unsigned int *bin_a = join_chunk->bin_a;
- const unsigned int *bin_lum_c = data_chunk->bin_lum;
- const unsigned int *bin_r_c = data_chunk->bin_r;
- const unsigned int *bin_g_c = data_chunk->bin_g;
- const unsigned int *bin_b_c = data_chunk->bin_b;
- const unsigned int *bin_a_c = data_chunk->bin_a;
+ uint *bin_lum = join_chunk->bin_lum;
+ uint *bin_r = join_chunk->bin_r;
+ uint *bin_g = join_chunk->bin_g;
+ uint *bin_b = join_chunk->bin_b;
+ uint *bin_a = join_chunk->bin_a;
+ const uint *bin_lum_c = data_chunk->bin_lum;
+ const uint *bin_r_c = data_chunk->bin_r;
+ const uint *bin_g_c = data_chunk->bin_g;
+ const uint *bin_b_c = data_chunk->bin_b;
+ const uint *bin_a_c = data_chunk->bin_a;
const float *min = data_chunk->min;
const float *max = data_chunk->max;
@@ -1609,9 +1609,9 @@ void BKE_scopes_update(Scopes *scopes,
const ColorManagedDisplaySettings *display_settings)
{
int a;
- unsigned int nl, na, nr, ng, nb;
+ uint nl, na, nr, ng, nb;
double divl, diva, divr, divg, divb;
- const unsigned char *display_buffer = NULL;
+ const uchar *display_buffer = NULL;
int ycc_mode = -1;
void *cache_handle = NULL;
struct ColormanageProcessor *cm_processor = NULL;
@@ -1696,7 +1696,7 @@ void BKE_scopes_update(Scopes *scopes,
cm_processor = IMB_colormanagement_display_processor_new(view_settings, display_settings);
}
else {
- display_buffer = (const unsigned char *)IMB_display_buffer_acquire(
+ display_buffer = (const uchar *)IMB_display_buffer_acquire(
ibuf, view_settings, display_settings, &cache_handle);
}
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index cd381e15635..a6a6a1ca28f 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -2855,7 +2855,7 @@ static void actcon_get_tarmat(struct Depsgraph *depsgraph,
axis = data->type - 20;
}
- BLI_assert((unsigned int)axis < 3);
+ BLI_assert((uint)axis < 3);
/* Target defines the animation */
s = (vec[axis] - data->min) / (data->max - data->min);
diff --git a/source/blender/blenkernel/intern/cryptomatte.cc b/source/blender/blenkernel/intern/cryptomatte.cc
index 72204f6624e..e5f85f6aecf 100644
--- a/source/blender/blenkernel/intern/cryptomatte.cc
+++ b/source/blender/blenkernel/intern/cryptomatte.cc
@@ -311,7 +311,7 @@ static std::string cryptomatte_determine_name(const ViewLayer *view_layer,
static uint32_t cryptomatte_determine_identifier(const blender::StringRef name)
{
- return BLI_hash_mm3(reinterpret_cast<const unsigned char *>(name.data()), name.size(), 0);
+ return BLI_hash_mm3(reinterpret_cast<const uchar *>(name.data()), name.size(), 0);
}
static void add_render_result_meta_data(RenderResult *render_result,
diff --git a/source/blender/blenkernel/intern/curve.cc b/source/blender/blenkernel/intern/curve.cc
index ca390fae424..ddd1f000644 100644
--- a/source/blender/blenkernel/intern/curve.cc
+++ b/source/blender/blenkernel/intern/curve.cc
@@ -395,7 +395,7 @@ void BKE_curve_init(Curve *cu, const short curve_type)
cu->flag |= CU_FRONT | CU_BACK;
cu->vfont = cu->vfontb = cu->vfonti = cu->vfontbi = BKE_vfont_builtin_get();
cu->vfont->id.us += 4;
- cu->str = (char *)MEM_malloc_arrayN(12, sizeof(unsigned char), "str");
+ cu->str = (char *)MEM_malloc_arrayN(12, sizeof(uchar), "str");
BLI_strncpy(cu->str, "Text", 12);
cu->len = cu->len_char32 = cu->pos = 4;
cu->strinfo = (CharInfo *)MEM_calloc_arrayN(12, sizeof(CharInfo), "strinfo new");
@@ -1499,7 +1499,7 @@ void BKE_nurb_makeFaces(const Nurb *nu, float *coord_array, int rowstride, int r
}
u += ustep;
if (rowstride != 0) {
- in = (float *)(((unsigned char *)in) + (rowstride - 3 * totv * sizeof(*in)));
+ in = (float *)(((uchar *)in) + (rowstride - 3 * totv * sizeof(*in)));
}
}
@@ -1647,35 +1647,34 @@ void BKE_nurb_makeCurve(const Nurb *nu,
MEM_freeN(basisu);
}
-unsigned int BKE_curve_calc_coords_axis_len(const unsigned int bezt_array_len,
- const unsigned int resolu,
- const bool is_cyclic,
- const bool use_cyclic_duplicate_endpoint)
+uint BKE_curve_calc_coords_axis_len(const uint bezt_array_len,
+ const uint resolu,
+ const bool is_cyclic,
+ const bool use_cyclic_duplicate_endpoint)
{
- const unsigned int segments = bezt_array_len - (is_cyclic ? 0 : 1);
- const unsigned int points_len = (segments * resolu) +
- (is_cyclic ? (use_cyclic_duplicate_endpoint) : 1);
+ const uint segments = bezt_array_len - (is_cyclic ? 0 : 1);
+ const uint points_len = (segments * resolu) + (is_cyclic ? (use_cyclic_duplicate_endpoint) : 1);
return points_len;
}
void BKE_curve_calc_coords_axis(const BezTriple *bezt_array,
- const unsigned int bezt_array_len,
- const unsigned int resolu,
+ const uint bezt_array_len,
+ const uint resolu,
const bool is_cyclic,
const bool use_cyclic_duplicate_endpoint,
/* array params */
- const unsigned int axis,
- const unsigned int stride,
+ const uint axis,
+ const uint stride,
float *r_points)
{
- const unsigned int points_len = BKE_curve_calc_coords_axis_len(
+ const uint points_len = BKE_curve_calc_coords_axis_len(
bezt_array_len, resolu, is_cyclic, use_cyclic_duplicate_endpoint);
float *r_points_offset = r_points;
- const unsigned int resolu_stride = resolu * stride;
- const unsigned int bezt_array_last = bezt_array_len - 1;
+ const uint resolu_stride = resolu * stride;
+ const uint bezt_array_last = bezt_array_len - 1;
- for (unsigned int i = 0; i < bezt_array_last; i++) {
+ for (uint i = 0; i < bezt_array_last; i++) {
const BezTriple *bezt_curr = &bezt_array[i];
const BezTriple *bezt_next = &bezt_array[i + 1];
BKE_curve_forward_diff_bezier(bezt_curr->vec[1][axis],
@@ -1683,7 +1682,7 @@ void BKE_curve_calc_coords_axis(const BezTriple *bezt_array,
bezt_next->vec[0][axis],
bezt_next->vec[1][axis],
r_points_offset,
- (int)resolu,
+ int(resolu),
stride);
r_points_offset = (float *)POINTER_OFFSET(r_points_offset, resolu_stride);
}
@@ -1696,7 +1695,7 @@ void BKE_curve_calc_coords_axis(const BezTriple *bezt_array,
bezt_next->vec[0][axis],
bezt_next->vec[1][axis],
r_points_offset,
- (int)resolu,
+ int(resolu),
stride);
r_points_offset = (float *)POINTER_OFFSET(r_points_offset, resolu_stride);
if (use_cyclic_duplicate_endpoint) {
@@ -1720,7 +1719,7 @@ void BKE_curve_forward_diff_bezier(
float rt0, rt1, rt2, rt3, f;
int a;
- f = (float)it;
+ f = float(it);
rt0 = q0;
rt1 = 3.0f * (q1 - q0) / f;
f *= f;
@@ -1748,7 +1747,7 @@ void BKE_curve_forward_diff_tangent_bezier(
float rt0, rt1, rt2, f;
int a;
- f = 1.0f / (float)it;
+ f = 1.0f / float(it);
rt0 = 3.0f * (q1 - q0);
rt1 = f * (3.0f * (q3 - q0) + 9.0f * (q1 - q2));
@@ -1779,7 +1778,7 @@ static void forward_diff_bezier_cotangent(const float p0[3],
*
* This could also be optimized like BKE_curve_forward_diff_bezier */
for (int a = 0; a <= it; a++) {
- float t = (float)a / (float)it;
+ float t = float(a) / float(it);
for (int i = 0; i < 3; i++) {
p[i] = (-6.0f * t + 6.0f) * p0[i] + (18.0f * t - 12.0f) * p1[i] +
@@ -2006,7 +2005,7 @@ static void tilt_bezpart(const BezTriple *prevbezt,
}
fac = 0.0;
- dfac = 1.0f / (float)resolu;
+ dfac = 1.0f / float(resolu);
for (a = 0; a < resolu; a++, fac += dfac) {
if (tilt_array) {
@@ -2329,7 +2328,7 @@ static void make_bevel_list_3D_minimum_twist(BevList *bl)
nr = bl->nr;
while (nr--) {
- ang_fac = angle * (1.0f - ((float)nr / bl->nr)); /* also works */
+ ang_fac = angle * (1.0f - (float(nr) / bl->nr)); /* also works */
axis_angle_to_quat(q, bevp1->dir, ang_fac);
mul_qt_qtqt(bevp1->quat, q, bevp1->quat);
@@ -2516,7 +2515,7 @@ static void make_bevel_list_2D(BevList *bl)
/* first */
bevp = bl->bevpoints;
- angle = atan2f(bevp->dir[0], bevp->dir[1]) - (float)M_PI_2;
+ angle = atan2f(bevp->dir[0], bevp->dir[1]) - float(M_PI_2);
bevp->sina = sinf(angle);
bevp->cosa = cosf(angle);
vec_to_quat(bevp->quat, bevp->dir, 5, 1);
@@ -2524,7 +2523,7 @@ static void make_bevel_list_2D(BevList *bl)
/* last */
bevp = bl->bevpoints;
bevp += (bl->nr - 1);
- angle = atan2f(bevp->dir[0], bevp->dir[1]) - (float)M_PI_2;
+ angle = atan2f(bevp->dir[0], bevp->dir[1]) - float(M_PI_2);
bevp->sina = sinf(angle);
bevp->cosa = cosf(angle);
vec_to_quat(bevp->quat, bevp->dir, 5, 1);
@@ -5154,7 +5153,7 @@ bool BKE_curve_center_median(Curve *cu, float cent[3])
}
if (total) {
- mul_v3_fl(cent, 1.0f / (float)total);
+ mul_v3_fl(cent, 1.0f / float(total));
}
return (total != 0);
@@ -5390,10 +5389,10 @@ bool BKE_curve_material_index_validate(Curve *cu)
return false;
}
-void BKE_curve_material_remap(Curve *cu, const unsigned int *remap, unsigned int remap_len)
+void BKE_curve_material_remap(Curve *cu, const uint *remap, uint remap_len)
{
const int curvetype = BKE_curve_type_get(cu);
- const short remap_len_short = (short)remap_len;
+ const short remap_len_short = short(remap_len);
#define MAT_NR_REMAP(n) \
if (n < remap_len_short) { \
diff --git a/source/blender/blenkernel/intern/curve_bezier.cc b/source/blender/blenkernel/intern/curve_bezier.cc
index 59b09384698..3aa87be3787 100644
--- a/source/blender/blenkernel/intern/curve_bezier.cc
+++ b/source/blender/blenkernel/intern/curve_bezier.cc
@@ -210,7 +210,7 @@ void evaluate_segment(const float3 &point_0,
MutableSpan<float3> result)
{
BLI_assert(result.size() > 0);
- const float inv_len = 1.0f / static_cast<float>(result.size());
+ const float inv_len = 1.0f / float(result.size());
const float inv_len_squared = inv_len * inv_len;
const float inv_len_cubed = inv_len_squared * inv_len;
diff --git a/source/blender/blenkernel/intern/curveprofile.cc b/source/blender/blenkernel/intern/curveprofile.cc
index 2f3fc2e95d8..db0cf16d467 100644
--- a/source/blender/blenkernel/intern/curveprofile.cc
+++ b/source/blender/blenkernel/intern/curveprofile.cc
@@ -207,7 +207,7 @@ bool BKE_curveprofile_remove_point(CurveProfile *profile, CurveProfilePoint *poi
CurveProfilePoint *new_path = (CurveProfilePoint *)MEM_mallocN(
sizeof(CurveProfilePoint) * profile->path_len, __func__);
- int i_delete = (int)(point - profile->path);
+ int i_delete = int(point - profile->path);
BLI_assert(i_delete > 0);
/* Copy the before and after the deleted point. */
@@ -379,8 +379,8 @@ static void curveprofile_build_supports(CurveProfile *profile)
point_init(&profile->path[0], 1.0f, 0.0f, 0, HD_VECT, HD_VECT);
point_init(&profile->path[1], 1.0f, 0.5f, 0, HD_VECT, HD_VECT);
for (int i = 1; i < n - 2; i++) {
- const float x = 1.0f - (0.5f * (1.0f - cosf((float)((i / (float)(n - 3))) * M_PI_2)));
- const float y = 0.5f + 0.5f * sinf((float)((i / (float)(n - 3)) * M_PI_2));
+ const float x = 1.0f - (0.5f * (1.0f - cosf(float(i / float(n - 3)) * M_PI_2)));
+ const float y = 0.5f + 0.5f * sinf(float((i / float(n - 3)) * M_PI_2));
point_init(&profile->path[i], x, y, 0, HD_AUTO, HD_AUTO);
}
point_init(&profile->path[n - 2], 0.5f, 1.0f, 0, HD_VECT, HD_VECT);
@@ -408,8 +408,8 @@ static void curveprofile_build_steps(CurveProfile *profile)
for (int i = 0; i < n; i++) {
int step_x = (i + 1) / 2;
int step_y = i / 2;
- const float x = 1.0f - ((float)(2 * step_x) / n_steps_x);
- const float y = (float)(2 * step_y) / n_steps_y;
+ const float x = 1.0f - (float(2 * step_x) / n_steps_x);
+ const float y = float(2 * step_y) / n_steps_y;
point_init(&profile->path[i], x, y, 0, HD_VECT, HD_VECT);
}
}
@@ -1048,13 +1048,13 @@ void BKE_curveprofile_evaluate_length_portion(const CurveProfile *profile,
#ifdef DEBUG_CURVEPROFILE_EVALUATE
printf("CURVEPROFILE EVALUATE\n");
- printf(" length portion input: %f\n", (double)length_portion);
- printf(" requested path length: %f\n", (double)requested_length);
- printf(" distance to next point: %f\n", (double)distance_to_next_point);
- printf(" length travelled: %f\n", (double)length_travelled);
- printf(" lerp-factor: %f\n", (double)lerp_factor);
- printf(" ith point (%f, %f)\n", (double)profile->path[i].x, (double)profile->path[i].y);
- printf(" next point(%f, %f)\n", (double)profile->path[i + 1].x, (double)profile->path[i + 1].y);
+ printf(" length portion input: %f\n", double(length_portion));
+ printf(" requested path length: %f\n", double(requested_length));
+ printf(" distance to next point: %f\n", double(distance_to_next_point));
+ printf(" length travelled: %f\n", double(length_travelled));
+ printf(" lerp-factor: %f\n", double(lerp_factor));
+ printf(" ith point (%f, %f)\n", double(profile->path[i].x), double(profile->path[i].y));
+ printf(" next point(%f, %f)\n", double(profile->path[i + 1].x), double(profile->path[i + 1].y));
#endif
*x_out = interpf(profile->table[i].x, profile->table[i + 1].x, lerp_factor);
diff --git a/source/blender/blenkernel/intern/customdata.cc b/source/blender/blenkernel/intern/customdata.cc
index 51c3b405ebc..66b929d7c55 100644
--- a/source/blender/blenkernel/intern/customdata.cc
+++ b/source/blender/blenkernel/intern/customdata.cc
@@ -520,7 +520,7 @@ static void layerInterp_propInt(const void **sources,
const float src = *static_cast<const int *>(sources[i]);
result += src * weight;
}
- const int rounded_result = static_cast<int>(round(result));
+ const int rounded_result = int(round(result));
*static_cast<int *>(dest) = rounded_result;
}
@@ -646,7 +646,7 @@ static void layerCopy_mdisps(const void *source, void *dest, const int count)
for (int i = 0; i < count; i++) {
if (s[i].disps) {
d[i].disps = static_cast<float(*)[3]>(MEM_dupallocN(s[i].disps));
- d[i].hidden = static_cast<unsigned int *>(MEM_dupallocN(s[i].hidden));
+ d[i].hidden = static_cast<uint *>(MEM_dupallocN(s[i].hidden));
}
else {
d[i].disps = nullptr;
@@ -832,7 +832,7 @@ static void layerCopyValue_mloopcol(const void *source,
{
const MLoopCol *m1 = static_cast<const MLoopCol *>(source);
MLoopCol *m2 = static_cast<MLoopCol *>(dest);
- unsigned char tmp_col[4];
+ uchar tmp_col[4];
if (ELEM(mixmode,
CDT_MIX_NOMIX,
@@ -841,7 +841,7 @@ static void layerCopyValue_mloopcol(const void *source,
/* Modes that do a full copy or nothing. */
if (ELEM(mixmode, CDT_MIX_REPLACE_ABOVE_THRESHOLD, CDT_MIX_REPLACE_BELOW_THRESHOLD)) {
/* TODO: Check for a real valid way to get 'factor' value of our dest color? */
- const float f = ((float)m2->r + (float)m2->g + (float)m2->b) / 3.0f;
+ const float f = (float(m2->r) + float(m2->g) + float(m2->b)) / 3.0f;
if (mixmode == CDT_MIX_REPLACE_ABOVE_THRESHOLD && f < mixfactor) {
return; /* Do Nothing! */
}
@@ -855,8 +855,8 @@ static void layerCopyValue_mloopcol(const void *source,
m2->a = m1->a;
}
else { /* Modes that support 'real' mix factor. */
- unsigned char src[4] = {m1->r, m1->g, m1->b, m1->a};
- unsigned char dst[4] = {m2->r, m2->g, m2->b, m2->a};
+ uchar src[4] = {m1->r, m1->g, m1->b, m1->a};
+ uchar dst[4] = {m2->r, m2->g, m2->b, m2->a};
if (mixmode == CDT_MIX_MIX) {
blend_color_mix_byte(tmp_col, dst, src);
@@ -876,10 +876,10 @@ static void layerCopyValue_mloopcol(const void *source,
blend_color_interpolate_byte(dst, dst, tmp_col, mixfactor);
- m2->r = (char)dst[0];
- m2->g = (char)dst[1];
- m2->b = (char)dst[2];
- m2->a = (char)dst[3];
+ m2->r = char(dst[0]);
+ m2->g = char(dst[1]);
+ m2->b = char(dst[2]);
+ m2->a = char(dst[3]);
}
}
@@ -901,10 +901,10 @@ static void layerMultiply_mloopcol(void *data, const float fac)
{
MLoopCol *m = static_cast<MLoopCol *>(data);
- m->r = (float)m->r * fac;
- m->g = (float)m->g * fac;
- m->b = (float)m->b * fac;
- m->a = (float)m->a * fac;
+ m->r = float(m->r) * fac;
+ m->g = float(m->g) * fac;
+ m->b = float(m->b) * fac;
+ m->a = float(m->a) * fac;
}
static void layerAdd_mloopcol(void *data1, const void *data2)
@@ -1869,7 +1869,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
/* 29: CD_BWEIGHT */
{sizeof(MFloatProperty), "MFloatProperty", 1, nullptr, nullptr, nullptr, layerInterp_bweight},
/* 30: CD_CREASE */
- {sizeof(float), "", 0, N_("SubSurfCrease"), nullptr, nullptr, layerInterp_propFloat},
+ {sizeof(float), "", 0, nullptr, nullptr, nullptr, layerInterp_propFloat},
/* 31: CD_ORIGSPACE_MLOOP */
{sizeof(OrigSpaceLoop),
"OrigSpaceLoop",
@@ -3119,7 +3119,7 @@ static void *customData_duplicate_referenced_layer_index(CustomData *data,
if (typeInfo->copy) {
void *dst_data = MEM_malloc_arrayN(
- (size_t)totelem, typeInfo->size, "CD duplicate ref layer");
+ size_t(totelem), typeInfo->size, "CD duplicate ref layer");
typeInfo->copy(layer->data, dst_data, totelem);
layer->data = dst_data;
}
@@ -3250,7 +3250,7 @@ void CustomData_copy_elements(const int type,
typeInfo->copy(src_data_ofs, dst_data_ofs, count);
}
else {
- memcpy(dst_data_ofs, src_data_ofs, (size_t)count * typeInfo->size);
+ memcpy(dst_data_ofs, src_data_ofs, size_t(count) * typeInfo->size);
}
}
@@ -3269,8 +3269,8 @@ void CustomData_copy_data_layer(const CustomData *source,
typeInfo = layerType_getInfo(source->layers[src_layer_index].type);
- const size_t src_offset = (size_t)src_index * typeInfo->size;
- const size_t dst_offset = (size_t)dst_index * typeInfo->size;
+ const size_t src_offset = size_t(src_index) * typeInfo->size;
+ const size_t dst_offset = size_t(dst_index) * typeInfo->size;
if (!count || !src_data || !dst_data) {
if (count && !(src_data == nullptr && dst_data == nullptr)) {
@@ -3290,7 +3290,7 @@ void CustomData_copy_data_layer(const CustomData *source,
else {
memcpy(POINTER_OFFSET(dst_data, dst_offset),
POINTER_OFFSET(src_data, src_offset),
- (size_t)count * typeInfo->size);
+ size_t(count) * typeInfo->size);
}
}
@@ -3379,7 +3379,7 @@ void CustomData_free_elem(CustomData *data, const int index, const int count)
const LayerTypeInfo *typeInfo = layerType_getInfo(data->layers[i].type);
if (typeInfo->free) {
- size_t offset = (size_t)index * typeInfo->size;
+ size_t offset = size_t(index) * typeInfo->size;
typeInfo->free(POINTER_OFFSET(data->layers[i].data, offset), count, typeInfo->size);
}
@@ -3415,7 +3415,7 @@ void CustomData_interp(const CustomData *source,
if (weights == nullptr) {
default_weights = (count > SOURCE_BUF_SIZE) ?
static_cast<float *>(
- MEM_mallocN(sizeof(*weights) * (size_t)count, __func__)) :
+ MEM_mallocN(sizeof(*weights) * size_t(count), __func__)) :
default_weights_buf;
copy_vn_fl(default_weights, count, 1.0f / count);
weights = default_weights;
@@ -3446,7 +3446,7 @@ void CustomData_interp(const CustomData *source,
void *src_data = source->layers[src_i].data;
for (int j = 0; j < count; j++) {
- sources[j] = POINTER_OFFSET(src_data, (size_t)src_indices[j] * typeInfo->size);
+ sources[j] = POINTER_OFFSET(src_data, size_t(src_indices[j]) * typeInfo->size);
}
typeInfo->interp(
@@ -3454,7 +3454,7 @@ void CustomData_interp(const CustomData *source,
weights,
sub_weights,
count,
- POINTER_OFFSET(dest->layers[dest_i].data, (size_t)dest_index * typeInfo->size));
+ POINTER_OFFSET(dest->layers[dest_i].data, size_t(dest_index) * typeInfo->size));
/* if there are multiple source & dest layers of the same type,
* we don't want to copy all source layers to the same dest, so
@@ -3478,7 +3478,7 @@ void CustomData_swap_corners(CustomData *data, const int index, const int *corne
const LayerTypeInfo *typeInfo = layerType_getInfo(data->layers[i].type);
if (typeInfo->swap) {
- const size_t offset = (size_t)index * typeInfo->size;
+ const size_t offset = size_t(index) * typeInfo->size;
typeInfo->swap(POINTER_OFFSET(data->layers[i].data, offset), corner_indices);
}
@@ -3523,7 +3523,7 @@ void *CustomData_get(const CustomData *data, const int index, const int type)
}
/* get the offset of the desired element */
- const size_t offset = (size_t)index * layerType_getInfo(type)->size;
+ const size_t offset = size_t(index) * layerType_getInfo(type)->size;
return POINTER_OFFSET(data->layers[layer_index].data, offset);
}
@@ -3538,7 +3538,7 @@ void *CustomData_get_n(const CustomData *data, const int type, const int index,
return nullptr;
}
- const size_t offset = (size_t)index * layerType_getInfo(type)->size;
+ const size_t offset = size_t(index) * layerType_getInfo(type)->size;
return POINTER_OFFSET(data->layers[layer_index + n].data, offset);
}
@@ -4278,7 +4278,7 @@ void CustomData_bmesh_interp(CustomData *data,
float *default_weights = nullptr;
if (weights == nullptr) {
default_weights = (count > SOURCE_BUF_SIZE) ?
- (float *)MEM_mallocN(sizeof(*weights) * (size_t)count, __func__) :
+ (float *)MEM_mallocN(sizeof(*weights) * size_t(count), __func__) :
default_weights_buf;
copy_vn_fl(default_weights, count, 1.0f / count);
weights = default_weights;
@@ -4341,7 +4341,7 @@ void CustomData_to_bmesh_block(const CustomData *source,
void *dest_data = POINTER_OFFSET(*dest_block, offset);
const LayerTypeInfo *typeInfo = layerType_getInfo(dest->layers[dest_i].type);
- const size_t src_offset = (size_t)src_index * typeInfo->size;
+ const size_t src_offset = size_t(src_index) * typeInfo->size;
if (typeInfo->copy) {
typeInfo->copy(POINTER_OFFSET(src_data, src_offset), dest_data, 1);
@@ -4393,7 +4393,7 @@ void CustomData_from_bmesh_block(const CustomData *source,
int offset = source->layers[src_i].offset;
const void *src_data = POINTER_OFFSET(src_block, offset);
void *dst_data = POINTER_OFFSET(dest->layers[dest_i].data,
- (size_t)dest_index * typeInfo->size);
+ size_t(dest_index) * typeInfo->size);
if (typeInfo->copy) {
typeInfo->copy(src_data, dst_data, 1);
@@ -4998,13 +4998,13 @@ static bool check_bit_flag(const void *data, const size_t data_size, const uint6
{
switch (data_size) {
case 1:
- return ((*((uint8_t *)data) & ((uint8_t)flag)) != 0);
+ return ((*((uint8_t *)data) & uint8_t(flag)) != 0);
case 2:
- return ((*((uint16_t *)data) & ((uint16_t)flag)) != 0);
+ return ((*((uint16_t *)data) & uint16_t(flag)) != 0);
case 4:
- return ((*((uint32_t *)data) & ((uint32_t)flag)) != 0);
+ return ((*((uint32_t *)data) & uint32_t(flag)) != 0);
case 8:
- return ((*((uint64_t *)data) & ((uint64_t)flag)) != 0);
+ return ((*((uint64_t *)data) & uint64_t(flag)) != 0);
default:
// CLOG_ERROR(&LOG, "Unknown flags-container size (%zu)", datasize);
return false;
@@ -5047,7 +5047,7 @@ static void customdata_data_transfer_interp_generic(const CustomDataTransferLaye
else {
const LayerTypeInfo *type_info = layerType_getInfo(data_type);
- data_size = (size_t)type_info->size;
+ data_size = size_t(type_info->size);
interp_cd = type_info->interp;
copy_cd = type_info->copy;
}
@@ -5200,7 +5200,7 @@ void CustomData_data_transfer(const MeshPairRemap *me_remap,
const LayerTypeInfo *type_info = layerType_getInfo(data_type);
/* NOTE: we can use 'fake' CDLayers for crease :/. */
- data_size = (size_t)type_info->size;
+ data_size = size_t(type_info->size);
data_step = laymap->elem_size ? laymap->elem_size : data_size;
data_offset = laymap->data_offset;
}
@@ -5219,13 +5219,13 @@ void CustomData_data_transfer(const MeshPairRemap *me_remap,
if (tmp_data_src) {
if (UNLIKELY(sources_num > tmp_buff_size)) {
- tmp_buff_size = (size_t)sources_num;
+ tmp_buff_size = size_t(sources_num);
tmp_data_src = (const void **)MEM_reallocN((void *)tmp_data_src,
sizeof(*tmp_data_src) * tmp_buff_size);
}
for (int j = 0; j < sources_num; j++) {
- const size_t src_idx = (size_t)mapit->indices_src[j];
+ const size_t src_idx = size_t(mapit->indices_src[j]);
tmp_data_src[j] = POINTER_OFFSET(data_src, (data_step * src_idx) + data_offset);
}
}
diff --git a/source/blender/blenkernel/intern/customdata_file.c b/source/blender/blenkernel/intern/customdata_file.c
index cbfaf2831d1..85e88996c0a 100644
--- a/source/blender/blenkernel/intern/customdata_file.c
+++ b/source/blender/blenkernel/intern/customdata_file.c
@@ -310,7 +310,7 @@ bool cdf_read_layer(CDataFile *cdf, CDataFileLayer *blay)
return (BLI_fseek(cdf->readf, offset, SEEK_SET) == 0);
}
-bool cdf_read_data(CDataFile *cdf, unsigned int size, void *data)
+bool cdf_read_data(CDataFile *cdf, uint size, void *data)
{
/* read data */
if (!fread(data, size, 1, cdf->readf)) {
@@ -384,7 +384,7 @@ bool cdf_write_layer(CDataFile *UNUSED(cdf), CDataFileLayer *UNUSED(blay))
return true;
}
-bool cdf_write_data(CDataFile *cdf, unsigned int size, void *data)
+bool cdf_write_data(CDataFile *cdf, uint size, void *data)
{
/* write data */
if (!fwrite(data, size, 1, cdf->writef)) {
diff --git a/source/blender/blenkernel/intern/data_transfer.c b/source/blender/blenkernel/intern/data_transfer.c
index 36f038e68ab..e6afca11b40 100644
--- a/source/blender/blenkernel/intern/data_transfer.c
+++ b/source/blender/blenkernel/intern/data_transfer.c
@@ -374,8 +374,8 @@ float data_transfer_interp_float_do(const int mix_mode,
{
float val_ret;
- if (((mix_mode == CDT_MIX_REPLACE_ABOVE_THRESHOLD && (val_dst < mix_factor)) ||
- (mix_mode == CDT_MIX_REPLACE_BELOW_THRESHOLD && (val_dst > mix_factor)))) {
+ if ((mix_mode == CDT_MIX_REPLACE_ABOVE_THRESHOLD && (val_dst < mix_factor)) ||
+ (mix_mode == CDT_MIX_REPLACE_BELOW_THRESHOLD && (val_dst > mix_factor))) {
return val_dst; /* Do not affect destination. */
}
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c
index 7940d65b1bb..b5c3147b0f1 100644
--- a/source/blender/blenkernel/intern/deform.c
+++ b/source/blender/blenkernel/intern/deform.c
@@ -271,7 +271,7 @@ void BKE_defvert_normalize(MDeformVert *dvert)
}
else {
MDeformWeight *dw;
- unsigned int i;
+ uint i;
float tot_weight = 0.0f;
for (i = dvert->totweight, dw = dvert->dw; i != 0; i--, dw++) {
@@ -309,7 +309,7 @@ void BKE_defvert_normalize_lock_single(MDeformVert *dvert,
else {
MDeformWeight *dw_lock = NULL;
MDeformWeight *dw;
- unsigned int i;
+ uint i;
float tot_weight = 0.0f;
float lock_iweight = 1.0f;
@@ -363,7 +363,7 @@ void BKE_defvert_normalize_lock_map(MDeformVert *dvert,
}
else {
MDeformWeight *dw;
- unsigned int i;
+ uint i;
float tot_weight = 0.0f;
float lock_iweight = 0.0f;
@@ -752,7 +752,7 @@ MDeformWeight *BKE_defvert_find_index(const MDeformVert *dvert, const int defgro
{
if (dvert && defgroup >= 0) {
MDeformWeight *dw = dvert->dw;
- unsigned int i;
+ uint i;
for (i = dvert->totweight; i != 0; i--, dw++) {
if (dw->def_nr == defgroup) {
@@ -865,7 +865,7 @@ int BKE_defvert_find_shared(const MDeformVert *dvert_a, const MDeformVert *dvert
{
if (dvert_a->totweight && dvert_b->totweight) {
MDeformWeight *dw = dvert_a->dw;
- unsigned int i;
+ uint i;
for (i = dvert_a->totweight; i != 0; i--, dw++) {
if (dw->weight > 0.0f && BKE_defvert_find_weight(dvert_b, dw->def_nr) > 0.0f) {
diff --git a/source/blender/blenkernel/intern/displist.cc b/source/blender/blenkernel/intern/displist.cc
index 279166297ec..2b4bd3eb8f6 100644
--- a/source/blender/blenkernel/intern/displist.cc
+++ b/source/blender/blenkernel/intern/displist.cc
@@ -503,7 +503,7 @@ static float displist_calc_taper(Depsgraph *depsgraph,
float BKE_displist_calc_taper(
Depsgraph *depsgraph, const Scene *scene, Object *taperobj, int cur, int tot)
{
- const float fac = ((float)cur) / (float)(tot - 1);
+ const float fac = float(cur) / float(tot - 1);
return displist_calc_taper(depsgraph, scene, taperobj, fac);
}
@@ -518,7 +518,7 @@ static ModifierData *curve_get_tessellate_point(const Scene *scene,
ModifierMode required_mode = for_render ? eModifierMode_Render : eModifierMode_Realtime;
if (editmode) {
- required_mode = (ModifierMode)((int)required_mode | eModifierMode_Editmode);
+ required_mode = (ModifierMode)(int(required_mode) | eModifierMode_Editmode);
}
ModifierData *pretessellatePoint = nullptr;
@@ -562,7 +562,7 @@ void BKE_curve_calc_modifiers_pre(Depsgraph *depsgraph,
const bool editmode = (!for_render && (cu->editnurb || cu->editfont));
ModifierMode required_mode = for_render ? eModifierMode_Render : eModifierMode_Realtime;
if (editmode) {
- required_mode = (ModifierMode)((int)required_mode | eModifierMode_Editmode);
+ required_mode = (ModifierMode)(int(required_mode) | eModifierMode_Editmode);
}
ModifierApplyFlag apply_flag = (ModifierApplyFlag)0;
@@ -689,7 +689,7 @@ static GeometrySet curve_calc_modifiers_post(Depsgraph *depsgraph,
ModifierApplyFlag apply_flag = for_render ? MOD_APPLY_RENDER : (ModifierApplyFlag)0;
ModifierMode required_mode = for_render ? eModifierMode_Render : eModifierMode_Realtime;
if (editmode) {
- required_mode = (ModifierMode)((int)required_mode | eModifierMode_Editmode);
+ required_mode = (ModifierMode)(int(required_mode) | eModifierMode_Editmode);
}
const ModifierEvalContext mectx_deform = {
@@ -970,13 +970,13 @@ static void calc_bevfac_segment_mapping(
int bevcount = 0, nr = bl->nr;
float bev_fl = bevfac * (bl->nr - 1);
- *r_bev = (int)bev_fl;
+ *r_bev = int(bev_fl);
while (bevcount < nr - 1) {
float normlen = *seglen / spline_length;
if (normsum + normlen > bevfac) {
bev_fl = bevcount + (bevfac - normsum) / normlen * *segbevcount;
- *r_bev = (int)bev_fl;
+ *r_bev = int(bev_fl);
*r_blend = bev_fl - *r_bev;
break;
}
@@ -1046,7 +1046,7 @@ static void calc_bevfac_mapping(const Curve *cu,
switch (cu->bevfac1_mapping) {
case CU_BEVFAC_MAP_RESOLU: {
const float start_fl = cu->bevfac1 * (bl->nr - 1);
- *r_start = (int)start_fl;
+ *r_start = int(start_fl);
*r_firstblend = 1.0f - (start_fl - (*r_start));
break;
}
@@ -1065,7 +1065,7 @@ static void calc_bevfac_mapping(const Curve *cu,
switch (cu->bevfac2_mapping) {
case CU_BEVFAC_MAP_RESOLU: {
const float end_fl = cu->bevfac2 * (bl->nr - 1);
- end = (int)end_fl;
+ end = int(end_fl);
*r_steps = 2 + end - *r_start;
*r_lastblend = end_fl - end;
@@ -1238,12 +1238,12 @@ static GeometrySet evaluate_curve_type_object(Depsgraph *depsgraph,
taper_factor = 1.0f;
}
else {
- taper_factor = ((float)a - (1.0f - first_blend)) / len;
+ taper_factor = (float(a) - (1.0f - first_blend)) / len;
}
}
else {
float len = bl->nr - 1;
- taper_factor = (float)i / len;
+ taper_factor = float(i) / len;
if (a == 0) {
taper_factor += (1.0f - first_blend) / len;
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index 9d46c381d7a..03358f50d40 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -212,13 +212,13 @@ typedef struct PaintBakeData {
typedef struct PaintUVPoint {
/* Pixel / mesh data */
/** tri index on domain derived mesh */
- unsigned int tri_index;
- unsigned int pixel_index;
+ uint tri_index;
+ uint pixel_index;
/* vertex indexes */
- unsigned int v1, v2, v3;
+ uint v1, v2, v3;
/** If this pixel isn't uv mapped to any face, but its neighboring pixel is. */
- unsigned int neighbor_pixel;
+ uint neighbor_pixel;
} PaintUVPoint;
typedef struct ImgSeqFormatData {
@@ -514,7 +514,7 @@ static void scene_setSubframe(Scene *scene, float subframe)
static int surface_getBrushFlags(DynamicPaintSurface *surface, Depsgraph *depsgraph)
{
- unsigned int numobjects;
+ uint numobjects;
Object **objects = BKE_collision_objects_create(
depsgraph, NULL, surface->brush_group, &numobjects, eModifierType_DynamicPaint);
@@ -1496,7 +1496,7 @@ static void dynamic_paint_set_init_color_tex_to_vcol_cb(
for (int j = 3; j--;) {
TexResult texres = {0};
- const unsigned int vert = mloop[mlooptri[i].tri[j]].v;
+ const uint vert = mloop[mlooptri[i].tri[j]].v;
/* remap to [-1.0, 1.0] */
uv[0] = mloopuv[mlooptri[i].tri[j]].uv[0] * 2.0f - 1.0f;
@@ -1569,7 +1569,7 @@ static void dynamic_paint_set_init_color_vcol_to_imseq_cb(
/* collect color values */
for (int j = 3; j--;) {
- rgba_uchar_to_float(colors[j], (const unsigned char *)&mloopcol[mlooptri[tri_idx].tri[j]].r);
+ rgba_uchar_to_float(colors[j], (const uchar *)&mloopcol[mlooptri[tri_idx].tri[j]].r);
}
/* interpolate final color */
@@ -1669,7 +1669,7 @@ static void dynamicPaint_setInitialColor(const Scene *scene, DynamicPaintSurface
}
for (int i = 0; i < totloop; i++) {
- rgba_uchar_to_float(pPoint[mloop[i].v].color, (const unsigned char *)&col[i].r);
+ rgba_uchar_to_float(pPoint[mloop[i].v].color, (const uchar *)&col[i].r);
}
}
else if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ) {
@@ -1698,7 +1698,7 @@ void dynamicPaint_clearSurface(const Scene *scene, DynamicPaintSurface *surface)
{
PaintSurfaceData *sData = surface->data;
if (sData && sData->type_data) {
- unsigned int data_size;
+ uint data_size;
if (surface->type == MOD_DPAINT_SURFACE_T_PAINT) {
data_size = sizeof(PaintPoint);
@@ -1762,7 +1762,7 @@ bool dynamicPaint_resetSurface(const Scene *scene, DynamicPaintSurface *surface)
static bool dynamicPaint_checkSurfaceData(const Scene *scene, DynamicPaintSurface *surface)
{
if (!surface->data ||
- ((dynamicPaint_surfaceNumOfPoints(surface) != surface->data->total_points))) {
+ (dynamicPaint_surfaceNumOfPoints(surface) != surface->data->total_points)) {
return dynamicPaint_resetSurface(scene, surface);
}
return true;
@@ -1862,7 +1862,7 @@ static void dynamic_paint_apply_surface_vpaint_cb(void *__restrict userdata,
/* save layer data to output layer */
/* apply color */
if (mloopcol) {
- rgba_float_to_uchar((unsigned char *)&mloopcol[l_index].r, fcolor[v_index]);
+ rgba_float_to_uchar((uchar *)&mloopcol[l_index].r, fcolor[v_index]);
}
/* apply wetness */
if (mloopcol_wet) {
@@ -2512,7 +2512,7 @@ static void dynamic_paint_find_island_border(const DynamicPaintCreateUVSurfaceDa
const MLoopTri *mlooptri = data->mlooptri;
const MLoopUV *mloopuv = data->mloopuv;
- const unsigned int *loop_idx = mlooptri[tri_index].tri;
+ const uint *loop_idx = mlooptri[tri_index].tri;
/* Enumerate all edges of the triangle, rotating the vertex list accordingly. */
for (int edge_idx = 0; edge_idx < 3; edge_idx++) {
@@ -2566,7 +2566,7 @@ static void dynamic_paint_find_island_border(const DynamicPaintCreateUVSurfaceDa
continue;
}
- const unsigned int *other_loop_idx = mlooptri[lt_index].tri;
+ const uint *other_loop_idx = mlooptri[lt_index].tri;
/* Check edges for match, looping in the same order as the outer loop. */
for (int j = 0; j < 3; j++) {
@@ -5339,12 +5339,12 @@ static void dynamic_paint_effect_drip_cb(void *__restrict userdata,
float dir_factor, a_factor;
const float speed_scale = eff_scale * force[index * 4 + 3] / bNeighs[n_idx].dist;
- const unsigned int n_trgt = (unsigned int)n_target[n_idx];
+ const uint n_trgt = (uint)n_target[n_idx];
/* Sort of spinlock, but only for given ePoint.
* Since the odds a same ePoint is modified at the same time by several threads is very low,
* this is much more efficient than a global spin lock. */
- const unsigned int epointlock_idx = n_trgt / 8;
+ const uint epointlock_idx = n_trgt / 8;
const uint8_t epointlock_bitmask = 1 << (n_trgt & 7); /* 7 == 0b111 */
while (atomic_fetch_and_or_uint8(&point_locks[epointlock_idx], epointlock_bitmask) &
epointlock_bitmask) {
@@ -5391,7 +5391,7 @@ static void dynamic_paint_effect_drip_cb(void *__restrict userdata,
}
{
- const unsigned int ppointlock_idx = index / 8;
+ const uint ppointlock_idx = index / 8;
const uint8_t ppointlock_bitmask = 1 << (index & 7); /* 7 == 0b111 */
while (atomic_fetch_and_or_uint8(&point_locks[ppointlock_idx], ppointlock_bitmask) &
ppointlock_bitmask) {
@@ -6063,10 +6063,8 @@ static bool dynamicPaint_generateBakeData(DynamicPaintSurface *surface,
/* Init bdata */
bData->bNormal = (struct PaintBakeNormal *)MEM_mallocN(
sData->total_points * sizeof(struct PaintBakeNormal), "Dynamic Paint step data");
- bData->s_pos = MEM_mallocN(sData->total_points * sizeof(unsigned int),
- "Dynamic Paint bData s_pos");
- bData->s_num = MEM_mallocN(sData->total_points * sizeof(unsigned int),
- "Dynamic Paint bData s_num");
+ bData->s_pos = MEM_mallocN(sData->total_points * sizeof(uint), "Dynamic Paint bData s_pos");
+ bData->s_num = MEM_mallocN(sData->total_points * sizeof(uint), "Dynamic Paint bData s_num");
bData->realCoord = (struct Vec3f *)MEM_mallocN(surface_totalSamples(surface) * sizeof(Vec3f),
"Dynamic Paint point coords");
bData->prev_verts = MEM_mallocN(canvasNumOfVerts * sizeof(MVert),
@@ -6189,7 +6187,7 @@ static int dynamicPaint_doStep(Depsgraph *depsgraph,
* Loop through surface's target paint objects and do painting
*/
{
- unsigned int numobjects;
+ uint numobjects;
Object **objects = BKE_collision_objects_create(
depsgraph, NULL, surface->brush_group, &numobjects, eModifierType_DynamicPaint);
diff --git a/source/blender/blenkernel/intern/editmesh_bvh.c b/source/blender/blenkernel/intern/editmesh_bvh.c
index edf3539681c..5e58a049135 100644
--- a/source/blender/blenkernel/intern/editmesh_bvh.c
+++ b/source/blender/blenkernel/intern/editmesh_bvh.c
@@ -551,7 +551,7 @@ static bool bmbvh_overlap_cb(void *userdata, int index_a, int index_b, int UNUSE
BVHTreeOverlap *BKE_bmbvh_overlap(const BMBVHTree *bmtree_a,
const BMBVHTree *bmtree_b,
- unsigned int *r_overlap_tot)
+ uint *r_overlap_tot)
{
struct BMBVHTree_OverlapData data;
@@ -572,7 +572,7 @@ static bool bmbvh_overlap_self_cb(void *userdata, int index_a, int index_b, int
return false;
}
-BVHTreeOverlap *BKE_bmbvh_overlap_self(const BMBVHTree *bmtree, unsigned int *r_overlap_tot)
+BVHTreeOverlap *BKE_bmbvh_overlap_self(const BMBVHTree *bmtree, uint *r_overlap_tot)
{
struct BMBVHTree_OverlapData data;
diff --git a/source/blender/blenkernel/intern/editmesh_tangent.cc b/source/blender/blenkernel/intern/editmesh_tangent.cc
index a65532d083d..6ce9d3c7bb5 100644
--- a/source/blender/blenkernel/intern/editmesh_tangent.cc
+++ b/source/blender/blenkernel/intern/editmesh_tangent.cc
@@ -33,9 +33,9 @@ struct SGLSLEditMeshToTangent {
uint GetNumFaces()
{
#ifdef USE_LOOPTRI_DETECT_QUADS
- return (uint)num_face_as_quad_map;
+ return uint(num_face_as_quad_map);
#else
- return (uint)numTessFaces;
+ return uint(numTessFaces);
#endif
}
@@ -194,21 +194,21 @@ void BKE_editmesh_loop_tangent_calc(BMEditMesh *em,
for (int i = 0; i < tangent_names_len; i++) {
if (tangent_names[i][0]) {
BKE_mesh_add_loop_tangent_named_layer_for_uv(
- &bm->ldata, loopdata_out, (int)loopdata_out_len, tangent_names[i]);
+ &bm->ldata, loopdata_out, int(loopdata_out_len), tangent_names[i]);
}
}
if ((tangent_mask & DM_TANGENT_MASK_ORCO) &&
CustomData_get_named_layer_index(loopdata_out, CD_TANGENT, "") == -1) {
CustomData_add_layer_named(
- loopdata_out, CD_TANGENT, CD_SET_DEFAULT, nullptr, (int)loopdata_out_len, "");
+ loopdata_out, CD_TANGENT, CD_SET_DEFAULT, nullptr, int(loopdata_out_len), "");
}
if (calc_act && act_uv_name[0]) {
BKE_mesh_add_loop_tangent_named_layer_for_uv(
- &bm->ldata, loopdata_out, (int)loopdata_out_len, act_uv_name);
+ &bm->ldata, loopdata_out, int(loopdata_out_len), act_uv_name);
}
if (calc_ren && ren_uv_name[0]) {
BKE_mesh_add_loop_tangent_named_layer_for_uv(
- &bm->ldata, loopdata_out, (int)loopdata_out_len, ren_uv_name);
+ &bm->ldata, loopdata_out, int(loopdata_out_len), ren_uv_name);
}
int totface = em->tottri;
#ifdef USE_LOOPTRI_DETECT_QUADS
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index f5876e48241..4b91efff08d 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -1308,7 +1308,7 @@ void BKE_fcurve_handles_recalc(FCurve *fcu)
void testhandles_fcurve(FCurve *fcu, eBezTriple_Flag sel_flag, const bool use_handle)
{
BezTriple *bezt;
- unsigned int a;
+ uint a;
/* Only beztriples have handles (bpoints don't though). */
if (ELEM(NULL, fcu, fcu->bezt)) {
@@ -1368,7 +1368,7 @@ void sort_time_fcurve(FCurve *fcu)
bool test_time_fcurve(FCurve *fcu)
{
- unsigned int a;
+ uint a;
/* Sanity checks. */
if (fcu == NULL) {
@@ -1778,7 +1778,7 @@ static float fcurve_eval_keyframes_interpolate(FCurve *fcu, BezTriple *bezts, fl
{
const float eps = 1.e-8f;
BezTriple *bezt, *prevbezt;
- unsigned int a;
+ uint a;
/* Evaltime occurs somewhere in the middle of the curve. */
bool exact = false;
diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c
index 11c3dfc18dc..551bab75d4b 100644
--- a/source/blender/blenkernel/intern/fmodifier.c
+++ b/source/blender/blenkernel/intern/fmodifier.c
@@ -203,7 +203,7 @@ static void fcm_generator_evaluate(
case FCM_GENERATOR_POLYNOMIAL_FACTORISED: /* Factorized polynomial */
{
float value = 1.0f, *cp = NULL;
- unsigned int i;
+ uint i;
/* For each coefficient pair,
* solve for that bracket before accumulating in value by multiplying. */
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index f6082d886d9..bfffd44e73d 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1953,9 +1953,7 @@ bool BKE_gpencil_material_index_used(bGPdata *gpd, int index)
return false;
}
-void BKE_gpencil_material_remap(struct bGPdata *gpd,
- const unsigned int *remap,
- unsigned int remap_len)
+void BKE_gpencil_material_remap(struct bGPdata *gpd, const uint *remap, uint remap_len)
{
const short remap_len_short = (short)remap_len;
@@ -2787,11 +2785,14 @@ void BKE_gpencil_update_layer_transforms(const Depsgraph *depsgraph, Object *ob)
changed = !equals_m4m4(gpl->inverse, cur_mat);
}
- /* Calc local layer transform. */
+ /* Calc local layer transform. Early out if we have non-animated zero transforms. */
bool transformed = ((!is_zero_v3(gpl->location)) || (!is_zero_v3(gpl->rotation)) ||
(!is_one_v3(gpl->scale)));
+ float tmp_mat[4][4];
+ loc_eul_size_to_mat4(tmp_mat, gpl->location, gpl->rotation, gpl->scale);
+ transformed |= !equals_m4m4(gpl->layer_mat, tmp_mat);
if (transformed) {
- loc_eul_size_to_mat4(gpl->layer_mat, gpl->location, gpl->rotation, gpl->scale);
+ copy_m4_m4(gpl->layer_mat, tmp_mat);
}
/* Continue if no transformations are applied to this layer. */
diff --git a/source/blender/blenkernel/intern/gpencil_curve.c b/source/blender/blenkernel/intern/gpencil_curve.c
index bf224a9613e..a0a579e6d65 100644
--- a/source/blender/blenkernel/intern/gpencil_curve.c
+++ b/source/blender/blenkernel/intern/gpencil_curve.c
@@ -645,10 +645,10 @@ bGPDcurve *BKE_gpencil_stroke_editcurve_generate(bGPDstroke *gps,
}
float *r_cubic_array = NULL;
- unsigned int r_cubic_array_len = 0;
- unsigned int *r_cubic_orig_index = NULL;
- unsigned int *r_corners_index_array = NULL;
- unsigned int r_corners_index_len = 0;
+ uint r_cubic_array_len = 0;
+ uint *r_cubic_orig_index = NULL;
+ uint *r_corners_index_array = NULL;
+ uint r_corners_index_len = 0;
int r = curve_fit_cubic_to_points_refit_fl(points,
gps->totpoints,
POINT_DIM,
@@ -992,7 +992,7 @@ static float *gpencil_stroke_points_from_editcurve_fixed_resolu(bGPDcurve_point
float(*r_points)[9] = MEM_callocN((stride * points_len * (is_cyclic ? 2 : 1)), __func__);
float *points_offset = &r_points[0][0];
- for (unsigned int i = 0; i < array_last; i++) {
+ for (uint i = 0; i < array_last; i++) {
bGPDcurve_point *cpt_curr = &curve_point_array[i];
bGPDcurve_point *cpt_next = &curve_point_array[i + 1];
diff --git a/source/blender/blenkernel/intern/gpencil_geom.cc b/source/blender/blenkernel/intern/gpencil_geom.cc
index 4d0db4d5386..fe5e656d55d 100644
--- a/source/blender/blenkernel/intern/gpencil_geom.cc
+++ b/source/blender/blenkernel/intern/gpencil_geom.cc
@@ -746,7 +746,7 @@ bool BKE_gpencil_stroke_stretch(bGPDstroke *gps,
* `curvature = delta angle/delta arclength = len_v3(total_angle) / overshoot_length` */
float curvature = normalize_v3(total_angle) / overshoot_length;
/* Compensate for the weights powf(added_len, segment_influence). */
- curvature /= powf(overshoot_length / fminf(overshoot_parameter, (float)j), segment_influence);
+ curvature /= powf(overshoot_length / fminf(overshoot_parameter, float(j)), segment_influence);
if (invert_curvature) {
curvature = -curvature;
}
@@ -1044,14 +1044,14 @@ bool BKE_gpencil_stroke_smooth_point(bGPDstroke *gps,
(iterations * iterations) / 4 + 2 * iterations + 12;
double w = keep_shape ? 2.0 : 1.0;
double w2 = keep_shape ?
- (1.0 / M_SQRT3) * exp((2 * iterations * iterations) / (double)(n_half * 3)) :
+ (1.0 / M_SQRT3) * exp((2 * iterations * iterations) / double(n_half * 3)) :
0.0;
double total_w = 0.0;
for (int step = iterations; step > 0; step--) {
int before = point_index - step;
int after = point_index + step;
- float w_before = (float)(w - w2);
- float w_after = (float)(w - w2);
+ float w_before = float(w - w2);
+ float w_after = float(w - w2);
if (is_cyclic) {
before = (before % gps->totpoints + gps->totpoints) % gps->totpoints;
@@ -1060,13 +1060,13 @@ bool BKE_gpencil_stroke_smooth_point(bGPDstroke *gps,
else {
if (before < 0) {
if (!smooth_caps) {
- w_before *= -before / (float)point_index;
+ w_before *= -before / float(point_index);
}
before = 0;
}
if (after > gps->totpoints - 1) {
if (!smooth_caps) {
- w_after *= (after - (gps->totpoints - 1)) / (float)(gps->totpoints - 1 - point_index);
+ w_after *= (after - (gps->totpoints - 1)) / float(gps->totpoints - 1 - point_index);
}
after = gps->totpoints - 1;
}
@@ -1081,14 +1081,14 @@ bool BKE_gpencil_stroke_smooth_point(bGPDstroke *gps,
total_w += w_before;
total_w += w_after;
- w *= (n_half + step) / (double)(n_half + 1 - step);
- w2 *= (n_half * 3 + step) / (double)(n_half * 3 + 1 - step);
+ w *= (n_half + step) / double(n_half + 1 - step);
+ w2 *= (n_half * 3 + step) / double(n_half * 3 + 1 - step);
}
total_w += w - w2;
/* The accumulated weight total_w should be
* ~sqrt(M_PI * n_half) * exp((iterations * iterations) / n_half) < 100
* here, but sometimes not quite. */
- mul_v3_fl(sco, (float)(1.0 / total_w));
+ mul_v3_fl(sco, float(1.0 / total_w));
/* Shift back to global coordinates. */
add_v3_v3(sco, &pt->x);
@@ -1123,8 +1123,8 @@ bool BKE_gpencil_stroke_smooth_strength(
for (int step = iterations; step > 0; step--) {
int before = point_index - step;
int after = point_index + step;
- float w_before = (float)w;
- float w_after = (float)w;
+ float w_before = float(w);
+ float w_after = float(w);
if (is_cyclic) {
before = (before % gps->totpoints + gps->totpoints) % gps->totpoints;
@@ -1142,7 +1142,7 @@ bool BKE_gpencil_stroke_smooth_strength(
total_w += w_before;
total_w += w_after;
- w *= (n_half + step) / (double)(n_half + 1 - step);
+ w *= (n_half + step) / double(n_half + 1 - step);
}
total_w += w;
/* The accumulated weight total_w should be
@@ -1181,8 +1181,8 @@ bool BKE_gpencil_stroke_smooth_thickness(
for (int step = iterations; step > 0; step--) {
int before = point_index - step;
int after = point_index + step;
- float w_before = (float)w;
- float w_after = (float)w;
+ float w_before = float(w);
+ float w_after = float(w);
if (is_cyclic) {
before = (before % gps->totpoints + gps->totpoints) % gps->totpoints;
@@ -1200,7 +1200,7 @@ bool BKE_gpencil_stroke_smooth_thickness(
total_w += w_before;
total_w += w_after;
- w *= (n_half + step) / (double)(n_half + 1 - step);
+ w *= (n_half + step) / double(n_half + 1 - step);
}
total_w += w;
/* The accumulated weight total_w should be
@@ -1251,8 +1251,8 @@ bool BKE_gpencil_stroke_smooth_uv(struct bGPDstroke *gps,
for (int step = iterations; step > 0; step--) {
int before = point_index - step;
int after = point_index + step;
- float w_before = (float)w;
- float w_after = (float)w;
+ float w_before = float(w);
+ float w_after = float(w);
if (is_cyclic) {
before = (before % gps->totpoints + gps->totpoints) % gps->totpoints;
@@ -1260,11 +1260,11 @@ bool BKE_gpencil_stroke_smooth_uv(struct bGPDstroke *gps,
}
else {
if (before < 0) {
- w_before *= -before / (float)point_index;
+ w_before *= -before / float(point_index);
before = 0;
}
if (after > gps->totpoints - 1) {
- w_after *= (after - (gps->totpoints - 1)) / (float)(gps->totpoints - 1 - point_index);
+ w_after *= (after - (gps->totpoints - 1)) / float(gps->totpoints - 1 - point_index);
after = gps->totpoints - 1;
}
}
@@ -1278,7 +1278,7 @@ bool BKE_gpencil_stroke_smooth_uv(struct bGPDstroke *gps,
total_w += w_before;
total_w += w_after;
- w *= (n_half + step) / (double)(n_half + 1 - step);
+ w *= (n_half + step) / double(n_half + 1 - step);
}
total_w += w;
/* The accumulated weight total_w should be
@@ -1353,7 +1353,7 @@ void BKE_gpencil_stroke_2d_flat(const bGPDspoint *points,
const bGPDspoint *pt0 = &points[0];
const bGPDspoint *pt1 = &points[1];
- const bGPDspoint *pt3 = &points[(int)(totpoints * 0.75)];
+ const bGPDspoint *pt3 = &points[int(totpoints * 0.75)];
float locx[3];
float locy[3];
@@ -1430,7 +1430,7 @@ void BKE_gpencil_stroke_2d_flat_ref(const bGPDspoint *ref_points,
const bGPDspoint *pt0 = &ref_points[0];
const bGPDspoint *pt1 = &ref_points[1];
- const bGPDspoint *pt3 = &ref_points[(int)(ref_totpoints * 0.75)];
+ const bGPDspoint *pt3 = &ref_points[int(ref_totpoints * 0.75)];
float locx[3];
float locy[3];
@@ -1499,7 +1499,7 @@ void BKE_gpencil_stroke_2d_flat_ref(const bGPDspoint *ref_points,
}
/* Concave (-1), Convex (1), or Auto-detect (0)? */
- *r_direction = (int)locy[2];
+ *r_direction = int(locy[2]);
}
/* Calc texture coordinates using flat projected points. */
@@ -1564,7 +1564,7 @@ void BKE_gpencil_stroke_fill_triangulate(bGPDstroke *gps)
/* convert to 2d and triangulate */
BKE_gpencil_stroke_2d_flat(gps->points, gps->totpoints, points2d, &direction);
- BLI_polyfill_calc(points2d, (uint)gps->totpoints, direction, tmp_triangles);
+ BLI_polyfill_calc(points2d, uint(gps->totpoints), direction, tmp_triangles);
/* calc texture coordinates automatically */
float minv[2];
@@ -1844,7 +1844,7 @@ bool BKE_gpencil_stroke_close(bGPDstroke *gps)
pt2 = &gps->points[0];
bGPDspoint *pt = &gps->points[old_tot];
for (int i = 1; i < tot_newpoints + 1; i++, pt++) {
- float step = (tot_newpoints > 1) ? ((float)i / (float)tot_newpoints) : 0.99f;
+ float step = (tot_newpoints > 1) ? (float(i) / float(tot_newpoints)) : 0.99f;
/* Clamp last point to be near, but not on top of first point. */
if ((tot_newpoints > 1) && (i == tot_newpoints)) {
step *= 0.99f;
@@ -1988,7 +1988,7 @@ void BKE_gpencil_stroke_normal(const bGPDstroke *gps, float r_normal[3])
const bGPDspoint *pt0 = &points[0];
const bGPDspoint *pt1 = &points[1];
- const bGPDspoint *pt3 = &points[(int)(totpoints * 0.75)];
+ const bGPDspoint *pt3 = &points[int(totpoints * 0.75)];
float vec1[3];
float vec2[3];
@@ -2629,7 +2629,7 @@ static int gpencil_material_find_index_by_name(Object *ob, const char *name)
{
for (int i = 0; i < ob->totcol; i++) {
Material *ma = BKE_object_material_get(ob, i + 1);
- if ((ma != nullptr) && (ma->gp_style != nullptr) && (STREQ(ma->id.name + 2, name))) {
+ if ((ma != nullptr) && (ma->gp_style != nullptr) && STREQ(ma->id.name + 2, name)) {
return i;
}
}
@@ -3117,7 +3117,7 @@ bGPDstroke *BKE_gpencil_stroke_delete_tagged_points(bGPdata *gpd,
bGPDstroke *new_stroke = nullptr;
bGPDstroke *gps_first = nullptr;
- const bool is_cyclic = (bool)(gps->flag & GP_STROKE_CYCLIC);
+ const bool is_cyclic = bool(gps->flag & GP_STROKE_CYCLIC);
/* First Pass: Identify start/end of islands */
bGPDspoint *pt = gps->points;
@@ -3210,7 +3210,7 @@ bGPDstroke *BKE_gpencil_stroke_delete_tagged_points(bGPdata *gpd,
float delta = gps->points[island->start_idx].time;
int j;
- new_stroke->inittime += (double)delta;
+ new_stroke->inittime += double(delta);
pts = new_stroke->points;
for (j = 0; j < new_stroke->totpoints; j++, pts++) {
@@ -3502,7 +3502,7 @@ void BKE_gpencil_stroke_join(bGPDstroke *gps_a,
/* Ratio to apply in the points to keep the same thickness in the joined stroke using the
* destination stroke thickness. */
const float ratio = (fit_thickness && gps_a->thickness > 0.0f) ?
- (float)gps_b->thickness / (float)gps_a->thickness :
+ float(gps_b->thickness) / float(gps_a->thickness) :
1.0f;
/* 3rd: add all points */
@@ -3863,7 +3863,7 @@ static int generate_arc_from_point_to_point(ListBase *list,
* points to insert. */
int num_points = (int)(((1 << (subdivisions + 1)) - 1) * (angle / M_PI));
if (num_points > 0) {
- float angle_incr = angle / (float)num_points;
+ float angle_incr = angle / float(num_points);
float vec_p[3];
float vec_t[3];
@@ -3918,7 +3918,7 @@ static int generate_semi_circle_from_point_to_point(ListBase *list,
}
float vec_p[3];
- float angle_incr = M_PI / ((float)num_points - 1);
+ float angle_incr = M_PI / (float(num_points) - 1);
tPerimeterPoint *last_point = from;
for (int i = 1; i < num_points; i++) {
@@ -4324,7 +4324,7 @@ float BKE_gpencil_stroke_average_pressure_get(bGPDstroke *gps)
tot += pt->pressure;
}
- return tot / (float)gps->totpoints;
+ return tot / float(gps->totpoints);
}
bool BKE_gpencil_stroke_is_pressure_constant(bGPDstroke *gps)
diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c
index 8361d8e1849..191231f2b43 100644
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@ -720,7 +720,14 @@ void BKE_gpencil_prepare_eval_data(Depsgraph *depsgraph, Scene *scene, Object *o
do_parent = true;
break;
}
- if ((!is_zero_v3(gpl->location)) || (!is_zero_v3(gpl->rotation)) || (!is_one_v3(gpl->scale))) {
+
+ /* Only do layer transformations for non-zero or animated transforms. */
+ bool transformed = ((!is_zero_v3(gpl->location)) || (!is_zero_v3(gpl->rotation)) ||
+ (!is_one_v3(gpl->scale)));
+ float tmp_mat[4][4];
+ loc_eul_size_to_mat4(tmp_mat, gpl->location, gpl->rotation, gpl->scale);
+ transformed |= !equals_m4m4(gpl->layer_mat, tmp_mat);
+ if (transformed) {
do_transform = true;
break;
}
@@ -897,6 +904,11 @@ void BKE_gpencil_modifier_blend_write(BlendWriter *writer, ListBase *modbase)
BLO_write_struct_array(
writer, DashGpencilModifierSegment, gpmd->segments_len, gpmd->segments);
}
+ else if (md->type == eGpencilModifierType_Time) {
+ TimeGpencilModifierData *gpmd = (TimeGpencilModifierData *)md;
+ BLO_write_struct_array(
+ writer, TimeGpencilModifierSegment, gpmd->segments_len, gpmd->segments);
+ }
}
}
@@ -983,6 +995,13 @@ void BKE_gpencil_modifier_blend_read_data(BlendDataReader *reader, ListBase *lb)
gpmd->segments[i].dmd = gpmd;
}
}
+ else if (md->type == eGpencilModifierType_Time) {
+ TimeGpencilModifierData *gpmd = (TimeGpencilModifierData *)md;
+ BLO_read_data_address(reader, &gpmd->segments);
+ for (int i = 0; i < gpmd->segments_len; i++) {
+ gpmd->segments[i].gpmd = gpmd;
+ }
+ }
if (md->type == eGpencilModifierType_Shrinkwrap) {
ShrinkwrapGpencilModifierData *gpmd = (ShrinkwrapGpencilModifierData *)md;
gpmd->cache_data = NULL;
diff --git a/source/blender/blenkernel/intern/icons.cc b/source/blender/blenkernel/intern/icons.cc
index f59f5352aad..dc1d23de7e0 100644
--- a/source/blender/blenkernel/intern/icons.cc
+++ b/source/blender/blenkernel/intern/icons.cc
@@ -479,7 +479,7 @@ PreviewImage *BKE_previewimg_cached_thumbnail_read(const char *name,
if (prv && force_update) {
const char *prv_deferred_data = (char *)PRV_DEFERRED_DATA(prv);
- if (((int)prv_deferred_data[0] == source) && STREQ(&prv_deferred_data[1], filepath)) {
+ if ((int(prv_deferred_data[0]) == source) && STREQ(&prv_deferred_data[1], filepath)) {
/* If same filepath, no need to re-allocate preview, just clear it up. */
BKE_previewimg_clear(prv);
}
@@ -566,9 +566,9 @@ void BKE_previewimg_ensure(PreviewImage *prv, const int size)
ImBuf *BKE_previewimg_to_imbuf(PreviewImage *prv, const int size)
{
- const unsigned int w = prv->w[size];
- const unsigned int h = prv->h[size];
- const unsigned int *rect = prv->rect[size];
+ const uint w = prv->w[size];
+ const uint h = prv->h[size];
+ const uint *rect = prv->rect[size];
ImBuf *ima = nullptr;
@@ -971,8 +971,8 @@ struct Icon_Geom *BKE_icon_geom_from_memory(uchar *data, size_t data_len)
p += 4;
struct Icon_Geom *geom = (struct Icon_Geom *)MEM_mallocN(sizeof(*geom), __func__);
- geom->coords_range[0] = (int)*p++;
- geom->coords_range[1] = (int)*p++;
+ geom->coords_range[0] = int(*p++);
+ geom->coords_range[1] = int(*p++);
/* x, y ignored for now */
p += 2;
diff --git a/source/blender/blenkernel/intern/icons_rasterize.c b/source/blender/blenkernel/intern/icons_rasterize.c
index 00dbdcfa1e5..56854c1318e 100644
--- a/source/blender/blenkernel/intern/icons_rasterize.c
+++ b/source/blender/blenkernel/intern/icons_rasterize.c
@@ -67,9 +67,7 @@ static void tri_fill_smooth(int x, int x_end, int y, void *user_data)
}
}
-ImBuf *BKE_icon_geom_rasterize(const struct Icon_Geom *geom,
- const unsigned int size_x,
- const unsigned int size_y)
+ImBuf *BKE_icon_geom_rasterize(const struct Icon_Geom *geom, const uint size_x, const uint size_y)
{
const int coords_len = geom->coords_len;
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index 98c317c547b..f876caf9d91 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -829,8 +829,8 @@ bool IDP_EqualsProperties_ex(IDProperty *prop1, IDProperty *prop2, const bool is
case IDP_DOUBLE:
return (IDP_Double(prop1) == IDP_Double(prop2));
case IDP_STRING: {
- return (((prop1->len == prop2->len) &&
- STREQLEN(IDP_String(prop1), IDP_String(prop2), (size_t)prop1->len)));
+ return ((prop1->len == prop2->len) &&
+ STREQLEN(IDP_String(prop1), IDP_String(prop2), (size_t)prop1->len));
}
case IDP_ARRAY:
if (prop1->len == prop2->len && prop1->subtype == prop2->subtype) {
diff --git a/source/blender/blenkernel/intern/image.cc b/source/blender/blenkernel/intern/image.cc
index 3cc0727a94a..f6e19277993 100644
--- a/source/blender/blenkernel/intern/image.cc
+++ b/source/blender/blenkernel/intern/image.cc
@@ -256,7 +256,7 @@ static void image_foreach_cache(ID *id,
function_callback(id, &key, (void **)&image->rr, 0, user_data);
LISTBASE_FOREACH (RenderSlot *, slot, &image->renderslots) {
- key.offset_in_ID = (size_t)BLI_ghashutil_strhash_p(slot->name);
+ key.offset_in_ID = size_t(BLI_ghashutil_strhash_p(slot->name));
function_callback(id, &key, (void **)&slot->render, 0, user_data);
}
}
@@ -484,7 +484,7 @@ struct ImageCacheKey {
int index;
};
-static unsigned int imagecache_hashhash(const void *key_v)
+static uint imagecache_hashhash(const void *key_v)
{
const ImageCacheKey *key = static_cast<const ImageCacheKey *>(key_v);
return key->index;
@@ -846,8 +846,8 @@ int BKE_image_get_tile_from_pos(Image *ima, const float uv[2], float r_uv[2], fl
return 0;
}
- int ix = (int)uv[0];
- int iy = (int)uv[1];
+ int ix = int(uv[0]);
+ int iy = int(uv[1]);
int tile_number = 1001 + 10 * iy + ix;
if (BKE_image_get_tile(ima, tile_number) == nullptr) {
@@ -867,8 +867,8 @@ void BKE_image_get_tile_uv(const Image *ima, const int tile_number, float r_uv[2
}
else {
const int tile_index = tile_number - 1001;
- r_uv[0] = static_cast<float>(tile_index % 10);
- r_uv[1] = static_cast<float>(tile_index / 10);
+ r_uv[0] = float(tile_index % 10);
+ r_uv[1] = float(tile_index / 10);
}
}
@@ -1080,7 +1080,7 @@ struct ImageFillData {
short gen_type;
uint width;
uint height;
- unsigned char *rect;
+ uchar *rect;
float *rect_float;
float fill_color[4];
};
@@ -1093,7 +1093,7 @@ static void image_buf_fill_isolated(void *usersata_v)
const uint width = usersata->width;
const uint height = usersata->height;
- unsigned char *rect = usersata->rect;
+ uchar *rect = usersata->rect;
float *rect_float = usersata->rect_float;
switch (gen_type) {
@@ -1112,7 +1112,7 @@ static void image_buf_fill_isolated(void *usersata_v)
static ImBuf *add_ibuf_for_tile(Image *ima, ImageTile *tile)
{
ImBuf *ibuf;
- unsigned char *rect = nullptr;
+ uchar *rect = nullptr;
float *rect_float = nullptr;
float fill_color[4];
@@ -1152,7 +1152,7 @@ static ImBuf *add_ibuf_for_tile(Image *ima, ImageTile *tile)
}
if (ibuf != nullptr) {
- rect = (unsigned char *)ibuf->rect;
+ rect = (uchar *)ibuf->rect;
IMB_colormanagement_assign_rect_colorspace(ibuf, ima->colorspace_settings.name);
}
@@ -1183,8 +1183,8 @@ static ImBuf *add_ibuf_for_tile(Image *ima, ImageTile *tile)
}
Image *BKE_image_add_generated(Main *bmain,
- unsigned int width,
- unsigned int height,
+ uint width,
+ uint height,
const char *name,
int depth,
int floatbuf,
@@ -1534,14 +1534,14 @@ void BKE_image_print_memlist(Main *bmain)
totsize += image_mem_size(ima);
}
- printf("\ntotal image memory len: %.3f MB\n", (double)totsize / (double)(1024 * 1024));
+ printf("\ntotal image memory len: %.3f MB\n", double(totsize) / double(1024 * 1024));
for (ima = static_cast<Image *>(bmain->images.first); ima;
ima = static_cast<Image *>(ima->id.next)) {
size = image_mem_size(ima);
if (size) {
- printf("%s len: %.3f MB\n", ima->id.name + 2, (double)size / (double)(1024 * 1024));
+ printf("%s len: %.3f MB\n", ima->id.name + 2, double(size) / double(1024 * 1024));
}
}
}
@@ -1943,7 +1943,7 @@ static void stampdata_from_template(StampData *stamp_data,
void BKE_image_stamp_buf(Scene *scene,
Object *camera,
const StampData *stamp_data_template,
- unsigned char *rect,
+ uchar *rect,
float *rectf,
int width,
int height,
@@ -1967,7 +1967,7 @@ void BKE_image_stamp_buf(Scene *scene,
* for now though this is only used for renders which use scene settings */
#define TEXT_SIZE_CHECK(str, w, h) \
- ((str[0]) && ((void)(h = h_fixed), (w = (int)BLF_width(mono, str, sizeof(str)))))
+ ((str[0]) && ((void)(h = h_fixed), (w = int(BLF_width(mono, str, sizeof(str))))))
/* must enable BLF_WORD_WRAP before using */
#define TEXT_SIZE_CHECK_WORD_WRAP(str, w, h) \
@@ -2524,7 +2524,7 @@ bool BKE_imbuf_alpha_test(ImBuf *ibuf)
}
}
else if (ibuf->rect) {
- unsigned char *buf = (unsigned char *)ibuf->rect;
+ uchar *buf = (uchar *)ibuf->rect;
for (tot = ibuf->x * ibuf->y; tot--; buf += 4) {
if (buf[3] != 255) {
return true;
@@ -2986,7 +2986,7 @@ static void image_free_tile(Image *ima, ImageTile *tile)
for (int i = 0; i < TEXTARGET_COUNT; i++) {
/* Only two textures depends on all tiles, so if this is a secondary tile we can keep the other
* two. */
- if (tile != ima->tiles.first && !(ELEM(i, TEXTARGET_2D_ARRAY, TEXTARGET_TILE_MAPPING))) {
+ if (tile != ima->tiles.first && !ELEM(i, TEXTARGET_2D_ARRAY, TEXTARGET_TILE_MAPPING)) {
continue;
}
@@ -4101,7 +4101,7 @@ static ImBuf *load_image_single(Image *ima,
LISTBASE_FOREACH (ImagePackedFile *, imapf, &ima->packedfiles) {
if (imapf->view == view_id && imapf->tile_number == tile_number) {
if (imapf->packedfile) {
- ibuf = IMB_ibImageFromMemory((unsigned char *)imapf->packedfile->data,
+ ibuf = IMB_ibImageFromMemory((uchar *)imapf->packedfile->data,
imapf->packedfile->size,
flag,
ima->colorspace_settings.name,
@@ -4291,7 +4291,7 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **r_loc
Render *re;
RenderView *rv;
float *rectf, *rectz;
- unsigned int *rect;
+ uint *rect;
float dither;
int channels, layer, pass;
ImBuf *ibuf;
@@ -4350,12 +4350,12 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **r_loc
/* this gives active layer, composite or sequence result */
if (rv == nullptr) {
- rect = (unsigned int *)rres.rect32;
+ rect = (uint *)rres.rect32;
rectf = rres.rectf;
rectz = rres.rectz;
}
else {
- rect = (unsigned int *)rv->rect32;
+ rect = (uint *)rv->rect32;
rectf = rv->rectf;
rectz = rv->rectz;
}
@@ -5120,7 +5120,7 @@ void BKE_image_user_file_path_ex(const Main *bmain,
if (ELEM(ima->source, IMA_SRC_SEQUENCE, IMA_SRC_TILED)) {
char head[FILE_MAX], tail[FILE_MAX];
- unsigned short numlen;
+ ushort numlen;
int index;
if (ima->source == IMA_SRC_SEQUENCE) {
@@ -5187,8 +5187,8 @@ void BKE_image_get_size_fl(Image *image, ImageUser *iuser, float r_size[2])
int width, height;
BKE_image_get_size(image, iuser, &width, &height);
- r_size[0] = (float)width;
- r_size[1] = (float)height;
+ r_size[0] = float(width);
+ r_size[1] = float(height);
}
void BKE_image_get_aspect(Image *image, float *r_aspx, float *r_aspy)
@@ -5204,13 +5204,13 @@ void BKE_image_get_aspect(Image *image, float *r_aspx, float *r_aspy)
}
}
-unsigned char *BKE_image_get_pixels_for_frame(struct Image *image, int frame, int tile)
+uchar *BKE_image_get_pixels_for_frame(struct Image *image, int frame, int tile)
{
ImageUser iuser;
BKE_imageuser_default(&iuser);
void *lock;
ImBuf *ibuf;
- unsigned char *pixels = nullptr;
+ uchar *pixels = nullptr;
iuser.framenr = frame;
iuser.tile = tile;
@@ -5218,10 +5218,10 @@ unsigned char *BKE_image_get_pixels_for_frame(struct Image *image, int frame, in
ibuf = BKE_image_acquire_ibuf(image, &iuser, &lock);
if (ibuf) {
- pixels = (unsigned char *)ibuf->rect;
+ pixels = (uchar *)ibuf->rect;
if (pixels) {
- pixels = static_cast<unsigned char *>(MEM_dupallocN(pixels));
+ pixels = static_cast<uchar *>(MEM_dupallocN(pixels));
}
BKE_image_release_ibuf(image, ibuf, lock);
diff --git a/source/blender/blenkernel/intern/image_gen.c b/source/blender/blenkernel/intern/image_gen.c
index 32795baaa37..aef64247346 100644
--- a/source/blender/blenkernel/intern/image_gen.c
+++ b/source/blender/blenkernel/intern/image_gen.c
@@ -19,14 +19,14 @@
#include "BLF_api.h"
typedef struct FillColorThreadData {
- unsigned char *rect;
+ uchar *rect;
float *rect_float;
int width;
float color[4];
} FillColorThreadData;
static void image_buf_fill_color_slice(
- unsigned char *rect, float *rect_float, int width, int height, const float color[4])
+ uchar *rect, float *rect_float, int width, int height, const float color[4])
{
int x, y;
@@ -41,7 +41,7 @@ static void image_buf_fill_color_slice(
}
if (rect) {
- unsigned char ccol[4];
+ uchar ccol[4];
rgba_float_to_uchar(ccol, color);
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) {
@@ -60,13 +60,13 @@ static void image_buf_fill_color_thread_do(void *data_v, int scanline)
FillColorThreadData *data = (FillColorThreadData *)data_v;
const int num_scanlines = 1;
size_t offset = ((size_t)scanline) * data->width * 4;
- unsigned char *rect = (data->rect != NULL) ? (data->rect + offset) : NULL;
+ uchar *rect = (data->rect != NULL) ? (data->rect + offset) : NULL;
float *rect_float = (data->rect_float != NULL) ? (data->rect_float + offset) : NULL;
image_buf_fill_color_slice(rect, rect_float, data->width, num_scanlines, data->color);
}
void BKE_image_buf_fill_color(
- unsigned char *rect, float *rect_float, int width, int height, const float color[4])
+ uchar *rect, float *rect_float, int width, int height, const float color[4])
{
if (((size_t)width) * height < 64 * 64) {
image_buf_fill_color_slice(rect, rect_float, width, height, color);
@@ -82,7 +82,7 @@ void BKE_image_buf_fill_color(
}
static void image_buf_fill_checker_slice(
- unsigned char *rect, float *rect_float, int width, int height, int offset)
+ uchar *rect, float *rect_float, int width, int height, int offset)
{
/* these two passes could be combined into one, but it's more readable and
* easy to tweak like this, speed isn't really that much of an issue in this situation... */
@@ -90,7 +90,7 @@ static void image_buf_fill_checker_slice(
int checkerwidth = 32;
int x, y;
- unsigned char *rect_orig = rect;
+ uchar *rect_orig = rect;
float *rect_float_orig = rect_float;
float hsv[3] = {0.0f, 0.9f, 0.9f};
@@ -178,7 +178,7 @@ static void image_buf_fill_checker_slice(
}
typedef struct FillCheckerThreadData {
- unsigned char *rect;
+ uchar *rect;
float *rect_float;
int width;
} FillCheckerThreadData;
@@ -188,12 +188,12 @@ static void image_buf_fill_checker_thread_do(void *data_v, int scanline)
FillCheckerThreadData *data = (FillCheckerThreadData *)data_v;
size_t offset = ((size_t)scanline) * data->width * 4;
const int num_scanlines = 1;
- unsigned char *rect = (data->rect != NULL) ? (data->rect + offset) : NULL;
+ uchar *rect = (data->rect != NULL) ? (data->rect + offset) : NULL;
float *rect_float = (data->rect_float != NULL) ? (data->rect_float + offset) : NULL;
image_buf_fill_checker_slice(rect, rect_float, data->width, num_scanlines, scanline);
}
-void BKE_image_buf_fill_checker(unsigned char *rect, float *rect_float, int width, int height)
+void BKE_image_buf_fill_checker(uchar *rect, float *rect_float, int width, int height)
{
if (((size_t)width) * height < 64 * 64) {
image_buf_fill_checker_slice(rect, rect_float, width, height, 0);
@@ -214,7 +214,7 @@ void BKE_image_buf_fill_checker(unsigned char *rect, float *rect_float, int widt
((real + (char)(add * 255.0f)) <= 255) ? (real + (char)(add * 255.0f)) : 255
static void checker_board_color_fill(
- unsigned char *rect, float *rect_float, int width, int height, int offset, int total_height)
+ uchar *rect, float *rect_float, int width, int height, int offset, int total_height)
{
int hue_step, y, x;
float hsv[3], rgb[3];
@@ -255,13 +255,8 @@ static void checker_board_color_fill(
}
}
-static void checker_board_color_tint(unsigned char *rect,
- float *rect_float,
- int width,
- int height,
- int size,
- float blend,
- int offset)
+static void checker_board_color_tint(
+ uchar *rect, float *rect_float, int width, int height, int size, float blend, int offset)
{
int x, y;
float blend_half = blend * 0.5f;
@@ -310,7 +305,7 @@ static void checker_board_color_tint(unsigned char *rect,
}
static void checker_board_grid_fill(
- unsigned char *rect, float *rect_float, int width, int height, float blend, int offset)
+ uchar *rect, float *rect_float, int width, int height, float blend, int offset)
{
int x, y;
for (y = offset; y < height + offset; y++) {
@@ -348,7 +343,7 @@ static void checker_board_grid_fill(
/* defined in image.c */
static void checker_board_text(
- unsigned char *rect, float *rect_float, int width, int height, int step, int outline)
+ uchar *rect, float *rect_float, int width, int height, int step, int outline)
{
int x, y;
int pen_x, pen_y;
@@ -415,7 +410,7 @@ static void checker_board_text(
}
static void checker_board_color_prepare_slice(
- unsigned char *rect, float *rect_float, int width, int height, int offset, int total_height)
+ uchar *rect, float *rect_float, int width, int height, int offset, int total_height)
{
checker_board_color_fill(rect, rect_float, width, height, offset, total_height);
checker_board_color_tint(rect, rect_float, width, height, 1, 0.03f, offset);
@@ -426,7 +421,7 @@ static void checker_board_color_prepare_slice(
}
typedef struct FillCheckerColorThreadData {
- unsigned char *rect;
+ uchar *rect;
float *rect_float;
int width, height;
} FillCheckerColorThreadData;
@@ -436,16 +431,13 @@ static void checker_board_color_prepare_thread_do(void *data_v, int scanline)
FillCheckerColorThreadData *data = (FillCheckerColorThreadData *)data_v;
const int num_scanlines = 1;
size_t offset = ((size_t)data->width) * scanline * 4;
- unsigned char *rect = (data->rect != NULL) ? (data->rect + offset) : NULL;
+ uchar *rect = (data->rect != NULL) ? (data->rect + offset) : NULL;
float *rect_float = (data->rect_float != NULL) ? (data->rect_float + offset) : NULL;
checker_board_color_prepare_slice(
rect, rect_float, data->width, num_scanlines, scanline, data->height);
}
-void BKE_image_buf_fill_checker_color(unsigned char *rect,
- float *rect_float,
- int width,
- int height)
+void BKE_image_buf_fill_checker_color(uchar *rect, float *rect_float, int width, int height)
{
if (((size_t)width) * height < 64 * 64) {
checker_board_color_prepare_slice(rect, rect_float, width, height, 0, height);
diff --git a/source/blender/blenkernel/intern/image_gpu.cc b/source/blender/blenkernel/intern/image_gpu.cc
index 08fdd715512..6893a50638a 100644
--- a/source/blender/blenkernel/intern/image_gpu.cc
+++ b/source/blender/blenkernel/intern/image_gpu.cc
@@ -551,7 +551,7 @@ void BKE_image_free_anim_gputextures(Main *bmain)
void BKE_image_free_old_gputextures(Main *bmain)
{
static int lasttime = 0;
- int ctime = (int)PIL_check_seconds_timer();
+ int ctime = int(PIL_check_seconds_timer());
/*
* Run garbage collector once for every collecting period of time
@@ -602,8 +602,8 @@ static ImBuf *update_do_scale(uchar *rect,
int full_h)
{
/* Partial update with scaling. */
- float xratio = limit_w / (float)full_w;
- float yratio = limit_h / (float)full_h;
+ float xratio = limit_w / float(full_w);
+ float yratio = limit_h / float(full_h);
int part_w = *w, part_h = *h;
@@ -611,8 +611,8 @@ static ImBuf *update_do_scale(uchar *rect,
* losing 1 pixel due to rounding errors in x,y. */
*x *= xratio;
*y *= yratio;
- *w = (int)ceil(xratio * (*w));
- *h = (int)ceil(yratio * (*h));
+ *w = int(ceil(xratio * (*w)));
+ *h = int(ceil(yratio * (*h)));
/* ...but take back if we are over the limit! */
if (*x + *w > limit_w) {
diff --git a/source/blender/blenkernel/intern/image_save.cc b/source/blender/blenkernel/intern/image_save.cc
index 6f62ee123cb..41a5f88f677 100644
--- a/source/blender/blenkernel/intern/image_save.cc
+++ b/source/blender/blenkernel/intern/image_save.cc
@@ -473,7 +473,7 @@ static bool image_save_single(ReportList *reports,
}
/* individual multiview images */
else if (imf->views_format == R_IMF_VIEWS_INDIVIDUAL) {
- unsigned char planes = ibuf->planes;
+ uchar planes = ibuf->planes;
const int totviews = (rr ? BLI_listbase_count(&rr->views) : BLI_listbase_count(&ima->views));
if (!is_exr_rr) {
@@ -543,7 +543,7 @@ static bool image_save_single(ReportList *reports,
else {
ImBuf *ibuf_stereo[2] = {nullptr};
- unsigned char planes = ibuf->planes;
+ uchar planes = ibuf->planes;
const char *names[2] = {STEREO_LEFT_NAME, STEREO_RIGHT_NAME};
/* we need to get the specific per-view buffers */
@@ -798,8 +798,10 @@ bool BKE_image_render_write_exr(ReportList *reports,
LISTBASE_FOREACH (RenderLayer *, rl, &rr->layers) {
/* Skip other render layers if requested. */
if (!multi_layer && nr != layer) {
+ nr++;
continue;
}
+ nr++;
LISTBASE_FOREACH (RenderPass *, rp, &rl->passes) {
/* Skip non-RGBA and Z passes if not using multi layer. */
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index 40a5c08a068..6a8edde9c49 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -1492,7 +1492,7 @@ static void icu_to_fcurves(ID *id,
* 3) filter the keyframes for the flag of interest
*/
for (b = 0; b < totbits; b++, abp++) {
- unsigned int i = 0;
+ uint i = 0;
/* make a copy of existing base-data if not the last curve */
if (b < (totbits - 1)) {
@@ -1562,7 +1562,7 @@ static void icu_to_fcurves(ID *id,
}
}
else {
- unsigned int i = 0;
+ uint i = 0;
/* get rna-path
* - we will need to set the 'disabled' flag if no path is able to be made (for now)
diff --git a/source/blender/blenkernel/intern/kelvinlet.c b/source/blender/blenkernel/intern/kelvinlet.c
index 73a84f06ad8..4ccd848b9d7 100644
--- a/source/blender/blenkernel/intern/kelvinlet.c
+++ b/source/blender/blenkernel/intern/kelvinlet.c
@@ -154,7 +154,7 @@ static void kelvinlet_scale(float disp[3],
sub_v3_v3v3(radius_vertex, vertex_co, location);
const float radius = len_v3(radius_vertex);
const float radius_e = sqrtf(pow2f(radius) + pow2f(p->radius_scaled[0]));
- const float u = (2.0f * p->b - p->a) * ((1.0f / pow3f(radius_e))) +
+ const float u = (2.0f * p->b - p->a) * (1.0f / pow3f(radius_e)) +
((3.0f * pow2f(p->radius_scaled[0])) / (2.0f * pow5f(radius_e)));
const float fade = u * p->c;
mul_v3_v3fl(disp, radius_vertex, fade * p->f);
@@ -181,7 +181,7 @@ static void kelvinlet_twist(float disp[3],
sub_v3_v3v3(radius_vertex, vertex_co, location);
const float radius = len_v3(radius_vertex);
const float radius_e = sqrtf(pow2f(radius) + pow2f(p->radius_scaled[0]));
- const float u = -p->a * ((1.0f / pow3f(radius_e))) +
+ const float u = -p->a * (1.0f / pow3f(radius_e)) +
((3.0f * pow2f(p->radius_scaled[0])) / (2.0f * pow5f(radius_e)));
const float fade = u * p->c;
cross_v3_v3v3(q_r, normal, radius_vertex);
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index e0959182fa4..f6a409ee3f0 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -245,7 +245,7 @@ int BKE_lattice_index_flip(
void BKE_lattice_bitmap_from_flag(
Lattice *lt, BLI_bitmap *bitmap, const uint8_t flag, const bool clear, const bool respecthide)
{
- const unsigned int tot = lt->pntsu * lt->pntsv * lt->pntsw;
+ const uint tot = lt->pntsu * lt->pntsv * lt->pntsw;
BPoint *bp;
bp = lt->def;
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c
index d779fc4f512..12472cf9dc5 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -1022,7 +1022,7 @@ static void layer_collection_objects_sync(ViewLayer *view_layer,
if ((layer_restrict & LAYER_COLLECTION_HIDE) == 0) {
base->flag_from_collection |= BASE_ENABLED_AND_VISIBLE_IN_DEFAULT_VIEWPORT;
}
- if (((collection_restrict & COLLECTION_HIDE_SELECT) == 0)) {
+ if ((collection_restrict & COLLECTION_HIDE_SELECT) == 0) {
base->flag_from_collection |= BASE_SELECTABLE;
}
}
@@ -1686,7 +1686,7 @@ static void layer_collection_local_visibility_unset_recursive(LayerCollection *l
static void layer_collection_local_sync(const Scene *scene,
ViewLayer *view_layer,
LayerCollection *layer_collection,
- const unsigned short local_collections_uuid,
+ const ushort local_collections_uuid,
bool visible)
{
if ((layer_collection->local_collections_bits & local_collections_uuid) == 0) {
@@ -1718,7 +1718,7 @@ void BKE_layer_collection_local_sync(const Scene *scene, ViewLayer *view_layer,
return;
}
- const unsigned short local_collections_uuid = v3d->local_collections_uuid;
+ const ushort local_collections_uuid = v3d->local_collections_uuid;
/* Reset flags and set the bases visible by default. */
BKE_view_layer_synced_ensure(scene, view_layer);
diff --git a/source/blender/blenkernel/intern/lib_override.cc b/source/blender/blenkernel/intern/lib_override.cc
index 3f1b80014ac..7202570f732 100644
--- a/source/blender/blenkernel/intern/lib_override.cc
+++ b/source/blender/blenkernel/intern/lib_override.cc
@@ -494,8 +494,8 @@ bool BKE_lib_override_library_create_from_tag(Main *bmain,
if (id_hierarchy_root != nullptr) {
/* If the hierarchy root is given, it must be a valid existing override (used during partial
* resync process mainly). */
- BLI_assert((ID_IS_OVERRIDE_LIBRARY_REAL(id_hierarchy_root) &&
- id_hierarchy_root->override_library->reference->lib == id_root_reference->lib));
+ BLI_assert(ID_IS_OVERRIDE_LIBRARY_REAL(id_hierarchy_root) &&
+ id_hierarchy_root->override_library->reference->lib == id_root_reference->lib);
if (!do_no_main) {
/* When processing within Main, set existing overrides in given hierarchy as 'newid' of their
@@ -507,8 +507,8 @@ bool BKE_lib_override_library_create_from_tag(Main *bmain,
if (!ELEM(id_hierarchy_root_reference, nullptr, id_root_reference)) {
/* If the reference hierarchy root is given, it must be from the same library as the reference
* root, and also tagged for override. */
- BLI_assert((id_hierarchy_root_reference->lib == id_root_reference->lib &&
- (id_hierarchy_root_reference->tag & LIB_TAG_DOIT) != 0));
+ BLI_assert(id_hierarchy_root_reference->lib == id_root_reference->lib &&
+ (id_hierarchy_root_reference->tag & LIB_TAG_DOIT) != 0);
}
const Library *reference_library = id_root_reference->lib;
diff --git a/source/blender/blenkernel/intern/lib_remap.c b/source/blender/blenkernel/intern/lib_remap.c
index 2ebdc6788d9..addb7b0988c 100644
--- a/source/blender/blenkernel/intern/lib_remap.c
+++ b/source/blender/blenkernel/intern/lib_remap.c
@@ -183,7 +183,7 @@ static int foreach_libblock_remap_callback(LibraryIDLinkCallbackData *cb_data)
/* Better remap to NULL than not remapping at all,
* then we can handle it as a regular remap-to-NULL case. */
- if ((cb_flag & IDWALK_CB_NEVER_SELF)) {
+ if (cb_flag & IDWALK_CB_NEVER_SELF) {
id_remapper_options |= ID_REMAP_APPLY_UNMAP_WHEN_REMAPPING_TO_SELF;
}
diff --git a/source/blender/blenkernel/intern/main_idmap.c b/source/blender/blenkernel/intern/main_idmap.c
index a01dbd14e65..24c1da782fe 100644
--- a/source/blender/blenkernel/intern/main_idmap.c
+++ b/source/blender/blenkernel/intern/main_idmap.c
@@ -184,10 +184,10 @@ struct Main *BKE_main_idmap_main_get(struct IDNameLib_Map *id_map)
return id_map->bmain;
}
-static unsigned int idkey_hash(const void *ptr)
+static uint idkey_hash(const void *ptr)
{
const struct IDNameLib_Key *idkey = ptr;
- unsigned int key = BLI_ghashutil_strhash(idkey->name);
+ uint key = BLI_ghashutil_strhash(idkey->name);
if (idkey->lib) {
key ^= BLI_ghashutil_ptrhash(idkey->lib);
}
diff --git a/source/blender/blenkernel/intern/main_namemap.cc b/source/blender/blenkernel/intern/main_namemap.cc
index a600afb4ed1..5a8f90ea10a 100644
--- a/source/blender/blenkernel/intern/main_namemap.cc
+++ b/source/blender/blenkernel/intern/main_namemap.cc
@@ -62,7 +62,7 @@ static bool id_name_final_build(char *name, char *base_name, size_t base_name_le
/* Code above may have generated invalid utf-8 string, due to raw truncation.
* Ensure we get a valid one now. */
- base_name_len -= (size_t)BLI_str_utf8_invalid_strip(base_name, base_name_len);
+ base_name_len -= size_t(BLI_str_utf8_invalid_strip(base_name, base_name_len));
/* Also truncate orig name, and start the whole check again. */
name[base_name_len] = '\0';
@@ -97,7 +97,7 @@ struct UniqueName_Key {
* one larger.
*/
struct UniqueName_Value {
- static constexpr unsigned max_exact_tracking = 1024;
+ static constexpr uint max_exact_tracking = 1024;
BLI_BITMAP_DECLARE(mask, max_exact_tracking);
int max_value = 0;
diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c
index 0b8351efdf4..d877620855f 100644
--- a/source/blender/blenkernel/intern/mask.c
+++ b/source/blender/blenkernel/intern/mask.c
@@ -308,7 +308,7 @@ BezTriple *BKE_mask_spline_point_next_bezt(MaskSpline *spline,
return NULL;
}
- return &((point + 1))->bezt;
+ return &(point + 1)->bezt;
}
MaskSplinePoint *BKE_mask_spline_point_array(MaskSpline *spline)
diff --git a/source/blender/blenkernel/intern/mask_evaluate.c b/source/blender/blenkernel/intern/mask_evaluate.c
index 3425510c8b9..e76c7894f9f 100644
--- a/source/blender/blenkernel/intern/mask_evaluate.c
+++ b/source/blender/blenkernel/intern/mask_evaluate.c
@@ -24,10 +24,10 @@
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
-unsigned int BKE_mask_spline_resolution(MaskSpline *spline, int width, int height)
+uint BKE_mask_spline_resolution(MaskSpline *spline, int width, int height)
{
float max_segment = 0.01f;
- unsigned int i, resol = 1;
+ uint i, resol = 1;
if (width != 0 && height != 0) {
max_segment = 1.0f / (float)max_ii(width, height);
@@ -37,7 +37,7 @@ unsigned int BKE_mask_spline_resolution(MaskSpline *spline, int width, int heigh
MaskSplinePoint *point = &spline->points[i];
BezTriple *bezt_curr, *bezt_next;
float a, b, c, len;
- unsigned int cur_resol;
+ uint cur_resol;
bezt_curr = &point->bezt;
bezt_next = BKE_mask_spline_point_next_bezt(spline, spline->points, point);
@@ -63,10 +63,10 @@ unsigned int BKE_mask_spline_resolution(MaskSpline *spline, int width, int heigh
return CLAMPIS(resol, 1, MASK_RESOL_MAX);
}
-unsigned int BKE_mask_spline_feather_resolution(MaskSpline *spline, int width, int height)
+uint BKE_mask_spline_feather_resolution(MaskSpline *spline, int width, int height)
{
const float max_segment = 0.005;
- unsigned int resol = BKE_mask_spline_resolution(spline, width, height);
+ uint resol = BKE_mask_spline_resolution(spline, width, height);
float max_jump = 0.0f;
/* avoid checking the featrher if we already hit the maximum value */
@@ -102,7 +102,7 @@ unsigned int BKE_mask_spline_feather_resolution(MaskSpline *spline, int width, i
return CLAMPIS(resol, 1, MASK_RESOL_MAX);
}
-int BKE_mask_spline_differentiate_calc_total(const MaskSpline *spline, const unsigned int resol)
+int BKE_mask_spline_differentiate_calc_total(const MaskSpline *spline, const uint resol)
{
if (spline->flag & MASK_SPLINE_CYCLIC) {
return spline->tot_point * resol;
@@ -112,8 +112,8 @@ int BKE_mask_spline_differentiate_calc_total(const MaskSpline *spline, const uns
}
float (*BKE_mask_spline_differentiate_with_resolution(MaskSpline *spline,
- const unsigned int resol,
- unsigned int *r_tot_diff_point))[2]
+ const uint resol,
+ uint *r_tot_diff_point))[2]
{
MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);
@@ -176,7 +176,7 @@ float (*BKE_mask_spline_differentiate_with_resolution(MaskSpline *spline,
}
float (*BKE_mask_spline_differentiate(
- MaskSpline *spline, int width, int height, unsigned int *r_tot_diff_point))[2]
+ MaskSpline *spline, int width, int height, uint *r_tot_diff_point))[2]
{
uint resol = BKE_mask_spline_resolution(spline, width, height);
@@ -316,7 +316,7 @@ static void feather_bucket_get_diagonal(FeatherEdgesBucket *buckets,
void BKE_mask_spline_feather_collapse_inner_loops(MaskSpline *spline,
float (*feather_points)[2],
- const unsigned int tot_feather_point)
+ const uint tot_feather_point)
{
#define BUCKET_INDEX(co) feather_bucket_index_from_coord(co, min, bucket_scale, buckets_per_side)
@@ -340,7 +340,7 @@ void BKE_mask_spline_feather_collapse_inner_loops(MaskSpline *spline,
INIT_MINMAX2(min, max);
for (uint i = 0; i < tot_feather_point; i++) {
- unsigned int next = i + 1;
+ uint next = i + 1;
float delta;
minmax_v2v2_v2(min, max, feather_points[i]);
@@ -489,11 +489,11 @@ void BKE_mask_spline_feather_collapse_inner_loops(MaskSpline *spline,
}
/** only called from #BKE_mask_spline_feather_differentiated_points_with_resolution() ! */
-static float (*mask_spline_feather_differentiated_points_with_resolution__even(
- MaskSpline *spline,
- const unsigned int resol,
- const bool do_feather_isect,
- unsigned int *r_tot_feather_point))[2]
+static float (
+ *mask_spline_feather_differentiated_points_with_resolution__even(MaskSpline *spline,
+ const uint resol,
+ const bool do_feather_isect,
+ uint *r_tot_feather_point))[2]
{
MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);
MaskSplinePoint *point_curr, *point_prev;
@@ -565,9 +565,9 @@ static float (*mask_spline_feather_differentiated_points_with_resolution__even(
/** only called from #BKE_mask_spline_feather_differentiated_points_with_resolution() ! */
static float (*mask_spline_feather_differentiated_points_with_resolution__double(
MaskSpline *spline,
- const unsigned int resol,
+ const uint resol,
const bool do_feather_isect,
- unsigned int *r_tot_feather_point))[2]
+ uint *r_tot_feather_point))[2]
{
MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);
@@ -704,11 +704,11 @@ static float (*mask_spline_feather_differentiated_points_with_resolution__double
return feather;
}
-float (*BKE_mask_spline_feather_differentiated_points_with_resolution(
- MaskSpline *spline,
- const unsigned int resol,
- const bool do_feather_isect,
- unsigned int *r_tot_feather_point))[2]
+float (
+ *BKE_mask_spline_feather_differentiated_points_with_resolution(MaskSpline *spline,
+ const uint resol,
+ const bool do_feather_isect,
+ uint *r_tot_feather_point))[2]
{
switch (spline->offset_mode) {
case MASK_SPLINE_OFFSET_EVEN:
@@ -768,14 +768,11 @@ float (*BKE_mask_spline_feather_points(MaskSpline *spline, int *r_tot_feather_po
return feather;
}
-float *BKE_mask_point_segment_feather_diff(MaskSpline *spline,
- MaskSplinePoint *point,
- int width,
- int height,
- unsigned int *r_tot_feather_point)
+float *BKE_mask_point_segment_feather_diff(
+ MaskSpline *spline, MaskSplinePoint *point, int width, int height, uint *r_tot_feather_point)
{
float *feather, *fp;
- unsigned int resol = BKE_mask_spline_feather_resolution(spline, width, height);
+ uint resol = BKE_mask_spline_feather_resolution(spline, width, height);
feather = fp = MEM_callocN(2 * resol * sizeof(float), "mask point spline feather diff points");
@@ -796,11 +793,8 @@ float *BKE_mask_point_segment_feather_diff(MaskSpline *spline,
return feather;
}
-float *BKE_mask_point_segment_diff(MaskSpline *spline,
- MaskSplinePoint *point,
- int width,
- int height,
- unsigned int *r_tot_diff_point)
+float *BKE_mask_point_segment_diff(
+ MaskSpline *spline, MaskSplinePoint *point, int width, int height, uint *r_tot_diff_point)
{
MaskSplinePoint *points_array = BKE_mask_spline_point_array_from_point(spline, point);
diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c
index 84aabbc7a9b..b9ea3eaba69 100644
--- a/source/blender/blenkernel/intern/mask_rasterize.c
+++ b/source/blender/blenkernel/intern/mask_rasterize.c
@@ -83,17 +83,17 @@
#define BUCKET_PIXELS_PER_CELL 4
#define SF_EDGE_IS_BOUNDARY 0xff
-#define SF_KEYINDEX_TEMP_ID ((unsigned int)-1)
+#define SF_KEYINDEX_TEMP_ID ((uint)-1)
-#define TRI_TERMINATOR_ID ((unsigned int)-1)
-#define TRI_VERT ((unsigned int)-1)
+#define TRI_TERMINATOR_ID ((uint)-1)
+#define TRI_VERT ((uint)-1)
/* for debugging add... */
#ifndef NDEBUG
// printf("%u %u %u %u\n", _t[0], _t[1], _t[2], _t[3]);
# define FACE_ASSERT(face, vert_max) \
{ \
- unsigned int *_t = face; \
+ uint *_t = face; \
BLI_assert(_t[0] < vert_max); \
BLI_assert(_t[1] < vert_max); \
BLI_assert(_t[2] < vert_max); \
@@ -127,9 +127,7 @@ static void rotate_point_v2(
r_p[1] = p_new[1] + cent[1];
}
-BLI_INLINE unsigned int clampis_uint(const unsigned int v,
- const unsigned int min,
- const unsigned int max)
+BLI_INLINE uint clampis_uint(const uint v, const uint min, const uint max)
{
return v < min ? min : (v > max ? max : v);
}
@@ -156,19 +154,19 @@ static ScanFillVert *scanfill_vert_add_v2_with_depth(ScanFillContext *sf_ctx,
/* internal use only */
typedef struct MaskRasterLayer {
/* geometry */
- unsigned int face_tot;
- unsigned int (*face_array)[4]; /* access coords tri/quad */
- float (*face_coords)[3]; /* xy, z 0-1 (1.0 == filled) */
+ uint face_tot;
+ uint (*face_array)[4]; /* access coords tri/quad */
+ float (*face_coords)[3]; /* xy, z 0-1 (1.0 == filled) */
/* 2d bounds (to quickly skip bucket lookup) */
rctf bounds;
/* buckets */
- unsigned int **buckets_face;
+ uint **buckets_face;
/* cache divide and subtract */
float buckets_xy_scalar[2]; /* (1.0 / (buckets_width + FLT_EPSILON)) * buckets_x */
- unsigned int buckets_x;
- unsigned int buckets_y;
+ uint buckets_x;
+ uint buckets_y;
/* copied direct from #MaskLayer.--- */
/* blending options */
@@ -181,12 +179,12 @@ typedef struct MaskRasterLayer {
typedef struct MaskRasterSplineInfo {
/* body of the spline */
- unsigned int vertex_offset;
- unsigned int vertex_total;
+ uint vertex_offset;
+ uint vertex_total;
/* capping for non-filled, non cyclic splines */
- unsigned int vertex_total_cap_head;
- unsigned int vertex_total_cap_tail;
+ uint vertex_total_cap_head;
+ uint vertex_total_cap_tail;
bool is_cyclic;
} MaskRasterSplineInfo;
@@ -196,7 +194,7 @@ typedef struct MaskRasterSplineInfo {
*/
struct MaskRasterHandle {
MaskRasterLayer *layers;
- unsigned int layers_tot;
+ uint layers_tot;
/* 2d bounds (to quickly skip bucket lookup) */
rctf bounds;
@@ -217,7 +215,7 @@ MaskRasterHandle *BKE_maskrasterize_handle_new(void)
void BKE_maskrasterize_handle_free(MaskRasterHandle *mr_handle)
{
- const unsigned int layers_tot = mr_handle->layers_tot;
+ const uint layers_tot = mr_handle->layers_tot;
MaskRasterLayer *layer = mr_handle->layers;
for (uint i = 0; i < layers_tot; i++, layer++) {
@@ -231,10 +229,10 @@ void BKE_maskrasterize_handle_free(MaskRasterHandle *mr_handle)
}
if (layer->buckets_face) {
- const unsigned int bucket_tot = layer->buckets_x * layer->buckets_y;
- unsigned int bucket_index;
+ const uint bucket_tot = layer->buckets_x * layer->buckets_y;
+ uint bucket_index;
for (bucket_index = 0; bucket_index < bucket_tot; bucket_index++) {
- unsigned int *face_index = layer->buckets_face[bucket_index];
+ uint *face_index = layer->buckets_face[bucket_index];
if (face_index) {
MEM_freeN(face_index);
}
@@ -250,15 +248,15 @@ void BKE_maskrasterize_handle_free(MaskRasterHandle *mr_handle)
static void maskrasterize_spline_differentiate_point_outset(float (*diff_feather_points)[2],
float (*diff_points)[2],
- const unsigned int tot_diff_point,
+ const uint tot_diff_point,
const float ofs,
const bool do_test)
{
- unsigned int k_prev = tot_diff_point - 2;
- unsigned int k_curr = tot_diff_point - 1;
- unsigned int k_next = 0;
+ uint k_prev = tot_diff_point - 2;
+ uint k_curr = tot_diff_point - 1;
+ uint k_next = 0;
- unsigned int k;
+ uint k;
float d_prev[2];
float d_next[2];
@@ -320,14 +318,14 @@ static void maskrasterize_spline_differentiate_point_outset(float (*diff_feather
* are to any of the triangle edges.
*/
static bool layer_bucket_isect_test(const MaskRasterLayer *layer,
- unsigned int face_index,
- const unsigned int bucket_x,
- const unsigned int bucket_y,
+ uint face_index,
+ const uint bucket_x,
+ const uint bucket_y,
const float bucket_size_x,
const float bucket_size_y,
const float bucket_max_rad_squared)
{
- unsigned int *face = layer->face_array[face_index];
+ uint *face = layer->face_array[face_index];
float(*cos)[3] = layer->face_coords;
const float xmin = layer->bounds.xmin + (bucket_size_x * (float)bucket_x);
@@ -403,8 +401,8 @@ static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size)
const float bucket_dim_x = BLI_rctf_size_x(&layer->bounds);
const float bucket_dim_y = BLI_rctf_size_y(&layer->bounds);
- layer->buckets_x = (unsigned int)((bucket_dim_x / pixel_size) / (float)BUCKET_PIXELS_PER_CELL);
- layer->buckets_y = (unsigned int)((bucket_dim_y / pixel_size) / (float)BUCKET_PIXELS_PER_CELL);
+ layer->buckets_x = (uint)((bucket_dim_x / pixel_size) / (float)BUCKET_PIXELS_PER_CELL);
+ layer->buckets_y = (uint)((bucket_dim_y / pixel_size) / (float)BUCKET_PIXELS_PER_CELL);
// printf("bucket size %ux%u\n", layer->buckets_x, layer->buckets_y);
@@ -422,14 +420,14 @@ static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size)
FLT_EPSILON;
const float bucket_max_rad_squared = bucket_max_rad * bucket_max_rad;
- unsigned int *face = &layer->face_array[0][0];
+ uint *face = &layer->face_array[0][0];
float(*cos)[3] = layer->face_coords;
- const unsigned int bucket_tot = layer->buckets_x * layer->buckets_y;
+ const uint bucket_tot = layer->buckets_x * layer->buckets_y;
LinkNode **bucketstore = MEM_callocN(bucket_tot * sizeof(LinkNode *), __func__);
- unsigned int *bucketstore_tot = MEM_callocN(bucket_tot * sizeof(unsigned int), __func__);
+ uint *bucketstore_tot = MEM_callocN(bucket_tot * sizeof(uint), __func__);
- unsigned int face_index;
+ uint face_index;
for (face_index = 0; face_index < layer->face_tot; face_index++, face += 4) {
float xmin;
@@ -468,17 +466,13 @@ static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size)
CLAMP(ymax, 0.0f, 1.0f);
{
- unsigned int xi_min = (unsigned int)((xmin - layer->bounds.xmin) *
- layer->buckets_xy_scalar[0]);
- unsigned int xi_max = (unsigned int)((xmax - layer->bounds.xmin) *
- layer->buckets_xy_scalar[0]);
- unsigned int yi_min = (unsigned int)((ymin - layer->bounds.ymin) *
- layer->buckets_xy_scalar[1]);
- unsigned int yi_max = (unsigned int)((ymax - layer->bounds.ymin) *
- layer->buckets_xy_scalar[1]);
+ uint xi_min = (uint)((xmin - layer->bounds.xmin) * layer->buckets_xy_scalar[0]);
+ uint xi_max = (uint)((xmax - layer->bounds.xmin) * layer->buckets_xy_scalar[0]);
+ uint yi_min = (uint)((ymin - layer->bounds.ymin) * layer->buckets_xy_scalar[1]);
+ uint yi_max = (uint)((ymax - layer->bounds.ymin) * layer->buckets_xy_scalar[1]);
void *face_index_void = POINTER_FROM_UINT(face_index);
- unsigned int xi, yi;
+ uint xi, yi;
/* this should _almost_ never happen but since it can in extreme cases,
* we have to clamp the values or we overrun the buffer and crash */
@@ -496,10 +490,10 @@ static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size)
}
for (yi = yi_min; yi <= yi_max; yi++) {
- unsigned int bucket_index = (layer->buckets_x * yi) + xi_min;
+ uint bucket_index = (layer->buckets_x * yi) + xi_min;
for (xi = xi_min; xi <= xi_max; xi++, bucket_index++) {
/* correct but do in outer loop */
- // unsigned int bucket_index = (layer->buckets_x * yi) + xi;
+ // uint bucket_index = (layer->buckets_x * yi) + xi;
BLI_assert(xi < layer->buckets_x);
BLI_assert(yi < layer->buckets_y);
@@ -528,13 +522,12 @@ static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size)
if (1) {
/* now convert linknodes into arrays for faster per pixel access */
- unsigned int **buckets_face = MEM_mallocN(bucket_tot * sizeof(*buckets_face), __func__);
- unsigned int bucket_index;
+ uint **buckets_face = MEM_mallocN(bucket_tot * sizeof(*buckets_face), __func__);
+ uint bucket_index;
for (bucket_index = 0; bucket_index < bucket_tot; bucket_index++) {
if (bucketstore_tot[bucket_index]) {
- unsigned int *bucket = MEM_mallocN(
- (bucketstore_tot[bucket_index] + 1) * sizeof(unsigned int), __func__);
+ uint *bucket = MEM_mallocN((bucketstore_tot[bucket_index] + 1) * sizeof(uint), __func__);
LinkNode *bucket_node;
buckets_face[bucket_index] = bucket;
@@ -577,10 +570,10 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle,
const float zvec[3] = {0.0f, 0.0f, -1.0f};
MaskLayer *masklay;
- unsigned int masklay_index;
+ uint masklay_index;
MemArena *sf_arena;
- mr_handle->layers_tot = (unsigned int)BLI_listbase_count(&mask->masklayers);
+ mr_handle->layers_tot = (uint)BLI_listbase_count(&mask->masklayers);
mr_handle->layers = MEM_mallocN(sizeof(MaskRasterLayer) * mr_handle->layers_tot,
"MaskRasterLayer");
BLI_rctf_init_minmax(&mr_handle->bounds);
@@ -591,9 +584,9 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle,
masklay = masklay->next, masklay_index++) {
/* we need to store vertex ranges for open splines for filling */
- unsigned int tot_splines;
+ uint tot_splines;
MaskRasterSplineInfo *open_spline_ranges;
- unsigned int open_spline_index = 0;
+ uint open_spline_index = 0;
MaskSpline *spline;
@@ -603,12 +596,12 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle,
ScanFillVert *sf_vert_next = NULL;
ScanFillFace *sf_tri;
- unsigned int sf_vert_tot = 0;
- unsigned int tot_feather_quads = 0;
+ uint sf_vert_tot = 0;
+ uint tot_feather_quads = 0;
#ifdef USE_SCANFILL_EDGE_WORKAROUND
- unsigned int tot_boundary_used = 0;
- unsigned int tot_boundary_found = 0;
+ uint tot_boundary_used = 0;
+ uint tot_boundary_found = 0;
#endif
if (masklay->visibility_flag & MASK_HIDE_RENDER) {
@@ -618,7 +611,7 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle,
continue;
}
- tot_splines = (unsigned int)BLI_listbase_count(&masklay->splines);
+ tot_splines = (uint)BLI_listbase_count(&masklay->splines);
open_spline_ranges = MEM_callocN(sizeof(*open_spline_ranges) * tot_splines, __func__);
BLI_scanfill_begin_arena(&sf_ctx, sf_arena);
@@ -628,15 +621,15 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle,
const bool is_fill = (spline->flag & MASK_SPLINE_NOFILL) == 0;
float(*diff_points)[2];
- unsigned int tot_diff_point;
+ uint tot_diff_point;
float(*diff_feather_points)[2];
float(*diff_feather_points_flip)[2];
- unsigned int tot_diff_feather_points;
+ uint tot_diff_feather_points;
- const unsigned int resol_a = BKE_mask_spline_resolution(spline, width, height) / 4;
- const unsigned int resol_b = BKE_mask_spline_feather_resolution(spline, width, height) / 4;
- const unsigned int resol = CLAMPIS(MAX2(resol_a, resol_b), 4, 512);
+ const uint resol_a = BKE_mask_spline_resolution(spline, width, height) / 4;
+ const uint resol_b = BKE_mask_spline_feather_resolution(spline, width, height) / 4;
+ const uint resol = CLAMPIS(MAX2(resol_a, resol_b), 4, 512);
diff_points = BKE_mask_spline_differentiate_with_resolution(spline, resol, &tot_diff_point);
@@ -652,7 +645,7 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle,
if (tot_diff_point > 3) {
ScanFillVert *sf_vert_prev;
- unsigned int j;
+ uint j;
sf_ctx.poly_nr++;
@@ -835,19 +828,18 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle,
const float *fp_cent;
const float *fp_turn;
- unsigned int k;
+ uint k;
fp_cent = diff_points[0];
fp_turn = diff_feather_points[0];
#define CALC_CAP_RESOL \
- clampis_uint( \
- (unsigned int)(len_v2v2(fp_cent, fp_turn) / (pixel_size * SPLINE_RESOL_CAP_PER_PIXEL)), \
- SPLINE_RESOL_CAP_MIN, \
- SPLINE_RESOL_CAP_MAX)
+ clampis_uint((uint)(len_v2v2(fp_cent, fp_turn) / (pixel_size * SPLINE_RESOL_CAP_PER_PIXEL)), \
+ SPLINE_RESOL_CAP_MIN, \
+ SPLINE_RESOL_CAP_MAX)
{
- const unsigned int vertex_total_cap = CALC_CAP_RESOL;
+ const uint vertex_total_cap = CALC_CAP_RESOL;
for (k = 1; k < vertex_total_cap; k++) {
const float angle = (float)k * (1.0f / (float)vertex_total_cap) * (float)M_PI;
@@ -868,7 +860,7 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle,
fp_turn = diff_feather_points[tot_diff_point - 1];
{
- const unsigned int vertex_total_cap = CALC_CAP_RESOL;
+ const uint vertex_total_cap = CALC_CAP_RESOL;
for (k = 1; k < vertex_total_cap; k++) {
const float angle = (float)k * (1.0f / (float)vertex_total_cap) * (float)M_PI;
@@ -905,11 +897,11 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle,
}
{
- unsigned int(*face_array)[4], *face; /* access coords */
- float(*face_coords)[3], *cos; /* xy, z 0-1 (1.0 == filled) */
- unsigned int sf_tri_tot;
+ uint(*face_array)[4], *face; /* access coords */
+ float(*face_coords)[3], *cos; /* xy, z 0-1 (1.0 == filled) */
+ uint sf_tri_tot;
rctf bounds;
- unsigned int face_index;
+ uint face_index;
int scanfill_flag = 0;
bool is_isect = false;
@@ -946,8 +938,8 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle,
if ((masklay->flag & MASK_LAYERFLAG_FILL_OVERLAP) &&
(is_isect = BLI_scanfill_calc_self_isect(
&sf_ctx, &isect_remvertbase, &isect_remedgebase))) {
- unsigned int sf_vert_tot_isect = (unsigned int)BLI_listbase_count(&sf_ctx.fillvertbase);
- unsigned int i = sf_vert_tot;
+ uint sf_vert_tot_isect = (uint)BLI_listbase_count(&sf_ctx.fillvertbase);
+ uint i = sf_vert_tot;
face_coords = MEM_reallocN(face_coords,
sizeof(float[3]) * (sf_vert_tot + sf_vert_tot_isect));
@@ -972,7 +964,7 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle,
scanfill_flag |= BLI_SCANFILL_CALC_HOLES;
}
- sf_tri_tot = (unsigned int)BLI_scanfill_calc_ex(&sf_ctx, scanfill_flag, zvec);
+ sf_tri_tot = (uint)BLI_scanfill_calc_ex(&sf_ctx, scanfill_flag, zvec);
if (is_isect) {
/* add removed data back, we only need edges for feather,
@@ -987,7 +979,7 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle,
face_index = 0;
/* faces */
- face = (unsigned int *)face_array;
+ face = (uint *)face_array;
for (sf_tri = sf_ctx.fillfacebase.first; sf_tri; sf_tri = sf_tri->next) {
*(face++) = sf_tri->v3->tmp.u;
*(face++) = sf_tri->v2->tmp.u;
@@ -1029,13 +1021,11 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle,
/* feather only splines */
while (open_spline_index > 0) {
- const unsigned int vertex_offset = open_spline_ranges[--open_spline_index].vertex_offset;
- unsigned int vertex_total = open_spline_ranges[open_spline_index].vertex_total;
- unsigned int vertex_total_cap_head =
- open_spline_ranges[open_spline_index].vertex_total_cap_head;
- unsigned int vertex_total_cap_tail =
- open_spline_ranges[open_spline_index].vertex_total_cap_tail;
- unsigned int k, j;
+ const uint vertex_offset = open_spline_ranges[--open_spline_index].vertex_offset;
+ uint vertex_total = open_spline_ranges[open_spline_index].vertex_total;
+ uint vertex_total_cap_head = open_spline_ranges[open_spline_index].vertex_total_cap_head;
+ uint vertex_total_cap_tail = open_spline_ranges[open_spline_index].vertex_total_cap_tail;
+ uint k, j;
j = vertex_offset;
@@ -1075,7 +1065,7 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle,
FACE_ASSERT(face - 4, sf_vert_tot);
}
else {
- unsigned int midvidx = vertex_offset;
+ uint midvidx = vertex_offset;
/***************
* cap end 'a' */
@@ -1229,7 +1219,7 @@ static float maskrasterize_layer_z_depth_quad(
return w[2] + w[3]; /* we can make this assumption for small speedup */
}
-static float maskrasterize_layer_isect(const unsigned int *face,
+static float maskrasterize_layer_isect(const uint *face,
float (*cos)[3],
const float dist_orig,
const float xy[2])
@@ -1288,22 +1278,21 @@ static float maskrasterize_layer_isect(const unsigned int *face,
return 1.0f;
}
-BLI_INLINE unsigned int layer_bucket_index_from_xy(MaskRasterLayer *layer, const float xy[2])
+BLI_INLINE uint layer_bucket_index_from_xy(MaskRasterLayer *layer, const float xy[2])
{
BLI_assert(BLI_rctf_isect_pt_v(&layer->bounds, xy));
- return ((unsigned int)((xy[0] - layer->bounds.xmin) * layer->buckets_xy_scalar[0])) +
- (((unsigned int)((xy[1] - layer->bounds.ymin) * layer->buckets_xy_scalar[1])) *
- layer->buckets_x);
+ return ((uint)((xy[0] - layer->bounds.xmin) * layer->buckets_xy_scalar[0])) +
+ (((uint)((xy[1] - layer->bounds.ymin) * layer->buckets_xy_scalar[1])) * layer->buckets_x);
}
static float layer_bucket_depth_from_xy(MaskRasterLayer *layer, const float xy[2])
{
- unsigned int index = layer_bucket_index_from_xy(layer, xy);
- unsigned int *face_index = layer->buckets_face[index];
+ uint index = layer_bucket_index_from_xy(layer, xy);
+ uint *face_index = layer->buckets_face[index];
if (face_index) {
- unsigned int(*face_array)[4] = layer->face_array;
+ uint(*face_array)[4] = layer->face_array;
float(*cos)[3] = layer->face_coords;
float best_dist = 1.0f;
while (*face_index != TRI_TERMINATOR_ID) {
@@ -1330,7 +1319,7 @@ float BKE_maskrasterize_handle_sample(MaskRasterHandle *mr_handle, const float x
/* can't do this because some layers may invert */
/* if (BLI_rctf_isect_pt_v(&mr_handle->bounds, xy)) */
- const unsigned int layers_tot = mr_handle->layers_tot;
+ const uint layers_tot = mr_handle->layers_tot;
MaskRasterLayer *layer = mr_handle->layers;
/* return value */
@@ -1455,8 +1444,8 @@ static void maskrasterize_buffer_cb(void *__restrict userdata,
}
void BKE_maskrasterize_buffer(MaskRasterHandle *mr_handle,
- const unsigned int width,
- const unsigned int height,
+ const uint width,
+ const uint height,
/* Cannot be const, because it is assigned to non-const variable.
* NOLINTNEXTLINE: readability-non-const-parameter. */
float *buffer)
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 3ea6dd3d735..6c6d2298dbd 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -1069,7 +1069,7 @@ void BKE_object_material_assign_single_obdata(struct Main *bmain,
object_material_assign(bmain, ob, ma, act, BKE_MAT_ASSIGN_OBDATA, false);
}
-void BKE_object_material_remap(Object *ob, const unsigned int *remap)
+void BKE_object_material_remap(Object *ob, const uint *remap)
{
Material ***matar = BKE_object_material_array_p(ob);
const short *totcol_p = BKE_object_material_len_p(ob);
diff --git a/source/blender/blenkernel/intern/mball.cc b/source/blender/blenkernel/intern/mball.cc
index 91797f8ed2f..7c83bed85b0 100644
--- a/source/blender/blenkernel/intern/mball.cc
+++ b/source/blender/blenkernel/intern/mball.cc
@@ -529,7 +529,7 @@ bool BKE_mball_center_median(const MetaBall *mb, float r_cent[3])
}
if (total) {
- mul_v3_fl(r_cent, 1.0f / (float)total);
+ mul_v3_fl(r_cent, 1.0f / float(total));
}
return (total != 0);
diff --git a/source/blender/blenkernel/intern/mball_tessellate.c b/source/blender/blenkernel/intern/mball_tessellate.c
index 48fadd2e9b8..1bb50c2c97f 100644
--- a/source/blender/blenkernel/intern/mball_tessellate.c
+++ b/source/blender/blenkernel/intern/mball_tessellate.c
@@ -93,32 +93,32 @@ typedef struct MetaballBVHNode { /* BVH node */
struct MetaballBVHNode *child[2];
} MetaballBVHNode;
-typedef struct process { /* parameters, storage */
- float thresh, size; /* mball threshold, single cube size */
- float delta; /* small delta for calculating normals */
- unsigned int converge_res; /* converge procedure resolution (more = slower) */
+typedef struct process { /* parameters, storage */
+ float thresh, size; /* mball threshold, single cube size */
+ float delta; /* small delta for calculating normals */
+ uint converge_res; /* converge procedure resolution (more = slower) */
- MetaElem **mainb; /* array of all metaelems */
- unsigned int totelem, mem; /* number of metaelems */
+ MetaElem **mainb; /* array of all metaelems */
+ uint totelem, mem; /* number of metaelems */
MetaballBVHNode metaball_bvh; /* The simplest bvh */
Box allbb; /* Bounding box of all metaelems */
MetaballBVHNode **bvh_queue; /* Queue used during bvh traversal */
- unsigned int bvh_queue_size;
+ uint bvh_queue_size;
CUBES *cubes; /* stack of cubes waiting for polygonization */
CENTERLIST **centers; /* cube center hash table */
CORNER **corners; /* corner value hash table */
EDGELIST **edges; /* edge and vertex id hash table */
- int (*indices)[4]; /* output indices */
- unsigned int totindex; /* size of memory allocated for indices */
- unsigned int curindex; /* number of currently added indices */
+ int (*indices)[4]; /* output indices */
+ uint totindex; /* size of memory allocated for indices */
+ uint curindex; /* number of currently added indices */
float (*co)[3], (*no)[3]; /* surface vertices - positions and normals */
- unsigned int totvertex; /* memory size */
- unsigned int curvertex; /* currently added vertices */
+ uint totvertex; /* memory size */
+ uint curvertex; /* currently added vertices */
/* memory allocation from common pool */
MemArena *pgn_elements;
@@ -155,10 +155,9 @@ static void make_box_from_metaelem(Box *r, const MetaElem *ml)
* where centroids of elements in the [start, i) segment lie "on the right side" of div,
* and elements in the [i, end) segment lie "on the left"
*/
-static unsigned int partition_mainb(
- MetaElem **mainb, unsigned int start, unsigned int end, unsigned int s, float div)
+static uint partition_mainb(MetaElem **mainb, uint start, uint end, uint s, float div)
{
- unsigned int i = start, j = end - 1;
+ uint i = start, j = end - 1;
div *= 2.0f;
while (1) {
@@ -188,13 +187,10 @@ static unsigned int partition_mainb(
/**
* Recursively builds a BVH, dividing elements along the middle of the longest axis of allbox.
*/
-static void build_bvh_spatial(PROCESS *process,
- MetaballBVHNode *node,
- unsigned int start,
- unsigned int end,
- const Box *allbox)
+static void build_bvh_spatial(
+ PROCESS *process, MetaballBVHNode *node, uint start, uint end, const Box *allbox)
{
- unsigned int part, j, s;
+ uint part, j, s;
float dim[3], div;
/* Maximum bvh queue size is number of nodes which are made, equals calls to this function. */
@@ -401,7 +397,7 @@ static float densfunc(const MetaElem *ball, float x, float y, float z)
static float metaball(PROCESS *process, float x, float y, float z)
{
float dens = 0.0f;
- unsigned int front = 0, back = 0;
+ uint front = 0, back = 0;
MetaballBVHNode *node;
process->bvh_queue[front++] = &process->metaball_bvh;
@@ -1080,7 +1076,7 @@ static void closest_latice(int r[3], const float pos[3], const float size)
/**
* Find at most 26 cubes to start polygonization from.
*/
-static void find_first_points(PROCESS *process, const unsigned int em)
+static void find_first_points(PROCESS *process, const uint em)
{
const MetaElem *ml;
int center[3], lbn[3], rtf[3], it[3], dir[3], add[3];
@@ -1168,7 +1164,7 @@ static void init_meta(Depsgraph *depsgraph, PROCESS *process, Scene *scene, Obje
MetaBall *mb;
const MetaElem *ml;
float obinv[4][4], obmat[4][4];
- unsigned int i;
+ uint i;
int obnr, zero_size = 0;
char obname[MAX_ID_NAME];
SceneBaseIter iter;
diff --git a/source/blender/blenkernel/intern/mesh.cc b/source/blender/blenkernel/intern/mesh.cc
index 6df6cd31cf4..7079a3e1ae8 100644
--- a/source/blender/blenkernel/intern/mesh.cc
+++ b/source/blender/blenkernel/intern/mesh.cc
@@ -1396,7 +1396,7 @@ void BKE_mesh_material_remap(Mesh *me, const uint *remap, uint remap_len)
{
using namespace blender;
using namespace blender::bke;
- const short remap_len_short = (short)remap_len;
+ const short remap_len_short = short(remap_len);
#define MAT_NR_REMAP(n) \
if (n < remap_len_short) { \
@@ -1832,7 +1832,7 @@ void BKE_mesh_calc_normals_split_ex(Mesh *mesh,
* only in case auto-smooth is enabled. */
const bool use_split_normals = (r_lnors_spacearr != nullptr) ||
((mesh->flag & ME_AUTOSMOOTH) != 0);
- const float split_angle = (mesh->flag & ME_AUTOSMOOTH) != 0 ? mesh->smoothresh : (float)M_PI;
+ const float split_angle = (mesh->flag & ME_AUTOSMOOTH) != 0 ? mesh->smoothresh : float(M_PI);
/* may be nullptr */
clnors = (short(*)[2])CustomData_get_layer(&mesh->ldata, CD_CUSTOMLOOPNORMAL);
diff --git a/source/blender/blenkernel/intern/mesh_boolean_convert.cc b/source/blender/blenkernel/intern/mesh_boolean_convert.cc
index be6c27ee6f9..360c7da2ae2 100644
--- a/source/blender/blenkernel/intern/mesh_boolean_convert.cc
+++ b/source/blender/blenkernel/intern/mesh_boolean_convert.cc
@@ -114,7 +114,7 @@ class MeshesToIMeshInfo {
* input `Mesh` that contained the `MVert` that it came from. */
int MeshesToIMeshInfo::input_mesh_for_imesh_vert(int imesh_v) const
{
- int n = static_cast<int>(mesh_vert_offset.size());
+ int n = int(mesh_vert_offset.size());
for (int i = 0; i < n - 1; ++i) {
if (imesh_v < mesh_vert_offset[i + 1]) {
return i;
@@ -127,7 +127,7 @@ int MeshesToIMeshInfo::input_mesh_for_imesh_vert(int imesh_v) const
* return the index of the input `Mesh` that contained the `MVert` that it came from. */
int MeshesToIMeshInfo::input_mesh_for_imesh_edge(int imesh_e) const
{
- int n = static_cast<int>(mesh_edge_offset.size());
+ int n = int(mesh_edge_offset.size());
for (int i = 0; i < n - 1; ++i) {
if (imesh_e < mesh_edge_offset[i + 1]) {
return i;
@@ -140,7 +140,7 @@ int MeshesToIMeshInfo::input_mesh_for_imesh_edge(int imesh_e) const
* input `Mesh` that contained the `MPoly` that it came from. */
int MeshesToIMeshInfo::input_mesh_for_imesh_face(int imesh_f) const
{
- int n = static_cast<int>(mesh_poly_offset.size());
+ int n = int(mesh_poly_offset.size());
for (int i = 0; i < n - 1; ++i) {
if (imesh_f < mesh_poly_offset[i + 1]) {
return i;
@@ -831,7 +831,7 @@ Mesh *direct_mesh_boolean(Span<const Mesh *> meshes,
return mi;
}
}
- return static_cast<int>(mim.mesh_poly_offset.size()) - 1;
+ return int(mim.mesh_poly_offset.size()) - 1;
};
IMesh m_out = boolean_mesh(m_in,
static_cast<BoolOpType>(boolean_mode),
diff --git a/source/blender/blenkernel/intern/mesh_calc_edges.cc b/source/blender/blenkernel/intern/mesh_calc_edges.cc
index 038133c33ae..5e6babdf7b4 100644
--- a/source/blender/blenkernel/intern/mesh_calc_edges.cc
+++ b/source/blender/blenkernel/intern/mesh_calc_edges.cc
@@ -35,8 +35,7 @@ struct OrderedEdge {
}
}
- OrderedEdge(const uint v1, const uint v2)
- : OrderedEdge(static_cast<int>(v1), static_cast<int>(v2))
+ OrderedEdge(const uint v1, const uint v2) : OrderedEdge(int(v1), int(v2))
{
}
@@ -217,7 +216,7 @@ void BKE_mesh_calc_edges(Mesh *mesh, bool keep_existing_edges, const bool select
* Each edge is assigned to one of the hash maps based on the lower bits of a hash value. */
const int parallel_maps = get_parallel_maps_count(mesh);
BLI_assert(is_power_of_2_i(parallel_maps));
- const uint32_t parallel_mask = static_cast<uint32_t>(parallel_maps) - 1;
+ const uint32_t parallel_mask = uint32_t(parallel_maps) - 1;
Array<EdgeMap> edge_maps(parallel_maps);
reserve_hash_maps(mesh, keep_existing_edges, edge_maps);
diff --git a/source/blender/blenkernel/intern/mesh_convert.cc b/source/blender/blenkernel/intern/mesh_convert.cc
index 1ad74ef693a..4c6ecff60ad 100644
--- a/source/blender/blenkernel/intern/mesh_convert.cc
+++ b/source/blender/blenkernel/intern/mesh_convert.cc
@@ -274,13 +274,13 @@ static Mesh *mesh_nurbs_displist_to_mesh(const Curve *cu, const ListBase *dispba
mloop[0].v = startvert + index[0];
mloop[1].v = startvert + index[2];
mloop[2].v = startvert + index[1];
- mpoly->loopstart = (int)(mloop - loops.data());
+ mpoly->loopstart = int(mloop - loops.data());
mpoly->totloop = 3;
material_indices.span[mpoly - polys.data()] = dl->col;
if (mloopuv) {
for (int i = 0; i < 3; i++, mloopuv++) {
- mloopuv->uv[0] = (mloop[i].v - startvert) / (float)(dl->nr - 1);
+ mloopuv->uv[0] = (mloop[i].v - startvert) / float(dl->nr - 1);
mloopuv->uv[1] = 0.0f;
}
}
@@ -334,7 +334,7 @@ static Mesh *mesh_nurbs_displist_to_mesh(const Curve *cu, const ListBase *dispba
mloop[1].v = p3;
mloop[2].v = p4;
mloop[3].v = p2;
- mpoly->loopstart = (int)(mloop - loops.data());
+ mpoly->loopstart = int(mloop - loops.data());
mpoly->totloop = 4;
material_indices.span[mpoly - polys.data()] = dl->col;
@@ -357,14 +357,14 @@ static Mesh *mesh_nurbs_displist_to_mesh(const Curve *cu, const ListBase *dispba
/* find uv based on vertex index into grid array */
int v = mloop[i].v - startvert;
- mloopuv->uv[0] = (v / dl->nr) / (float)orco_sizev;
- mloopuv->uv[1] = (v % dl->nr) / (float)orco_sizeu;
+ mloopuv->uv[0] = (v / dl->nr) / float(orco_sizev);
+ mloopuv->uv[1] = (v % dl->nr) / float(orco_sizeu);
/* cyclic correction */
- if ((ELEM(i, 1, 2)) && mloopuv->uv[0] == 0.0f) {
+ if (ELEM(i, 1, 2) && mloopuv->uv[0] == 0.0f) {
mloopuv->uv[0] = 1.0f;
}
- if ((ELEM(i, 0, 1)) && mloopuv->uv[1] == 0.0f) {
+ if (ELEM(i, 0, 1) && mloopuv->uv[1] == 0.0f) {
mloopuv->uv[1] = 1.0f;
}
}
@@ -1133,11 +1133,11 @@ static void add_shapekey_layers(Mesh *mesh_dest, Mesh *mesh_src)
mesh_src->totvert,
kb->name,
kb->totelem);
- array = (float *)MEM_calloc_arrayN((size_t)mesh_src->totvert, sizeof(float[3]), __func__);
+ array = (float *)MEM_calloc_arrayN(size_t(mesh_src->totvert), sizeof(float[3]), __func__);
}
else {
- array = (float *)MEM_malloc_arrayN((size_t)mesh_src->totvert, sizeof(float[3]), __func__);
- memcpy(array, kb->data, sizeof(float[3]) * (size_t)mesh_src->totvert);
+ array = (float *)MEM_malloc_arrayN(size_t(mesh_src->totvert), sizeof(float[3]), __func__);
+ memcpy(array, kb->data, sizeof(float[3]) * size_t(mesh_src->totvert));
}
CustomData_add_layer_named(
diff --git a/source/blender/blenkernel/intern/mesh_evaluate.cc b/source/blender/blenkernel/intern/mesh_evaluate.cc
index 4f8391263a1..ae0d5efa112 100644
--- a/source/blender/blenkernel/intern/mesh_evaluate.cc
+++ b/source/blender/blenkernel/intern/mesh_evaluate.cc
@@ -150,7 +150,7 @@ static void mesh_calc_ngon_center(const MPoly *mpoly,
const MVert *mvert,
float cent[3])
{
- const float w = 1.0f / (float)mpoly->totloop;
+ const float w = 1.0f / float(mpoly->totloop);
zero_v3(cent);
@@ -190,7 +190,7 @@ float BKE_mesh_calc_poly_area(const MPoly *mpoly, const MLoop *loopstart, const
}
const MLoop *l_iter = loopstart;
- float(*vertexcos)[3] = (float(*)[3])BLI_array_alloca(vertexcos, (size_t)mpoly->totloop);
+ float(*vertexcos)[3] = (float(*)[3])BLI_array_alloca(vertexcos, size_t(mpoly->totloop));
/* pack vertex cos into an array for area_poly_v3 */
for (int i = 0; i < mpoly->totloop; i++, l_iter++) {
@@ -198,7 +198,7 @@ float BKE_mesh_calc_poly_area(const MPoly *mpoly, const MLoop *loopstart, const
}
/* finally calculate the area */
- float area = area_poly_v3((const float(*)[3])vertexcos, (uint)mpoly->totloop);
+ float area = area_poly_v3((const float(*)[3])vertexcos, uint(mpoly->totloop));
return area;
}
@@ -221,7 +221,7 @@ float BKE_mesh_calc_poly_uv_area(const MPoly *mpoly, const MLoopUV *uv_array)
int i, l_iter = mpoly->loopstart;
float area;
- float(*vertexcos)[2] = (float(*)[2])BLI_array_alloca(vertexcos, (size_t)mpoly->totloop);
+ float(*vertexcos)[2] = (float(*)[2])BLI_array_alloca(vertexcos, size_t(mpoly->totloop));
/* pack vertex cos into an array for area_poly_v2 */
for (i = 0; i < mpoly->totloop; i++, l_iter++) {
@@ -229,7 +229,7 @@ float BKE_mesh_calc_poly_uv_area(const MPoly *mpoly, const MLoopUV *uv_array)
}
/* finally calculate the area */
- area = area_poly_v2(vertexcos, (uint)mpoly->totloop);
+ area = area_poly_v2(vertexcos, uint(mpoly->totloop));
return area;
}
@@ -407,7 +407,7 @@ bool BKE_mesh_center_median(const Mesh *me, float r_cent[3])
}
/* otherwise we get NAN for 0 verts */
if (me->totvert) {
- mul_v3_fl(r_cent, 1.0f / (float)me->totvert);
+ mul_v3_fl(r_cent, 1.0f / float(me->totvert));
}
return (me->totvert != 0);
}
@@ -428,7 +428,7 @@ bool BKE_mesh_center_median_from_polys(const Mesh *me, float r_cent[3])
}
/* otherwise we get NAN for 0 verts */
if (me->totpoly) {
- mul_v3_fl(r_cent, 1.0f / (float)tot);
+ mul_v3_fl(r_cent, 1.0f / float(tot));
}
return (me->totpoly != 0);
}
@@ -638,7 +638,7 @@ void BKE_mesh_mdisp_flip(MDisps *md, const bool use_loop_mdisp_flip)
return;
}
- const int sides = (int)sqrt(md->totdisp);
+ const int sides = int(sqrt(md->totdisp));
float(*co)[3] = md->disps;
for (int x = 0; x < sides; x++) {
@@ -922,9 +922,9 @@ void BKE_mesh_calc_relative_deform(const MPoly *mpoly,
const MPoly *mp;
int i;
- int *vert_accum = (int *)MEM_calloc_arrayN((size_t)totvert, sizeof(*vert_accum), __func__);
+ int *vert_accum = (int *)MEM_calloc_arrayN(size_t(totvert), sizeof(*vert_accum), __func__);
- memset(vert_cos_new, '\0', sizeof(*vert_cos_new) * (size_t)totvert);
+ memset(vert_cos_new, '\0', sizeof(*vert_cos_new) * size_t(totvert));
for (i = 0, mp = mpoly; i < totpoly; i++, mp++) {
const MLoop *loopstart = mloop + mp->loopstart;
@@ -952,7 +952,7 @@ void BKE_mesh_calc_relative_deform(const MPoly *mpoly,
for (i = 0; i < totvert; i++) {
if (vert_accum[i]) {
- mul_v3_fl(vert_cos_new[i], 1.0f / (float)vert_accum[i]);
+ mul_v3_fl(vert_cos_new[i], 1.0f / float(vert_accum[i]));
}
else {
copy_v3_v3(vert_cos_new[i], vert_cos_org[i]);
diff --git a/source/blender/blenkernel/intern/mesh_fair.cc b/source/blender/blenkernel/intern/mesh_fair.cc
index 41dcb3501cc..bb0a5610cf4 100644
--- a/source/blender/blenkernel/intern/mesh_fair.cc
+++ b/source/blender/blenkernel/intern/mesh_fair.cc
@@ -82,7 +82,7 @@ class FairingContext {
LoopWeight *loop_weight)
{
- fair_verts_ex(affected, (int)depth, vertex_weight, loop_weight);
+ fair_verts_ex(affected, int(depth), vertex_weight, loop_weight);
}
protected:
diff --git a/source/blender/blenkernel/intern/mesh_legacy_convert.cc b/source/blender/blenkernel/intern/mesh_legacy_convert.cc
index 2c75c477b9a..b68117b7eb2 100644
--- a/source/blender/blenkernel/intern/mesh_legacy_convert.cc
+++ b/source/blender/blenkernel/intern/mesh_legacy_convert.cc
@@ -110,24 +110,24 @@ static void bm_corners_to_loops_ex(ID *id,
BLI_assert(fd->totdisp == 0);
}
else {
- const int side = (int)sqrtf((float)(fd->totdisp / corners));
+ const int side = int(sqrtf(float(fd->totdisp / corners)));
const int side_sq = side * side;
for (int i = 0; i < tot; i++, disps += side_sq, ld++) {
ld->totdisp = side_sq;
- ld->level = (int)(logf((float)side - 1.0f) / (float)M_LN2) + 1;
+ ld->level = int(logf(float(side) - 1.0f) / float(M_LN2)) + 1;
if (ld->disps) {
MEM_freeN(ld->disps);
}
ld->disps = (float(*)[3])MEM_malloc_arrayN(
- (size_t)side_sq, sizeof(float[3]), "converted loop mdisps");
+ size_t(side_sq), sizeof(float[3]), "converted loop mdisps");
if (fd->disps) {
- memcpy(ld->disps, disps, (size_t)side_sq * sizeof(float[3]));
+ memcpy(ld->disps, disps, size_t(side_sq) * sizeof(float[3]));
}
else {
- memset(ld->disps, 0, (size_t)side_sq * sizeof(float[3]));
+ memset(ld->disps, 0, size_t(side_sq) * sizeof(float[3]));
}
}
}
@@ -212,7 +212,7 @@ static void convert_mfaces_to_mpolys(ID *id,
CustomData_external_read(fdata, id, CD_MASK_MDISPS, totface_i);
}
- eh = BLI_edgehash_new_ex(__func__, (uint)totedge_i);
+ eh = BLI_edgehash_new_ex(__func__, uint(totedge_i));
/* build edge hash */
me = medge;
@@ -609,15 +609,15 @@ static int mesh_tessface_calc(CustomData *fdata,
* if all faces are triangles it will be correct, `quads == 2x` allocations. */
/* Take care since memory is _not_ zeroed so be sure to initialize each field. */
mface_to_poly_map = (int *)MEM_malloc_arrayN(
- (size_t)looptri_num, sizeof(*mface_to_poly_map), __func__);
- mface = (MFace *)MEM_malloc_arrayN((size_t)looptri_num, sizeof(*mface), __func__);
- lindices = (uint(*)[4])MEM_malloc_arrayN((size_t)looptri_num, sizeof(*lindices), __func__);
+ size_t(looptri_num), sizeof(*mface_to_poly_map), __func__);
+ mface = (MFace *)MEM_malloc_arrayN(size_t(looptri_num), sizeof(*mface), __func__);
+ lindices = (uint(*)[4])MEM_malloc_arrayN(size_t(looptri_num), sizeof(*lindices), __func__);
mface_index = 0;
mp = mpoly;
for (poly_index = 0; poly_index < totpoly; poly_index++, mp++) {
- const uint mp_loopstart = (uint)mp->loopstart;
- const uint mp_totloop = (uint)mp->totloop;
+ const uint mp_loopstart = uint(mp->loopstart);
+ const uint mp_totloop = uint(mp->totloop);
uint l1, l2, l3, l4;
uint *lidx;
if (mp_totloop < 3) {
@@ -701,8 +701,8 @@ static int mesh_tessface_calc(CustomData *fdata,
arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__);
}
- tris = (uint(*)[3])BLI_memarena_alloc(arena, sizeof(*tris) * (size_t)totfilltri);
- projverts = (float(*)[2])BLI_memarena_alloc(arena, sizeof(*projverts) * (size_t)mp_totloop);
+ tris = (uint(*)[3])BLI_memarena_alloc(arena, sizeof(*tris) * size_t(totfilltri));
+ projverts = (float(*)[2])BLI_memarena_alloc(arena, sizeof(*projverts) * size_t(mp_totloop));
zero_v3(normal);
@@ -774,9 +774,9 @@ static int mesh_tessface_calc(CustomData *fdata,
/* Not essential but without this we store over-allocated memory in the #CustomData layers. */
if (LIKELY(looptri_num != totface)) {
- mface = (MFace *)MEM_reallocN(mface, sizeof(*mface) * (size_t)totface);
+ mface = (MFace *)MEM_reallocN(mface, sizeof(*mface) * size_t(totface));
mface_to_poly_map = (int *)MEM_reallocN(mface_to_poly_map,
- sizeof(*mface_to_poly_map) * (size_t)totface);
+ sizeof(*mface_to_poly_map) * size_t(totface));
}
CustomData_add_layer(fdata, CD_MFACE, CD_ASSIGN, mface, totface);
diff --git a/source/blender/blenkernel/intern/mesh_mapping.cc b/source/blender/blenkernel/intern/mesh_mapping.cc
index b612564ef09..2db0adce033 100644
--- a/source/blender/blenkernel/intern/mesh_mapping.cc
+++ b/source/blender/blenkernel/intern/mesh_mapping.cc
@@ -64,7 +64,7 @@ UvVertMap *BKE_mesh_uv_vert_map_create(const MPoly *mpoly,
}
vmap = (UvVertMap *)MEM_callocN(sizeof(*vmap), "UvVertMap");
- buf = vmap->buf = (UvMapVert *)MEM_callocN(sizeof(*vmap->buf) * (size_t)totuv, "UvMapVert");
+ buf = vmap->buf = (UvMapVert *)MEM_callocN(sizeof(*vmap->buf) * size_t(totuv), "UvMapVert");
vmap->vert = (UvMapVert **)MEM_callocN(sizeof(*vmap->vert) * totvert, "UvMapVert*");
if (use_winding) {
winding = static_cast<bool *>(MEM_callocN(sizeof(*winding) * totpoly, "winding"));
@@ -81,13 +81,13 @@ UvVertMap *BKE_mesh_uv_vert_map_create(const MPoly *mpoly,
float(*tf_uv)[2] = NULL;
if (use_winding) {
- tf_uv = (float(*)[2])BLI_buffer_reinit_data(&tf_uv_buf, vec2f, (size_t)mp->totloop);
+ tf_uv = (float(*)[2])BLI_buffer_reinit_data(&tf_uv_buf, vec2f, size_t(mp->totloop));
}
nverts = mp->totloop;
for (i = 0; i < nverts; i++) {
- buf->loop_of_poly_index = (unsigned short)i;
+ buf->loop_of_poly_index = ushort(i);
buf->poly_index = a;
buf->separate = 0;
buf->next = vmap->vert[mloop[mp->loopstart + i].v];
@@ -101,7 +101,7 @@ UvVertMap *BKE_mesh_uv_vert_map_create(const MPoly *mpoly,
}
if (use_winding) {
- winding[a] = cross_poly_v2(tf_uv, (uint)nverts) > 0;
+ winding[a] = cross_poly_v2(tf_uv, uint(nverts)) > 0;
}
}
}
@@ -196,11 +196,11 @@ static void mesh_vert_poly_or_loop_map_create(MeshElemMap **r_map,
int totloop,
const bool do_loops)
{
- MeshElemMap *map = MEM_cnew_array<MeshElemMap>((size_t)totvert, __func__);
+ MeshElemMap *map = MEM_cnew_array<MeshElemMap>(size_t(totvert), __func__);
int *indices, *index_iter;
int i, j;
- indices = static_cast<int *>(MEM_mallocN(sizeof(int) * (size_t)totloop, __func__));
+ indices = static_cast<int *>(MEM_mallocN(sizeof(int) * size_t(totloop), __func__));
index_iter = indices;
/* Count number of polys for each vertex */
@@ -268,8 +268,8 @@ void BKE_mesh_vert_looptri_map_create(MeshElemMap **r_map,
const MLoop *mloop,
const int UNUSED(totloop))
{
- MeshElemMap *map = MEM_cnew_array<MeshElemMap>((size_t)totvert, __func__);
- int *indices = static_cast<int *>(MEM_mallocN(sizeof(int) * (size_t)totlooptri * 3, __func__));
+ MeshElemMap *map = MEM_cnew_array<MeshElemMap>(size_t(totvert), __func__);
+ int *indices = static_cast<int *>(MEM_mallocN(sizeof(int) * size_t(totlooptri) * 3, __func__));
int *index_step;
const MLoopTri *mlt;
int i;
@@ -306,8 +306,8 @@ void BKE_mesh_vert_looptri_map_create(MeshElemMap **r_map,
void BKE_mesh_vert_edge_map_create(
MeshElemMap **r_map, int **r_mem, const MEdge *medge, int totvert, int totedge)
{
- MeshElemMap *map = MEM_cnew_array<MeshElemMap>((size_t)totvert, __func__);
- int *indices = static_cast<int *>(MEM_mallocN(sizeof(int[2]) * (size_t)totedge, __func__));
+ MeshElemMap *map = MEM_cnew_array<MeshElemMap>(size_t(totvert), __func__);
+ int *indices = static_cast<int *>(MEM_mallocN(sizeof(int[2]) * size_t(totedge), __func__));
int *i_pt = indices;
int i;
@@ -345,8 +345,8 @@ void BKE_mesh_vert_edge_map_create(
void BKE_mesh_vert_edge_vert_map_create(
MeshElemMap **r_map, int **r_mem, const MEdge *medge, int totvert, int totedge)
{
- MeshElemMap *map = MEM_cnew_array<MeshElemMap>((size_t)totvert, __func__);
- int *indices = static_cast<int *>(MEM_mallocN(sizeof(int[2]) * (size_t)totedge, __func__));
+ MeshElemMap *map = MEM_cnew_array<MeshElemMap>(size_t(totvert), __func__);
+ int *indices = static_cast<int *>(MEM_mallocN(sizeof(int[2]) * size_t(totedge), __func__));
int *i_pt = indices;
int i;
@@ -370,8 +370,8 @@ void BKE_mesh_vert_edge_vert_map_create(
for (i = 0; i < totedge; i++) {
const uint v[2] = {medge[i].v1, medge[i].v2};
- map[v[0]].indices[map[v[0]].count] = (int)v[1];
- map[v[1]].indices[map[v[1]].count] = (int)v[0];
+ map[v[0]].indices[map[v[0]].count] = int(v[1]);
+ map[v[1]].indices[map[v[1]].count] = int(v[0]);
map[v[0]].count++;
map[v[1]].count++;
@@ -390,8 +390,8 @@ void BKE_mesh_edge_loop_map_create(MeshElemMap **r_map,
const MLoop *mloop,
const int totloop)
{
- MeshElemMap *map = MEM_cnew_array<MeshElemMap>((size_t)totedge, __func__);
- int *indices = static_cast<int *>(MEM_mallocN(sizeof(int) * (size_t)totloop * 2, __func__));
+ MeshElemMap *map = MEM_cnew_array<MeshElemMap>(size_t(totedge), __func__);
+ int *indices = static_cast<int *>(MEM_mallocN(sizeof(int) * size_t(totloop) * 2, __func__));
int *index_step;
const MPoly *mp;
int i;
@@ -443,8 +443,8 @@ void BKE_mesh_edge_poly_map_create(MeshElemMap **r_map,
const MLoop *mloop,
const int totloop)
{
- MeshElemMap *map = MEM_cnew_array<MeshElemMap>((size_t)totedge, __func__);
- int *indices = static_cast<int *>(MEM_mallocN(sizeof(int) * (size_t)totloop, __func__));
+ MeshElemMap *map = MEM_cnew_array<MeshElemMap>(size_t(totedge), __func__);
+ int *indices = static_cast<int *>(MEM_mallocN(sizeof(int) * size_t(totloop), __func__));
int *index_step;
const MPoly *mp;
int i;
@@ -488,8 +488,8 @@ void BKE_mesh_origindex_map_create(MeshElemMap **r_map,
const int *final_origindex,
const int totfinal)
{
- MeshElemMap *map = MEM_cnew_array<MeshElemMap>((size_t)totsource, __func__);
- int *indices = static_cast<int *>(MEM_mallocN(sizeof(int) * (size_t)totfinal, __func__));
+ MeshElemMap *map = MEM_cnew_array<MeshElemMap>(size_t(totsource), __func__);
+ int *indices = static_cast<int *>(MEM_mallocN(sizeof(int) * size_t(totfinal), __func__));
int *index_step;
int i;
@@ -530,8 +530,8 @@ void BKE_mesh_origindex_map_create_looptri(MeshElemMap **r_map,
const MLoopTri *looptri,
const int looptri_num)
{
- MeshElemMap *map = MEM_cnew_array<MeshElemMap>((size_t)mpoly_num, __func__);
- int *indices = static_cast<int *>(MEM_mallocN(sizeof(int) * (size_t)looptri_num, __func__));
+ MeshElemMap *map = MEM_cnew_array<MeshElemMap>(size_t(mpoly_num), __func__);
+ int *indices = static_cast<int *>(MEM_mallocN(sizeof(int) * size_t(looptri_num), __func__));
int *index_step;
int i;
@@ -623,8 +623,8 @@ static void poly_edge_loop_islands_calc(const MEdge *medge,
&edge_poly_map, &edge_poly_mem, medge, totedge, mpoly, totpoly, mloop, totloop);
}
- poly_groups = static_cast<int *>(MEM_callocN(sizeof(int) * (size_t)totpoly, __func__));
- poly_stack = static_cast<int *>(MEM_mallocN(sizeof(int) * (size_t)totpoly, __func__));
+ poly_groups = static_cast<int *>(MEM_callocN(sizeof(int) * size_t(totpoly), __func__));
+ poly_stack = static_cast<int *>(MEM_mallocN(sizeof(int) * size_t(totpoly), __func__));
while (true) {
int poly;
@@ -662,7 +662,7 @@ static void poly_edge_loop_islands_calc(const MEdge *medge,
mp = &mpoly[poly];
for (ml = &mloop[mp->loopstart], j = mp->totloop; j--; ml++) {
/* loop over poly users */
- const int me_idx = (int)ml->e;
+ const int me_idx = int(ml->e);
const MEdge *me = &medge[me_idx];
const MeshElemMap *map_ele = &edge_poly_map[me_idx];
const int *p = map_ele->indices;
@@ -838,7 +838,7 @@ void BKE_mesh_loop_islands_init(MeshIslandStore *island_store,
island_store->item_type = item_type;
island_store->items_to_islands_num = items_num;
island_store->items_to_islands = static_cast<int *>(
- BLI_memarena_alloc(mem, sizeof(*island_store->items_to_islands) * (size_t)items_num));
+ BLI_memarena_alloc(mem, sizeof(*island_store->items_to_islands) * size_t(items_num)));
island_store->island_type = island_type;
island_store->islands_num_alloc = MISLAND_DEFAULT_BUFSIZE;
@@ -890,7 +890,7 @@ void BKE_mesh_loop_islands_add(MeshIslandStore *island_store,
MeshElemMap *isld, *innrcut;
const int curr_island_idx = island_store->islands_num++;
- const size_t curr_num_islands = (size_t)island_store->islands_num;
+ const size_t curr_num_islands = size_t(island_store->islands_num);
int i = item_num;
while (i--) {
@@ -916,17 +916,17 @@ void BKE_mesh_loop_islands_add(MeshIslandStore *island_store,
BLI_memarena_alloc(mem, sizeof(*isld)));
isld->count = num_island_items;
isld->indices = static_cast<int *>(
- BLI_memarena_alloc(mem, sizeof(*isld->indices) * (size_t)num_island_items));
- memcpy(isld->indices, island_item_indices, sizeof(*isld->indices) * (size_t)num_island_items);
+ BLI_memarena_alloc(mem, sizeof(*isld->indices) * size_t(num_island_items)));
+ memcpy(isld->indices, island_item_indices, sizeof(*isld->indices) * size_t(num_island_items));
island_store->innercuts[curr_island_idx] = innrcut = static_cast<MeshElemMap *>(
BLI_memarena_alloc(mem, sizeof(*innrcut)));
innrcut->count = num_innercut_items;
innrcut->indices = static_cast<int *>(
- BLI_memarena_alloc(mem, sizeof(*innrcut->indices) * (size_t)num_innercut_items));
+ BLI_memarena_alloc(mem, sizeof(*innrcut->indices) * size_t(num_innercut_items)));
memcpy(innrcut->indices,
innercut_item_indices,
- sizeof(*innrcut->indices) * (size_t)num_innercut_items);
+ sizeof(*innrcut->indices) * size_t(num_innercut_items));
}
/* TODO: I'm not sure edge seam flag is enough to define UV islands?
@@ -1066,22 +1066,22 @@ static bool mesh_calc_islands_loop_poly_uv(const MVert *UNUSED(verts),
if (num_edge_borders) {
edge_border_count = static_cast<char *>(
- MEM_mallocN(sizeof(*edge_border_count) * (size_t)totedge, __func__));
+ MEM_mallocN(sizeof(*edge_border_count) * size_t(totedge), __func__));
edge_innercut_indices = static_cast<int *>(
- MEM_mallocN(sizeof(*edge_innercut_indices) * (size_t)num_edge_borders, __func__));
+ MEM_mallocN(sizeof(*edge_innercut_indices) * size_t(num_edge_borders), __func__));
}
poly_indices = static_cast<int *>(
- MEM_mallocN(sizeof(*poly_indices) * (size_t)totpoly, __func__));
+ MEM_mallocN(sizeof(*poly_indices) * size_t(totpoly), __func__));
loop_indices = static_cast<int *>(
- MEM_mallocN(sizeof(*loop_indices) * (size_t)totloop, __func__));
+ MEM_mallocN(sizeof(*loop_indices) * size_t(totloop), __func__));
/* NOTE: here we ignore '0' invalid group - this should *never* happen in this case anyway? */
for (grp_idx = 1; grp_idx <= num_poly_groups; grp_idx++) {
num_pidx = num_lidx = 0;
if (num_edge_borders) {
num_einnercuts = 0;
- memset(edge_border_count, 0, sizeof(*edge_border_count) * (size_t)totedge);
+ memset(edge_border_count, 0, sizeof(*edge_border_count) * size_t(totedge));
}
for (p_idx = 0; p_idx < totpoly; p_idx++) {
@@ -1097,7 +1097,7 @@ static bool mesh_calc_islands_loop_poly_uv(const MVert *UNUSED(verts),
(edge_border_count[ml->e] < 2)) {
edge_border_count[ml->e]++;
if (edge_border_count[ml->e] == 2) {
- edge_innercut_indices[num_einnercuts++] = (int)ml->e;
+ edge_innercut_indices[num_einnercuts++] = int(ml->e);
}
}
}
diff --git a/source/blender/blenkernel/intern/mesh_merge_customdata.cc b/source/blender/blenkernel/intern/mesh_merge_customdata.cc
index f7936d8a4da..2c500f4d972 100644
--- a/source/blender/blenkernel/intern/mesh_merge_customdata.cc
+++ b/source/blender/blenkernel/intern/mesh_merge_customdata.cc
@@ -69,7 +69,7 @@ static void merge_uvs_for_vertex(const Span<int> loops_for_vert, Span<MLoopUV *>
BLI_assert(loops_merge.is_empty());
loops_merge.extend_unchecked(loops_for_vert);
while (loops_merge.size() > 1) {
- uint i_last = (uint)loops_merge.size() - 1;
+ uint i_last = uint(loops_merge.size()) - 1;
const float *uv_src = mloopuv[loops_merge[0]].uv;
for (uint i = 1; i <= i_last;) {
float *uv_dst = mloopuv[loops_merge[i]].uv;
diff --git a/source/blender/blenkernel/intern/mesh_normals.cc b/source/blender/blenkernel/intern/mesh_normals.cc
index 21dd39586ec..154840e2ef7 100644
--- a/source/blender/blenkernel/intern/mesh_normals.cc
+++ b/source/blender/blenkernel/intern/mesh_normals.cc
@@ -320,7 +320,7 @@ void BKE_mesh_calc_normals_poly_and_vertex(const MVert *mvert,
BLI_parallel_range_settings_defaults(&settings);
settings.min_iter_per_thread = 1024;
- memset(r_vert_normals, 0, sizeof(*r_vert_normals) * (size_t)mvert_len);
+ memset(r_vert_normals, 0, sizeof(*r_vert_normals) * size_t(mvert_len));
MeshCalcNormalsData_PolyAndVertex data = {};
data.mpoly = mpoly;
@@ -476,10 +476,10 @@ void BKE_mesh_calc_normals_looptri(MVert *mverts,
int looptri_num,
float (*r_tri_nors)[3])
{
- float(*tnorms)[3] = (float(*)[3])MEM_calloc_arrayN((size_t)numVerts, sizeof(*tnorms), "tnorms");
+ float(*tnorms)[3] = (float(*)[3])MEM_calloc_arrayN(size_t(numVerts), sizeof(*tnorms), "tnorms");
float(*fnors)[3] = (r_tri_nors) ? r_tri_nors :
(float(*)[3])MEM_calloc_arrayN(
- (size_t)looptri_num, sizeof(*fnors), "meshnormals");
+ size_t(looptri_num), sizeof(*fnors), "meshnormals");
if (!tnorms || !fnors) {
goto cleanup;
@@ -535,9 +535,9 @@ void BKE_lnor_spacearr_init(MLoopNorSpaceArray *lnors_spacearr,
}
mem = lnors_spacearr->mem;
lnors_spacearr->lspacearr = (MLoopNorSpace **)BLI_memarena_calloc(
- mem, sizeof(MLoopNorSpace *) * (size_t)numLoops);
+ mem, sizeof(MLoopNorSpace *) * size_t(numLoops));
lnors_spacearr->loops_pool = (LinkNode *)BLI_memarena_alloc(
- mem, sizeof(LinkNode) * (size_t)numLoops);
+ mem, sizeof(LinkNode) * size_t(numLoops));
lnors_spacearr->spaces_num = 0;
}
@@ -598,7 +598,7 @@ void BKE_lnor_space_define(MLoopNorSpace *lnor_space,
float vec_other[3],
BLI_Stack *edge_vectors)
{
- const float pi2 = (float)M_PI * 2.0f;
+ const float pi2 = float(M_PI) * 2.0f;
float tvec[3], dtp;
const float dtp_ref = dot_v3v3(vec_ref, lnor);
const float dtp_other = dot_v3v3(vec_other, lnor);
@@ -632,7 +632,7 @@ void BKE_lnor_space_define(MLoopNorSpace *lnor_space,
* a smooth vertex with only two edges and two faces (our Monkey's nose has that, e.g.).
*/
BLI_assert(count >= 2); /* This piece of code shall only be called for more than one loop. */
- lnor_space->ref_alpha = alpha / (float)count;
+ lnor_space->ref_alpha = alpha / float(count);
}
else {
lnor_space->ref_alpha = (saacosf(dot_v3v3(vec_ref, lnor)) +
@@ -690,13 +690,13 @@ void BKE_lnor_space_add_loop(MLoopNorSpaceArray *lnors_spacearr,
MINLINE float unit_short_to_float(const short val)
{
- return (float)val / (float)SHRT_MAX;
+ return float(val) / float(SHRT_MAX);
}
MINLINE short unit_float_to_short(const float val)
{
/* Rounding. */
- return (short)floorf(val * (float)SHRT_MAX + 0.5f);
+ return short(floorf(val * float(SHRT_MAX) + 0.5f));
}
void BKE_lnor_space_custom_data_to_normal(MLoopNorSpace *lnor_space,
@@ -712,7 +712,7 @@ void BKE_lnor_space_custom_data_to_normal(MLoopNorSpace *lnor_space,
{
/* TODO: Check whether using #sincosf() gives any noticeable benefit
* (could not even get it working under linux though)! */
- const float pi2 = (float)(M_PI * 2.0);
+ const float pi2 = float(M_PI * 2.0);
const float alphafac = unit_short_to_float(clnor_data[0]);
const float alpha = (alphafac > 0.0f ? lnor_space->ref_alpha : pi2 - lnor_space->ref_alpha) *
alphafac;
@@ -745,7 +745,7 @@ void BKE_lnor_space_custom_normal_to_data(MLoopNorSpace *lnor_space,
}
{
- const float pi2 = (float)(M_PI * 2.0);
+ const float pi2 = float(M_PI * 2.0);
const float cos_alpha = dot_v3v3(lnor_space->vec_lnor, custom_lnor);
float vec[3], cos_beta;
float alpha;
@@ -835,7 +835,7 @@ struct LoopSplitTaskDataCommon {
#define INDEX_UNSET INT_MIN
#define INDEX_INVALID -1
/* See comment about edge_to_loops below. */
-#define IS_EDGE_SHARP(_e2l) (ELEM((_e2l)[1], INDEX_UNSET, INDEX_INVALID))
+#define IS_EDGE_SHARP(_e2l) ELEM((_e2l)[1], INDEX_UNSET, INDEX_INVALID)
static void mesh_edges_sharp_tag(LoopSplitTaskDataCommon *data,
const bool check_angle,
@@ -955,17 +955,17 @@ void BKE_edges_sharp_from_angle_set(const struct MVert *mverts,
const int numPolys,
const float split_angle)
{
- if (split_angle >= (float)M_PI) {
+ if (split_angle >= float(M_PI)) {
/* Nothing to do! */
return;
}
/* Mapping edge -> loops. See BKE_mesh_normals_loop_split() for details. */
int(*edge_to_loops)[2] = (int(*)[2])MEM_calloc_arrayN(
- (size_t)numEdges, sizeof(*edge_to_loops), __func__);
+ size_t(numEdges), sizeof(*edge_to_loops), __func__);
/* Simple mapping from a loop to its polygon index. */
- int *loop_to_poly = (int *)MEM_malloc_arrayN((size_t)numLoops, sizeof(*loop_to_poly), __func__);
+ int *loop_to_poly = (int *)MEM_malloc_arrayN(size_t(numLoops), sizeof(*loop_to_poly), __func__);
LoopSplitTaskDataCommon common_data = {};
common_data.mverts = mverts;
@@ -1278,8 +1278,8 @@ static void split_loop_nor_fan_do(LoopSplitTaskDataCommon *common_data, LoopSpli
}
while ((clnor = (short *)BLI_SMALLSTACK_POP(clnors))) {
// print_v2("org clnor", clnor);
- clnor[0] = (short)clnors_avg[0];
- clnor[1] = (short)clnors_avg[1];
+ clnor[0] = short(clnors_avg[0]);
+ clnor[1] = short(clnors_avg[1]);
}
// print_v2("new clnors", clnors_avg);
}
@@ -1670,12 +1670,12 @@ void BKE_mesh_normals_loop_split(const MVert *mverts,
* to retrieve the real value later in code).
* Note also that loose edges always have both values set to 0! */
int(*edge_to_loops)[2] = (int(*)[2])MEM_calloc_arrayN(
- (size_t)numEdges, sizeof(*edge_to_loops), __func__);
+ size_t(numEdges), sizeof(*edge_to_loops), __func__);
/* Simple mapping from a loop to its polygon index. */
int *loop_to_poly = r_loop_to_poly ? r_loop_to_poly :
(int *)MEM_malloc_arrayN(
- (size_t)numLoops, sizeof(*loop_to_poly), __func__);
+ size_t(numLoops), sizeof(*loop_to_poly), __func__);
/* When using custom loop normals, disable the angle feature! */
const bool check_angle = (split_angle < (float)M_PI) && (clnors_data == nullptr);
@@ -1779,8 +1779,8 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
* So better to keep some simplicity here, and just call #BKE_mesh_normals_loop_split() twice! */
MLoopNorSpaceArray lnors_spacearr = {nullptr};
BitVector<> done_loops(numLoops, false);
- float(*lnors)[3] = (float(*)[3])MEM_calloc_arrayN((size_t)numLoops, sizeof(*lnors), __func__);
- int *loop_to_poly = (int *)MEM_malloc_arrayN((size_t)numLoops, sizeof(int), __func__);
+ float(*lnors)[3] = (float(*)[3])MEM_calloc_arrayN(size_t(numLoops), sizeof(*lnors), __func__);
+ int *loop_to_poly = (int *)MEM_malloc_arrayN(size_t(numLoops), sizeof(int), __func__);
/* In this case we always consider split nors as ON,
* and do not want to use angle to define smooth fans! */
const bool use_split_normals = true;
@@ -1952,7 +1952,7 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
LinkNode *loops = lnors_spacearr.lspacearr[i]->loops;
if (lnors_spacearr.lspacearr[i]->flags & MLNOR_SPACE_IS_SINGLE) {
BLI_assert(POINTER_AS_INT(loops) == i);
- const int nidx = use_vertices ? (int)mloops[i].v : i;
+ const int nidx = use_vertices ? int(mloops[i].v) : i;
float *nor = r_custom_loopnors[nidx];
BKE_lnor_space_custom_normal_to_data(lnors_spacearr.lspacearr[i], nor, r_clnors_data[i]);
@@ -1966,7 +1966,7 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
zero_v3(avg_nor);
while (loops) {
const int lidx = POINTER_AS_INT(loops->link);
- const int nidx = use_vertices ? (int)mloops[lidx].v : lidx;
+ const int nidx = use_vertices ? int(mloops[lidx].v) : lidx;
float *nor = r_custom_loopnors[nidx];
avg_nor_count++;
@@ -1977,7 +1977,7 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
done_loops[lidx].reset();
}
- mul_v3_fl(avg_nor, 1.0f / (float)avg_nor_count);
+ mul_v3_fl(avg_nor, 1.0f / float(avg_nor_count));
BKE_lnor_space_custom_normal_to_data(lnors_spacearr.lspacearr[i], avg_nor, clnor_data_tmp);
while ((clnor_data = (short *)BLI_SMALLSTACK_POP(clnors_data))) {
@@ -2056,7 +2056,7 @@ static void mesh_set_custom_normals(Mesh *mesh, float (*r_custom_nors)[3], const
clnors = (short(*)[2])CustomData_get_layer(&mesh->ldata, CD_CUSTOMLOOPNORMAL);
if (clnors != nullptr) {
- memset(clnors, 0, sizeof(*clnors) * (size_t)numloops);
+ memset(clnors, 0, sizeof(*clnors) * size_t(numloops));
}
else {
clnors = (short(*)[2])CustomData_add_layer(
@@ -2099,7 +2099,7 @@ void BKE_mesh_normals_loop_to_vertex(const int numVerts,
float (*r_vert_clnors)[3])
{
int *vert_loops_count = (int *)MEM_calloc_arrayN(
- (size_t)numVerts, sizeof(*vert_loops_count), __func__);
+ size_t(numVerts), sizeof(*vert_loops_count), __func__);
copy_vn_fl((float *)r_vert_clnors, 3 * numVerts, 0.0f);
@@ -2113,7 +2113,7 @@ void BKE_mesh_normals_loop_to_vertex(const int numVerts,
}
for (i = 0; i < numVerts; i++) {
- mul_v3_fl(r_vert_clnors[i], 1.0f / (float)vert_loops_count[i]);
+ mul_v3_fl(r_vert_clnors[i], 1.0f / float(vert_loops_count[i]));
}
MEM_freeN(vert_loops_count);
diff --git a/source/blender/blenkernel/intern/mesh_remap.c b/source/blender/blenkernel/intern/mesh_remap.c
index d63d064eb3c..cb05d33bc2e 100644
--- a/source/blender/blenkernel/intern/mesh_remap.c
+++ b/source/blender/blenkernel/intern/mesh_remap.c
@@ -1050,7 +1050,7 @@ static void mesh_island_to_astar_graph_edge_process(MeshIslandStore *islands,
const bool is_edge_innercut,
const int *poly_island_index_map,
float (*poly_centers)[3],
- unsigned char *poly_status)
+ uchar *poly_status)
{
int *poly_island_indices = BLI_array_alloca(poly_island_indices,
(size_t)edge_to_poly_map[edge_idx].count);
@@ -1114,7 +1114,7 @@ static void mesh_island_to_astar_graph(MeshIslandStore *islands,
BLI_bitmap *done_edges = BLI_BITMAP_NEW(numedges, __func__);
const int node_num = islands ? island_poly_map->count : numpolys;
- unsigned char *poly_status = MEM_callocN(sizeof(*poly_status) * (size_t)node_num, __func__);
+ uchar *poly_status = MEM_callocN(sizeof(*poly_status) * (size_t)node_num, __func__);
float(*poly_centers)[3];
int pidx_isld;
diff --git a/source/blender/blenkernel/intern/mesh_remesh_voxel.cc b/source/blender/blenkernel/intern/mesh_remesh_voxel.cc
index 3c492e2e167..62354c83df1 100644
--- a/source/blender/blenkernel/intern/mesh_remesh_voxel.cc
+++ b/source/blender/blenkernel/intern/mesh_remesh_voxel.cc
@@ -407,8 +407,8 @@ void BKE_remesh_reproject_vertex_paint(Mesh *target, const Mesh *source)
bvhtree.tree, target_verts[i].co, &nearest, bvhtree.nearest_callback, &bvhtree);
if (nearest.index != -1) {
- memcpy(POINTER_OFFSET(target_data, (size_t)i * data_size),
- POINTER_OFFSET(source_data, (size_t)nearest.index * data_size),
+ memcpy(POINTER_OFFSET(target_data, size_t(i) * data_size),
+ POINTER_OFFSET(source_data, size_t(nearest.index) * data_size),
data_size);
}
}
@@ -469,11 +469,11 @@ void BKE_remesh_reproject_vertex_paint(Mesh *target, const Mesh *source)
source_loops->count,
target_loops->indices[0]);
- void *elem = POINTER_OFFSET(target_data, (size_t)target_loops->indices[0] * data_size);
+ void *elem = POINTER_OFFSET(target_data, size_t(target_loops->indices[0]) * data_size);
/* Copy to rest of target loops. */
for (int j = 1; j < target_loops->count; j++) {
- memcpy(POINTER_OFFSET(target_data, (size_t)target_loops->indices[j] * data_size),
+ memcpy(POINTER_OFFSET(target_data, size_t(target_loops->indices[j]) * data_size),
elem,
data_size);
}
@@ -586,7 +586,7 @@ struct Mesh *BKE_mesh_remesh_voxel_fix_poles(const Mesh *mesh)
BMVert *vert = BM_edge_other_vert(ed, v);
add_v3_v3(co, vert->co);
}
- mul_v3_fl(co, 1.0f / (float)BM_vert_edge_count(v));
+ mul_v3_fl(co, 1.0f / float(BM_vert_edge_count(v)));
mid_v3_v3v3(v->co, v->co, co);
}
}
diff --git a/source/blender/blenkernel/intern/mesh_tangent.cc b/source/blender/blenkernel/intern/mesh_tangent.cc
index 8f9af5e9258..7c12e15ca7b 100644
--- a/source/blender/blenkernel/intern/mesh_tangent.cc
+++ b/source/blender/blenkernel/intern/mesh_tangent.cc
@@ -36,34 +36,34 @@
struct BKEMeshToTangent {
uint GetNumFaces()
{
- return (uint)num_polys;
+ return uint(num_polys);
}
uint GetNumVerticesOfFace(const uint face_num)
{
- return (uint)mpolys[face_num].totloop;
+ return uint(mpolys[face_num].totloop);
}
mikk::float3 GetPosition(const uint face_num, const uint vert_num)
{
- const uint loop_idx = (uint)mpolys[face_num].loopstart + vert_num;
+ const uint loop_idx = uint(mpolys[face_num].loopstart) + vert_num;
return mikk::float3(mverts[mloops[loop_idx].v].co);
}
mikk::float3 GetTexCoord(const uint face_num, const uint vert_num)
{
- const float *uv = luvs[(uint)mpolys[face_num].loopstart + vert_num].uv;
+ const float *uv = luvs[uint(mpolys[face_num].loopstart) + vert_num].uv;
return mikk::float3(uv[0], uv[1], 1.0f);
}
mikk::float3 GetNormal(const uint face_num, const uint vert_num)
{
- return mikk::float3(lnors[(uint)mpolys[face_num].loopstart + vert_num]);
+ return mikk::float3(lnors[uint(mpolys[face_num].loopstart) + vert_num]);
}
void SetTangentSpace(const uint face_num, const uint vert_num, mikk::float3 T, bool orientation)
{
- float *p_res = tangents[(uint)mpolys[face_num].loopstart + vert_num];
+ float *p_res = tangents[uint(mpolys[face_num].loopstart) + vert_num];
copy_v4_fl4(p_res, T.x, T.y, T.z, orientation ? 1.0f : -1.0f);
}
@@ -166,9 +166,9 @@ struct SGLSLMeshToTangent {
uint GetNumFaces()
{
#ifdef USE_LOOPTRI_DETECT_QUADS
- return (uint)num_face_as_quad_map;
+ return uint(num_face_as_quad_map);
#else
- return (uint)numTessFaces;
+ return uint(numTessFaces);
#endif
}
@@ -196,7 +196,7 @@ struct SGLSLMeshToTangent {
lt = &looptri[face_as_quad_map[face_num]];
const MPoly *mp = &mpoly[lt->poly];
if (mp->totloop == 4) {
- return ((uint)mp->loopstart + vert_num);
+ return (uint(mp->loopstart) + vert_num);
}
/* fall through to regular triangle */
}
@@ -382,7 +382,7 @@ void BKE_mesh_calc_loop_tangent_step_0(const CustomData *loopData,
add = true;
}
if (add) {
- *rtangent_mask |= (short)(1 << n);
+ *rtangent_mask |= short(1 << n);
}
}
@@ -437,21 +437,21 @@ void BKE_mesh_calc_loop_tangent_ex(const MVert *mvert,
for (int i = 0; i < tangent_names_len; i++) {
if (tangent_names[i][0]) {
BKE_mesh_add_loop_tangent_named_layer_for_uv(
- loopdata, loopdata_out, (int)loopdata_out_len, tangent_names[i]);
+ loopdata, loopdata_out, int(loopdata_out_len), tangent_names[i]);
}
}
if ((tangent_mask & DM_TANGENT_MASK_ORCO) &&
CustomData_get_named_layer_index(loopdata, CD_TANGENT, "") == -1) {
CustomData_add_layer_named(
- loopdata_out, CD_TANGENT, CD_SET_DEFAULT, nullptr, (int)loopdata_out_len, "");
+ loopdata_out, CD_TANGENT, CD_SET_DEFAULT, nullptr, int(loopdata_out_len), "");
}
if (calc_act && act_uv_name[0]) {
BKE_mesh_add_loop_tangent_named_layer_for_uv(
- loopdata, loopdata_out, (int)loopdata_out_len, act_uv_name);
+ loopdata, loopdata_out, int(loopdata_out_len), act_uv_name);
}
if (calc_ren && ren_uv_name[0]) {
BKE_mesh_add_loop_tangent_named_layer_for_uv(
- loopdata, loopdata_out, (int)loopdata_out_len, ren_uv_name);
+ loopdata, loopdata_out, int(loopdata_out_len), ren_uv_name);
}
#ifdef USE_LOOPTRI_DETECT_QUADS
@@ -465,7 +465,7 @@ void BKE_mesh_calc_loop_tangent_ex(const MVert *mvert,
/* map fake face index to looptri */
face_as_quad_map = static_cast<int *>(MEM_mallocN(sizeof(int) * looptri_len, __func__));
int k, j;
- for (k = 0, j = 0; j < (int)looptri_len; k++, j++) {
+ for (k = 0, j = 0; j < int(looptri_len); k++, j++) {
face_as_quad_map[k] = j;
/* step over all quads */
if (mpoly[looptri[j].poly].totloop == 4) {
@@ -475,7 +475,7 @@ void BKE_mesh_calc_loop_tangent_ex(const MVert *mvert,
num_face_as_quad_map = k;
}
else {
- num_face_as_quad_map = (int)looptri_len;
+ num_face_as_quad_map = int(looptri_len);
}
#endif
@@ -491,7 +491,7 @@ void BKE_mesh_calc_loop_tangent_ex(const MVert *mvert,
int index = CustomData_get_layer_index_n(loopdata_out, CD_TANGENT, n);
BLI_assert(n < MAX_MTFACE);
SGLSLMeshToTangent *mesh2tangent = &data_array[n];
- mesh2tangent->numTessFaces = (int)looptri_len;
+ mesh2tangent->numTessFaces = int(looptri_len);
#ifdef USE_LOOPTRI_DETECT_QUADS
mesh2tangent->face_as_quad_map = face_as_quad_map;
mesh2tangent->num_face_as_quad_map = num_face_as_quad_map;
@@ -525,7 +525,7 @@ void BKE_mesh_calc_loop_tangent_ex(const MVert *mvert,
int uv_start = CustomData_get_layer_index(loopdata, CD_MLOOPUV);
BLI_assert(uv_ind != -1 && uv_start != -1);
BLI_assert(uv_ind - uv_start < MAX_MTFACE);
- tangent_mask_curr |= (short)(1 << (uv_ind - uv_start));
+ tangent_mask_curr |= short(1 << (uv_ind - uv_start));
}
mesh2tangent->tangent = static_cast<float(*)[4]>(loopdata_out->layers[index].data);
@@ -583,10 +583,10 @@ void BKE_mesh_calc_loop_tangents(Mesh *me_eval,
BKE_mesh_calc_loop_tangent_ex(
BKE_mesh_verts(me_eval),
BKE_mesh_polys(me_eval),
- (uint)me_eval->totpoly,
+ uint(me_eval->totpoly),
BKE_mesh_loops(me_eval),
me_eval->runtime.looptris.array,
- (uint)me_eval->runtime.looptris.len,
+ uint(me_eval->runtime.looptris.len),
&me_eval->ldata,
calc_active_tangent,
tangent_names,
@@ -598,7 +598,7 @@ void BKE_mesh_calc_loop_tangents(Mesh *me_eval,
static_cast<const float(*)[3]>(CustomData_get_layer(&me_eval->vdata, CD_ORCO)),
/* result */
&me_eval->ldata,
- (uint)me_eval->totloop,
+ uint(me_eval->totloop),
&tangent_mask);
}
diff --git a/source/blender/blenkernel/intern/mesh_tessellate.cc b/source/blender/blenkernel/intern/mesh_tessellate.cc
index de4c60b28db..88f78197566 100644
--- a/source/blender/blenkernel/intern/mesh_tessellate.cc
+++ b/source/blender/blenkernel/intern/mesh_tessellate.cc
@@ -49,8 +49,8 @@ BLI_INLINE void mesh_calc_tessellation_for_face_impl(const MLoop *mloop,
const bool face_normal,
const float normal_precalc[3])
{
- const uint mp_loopstart = (uint)mpoly[poly_index].loopstart;
- const uint mp_totloop = (uint)mpoly[poly_index].totloop;
+ const uint mp_loopstart = uint(mpoly[poly_index].loopstart);
+ const uint mp_totloop = uint(mpoly[poly_index].totloop);
#define ML_TO_MLT(i1, i2, i3) \
{ \
@@ -125,9 +125,9 @@ BLI_INLINE void mesh_calc_tessellation_for_face_impl(const MLoop *mloop,
}
uint(*tris)[3] = static_cast<uint(*)[3]>(
- BLI_memarena_alloc(pf_arena, sizeof(*tris) * (size_t)totfilltri));
+ BLI_memarena_alloc(pf_arena, sizeof(*tris) * size_t(totfilltri)));
float(*projverts)[2] = static_cast<float(*)[2]>(
- BLI_memarena_alloc(pf_arena, sizeof(*projverts) * (size_t)mp_totloop));
+ BLI_memarena_alloc(pf_arena, sizeof(*projverts) * size_t(mp_totloop)));
ml = mloop + mp_loopstart;
for (uint j = 0; j < mp_totloop; j++, ml++) {
@@ -186,7 +186,7 @@ static void mesh_recalc_looptri__single_threaded(const MLoop *mloop,
uint tri_index = 0;
if (poly_normals != nullptr) {
- for (uint poly_index = 0; poly_index < (uint)totpoly; poly_index++, mp++) {
+ for (uint poly_index = 0; poly_index < uint(totpoly); poly_index++, mp++) {
mesh_calc_tessellation_for_face_with_normal(mloop,
mpoly,
mvert,
@@ -194,14 +194,14 @@ static void mesh_recalc_looptri__single_threaded(const MLoop *mloop,
&mlooptri[tri_index],
&pf_arena,
poly_normals[poly_index]);
- tri_index += (uint)(mp->totloop - 2);
+ tri_index += uint(mp->totloop - 2);
}
}
else {
- for (uint poly_index = 0; poly_index < (uint)totpoly; poly_index++, mp++) {
+ for (uint poly_index = 0; poly_index < uint(totpoly); poly_index++, mp++) {
mesh_calc_tessellation_for_face(
mloop, mpoly, mvert, poly_index, &mlooptri[tri_index], &pf_arena);
- tri_index += (uint)(mp->totloop - 2);
+ tri_index += uint(mp->totloop - 2);
}
}
@@ -209,7 +209,7 @@ static void mesh_recalc_looptri__single_threaded(const MLoop *mloop,
BLI_memarena_free(pf_arena);
pf_arena = nullptr;
}
- BLI_assert(tri_index == (uint)poly_to_tri_count(totpoly, totloop));
+ BLI_assert(tri_index == uint(poly_to_tri_count(totpoly, totloop)));
UNUSED_VARS_NDEBUG(totloop);
}
@@ -239,7 +239,7 @@ static void mesh_calc_tessellation_for_face_fn(void *__restrict userdata,
mesh_calc_tessellation_for_face_impl(data->mloop,
data->mpoly,
data->mvert,
- (uint)index,
+ uint(index),
&data->mlooptri[tri_index],
&tls_data->pf_arena,
false,
@@ -256,7 +256,7 @@ static void mesh_calc_tessellation_for_face_with_normal_fn(void *__restrict user
mesh_calc_tessellation_for_face_impl(data->mloop,
data->mpoly,
data->mvert,
- (uint)index,
+ uint(index),
&data->mlooptri[tri_index],
&tls_data->pf_arena,
true,
diff --git a/source/blender/blenkernel/intern/mesh_validate.cc b/source/blender/blenkernel/intern/mesh_validate.cc
index 47de7245ccc..95f885c45dd 100644
--- a/source/blender/blenkernel/intern/mesh_validate.cc
+++ b/source/blender/blenkernel/intern/mesh_validate.cc
@@ -987,7 +987,7 @@ static bool mesh_validate_customdata(CustomData *data,
}
}
- PRINT_MSG("%s: Finished (is_valid=%d)\n\n", __func__, (int)!has_fixes);
+ PRINT_MSG("%s: Finished (is_valid=%d)\n\n", __func__, int(!has_fixes));
*r_change = has_fixes;
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c
index 46e05b39076..58c3ef3bba0 100644
--- a/source/blender/blenkernel/intern/movieclip.c
+++ b/source/blender/blenkernel/intern/movieclip.c
@@ -357,7 +357,7 @@ IDTypeInfo IDType_ID_MC = {
/*********************** movieclip buffer loaders *************************/
-static int sequence_guess_offset(const char *full_name, int head_len, unsigned short numlen)
+static int sequence_guess_offset(const char *full_name, int head_len, ushort numlen)
{
char num[FILE_MAX] = {0};
@@ -425,7 +425,7 @@ static int get_timecode(MovieClip *clip, int flag)
static void get_sequence_fname(const MovieClip *clip, const int framenr, char *name)
{
- unsigned short numlen;
+ ushort numlen;
char head[FILE_MAX], tail[FILE_MAX];
int offset;
@@ -647,7 +647,7 @@ static void movieclip_calc_length(MovieClip *clip)
}
}
else if (clip->source == MCLIP_SRC_SEQUENCE) {
- unsigned short numlen;
+ ushort numlen;
char name[FILE_MAX], head[FILE_MAX], tail[FILE_MAX];
BLI_path_sequence_decode(clip->filepath, head, tail, &numlen);
@@ -735,7 +735,7 @@ static int user_frame_to_cache_frame(MovieClip *clip, int framenr)
if (clip->source == MCLIP_SRC_SEQUENCE) {
if (clip->cache->sequence_offset == -1) {
- unsigned short numlen;
+ ushort numlen;
char head[FILE_MAX], tail[FILE_MAX];
BLI_path_sequence_decode(clip->filepath, head, tail, &numlen);
@@ -763,7 +763,7 @@ static void moviecache_keydata(void *userkey, int *framenr, int *proxy, int *ren
*render_flags = key->render_flag;
}
-static unsigned int moviecache_hashhash(const void *keyv)
+static uint moviecache_hashhash(const void *keyv)
{
const MovieClipImBufCacheKey *key = keyv;
int rval = key->framenr;
@@ -880,7 +880,7 @@ static bool put_imbuf_cache(
clip->cache->moviecache = moviecache;
clip->cache->sequence_offset = -1;
if (clip->source == MCLIP_SRC_SEQUENCE) {
- unsigned short numlen;
+ ushort numlen;
BLI_path_sequence_decode(clip->filepath, NULL, NULL, &numlen);
clip->cache->is_still_sequence = (numlen == 0);
}
diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc
index 1c7b1b9fa3e..0dcb2aa3139 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -374,7 +374,7 @@ static void node_foreach_cache(ID *id,
if (nodetree->type == NTREE_COMPOSIT) {
LISTBASE_FOREACH (bNode *, node, &nodetree->nodes) {
if (node->type == CMP_NODE_MOVIEDISTORTION) {
- key.offset_in_ID = (size_t)BLI_ghashutil_strhash_p(node->name);
+ key.offset_in_ID = size_t(BLI_ghashutil_strhash_p(node->name));
function_callback(id, &key, (void **)&node->storage, 0, user_data);
}
}
@@ -1417,8 +1417,8 @@ void nodeUnregisterType(bNodeType *nt)
bool nodeTypeUndefined(const bNode *node)
{
return (node->typeinfo == &NodeTypeUndefined) ||
- ((ELEM(node->type, NODE_GROUP, NODE_CUSTOM_GROUP)) && node->id &&
- ID_IS_LINKED(node->id) && (node->id->tag & LIB_TAG_MISSING));
+ (ELEM(node->type, NODE_GROUP, NODE_CUSTOM_GROUP) && node->id && ID_IS_LINKED(node->id) &&
+ (node->id->tag & LIB_TAG_MISSING));
}
GHashIterator *nodeTypeGetIterator()
@@ -2716,8 +2716,8 @@ bNodePreview *BKE_node_preview_verify(bNodeInstanceHash *previews,
}
if (preview->rect == nullptr) {
- preview->rect = (unsigned char *)MEM_callocN(4 * xsize + xsize * ysize * sizeof(char[4]),
- "node preview rect");
+ preview->rect = (uchar *)MEM_callocN(4 * xsize + xsize * ysize * sizeof(char[4]),
+ "node preview rect");
preview->xsize = xsize;
preview->ysize = ysize;
}
@@ -2730,7 +2730,7 @@ bNodePreview *BKE_node_preview_copy(bNodePreview *preview)
{
bNodePreview *new_preview = (bNodePreview *)MEM_dupallocN(preview);
if (preview->rect) {
- new_preview->rect = (unsigned char *)MEM_dupallocN(preview->rect);
+ new_preview->rect = (uchar *)MEM_dupallocN(preview->rect);
}
return new_preview;
}
@@ -3899,15 +3899,15 @@ bNodeInstanceKey BKE_node_instance_key(bNodeInstanceKey parent_key,
return key;
}
-static unsigned int node_instance_hash_key(const void *key)
+static uint node_instance_hash_key(const void *key)
{
return ((const bNodeInstanceKey *)key)->value;
}
static bool node_instance_hash_key_cmp(const void *a, const void *b)
{
- unsigned int value_a = ((const bNodeInstanceKey *)a)->value;
- unsigned int value_b = ((const bNodeInstanceKey *)b)->value;
+ uint value_a = ((const bNodeInstanceKey *)a)->value;
+ uint value_b = ((const bNodeInstanceKey *)b)->value;
return (value_a != value_b);
}
@@ -4743,6 +4743,7 @@ static void registerGeometryNodes()
register_node_type_geo_flip_faces();
register_node_type_geo_geometry_to_instance();
register_node_type_geo_image_texture();
+ register_node_type_geo_input_control_point_neighbors();
register_node_type_geo_input_curve_handles();
register_node_type_geo_input_curve_tilt();
register_node_type_geo_input_id();
diff --git a/source/blender/blenkernel/intern/node_tree_update.cc b/source/blender/blenkernel/intern/node_tree_update.cc
index f9bab0959c9..44ca2752782 100644
--- a/source/blender/blenkernel/intern/node_tree_update.cc
+++ b/source/blender/blenkernel/intern/node_tree_update.cc
@@ -1432,7 +1432,7 @@ class NodeTreeMainUpdater {
}
/* When the hashes for the linked sockets are ready, combine them into a hash for the input
* socket. */
- const uint64_t socket_ptr = (uintptr_t)&socket;
+ const uint64_t socket_ptr = uintptr_t(&socket);
uint32_t socket_hash = noise::hash(socket_ptr, socket_ptr >> 32);
for (const bNodeSocket *origin_socket : socket.logically_linked_sockets()) {
const uint32_t origin_socket_hash = *hash_by_socket_id[origin_socket->index_in_tree()];
@@ -1457,7 +1457,7 @@ class NodeTreeMainUpdater {
}
/* When all input socket hashes have been computed, combine them into a hash for the output
* socket. */
- const uint64_t socket_ptr = (uintptr_t)&socket;
+ const uint64_t socket_ptr = uintptr_t(&socket);
uint32_t socket_hash = noise::hash(socket_ptr, socket_ptr >> 32);
for (const bNodeSocket *input_socket : node.input_sockets()) {
if (input_socket->is_available()) {
diff --git a/source/blender/blenkernel/intern/object.cc b/source/blender/blenkernel/intern/object.cc
index 7ea6a4c597e..20ba47efaa0 100644
--- a/source/blender/blenkernel/intern/object.cc
+++ b/source/blender/blenkernel/intern/object.cc
@@ -1402,15 +1402,15 @@ ModifierData *BKE_object_active_modifier(const Object *ob)
bool BKE_object_supports_modifiers(const Object *ob)
{
- return (ELEM(ob->type,
- OB_MESH,
- OB_CURVES,
- OB_CURVES_LEGACY,
- OB_SURF,
- OB_FONT,
- OB_LATTICE,
- OB_POINTCLOUD,
- OB_VOLUME));
+ return ELEM(ob->type,
+ OB_MESH,
+ OB_CURVES,
+ OB_CURVES_LEGACY,
+ OB_SURF,
+ OB_FONT,
+ OB_LATTICE,
+ OB_POINTCLOUD,
+ OB_VOLUME);
}
bool BKE_object_support_modifier_type_check(const Object *ob, int modifier_type)
@@ -3012,7 +3012,7 @@ void BKE_object_tfm_protected_restore(Object *ob,
const ObjectTfmProtectedChannels *obtfm,
const short protectflag)
{
- unsigned int i;
+ uint i;
for (i = 0; i < 3; i++) {
if (protectflag & (OB_LOCK_LOCX << i)) {
@@ -5268,12 +5268,12 @@ void BKE_object_groups_clear(Main *bmain, Scene *scene, Object *ob)
KDTree_3d *BKE_object_as_kdtree(Object *ob, int *r_tot)
{
KDTree_3d *tree = nullptr;
- unsigned int tot = 0;
+ uint tot = 0;
switch (ob->type) {
case OB_MESH: {
Mesh *me = (Mesh *)ob->data;
- unsigned int i;
+ uint i;
Mesh *me_eval = ob->runtime.mesh_deform_eval ? ob->runtime.mesh_deform_eval :
BKE_object_get_evaluated_mesh(ob);
@@ -5316,7 +5316,7 @@ KDTree_3d *BKE_object_as_kdtree(Object *ob, int *r_tot)
case OB_SURF: {
/* TODO: take deformation into account */
Curve *cu = (Curve *)ob->data;
- unsigned int i, a;
+ uint i, a;
Nurb *nu;
@@ -5360,7 +5360,7 @@ KDTree_3d *BKE_object_as_kdtree(Object *ob, int *r_tot)
/* TODO: take deformation into account */
Lattice *lt = (Lattice *)ob->data;
BPoint *bp;
- unsigned int i;
+ uint i;
tot = lt->pntsu * lt->pntsv * lt->pntsw;
tree = BLI_kdtree_3d_new(tot);
@@ -5450,7 +5450,7 @@ bool BKE_object_modifier_update_subframe(Depsgraph *depsgraph,
}
/* Skip sub-frame if object is parented to vertex of a dynamic paint canvas. */
- if (no_update && (ELEM(ob->partype, PARVERT1, PARVERT3))) {
+ if (no_update && ELEM(ob->partype, PARVERT1, PARVERT3)) {
return false;
}
diff --git a/source/blender/blenkernel/intern/object_deform.c b/source/blender/blenkernel/intern/object_deform.c
index a72d68710ed..c1fe10dca6b 100644
--- a/source/blender/blenkernel/intern/object_deform.c
+++ b/source/blender/blenkernel/intern/object_deform.c
@@ -613,7 +613,7 @@ bool *BKE_object_defgroup_selected_get(Object *ob, int defbase_tot, int *r_dg_fl
{
bool *dg_selection = MEM_mallocN(defbase_tot * sizeof(bool), __func__);
bDeformGroup *defgroup;
- unsigned int i;
+ uint i;
Object *armob = BKE_object_pose_armature_get(ob);
(*r_dg_flags_sel_tot) = 0;
@@ -700,7 +700,7 @@ void BKE_object_defgroup_mirror_selection(struct Object *ob,
const ListBase *defbase = BKE_object_defgroup_list(ob);
bDeformGroup *defgroup;
- unsigned int i;
+ uint i;
int i_mirr;
for (i = 0, defgroup = defbase->first; i < defbase_tot && defgroup;
diff --git a/source/blender/blenkernel/intern/object_dupli.cc b/source/blender/blenkernel/intern/object_dupli.cc
index dde3130a5b0..e28aaabb4e1 100644
--- a/source/blender/blenkernel/intern/object_dupli.cc
+++ b/source/blender/blenkernel/intern/object_dupli.cc
@@ -211,7 +211,7 @@ static DupliObject *make_dupli(
if (dob->persistent_id[0] != INT_MAX) {
for (i = 0; i < MAX_DUPLI_RECUR; i++) {
- dob->random_id = BLI_hash_int_2d(dob->random_id, (unsigned int)dob->persistent_id[i]);
+ dob->random_id = BLI_hash_int_2d(dob->random_id, uint(dob->persistent_id[i]));
}
}
else {
@@ -649,7 +649,7 @@ static const DupliGenerator gen_dupli_verts = {
* \{ */
static Object *find_family_object(
- Main *bmain, const char *family, size_t family_len, unsigned int ch, GHash *family_gh)
+ Main *bmain, const char *family, size_t family_len, uint ch, GHash *family_gh)
{
void *ch_key = POINTER_FROM_UINT(ch);
@@ -727,7 +727,7 @@ static void make_duplis_font(const DupliContext *ctx)
/* XXX That G.main is *really* ugly, but not sure what to do here.
* Definitively don't think it would be safe to put back `Main *bmain` pointer
* in #DupliContext as done in 2.7x? */
- ob = find_family_object(G.main, cu->family, family_len, (unsigned int)text[a], family_gh);
+ ob = find_family_object(G.main, cu->family, family_len, uint(text[a]), family_gh);
if (is_eval_curve) {
/* Workaround for the above hack. */
@@ -953,7 +953,7 @@ static void get_dupliface_transform_from_coords(Span<float3> coords,
for (const float3 &coord : coords) {
location += coord;
}
- location *= 1.0f / (float)coords.size();
+ location *= 1.0f / float(coords.size());
/* Rotation. */
float quat[4];
@@ -964,7 +964,7 @@ static void get_dupliface_transform_from_coords(Span<float3> coords,
/* Scale. */
float scale;
if (use_scale) {
- const float area = area_poly_v3((const float(*)[3])coords.data(), (uint)coords.size());
+ const float area = area_poly_v3((const float(*)[3])coords.data(), uint(coords.size()));
scale = sqrtf(area) * scale_fac;
}
else {
@@ -1094,7 +1094,7 @@ static void make_child_duplis_faces_from_mesh(const DupliContext *ctx,
DupliObject *dob = face_dupli_from_mesh(
fdd->params.ctx, inst_ob, child_imat, a, use_scale, scale_fac, mp, loopstart, mvert);
- const float w = 1.0f / (float)mp->totloop;
+ const float w = 1.0f / float(mp->totloop);
if (orco) {
for (int j = 0; j < mp->totloop; j++) {
madd_v3_v3fl(dob->orco, orco[loopstart[j].v], w);
@@ -1134,7 +1134,7 @@ static void make_child_duplis_faces_from_editmesh(const DupliContext *ctx,
fdd->params.ctx, inst_ob, child_imat, a, use_scale, scale_fac, f, vert_coords);
if (fdd->has_orco) {
- const float w = 1.0f / (float)f->len;
+ const float w = 1.0f / float(f->len);
BMLoop *l_first, *l_iter;
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
do {
@@ -1294,7 +1294,7 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
totpart = psys->totcached;
}
- RNG *rng = BLI_rng_new_srandom(31415926u + (unsigned int)psys->seed);
+ RNG *rng = BLI_rng_new_srandom(31415926u + uint(psys->seed));
psys->lattice_deform_data = psys_create_lattice_deform_data(&sim);
@@ -1326,7 +1326,7 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_END;
}
- oblist = (Object **)MEM_callocN((size_t)totcollection * sizeof(Object *),
+ oblist = (Object **)MEM_callocN(size_t(totcollection) * sizeof(Object *),
"dupcollection object list");
if (use_collection_count) {
diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c
index 91170060fee..3fe8b95e656 100644
--- a/source/blender/blenkernel/intern/object_update.c
+++ b/source/blender/blenkernel/intern/object_update.c
@@ -141,9 +141,10 @@ void BKE_object_handle_data_update(Depsgraph *depsgraph, Scene *scene, Object *o
CustomData_MeshMasks cddata_masks = scene->customdata_mask;
CustomData_MeshMasks_update(&cddata_masks, &CD_MASK_BAREMESH);
/* Custom attributes should not be removed automatically. They might be used by the render
- * engine or scripts. They can still be removed explicitly using geometry nodes. */
- cddata_masks.vmask |= CD_MASK_PROP_ALL;
- cddata_masks.emask |= CD_MASK_PROP_ALL;
+ * engine or scripts. They can still be removed explicitly using geometry nodes.
+ * Crease can be be used in generic situations with geometry nodes as well. */
+ cddata_masks.vmask |= CD_MASK_PROP_ALL | CD_MASK_CREASE;
+ cddata_masks.emask |= CD_MASK_PROP_ALL | CD_MASK_CREASE;
cddata_masks.fmask |= CD_MASK_PROP_ALL;
cddata_masks.pmask |= CD_MASK_PROP_ALL;
cddata_masks.lmask |= CD_MASK_PROP_ALL;
diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c
index cd1f24fee37..c142f096395 100644
--- a/source/blender/blenkernel/intern/ocean.c
+++ b/source/blender/blenkernel/intern/ocean.c
@@ -915,7 +915,7 @@ bool BKE_ocean_init(struct Ocean *o,
/* This ensures we get a value tied to the surface location, avoiding dramatic surface
* change with changing resolution.
* Explicitly cast to signed int first to ensure consistent behavior on all processors,
- * since behavior of float to unsigned int cast is undefined in C. */
+ * since behavior of `float` to `uint` cast is undefined in C. */
const int hash_x = o->_kx[i] * 360.0f;
const int hash_z = o->_kz[j] * 360.0f;
int new_seed = seed + BLI_hash_int_2d(hash_x, hash_z);
diff --git a/source/blender/blenkernel/intern/paint.cc b/source/blender/blenkernel/intern/paint.cc
index d98c368f437..08e49550426 100644
--- a/source/blender/blenkernel/intern/paint.cc
+++ b/source/blender/blenkernel/intern/paint.cc
@@ -2031,7 +2031,7 @@ int BKE_sculpt_mask_layers_ensure(Object *ob, MultiresModifierData *mmd)
const MLoop *l = &loops[p->loopstart + j];
avg += paint_mask[l->v];
}
- avg /= (float)p->totloop;
+ avg /= float(p->totloop);
/* fill in multires mask corner */
for (j = 0; j < p->totloop; j++) {
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index bbd462d5ae1..3675dea50e3 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -507,8 +507,8 @@ IDTypeInfo IDType_ID_PA = {
.lib_override_apply_post = NULL,
};
-unsigned int PSYS_FRAND_SEED_OFFSET[PSYS_FRAND_COUNT];
-unsigned int PSYS_FRAND_SEED_MULTIPLIER[PSYS_FRAND_COUNT];
+uint PSYS_FRAND_SEED_OFFSET[PSYS_FRAND_COUNT];
+uint PSYS_FRAND_SEED_MULTIPLIER[PSYS_FRAND_COUNT];
float PSYS_FRAND_BASE[PSYS_FRAND_COUNT];
void BKE_particle_init_rng(void)
@@ -516,8 +516,8 @@ void BKE_particle_init_rng(void)
RNG *rng = BLI_rng_new_srandom(5831); /* arbitrary */
for (int i = 0; i < PSYS_FRAND_COUNT; i++) {
PSYS_FRAND_BASE[i] = BLI_rng_get_float(rng);
- PSYS_FRAND_SEED_OFFSET[i] = (unsigned int)BLI_rng_get_int(rng);
- PSYS_FRAND_SEED_MULTIPLIER[i] = (unsigned int)BLI_rng_get_int(rng);
+ PSYS_FRAND_SEED_OFFSET[i] = (uint)BLI_rng_get_int(rng);
+ PSYS_FRAND_SEED_MULTIPLIER[i] = (uint)BLI_rng_get_int(rng);
}
BLI_rng_free(rng);
}
diff --git a/source/blender/blenkernel/intern/particle_distribute.c b/source/blender/blenkernel/intern/particle_distribute.c
index 561043b553e..ce9fec6043d 100644
--- a/source/blender/blenkernel/intern/particle_distribute.c
+++ b/source/blender/blenkernel/intern/particle_distribute.c
@@ -480,7 +480,7 @@ static void distribute_from_verts_exec(ParticleTask *thread, ParticleData *pa, i
* map to equal-colored parts of a texture */
for (int i = 0; i < ctx->mesh->totface; i++, mface++) {
if (ELEM(pa->num, mface->v1, mface->v2, mface->v3, mface->v4)) {
- unsigned int *vert = &mface->v1;
+ uint *vert = &mface->v1;
for (int j = 0; j < 4; j++, vert++) {
if (*vert == pa->num) {
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c
index aad19a8b842..1d65e958e1c 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -234,8 +234,7 @@ void pbvh_grow_nodes(PBVH *pbvh, int totnode)
/* Add a vertex to the map, with a positive value for unique vertices and
* a negative value for additional vertices */
-static int map_insert_vert(
- PBVH *pbvh, GHash *map, unsigned int *face_verts, unsigned int *uniq_verts, int vertex)
+static int map_insert_vert(PBVH *pbvh, GHash *map, uint *face_verts, uint *uniq_verts, int vertex)
{
void *key, **value_p;
@@ -1023,7 +1022,7 @@ static void pbvh_update_normals_accum_task_cb(void *__restrict userdata,
float(*vnors)[3] = data->vnors;
if (node->flag & PBVH_UpdateNormals) {
- unsigned int mpoly_prev = UINT_MAX;
+ uint mpoly_prev = UINT_MAX;
float fn[3];
const int *faces = node->prim_indices;
@@ -1031,7 +1030,7 @@ static void pbvh_update_normals_accum_task_cb(void *__restrict userdata,
for (int i = 0; i < totface; i++) {
const MLoopTri *lt = &pbvh->looptri[faces[i]];
- const unsigned int vtri[3] = {
+ const uint vtri[3] = {
pbvh->mloop[lt->tri[0]].v,
pbvh->mloop[lt->tri[1]].v,
pbvh->mloop[lt->tri[2]].v,
@@ -2168,8 +2167,8 @@ bool ray_face_intersection_tri(const float ray_start[3],
float *depth)
{
float depth_test;
- if ((isect_ray_tri_watertight_v3(ray_start, isect_precalc, t0, t1, t2, &depth_test, NULL) &&
- (depth_test < *depth))) {
+ if (isect_ray_tri_watertight_v3(ray_start, isect_precalc, t0, t1, t2, &depth_test, NULL) &&
+ (depth_test < *depth)) {
*depth = depth_test;
return true;
}
@@ -2214,12 +2213,12 @@ bool ray_face_nearest_quad(const float ray_start[3],
float dist_sq_test;
float co[3], depth_test;
- if (((dist_sq_test = dist_squared_ray_to_tri_v3_fast(
- ray_start, ray_normal, t0, t1, t2, co, &depth_test)) < *dist_sq)) {
+ if ((dist_sq_test = dist_squared_ray_to_tri_v3_fast(
+ ray_start, ray_normal, t0, t1, t2, co, &depth_test)) < *dist_sq) {
*dist_sq = dist_sq_test;
*depth = depth_test;
- if (((dist_sq_test = dist_squared_ray_to_tri_v3_fast(
- ray_start, ray_normal, t0, t2, t3, co, &depth_test)) < *dist_sq)) {
+ if ((dist_sq_test = dist_squared_ray_to_tri_v3_fast(
+ ray_start, ray_normal, t0, t2, t3, co, &depth_test)) < *dist_sq) {
*dist_sq = dist_sq_test;
*depth = depth_test;
}
@@ -2240,8 +2239,8 @@ bool ray_face_nearest_tri(const float ray_start[3],
float dist_sq_test;
float co[3], depth_test;
- if (((dist_sq_test = dist_squared_ray_to_tri_v3_fast(
- ray_start, ray_normal, t0, t1, t2, co, &depth_test)) < *dist_sq)) {
+ if ((dist_sq_test = dist_squared_ray_to_tri_v3_fast(
+ ray_start, ray_normal, t0, t1, t2, co, &depth_test)) < *dist_sq) {
*dist_sq = dist_sq_test;
*depth = depth_test;
return true;
diff --git a/source/blender/blenkernel/intern/pbvh.cc b/source/blender/blenkernel/intern/pbvh.cc
index 70aeb10f087..b2f32a38f23 100644
--- a/source/blender/blenkernel/intern/pbvh.cc
+++ b/source/blender/blenkernel/intern/pbvh.cc
@@ -63,7 +63,7 @@ template<typename T> void to_float(const T &src, float dst[4]);
template<> void to_float(const MLoopCol &src, float dst[4])
{
- rgba_uchar_to_float(dst, reinterpret_cast<const unsigned char *>(&src));
+ rgba_uchar_to_float(dst, reinterpret_cast<const uchar *>(&src));
srgb_to_linearrgb_v3_v3(dst, dst);
}
template<> void to_float(const MPropCol &src, float dst[4])
@@ -78,7 +78,7 @@ template<> void from_float(const float src[4], MLoopCol &dst)
float temp[4];
linearrgb_to_srgb_v3_v3(temp, src);
temp[3] = src[3];
- rgba_float_to_uchar(reinterpret_cast<unsigned char *>(&dst), temp);
+ rgba_float_to_uchar(reinterpret_cast<uchar *>(&dst), temp);
}
template<> void from_float(const float src[4], MPropCol &dst)
{
@@ -112,7 +112,7 @@ static void pbvh_vertex_color_get(const PBVH &pbvh, PBVHVertRef vertex, float r_
}
if (count) {
- mul_v4_fl(r_color, 1.0f / (float)count);
+ mul_v4_fl(r_color, 1.0f / float(count));
}
}
else {
diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c
index 70d442021fe..81dbff980d5 100644
--- a/source/blender/blenkernel/intern/pbvh_bmesh.c
+++ b/source/blender/blenkernel/intern/pbvh_bmesh.c
@@ -730,7 +730,7 @@ typedef struct EdgeQueue {
const float *view_normal;
#ifdef USE_EDGEQUEUE_FRONTFACE
- unsigned int use_view_normal : 1;
+ uint use_view_normal : 1;
#endif
} EdgeQueue;
@@ -883,7 +883,7 @@ static void long_edge_queue_edge_add_recursive(
return;
}
- if ((l_edge->radial_next != l_edge)) {
+ if (l_edge->radial_next != l_edge) {
/* How much longer we need to be to consider for subdividing
* (avoids subdividing faces which are only *slightly* skinny) */
# define EVEN_EDGELEN_THRESHOLD 1.2f
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index ce04d781980..5ec69f9bc45 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -103,14 +103,14 @@
static CLG_LogRef LOG = {"bke.pointcache"};
static int ptcache_data_size[] = {
- sizeof(unsigned int), /* BPHYS_DATA_INDEX */
- sizeof(float[3]), /* BPHYS_DATA_LOCATION */
- sizeof(float[3]), /* BPHYS_DATA_VELOCITY */
- sizeof(float[4]), /* BPHYS_DATA_ROTATION */
- sizeof(float[3]), /* BPHYS_DATA_AVELOCITY / BPHYS_DATA_XCONST */
- sizeof(float), /* BPHYS_DATA_SIZE */
- sizeof(float[3]), /* BPHYS_DATA_TIMES */
- sizeof(BoidData), /* case BPHYS_DATA_BOIDS */
+ sizeof(uint), /* BPHYS_DATA_INDEX */
+ sizeof(float[3]), /* BPHYS_DATA_LOCATION */
+ sizeof(float[3]), /* BPHYS_DATA_VELOCITY */
+ sizeof(float[4]), /* BPHYS_DATA_ROTATION */
+ sizeof(float[3]), /* BPHYS_DATA_AVELOCITY / BPHYS_DATA_XCONST */
+ sizeof(float), /* BPHYS_DATA_SIZE */
+ sizeof(float[3]), /* BPHYS_DATA_TIMES */
+ sizeof(BoidData), /* case BPHYS_DATA_BOIDS */
};
static int ptcache_extra_datasize[] = {
@@ -120,11 +120,11 @@ static int ptcache_extra_datasize[] = {
};
/* forward declarations */
-static int ptcache_file_compressed_read(PTCacheFile *pf, unsigned char *result, unsigned int len);
+static int ptcache_file_compressed_read(PTCacheFile *pf, uchar *result, uint len);
static int ptcache_file_compressed_write(
- PTCacheFile *pf, unsigned char *in, unsigned int in_len, unsigned char *out, int mode);
-static int ptcache_file_write(PTCacheFile *pf, const void *f, unsigned int tot, unsigned int size);
-static int ptcache_file_read(PTCacheFile *pf, void *f, unsigned int tot, unsigned int size);
+ PTCacheFile *pf, uchar *in, uint in_len, uchar *out, int mode);
+static int ptcache_file_write(PTCacheFile *pf, const void *f, uint tot, uint size);
+static int ptcache_file_read(PTCacheFile *pf, void *f, uint tot, uint size);
/* Common functions */
static int ptcache_basic_header_read(PTCacheFile *pf)
@@ -132,11 +132,11 @@ static int ptcache_basic_header_read(PTCacheFile *pf)
int error = 0;
/* Custom functions should read these basic elements too! */
- if (!error && !fread(&pf->totpoint, sizeof(unsigned int), 1, pf->fp)) {
+ if (!error && !fread(&pf->totpoint, sizeof(uint), 1, pf->fp)) {
error = 1;
}
- if (!error && !fread(&pf->data_types, sizeof(unsigned int), 1, pf->fp)) {
+ if (!error && !fread(&pf->data_types, sizeof(uint), 1, pf->fp)) {
error = 1;
}
@@ -145,20 +145,17 @@ static int ptcache_basic_header_read(PTCacheFile *pf)
static int ptcache_basic_header_write(PTCacheFile *pf)
{
/* Custom functions should write these basic elements too! */
- if (!fwrite(&pf->totpoint, sizeof(unsigned int), 1, pf->fp)) {
+ if (!fwrite(&pf->totpoint, sizeof(uint), 1, pf->fp)) {
return 0;
}
- if (!fwrite(&pf->data_types, sizeof(unsigned int), 1, pf->fp)) {
+ if (!fwrite(&pf->data_types, sizeof(uint), 1, pf->fp)) {
return 0;
}
return 1;
}
-static void ptcache_add_extra_data(PTCacheMem *pm,
- unsigned int type,
- unsigned int count,
- void *data)
+static void ptcache_add_extra_data(PTCacheMem *pm, uint type, uint count, void *data)
{
PTCacheExtra *extra = MEM_callocN(sizeof(PTCacheExtra), "Point cache: extra data descriptor");
@@ -683,8 +680,8 @@ static int ptcache_dynamicpaint_write(PTCacheFile *pf, void *dp_v)
if (surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ && surface->data) {
int total_points = surface->data->total_points;
- unsigned int in_len;
- unsigned char *out;
+ uint in_len;
+ uchar *out;
/* cache type */
ptcache_file_write(pf, &surface->type, 1, sizeof(int));
@@ -702,10 +699,10 @@ static int ptcache_dynamicpaint_write(PTCacheFile *pf, void *dp_v)
return 0;
}
- out = (unsigned char *)MEM_callocN(LZO_OUT_LEN(in_len), "pointcache_lzo_buffer");
+ out = (uchar *)MEM_callocN(LZO_OUT_LEN(in_len), "pointcache_lzo_buffer");
ptcache_file_compressed_write(
- pf, (unsigned char *)surface->data->type_data, in_len, out, cache_compress);
+ pf, (uchar *)surface->data->type_data, in_len, out, cache_compress);
MEM_freeN(out);
}
return 1;
@@ -723,7 +720,7 @@ static int ptcache_dynamicpaint_read(PTCacheFile *pf, void *dp_v)
}
if (surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ && surface->data) {
- unsigned int data_len;
+ uint data_len;
int surface_type;
/* cache type */
@@ -748,7 +745,7 @@ static int ptcache_dynamicpaint_read(PTCacheFile *pf, void *dp_v)
}
ptcache_file_compressed_read(
- pf, (unsigned char *)surface->data->type_data, data_len * surface->data->total_points);
+ pf, (uchar *)surface->data->type_data, data_len * surface->data->total_points);
}
return 1;
}
@@ -1424,7 +1421,7 @@ static int ptcache_filepath(
idname = (pid->owner_id->name + 2);
/* convert chars to hex so they are always a valid filename */
while ('\0' != *idname) {
- BLI_snprintf(newname, MAX_PTCACHE_FILE - len, "%02X", (unsigned int)(*idname++));
+ BLI_snprintf(newname, MAX_PTCACHE_FILE - len, "%02X", (uint)(*idname++));
newname += 2;
len += 2;
}
@@ -1500,29 +1497,28 @@ static void ptcache_file_close(PTCacheFile *pf)
}
}
-static int ptcache_file_compressed_read(PTCacheFile *pf, unsigned char *result, unsigned int len)
+static int ptcache_file_compressed_read(PTCacheFile *pf, uchar *result, uint len)
{
int r = 0;
- unsigned char compressed = 0;
+ uchar compressed = 0;
size_t in_len;
#ifdef WITH_LZO
size_t out_len = len;
#endif
- unsigned char *in;
- unsigned char *props = MEM_callocN(sizeof(char[16]), "tmp");
+ uchar *in;
+ uchar *props = MEM_callocN(sizeof(char[16]), "tmp");
- ptcache_file_read(pf, &compressed, 1, sizeof(unsigned char));
+ ptcache_file_read(pf, &compressed, 1, sizeof(uchar));
if (compressed) {
- unsigned int size;
- ptcache_file_read(pf, &size, 1, sizeof(unsigned int));
+ uint size;
+ ptcache_file_read(pf, &size, 1, sizeof(uint));
in_len = (size_t)size;
if (in_len == 0) {
/* do nothing */
}
else {
- in = (unsigned char *)MEM_callocN(sizeof(unsigned char) * in_len,
- "pointcache_compressed_buffer");
- ptcache_file_read(pf, in, in_len, sizeof(unsigned char));
+ in = (uchar *)MEM_callocN(sizeof(uchar) * in_len, "pointcache_compressed_buffer");
+ ptcache_file_read(pf, in, in_len, sizeof(uchar));
#ifdef WITH_LZO
if (compressed == 1) {
r = lzo1x_decompress_safe(in, (lzo_uint)in_len, result, (lzo_uint *)&out_len, NULL);
@@ -1532,9 +1528,9 @@ static int ptcache_file_compressed_read(PTCacheFile *pf, unsigned char *result,
if (compressed == 2) {
size_t sizeOfIt;
size_t leni = in_len, leno = len;
- ptcache_file_read(pf, &size, 1, sizeof(unsigned int));
+ ptcache_file_read(pf, &size, 1, sizeof(uint));
sizeOfIt = (size_t)size;
- ptcache_file_read(pf, props, sizeOfIt, sizeof(unsigned char));
+ ptcache_file_read(pf, props, sizeOfIt, sizeof(uchar));
r = LzmaUncompress(result, &leno, in, &leni, props, sizeOfIt);
}
#endif
@@ -1542,7 +1538,7 @@ static int ptcache_file_compressed_read(PTCacheFile *pf, unsigned char *result,
}
}
else {
- ptcache_file_read(pf, result, len, sizeof(unsigned char));
+ ptcache_file_read(pf, result, len, sizeof(uchar));
}
MEM_freeN(props);
@@ -1550,12 +1546,12 @@ static int ptcache_file_compressed_read(PTCacheFile *pf, unsigned char *result,
return r;
}
static int ptcache_file_compressed_write(
- PTCacheFile *pf, unsigned char *in, unsigned int in_len, unsigned char *out, int mode)
+ PTCacheFile *pf, uchar *in, uint in_len, uchar *out, int mode)
{
int r = 0;
- unsigned char compressed = 0;
+ uchar compressed = 0;
size_t out_len = 0;
- unsigned char *props = MEM_callocN(sizeof(char[16]), "tmp");
+ uchar *props = MEM_callocN(sizeof(char[16]), "tmp");
size_t sizeOfIt = 5;
(void)mode; /* unused when building w/o compression */
@@ -1600,31 +1596,31 @@ static int ptcache_file_compressed_write(
}
#endif
- ptcache_file_write(pf, &compressed, 1, sizeof(unsigned char));
+ ptcache_file_write(pf, &compressed, 1, sizeof(uchar));
if (compressed) {
- unsigned int size = out_len;
- ptcache_file_write(pf, &size, 1, sizeof(unsigned int));
- ptcache_file_write(pf, out, out_len, sizeof(unsigned char));
+ uint size = out_len;
+ ptcache_file_write(pf, &size, 1, sizeof(uint));
+ ptcache_file_write(pf, out, out_len, sizeof(uchar));
}
else {
- ptcache_file_write(pf, in, in_len, sizeof(unsigned char));
+ ptcache_file_write(pf, in, in_len, sizeof(uchar));
}
if (compressed == 2) {
- unsigned int size = sizeOfIt;
- ptcache_file_write(pf, &sizeOfIt, 1, sizeof(unsigned int));
- ptcache_file_write(pf, props, size, sizeof(unsigned char));
+ uint size = sizeOfIt;
+ ptcache_file_write(pf, &sizeOfIt, 1, sizeof(uint));
+ ptcache_file_write(pf, props, size, sizeof(uchar));
}
MEM_freeN(props);
return r;
}
-static int ptcache_file_read(PTCacheFile *pf, void *f, unsigned int tot, unsigned int size)
+static int ptcache_file_read(PTCacheFile *pf, void *f, uint tot, uint size)
{
return (fread(f, size, tot, pf->fp) == tot);
}
-static int ptcache_file_write(PTCacheFile *pf, const void *f, unsigned int tot, unsigned int size)
+static int ptcache_file_write(PTCacheFile *pf, const void *f, uint tot, uint size)
{
return (fwrite(f, size, tot, pf->fp) == tot);
}
@@ -1656,7 +1652,7 @@ static int ptcache_file_data_write(PTCacheFile *pf)
}
static int ptcache_file_header_begin_read(PTCacheFile *pf)
{
- unsigned int typeflag = 0;
+ uint typeflag = 0;
int error = 0;
char bphysics[8];
@@ -1670,7 +1666,7 @@ static int ptcache_file_header_begin_read(PTCacheFile *pf)
error = 1;
}
- if (!error && !fread(&typeflag, sizeof(unsigned int), 1, pf->fp)) {
+ if (!error && !fread(&typeflag, sizeof(uint), 1, pf->fp)) {
error = 1;
}
@@ -1687,13 +1683,13 @@ static int ptcache_file_header_begin_read(PTCacheFile *pf)
static int ptcache_file_header_begin_write(PTCacheFile *pf)
{
const char *bphysics = "BPHYSICS";
- unsigned int typeflag = pf->type + pf->flag;
+ uint typeflag = pf->type + pf->flag;
if (fwrite(bphysics, sizeof(char), 8, pf->fp) != 8) {
return 0;
}
- if (!fwrite(&typeflag, sizeof(unsigned int), 1, pf->fp)) {
+ if (!fwrite(&typeflag, sizeof(uint), 1, pf->fp)) {
return 0;
}
@@ -1722,11 +1718,11 @@ static void ptcache_file_pointers_init(PTCacheFile *pf)
pf->cur[BPHYS_DATA_BOIDS] = (data_types & (1 << BPHYS_DATA_BOIDS)) ? &pf->data.boids : NULL;
}
-int BKE_ptcache_mem_index_find(PTCacheMem *pm, unsigned int index)
+int BKE_ptcache_mem_index_find(PTCacheMem *pm, uint index)
{
if (pm->totpoint > 0 && pm->data[BPHYS_DATA_INDEX]) {
- unsigned int *data = pm->data[BPHYS_DATA_INDEX];
- unsigned int mid, low = 0, high = pm->totpoint - 1;
+ uint *data = pm->data[BPHYS_DATA_INDEX];
+ uint mid, low = 0, high = pm->totpoint - 1;
if (index < *data || index > *(data + high)) {
return -1;
@@ -1868,7 +1864,7 @@ static int ptcache_old_elemsize(PTCacheID *pid)
return 0;
}
-static void ptcache_find_frames_around(PTCacheID *pid, unsigned int frame, int *fra1, int *fra2)
+static void ptcache_find_frames_around(PTCacheID *pid, uint frame, int *fra1, int *fra2)
{
if (pid->cache->flag & PTCACHE_DISK_CACHE) {
int cfra1 = frame, cfra2 = frame + 1;
@@ -1930,7 +1926,7 @@ static PTCacheMem *ptcache_disk_frame_to_mem(PTCacheID *pid, int cfra)
{
PTCacheFile *pf = ptcache_file_open(pid, PTCACHE_FILE_READ, cfra);
PTCacheMem *pm = NULL;
- unsigned int i, error = 0;
+ uint i, error = 0;
if (pf == NULL) {
return NULL;
@@ -1955,9 +1951,9 @@ static PTCacheMem *ptcache_disk_frame_to_mem(PTCacheID *pid, int cfra)
if (pf->flag & PTCACHE_TYPEFLAG_COMPRESS) {
for (i = 0; i < BPHYS_TOT_DATA; i++) {
- unsigned int out_len = pm->totpoint * ptcache_data_size[i];
+ uint out_len = pm->totpoint * ptcache_data_size[i];
if (pf->data_types & (1 << i)) {
- ptcache_file_compressed_read(pf, (unsigned char *)(pm->data[i]), out_len);
+ ptcache_file_compressed_read(pf, (uchar *)(pm->data[i]), out_len);
}
}
}
@@ -1978,22 +1974,21 @@ static PTCacheMem *ptcache_disk_frame_to_mem(PTCacheID *pid, int cfra)
}
if (!error && pf->flag & PTCACHE_TYPEFLAG_EXTRADATA) {
- unsigned int extratype = 0;
+ uint extratype = 0;
- while (ptcache_file_read(pf, &extratype, 1, sizeof(unsigned int))) {
+ while (ptcache_file_read(pf, &extratype, 1, sizeof(uint))) {
PTCacheExtra *extra = MEM_callocN(sizeof(PTCacheExtra), "Pointcache extradata");
extra->type = extratype;
- ptcache_file_read(pf, &extra->totdata, 1, sizeof(unsigned int));
+ ptcache_file_read(pf, &extra->totdata, 1, sizeof(uint));
extra->data = MEM_callocN(extra->totdata * ptcache_extra_datasize[extra->type],
"Pointcache extradata->data");
if (pf->flag & PTCACHE_TYPEFLAG_COMPRESS) {
- ptcache_file_compressed_read(pf,
- (unsigned char *)(extra->data),
- extra->totdata * ptcache_extra_datasize[extra->type]);
+ ptcache_file_compressed_read(
+ pf, (uchar *)(extra->data), extra->totdata * ptcache_extra_datasize[extra->type]);
}
else {
ptcache_file_read(pf, extra->data, extra->totdata, ptcache_extra_datasize[extra->type]);
@@ -2020,7 +2015,7 @@ static PTCacheMem *ptcache_disk_frame_to_mem(PTCacheID *pid, int cfra)
static int ptcache_mem_frame_to_disk(PTCacheID *pid, PTCacheMem *pm)
{
PTCacheFile *pf = NULL;
- unsigned int i, error = 0;
+ uint i, error = 0;
BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_FRAME, pm->frame);
@@ -2054,11 +2049,10 @@ static int ptcache_mem_frame_to_disk(PTCacheID *pid, PTCacheMem *pm)
if (pid->cache->compression) {
for (i = 0; i < BPHYS_TOT_DATA; i++) {
if (pm->data[i]) {
- unsigned int in_len = pm->totpoint * ptcache_data_size[i];
- unsigned char *out = (unsigned char *)MEM_callocN(LZO_OUT_LEN(in_len) * 4,
- "pointcache_lzo_buffer");
+ uint in_len = pm->totpoint * ptcache_data_size[i];
+ uchar *out = (uchar *)MEM_callocN(LZO_OUT_LEN(in_len) * 4, "pointcache_lzo_buffer");
ptcache_file_compressed_write(
- pf, (unsigned char *)(pm->data[i]), in_len, out, pid->cache->compression);
+ pf, (uchar *)(pm->data[i]), in_len, out, pid->cache->compression);
MEM_freeN(out);
}
}
@@ -2087,15 +2081,14 @@ static int ptcache_mem_frame_to_disk(PTCacheID *pid, PTCacheMem *pm)
continue;
}
- ptcache_file_write(pf, &extra->type, 1, sizeof(unsigned int));
- ptcache_file_write(pf, &extra->totdata, 1, sizeof(unsigned int));
+ ptcache_file_write(pf, &extra->type, 1, sizeof(uint));
+ ptcache_file_write(pf, &extra->totdata, 1, sizeof(uint));
if (pid->cache->compression) {
- unsigned int in_len = extra->totdata * ptcache_extra_datasize[extra->type];
- unsigned char *out = (unsigned char *)MEM_callocN(LZO_OUT_LEN(in_len) * 4,
- "pointcache_lzo_buffer");
+ uint in_len = extra->totdata * ptcache_extra_datasize[extra->type];
+ uchar *out = (uchar *)MEM_callocN(LZO_OUT_LEN(in_len) * 4, "pointcache_lzo_buffer");
ptcache_file_compressed_write(
- pf, (unsigned char *)(extra->data), in_len, out, pid->cache->compression);
+ pf, (uchar *)(extra->data), in_len, out, pid->cache->compression);
MEM_freeN(out);
}
else {
@@ -2535,7 +2528,7 @@ static int ptcache_write_needed(PTCacheID *pid, int cfra, int *overwrite)
return 0;
}
-int BKE_ptcache_write(PTCacheID *pid, unsigned int cfra)
+int BKE_ptcache_write(PTCacheID *pid, uint cfra)
{
PointCache *cache = pid->cache;
if (!pid->totpoint) {
@@ -2587,10 +2580,10 @@ int BKE_ptcache_write(PTCacheID *pid, unsigned int cfra)
/* Clears & resets. */
-void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
+void BKE_ptcache_id_clear(PTCacheID *pid, int mode, uint cfra)
{
- unsigned int len; /* store the length of the string */
- unsigned int sta, end;
+ uint len; /* store the length of the string */
+ uint sta, end;
/* mode is same as fopen's modes */
DIR *dir;
@@ -2812,8 +2805,8 @@ void BKE_ptcache_id_time(
}
if (cache->cached_frames == NULL && cache->endframe > cache->startframe) {
- unsigned int sta = cache->startframe;
- unsigned int end = cache->endframe;
+ uint sta = cache->startframe;
+ uint end = cache->endframe;
cache->cached_frames_len = cache->endframe - cache->startframe + 1;
cache->cached_frames = MEM_callocN(sizeof(char) * cache->cached_frames_len,
@@ -2826,7 +2819,7 @@ void BKE_ptcache_id_time(
char path[MAX_PTCACHE_PATH];
char filepath[MAX_PTCACHE_FILE];
char ext[MAX_PTCACHE_PATH];
- unsigned int len; /* store the length of the string */
+ uint len; /* store the length of the string */
ptcache_path(pid, path);
diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index 2705241425b..6b4cddb05f2 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -2261,7 +2261,7 @@ void BKE_rigidbody_do_simulation(Depsgraph *depsgraph, Scene *scene, float ctime
/* write cache for current frame */
BKE_ptcache_validate(cache, (int)ctime);
- BKE_ptcache_write(&pid, (unsigned int)ctime);
+ BKE_ptcache_write(&pid, (uint)ctime);
rbw->ltime = ctime;
}
diff --git a/source/blender/blenkernel/intern/scene.cc b/source/blender/blenkernel/intern/scene.cc
index 8764927786d..4af6409347d 100644
--- a/source/blender/blenkernel/intern/scene.cc
+++ b/source/blender/blenkernel/intern/scene.cc
@@ -163,7 +163,7 @@ static void scene_init_data(ID *id)
scene->toolsettings = DNA_struct_default_alloc(ToolSettings);
- scene->toolsettings->autokey_mode = (uchar)U.autokey_mode;
+ scene->toolsettings->autokey_mode = uchar(U.autokey_mode);
/* Grease pencil multi-frame falloff curve. */
scene->toolsettings->gp_sculpt.cur_falloff = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
@@ -182,11 +182,11 @@ static void scene_init_data(ID *id)
scene->unit.system = USER_UNIT_METRIC;
scene->unit.scale_length = 1.0f;
- scene->unit.length_unit = (uchar)BKE_unit_base_of_type_get(USER_UNIT_METRIC, B_UNIT_LENGTH);
- scene->unit.mass_unit = (uchar)BKE_unit_base_of_type_get(USER_UNIT_METRIC, B_UNIT_MASS);
- scene->unit.time_unit = (uchar)BKE_unit_base_of_type_get(USER_UNIT_METRIC, B_UNIT_TIME);
- scene->unit.temperature_unit = (uchar)BKE_unit_base_of_type_get(USER_UNIT_METRIC,
- B_UNIT_TEMPERATURE);
+ scene->unit.length_unit = uchar(BKE_unit_base_of_type_get(USER_UNIT_METRIC, B_UNIT_LENGTH));
+ scene->unit.mass_unit = uchar(BKE_unit_base_of_type_get(USER_UNIT_METRIC, B_UNIT_MASS));
+ scene->unit.time_unit = uchar(BKE_unit_base_of_type_get(USER_UNIT_METRIC, B_UNIT_TIME));
+ scene->unit.temperature_unit = uchar(
+ BKE_unit_base_of_type_get(USER_UNIT_METRIC, B_UNIT_TEMPERATURE));
/* Anti-Aliasing threshold. */
scene->grease_pencil_settings.smaa_threshold = 1.0f;
@@ -771,7 +771,7 @@ static bool seq_foreach_member_id_cb(Sequence *seq, void *user_data)
{ \
CHECK_TYPE(&((_id_super)->id), ID *); \
BKE_lib_query_foreachid_process((_data), (ID **)&(_id_super), (_cb_flag)); \
- if (BKE_lib_query_foreachid_iter_stop((_data))) { \
+ if (BKE_lib_query_foreachid_iter_stop(_data)) { \
return false; \
} \
} \
@@ -906,8 +906,8 @@ static bool seq_foreach_path_callback(Sequence *seq, void *user_data)
}
else if ((seq->type == SEQ_TYPE_IMAGE) && se) {
/* NOTE: An option not to loop over all strips could be useful? */
- unsigned int len = (unsigned int)MEM_allocN_len(se) / (unsigned int)sizeof(*se);
- unsigned int i;
+ uint len = uint(MEM_allocN_len(se)) / uint(sizeof(*se));
+ uint i;
if (bpath_data->flag & BKE_BPATH_FOREACH_PATH_SKIP_MULTIFILE) {
/* only operate on one path */
@@ -1038,10 +1038,10 @@ static void scene_blend_write(BlendWriter *writer, ID *id, const void *id_addres
if (sce->r.avicodecdata) {
BLO_write_struct(writer, AviCodecData, sce->r.avicodecdata);
if (sce->r.avicodecdata->lpFormat) {
- BLO_write_raw(writer, (size_t)sce->r.avicodecdata->cbFormat, sce->r.avicodecdata->lpFormat);
+ BLO_write_raw(writer, size_t(sce->r.avicodecdata->cbFormat), sce->r.avicodecdata->lpFormat);
}
if (sce->r.avicodecdata->lpParms) {
- BLO_write_raw(writer, (size_t)sce->r.avicodecdata->cbParms, sce->r.avicodecdata->lpParms);
+ BLO_write_raw(writer, size_t(sce->r.avicodecdata->cbParms), sce->r.avicodecdata->lpParms);
}
}
@@ -1258,8 +1258,8 @@ static void scene_blend_read_data(BlendDataReader *reader, ID *id)
intptr_t seqbase_offset;
intptr_t channels_offset;
- seqbase_offset = ((intptr_t) & (temp.seqbase)) - ((intptr_t)&temp);
- channels_offset = ((intptr_t) & (temp.channels)) - ((intptr_t)&temp);
+ seqbase_offset = intptr_t(&(temp).seqbase) - intptr_t(&temp);
+ channels_offset = intptr_t(&(temp).channels) - intptr_t(&temp);
/* seqbase root pointer */
if (ed->seqbasep == old_seqbasep) {
@@ -1377,7 +1377,7 @@ static void scene_blend_read_data(BlendDataReader *reader, ID *id)
/* make sure simulation starts from the beginning after loading file */
if (rbw->pointcache) {
- rbw->ltime = (float)rbw->pointcache->startframe;
+ rbw->ltime = float(rbw->pointcache->startframe);
}
}
else {
@@ -1391,7 +1391,7 @@ static void scene_blend_read_data(BlendDataReader *reader, ID *id)
/* make sure simulation starts from the beginning after loading file */
if (rbw->shared->pointcache) {
- rbw->ltime = (float)rbw->shared->pointcache->startframe;
+ rbw->ltime = float(rbw->shared->pointcache->startframe);
}
}
rbw->objects = nullptr;
@@ -2495,8 +2495,8 @@ float BKE_scene_frame_get(const Scene *scene)
void BKE_scene_frame_set(Scene *scene, float frame)
{
double intpart;
- scene->r.subframe = modf((double)frame, &intpart);
- scene->r.cfra = (int)intpart;
+ scene->r.subframe = modf(double(frame), &intpart);
+ scene->r.cfra = int(intpart);
}
/* -------------------------------------------------------------------- */
@@ -3067,7 +3067,7 @@ double BKE_scene_unit_scale(const UnitSettings *unit, const int unit_type, doubl
case B_UNIT_LENGTH:
case B_UNIT_VELOCITY:
case B_UNIT_ACCELERATION:
- return value * (double)unit->scale_length;
+ return value * double(unit->scale_length);
case B_UNIT_AREA:
case B_UNIT_POWER:
return value * pow(unit->scale_length, 2);
@@ -3385,10 +3385,10 @@ struct DepsgraphKey {
*/
};
-static unsigned int depsgraph_key_hash(const void *key_v)
+static uint depsgraph_key_hash(const void *key_v)
{
const DepsgraphKey *key = static_cast<const DepsgraphKey *>(key_v);
- unsigned int hash = BLI_ghashutil_ptrhash(key->view_layer);
+ uint hash = BLI_ghashutil_ptrhash(key->view_layer);
/* TODO(sergey): Include hash from other fields in the key. */
return hash;
}
diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c
index 4b4e3bdcfa6..f94836551bb 100644
--- a/source/blender/blenkernel/intern/shrinkwrap.c
+++ b/source/blender/blenkernel/intern/shrinkwrap.c
@@ -200,7 +200,7 @@ static ShrinkwrapBoundaryData *shrinkwrap_build_boundary_data(struct Mesh *mesh)
char *edge_mode = MEM_calloc_arrayN((size_t)mesh->totedge, sizeof(char), __func__);
for (int i = 0; i < mesh->totloop; i++) {
- unsigned int eidx = mloop[i].e;
+ uint eidx = mloop[i].e;
if (edge_mode[eidx] < 2) {
edge_mode[eidx]++;
@@ -210,7 +210,7 @@ static ShrinkwrapBoundaryData *shrinkwrap_build_boundary_data(struct Mesh *mesh)
/* Build the boundary edge bitmask. */
BLI_bitmap *edge_is_boundary = BLI_BITMAP_NEW(mesh->totedge,
"ShrinkwrapBoundaryData::edge_is_boundary");
- unsigned int num_boundary_edges = 0;
+ uint num_boundary_edges = 0;
for (int i = 0; i < mesh->totedge; i++) {
edge_mode[i] = (edge_mode[i] == 1);
@@ -268,7 +268,7 @@ static ShrinkwrapBoundaryData *shrinkwrap_build_boundary_data(struct Mesh *mesh)
}
}
- unsigned int num_boundary_verts = 0;
+ uint num_boundary_verts = 0;
for (int i = 0; i < mesh->totvert; i++) {
vert_boundary_id[i] = (vert_boundary_id[i] != 0) ? (int)num_boundary_verts++ : -1;
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index d1451353feb..14a7d26a354 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -510,7 +510,7 @@ static void ccd_build_deflector_hash(Depsgraph *depsgraph,
return;
}
- unsigned int numobjects;
+ uint numobjects;
Object **objects = BKE_collision_objects_create(
depsgraph, vertexowner, collection, &numobjects, eModifierType_Collision);
@@ -547,7 +547,7 @@ static void ccd_update_deflector_hash(Depsgraph *depsgraph,
return;
}
- unsigned int numobjects;
+ uint numobjects;
Object **objects = BKE_collision_objects_create(
depsgraph, vertexowner, collection, &numobjects, eModifierType_Collision);
@@ -750,10 +750,10 @@ static void build_bps_springlist(Object *ob)
}
/* scan for attached inner springs */
for (b = sb->totspring, bs = sb->bspring; b > 0; b--, bs++) {
- if (((sb->totpoint - a) == bs->v1)) {
+ if ((sb->totpoint - a) == bs->v1) {
add_bp_springlist(bp, sb->totspring - b);
}
- if (((sb->totpoint - a) == bs->v2)) {
+ if ((sb->totpoint - a) == bs->v2) {
add_bp_springlist(bp, sb->totspring - b);
}
} /* For springs. */
@@ -963,7 +963,7 @@ static void free_softbody_intern(SoftBody *sb)
*/
static int query_external_colliders(Depsgraph *depsgraph, Collection *collection)
{
- unsigned int numobjects;
+ uint numobjects;
Object **objects = BKE_collision_objects_create(
depsgraph, NULL, collection, &numobjects, eModifierType_Collision);
BKE_collision_objects_free(objects);
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index 6e23ca0e89f..d08fba0e657 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -556,7 +556,7 @@ static void sound_load_audio(Main *bmain, bSound *sound, bool free_waveform)
/* but we need a packed file then */
if (pf) {
- sound->handle = AUD_Sound_bufferFile((unsigned char *)pf->data, pf->size);
+ sound->handle = AUD_Sound_bufferFile((uchar *)pf->data, pf->size);
}
else {
/* or else load it from disk */
diff --git a/source/blender/blenkernel/intern/studiolight.c b/source/blender/blenkernel/intern/studiolight.c
index 64f998ea67f..9610443ef70 100644
--- a/source/blender/blenkernel/intern/studiolight.c
+++ b/source/blender/blenkernel/intern/studiolight.c
@@ -342,9 +342,7 @@ static void *studiolight_multilayer_addlayer(void *base, const char *UNUSED(laye
/* Convert a multilayer pass to ImBuf channel 4 float buffer.
* NOTE: Parameter rect will become invalid. Do not use rect after calling this
* function */
-static float *studiolight_multilayer_convert_pass(ImBuf *ibuf,
- float *rect,
- const unsigned int channels)
+static float *studiolight_multilayer_convert_pass(ImBuf *ibuf, float *rect, const uint channels)
{
if (channels == 4) {
return rect;
diff --git a/source/blender/blenkernel/intern/subdiv_ccg.c b/source/blender/blenkernel/intern/subdiv_ccg.c
index 03937b270bc..e7f89a625b3 100644
--- a/source/blender/blenkernel/intern/subdiv_ccg.c
+++ b/source/blender/blenkernel/intern/subdiv_ccg.c
@@ -171,7 +171,7 @@ static void subdiv_ccg_eval_grid_element_limit(CCGEvalGridsData *data,
const int ptex_face_index,
const float u,
const float v,
- unsigned char *element)
+ uchar *element)
{
Subdiv *subdiv = data->subdiv;
SubdivCCG *subdiv_ccg = data->subdiv_ccg;
@@ -195,7 +195,7 @@ static void subdiv_ccg_eval_grid_element_mask(CCGEvalGridsData *data,
const int ptex_face_index,
const float u,
const float v,
- unsigned char *element)
+ uchar *element)
{
SubdivCCG *subdiv_ccg = data->subdiv_ccg;
if (!subdiv_ccg->has_mask) {
@@ -214,7 +214,7 @@ static void subdiv_ccg_eval_grid_element(CCGEvalGridsData *data,
const int ptex_face_index,
const float u,
const float v,
- unsigned char *element)
+ uchar *element)
{
subdiv_ccg_eval_grid_element_limit(data, ptex_face_index, u, v, element);
subdiv_ccg_eval_grid_element_mask(data, ptex_face_index, u, v, element);
@@ -232,7 +232,7 @@ static void subdiv_ccg_eval_regular_grid(CCGEvalGridsData *data, const int face_
const SubdivCCGFace *face = &faces[face_index];
for (int corner = 0; corner < face->num_grids; corner++) {
const int grid_index = face->start_grid_index + corner;
- unsigned char *grid = (unsigned char *)subdiv_ccg->grids[grid_index];
+ uchar *grid = (uchar *)subdiv_ccg->grids[grid_index];
for (int y = 0; y < grid_size; y++) {
const float grid_v = y * grid_size_1_inv;
for (int x = 0; x < grid_size; x++) {
@@ -264,7 +264,7 @@ static void subdiv_ccg_eval_special_grid(CCGEvalGridsData *data, const int face_
for (int corner = 0; corner < face->num_grids; corner++) {
const int grid_index = face->start_grid_index + corner;
const int ptex_face_index = data->face_ptex_offset[face_index] + corner;
- unsigned char *grid = (unsigned char *)subdiv_ccg->grids[grid_index];
+ uchar *grid = (uchar *)subdiv_ccg->grids[grid_index];
for (int y = 0; y < grid_size; y++) {
const float u = 1.0f - (y * grid_size_1_inv);
for (int x = 0; x < grid_size; x++) {
diff --git a/source/blender/blenkernel/intern/subdiv_mesh.cc b/source/blender/blenkernel/intern/subdiv_mesh.cc
index 6bc188fd1fc..14695718804 100644
--- a/source/blender/blenkernel/intern/subdiv_mesh.cc
+++ b/source/blender/blenkernel/intern/subdiv_mesh.cc
@@ -222,7 +222,7 @@ static void vertex_interpolation_init(const SubdivMeshContext *ctx,
vertex_interpolation->vertex_data_storage_allocated = true;
/* Interpolate center of poly right away, it stays unchanged for all
* ptex faces. */
- const float weight = 1.0f / (float)coarse_poly->totloop;
+ const float weight = 1.0f / float(coarse_poly->totloop);
blender::Array<float, 32> weights(coarse_poly->totloop);
blender::Array<int, 32> indices(coarse_poly->totloop);
for (int i = 0; i < coarse_poly->totloop; i++) {
@@ -267,14 +267,13 @@ static void vertex_interpolation_from_corner(const SubdivMeshContext *ctx,
const int first_loop_index = loops_of_ptex.first_loop - coarse_mloop;
const int last_loop_index = loops_of_ptex.last_loop - coarse_mloop;
const int first_indices[2] = {
- static_cast<int>(coarse_mloop[first_loop_index].v),
- static_cast<int>(
- coarse_mloop[coarse_poly->loopstart +
+ int(coarse_mloop[first_loop_index].v),
+ int(coarse_mloop[coarse_poly->loopstart +
(first_loop_index - coarse_poly->loopstart + 1) % coarse_poly->totloop]
.v)};
const int last_indices[2] = {
- static_cast<int>(coarse_mloop[first_loop_index].v),
- static_cast<int>(coarse_mloop[last_loop_index].v),
+ int(coarse_mloop[first_loop_index].v),
+ int(coarse_mloop[last_loop_index].v),
};
CustomData_interp(vertex_data,
&vertex_interpolation->vertex_data_storage,
@@ -356,7 +355,7 @@ static void loop_interpolation_init(const SubdivMeshContext *ctx,
loop_interpolation->loop_data_storage_allocated = true;
/* Interpolate center of poly right away, it stays unchanged for all
* ptex faces. */
- const float weight = 1.0f / (float)coarse_poly->totloop;
+ const float weight = 1.0f / float(coarse_poly->totloop);
blender::Array<float, 32> weights(coarse_poly->totloop);
blender::Array<int, 32> indices(coarse_poly->totloop);
for (int i = 0; i < coarse_poly->totloop; i++) {
@@ -402,8 +401,8 @@ static void loop_interpolation_from_corner(const SubdivMeshContext *ctx,
(first_loop_index - base_loop_index + 1) % coarse_poly->totloop;
const int first_indices[2] = {first_loop_index, second_loop_index};
const int last_indices[2] = {
- static_cast<int>(loops_of_ptex.last_loop - coarse_mloop),
- static_cast<int>(loops_of_ptex.first_loop - coarse_mloop),
+ int(loops_of_ptex.last_loop - coarse_mloop),
+ int(loops_of_ptex.first_loop - coarse_mloop),
};
CustomData_interp(
loop_data, &loop_interpolation->loop_data_storage, first_indices, weights, nullptr, 2, 1);
@@ -1085,8 +1084,7 @@ static void subdiv_mesh_vertex_of_loose_edge_interpolate(SubdivMeshContext *ctx,
BLI_assert(u > 0.0f);
BLI_assert(u < 1.0f);
const float interpolation_weights[2] = {1.0f - u, u};
- const int coarse_vertex_indices[2] = {static_cast<int>(coarse_edge->v1),
- static_cast<int>(coarse_edge->v2)};
+ const int coarse_vertex_indices[2] = {int(coarse_edge->v1), int(coarse_edge->v2)};
CustomData_interp(&coarse_mesh->vdata,
&subdiv_mesh->vdata,
coarse_vertex_indices,
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index c95c43a8099..c37f4b1ea2f 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -327,7 +327,7 @@ static int ss_sync_from_uv(CCGSubSurf *ss,
int nverts = mp->totloop;
int j, j_next;
CCGFace *origf = ccgSubSurf_getFace(origss, POINTER_FROM_INT(i));
- /* unsigned int *fv = &mp->v1; */
+ /* uint *fv = &mp->v1; */
MLoop *ml = mloop + mp->loopstart;
#ifdef USE_DYNSIZE
@@ -340,8 +340,8 @@ static int ss_sync_from_uv(CCGSubSurf *ss,
get_face_uv_map_vert(vmap, mpoly, ml, i, fverts);
for (j = 0, j_next = nverts - 1; j < nverts; j_next = j++) {
- unsigned int v0 = POINTER_AS_UINT(fverts[j_next]);
- unsigned int v1 = POINTER_AS_UINT(fverts[j]);
+ uint v0 = POINTER_AS_UINT(fverts[j_next]);
+ uint v1 = POINTER_AS_UINT(fverts[j]);
if (BLI_edgeset_add(eset, v0, v1)) {
CCGEdge *e, *orige = ccgSubSurf_getFaceEdge(origf, j_next);
@@ -892,7 +892,7 @@ static void ccgDM_copyFinalVertArray(DerivedMesh *dm, MVert *mvert)
int totvert, totedge, totface;
int gridSize = ccgSubSurf_getGridSize(ss);
int edgeSize = ccgSubSurf_getEdgeSize(ss);
- unsigned int i = 0;
+ uint i = 0;
CCG_key_top_level(&key, ss);
@@ -960,7 +960,7 @@ static void ccgDM_copyFinalEdgeArray(DerivedMesh *dm, MEdge *medge)
int totedge, totface;
int gridSize = ccgSubSurf_getGridSize(ss);
int edgeSize = ccgSubSurf_getEdgeSize(ss);
- unsigned int i = 0;
+ uint i = 0;
short *edgeFlags = ccgdm->edgeFlags;
const short ed_interior_flag = ccgdm->drawInteriorEdges ? (ME_EDGEDRAW | ME_EDGERENDER) : 0;
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index 1444ba1e1c4..1a0c0716fcd 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -354,7 +354,7 @@ static void cleanup_textline(TextLine *tl)
* used for load and reload (unlike txt_insert_buf)
* assumes all fields are empty
*/
-static void text_from_buf(Text *text, const unsigned char *buffer, const int len)
+static void text_from_buf(Text *text, const uchar *buffer, const int len)
{
int i, llen, lines_count;
@@ -419,7 +419,7 @@ static void text_from_buf(Text *text, const unsigned char *buffer, const int len
bool BKE_text_reload(Text *text)
{
- unsigned char *buffer;
+ uchar *buffer;
size_t buffer_len;
char filepath_abs[FILE_MAX];
BLI_stat_t st;
@@ -459,7 +459,7 @@ Text *BKE_text_load_ex(Main *bmain,
const char *relbase,
const bool is_internal)
{
- unsigned char *buffer;
+ uchar *buffer;
size_t buffer_len;
Text *ta;
char filepath_abs[FILE_MAX];
@@ -896,8 +896,7 @@ void txt_move_left(Text *text, const bool sel)
(*charp) -= tabsize;
}
else {
- const char *prev = BLI_str_find_prev_char_utf8((*linep)->line + *charp, (*linep)->line);
- *charp = prev - (*linep)->line;
+ BLI_str_cursor_step_prev_utf8((*linep)->line, (*linep)->len, charp);
}
}
@@ -941,7 +940,7 @@ void txt_move_right(Text *text, const bool sel)
(*charp) += tabsize;
}
else {
- (*charp) += BLI_str_utf8_size((*linep)->line + *charp);
+ BLI_str_cursor_step_next_utf8((*linep)->line, (*linep)->len, charp);
}
}
@@ -1088,16 +1087,16 @@ void txt_move_eof(Text *text, const bool sel)
}
}
-void txt_move_toline(Text *text, unsigned int line, const bool sel)
+void txt_move_toline(Text *text, uint line, const bool sel)
{
txt_move_to(text, line, 0, sel);
}
-void txt_move_to(Text *text, unsigned int line, unsigned int ch, const bool sel)
+void txt_move_to(Text *text, uint line, uint ch, const bool sel)
{
TextLine **linep;
int *charp;
- unsigned int i;
+ uint i;
if (sel) {
txt_curs_sel(text, &linep, &charp);
@@ -1118,8 +1117,8 @@ void txt_move_to(Text *text, unsigned int line, unsigned int ch, const bool sel)
break;
}
}
- if (ch > (unsigned int)((*linep)->len)) {
- ch = (unsigned int)((*linep)->len);
+ if (ch > (uint)((*linep)->len)) {
+ ch = (uint)((*linep)->len);
}
*charp = ch;
@@ -1757,8 +1756,6 @@ void txt_duplicate_line(Text *text)
void txt_delete_char(Text *text)
{
- unsigned int c = '\n';
-
if (!text->curl) {
return;
}
@@ -1778,10 +1775,9 @@ void txt_delete_char(Text *text)
}
}
else { /* Just deleting a char */
- size_t c_len = text->curc;
- c = BLI_str_utf8_as_unicode_step(text->curl->line, text->curl->len, &c_len);
- c_len -= text->curc;
- UNUSED_VARS(c);
+ int pos = text->curc;
+ BLI_str_cursor_step_next_utf8(text->curl->line, text->curl->len, &pos);
+ size_t c_len = pos - text->curc;
memmove(text->curl->line + text->curc,
text->curl->line + text->curc + c_len,
@@ -1805,8 +1801,6 @@ void txt_delete_word(Text *text)
void txt_backspace_char(Text *text)
{
- unsigned int c = '\n';
-
if (!text->curl) {
return;
}
@@ -1828,13 +1822,9 @@ void txt_backspace_char(Text *text)
txt_pop_sel(text);
}
else { /* Just backspacing a char */
- const char *prev = BLI_str_find_prev_char_utf8(text->curl->line + text->curc,
- text->curl->line);
- size_t c_len = prev - text->curl->line;
- c = BLI_str_utf8_as_unicode_step(text->curl->line, text->curl->len, &c_len);
- c_len -= prev - text->curl->line;
-
- UNUSED_VARS(c);
+ int pos = text->curc;
+ BLI_str_cursor_step_prev_utf8(text->curl->line, text->curl->len, &pos);
+ size_t c_len = text->curc - pos;
/* source and destination overlap, don't use memcpy() */
memmove(text->curl->line + text->curc - c_len,
@@ -1873,7 +1863,7 @@ static void txt_convert_tab_to_spaces(Text *text)
txt_insert_buf(text, sb, strlen(sb));
}
-static bool txt_add_char_intern(Text *text, unsigned int add, bool replace_tabs)
+static bool txt_add_char_intern(Text *text, uint add, bool replace_tabs)
{
char *tmp, ch[BLI_UTF8_MAX];
size_t add_len;
@@ -1916,12 +1906,12 @@ static bool txt_add_char_intern(Text *text, unsigned int add, bool replace_tabs)
return 1;
}
-bool txt_add_char(Text *text, unsigned int add)
+bool txt_add_char(Text *text, uint add)
{
return txt_add_char_intern(text, add, (text->flags & TXT_TABSTOSPACES) != 0);
}
-bool txt_add_raw_char(Text *text, unsigned int add)
+bool txt_add_raw_char(Text *text, uint add)
{
return txt_add_char_intern(text, add, 0);
}
@@ -1932,9 +1922,9 @@ void txt_delete_selected(Text *text)
txt_make_dirty(text);
}
-bool txt_replace_char(Text *text, unsigned int add)
+bool txt_replace_char(Text *text, uint add)
{
- unsigned int del;
+ uint del;
size_t del_size = 0, add_size;
char ch[BLI_UTF8_MAX];
@@ -2361,12 +2351,12 @@ bool text_check_identifier_nodigit(const char ch)
}
#ifndef WITH_PYTHON
-int text_check_identifier_unicode(const unsigned int ch)
+int text_check_identifier_unicode(const uint ch)
{
- return (ch < 255 && text_check_identifier((unsigned int)ch));
+ return (ch < 255 && text_check_identifier((uint)ch));
}
-int text_check_identifier_nodigit_unicode(const unsigned int ch)
+int text_check_identifier_nodigit_unicode(const uint ch)
{
return (ch < 255 && text_check_identifier_nodigit((char)ch));
}
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c
index cd1af5a8de4..c6efe235172 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -2396,21 +2396,21 @@ ImBuf *BKE_tracking_distortion_exec(MovieDistortion *distortion,
else {
if (undistort) {
libmv_cameraIntrinsicsUndistortByte(distortion->intrinsics,
- (unsigned char *)ibuf->rect,
+ (uchar *)ibuf->rect,
ibuf->x,
ibuf->y,
overscan,
ibuf->channels,
- (unsigned char *)resibuf->rect);
+ (uchar *)resibuf->rect);
}
else {
libmv_cameraIntrinsicsDistortByte(distortion->intrinsics,
- (unsigned char *)ibuf->rect,
+ (uchar *)ibuf->rect,
ibuf->x,
ibuf->y,
overscan,
ibuf->channels,
- (unsigned char *)resibuf->rect);
+ (uchar *)resibuf->rect);
}
}
@@ -2693,7 +2693,7 @@ ImBuf *BKE_tracking_sample_pattern(int frame_width,
&warped_position_y);
}
else {
- libmv_samplePlanarPatchByte((unsigned char *)search_ibuf->rect,
+ libmv_samplePlanarPatchByte((uchar *)search_ibuf->rect,
search_ibuf->x,
search_ibuf->y,
4,
@@ -2702,7 +2702,7 @@ ImBuf *BKE_tracking_sample_pattern(int frame_width,
num_samples_x,
num_samples_y,
mask,
- (unsigned char *)pattern_ibuf->rect,
+ (uchar *)pattern_ibuf->rect,
&warped_position_x,
&warped_position_y);
}
@@ -2868,7 +2868,7 @@ ImBuf *BKE_tracking_get_plane_imbuf(const ImBuf *frame_ibuf,
&warped_position_y);
}
else {
- libmv_samplePlanarPatchByte((unsigned char *)frame_ibuf->rect,
+ libmv_samplePlanarPatchByte((uchar *)frame_ibuf->rect,
frame_ibuf->x,
frame_ibuf->y,
4,
@@ -2877,7 +2877,7 @@ ImBuf *BKE_tracking_get_plane_imbuf(const ImBuf *frame_ibuf,
num_samples_x,
num_samples_y,
NULL,
- (unsigned char *)plane_ibuf->rect,
+ (uchar *)plane_ibuf->rect,
&warped_position_x,
&warped_position_y);
}
diff --git a/source/blender/blenkernel/intern/tracking_detect.c b/source/blender/blenkernel/intern/tracking_detect.c
index 540f880905d..910d02ef50a 100644
--- a/source/blender/blenkernel/intern/tracking_detect.c
+++ b/source/blender/blenkernel/intern/tracking_detect.c
@@ -121,7 +121,7 @@ static void run_configured_detector(MovieTracking *tracking,
features = libmv_detectFeaturesFloat(ibuf->rect_float, ibuf->x, ibuf->y, 4, options);
}
else if (ibuf->rect) {
- features = libmv_detectFeaturesByte((unsigned char *)ibuf->rect, ibuf->x, ibuf->y, 4, options);
+ features = libmv_detectFeaturesByte((uchar *)ibuf->rect, ibuf->x, ibuf->y, 4, options);
}
if (features != NULL) {
diff --git a/source/blender/blenkernel/intern/tracking_region_tracker.c b/source/blender/blenkernel/intern/tracking_region_tracker.c
index c89d44c4bf0..52df980554b 100644
--- a/source/blender/blenkernel/intern/tracking_region_tracker.c
+++ b/source/blender/blenkernel/intern/tracking_region_tracker.c
@@ -42,7 +42,7 @@ static void float_rgba_to_gray(const float *rgba,
}
}
-static void uint8_rgba_to_float_gray(const unsigned char *rgba,
+static void uint8_rgba_to_float_gray(const uchar *rgba,
float *gray,
int num_pixels,
float weight_red,
@@ -50,7 +50,7 @@ static void uint8_rgba_to_float_gray(const unsigned char *rgba,
float weight_blue)
{
for (int i = 0; i < num_pixels; i++) {
- const unsigned char *pixel = rgba + i * 4;
+ const uchar *pixel = rgba + i * 4;
gray[i] = (weight_red * pixel[0] + weight_green * pixel[1] + weight_blue * pixel[2]) / 255.0f;
}
@@ -86,7 +86,7 @@ static float *track_get_search_floatbuf(ImBuf *ibuf,
}
else {
uint8_rgba_to_float_gray(
- (unsigned char *)searchibuf->rect, gray_pixels, width * height, 0.2126f, 0.7152f, 0.0722f);
+ (uchar *)searchibuf->rect, gray_pixels, width * height, 0.2126f, 0.7152f, 0.0722f);
}
IMB_freeImBuf(searchibuf);
diff --git a/source/blender/blenkernel/intern/tracking_util.c b/source/blender/blenkernel/intern/tracking_util.c
index e97aa49f4ca..aaf262d120b 100644
--- a/source/blender/blenkernel/intern/tracking_util.c
+++ b/source/blender/blenkernel/intern/tracking_util.c
@@ -723,7 +723,7 @@ static ImBuf *accessor_get_ibuf(TrackingImageAccessor *accessor,
int dst_index = (dst_y * width + dst_x) * 4,
src_index = (src_y * orig_ibuf->x + src_x) * 4;
rgba_uchar_to_float(final_ibuf->rect_float + dst_index,
- (unsigned char *)orig_ibuf->rect + src_index);
+ (uchar *)orig_ibuf->rect + src_index);
}
}
}
diff --git a/source/blender/blenkernel/intern/type_conversions.cc b/source/blender/blenkernel/intern/type_conversions.cc
index a01f5d19088..ffc5442af2d 100644
--- a/source/blender/blenkernel/intern/type_conversions.cc
+++ b/source/blender/blenkernel/intern/type_conversions.cc
@@ -49,7 +49,7 @@ static float3 float_to_float3(const float &a)
}
static int32_t float_to_int(const float &a)
{
- return (int32_t)a;
+ return int32_t(a);
}
static bool float_to_bool(const float &a)
{
@@ -79,7 +79,7 @@ static float float2_to_float(const float2 &a)
}
static int float2_to_int(const float2 &a)
{
- return (int32_t)((a.x + a.y) / 2.0f);
+ return int32_t((a.x + a.y) / 2.0f);
}
static bool float2_to_bool(const float2 &a)
{
@@ -112,7 +112,7 @@ static float float3_to_float(const float3 &a)
}
static int float3_to_int(const float3 &a)
{
- return (int)((a.x + a.y + a.z) / 3.0f);
+ return int((a.x + a.y + a.z) / 3.0f);
}
static float2 float3_to_float2(const float3 &a)
{
@@ -138,19 +138,19 @@ static int8_t int_to_int8(const int32_t &a)
}
static float int_to_float(const int32_t &a)
{
- return (float)a;
+ return float(a);
}
static float2 int_to_float2(const int32_t &a)
{
- return float2((float)a);
+ return float2(float(a));
}
static float3 int_to_float3(const int32_t &a)
{
- return float3((float)a);
+ return float3(float(a));
}
static ColorGeometry4f int_to_color(const int32_t &a)
{
- return ColorGeometry4f((float)a, (float)a, (float)a, 1.0f);
+ return ColorGeometry4f(float(a), float(a), float(a), 1.0f);
}
static ColorGeometry4b int_to_byte_color(const int32_t &a)
{
@@ -163,23 +163,23 @@ static bool int8_to_bool(const int8_t &a)
}
static int int8_to_int(const int8_t &a)
{
- return static_cast<int>(a);
+ return int(a);
}
static float int8_to_float(const int8_t &a)
{
- return (float)a;
+ return float(a);
}
static float2 int8_to_float2(const int8_t &a)
{
- return float2((float)a);
+ return float2(float(a));
}
static float3 int8_to_float3(const int8_t &a)
{
- return float3((float)a);
+ return float3(float(a));
}
static ColorGeometry4f int8_to_color(const int8_t &a)
{
- return ColorGeometry4f((float)a, (float)a, (float)a, 1.0f);
+ return ColorGeometry4f(float(a), float(a), float(a), 1.0f);
}
static ColorGeometry4b int8_to_byte_color(const int8_t &a)
{
@@ -188,15 +188,15 @@ static ColorGeometry4b int8_to_byte_color(const int8_t &a)
static float bool_to_float(const bool &a)
{
- return (bool)a;
+ return bool(a);
}
static int8_t bool_to_int8(const bool &a)
{
- return static_cast<int8_t>(a);
+ return int8_t(a);
}
static int32_t bool_to_int(const bool &a)
{
- return (int32_t)a;
+ return int32_t(a);
}
static float2 bool_to_float2(const bool &a)
{
@@ -225,7 +225,7 @@ static float color_to_float(const ColorGeometry4f &a)
}
static int32_t color_to_int(const ColorGeometry4f &a)
{
- return (int)rgb_to_grayscale(a);
+ return int(rgb_to_grayscale(a));
}
static int8_t color_to_int8(const ColorGeometry4f &a)
{
diff --git a/source/blender/blenkernel/intern/undo_system.c b/source/blender/blenkernel/intern/undo_system.c
index 300ef0c646f..db2a6b658fa 100644
--- a/source/blender/blenkernel/intern/undo_system.c
+++ b/source/blender/blenkernel/intern/undo_system.c
@@ -299,7 +299,7 @@ static void undosys_stack_clear_all_last(UndoStack *ustack, UndoStep *us)
BLI_assert(us_iter != ustack->step_active);
undosys_step_free_and_unlink(ustack, us_iter);
undosys_stack_validate(ustack, is_not_empty);
- } while ((us != us_iter));
+ } while (us != us_iter);
}
}
@@ -320,7 +320,7 @@ static void undosys_stack_clear_all_first(UndoStack *ustack, UndoStep *us, UndoS
BLI_assert(us_iter != ustack->step_active);
undosys_step_free_and_unlink(ustack, us_iter);
undosys_stack_validate(ustack, is_not_empty);
- } while ((us != us_iter));
+ } while (us != us_iter);
}
}
diff --git a/source/blender/blenkernel/intern/vfont.c b/source/blender/blenkernel/intern/vfont.c
index ddc758c6887..0e04da246fc 100644
--- a/source/blender/blenkernel/intern/vfont.c
+++ b/source/blender/blenkernel/intern/vfont.c
@@ -423,7 +423,7 @@ VFont *BKE_vfont_builtin_get(void)
return BKE_vfont_load(G_MAIN, FO_BUILTIN_NAME);
}
-static VChar *find_vfont_char(VFontData *vfd, unsigned int character)
+static VChar *find_vfont_char(VFontData *vfd, uint character)
{
return BLI_ghash_lookup(vfd->characters, POINTER_FROM_UINT(character));
}
@@ -494,7 +494,7 @@ static void build_underline(Curve *cu,
void BKE_vfont_build_char(Curve *cu,
ListBase *nubase,
- unsigned int character,
+ uint character,
CharInfo *info,
float ofsx,
float ofsy,
@@ -1194,7 +1194,7 @@ static bool vfont_to_curve(Object *ob,
/* pass */
}
- if ((mem[j] != '\n') && ((chartransdata[j].dobreak != 0))) {
+ if ((mem[j] != '\n') && (chartransdata[j].dobreak != 0)) {
if (mem[i] == ' ') {
struct TempLineInfo *li;
@@ -1505,7 +1505,7 @@ static bool vfont_to_curve(Object *ob,
ct = chartransdata;
for (i = 0; i < slen; i++) {
- unsigned int cha = (unsigned int)mem[i];
+ uint cha = (uint)mem[i];
info = &(custrinfo[i]);
if ((cu->overflow == CU_OVERFLOW_TRUNCATE) && (ob && ob->mode != OB_MODE_EDIT) &&
diff --git a/source/blender/blenkernel/intern/vfontdata_freetype.c b/source/blender/blenkernel/intern/vfontdata_freetype.c
index 79d9b64b0f6..30e5f29e6a8 100644
--- a/source/blender/blenkernel/intern/vfontdata_freetype.c
+++ b/source/blender/blenkernel/intern/vfontdata_freetype.c
@@ -418,7 +418,7 @@ VFontData *BKE_vfontdata_copy(const VFontData *vfont_src, const int UNUSED(flag)
return vfont_dst;
}
-VChar *BKE_vfontdata_char_from_freetypefont(VFont *vfont, unsigned long character)
+VChar *BKE_vfontdata_char_from_freetypefont(VFont *vfont, ulong character)
{
VChar *che = NULL;
diff --git a/source/blender/blenkernel/intern/volume.cc b/source/blender/blenkernel/intern/volume.cc
index 502d3ac6d40..6418523a614 100644
--- a/source/blender/blenkernel/intern/volume.cc
+++ b/source/blender/blenkernel/intern/volume.cc
@@ -1636,8 +1636,8 @@ bool BKE_volume_grid_bounds(openvdb::GridBase::ConstPtr grid, float3 &r_min, flo
openvdb::BBoxd bbox = grid->transform().indexToWorld(coordbbox);
- r_min = float3((float)bbox.min().x(), (float)bbox.min().y(), (float)bbox.min().z());
- r_max = float3((float)bbox.max().x(), (float)bbox.max().y(), (float)bbox.max().z());
+ r_min = float3(float(bbox.min().x()), float(bbox.min().y()), float(bbox.min().z()));
+ r_max = float3(float(bbox.max().x()), float(bbox.max().y()), float(bbox.max().z()));
return true;
}
@@ -1646,7 +1646,7 @@ openvdb::GridBase::ConstPtr BKE_volume_grid_shallow_transform(openvdb::GridBase:
const blender::float4x4 &transform)
{
openvdb::math::Transform::Ptr grid_transform = grid->transform().copy();
- grid_transform->postMult(openvdb::Mat4d(((float *)transform.values)));
+ grid_transform->postMult(openvdb::Mat4d((float *)transform.values));
/* Create a transformed grid. The underlying tree is shared. */
return grid->copyGridReplacingTransform(grid_transform);
diff --git a/source/blender/blenkernel/intern/volume_render.cc b/source/blender/blenkernel/intern/volume_render.cc
index e7620be6401..700bd63c9d4 100644
--- a/source/blender/blenkernel/intern/volume_render.cc
+++ b/source/blender/blenkernel/intern/volume_render.cc
@@ -102,9 +102,8 @@ bool BKE_volume_grid_dense_floats(const Volume *volume,
}
const openvdb::Vec3i resolution = bbox.dim().asVec3i();
- const int64_t num_voxels = static_cast<int64_t>(resolution[0]) *
- static_cast<int64_t>(resolution[1]) *
- static_cast<int64_t>(resolution[2]);
+ const int64_t num_voxels = int64_t(resolution[0]) * int64_t(resolution[1]) *
+ int64_t(resolution[2]);
const int channels = BKE_volume_grid_channels(volume_grid);
const int elem_size = sizeof(float) * channels;
float *voxels = static_cast<float *>(MEM_malloc_arrayN(num_voxels, elem_size, __func__));
diff --git a/source/blender/blenkernel/intern/writeavi.c b/source/blender/blenkernel/intern/writeavi.c
index f4de82824c1..dbdf8cc395d 100644
--- a/source/blender/blenkernel/intern/writeavi.c
+++ b/source/blender/blenkernel/intern/writeavi.c
@@ -237,7 +237,7 @@ static int append_avi(void *context_v,
const char *UNUSED(suffix),
ReportList *UNUSED(reports))
{
- unsigned int *rt1, *rt2, *rectot;
+ uint *rt1, *rt2, *rectot;
int x, y;
char *cp, rt;
AviMovie *avi = context_v;
@@ -249,7 +249,7 @@ static int append_avi(void *context_v,
/* note that libavi free's the buffer... stupid interface - zr */
rectot = MEM_mallocN(rectx * recty * sizeof(int), "rectot");
rt1 = rectot;
- rt2 = (unsigned int *)pixels + (recty - 1) * rectx;
+ rt2 = (uint *)pixels + (recty - 1) * rectx;
/* flip y and convert to abgr */
for (y = 0; y < recty; y++, rt1 += rectx, rt2 -= rectx) {
memcpy(rt1, rt2, rectx * sizeof(int));
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index 883591e3e87..99df07b6105 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -425,7 +425,7 @@ static AVRational calc_time_base(uint den, double num, int codec_id)
/* Calculate the precision of the initial floating point number. */
if (num > 1.0) {
- const uint num_integer_bits = log2_floor_u((unsigned int)num);
+ const uint num_integer_bits = log2_floor_u((uint)num);
/* Formula for calculating the epsilon value: (power of two range) / (pow mantissa bits)
* For example, a float has 23 mantissa bits and the float value 3.5f as a pow2 range of
@@ -1282,7 +1282,7 @@ int BKE_ffmpeg_append(void *context_v,
PRINT("Writing frame %i, render width=%d, render height=%d\n", frame, rectx, recty);
if (context->video_stream) {
- avframe = generate_video_frame(context, (unsigned char *)pixels);
+ avframe = generate_video_frame(context, (uchar *)pixels);
success = (avframe && write_video_frame(context, avframe, reports));
# ifdef WITH_AUDASPACE
/* Add +1 frame because we want to encode audio up until the next video frame. */