Cleanup: use explicit casts when assigning booleans to floats
While valid, this isn't so common and cppcheck warns about this, use explicit casts to suppress the warning, also correct "true" being assigned to a float value.
This commit is contained in:
@@ -342,10 +342,10 @@ float get_default_rna_value(FCurve *fcu, PropertyRNA *prop, PointerRNA *ptr)
|
||||
switch (RNA_property_type(prop)) {
|
||||
case PROP_BOOLEAN:
|
||||
if (len) {
|
||||
default_value = RNA_property_boolean_get_default_index(ptr, prop, fcu->array_index);
|
||||
default_value = float(RNA_property_boolean_get_default_index(ptr, prop, fcu->array_index));
|
||||
}
|
||||
else {
|
||||
default_value = RNA_property_boolean_get_default(ptr, prop);
|
||||
default_value = float(RNA_property_boolean_get_default(ptr, prop));
|
||||
}
|
||||
break;
|
||||
case PROP_INT:
|
||||
|
||||
@@ -539,10 +539,10 @@ static void pose_slide_apply_props(tPoseSlideOp *pso,
|
||||
if (UNLIKELY(uint(fcu->array_index) >= RNA_property_array_length(&ptr, prop))) {
|
||||
break; /* Out of range, skip. */
|
||||
}
|
||||
tval = RNA_property_boolean_get_index(&ptr, prop, fcu->array_index);
|
||||
tval = float(RNA_property_boolean_get_index(&ptr, prop, fcu->array_index));
|
||||
}
|
||||
else {
|
||||
tval = RNA_property_boolean_get(&ptr, prop);
|
||||
tval = float(RNA_property_boolean_get(&ptr, prop));
|
||||
}
|
||||
|
||||
pose_slide_apply_val(pso, fcu, pfl->ob, &tval);
|
||||
|
||||
@@ -223,7 +223,7 @@ static void gizmo_primitive_setup(wmGizmo *gz)
|
||||
/* Default Values. */
|
||||
PrimitiveGizmo3D *gz_prim = (PrimitiveGizmo3D *)gz;
|
||||
gz_prim->draw_style = ED_GIZMO_PRIMITIVE_STYLE_PLANE;
|
||||
gz_prim->arc_inner_factor = true;
|
||||
gz_prim->arc_inner_factor = 1.0f;
|
||||
gz_prim->draw_inner = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -2515,10 +2515,10 @@ double ui_but_value_get(uiBut *but)
|
||||
switch (RNA_property_type(prop)) {
|
||||
case PROP_BOOLEAN:
|
||||
if (RNA_property_array_check(prop)) {
|
||||
value = RNA_property_boolean_get_index(&but->rnapoin, prop, but->rnaindex);
|
||||
value = double(RNA_property_boolean_get_index(&but->rnapoin, prop, but->rnaindex));
|
||||
}
|
||||
else {
|
||||
value = RNA_property_boolean_get(&but->rnapoin, prop);
|
||||
value = double(RNA_property_boolean_get(&but->rnapoin, prop));
|
||||
}
|
||||
break;
|
||||
case PROP_INT:
|
||||
|
||||
@@ -633,7 +633,7 @@ float BPY_driver_exec(PathResolvedRNA *anim_rna,
|
||||
dvar->curval = float(PyLong_AsLong(driver_arg));
|
||||
}
|
||||
else if (PyBool_Check(driver_arg)) {
|
||||
dvar->curval = (driver_arg == Py_True);
|
||||
dvar->curval = float(driver_arg == Py_True);
|
||||
}
|
||||
else {
|
||||
dvar->curval = 0.0f;
|
||||
|
||||
Reference in New Issue
Block a user