Cleanup: Move int to float conversions outside the function
The function doesn't actually use the `int` value, so the parameter already comes as `float`, this avoids unnecessary conversions.
This commit is contained in:
@@ -36,7 +36,7 @@ void ED_keymap_sculpt(wmKeyConfig *keyconf);
|
||||
void ED_sculpt_update_modal_transform(struct bContext *C, struct Object *ob);
|
||||
void ED_sculpt_init_transform(struct bContext *C,
|
||||
struct Object *ob,
|
||||
const int mval[2],
|
||||
const float mval_fl[2],
|
||||
const char *undo_name);
|
||||
void ED_sculpt_end_transform(struct bContext *C, struct Object *ob);
|
||||
|
||||
|
||||
@@ -271,7 +271,7 @@ bool ED_uvedit_nearest_uv_multi(const struct View2D *v2d,
|
||||
const struct Scene *scene,
|
||||
struct Object **objects,
|
||||
uint objects_len,
|
||||
const int mval[2],
|
||||
const float mval_fl[2],
|
||||
const bool ignore_selected,
|
||||
float *dist_sq,
|
||||
float r_uv[2]);
|
||||
|
||||
@@ -1579,7 +1579,7 @@ static int sculpt_cloth_filter_invoke(bContext *C, wmOperator *op, const wmEvent
|
||||
ob,
|
||||
sd,
|
||||
SCULPT_UNDO_COORDS,
|
||||
event->mval,
|
||||
mval_fl,
|
||||
RNA_float_get(op->ptr, "area_normal_radius"),
|
||||
RNA_float_get(op->ptr, "strength"));
|
||||
|
||||
|
||||
@@ -342,6 +342,7 @@ static int sculpt_color_filter_init(bContext *C, wmOperator *op)
|
||||
|
||||
int mval[2];
|
||||
RNA_int_get_array(op->ptr, "start_mouse", mval);
|
||||
float mval_fl[2] = {float(mval[0]), float(mval[1])};
|
||||
|
||||
const bool use_automasking = SCULPT_is_automasking_enabled(sd, ss, nullptr);
|
||||
if (use_automasking) {
|
||||
@@ -351,7 +352,6 @@ static int sculpt_color_filter_init(bContext *C, wmOperator *op)
|
||||
if (v3d) {
|
||||
/* Update the active face set manually as the paint cursor is not enabled when using the Mesh
|
||||
* Filter Tool. */
|
||||
float mval_fl[2] = {float(mval[0]), float(mval[1])};
|
||||
SculptCursorGeometryInfo sgi;
|
||||
SCULPT_cursor_geometry_info_update(C, &sgi, mval_fl, false);
|
||||
}
|
||||
@@ -374,7 +374,7 @@ static int sculpt_color_filter_init(bContext *C, wmOperator *op)
|
||||
ob,
|
||||
sd,
|
||||
SCULPT_UNDO_COLOR,
|
||||
mval,
|
||||
mval_fl,
|
||||
RNA_float_get(op->ptr, "area_normal_radius"),
|
||||
RNA_float_get(op->ptr, "strength"));
|
||||
FilterCache *filter_cache = ss->filter_cache;
|
||||
|
||||
@@ -111,7 +111,7 @@ void SCULPT_filter_cache_init(bContext *C,
|
||||
Object *ob,
|
||||
Sculpt *sd,
|
||||
const int undo_type,
|
||||
const int mval[2],
|
||||
const float mval_fl[2],
|
||||
float area_normal_radius,
|
||||
float start_strength)
|
||||
{
|
||||
@@ -175,7 +175,6 @@ void SCULPT_filter_cache_init(bContext *C,
|
||||
UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;
|
||||
|
||||
float co[3];
|
||||
float mval_fl[2] = {float(mval[0]), float(mval[1])};
|
||||
|
||||
if (vc.rv3d && SCULPT_stroke_get_location(C, co, mval_fl, false)) {
|
||||
Vector<PBVHNode *> nodes;
|
||||
@@ -1026,13 +1025,13 @@ static int sculpt_mesh_filter_start(bContext *C, wmOperator *op)
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
float mval_fl[2] = {float(mval[0]), float(mval[1])};
|
||||
if (use_automasking) {
|
||||
/* Increment stroke id for automasking system. */
|
||||
SCULPT_stroke_id_next(ob);
|
||||
|
||||
/* Update the active face set manually as the paint cursor is not enabled when using the Mesh
|
||||
* Filter Tool. */
|
||||
float mval_fl[2] = {float(mval[0]), float(mval[1])};
|
||||
SculptCursorGeometryInfo sgi;
|
||||
SCULPT_cursor_geometry_info_update(C, &sgi, mval_fl, false);
|
||||
}
|
||||
@@ -1048,7 +1047,7 @@ static int sculpt_mesh_filter_start(bContext *C, wmOperator *op)
|
||||
ob,
|
||||
sd,
|
||||
SCULPT_UNDO_COORDS,
|
||||
mval,
|
||||
mval_fl,
|
||||
RNA_float_get(op->ptr, "area_normal_radius"),
|
||||
RNA_float_get(op->ptr, "strength"));
|
||||
|
||||
|
||||
@@ -1457,7 +1457,7 @@ void SCULPT_filter_cache_init(bContext *C,
|
||||
Object *ob,
|
||||
Sculpt *sd,
|
||||
int undo_type,
|
||||
const int mval[2],
|
||||
const float mval_fl[2],
|
||||
float area_normal_radius,
|
||||
float start_strength);
|
||||
void SCULPT_filter_cache_free(SculptSession *ss);
|
||||
|
||||
@@ -38,7 +38,10 @@
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
|
||||
void ED_sculpt_init_transform(bContext *C, Object *ob, const int mval[2], const char *undo_name)
|
||||
void ED_sculpt_init_transform(bContext *C,
|
||||
Object *ob,
|
||||
const float mval_fl[2],
|
||||
const char *undo_name)
|
||||
{
|
||||
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
@@ -59,7 +62,7 @@ void ED_sculpt_init_transform(bContext *C, Object *ob, const int mval[2], const
|
||||
|
||||
SCULPT_vertex_random_access_ensure(ss);
|
||||
|
||||
SCULPT_filter_cache_init(C, ob, sd, SCULPT_UNDO_COORDS, mval, 5.0, 1.0f);
|
||||
SCULPT_filter_cache_init(C, ob, sd, SCULPT_UNDO_COORDS, mval_fl, 5.0, 1.0f);
|
||||
|
||||
if (sd->transform_mode == SCULPT_TRANSFORM_MODE_RADIUS_ELASTIC) {
|
||||
ss->filter_cache->transform_displacement_mode = SCULPT_TRANSFORM_DISPLACEMENT_INCREMENTAL;
|
||||
|
||||
@@ -88,7 +88,7 @@ static void createTransSculpt(bContext *C, TransInfo *t)
|
||||
copy_m3_m4(td->axismtx, ob->object_to_world);
|
||||
|
||||
BLI_assert(!(t->options & CTX_PAINT_CURVE));
|
||||
ED_sculpt_init_transform(C, ob, t->mval, t->undo_name);
|
||||
ED_sculpt_init_transform(C, ob, blender::float2(t->mval), t->undo_name);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -1143,7 +1143,7 @@ static void snap_target_uv_fn(TransInfo *t, float * /*vec*/)
|
||||
t->scene,
|
||||
objects,
|
||||
objects_len,
|
||||
t->mval,
|
||||
blender::float2(t->mval),
|
||||
t->tsnap.target_operation & SCE_SNAP_TARGET_NOT_SELECTED,
|
||||
&dist_sq,
|
||||
t->tsnap.snap_target))
|
||||
|
||||
@@ -1088,7 +1088,7 @@ bool ED_uvedit_nearest_uv_multi(const View2D *v2d,
|
||||
const Scene *scene,
|
||||
Object **objects,
|
||||
const uint objects_len,
|
||||
const int mval[2],
|
||||
const float mval_fl[2],
|
||||
const bool ignore_selected,
|
||||
float *dist_sq,
|
||||
float r_uv[2])
|
||||
@@ -1100,8 +1100,6 @@ bool ED_uvedit_nearest_uv_multi(const View2D *v2d,
|
||||
UI_view2d_view_to_region_fl(v2d, 0.0f, 0.0f, &offset[0], &offset[1]);
|
||||
|
||||
float co[2];
|
||||
|
||||
const float mval_fl[2] = {float(mval[0]), float(mval[1])};
|
||||
sub_v2_v2v2(co, mval_fl, offset);
|
||||
|
||||
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
|
||||
|
||||
Reference in New Issue
Block a user