diff options
Diffstat (limited to 'source/blender/editors/animation/fmodifier_ui.c')
-rw-r--r-- | source/blender/editors/animation/fmodifier_ui.c | 57 |
1 files changed, 38 insertions, 19 deletions
diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c index 9e96023b272..f4e1268ab77 100644 --- a/source/blender/editors/animation/fmodifier_ui.c +++ b/source/blender/editors/animation/fmodifier_ui.c @@ -77,8 +77,9 @@ static void validate_fmodifier_cb(bContext *UNUSED(C), void *fcm_v, void *UNUSED const FModifierTypeInfo *fmi = fmodifier_get_typeinfo(fcm); /* call the verify callback on the modifier if applicable */ - if (fmi && fmi->verify_data) + if (fmi && fmi->verify_data) { fmi->verify_data(fcm); + } } /* callback to remove the given modifier */ @@ -210,7 +211,7 @@ static void draw_modifier__generator(uiLayout *layout, cp = data->coefficients; for (i = 0; (i < data->arraysize) && (cp); i++, cp++) { /* To align with first line... */ - if (i) + if (i) { uiDefBut(block, UI_BTYPE_LABEL, 1, @@ -225,7 +226,8 @@ static void draw_modifier__generator(uiLayout *layout, 0, 0, ""); - else + } + else { uiDefBut(block, UI_BTYPE_LABEL, 1, @@ -240,6 +242,7 @@ static void draw_modifier__generator(uiLayout *layout, 0, 0, ""); + } /* coefficient */ uiDefButF(block, @@ -258,12 +261,15 @@ static void draw_modifier__generator(uiLayout *layout, TIP_("Coefficient for polynomial")); /* 'x' param (and '+' if necessary) */ - if (i == 0) + if (i == 0) { BLI_strncpy(xval, "", sizeof(xval)); - else if (i == 1) + } + else if (i == 1) { BLI_strncpy(xval, "x", sizeof(xval)); - else + } + else { BLI_snprintf(xval, sizeof(xval), "x^%u", i); + } uiDefBut(block, UI_BTYPE_LABEL, 1, @@ -328,7 +334,7 @@ static void draw_modifier__generator(uiLayout *layout, cp = data->coefficients; for (i = 0; (i < data->poly_order) && (cp); i++, cp += 2) { /* To align with first line */ - if (i) + if (i) { uiDefBut(block, UI_BTYPE_LABEL, 1, @@ -343,7 +349,8 @@ static void draw_modifier__generator(uiLayout *layout, 0, 0, ""); - else + } + else { uiDefBut(block, UI_BTYPE_LABEL, 1, @@ -358,6 +365,7 @@ static void draw_modifier__generator(uiLayout *layout, 0, 0, ""); + } /* opening bracket */ uiDefBut( block, UI_BTYPE_LABEL, 1, "(", 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); @@ -429,7 +437,7 @@ static void draw_modifier__generator(uiLayout *layout, row = uiLayoutRow(layout, true); block = uiLayoutGetBlock(row); } - else + else { uiDefBut(block, UI_BTYPE_LABEL, 1, @@ -444,6 +452,7 @@ static void draw_modifier__generator(uiLayout *layout, 0, 0, ""); + } } break; } @@ -569,15 +578,17 @@ static void fmod_envelope_addpoint_cb(bContext *C, void *fcm_dv, void *UNUSED(ar fedn = MEM_callocN((env->totvert + 1) * sizeof(FCM_EnvelopeData), "FCM_EnvelopeData"); /* add the points that should occur before the point to be pasted */ - if (i > 0) + if (i > 0) { memcpy(fedn, env->data, i * sizeof(FCM_EnvelopeData)); + } /* add point to paste at index i */ *(fedn + i) = fed; /* add the points that occur after the point to be pasted */ - if (i < env->totvert) + if (i < env->totvert) { memcpy(fedn + i + 1, env->data + i, (env->totvert - i) * sizeof(FCM_EnvelopeData)); + } /* replace (+ free) old with new */ MEM_freeN(env->data); @@ -885,10 +896,12 @@ void ANIM_uiTemplate_fmodifier_draw(uiLayout *layout, uiItemR(sub, &ptr, "active", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); /* name */ - if (fmi) + if (fmi) { uiItemL(sub, IFACE_(fmi->name), ICON_NONE); - else + } + else { uiItemL(sub, IFACE_("<Unknown Modifier>"), ICON_NONE); + } /* right-align ------------------------------------------- */ sub = uiLayoutRow(row, true); @@ -1025,8 +1038,9 @@ bool ANIM_fmodifiers_copy_to_buf(ListBase *modifiers, bool active) bool ok = true; /* sanity checks */ - if (ELEM(NULL, modifiers, modifiers->first)) + if (ELEM(NULL, modifiers, modifiers->first)) { return 0; + } /* copy the whole list, or just the active one? */ if (active) { @@ -1036,11 +1050,13 @@ bool ANIM_fmodifiers_copy_to_buf(ListBase *modifiers, bool active) FModifier *fcmN = copy_fmodifier(fcm); BLI_addtail(&fmodifier_copypaste_buf, fcmN); } - else + else { ok = 0; + } } - else + else { copy_fmodifiers(&fmodifier_copypaste_buf, modifiers); + } /* did we succeed? */ return ok; @@ -1055,14 +1071,16 @@ bool ANIM_fmodifiers_paste_from_buf(ListBase *modifiers, bool replace, FCurve *c bool ok = false; /* sanity checks */ - if (modifiers == NULL) + if (modifiers == NULL) { return 0; + } bool was_cyclic = curve && BKE_fcurve_is_cyclic(curve); /* if replacing the list, free the existing modifiers */ - if (replace) + if (replace) { free_fmodifiers(modifiers); + } /* now copy over all the modifiers in the buffer to the end of the list */ for (fcm = fmodifier_copypaste_buf.first; fcm; fcm = fcm->next) { @@ -1080,8 +1098,9 @@ bool ANIM_fmodifiers_paste_from_buf(ListBase *modifiers, bool replace, FCurve *c } /* adding or removing the Cycles modifier requires an update to handles */ - if (curve && BKE_fcurve_is_cyclic(curve) != was_cyclic) + if (curve && BKE_fcurve_is_cyclic(curve) != was_cyclic) { calchandles_fcurve(curve); + } /* did we succeed? */ return ok; |