diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2020-05-11 15:47:15 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2020-05-11 15:47:25 +0300 |
commit | 76c64af00caa7308368dfe0221b617c2aae3cde4 (patch) | |
tree | 1847b1d65e6ff5639dba22510ac4de4108cde45e /source/blender/editors/transform/transform_generics.c | |
parent | 267e4d130a26c0ecf4c1c7a70b67303a7620abb2 (diff) |
Fix T76630: Crash when changing transform value with Custom Orientation
Diffstat (limited to 'source/blender/editors/transform/transform_generics.c')
-rw-r--r-- | source/blender/editors/transform/transform_generics.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 704a48f3707..2a3c8ef60c3 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -1690,25 +1690,28 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve if (orient_type_constraint == -1) { if (orient_type_set != -1) { - orient_type_default = orient_type_set; - - if (orient_type_default >= V3D_ORIENT_CUSTOM) { - if (orient_type_default >= V3D_ORIENT_CUSTOM + BIF_countTransformOrientation(C)) { - orient_type_default = V3D_ORIENT_GLOBAL; - } - else { - custom_orientation = BKE_scene_transform_orientation_find( - t->scene, orient_type_default - V3D_ORIENT_CUSTOM); - orient_type_default = V3D_ORIENT_CUSTOM; - } - } - orient_type_constraint = orient_type_default; + orient_type_default = orient_type_constraint = orient_type_set; } else { TransformOrientationSlot *orient_slot = &t->scene->orientation_slots[SCE_ORIENT_DEFAULT]; - orient_type_constraint = orient_slot->type; custom_orientation = BKE_scene_transform_orientation_find(t->scene, orient_slot->index_custom); + + /* Add the slot value to the orient_type to be used for Redo. */ + orient_type_constraint = orient_slot->type + orient_slot->index_custom; + } + } + + if (custom_orientation == NULL && orient_type_constraint >= V3D_ORIENT_CUSTOM) { + if (orient_type_constraint >= V3D_ORIENT_CUSTOM + BIF_countTransformOrientation(C)) { + if (orient_type_default == orient_type_constraint) { + orient_type_default = V3D_ORIENT_GLOBAL; + } + orient_type_constraint = V3D_ORIENT_GLOBAL; + } + else { + custom_orientation = BKE_scene_transform_orientation_find( + t->scene, orient_type_constraint - V3D_ORIENT_CUSTOM); } } |