From 76c64af00caa7308368dfe0221b617c2aae3cde4 Mon Sep 17 00:00:00 2001 From: Germano Cavalcante Date: Mon, 11 May 2020 09:47:15 -0300 Subject: Fix T76630: Crash when changing transform value with Custom Orientation --- .../blender/editors/transform/transform_generics.c | 31 ++++++++++++---------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'source/blender/editors/transform/transform_generics.c') 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); } } -- cgit v1.2.3