diff options
author | mano-wii <germano.costa@ig.com.br> | 2020-02-14 17:51:29 +0300 |
---|---|---|
committer | mano-wii <germano.costa@ig.com.br> | 2020-02-14 17:51:29 +0300 |
commit | ef4505a1583f117414b484c7bd00a942854fb33d (patch) | |
tree | 5e7cd4d44d95a3d94762e09113bcef4272f57ded /source | |
parent | 38e06b19f6d198cc4846a8e5526ba08369c562ff (diff) |
Fix T68610: B-Bone display size/scaling op issues
Fix ReDo and create a new operator to display only the required properties.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D6849
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/transform/transform_mode_bonesize.c | 24 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_ops.c | 27 |
2 files changed, 41 insertions, 10 deletions
diff --git a/source/blender/editors/transform/transform_mode_bonesize.c b/source/blender/editors/transform/transform_mode_bonesize.c index 57c6df95a0f..9ca1857f011 100644 --- a/source/blender/editors/transform/transform_mode_bonesize.c +++ b/source/blender/editors/transform/transform_mode_bonesize.c @@ -108,22 +108,26 @@ static void ElementBoneSize(TransInfo *t, TransDataContainer *tc, TransData *td, static void applyBoneSize(TransInfo *t, const int UNUSED(mval[2])) { - float size[3], mat[3][3]; - float ratio = t->values[0]; + float mat[3][3]; int i; char str[UI_MAX_DRAW_STR]; - copy_v3_fl(size, ratio); + if (t->flag & T_INPUT_IS_VALUES_FINAL) { + copy_v3_v3(t->values_final, t->values); + } + else { + float ratio = t->values[0]; - snapGridIncrement(t, size); + copy_v3_fl(t->values_final, ratio); - if (applyNumInput(&t->num, size)) { - constraintNumInput(t, size); - } + snapGridIncrement(t, t->values_final); - copy_v3_v3(t->values_final, size); + if (applyNumInput(&t->num, t->values_final)) { + constraintNumInput(t, t->values_final); + } + } - size_to_mat3(mat, size); + size_to_mat3(mat, t->values_final); if (t->con.applySize) { t->con.applySize(t, NULL, NULL, mat); @@ -131,7 +135,7 @@ static void applyBoneSize(TransInfo *t, const int UNUSED(mval[2])) copy_m3_m3(t->mat, mat); // used in gizmo - headerBoneSize(t, size, str); + headerBoneSize(t, t->values_final, str); FOREACH_TRANS_DATA_CONTAINER (t, tc) { TransData *td = tc->data; diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index 09992e8be0e..39f6f24eb8d 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -75,6 +75,7 @@ static const char OP_PUSH_PULL[] = "TRANSFORM_OT_push_pull"; static const char OP_TILT[] = "TRANSFORM_OT_tilt"; static const char OP_TRACKBALL[] = "TRANSFORM_OT_trackball"; static const char OP_MIRROR[] = "TRANSFORM_OT_mirror"; +static const char OP_BONE_SIZE[] = "TRANSFORM_OT_bbone_resize"; static const char OP_EDGE_SLIDE[] = "TRANSFORM_OT_edge_slide"; static const char OP_VERT_SLIDE[] = "TRANSFORM_OT_vert_slide"; static const char OP_EDGE_CREASE[] = "TRANSFORM_OT_edge_crease"; @@ -94,6 +95,7 @@ static void TRANSFORM_OT_push_pull(struct wmOperatorType *ot); static void TRANSFORM_OT_tilt(struct wmOperatorType *ot); static void TRANSFORM_OT_trackball(struct wmOperatorType *ot); static void TRANSFORM_OT_mirror(struct wmOperatorType *ot); +static void TRANSFORM_OT_bbone_resize(struct wmOperatorType *ot); static void TRANSFORM_OT_edge_slide(struct wmOperatorType *ot); static void TRANSFORM_OT_vert_slide(struct wmOperatorType *ot); static void TRANSFORM_OT_edge_crease(struct wmOperatorType *ot); @@ -114,6 +116,7 @@ static TransformModeItem transform_modes[] = { {OP_TILT, TFM_TILT, TRANSFORM_OT_tilt}, {OP_TRACKBALL, TFM_TRACKBALL, TRANSFORM_OT_trackball}, {OP_MIRROR, TFM_MIRROR, TRANSFORM_OT_mirror}, + {OP_BONE_SIZE, TFM_BONESIZE, TRANSFORM_OT_bbone_resize}, {OP_EDGE_SLIDE, TFM_EDGE_SLIDE, TRANSFORM_OT_edge_slide}, {OP_VERT_SLIDE, TFM_VERT_SLIDE, TRANSFORM_OT_vert_slide}, {OP_EDGE_CREASE, TFM_CREASE, TRANSFORM_OT_edge_crease}, @@ -1015,6 +1018,30 @@ static void TRANSFORM_OT_mirror(struct wmOperatorType *ot) ot, P_ORIENT_MATRIX | P_CONSTRAINT | P_PROPORTIONAL | P_GPENCIL_EDIT | P_CENTER); } +static void TRANSFORM_OT_bbone_resize(struct wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Scale B-Bone"; + ot->description = "Scale selected bendy bones display size"; + ot->idname = OP_BONE_SIZE; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; + + /* api callbacks */ + ot->invoke = transform_invoke; + ot->exec = transform_exec; + ot->modal = transform_modal; + ot->cancel = transform_cancel; + ot->poll = ED_operator_screenactive; + ot->poll_property = transform_poll_property; + + RNA_def_float_translation( + ot->srna, "value", 2, VecOne, -FLT_MAX, FLT_MAX, "Display Size", "", -FLT_MAX, FLT_MAX); + + WM_operatortype_props_advanced_begin(ot); + + Transform_Properties(ot, P_ORIENT_MATRIX | P_CONSTRAINT | P_MIRROR); +} + static void TRANSFORM_OT_edge_slide(struct wmOperatorType *ot) { PropertyRNA *prop; |