Fix T69999: Active element pivot crashes without active object

This commit is contained in:
Campbell Barton 2019-09-20 10:19:43 +10:00
parent 5356577e4c
commit 6dc7cefb78
Notes: blender-bot 2023-02-14 00:46:14 +01:00
Referenced by issue #69999, transform pivot point to active - crashes blender
1 changed files with 11 additions and 7 deletions

View File

@ -1168,16 +1168,20 @@ static void gizmo_prepare_mat(const bContext *C,
if (scene->toolsettings->transform_pivot_point == V3D_AROUND_ACTIVE) {
bGPdata *gpd = CTX_data_gpencil_data(C);
Object *ob = OBACT(view_layer);
if (gpd && (gpd->flag & GP_DATA_STROKE_EDITMODE)) {
/* pass */
}
else if (ob->sculpt) {
SculptSession *ss = ob->sculpt;
copy_v3_v3(rv3d->twmat[3], ss->pivot_pos);
}
else if (ob != NULL) {
ED_object_calc_active_center(ob, false, rv3d->twmat[3]);
else {
Object *ob = OBACT(view_layer);
if (ob != NULL) {
if ((ob->mode & OB_MODE_ALL_SCULPT) && ob->sculpt) {
SculptSession *ss = ob->sculpt;
copy_v3_v3(rv3d->twmat[3], ss->pivot_pos);
}
else {
ED_object_calc_active_center(ob, false, rv3d->twmat[3]);
}
}
}
}
break;