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