Partial fixes for issues raised in T44219

* The breakdowner tool will no longer operate directly on properties
  of type "enum", as this doesn't make sense most of the time. This
  is still not much use though when custom properties (ints) are used
  to drive some underlying enum property though (as in blenrig)
* The breakdowner no longer tries to perform any blending if the
  start and end values are the same, to avoid float precision issues.
This commit is contained in:
Joshua Leung 2015-04-08 14:17:36 +12:00
parent 808ea6271a
commit 1492db09d1

@ -201,6 +201,12 @@ static void pose_slide_apply_val(tPoseSlideOp *pso, FCurve *fcu, float *val)
/* next/end */ /* next/end */
eVal = evaluate_fcurve(fcu, (float)pso->nextFrame); eVal = evaluate_fcurve(fcu, (float)pso->nextFrame);
/* if both values are equal, don't do anything */
if (IS_EQ(sVal, eVal)) {
(*val) = sVal;
return;
}
/* calculate the relative weights of the endpoints */ /* calculate the relative weights of the endpoints */
if (pso->mode == POSESLIDE_BREAKDOWN) { if (pso->mode == POSESLIDE_BREAKDOWN) {
/* get weights from the percentage control */ /* get weights from the percentage control */
@ -320,6 +326,7 @@ static void pose_slide_apply_props(tPoseSlideOp *pso, tPChanFCurveLink *pfl)
if (prop) { if (prop) {
switch (RNA_property_type(prop)) { switch (RNA_property_type(prop)) {
/* continuous values that can be smoothly interpolated... */
case PROP_FLOAT: case PROP_FLOAT:
{ {
float tval = RNA_property_float_get(&ptr, prop); float tval = RNA_property_float_get(&ptr, prop);
@ -327,8 +334,6 @@ static void pose_slide_apply_props(tPoseSlideOp *pso, tPChanFCurveLink *pfl)
RNA_property_float_set(&ptr, prop, tval); RNA_property_float_set(&ptr, prop, tval);
break; break;
} }
case PROP_BOOLEAN:
case PROP_ENUM:
case PROP_INT: case PROP_INT:
{ {
float tval = (float)RNA_property_int_get(&ptr, prop); float tval = (float)RNA_property_int_get(&ptr, prop);
@ -336,6 +341,23 @@ static void pose_slide_apply_props(tPoseSlideOp *pso, tPChanFCurveLink *pfl)
RNA_property_int_set(&ptr, prop, (int)tval); RNA_property_int_set(&ptr, prop, (int)tval);
break; break;
} }
/* values which can only take discrete values */
case PROP_BOOLEAN:
{
float tval = (float)RNA_property_boolean_get(&ptr, prop);
pose_slide_apply_val(pso, fcu, &tval);
RNA_property_boolean_set(&ptr, prop, (int)tval); // XXX: do we need threshold clamping here?
break;
}
case PROP_ENUM:
{
/* don't handle this case - these don't usually represent interchangeable
* set of values which should be interpolated between
*/
break;
}
default: default:
/* cannot handle */ /* cannot handle */
//printf("Cannot Pose Slide non-numerical property\n"); //printf("Cannot Pose Slide non-numerical property\n");