Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_mode_curveshrinkfatten.c
| Show All 30 Lines | |||||
| #include "ED_screen.h" | #include "ED_screen.h" | ||||
| #include "UI_interface.h" | #include "UI_interface.h" | ||||
| #include "BLT_translation.h" | #include "BLT_translation.h" | ||||
| #include "transform.h" | #include "transform.h" | ||||
| #include "transform_data.h" | |||||
| #include "transform_mode.h" | #include "transform_mode.h" | ||||
| #include "transform_snap.h" | #include "transform_snap.h" | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /* Transform (Curve Shrink/Fatten) */ | /* Transform (Curve Shrink/Fatten) */ | ||||
| /** \name Transform Curve Shrink/Fatten | /** \name Transform Curve Shrink/Fatten | ||||
| * \{ */ | * \{ */ | ||||
| static void applyCurveShrinkFatten(TransInfo *t, const int UNUSED(mval[2])) | static void applyCurveShrinkFatten(TransInfo *t, const int UNUSED(mval[2])) | ||||
| { | { | ||||
| float ratio; | float ratio; | ||||
| int i; | |||||
| char str[UI_MAX_DRAW_STR]; | char str[UI_MAX_DRAW_STR]; | ||||
| ratio = t->values[0]; | ratio = t->values[0]; | ||||
| snapGridIncrement(t, &ratio); | snapGridIncrement(t, &ratio); | ||||
| applyNumInput(&t->num, &ratio); | applyNumInput(&t->num, &ratio); | ||||
| t->values_final[0] = ratio; | t->values_final[0] = ratio; | ||||
| /* header print for NumInput */ | /* header print for NumInput */ | ||||
| if (hasNumInput(&t->num)) { | if (hasNumInput(&t->num)) { | ||||
| char c[NUM_STR_REP_LEN]; | char c[NUM_STR_REP_LEN]; | ||||
| outputNumInput(&(t->num), c, &t->scene->unit); | outputNumInput(&(t->num), c, &t->scene->unit); | ||||
| BLI_snprintf(str, sizeof(str), TIP_("Shrink/Fatten: %s"), c); | BLI_snprintf(str, sizeof(str), TIP_("Shrink/Fatten: %s"), c); | ||||
| } | } | ||||
| else { | else { | ||||
| BLI_snprintf(str, sizeof(str), TIP_("Shrink/Fatten: %3f"), ratio); | BLI_snprintf(str, sizeof(str), TIP_("Shrink/Fatten: %3f"), ratio); | ||||
| } | } | ||||
| FOREACH_TRANS_DATA_CONTAINER (t, tc) { | FOREACH_TRANS_DATA_CONTAINER (t, tc) { | ||||
| TransData *td = tc->data; | TransData *td = tc->data; | ||||
| for (i = 0; i < tc->data_len; i++, td++) { | for (int tdi = 0; tdi < tc->data_len; tdi++) { | ||||
| if (td->flag & TD_SKIP) { | if (td->basic[tdi].flag & TD_SKIP) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| if (td->val) { | if (td->special[tdi].val) { | ||||
| *td->val = td->ival * ratio; | *td->special[tdi].val = td->special[tdi].ival * ratio; | ||||
| /* apply PET */ | /* apply PET */ | ||||
| *td->val = (*td->val * td->factor) + ((1.0f - td->factor) * td->ival); | *td->special[tdi].val = (*td->special[tdi].val * td->prop[tdi].factor) + | ||||
| if (*td->val <= 0.0f) { | ((1.0f - td->prop[tdi].factor) * td->special[tdi].ival); | ||||
| *td->val = 0.001f; | if (*td->special[tdi].val <= 0.0f) { | ||||
| *td->special[tdi].val = 0.001f; | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| recalcData(t); | recalcData(t); | ||||
| ED_area_status_text(t->area, str); | ED_area_status_text(t->area, str); | ||||
| Show All 27 Lines | |||||