Cleanup: various C++ changes (use nullptr, function style casts)
This commit is contained in:
parent
1e66938d7a
commit
aaf05c2497
|
@ -726,7 +726,7 @@ static void gwl_primary_selection_discard_source(GWL_PrimarySelection *primary)
|
|||
|
||||
#ifdef WITH_INPUT_IME
|
||||
struct GWL_SeatIME {
|
||||
struct wl_surface *surface_window = nullptr;
|
||||
wl_surface *surface_window = nullptr;
|
||||
GHOST_TEventImeData event_ime_data = {
|
||||
/*result_len*/ nullptr,
|
||||
/*composite_len*/ nullptr,
|
||||
|
@ -806,7 +806,7 @@ struct GWL_Seat {
|
|||
std::unordered_set<zwp_tablet_tool_v2 *> tablet_tools;
|
||||
|
||||
#ifdef WITH_INPUT_IME
|
||||
struct zwp_text_input_v3 *text_input = nullptr;
|
||||
zwp_text_input_v3 *text_input = nullptr;
|
||||
#endif
|
||||
} wp;
|
||||
|
||||
|
@ -1063,7 +1063,7 @@ struct GWL_Display {
|
|||
zwp_pointer_constraints_v1 *pointer_constraints = nullptr;
|
||||
zwp_pointer_gestures_v1 *pointer_gestures = nullptr;
|
||||
#ifdef WITH_INPUT_IME
|
||||
struct zwp_text_input_manager_v3 *text_input_manager = nullptr;
|
||||
zwp_text_input_manager_v3 *text_input_manager = nullptr;
|
||||
#endif
|
||||
} wp;
|
||||
|
||||
|
@ -4566,7 +4566,7 @@ static CLG_LogRef LOG_WL_TEXT_INPUT = {"ghost.wl.handle.text_input"};
|
|||
|
||||
static void text_input_handle_enter(void *data,
|
||||
zwp_text_input_v3 * /*zwp_text_input_v3*/,
|
||||
struct wl_surface *surface)
|
||||
wl_surface *surface)
|
||||
{
|
||||
if (!ghost_wl_surface_own(surface)) {
|
||||
return;
|
||||
|
@ -4578,7 +4578,7 @@ static void text_input_handle_enter(void *data,
|
|||
|
||||
static void text_input_handle_leave(void *data,
|
||||
zwp_text_input_v3 * /*zwp_text_input_v3*/,
|
||||
struct wl_surface *surface)
|
||||
wl_surface *surface)
|
||||
{
|
||||
/* Can be null when closing a window. */
|
||||
if (!ghost_wl_surface_own_with_null_check(surface)) {
|
||||
|
@ -4747,7 +4747,7 @@ static void text_input_handle_done(void *data,
|
|||
seat->ime.has_commit_string_callback = false;
|
||||
}
|
||||
|
||||
static struct zwp_text_input_v3_listener text_input_listener = {
|
||||
static zwp_text_input_v3_listener text_input_listener = {
|
||||
/*enter*/ text_input_handle_enter,
|
||||
/*leave*/ text_input_handle_leave,
|
||||
/*preedit_string*/ text_input_handle_preedit_string,
|
||||
|
@ -5773,7 +5773,7 @@ static void gwl_registry_wp_text_input_manager_remove(GWL_Display *display,
|
|||
void * /*user_data*/,
|
||||
const bool /*on_exit*/)
|
||||
{
|
||||
struct zwp_text_input_manager_v3 **value_p = &display->wp.text_input_manager;
|
||||
zwp_text_input_manager_v3 **value_p = &display->wp.text_input_manager;
|
||||
zwp_text_input_manager_v3_destroy(*value_p);
|
||||
*value_p = nullptr;
|
||||
}
|
||||
|
|
|
@ -2427,7 +2427,7 @@ void CustomData_ensure_data_is_mutable(CustomDataLayer *layer, const int totelem
|
|||
ensure_layer_data_is_mutable(*layer, totelem);
|
||||
}
|
||||
|
||||
void CustomData_ensure_layers_are_mutable(struct CustomData *data, int totelem)
|
||||
void CustomData_ensure_layers_are_mutable(CustomData *data, int totelem)
|
||||
{
|
||||
for (const int i : IndexRange(data->totlayer)) {
|
||||
ensure_layer_data_is_mutable(data->layers[i], totelem);
|
||||
|
|
|
@ -1939,7 +1939,7 @@ static std::string unique_node_name(const GreasePencil &grease_pencil,
|
|||
{
|
||||
using namespace blender;
|
||||
char unique_name[MAX_NAME];
|
||||
BLI_strncpy(unique_name, name.c_str(), MAX_NAME);
|
||||
STRNCPY(unique_name, name.c_str());
|
||||
VectorSet<StringRefNull> names = get_node_names(grease_pencil);
|
||||
unique_node_name_ex(names, default_name, unique_name);
|
||||
return unique_name;
|
||||
|
|
|
@ -97,7 +97,7 @@ static bool is_subdivision_evaluation_possible_on_gpu()
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!(GPU_compute_shader_support())) {
|
||||
if (!GPU_compute_shader_support()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
* Ordering function for sorting lists of files/directories. Returns -1 if
|
||||
* entry1 belongs before entry2, 0 if they are equal, 1 if they should be swapped.
|
||||
*/
|
||||
static int direntry_cmp(struct direntry *entry1, struct direntry *entry2)
|
||||
static int direntry_cmp(direntry *entry1, direntry *entry2)
|
||||
{
|
||||
/* type is equal to stat.st_mode */
|
||||
|
||||
|
@ -101,14 +101,14 @@ static int direntry_cmp(struct direntry *entry1, struct direntry *entry2)
|
|||
}
|
||||
|
||||
struct BuildDirCtx {
|
||||
struct direntry *files; /* array[files_num] */
|
||||
direntry *files; /* array[files_num] */
|
||||
int files_num;
|
||||
};
|
||||
|
||||
/**
|
||||
* Scans the directory named *dirname and appends entries for its contents to files.
|
||||
*/
|
||||
static void bli_builddir(struct BuildDirCtx *dir_ctx, const char *dirname)
|
||||
static void bli_builddir(BuildDirCtx *dir_ctx, const char *dirname)
|
||||
{
|
||||
DIR *dir = opendir(dirname);
|
||||
if (UNLIKELY(dir == nullptr)) {
|
||||
|
@ -121,7 +121,7 @@ static void bli_builddir(struct BuildDirCtx *dir_ctx, const char *dirname)
|
|||
|
||||
ListBase dirbase = {nullptr, nullptr};
|
||||
int newnum = 0;
|
||||
const struct dirent *fname;
|
||||
const dirent *fname;
|
||||
bool has_current = false, has_parent = false;
|
||||
|
||||
char dirname_with_slash[FILE_MAXDIR + 1];
|
||||
|
@ -136,7 +136,7 @@ static void bli_builddir(struct BuildDirCtx *dir_ctx, const char *dirname)
|
|||
}
|
||||
|
||||
while ((fname = readdir(dir)) != nullptr) {
|
||||
struct dirlink *const dlink = (struct dirlink *)malloc(sizeof(dirlink));
|
||||
dirlink *const dlink = (dirlink *)malloc(sizeof(dirlink));
|
||||
if (dlink != nullptr) {
|
||||
dlink->name = BLI_strdup(fname->d_name);
|
||||
if (FILENAME_IS_PARENT(dlink->name)) {
|
||||
|
@ -155,7 +155,7 @@ static void bli_builddir(struct BuildDirCtx *dir_ctx, const char *dirname)
|
|||
|
||||
STRNCPY(pardir, dirname);
|
||||
if (BLI_path_parent_dir(pardir) && (BLI_access(pardir, R_OK) == 0)) {
|
||||
struct dirlink *const dlink = (struct dirlink *)malloc(sizeof(dirlink));
|
||||
dirlink *const dlink = (dirlink *)malloc(sizeof(dirlink));
|
||||
if (dlink != nullptr) {
|
||||
dlink->name = BLI_strdup(FILENAME_PARENT);
|
||||
BLI_addhead(&dirbase, dlink);
|
||||
|
@ -164,7 +164,7 @@ static void bli_builddir(struct BuildDirCtx *dir_ctx, const char *dirname)
|
|||
}
|
||||
}
|
||||
if (!has_current) {
|
||||
struct dirlink *const dlink = (struct dirlink *)malloc(sizeof(dirlink));
|
||||
dirlink *const dlink = (dirlink *)malloc(sizeof(dirlink));
|
||||
if (dlink != nullptr) {
|
||||
dlink->name = BLI_strdup(FILENAME_CURRENT);
|
||||
BLI_addhead(&dirbase, dlink);
|
||||
|
@ -186,7 +186,7 @@ static void bli_builddir(struct BuildDirCtx *dir_ctx, const char *dirname)
|
|||
}
|
||||
|
||||
if (dir_ctx->files == nullptr) {
|
||||
dir_ctx->files = (struct direntry *)MEM_mallocN(newnum * sizeof(direntry), __func__);
|
||||
dir_ctx->files = (direntry *)MEM_mallocN(newnum * sizeof(direntry), __func__);
|
||||
}
|
||||
|
||||
if (UNLIKELY(dir_ctx->files == nullptr)) {
|
||||
|
@ -194,8 +194,8 @@ static void bli_builddir(struct BuildDirCtx *dir_ctx, const char *dirname)
|
|||
dir_ctx->files_num = 0;
|
||||
}
|
||||
else {
|
||||
struct dirlink *dlink = (dirlink *)dirbase.first;
|
||||
struct direntry *file = &dir_ctx->files[dir_ctx->files_num];
|
||||
dirlink *dlink = (dirlink *)dirbase.first;
|
||||
direntry *file = &dir_ctx->files[dir_ctx->files_num];
|
||||
|
||||
while (dlink) {
|
||||
memset(file, 0, sizeof(direntry));
|
||||
|
@ -226,9 +226,9 @@ static void bli_builddir(struct BuildDirCtx *dir_ctx, const char *dirname)
|
|||
closedir(dir);
|
||||
}
|
||||
|
||||
uint BLI_filelist_dir_contents(const char *dirname, struct direntry **r_filelist)
|
||||
uint BLI_filelist_dir_contents(const char *dirname, direntry **r_filelist)
|
||||
{
|
||||
struct BuildDirCtx dir_ctx;
|
||||
BuildDirCtx dir_ctx;
|
||||
|
||||
dir_ctx.files_num = 0;
|
||||
dir_ctx.files = nullptr;
|
||||
|
@ -322,7 +322,7 @@ void BLI_filelist_entry_owner_to_string(const struct stat *st,
|
|||
UNUSED_VARS(st);
|
||||
BLI_strncpy(r_owner, "unknown", FILELIST_DIRENTRY_OWNER_LEN);
|
||||
#else
|
||||
struct passwd *pwuser = getpwuid(st->st_uid);
|
||||
passwd *pwuser = getpwuid(st->st_uid);
|
||||
|
||||
if (pwuser) {
|
||||
BLI_strncpy(r_owner, pwuser->pw_name, sizeof(*r_owner) * FILELIST_DIRENTRY_OWNER_LEN);
|
||||
|
@ -348,8 +348,8 @@ void BLI_filelist_entry_datetime_to_string(const struct stat *st,
|
|||
|
||||
if (r_is_today || r_is_yesterday) {
|
||||
/* `localtime()` has only one buffer so need to get data out before called again. */
|
||||
const time_t ts_now = time(NULL);
|
||||
struct tm *today = localtime(&ts_now);
|
||||
const time_t ts_now = time(nullptr);
|
||||
tm *today = localtime(&ts_now);
|
||||
|
||||
today_year = today->tm_year;
|
||||
today_yday = today->tm_yday;
|
||||
|
@ -368,7 +368,7 @@ void BLI_filelist_entry_datetime_to_string(const struct stat *st,
|
|||
}
|
||||
|
||||
const time_t ts_mtime = ts;
|
||||
const struct tm *tm = localtime(st ? &st->st_mtime : &ts_mtime);
|
||||
const tm *tm = localtime(st ? &st->st_mtime : &ts_mtime);
|
||||
const time_t zero = 0;
|
||||
|
||||
/* Prevent impossible dates in windows. */
|
||||
|
@ -395,7 +395,7 @@ void BLI_filelist_entry_datetime_to_string(const struct stat *st,
|
|||
}
|
||||
}
|
||||
|
||||
void BLI_filelist_entry_duplicate(struct direntry *dst, const struct direntry *src)
|
||||
void BLI_filelist_entry_duplicate(direntry *dst, const direntry *src)
|
||||
{
|
||||
*dst = *src;
|
||||
if (dst->relname) {
|
||||
|
@ -406,8 +406,8 @@ void BLI_filelist_entry_duplicate(struct direntry *dst, const struct direntry *s
|
|||
}
|
||||
}
|
||||
|
||||
void BLI_filelist_duplicate(struct direntry **dest_filelist,
|
||||
struct direntry *const src_filelist,
|
||||
void BLI_filelist_duplicate(direntry **dest_filelist,
|
||||
direntry *const src_filelist,
|
||||
const uint nrentries)
|
||||
{
|
||||
uint i;
|
||||
|
@ -415,13 +415,13 @@ void BLI_filelist_duplicate(struct direntry **dest_filelist,
|
|||
*dest_filelist = static_cast<direntry *>(
|
||||
MEM_mallocN(sizeof(**dest_filelist) * size_t(nrentries), __func__));
|
||||
for (i = 0; i < nrentries; i++) {
|
||||
struct direntry *const src = &src_filelist[i];
|
||||
struct direntry *dst = &(*dest_filelist)[i];
|
||||
direntry *const src = &src_filelist[i];
|
||||
direntry *dst = &(*dest_filelist)[i];
|
||||
BLI_filelist_entry_duplicate(dst, src);
|
||||
}
|
||||
}
|
||||
|
||||
void BLI_filelist_entry_free(struct direntry *entry)
|
||||
void BLI_filelist_entry_free(direntry *entry)
|
||||
{
|
||||
if (entry->relname) {
|
||||
MEM_freeN((void *)entry->relname);
|
||||
|
@ -431,7 +431,7 @@ void BLI_filelist_entry_free(struct direntry *entry)
|
|||
}
|
||||
}
|
||||
|
||||
void BLI_filelist_free(struct direntry *filelist, const uint nrentries)
|
||||
void BLI_filelist_free(direntry *filelist, const uint nrentries)
|
||||
{
|
||||
uint i;
|
||||
for (i = 0; i < nrentries; i++) {
|
||||
|
|
|
@ -862,9 +862,9 @@ static int recursive_operation(const char *startfrom,
|
|||
RecursiveOp_Callback callback_dir_post)
|
||||
{
|
||||
struct stat st;
|
||||
char *from = NULL, *to = nullptr;
|
||||
char *from_path = NULL, *to_path = nullptr;
|
||||
struct dirent **dirlist = nullptr;
|
||||
char *from = nullptr, *to = nullptr;
|
||||
char *from_path = nullptr, *to_path = nullptr;
|
||||
dirent **dirlist = nullptr;
|
||||
size_t from_alloc_len = -1, to_alloc_len = -1;
|
||||
int i, n = 0, ret = 0;
|
||||
|
||||
|
@ -916,7 +916,7 @@ static int recursive_operation(const char *startfrom,
|
|||
}
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
const struct dirent *const dirent = dirlist[i];
|
||||
const dirent *const dirent = dirlist[i];
|
||||
|
||||
if (FILENAME_IS_CURRPAR(dirent->d_name)) {
|
||||
continue;
|
||||
|
@ -1062,8 +1062,8 @@ static int delete_soft(const char *file, const char **error_message)
|
|||
char *xdg_current_desktop = getenv("XDG_CURRENT_DESKTOP");
|
||||
char *xdg_session_desktop = getenv("XDG_SESSION_DESKTOP");
|
||||
|
||||
if ((xdg_current_desktop != NULL && STREQ(xdg_current_desktop, "KDE")) ||
|
||||
(xdg_session_desktop != NULL && STREQ(xdg_session_desktop, "KDE")))
|
||||
if ((xdg_current_desktop != nullptr && STREQ(xdg_current_desktop, "KDE")) ||
|
||||
(xdg_session_desktop != nullptr && STREQ(xdg_session_desktop, "KDE")))
|
||||
{
|
||||
args[0] = "kioclient5";
|
||||
args[1] = "move";
|
||||
|
|
|
@ -653,7 +653,7 @@ void aabb_get_near_far_from_plane(const float plane_no[3],
|
|||
/** \name dist_squared_to_ray_to_aabb and helpers
|
||||
* \{ */
|
||||
|
||||
void dist_squared_ray_to_aabb_v3_precalc(struct DistRayAABB_Precalc *neasrest_precalc,
|
||||
void dist_squared_ray_to_aabb_v3_precalc(DistRayAABB_Precalc *neasrest_precalc,
|
||||
const float ray_origin[3],
|
||||
const float ray_direction[3])
|
||||
{
|
||||
|
@ -667,7 +667,7 @@ void dist_squared_ray_to_aabb_v3_precalc(struct DistRayAABB_Precalc *neasrest_pr
|
|||
}
|
||||
}
|
||||
|
||||
float dist_squared_ray_to_aabb_v3(const struct DistRayAABB_Precalc *data,
|
||||
float dist_squared_ray_to_aabb_v3(const DistRayAABB_Precalc *data,
|
||||
const float bb_min[3],
|
||||
const float bb_max[3],
|
||||
float r_point[3],
|
||||
|
@ -763,7 +763,7 @@ float dist_squared_ray_to_aabb_v3_simple(const float ray_origin[3],
|
|||
float r_point[3],
|
||||
float *r_depth)
|
||||
{
|
||||
struct DistRayAABB_Precalc data;
|
||||
DistRayAABB_Precalc data;
|
||||
dist_squared_ray_to_aabb_v3_precalc(&data, ray_origin, ray_direction);
|
||||
return dist_squared_ray_to_aabb_v3(&data, bb_min, bb_max, r_point, r_depth);
|
||||
}
|
||||
|
@ -774,7 +774,7 @@ float dist_squared_ray_to_aabb_v3_simple(const float ray_origin[3],
|
|||
/** \name dist_squared_to_projected_aabb and helpers
|
||||
* \{ */
|
||||
|
||||
void dist_squared_to_projected_aabb_precalc(struct DistProjectedAABBPrecalc *precalc,
|
||||
void dist_squared_to_projected_aabb_precalc(DistProjectedAABBPrecalc *precalc,
|
||||
const float projmat[4][4],
|
||||
const float winsize[2],
|
||||
const float mval[2])
|
||||
|
@ -826,7 +826,7 @@ void dist_squared_to_projected_aabb_precalc(struct DistProjectedAABBPrecalc *pre
|
|||
}
|
||||
}
|
||||
|
||||
float dist_squared_to_projected_aabb(struct DistProjectedAABBPrecalc *data,
|
||||
float dist_squared_to_projected_aabb(DistProjectedAABBPrecalc *data,
|
||||
const float bbmin[3],
|
||||
const float bbmax[3],
|
||||
bool r_axis_closest[3])
|
||||
|
@ -962,7 +962,7 @@ float dist_squared_to_projected_aabb_simple(const float projmat[4][4],
|
|||
const float bbmin[3],
|
||||
const float bbmax[3])
|
||||
{
|
||||
struct DistProjectedAABBPrecalc data;
|
||||
DistProjectedAABBPrecalc data;
|
||||
dist_squared_to_projected_aabb_precalc(&data, projmat, winsize, mval);
|
||||
|
||||
bool dummy[3] = {true, true, true};
|
||||
|
@ -1070,14 +1070,14 @@ int isect_seg_seg_v2_int(const int v1[2], const int v2[2], const int v3[2], cons
|
|||
{
|
||||
float div, lambda, mu;
|
||||
|
||||
div = (float)((v2[0] - v1[0]) * (v4[1] - v3[1]) - (v2[1] - v1[1]) * (v4[0] - v3[0]));
|
||||
div = float((v2[0] - v1[0]) * (v4[1] - v3[1]) - (v2[1] - v1[1]) * (v4[0] - v3[0]));
|
||||
if (div == 0.0f) {
|
||||
return ISECT_LINE_LINE_COLINEAR;
|
||||
}
|
||||
|
||||
lambda = (float)((v1[1] - v3[1]) * (v4[0] - v3[0]) - (v1[0] - v3[0]) * (v4[1] - v3[1])) / div;
|
||||
lambda = float((v1[1] - v3[1]) * (v4[0] - v3[0]) - (v1[0] - v3[0]) * (v4[1] - v3[1])) / div;
|
||||
|
||||
mu = (float)((v1[1] - v3[1]) * (v2[0] - v1[0]) - (v1[0] - v3[0]) * (v2[1] - v1[1])) / div;
|
||||
mu = float((v1[1] - v3[1]) * (v2[0] - v1[0]) - (v1[0] - v3[0]) * (v2[1] - v1[1])) / div;
|
||||
|
||||
if (lambda >= 0.0f && lambda <= 1.0f && mu >= 0.0f && mu <= 1.0f) {
|
||||
if (lambda == 0.0f || lambda == 1.0f || mu == 0.0f || mu == 1.0f) {
|
||||
|
@ -1120,9 +1120,9 @@ int isect_seg_seg_v2(const float v1[2], const float v2[2], const float v3[2], co
|
|||
return ISECT_LINE_LINE_COLINEAR;
|
||||
}
|
||||
|
||||
lambda = ((float)(v1[1] - v3[1]) * (v4[0] - v3[0]) - (v1[0] - v3[0]) * (v4[1] - v3[1])) / div;
|
||||
lambda = (float(v1[1] - v3[1]) * (v4[0] - v3[0]) - (v1[0] - v3[0]) * (v4[1] - v3[1])) / div;
|
||||
|
||||
mu = ((float)(v1[1] - v3[1]) * (v2[0] - v1[0]) - (v1[0] - v3[0]) * (v2[1] - v1[1])) / div;
|
||||
mu = (float(v1[1] - v3[1]) * (v2[0] - v1[0]) - (v1[0] - v3[0]) * (v2[1] - v1[1])) / div;
|
||||
|
||||
if (lambda >= 0.0f && lambda <= 1.0f && mu >= 0.0f && mu <= 1.0f) {
|
||||
if (lambda == 0.0f || lambda == 1.0f || mu == 0.0f || mu == 1.0f) {
|
||||
|
@ -1781,7 +1781,7 @@ bool isect_ray_tri_epsilon_v3(const float ray_origin[3],
|
|||
return true;
|
||||
}
|
||||
|
||||
void isect_ray_tri_watertight_v3_precalc(struct IsectRayPrecalc *isect_precalc,
|
||||
void isect_ray_tri_watertight_v3_precalc(IsectRayPrecalc *isect_precalc,
|
||||
const float ray_direction[3])
|
||||
{
|
||||
float inv_dir_z;
|
||||
|
@ -1809,7 +1809,7 @@ void isect_ray_tri_watertight_v3_precalc(struct IsectRayPrecalc *isect_precalc,
|
|||
}
|
||||
|
||||
bool isect_ray_tri_watertight_v3(const float ray_origin[3],
|
||||
const struct IsectRayPrecalc *isect_precalc,
|
||||
const IsectRayPrecalc *isect_precalc,
|
||||
const float v0[3],
|
||||
const float v1[3],
|
||||
const float v2[3],
|
||||
|
@ -1859,7 +1859,7 @@ bool isect_ray_tri_watertight_v3(const float ray_origin[3],
|
|||
/* Calculate scaled z-coordinates of vertices and use them to calculate
|
||||
* the hit distance.
|
||||
*/
|
||||
const int sign_det = (float_as_int(det) & (int)0x80000000);
|
||||
const int sign_det = (float_as_int(det) & int(0x80000000));
|
||||
const float t = (u * a_kz + v * b_kz + w * c_kz) * sz;
|
||||
const float sign_t = xor_fl(t, sign_det);
|
||||
if ((sign_t < 0.0f)
|
||||
|
@ -1892,7 +1892,7 @@ bool isect_ray_tri_watertight_v3_simple(const float ray_origin[3],
|
|||
float *r_lambda,
|
||||
float r_uv[2])
|
||||
{
|
||||
struct IsectRayPrecalc isect_precalc;
|
||||
IsectRayPrecalc isect_precalc;
|
||||
isect_ray_tri_watertight_v3_precalc(&isect_precalc, ray_direction);
|
||||
return isect_ray_tri_watertight_v3(ray_origin, &isect_precalc, v0, v1, v2, r_lambda, r_uv);
|
||||
}
|
||||
|
@ -2250,9 +2250,9 @@ bool isect_tri_tri_v3_ex(const float tri_a[3][3],
|
|||
sub_v3db_v3fl_v3fl(bc, tri_a[2], tri_a[1]);
|
||||
cross_v3_v3v3_db(plane_a, ba, bc);
|
||||
plane_a[3] = -dot_v3db_v3fl(plane_a, tri_a[1]);
|
||||
side[1][0] = (float)(dot_v3db_v3fl(plane_a, tri_b[0]) + plane_a[3]);
|
||||
side[1][1] = (float)(dot_v3db_v3fl(plane_a, tri_b[1]) + plane_a[3]);
|
||||
side[1][2] = (float)(dot_v3db_v3fl(plane_a, tri_b[2]) + plane_a[3]);
|
||||
side[1][0] = float(dot_v3db_v3fl(plane_a, tri_b[0]) + plane_a[3]);
|
||||
side[1][1] = float(dot_v3db_v3fl(plane_a, tri_b[1]) + plane_a[3]);
|
||||
side[1][2] = float(dot_v3db_v3fl(plane_a, tri_b[2]) + plane_a[3]);
|
||||
|
||||
if (!side[1][0] && !side[1][1] && !side[1][2]) {
|
||||
/* Coplanar case is not supported. */
|
||||
|
@ -2271,9 +2271,9 @@ bool isect_tri_tri_v3_ex(const float tri_a[3][3],
|
|||
sub_v3db_v3fl_v3fl(bc, tri_b[2], tri_b[1]);
|
||||
cross_v3_v3v3_db(plane_b, ba, bc);
|
||||
plane_b[3] = -dot_v3db_v3fl(plane_b, tri_b[1]);
|
||||
side[0][0] = (float)(dot_v3db_v3fl(plane_b, tri_a[0]) + plane_b[3]);
|
||||
side[0][1] = (float)(dot_v3db_v3fl(plane_b, tri_a[1]) + plane_b[3]);
|
||||
side[0][2] = (float)(dot_v3db_v3fl(plane_b, tri_a[2]) + plane_b[3]);
|
||||
side[0][0] = float(dot_v3db_v3fl(plane_b, tri_a[0]) + plane_b[3]);
|
||||
side[0][1] = float(dot_v3db_v3fl(plane_b, tri_a[1]) + plane_b[3]);
|
||||
side[0][2] = float(dot_v3db_v3fl(plane_b, tri_a[2]) + plane_b[3]);
|
||||
|
||||
if ((side[0][0] && side[0][1] && side[0][2]) && (side[0][0] < 0.0f) == (side[0][1] < 0.0f) &&
|
||||
(side[0][0] < 0.0f) == (side[0][2] < 0.0f))
|
||||
|
@ -2323,13 +2323,13 @@ bool isect_tri_tri_v3_ex(const float tri_a[3][3],
|
|||
SWAP(int, tri_i[0], tri_i[2]);
|
||||
}
|
||||
|
||||
range[i].min = (float)(dot_b + offset0);
|
||||
range[i].max = (float)(dot_b + offset1);
|
||||
range[i].min = float(dot_b + offset0);
|
||||
range[i].max = float(dot_b + offset1);
|
||||
interp_v3_v3v3(range[i].loc[0], tri[tri_i[1]], tri[tri_i[0]], fac0);
|
||||
interp_v3_v3v3(range[i].loc[1], tri[tri_i[1]], tri[tri_i[2]], fac1);
|
||||
}
|
||||
else {
|
||||
range[i].min = range[i].max = (float)dot_b;
|
||||
range[i].min = range[i].max = float(dot_b);
|
||||
copy_v3_v3(range[i].loc[0], tri[tri_i[1]]);
|
||||
copy_v3_v3(range[i].loc[1], tri[tri_i[1]]);
|
||||
}
|
||||
|
@ -3019,12 +3019,12 @@ bool isect_ray_ray_epsilon_v3(const float ray_origin_a[3],
|
|||
sub_v3_v3v3(t, ray_origin_b, ray_origin_a);
|
||||
sub_v3_v3v3(c, n, t);
|
||||
|
||||
if (r_lambda_a != NULL) {
|
||||
if (r_lambda_a != nullptr) {
|
||||
cross_v3_v3v3(cray, c, ray_direction_b);
|
||||
*r_lambda_a = dot_v3v3(cray, n) / nlen;
|
||||
}
|
||||
|
||||
if (r_lambda_b != NULL) {
|
||||
if (r_lambda_b != nullptr) {
|
||||
cross_v3_v3v3(cray, c, ray_direction_a);
|
||||
*r_lambda_b = dot_v3v3(cray, n) / nlen;
|
||||
}
|
||||
|
@ -3057,7 +3057,7 @@ bool isect_aabb_aabb_v3(const float min1[3],
|
|||
min2[1] < max1[1] && min2[2] < max1[2]);
|
||||
}
|
||||
|
||||
void isect_ray_aabb_v3_precalc(struct IsectRayAABB_Precalc *data,
|
||||
void isect_ray_aabb_v3_precalc(IsectRayAABB_Precalc *data,
|
||||
const float ray_origin[3],
|
||||
const float ray_direction[3])
|
||||
{
|
||||
|
@ -3072,7 +3072,7 @@ void isect_ray_aabb_v3_precalc(struct IsectRayAABB_Precalc *data,
|
|||
data->sign[2] = data->ray_inv_dir[2] < 0.0f;
|
||||
}
|
||||
|
||||
bool isect_ray_aabb_v3(const struct IsectRayAABB_Precalc *data,
|
||||
bool isect_ray_aabb_v3(const IsectRayAABB_Precalc *data,
|
||||
const float bb_min[3],
|
||||
const float bb_max[3],
|
||||
float *tmin_out)
|
||||
|
@ -3133,17 +3133,17 @@ bool isect_ray_aabb_v3_simple(const float orig[3],
|
|||
{
|
||||
double t[6];
|
||||
float hit_dist[2];
|
||||
const double invdirx = (dir[0] > 1e-35f || dir[0] < -1e-35f) ? 1.0 / (double)dir[0] : DBL_MAX;
|
||||
const double invdiry = (dir[1] > 1e-35f || dir[1] < -1e-35f) ? 1.0 / (double)dir[1] : DBL_MAX;
|
||||
const double invdirz = (dir[2] > 1e-35f || dir[2] < -1e-35f) ? 1.0 / (double)dir[2] : DBL_MAX;
|
||||
t[0] = (double)(bb_min[0] - orig[0]) * invdirx;
|
||||
t[1] = (double)(bb_max[0] - orig[0]) * invdirx;
|
||||
t[2] = (double)(bb_min[1] - orig[1]) * invdiry;
|
||||
t[3] = (double)(bb_max[1] - orig[1]) * invdiry;
|
||||
t[4] = (double)(bb_min[2] - orig[2]) * invdirz;
|
||||
t[5] = (double)(bb_max[2] - orig[2]) * invdirz;
|
||||
hit_dist[0] = (float)fmax(fmax(fmin(t[0], t[1]), fmin(t[2], t[3])), fmin(t[4], t[5]));
|
||||
hit_dist[1] = (float)fmin(fmin(fmax(t[0], t[1]), fmax(t[2], t[3])), fmax(t[4], t[5]));
|
||||
const double invdirx = (dir[0] > 1e-35f || dir[0] < -1e-35f) ? 1.0 / double(dir[0]) : DBL_MAX;
|
||||
const double invdiry = (dir[1] > 1e-35f || dir[1] < -1e-35f) ? 1.0 / double(dir[1]) : DBL_MAX;
|
||||
const double invdirz = (dir[2] > 1e-35f || dir[2] < -1e-35f) ? 1.0 / double(dir[2]) : DBL_MAX;
|
||||
t[0] = double(bb_min[0] - orig[0]) * invdirx;
|
||||
t[1] = double(bb_max[0] - orig[0]) * invdirx;
|
||||
t[2] = double(bb_min[1] - orig[1]) * invdiry;
|
||||
t[3] = double(bb_max[1] - orig[1]) * invdiry;
|
||||
t[4] = double(bb_min[2] - orig[2]) * invdirz;
|
||||
t[5] = double(bb_max[2] - orig[2]) * invdirz;
|
||||
hit_dist[0] = float(fmax(fmax(fmin(t[0], t[1]), fmin(t[2], t[3])), fmin(t[4], t[5])));
|
||||
hit_dist[1] = float(fmin(fmin(fmax(t[0], t[1]), fmax(t[2], t[3])), fmax(t[4], t[5])));
|
||||
if ((hit_dist[1] < 0.0f) || (hit_dist[0] > hit_dist[1])) {
|
||||
return false;
|
||||
}
|
||||
|
@ -3314,17 +3314,17 @@ int isect_point_tri_v2_int(
|
|||
{
|
||||
float v1[2], v2[2], v3[2], p[2];
|
||||
|
||||
v1[0] = (float)x1;
|
||||
v1[1] = (float)y1;
|
||||
v1[0] = float(x1);
|
||||
v1[1] = float(y1);
|
||||
|
||||
v2[0] = (float)x1;
|
||||
v2[1] = (float)y2;
|
||||
v2[0] = float(x1);
|
||||
v2[1] = float(y2);
|
||||
|
||||
v3[0] = (float)x2;
|
||||
v3[1] = (float)y1;
|
||||
v3[0] = float(x2);
|
||||
v3[1] = float(y1);
|
||||
|
||||
p[0] = (float)a;
|
||||
p[1] = (float)b;
|
||||
p[0] = float(a);
|
||||
p[1] = float(b);
|
||||
|
||||
return isect_point_tri_v2(p, v1, v2, v3);
|
||||
}
|
||||
|
@ -3979,9 +3979,9 @@ int interp_sparse_array(float *array, const int list_size, const float skipval)
|
|||
for (i = 0; i < list_size; i++) {
|
||||
if (array[i] == skipval) {
|
||||
if (array_up[i] != skipval && array_down[i] != skipval) {
|
||||
array[i] = ((array_up[i] * (float)ofs_tot_down[i]) +
|
||||
(array_down[i] * (float)ofs_tot_up[i])) /
|
||||
(float)(ofs_tot_down[i] + ofs_tot_up[i]);
|
||||
array[i] = ((array_up[i] * float(ofs_tot_down[i])) +
|
||||
(array_down[i] * float(ofs_tot_up[i]))) /
|
||||
float(ofs_tot_down[i] + ofs_tot_up[i]);
|
||||
}
|
||||
else if (array_up[i] != skipval) {
|
||||
array[i] = array_up[i];
|
||||
|
@ -4026,8 +4026,7 @@ struct Double2_Len {
|
|||
|
||||
/* Mean value weights - smooth interpolation weights for polygons with
|
||||
* more than 3 vertices */
|
||||
static float mean_value_half_tan_v3(const struct Float3_Len *d_curr,
|
||||
const struct Float3_Len *d_next)
|
||||
static float mean_value_half_tan_v3(const Float3_Len *d_curr, const Float3_Len *d_next)
|
||||
{
|
||||
float cross[3];
|
||||
cross_v3_v3v3(cross, d_curr->dir, d_next->dir);
|
||||
|
@ -4053,8 +4052,7 @@ static float mean_value_half_tan_v3(const struct Float3_Len *d_curr,
|
|||
* do not indicate a point "inside" the polygon.
|
||||
* To resolve this, doubles are used.
|
||||
*/
|
||||
static double mean_value_half_tan_v2_db(const struct Double2_Len *d_curr,
|
||||
const struct Double2_Len *d_next)
|
||||
static double mean_value_half_tan_v2_db(const Double2_Len *d_curr, const Double2_Len *d_next)
|
||||
{
|
||||
/* Different from the 3d version but still correct. */
|
||||
const double area = cross_v2v2_db(d_curr->dir, d_next->dir);
|
||||
|
@ -4091,7 +4089,7 @@ void interp_weights_poly_v3(float *w, float v[][3], const int n, const float co[
|
|||
float totweight = 0.0f;
|
||||
int i_curr, i_next;
|
||||
char ix_flag = 0;
|
||||
struct Float3_Len d_curr, d_next;
|
||||
Float3_Len d_curr, d_next;
|
||||
|
||||
/* loop over 'i_next' */
|
||||
i_curr = n - 1;
|
||||
|
@ -4134,7 +4132,7 @@ void interp_weights_poly_v3(float *w, float v[][3], const int n, const float co[
|
|||
}
|
||||
|
||||
if (ix_flag) {
|
||||
memset(w, 0, sizeof(*w) * (size_t)n);
|
||||
memset(w, 0, sizeof(*w) * size_t(n));
|
||||
|
||||
if (ix_flag & IS_POINT_IX) {
|
||||
w[i_curr] = 1.0f;
|
||||
|
@ -4176,7 +4174,7 @@ void interp_weights_poly_v2(float *w, float v[][2], const int n, const float co[
|
|||
float totweight = 0.0f;
|
||||
int i_curr, i_next;
|
||||
char ix_flag = 0;
|
||||
struct Double2_Len d_curr, d_next;
|
||||
Double2_Len d_curr, d_next;
|
||||
|
||||
/* loop over 'i_next' */
|
||||
i_curr = n - 1;
|
||||
|
@ -4207,7 +4205,7 @@ void interp_weights_poly_v2(float *w, float v[][2], const int n, const float co[
|
|||
d_curr = d_next;
|
||||
DIR_V2_SET(&d_next, v_next, co);
|
||||
ht = mean_value_half_tan_v2_db(&d_curr, &d_next);
|
||||
w[i_curr] = (d_curr.len == 0.0) ? 0.0f : (float)((ht_prev + ht) / d_curr.len);
|
||||
w[i_curr] = (d_curr.len == 0.0) ? 0.0f : float((ht_prev + ht) / d_curr.len);
|
||||
totweight += w[i_curr];
|
||||
|
||||
/* step */
|
||||
|
@ -4219,7 +4217,7 @@ void interp_weights_poly_v2(float *w, float v[][2], const int n, const float co[
|
|||
}
|
||||
|
||||
if (ix_flag) {
|
||||
memset(w, 0, sizeof(*w) * (size_t)n);
|
||||
memset(w, 0, sizeof(*w) * size_t(n));
|
||||
|
||||
if (ix_flag & IS_POINT_IX) {
|
||||
w[i_curr] = 1.0f;
|
||||
|
@ -4297,8 +4295,8 @@ void resolve_tri_uv_v2(
|
|||
if (IS_ZERO(det) == 0) {
|
||||
const double x[2] = {st[0] - st2[0], st[1] - st2[1]};
|
||||
|
||||
r_uv[0] = (float)((d * x[0] - b * x[1]) / det);
|
||||
r_uv[1] = (float)(((-c) * x[0] + a * x[1]) / det);
|
||||
r_uv[0] = float((d * x[0] - b * x[1]) / det);
|
||||
r_uv[1] = float(((-c) * x[0] + a * x[1]) / det);
|
||||
}
|
||||
else {
|
||||
zero_v2(r_uv);
|
||||
|
@ -4327,8 +4325,8 @@ void resolve_tri_uv_v3(
|
|||
if (IS_ZERO(det) == 0) {
|
||||
float w;
|
||||
|
||||
w = (float)((d00 * d21 - d01 * d20) / det);
|
||||
r_uv[1] = (float)((d11 * d20 - d01 * d21) / det);
|
||||
w = float((d00 * d21 - d01 * d20) / det);
|
||||
r_uv[1] = float((d11 * d20 - d01 * d21) / det);
|
||||
r_uv[0] = 1.0f - r_uv[1] - w;
|
||||
}
|
||||
else {
|
||||
|
@ -4343,7 +4341,7 @@ void resolve_quad_uv_v2(float r_uv[2],
|
|||
const float st2[2],
|
||||
const float st3[2])
|
||||
{
|
||||
resolve_quad_uv_v2_deriv(r_uv, NULL, st, st0, st1, st2, st3);
|
||||
resolve_quad_uv_v2_deriv(r_uv, nullptr, st, st0, st1, st2, st3);
|
||||
}
|
||||
|
||||
void resolve_quad_uv_v2_deriv(float r_uv[2],
|
||||
|
@ -4364,10 +4362,9 @@ void resolve_quad_uv_v2_deriv(float r_uv[2],
|
|||
const double a = (st0[0] - st[0]) * (st0[1] - st3[1]) - (st0[1] - st[1]) * (st0[0] - st3[0]);
|
||||
|
||||
/* B = ( (p0 - p) X (p1 - p2) + (p1 - p) X (p0 - p3) ) / 2 */
|
||||
const double b = 0.5 * (double)(((st0[0] - st[0]) * (st1[1] - st2[1]) -
|
||||
(st0[1] - st[1]) * (st1[0] - st2[0])) +
|
||||
((st1[0] - st[0]) * (st0[1] - st3[1]) -
|
||||
(st1[1] - st[1]) * (st0[0] - st3[0])));
|
||||
const double b =
|
||||
0.5 * double(((st0[0] - st[0]) * (st1[1] - st2[1]) - (st0[1] - st[1]) * (st1[0] - st2[0])) +
|
||||
((st1[0] - st[0]) * (st0[1] - st3[1]) - (st1[1] - st[1]) * (st0[0] - st3[0])));
|
||||
|
||||
/* C = (p1-p) X (p1-p2) */
|
||||
const double fC = (st1[0] - st[0]) * (st1[1] - st2[1]) - (st1[1] - st[1]) * (st1[0] - st2[0]);
|
||||
|
@ -4379,7 +4376,7 @@ void resolve_quad_uv_v2_deriv(float r_uv[2],
|
|||
if (IS_ZERO(denom) != 0) {
|
||||
const double fDen = a - fC;
|
||||
if (IS_ZERO(fDen) == 0) {
|
||||
r_uv[0] = (float)(a / fDen);
|
||||
r_uv[0] = float(a / fDen);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -4387,7 +4384,7 @@ void resolve_quad_uv_v2_deriv(float r_uv[2],
|
|||
const double desc = sqrt(desc_sq < 0.0 ? 0.0 : desc_sq);
|
||||
const double s = signed_area > 0 ? (-1.0) : 1.0;
|
||||
|
||||
r_uv[0] = (float)(((a - b) + s * desc) / denom);
|
||||
r_uv[0] = float(((a - b) + s * desc) / denom);
|
||||
}
|
||||
|
||||
/* find UV such that
|
||||
|
@ -4404,9 +4401,8 @@ void resolve_quad_uv_v2_deriv(float r_uv[2],
|
|||
}
|
||||
|
||||
if (IS_ZERO(denom) == 0) {
|
||||
r_uv[1] = (float)((double)((1.0f - r_uv[0]) * (st0[i] - st[i]) +
|
||||
r_uv[0] * (st1[i] - st[i])) /
|
||||
denom);
|
||||
r_uv[1] = float(double((1.0f - r_uv[0]) * (st0[i] - st[i]) + r_uv[0] * (st1[i] - st[i])) /
|
||||
denom);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4428,10 +4424,10 @@ void resolve_quad_uv_v2_deriv(float r_uv[2],
|
|||
|
||||
if (!IS_ZERO(denom)) {
|
||||
double inv_denom = 1.0 / denom;
|
||||
r_deriv[0][0] = (float)((double)-t[1] * inv_denom);
|
||||
r_deriv[0][1] = (float)((double)t[0] * inv_denom);
|
||||
r_deriv[1][0] = (float)((double)s[1] * inv_denom);
|
||||
r_deriv[1][1] = (float)((double)-s[0] * inv_denom);
|
||||
r_deriv[0][0] = float(double(-t[1]) * inv_denom);
|
||||
r_deriv[0][1] = float(double(t[0]) * inv_denom);
|
||||
r_deriv[1][0] = float(double(s[1]) * inv_denom);
|
||||
r_deriv[1][1] = float(double(-s[0]) * inv_denom);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4452,10 +4448,9 @@ float resolve_quad_u_v2(const float st[2],
|
|||
const double a = (st0[0] - st[0]) * (st0[1] - st3[1]) - (st0[1] - st[1]) * (st0[0] - st3[0]);
|
||||
|
||||
/* B = ( (p0 - p) X (p1 - p2) + (p1 - p) X (p0 - p3) ) / 2 */
|
||||
const double b = 0.5 * (double)(((st0[0] - st[0]) * (st1[1] - st2[1]) -
|
||||
(st0[1] - st[1]) * (st1[0] - st2[0])) +
|
||||
((st1[0] - st[0]) * (st0[1] - st3[1]) -
|
||||
(st1[1] - st[1]) * (st0[0] - st3[0])));
|
||||
const double b =
|
||||
0.5 * double(((st0[0] - st[0]) * (st1[1] - st2[1]) - (st0[1] - st[1]) * (st1[0] - st2[0])) +
|
||||
((st1[0] - st[0]) * (st0[1] - st3[1]) - (st1[1] - st[1]) * (st0[0] - st3[0])));
|
||||
|
||||
/* C = (p1-p) X (p1-p2) */
|
||||
const double fC = (st1[0] - st[0]) * (st1[1] - st2[1]) - (st1[1] - st[1]) * (st1[0] - st2[0]);
|
||||
|
@ -4464,7 +4459,7 @@ float resolve_quad_u_v2(const float st[2],
|
|||
if (IS_ZERO(denom) != 0) {
|
||||
const double fDen = a - fC;
|
||||
if (IS_ZERO(fDen) == 0) {
|
||||
return (float)(a / fDen);
|
||||
return float(a / fDen);
|
||||
}
|
||||
|
||||
return 0.0f;
|
||||
|
@ -4474,7 +4469,7 @@ float resolve_quad_u_v2(const float st[2],
|
|||
const double desc = sqrt(desc_sq < 0.0 ? 0.0 : desc_sq);
|
||||
const double s = signed_area > 0 ? (-1.0) : 1.0;
|
||||
|
||||
return (float)(((a - b) + s * desc) / denom);
|
||||
return float(((a - b) + s * desc) / denom);
|
||||
}
|
||||
|
||||
#undef IS_ZERO
|
||||
|
@ -4730,14 +4725,14 @@ void projmat_from_subregion(const float projmat[4][4],
|
|||
const int y_max,
|
||||
float r_projmat[4][4])
|
||||
{
|
||||
float rect_width = (float)(x_max - x_min);
|
||||
float rect_height = (float)(y_max - y_min);
|
||||
float rect_width = float(x_max - x_min);
|
||||
float rect_height = float(y_max - y_min);
|
||||
|
||||
float x_sca = (float)win_size[0] / rect_width;
|
||||
float y_sca = (float)win_size[1] / rect_height;
|
||||
float x_sca = float(win_size[0]) / rect_width;
|
||||
float y_sca = float(win_size[1]) / rect_height;
|
||||
|
||||
float x_fac = (float)((x_min + x_max) - win_size[0]) / rect_width;
|
||||
float y_fac = (float)((y_min + y_max) - win_size[1]) / rect_height;
|
||||
float x_fac = float((x_min + x_max) - win_size[0]) / rect_width;
|
||||
float y_fac = float((y_min + y_max) - win_size[1]) / rect_height;
|
||||
|
||||
copy_m4_m4(r_projmat, projmat);
|
||||
r_projmat[0][0] *= x_sca;
|
||||
|
@ -4944,7 +4939,7 @@ bool map_to_tube(float *r_u, float *r_v, const float x, const float y, const flo
|
|||
}
|
||||
else {
|
||||
/* The "Regular" case, just compute the coordinate. */
|
||||
*r_u = snap_coordinate(atan2f(x, -y) / (float)(2.0f * M_PI));
|
||||
*r_u = snap_coordinate(atan2f(x, -y) / float(2.0f * M_PI));
|
||||
}
|
||||
*r_v = (z + 1.0f) / 2.0f;
|
||||
return regular;
|
||||
|
@ -4961,9 +4956,9 @@ bool map_to_sphere(float *r_u, float *r_v, const float x, const float y, const f
|
|||
}
|
||||
else {
|
||||
/* The "Regular" case, just compute the coordinate. */
|
||||
*r_u = snap_coordinate(atan2f(x, -y) / (float)(2.0f * M_PI));
|
||||
*r_u = snap_coordinate(atan2f(x, -y) / float(2.0f * M_PI));
|
||||
}
|
||||
*r_v = snap_coordinate(atan2f(len_xy, -z) / (float)M_PI);
|
||||
*r_v = snap_coordinate(atan2f(len_xy, -z) / float(M_PI));
|
||||
return regular;
|
||||
}
|
||||
|
||||
|
@ -5040,7 +5035,7 @@ void accumulate_vertex_normals_v3(float n1[3],
|
|||
const float co4[3])
|
||||
{
|
||||
float vdiffs[4][3];
|
||||
const int nverts = (n4 != NULL && co4 != NULL) ? 4 : 3;
|
||||
const int nverts = (n4 != nullptr && co4 != nullptr) ? 4 : 3;
|
||||
|
||||
/* compute normalized edge vectors */
|
||||
sub_v3_v3v3(vdiffs[0], co2, co1);
|
||||
|
@ -5211,7 +5206,7 @@ void vcloud_estimate_transform_v3(const int list_size,
|
|||
}
|
||||
}
|
||||
if (!weight || !rweight) {
|
||||
accu_weight = accu_rweight = (float)list_size;
|
||||
accu_weight = accu_rweight = float(list_size);
|
||||
}
|
||||
|
||||
mul_v3_fl(accu_com, 1.0f / accu_weight);
|
||||
|
@ -5725,7 +5720,7 @@ float form_factor_quad(const float p[3],
|
|||
dot3 = dot_v3v3(n, g2);
|
||||
dot4 = dot_v3v3(n, g3);
|
||||
|
||||
result = (a1 * dot1 + a2 * dot2 + a3 * dot3 + a4 * dot4) * 0.5f / (float)M_PI;
|
||||
result = (a1 * dot1 + a2 * dot2 + a3 * dot3 + a4 * dot4) * 0.5f / float(M_PI);
|
||||
result = MAX2(result, 0.0f);
|
||||
|
||||
return result;
|
||||
|
|
|
@ -76,7 +76,7 @@ int BLI_path_sequence_decode(const char *path,
|
|||
const char *const lslash = BLI_path_slash_rfind(path);
|
||||
const char *const extension = BLI_path_extension_or_end(lslash ? lslash : path);
|
||||
const uint lslash_len = lslash != nullptr ? int(lslash - path) : 0;
|
||||
const uint name_end = (uint)(extension - path);
|
||||
const uint name_end = uint(extension - path);
|
||||
|
||||
for (i = name_end - 1; i >= int(lslash_len); i--) {
|
||||
if (isdigit(path[i])) {
|
||||
|
@ -108,7 +108,7 @@ int BLI_path_sequence_decode(const char *path,
|
|||
if (r_digits_len) {
|
||||
*r_digits_len = nume - nums + 1;
|
||||
}
|
||||
return (int)ret;
|
||||
return int(ret);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1166,7 +1166,7 @@ bool BLI_path_abs(char path[FILE_MAX], const char *basepath)
|
|||
|
||||
if (lslash) {
|
||||
/* Length up to and including last `/`. */
|
||||
const int baselen = (int)(lslash - base) + 1;
|
||||
const int baselen = int(lslash - base) + 1;
|
||||
/* Use path for temp storage here, we copy back over it right away. */
|
||||
BLI_strncpy(path, tmp + 2, FILE_MAX); /* Strip `//` prefix. */
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ double BLI_dir_free_space(const char *dir)
|
|||
}
|
||||
# endif
|
||||
|
||||
return ((double(disk.f_bsize)) * (double(disk.f_bfree)));
|
||||
return double(disk.f_bsize) * double(disk.f_bfree);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -563,7 +563,7 @@ LinkNode *BLI_file_read_as_lines(const char *filepath)
|
|||
}
|
||||
|
||||
BLI_fseek(fp, 0, SEEK_END);
|
||||
size = (size_t)BLI_ftell(fp);
|
||||
size = size_t(BLI_ftell(fp));
|
||||
BLI_fseek(fp, 0, SEEK_SET);
|
||||
|
||||
if (UNLIKELY(size == size_t(-1))) {
|
||||
|
|
|
@ -319,7 +319,7 @@ BLI_INLINE char *str_utf8_copy_max_bytes_impl(char *dst, const char *src, size_t
|
|||
/* Cast to `uint8_t` is a no-op, quiets array subscript of type `char` warning.
|
||||
* No need to check `src` points to a nil byte as this will return from the switch statement. */
|
||||
size_t utf8_size;
|
||||
while ((utf8_size = (size_t)utf8_char_compute_skip(*src)) < dst_maxncpy) {
|
||||
while ((utf8_size = size_t(utf8_char_compute_skip(*src))) < dst_maxncpy) {
|
||||
dst_maxncpy -= utf8_size;
|
||||
/* Prefer more compact block. */
|
||||
/* NOLINTBEGIN: bugprone-assignment-in-if-condition */
|
||||
|
@ -356,7 +356,7 @@ size_t BLI_strncpy_utf8_rlen(char *__restrict dst, const char *__restrict src, s
|
|||
char *r_dst = dst;
|
||||
dst = str_utf8_copy_max_bytes_impl(dst, src, dst_maxncpy);
|
||||
|
||||
return (size_t)(dst - r_dst);
|
||||
return size_t(dst - r_dst);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
@ -371,7 +371,7 @@ size_t BLI_strncpy_wchar_as_utf8(char *__restrict dst,
|
|||
|
||||
size_t len = 0;
|
||||
while (*src && len < dst_maxncpy) {
|
||||
len += BLI_str_utf8_from_unicode((uint)*src++, dst + len, dst_maxncpy - len);
|
||||
len += BLI_str_utf8_from_unicode(uint(*src++), dst + len, dst_maxncpy - len);
|
||||
}
|
||||
dst[len] = '\0';
|
||||
/* Return the correct length when part of the final byte did not fit into the string. */
|
||||
|
@ -386,7 +386,7 @@ size_t BLI_wstrlen_utf8(const wchar_t *src)
|
|||
size_t len = 0;
|
||||
|
||||
while (*src) {
|
||||
len += BLI_str_utf8_from_unicode_len((uint)*src++);
|
||||
len += BLI_str_utf8_from_unicode_len(uint(*src++));
|
||||
}
|
||||
|
||||
return len;
|
||||
|
@ -401,7 +401,7 @@ size_t BLI_strlen_utf8_ex(const char *strc, size_t *r_len_bytes)
|
|||
strc += BLI_str_utf8_size_safe(strc);
|
||||
}
|
||||
|
||||
*r_len_bytes = (size_t)(strc - strc_orig);
|
||||
*r_len_bytes = size_t(strc - strc_orig);
|
||||
return len;
|
||||
}
|
||||
|
||||
|
@ -418,7 +418,7 @@ size_t BLI_strnlen_utf8_ex(const char *strc, const size_t strc_maxlen, size_t *r
|
|||
const char *strc_end = strc + strc_maxlen;
|
||||
|
||||
while (true) {
|
||||
size_t step = (size_t)BLI_str_utf8_size_safe(strc);
|
||||
size_t step = size_t(BLI_str_utf8_size_safe(strc));
|
||||
if (!*strc || strc + step > strc_end) {
|
||||
break;
|
||||
}
|
||||
|
@ -426,7 +426,7 @@ size_t BLI_strnlen_utf8_ex(const char *strc, const size_t strc_maxlen, size_t *r
|
|||
len++;
|
||||
}
|
||||
|
||||
*r_len_bytes = (size_t)(strc - strc_orig);
|
||||
*r_len_bytes = size_t(strc - strc_orig);
|
||||
return len;
|
||||
}
|
||||
|
||||
|
@ -762,7 +762,7 @@ uint BLI_str_utf8_as_unicode_step_or_error(const char *__restrict p,
|
|||
const size_t p_len,
|
||||
size_t *__restrict index)
|
||||
{
|
||||
const uchar c = (uchar) * (p += *index);
|
||||
const uchar c = uchar(*(p += *index));
|
||||
|
||||
BLI_assert(*index < p_len);
|
||||
BLI_assert(c != '\0');
|
||||
|
@ -788,7 +788,7 @@ uint BLI_str_utf8_as_unicode_step_safe(const char *__restrict p,
|
|||
{
|
||||
uint result = BLI_str_utf8_as_unicode_step_or_error(p, p_len, index);
|
||||
if (UNLIKELY(result == BLI_UTF8_ERR)) {
|
||||
result = (uint)p[*index];
|
||||
result = uint(p[*index]);
|
||||
*index += 1;
|
||||
}
|
||||
BLI_assert(*index <= p_len);
|
||||
|
@ -854,10 +854,10 @@ size_t BLI_str_utf8_from_unicode(uint c, char *dst, const size_t dst_maxncpy)
|
|||
}
|
||||
|
||||
for (uint i = len - 1; i > 0; i--) {
|
||||
dst[i] = (char)((c & 0x3f) | 0x80);
|
||||
dst[i] = char((c & 0x3f) | 0x80);
|
||||
c >>= 6;
|
||||
}
|
||||
dst[0] = (char)(c | first);
|
||||
dst[0] = char(c | first);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
@ -883,7 +883,7 @@ size_t BLI_str_utf8_as_utf32(char32_t *__restrict dst_w,
|
|||
else {
|
||||
*dst_w = '?';
|
||||
const char *src_c_next = BLI_str_find_next_char_utf8(src_c + index, src_c_end);
|
||||
index = (size_t)(src_c_next - src_c);
|
||||
index = size_t(src_c_next - src_c);
|
||||
}
|
||||
dst_w++;
|
||||
len++;
|
||||
|
@ -903,7 +903,7 @@ size_t BLI_str_utf32_as_utf8(char *__restrict dst,
|
|||
|
||||
size_t len = 0;
|
||||
while (*src && len < dst_maxncpy) {
|
||||
len += BLI_str_utf8_from_unicode((uint)*src++, dst + len, dst_maxncpy - len);
|
||||
len += BLI_str_utf8_from_unicode(uint(*src++), dst + len, dst_maxncpy - len);
|
||||
}
|
||||
dst[len] = '\0';
|
||||
/* Return the correct length when part of the final byte did not fit into the string. */
|
||||
|
@ -919,7 +919,7 @@ size_t BLI_str_utf32_as_utf8_len_ex(const char32_t *src, const size_t src_maxlen
|
|||
const char32_t *src_end = src + src_maxlen;
|
||||
|
||||
while ((src < src_end) && *src) {
|
||||
len += BLI_str_utf8_from_unicode_len((uint)*src++);
|
||||
len += BLI_str_utf8_from_unicode_len(uint(*src++));
|
||||
}
|
||||
|
||||
return len;
|
||||
|
@ -930,7 +930,7 @@ size_t BLI_str_utf32_as_utf8_len(const char32_t *src)
|
|||
size_t len = 0;
|
||||
|
||||
while (*src) {
|
||||
len += BLI_str_utf8_from_unicode_len((uint)*src++);
|
||||
len += BLI_str_utf8_from_unicode_len(uint(*src++));
|
||||
}
|
||||
|
||||
return len;
|
||||
|
@ -987,7 +987,7 @@ size_t BLI_str_partition_ex_utf8(const char *str,
|
|||
const char **r_suf,
|
||||
const bool from_right)
|
||||
{
|
||||
const size_t str_len = end ? (size_t)(end - str) : strlen(str);
|
||||
const size_t str_len = end ? size_t(end - str) : strlen(str);
|
||||
if (end == nullptr) {
|
||||
end = str + str_len;
|
||||
}
|
||||
|
@ -1003,7 +1003,7 @@ size_t BLI_str_partition_ex_utf8(const char *str,
|
|||
str + index))
|
||||
{
|
||||
size_t index_ofs = 0;
|
||||
const uint c = BLI_str_utf8_as_unicode_step_or_error(sep, (size_t)(end - sep), &index_ofs);
|
||||
const uint c = BLI_str_utf8_as_unicode_step_or_error(sep, size_t(end - sep), &index_ofs);
|
||||
if (UNLIKELY(c == BLI_UTF8_ERR)) {
|
||||
break;
|
||||
}
|
||||
|
@ -1014,7 +1014,7 @@ size_t BLI_str_partition_ex_utf8(const char *str,
|
|||
/* `suf` is already correct in case from_right is true. */
|
||||
*r_sep = sep;
|
||||
*r_suf = from_right ? suf : (char *)(str + index);
|
||||
return (size_t)(sep - str);
|
||||
return size_t(sep - str);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1063,7 +1063,7 @@ int BLI_str_utf8_offset_from_index(const char *str, const size_t str_len, const
|
|||
UNUSED_VARS(code);
|
||||
index++;
|
||||
}
|
||||
return (int)offset;
|
||||
return int(offset);
|
||||
}
|
||||
|
||||
int BLI_str_utf8_offset_to_column(const char *str, const size_t str_len, const int offset_target)
|
||||
|
@ -1092,7 +1092,7 @@ int BLI_str_utf8_offset_from_column(const char *str, const size_t str_len, const
|
|||
}
|
||||
offset = offset_next;
|
||||
}
|
||||
return (int)offset;
|
||||
return int(offset);
|
||||
}
|
||||
|
||||
int BLI_str_utf8_offset_to_column_with_tabs(const char *str,
|
||||
|
@ -1129,7 +1129,7 @@ int BLI_str_utf8_offset_from_column_with_tabs(const char *str,
|
|||
}
|
||||
offset = offset_next;
|
||||
}
|
||||
return (int)offset;
|
||||
return int(offset);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
|
|
@ -114,11 +114,11 @@ bool BLI_string_replace_table_exact(char *string,
|
|||
size_t BLI_string_replace_range(
|
||||
char *string, size_t string_maxncpy, int src_beg, int src_end, const char *dst)
|
||||
{
|
||||
int string_len = (int)strlen(string);
|
||||
int string_len = int(strlen(string));
|
||||
BLI_assert(src_beg <= src_end);
|
||||
BLI_assert(src_end <= string_len);
|
||||
const int src_len = src_end - src_beg;
|
||||
int dst_len = (int)strlen(dst);
|
||||
int dst_len = int(strlen(dst));
|
||||
|
||||
if (src_len < dst_len) {
|
||||
/* Grow, first handle special cases. */
|
||||
|
@ -140,13 +140,13 @@ size_t BLI_string_replace_range(
|
|||
}
|
||||
|
||||
/* Grow. */
|
||||
memmove(string + (src_end + ofs), string + src_end, (size_t)(string_len - src_end) + 1);
|
||||
memmove(string + (src_end + ofs), string + src_end, size_t(string_len - src_end) + 1);
|
||||
string_len += ofs;
|
||||
}
|
||||
else if (src_len > dst_len) {
|
||||
/* Shrink. */
|
||||
const int ofs = src_len - dst_len;
|
||||
memmove(string + (src_end - ofs), string + src_end, (size_t)(string_len - src_end) + 1);
|
||||
memmove(string + (src_end - ofs), string + src_end, size_t(string_len - src_end) + 1);
|
||||
string_len -= ofs;
|
||||
}
|
||||
else { /* Simple case, no resizing. */
|
||||
|
@ -157,7 +157,7 @@ size_t BLI_string_replace_range(
|
|||
memcpy(string + src_beg, dst, size_t(dst_len));
|
||||
}
|
||||
BLI_assert(string[string_len] == '\0');
|
||||
return (size_t)string_len;
|
||||
return size_t(string_len);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
@ -178,7 +178,7 @@ size_t BLI_string_split_name_number(const char *name,
|
|||
while (a--) {
|
||||
if (name[a] == delim) {
|
||||
r_name_left[a] = '\0'; /* truncate left part here */
|
||||
*r_number = (int)atol(name + a + 1);
|
||||
*r_number = int(atol(name + a + 1));
|
||||
/* casting down to an int, can overflow for large numbers */
|
||||
if (*r_number < 0) {
|
||||
*r_number = 0;
|
||||
|
@ -562,7 +562,7 @@ size_t BLI_string_join_array(char *result,
|
|||
}
|
||||
}
|
||||
*c = '\0';
|
||||
return (size_t)(c - result);
|
||||
return size_t(c - result);
|
||||
}
|
||||
|
||||
size_t BLI_string_join_array_by_sep_char(
|
||||
|
@ -589,7 +589,7 @@ size_t BLI_string_join_array_by_sep_char(
|
|||
}
|
||||
}
|
||||
*c = '\0';
|
||||
return (size_t)(c - result);
|
||||
return size_t(c - result);
|
||||
}
|
||||
|
||||
char *BLI_string_join_arrayN(const char *strings[], uint strings_num)
|
||||
|
|
|
@ -547,8 +547,7 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
|
|||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
blo_update_defaults_scene(bmain, scene);
|
||||
|
||||
if (app_template &&
|
||||
(STREQ(app_template, "Video_Editing") || STREQ(app_template, "2D_Animation"))) {
|
||||
if (app_template && STR_ELEM(app_template, "Video_Editing", "2D_Animation")) {
|
||||
/* Filmic is too slow, use standard until it is optimized. */
|
||||
STRNCPY(scene->view_settings.view_transform, "Standard");
|
||||
STRNCPY(scene->view_settings.look, "None");
|
||||
|
|
|
@ -21,7 +21,7 @@ void SceneTimeNode::convert_to_operations(NodeConverter &converter,
|
|||
|
||||
const int frameNumber = context.get_framenumber();
|
||||
const Scene *scene = context.get_scene();
|
||||
const double frameRate = (double(scene->r.frs_sec) / double(scene->r.frs_sec_base));
|
||||
const double frameRate = double(scene->r.frs_sec) / double(scene->r.frs_sec_base);
|
||||
|
||||
SecondOperation->set_value(float(frameNumber / frameRate));
|
||||
converter.add_operation(SecondOperation);
|
||||
|
|
|
@ -155,8 +155,8 @@ float4 summed_area_table_sum_tiled(SocketReader *buffer, const rcti &area)
|
|||
|
||||
int2 corrected_lower_bound = lower_bound - int2(1, 1);
|
||||
int2 corrected_upper_bound;
|
||||
corrected_upper_bound[0] = math::min((int)buffer->get_width() - 1, upper_bound[0]);
|
||||
corrected_upper_bound[1] = math::min((int)buffer->get_height() - 1, upper_bound[1]);
|
||||
corrected_upper_bound[0] = math::min(int(buffer->get_width()) - 1, upper_bound[0]);
|
||||
corrected_upper_bound[1] = math::min(int(buffer->get_height()) - 1, upper_bound[1]);
|
||||
|
||||
float4 a, b, c, d, addend, substrahend;
|
||||
buffer->read_sampled(
|
||||
|
|
|
@ -321,7 +321,7 @@ void ShadowPunctual::compute_projection_boundaries(float light_radius,
|
|||
* TODO(fclem): Explain derivation.
|
||||
*/
|
||||
float cos_alpha = shadow_radius / max_lit_distance;
|
||||
float sin_alpha = sqrt((1.0f - math::square(cos_alpha)));
|
||||
float sin_alpha = sqrt(1.0f - math::square(cos_alpha));
|
||||
float near_shift = M_SQRT2 * shadow_radius * 0.5f * (sin_alpha - cos_alpha);
|
||||
float side_shift = M_SQRT2 * shadow_radius * 0.5f * (sin_alpha + cos_alpha);
|
||||
float origin_shift = M_SQRT2 * shadow_radius / (sin_alpha - cos_alpha);
|
||||
|
@ -345,7 +345,7 @@ void ShadowPunctual::end_sync(Light &light, float lod_bias)
|
|||
light_radius_, light_radius_ * softness_factor_, max_distance_, near, far, side);
|
||||
|
||||
/* Shift shadow map origin for area light to avoid clipping nearby geometry. */
|
||||
float shift = (is_area_light(light.type)) ? near : 0.0f;
|
||||
float shift = is_area_light(light.type) ? near : 0.0f;
|
||||
|
||||
float4x4 obmat_tmp = light.object_mat;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace blender::workbench {
|
|||
VolumePass::~VolumePass()
|
||||
{
|
||||
GPUShader **sh_p = &shaders_[0][0][0][0];
|
||||
const int n = sizeof(shaders_) / sizeof(*shaders_);
|
||||
const int n = ARRAY_SIZE(shaders_);
|
||||
for (int i = 0; i < n; i++, sh_p++) {
|
||||
GPUShader *sh = *sh_p;
|
||||
if (sh) {
|
||||
|
|
|
@ -509,7 +509,7 @@ void DRW_curves_update()
|
|||
GPUFrameBuffer *temp_fb = nullptr;
|
||||
GPUFrameBuffer *prev_fb = nullptr;
|
||||
if (GPU_type_matches_ex(GPU_DEVICE_ANY, GPU_OS_MAC, GPU_DRIVER_ANY, GPU_BACKEND_METAL)) {
|
||||
if (!(GPU_compute_shader_support())) {
|
||||
if (!GPU_compute_shader_support()) {
|
||||
prev_fb = GPU_framebuffer_active_get();
|
||||
char errorOut[256];
|
||||
/* if the frame-buffer is invalid we need a dummy frame-buffer to be bound. */
|
||||
|
|
|
@ -1822,7 +1822,7 @@ static size_t animdata_filter_grease_pencil_layer_node_recursive(
|
|||
size_t tmp_items = 0;
|
||||
|
||||
/* Add grease pencil layer channels. */
|
||||
BEGIN_ANIMFILTER_SUBCHANNELS ((layer_group.base.flag & GP_LAYER_TREE_NODE_EXPANDED)) {
|
||||
BEGIN_ANIMFILTER_SUBCHANNELS (layer_group.base.flag &GP_LAYER_TREE_NODE_EXPANDED) {
|
||||
LISTBASE_FOREACH_BACKWARD (GreasePencilLayerTreeNode *, node_, &layer_group.children) {
|
||||
tmp_items += animdata_filter_grease_pencil_layer_node_recursive(
|
||||
&tmp_data, ads, grease_pencil, node_->wrap(), filter_mode);
|
||||
|
|
|
@ -876,7 +876,7 @@ KeyingSet *ANIM_keyingset_get_from_idname(Scene *scene, const char *idname)
|
|||
|
||||
bool ANIM_keyingset_context_ok_poll(bContext *C, KeyingSet *ks)
|
||||
{
|
||||
if ((ks->flag & KEYINGSET_ABSOLUTE)) {
|
||||
if (ks->flag & KEYINGSET_ABSOLUTE) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -940,7 +940,7 @@ eModifyKey_Returns ANIM_validate_keyingset(bContext *C,
|
|||
}
|
||||
|
||||
/* if relative Keying Sets, poll and build up the paths */
|
||||
if ((ks->flag & KEYINGSET_ABSOLUTE)) {
|
||||
if (ks->flag & KEYINGSET_ABSOLUTE) {
|
||||
return MODIFYKEY_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ static void gizmo_snap_rna_snap_elem_index_get_fn(PointerRNA * /*ptr*/,
|
|||
static int gizmo_snap_rna_snap_srouce_type_get_fn(PointerRNA * /*ptr*/, PropertyRNA * /*prop*/)
|
||||
{
|
||||
V3DSnapCursorData *snap_data = ED_view3d_cursor_snap_data_get();
|
||||
return (int)snap_data->type_source;
|
||||
return int(snap_data->type_source);
|
||||
}
|
||||
|
||||
static void gizmo_snap_rna_snap_srouce_type_set_fn(PointerRNA * /*ptr*/,
|
||||
|
|
|
@ -1472,7 +1472,7 @@ static void paint_draw_2D_view_brush_cursor_default(PaintCursorContext *pcontext
|
|||
|
||||
static void grease_pencil_eraser_draw(PaintCursorContext *pcontext)
|
||||
{
|
||||
float radius = static_cast<float>(BKE_brush_size_get(pcontext->scene, pcontext->brush));
|
||||
float radius = float(BKE_brush_size_get(pcontext->scene, pcontext->brush));
|
||||
|
||||
/* Red-ish color with alpha. */
|
||||
immUniformColor4ub(255, 100, 100, 20);
|
||||
|
|
|
@ -357,7 +357,7 @@ static int sound_mixdown_exec(bContext *C, wmOperator *op)
|
|||
|
||||
BLI_path_abs(filepath, BKE_main_blendfile_path(bmain));
|
||||
|
||||
const double fps = (double(scene_eval->r.frs_sec) / double(scene_eval->r.frs_sec_base));
|
||||
const double fps = double(scene_eval->r.frs_sec) / double(scene_eval->r.frs_sec_base);
|
||||
const int start_frame = scene_eval->r.sfra;
|
||||
const int end_frame = scene_eval->r.efra;
|
||||
|
||||
|
|
|
@ -794,7 +794,7 @@ static void insert_grease_pencil_key(bAnimContext *ac,
|
|||
bool changed = false;
|
||||
if (hold_previous) {
|
||||
const FramesMapKey active_frame_number = layer->frame_key_at(current_frame_number);
|
||||
if ((active_frame_number == -1) || (layer->frames().lookup(active_frame_number).is_null())) {
|
||||
if ((active_frame_number == -1) || layer->frames().lookup(active_frame_number).is_null()) {
|
||||
/* There is no active frame to hold to, or it's a null frame. Therefore just insert a blank
|
||||
* frame. */
|
||||
changed = grease_pencil->insert_blank_frame(
|
||||
|
|
|
@ -870,7 +870,7 @@ void ED_info_draw_stats(
|
|||
else if ((ob) && (ob->type == OB_LAMP)) {
|
||||
stats_row(col1, labels[LIGHTS], col2, stats_fmt.totlampsel, stats_fmt.totlamp, y, height);
|
||||
}
|
||||
else if ((object_mode == OB_MODE_OBJECT) && ob && (ELEM(ob->type, OB_MESH, OB_FONT))) {
|
||||
else if ((object_mode == OB_MODE_OBJECT) && ob && ELEM(ob->type, OB_MESH, OB_FONT)) {
|
||||
/* Object mode with the active object a mesh or text object. */
|
||||
stats_row(col1, labels[VERTS], col2, stats_fmt.totvertsel, stats_fmt.totvert, y, height);
|
||||
stats_row(col1, labels[EDGES], col2, stats_fmt.totedgesel, stats_fmt.totedge, y, height);
|
||||
|
|
|
@ -1133,7 +1133,7 @@ bool node_is_previewable(const SpaceNode &snode, const bNodeTree &ntree, const b
|
|||
return false;
|
||||
}
|
||||
if (ntree.type == NTREE_SHADER) {
|
||||
return U.experimental.use_shader_node_previews && !(node.is_frame());
|
||||
return U.experimental.use_shader_node_previews && !node.is_frame();
|
||||
}
|
||||
return node.typeinfo->flag & NODE_PREVIEW;
|
||||
}
|
||||
|
|
|
@ -261,7 +261,7 @@ static bNodeSocket *node_find_preview_socket(bNodeTree &ntree, bNode &node)
|
|||
if (socket == nullptr) {
|
||||
socket = get_main_socket(ntree, node, SOCK_IN);
|
||||
if (socket != nullptr && socket->link == nullptr) {
|
||||
if (!(ELEM(socket->type, SOCK_FLOAT, SOCK_VECTOR, SOCK_RGBA))) {
|
||||
if (!ELEM(socket->type, SOCK_FLOAT, SOCK_VECTOR, SOCK_RGBA)) {
|
||||
/* We can not preview a socket with no link and no manual value. */
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -498,7 +498,7 @@ static int GreasePencilLayerToTransData(TransData *td,
|
|||
};
|
||||
|
||||
const blender::Map<int, GreasePencilFrame> &frame_map =
|
||||
duplicate ? (layer->runtime->trans_data_.temp_frames_buffer) : (layer->frames());
|
||||
duplicate ? (layer->runtime->trans_data_.temp_frames_buffer) : layer->frames();
|
||||
|
||||
for (const auto [frame_number, frame] : frame_map.items()) {
|
||||
grease_pencil_frame_to_trans_data(frame_number, frame.is_selected());
|
||||
|
|
|
@ -3616,7 +3616,7 @@ static LineartData *lineart_create_render_buffer(Scene *scene,
|
|||
ld->qtree.recursive_level = LRT_TILE_RECURSIVE_ORTHO;
|
||||
}
|
||||
|
||||
double asp = (double(ld->w) / double(ld->h));
|
||||
double asp = double(ld->w) / double(ld->h);
|
||||
int fit = BKE_camera_sensor_fit(c->sensor_fit, ld->w, ld->h);
|
||||
ld->conf.shift_x = fit == CAMERA_SENSOR_FIT_HOR ? c->shiftx : c->shiftx / asp;
|
||||
ld->conf.shift_y = fit == CAMERA_SENSOR_FIT_VERT ? c->shifty : c->shifty * asp;
|
||||
|
|
|
@ -1793,7 +1793,7 @@ static int exr_has_rgb(MultiPartInputFile &file, const char *rgb_channels[3])
|
|||
std::transform(lower_case_name.begin(),
|
||||
lower_case_name.end(),
|
||||
lower_case_name.begin(),
|
||||
[](unsigned char c) { return std::tolower(c); });
|
||||
[](uchar c) { return std::tolower(c); });
|
||||
|
||||
if (header.channels().findChannel(channel_names[i]) ||
|
||||
header.channels().findChannel(lower_case_name))
|
||||
|
|
|
@ -20,7 +20,7 @@ static void node_exec(GeoNodeExecParams params)
|
|||
{
|
||||
const Scene *scene = DEG_get_input_scene(params.depsgraph());
|
||||
const float scene_ctime = BKE_scene_ctime_get(scene);
|
||||
const double frame_rate = (double(scene->r.frs_sec) / double(scene->r.frs_sec_base));
|
||||
const double frame_rate = double(scene->r.frs_sec) / double(scene->r.frs_sec_base);
|
||||
params.set_output("Seconds", float(scene_ctime / frame_rate));
|
||||
params.set_output("Frame", scene_ctime);
|
||||
}
|
||||
|
|
|
@ -174,7 +174,7 @@ NODE_SHADER_MATERIALX_BEGIN
|
|||
res = (vector[0] + vector[1]) * val(0.5f);
|
||||
break;
|
||||
case SHD_BLEND_RADIAL:
|
||||
res = vector[1].atan2(vector[0]) / (val(float(M_PI * 2.0f))) + val(0.5f);
|
||||
res = vector[1].atan2(vector[0]) / val(float(M_PI * 2.0f)) + val(0.5f);
|
||||
break;
|
||||
case SHD_BLEND_QUADRATIC_SPHERE:
|
||||
res = (val(1.0f) - vector.dotproduct(vector).sqrt()).max(val(0.0f));
|
||||
|
|
|
@ -215,7 +215,7 @@ bool SEQ_retiming_key_is_transition_start(const SeqRetimingKey *key)
|
|||
|
||||
SeqRetimingKey *SEQ_retiming_transition_start_get(SeqRetimingKey *key)
|
||||
{
|
||||
if ((key->flag & SEQ_SPEED_TRANSITION_OUT)) {
|
||||
if (key->flag & SEQ_SPEED_TRANSITION_OUT) {
|
||||
return key - 1;
|
||||
}
|
||||
if (key->flag & SEQ_SPEED_TRANSITION_IN) {
|
||||
|
|
|
@ -624,7 +624,7 @@ int WM_event_absolute_delta_y(const wmEvent *event)
|
|||
*
|
||||
* \note Shift is excluded from this check since it prevented typing `Shift+Space`, see: #85517.
|
||||
*/
|
||||
bool WM_event_is_ime_switch(const struct wmEvent *event)
|
||||
bool WM_event_is_ime_switch(const wmEvent *event)
|
||||
{
|
||||
return (event->val == KM_PRESS) && (event->type == EVT_SPACEKEY) &&
|
||||
(event->modifier & (KM_CTRL | KM_OSKEY | KM_ALT));
|
||||
|
|
|
@ -1704,7 +1704,7 @@ static bool wm_window_timers_process(const bContext *C, int *sleep_us_p)
|
|||
* Even though using `floor` or `round` is more responsive,
|
||||
* it causes CPU intensive loops that may run until the timer is reached, see: #111579. */
|
||||
const double microseconds = 1000000.0;
|
||||
const double sleep_sec = (double(sleep_us) / microseconds);
|
||||
const double sleep_sec = double(sleep_us) / microseconds;
|
||||
const double sleep_sec_next = ntime_min - time;
|
||||
|
||||
if (sleep_sec_next < sleep_sec) {
|
||||
|
|
Loading…
Reference in New Issue