use BLI_strncpy and BLI_snprintf when the size of the string is known.
[blender.git] / source / blender / editors / armature / poseSlide.c
index b0ff604..c28b688 100644 (file)
@@ -51,6 +51,7 @@
 #include "BKE_fcurve.h"
 
 #include "BKE_context.h"
+#include "BKE_object.h"
 #include "BKE_report.h"
 
 #include "RNA_access.h"
@@ -129,7 +130,7 @@ static int pose_slide_init (bContext *C, wmOperator *op, short mode)
        
        /* get info from context */
        pso->scene= CTX_data_scene(C);
-       pso->ob= ED_object_pose_armature(CTX_data_active_object(C));
+       pso->ob= object_pose_armature_get(CTX_data_active_object(C));
        pso->arm= (pso->ob)? pso->ob->data : NULL;
        pso->sa= CTX_wm_area(C); /* only really needed when doing modal() */
        pso->ar= CTX_wm_region(C); /* only really needed when doing modal() */
@@ -420,7 +421,7 @@ static void pose_slide_apply_quat (tPoseSlideOp *pso, tPChanFCurveLink *pfl)
                        sub_qt_qtqt(quat_diff, pchan->quat, quat_prev);
                        
                        /* make a copy of the original rotation */
-                       QUATCOPY(quat_orig, pchan->quat);
+                       copy_qt_qt(quat_orig, pchan->quat);
                        
                        /* increase the original by the delta transform, by an amount determined by percentage */
                        add_qt_qtqt(pchan->quat, quat_orig, quat_diff, pso->percentage);
@@ -435,7 +436,7 @@ static void pose_slide_apply_quat (tPoseSlideOp *pso, tPChanFCurveLink *pfl)
                                interp_qt_qtqt(quat_interp, quat_prev, quat_next, (cframe-pso->prevFrame) / (pso->nextFrame-pso->prevFrame) );
                                
                                /* make a copy of the original rotation */
-                               QUATCOPY(quat_orig, pchan->quat);
+                               copy_qt_qt(quat_orig, pchan->quat);
                                
                                /* tricky interpolations - blending between original and new */
                                interp_qt_qtqt(pchan->quat, quat_orig, quat_interp, 1.0f/6.0f);
@@ -522,28 +523,28 @@ static void pose_slide_reset (tPoseSlideOp *pso)
 /* draw percentage indicator in header */
 static void pose_slide_draw_status (tPoseSlideOp *pso)
 {
-       char statusStr[32];
-       char mode[32];
+       char status_str[32];
+       char mode_str[32];
        
        switch (pso->mode) {
                case POSESLIDE_PUSH:
-                       strcpy(mode, "Push Pose");
+                       strcpy(mode_str, "Push Pose");
                        break;
                case POSESLIDE_RELAX:
-                       strcpy(mode, "Relax Pose");
+                       strcpy(mode_str, "Relax Pose");
                        break;
                case POSESLIDE_BREAKDOWN:
-                       strcpy(mode, "Breakdown");
+                       strcpy(mode_str, "Breakdown");
                        break;
                
                default:
                        // unknown
-                       strcpy(mode, "Sliding-Tool");
+                       strcpy(mode_str, "Sliding-Tool");
                        break;
        }
        
-       sprintf(statusStr, "%s: %d %%", mode, (int)(pso->percentage*100.0f));
-       ED_area_headerprint(pso->sa, statusStr);
+       BLI_snprintf(status_str, sizeof(status_str), "%s: %d %%", mode_str, (int)(pso->percentage*100.0f));
+       ED_area_headerprint(pso->sa, status_str);
 }
 
 /* common code for invoke() methods */
@@ -599,7 +600,7 @@ static int pose_slide_invoke_common (bContext *C, wmOperator *op, tPoseSlideOp *
                }
        }
        else {
-               BKE_report(op->reports, RPT_ERROR, "No keyframes to slide between.");
+               BKE_report(op->reports, RPT_ERROR, "No keyframes to slide between");
                pose_slide_exit(op);
                return OPERATOR_CANCELLED;
        }
@@ -717,8 +718,8 @@ static int pose_slide_exec_common (bContext *C, wmOperator *op, tPoseSlideOp *ps
 /* common code for defining RNA properties */
 static void pose_slide_opdef_properties (wmOperatorType *ot)
 {
-       RNA_def_int(ot->srna, "prev_frame", 0, MINAFRAME, MAXFRAME, "Previous Keyframe", "Frame number of keyframe immediately before the current frame.", 0, 50);
-       RNA_def_int(ot->srna, "next_frame", 0, MINAFRAME, MAXFRAME, "Next Keyframe", "Frame number of keyframe immediately after the current frame.", 0, 50);
+       RNA_def_int(ot->srna, "prev_frame", 0, MINAFRAME, MAXFRAME, "Previous Keyframe", "Frame number of keyframe immediately before the current frame", 0, 50);
+       RNA_def_int(ot->srna, "next_frame", 0, MINAFRAME, MAXFRAME, "Next Keyframe", "Frame number of keyframe immediately after the current frame", 0, 50);
        RNA_def_float_percentage(ot->srna, "percentage", 0.5f, 0.0f, 1.0f, "Percentage", "Weighting factor for the sliding operation", 0.3, 0.7);
 }
 
@@ -1164,7 +1165,7 @@ static void pose_propagate_fcurve (wmOperator *op, Object *ob, FCurve *fcu,
 static int pose_propagate_exec (bContext *C, wmOperator *op)
 {
        Scene *scene = CTX_data_scene(C);
-       Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+       Object *ob= object_pose_armature_get(CTX_data_active_object(C));
        bAction *act= (ob && ob->adt)? ob->adt->action : NULL;
        
        ListBase pflinks = {NULL, NULL};