Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_mode_boneenvelope.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 (Bone Envelope) */ | /* Transform (Bone Envelope) */ | ||||
| /** \name Transform Bone Envelope | /** \name Transform Bone Envelope | ||||
| * \{ */ | * \{ */ | ||||
| static void applyBoneEnvelope(TransInfo *t, const int UNUSED(mval[2])) | static void applyBoneEnvelope(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_("Envelope: %s"), c); | BLI_snprintf(str, sizeof(str), TIP_("Envelope: %s"), c); | ||||
| } | } | ||||
| else { | else { | ||||
| BLI_snprintf(str, sizeof(str), TIP_("Envelope: %3f"), ratio); | BLI_snprintf(str, sizeof(str), TIP_("Envelope: %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) { | ||||
| /* if the old/original value was 0.0f, then just use ratio */ | /* if the old/original value was 0.0f, then just use ratio */ | ||||
| if (td->ival) { | if (td->special[tdi].ival) { | ||||
| *td->val = td->ival * ratio; | *td->special[tdi].val = td->special[tdi].ival * ratio; | ||||
| } | } | ||||
| else { | else { | ||||
| *td->val = ratio; | *td->special[tdi].val = ratio; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| recalcData(t); | recalcData(t); | ||||
| ED_area_status_text(t->area, str); | ED_area_status_text(t->area, str); | ||||
| Show All 23 Lines | |||||