Fix T76630: Crash when changing transform value with Custom Orientation
This commit is contained in:
parent
267e4d130a
commit
76c64af00c
Notes:
blender-bot
2023-06-26 11:58:59 +02:00
Referenced by issue #76630, Crash: When changing extrude amount in redo panel
|
@ -730,7 +730,9 @@ void setUserConstraint(TransInfo *t, short orientation, int mode, const char fte
|
|||
BLI_snprintf(text, sizeof(text), ftext, TIP_("custom matrix"));
|
||||
setConstraint(t, t->spacemtx, mode, text);
|
||||
break;
|
||||
case V3D_ORIENT_CUSTOM: {
|
||||
case V3D_ORIENT_CUSTOM:
|
||||
default: {
|
||||
BLI_assert(orientation >= V3D_ORIENT_CUSTOM);
|
||||
char orientation_str[128];
|
||||
BLI_snprintf(orientation_str,
|
||||
sizeof(orientation_str),
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -713,7 +713,9 @@ void ED_transform_calc_orientation_from_type_ex(const bContext *C,
|
|||
ok = true;
|
||||
break;
|
||||
}
|
||||
case V3D_ORIENT_CUSTOM: {
|
||||
case V3D_ORIENT_CUSTOM:
|
||||
default: {
|
||||
BLI_assert(orientation_type >= V3D_ORIENT_CUSTOM);
|
||||
TransformOrientation *custom_orientation = BKE_scene_transform_orientation_find(
|
||||
scene, orientation_index_custom);
|
||||
if (applyTransformOrientation(custom_orientation, r_mat, NULL)) {
|
||||
|
|
|
@ -500,8 +500,9 @@ void initTransformOrientation(bContext *C, TransInfo *t, short orientation)
|
|||
copy_m3_m3(t->spacemtx, t->orientation.custom_matrix);
|
||||
break;
|
||||
case V3D_ORIENT_CUSTOM:
|
||||
default:
|
||||
BLI_assert(orientation >= V3D_ORIENT_CUSTOM);
|
||||
BLI_strncpy(t->spacename, t->orientation.custom->name, sizeof(t->spacename));
|
||||
|
||||
if (applyTransformOrientation(t->orientation.custom, t->spacemtx, t->spacename)) {
|
||||
/* pass */
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue