Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_mode_edge_crease.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 (Crease) */ | /* Transform (Crease) */ | ||||
| /** \name Transform Crease | /** \name Transform Crease | ||||
| * \{ */ | * \{ */ | ||||
| static void applyCrease(TransInfo *t, const int UNUSED(mval[2])) | static void applyCrease(TransInfo *t, const int UNUSED(mval[2])) | ||||
| { | { | ||||
| float crease; | float crease; | ||||
| int i; | |||||
| char str[UI_MAX_DRAW_STR]; | char str[UI_MAX_DRAW_STR]; | ||||
| crease = t->values[0]; | crease = t->values[0]; | ||||
| CLAMP_MAX(crease, 1.0f); | CLAMP_MAX(crease, 1.0f); | ||||
| snapGridIncrement(t, &crease); | snapGridIncrement(t, &crease); | ||||
| Show All 21 Lines | else { | ||||
| } | } | ||||
| else { | else { | ||||
| BLI_snprintf(str, sizeof(str), TIP_("Crease: %.3f %s"), crease, t->proptext); | BLI_snprintf(str, sizeof(str), TIP_("Crease: %.3f %s"), crease, t->proptext); | ||||
| } | } | ||||
| } | } | ||||
| 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 + crease * td->factor; | *td->special[tdi].val = td->special[tdi].ival + crease * td->prop[tdi].factor; | ||||
| if (*td->val < 0.0f) { | if (*td->special[tdi].val < 0.0f) { | ||||
| *td->val = 0.0f; | *td->special[tdi].val = 0.0f; | ||||
| } | } | ||||
| if (*td->val > 1.0f) { | if (*td->special[tdi].val > 1.0f) { | ||||
| *td->val = 1.0f; | *td->special[tdi].val = 1.0f; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| recalcData(t); | recalcData(t); | ||||
| ED_area_status_text(t->area, str); | ED_area_status_text(t->area, str); | ||||
| Show All 22 Lines | |||||