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:
Diffstat (limited to 'source/blender/editors/animation')
-rw-r--r--source/blender/editors/animation/drivers.c6
-rw-r--r--source/blender/editors/animation/fmodifier_ui.c6
-rw-r--r--source/blender/editors/animation/keyframes_edit.c14
-rw-r--r--source/blender/editors/animation/keyframes_general.c23
-rw-r--r--source/blender/editors/animation/keyframing.c15
5 files changed, 23 insertions, 41 deletions
diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c
index 3b15cd794d8..4d5ff33d5cf 100644
--- a/source/blender/editors/animation/drivers.c
+++ b/source/blender/editors/animation/drivers.c
@@ -355,9 +355,8 @@ int ANIM_add_driver_with_target(ReportList *reports,
int src_len = (RNA_property_array_check(prop)) ? RNA_property_array_length(&ptr2, prop2) : 1;
int len = MIN2(dst_len, src_len);
- int i;
- for (i = 0; i < len; i++) {
+ for (int i = 0; i < len; i++) {
done_tot += add_driver_with_target(reports,
dst_id,
dst_path,
@@ -378,9 +377,8 @@ int ANIM_add_driver_with_target(ReportList *reports,
case CREATEDRIVER_MAPPING_1_N: /* 1-N - Specified target index for all */
default: {
int len = (RNA_property_array_check(prop)) ? RNA_property_array_length(&ptr, prop) : 1;
- int i;
- for (i = 0; i < len; i++) {
+ for (int i = 0; i < len; i++) {
done_tot += add_driver_with_target(reports,
dst_id,
dst_path,
diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c
index 9d54be61171..a8fb0be4fbf 100644
--- a/source/blender/editors/animation/fmodifier_ui.c
+++ b/source/blender/editors/animation/fmodifier_ui.c
@@ -177,7 +177,6 @@ static void draw_modifier__generator(uiLayout *layout,
const uiFontStyle *fstyle = UI_FSTYLE_WIDGET;
float *cp = NULL;
char xval[32];
- uint i;
int maxXWidth;
/* draw polynomial order selector */
@@ -221,7 +220,7 @@ static void draw_modifier__generator(uiLayout *layout,
UI_block_func_set(block, deg_update, fcurve_owner_id, NULL);
cp = data->coefficients;
- for (i = 0; (i < data->arraysize) && (cp); i++, cp++) {
+ for (uint i = 0; (i < data->arraysize) && (cp); i++, cp++) {
/* To align with first line... */
if (i) {
uiDefBut(block,
@@ -319,7 +318,6 @@ static void draw_modifier__generator(uiLayout *layout,
case FCM_GENERATOR_POLYNOMIAL_FACTORISED: /* Factorized polynomial expression */
{
float *cp = NULL;
- uint i;
/* draw polynomial order selector */
row = uiLayoutRow(layout, false);
@@ -351,7 +349,7 @@ static void draw_modifier__generator(uiLayout *layout,
UI_block_func_set(block, deg_update, fcurve_owner_id, NULL);
cp = data->coefficients;
- for (i = 0; (i < data->poly_order) && (cp); i++, cp += 2) {
+ for (uint i = 0; (i < data->poly_order) && (cp); i++, cp += 2) {
/* To align with first line */
if (i) {
uiDefBut(block,
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c
index ef86b132a60..de2525ee150 100644
--- a/source/blender/editors/animation/keyframes_edit.c
+++ b/source/blender/editors/animation/keyframes_edit.c
@@ -943,11 +943,8 @@ KeyframeEditFunc ANIM_editkeyframes_snap(short mode)
static void mirror_bezier_xaxis_ex(BezTriple *bezt, const float center)
{
- float diff;
- int i;
-
- for (i = 0; i < 3; i++) {
- diff = (center - bezt->vec[i][0]);
+ for (int i = 0; i < 3; i++) {
+ float diff = (center - bezt->vec[i][0]);
bezt->vec[i][0] = (center + diff);
}
swap_v3_v3(bezt->vec[0], bezt->vec[2]);
@@ -958,11 +955,8 @@ static void mirror_bezier_xaxis_ex(BezTriple *bezt, const float center)
static void mirror_bezier_yaxis_ex(BezTriple *bezt, const float center)
{
- float diff;
- int i;
-
- for (i = 0; i < 3; i++) {
- diff = (center - bezt->vec[i][1]);
+ for (int i = 0; i < 3; i++) {
+ float diff = (center - bezt->vec[i][1]);
bezt->vec[i][1] = (center + diff);
}
}
diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c
index 64065d6d633..ea032446fc6 100644
--- a/source/blender/editors/animation/keyframes_general.c
+++ b/source/blender/editors/animation/keyframes_general.c
@@ -108,7 +108,6 @@ void delete_fcurve_key(FCurve *fcu, int index, bool do_recalc)
/* Delete selected keyframes in given F-Curve */
bool delete_fcurve_keys(FCurve *fcu)
{
- int i;
bool changed = false;
if (fcu->bezt == NULL) { /* ignore baked curves */
@@ -116,7 +115,7 @@ bool delete_fcurve_keys(FCurve *fcu)
}
/* Delete selected BezTriples */
- for (i = 0; i < fcu->totvert; i++) {
+ for (int i = 0; i < fcu->totvert; i++) {
if (fcu->bezt[i].f2 & SELECT) {
memmove(&fcu->bezt[i], &fcu->bezt[i + 1], sizeof(BezTriple) * (fcu->totvert - i - 1));
fcu->totvert--;
@@ -148,19 +147,16 @@ void clear_fcurve_keys(FCurve *fcu)
/* duplicate selected keyframes for the given F-Curve */
void duplicate_fcurve_keys(FCurve *fcu)
{
- BezTriple *newbezt;
- int i;
-
/* this can only work when there is an F-Curve, and also when there are some BezTriples */
if (ELEM(NULL, fcu, fcu->bezt)) {
return;
}
- for (i = 0; i < fcu->totvert; i++) {
+ for (int i = 0; i < fcu->totvert; i++) {
/* If a key is selected */
if (fcu->bezt[i].f2 & SELECT) {
/* Expand the list */
- newbezt = MEM_callocN(sizeof(BezTriple) * (fcu->totvert + 1), "beztriple");
+ BezTriple *newbezt = MEM_callocN(sizeof(BezTriple) * (fcu->totvert + 1), "beztriple");
memcpy(newbezt, fcu->bezt, sizeof(BezTriple) * (i + 1));
memcpy(newbezt + i + 1, fcu->bezt + i, sizeof(BezTriple));
@@ -489,16 +485,15 @@ typedef struct tSmooth_Bezt {
// TODO: introduce scaling factor for weighting falloff
void smooth_fcurve(FCurve *fcu)
{
- BezTriple *bezt;
- int i, x, totSel = 0;
+ int totSel = 0;
if (fcu->bezt == NULL) {
return;
}
/* first loop through - count how many verts are selected */
- bezt = fcu->bezt;
- for (i = 0; i < fcu->totvert; i++, bezt++) {
+ BezTriple *bezt = fcu->bezt;
+ for (int i = 0; i < fcu->totvert; i++, bezt++) {
if (BEZT_ISSEL_ANY(bezt)) {
totSel++;
}
@@ -513,7 +508,7 @@ void smooth_fcurve(FCurve *fcu)
/* populate tarray with data of selected points */
bezt = fcu->bezt;
- for (i = 0, x = 0; (i < fcu->totvert) && (x < totSel); i++, bezt++) {
+ for (int i = 0, x = 0; (i < fcu->totvert) && (x < totSel); i++, bezt++) {
if (BEZT_ISSEL_ANY(bezt)) {
/* tsb simply needs pointer to vec, and index */
tsb->h1 = &bezt->vec[0][1];
@@ -539,7 +534,7 @@ void smooth_fcurve(FCurve *fcu)
/* round 1: calculate smoothing deltas and new values */
tsb = tarray;
- for (i = 0; i < totSel; i++, tsb++) {
+ for (int i = 0; i < totSel; i++, tsb++) {
/* Don't touch end points (otherwise, curves slowly explode,
* as we don't have enough data there). */
if (ELEM(i, 0, (totSel - 1)) == 0) {
@@ -564,7 +559,7 @@ void smooth_fcurve(FCurve *fcu)
/* round 2: apply new values */
tsb = tarray;
- for (i = 0; i < totSel; i++, tsb++) {
+ for (int i = 0; i < totSel; i++, tsb++) {
/* don't touch end points, as their values weren't touched above */
if (ELEM(i, 0, (totSel - 1)) == 0) {
/* y2 takes the average of the 2 points */
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index 66d4882cf9d..fb4c0ae0758 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -618,22 +618,19 @@ enum {
*/
static short new_key_needed(FCurve *fcu, float cFrame, float nValue)
{
- BezTriple *bezt = NULL, *prev = NULL;
- int totCount, i;
- float valA = 0.0f, valB = 0.0f;
-
/* safety checking */
if (fcu == NULL) {
return KEYNEEDED_JUSTADD;
}
- totCount = fcu->totvert;
+ int totCount = fcu->totvert;
if (totCount == 0) {
return KEYNEEDED_JUSTADD;
}
/* loop through checking if any are the same */
- bezt = fcu->bezt;
- for (i = 0; i < totCount; i++) {
+ BezTriple *bezt = fcu->bezt;
+ BezTriple *prev = NULL;
+ for (int i = 0; i < totCount; i++) {
float prevPosi = 0.0f, prevVal = 0.0f;
float beztPosi = 0.0f, beztVal = 0.0f;
@@ -712,8 +709,8 @@ static short new_key_needed(FCurve *fcu, float cFrame, float nValue)
* keyframe is not equal to last keyframe.
*/
bezt = (fcu->bezt + (fcu->totvert - 1));
- valA = bezt->vec[1][1];
-
+ float valA = bezt->vec[1][1];
+ float valB;
if (prev) {
valB = prev->vec[1][1];
}