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:
authorJoshua Leung <aligorith@gmail.com>2011-03-13 15:26:53 +0300
committerJoshua Leung <aligorith@gmail.com>2011-03-13 15:26:53 +0300
commit280592be9f45d8d32f21cd4805570d8dcf3d790e (patch)
tree8c5c5bcb50d27d5a3794150d8b768a9af6197802 /source/blender/editors
parent2144b23f514005958e5ec962528599d6623bf15b (diff)
Replaced RNA code in previous commit with a version which should be a
bit safer (less likelyhood of float <-> int corruption)
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/armature/poseSlide.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/source/blender/editors/armature/poseSlide.c b/source/blender/editors/armature/poseSlide.c
index 302f23f7028..39d65a4526f 100644
--- a/source/blender/editors/armature/poseSlide.c
+++ b/source/blender/editors/armature/poseSlide.c
@@ -193,7 +193,7 @@ static void pose_slide_refresh (bContext *C, tPoseSlideOp *pso)
}
/* helper for apply() - perform sliding for some value */
-static void pose_slider_apply_val (tPoseSlideOp *pso, FCurve *fcu, float *val)
+static void pose_slide_apply_val (tPoseSlideOp *pso, FCurve *fcu, float *val)
{
float cframe = (float)pso->cframe;
float sVal, eVal;
@@ -283,7 +283,7 @@ static void pose_slide_apply_vec3 (tPoseSlideOp *pso, tPChanFCurveLink *pfl, flo
FCurve *fcu= (FCurve *)ld->data;
/* just work on these channels one by one... there's no interaction between values */
- pose_slider_apply_val(pso, fcu, &vec[fcu->array_index]);
+ pose_slide_apply_val(pso, fcu, &vec[fcu->array_index]);
}
/* free the temp path we got */
@@ -324,11 +324,28 @@ static void pose_slide_apply_props (tPoseSlideOp *pso, tPChanFCurveLink *pfl)
PropertyRNA *prop = RNA_struct_find_property(&ptr, pPtr);
if (prop) {
- float tval = RNA_property_float_get(&ptr, prop);
-
- pose_slider_apply_val(pso, fcu, &tval);
-
- RNA_property_float_set(&ptr, prop, tval);
+ switch (RNA_property_type(prop)) {
+ case PROP_FLOAT:
+ {
+ float tval = RNA_property_float_get(&ptr, prop);
+ pose_slide_apply_val(pso, fcu, &tval);
+ RNA_property_float_set(&ptr, prop, tval);
+ }
+ break;
+ case PROP_BOOLEAN:
+ case PROP_ENUM:
+ case PROP_INT:
+ {
+ float tval = (float)RNA_property_int_get(&ptr, prop);
+ pose_slide_apply_val(pso, fcu, &tval);
+ RNA_property_int_set(&ptr, prop, (int)tval);
+ }
+ break;
+ default:
+ /* cannot handle */
+ //printf("Cannot Pose Slide non-numerical property\n");
+ break;
+ }
}
}
}