2.5
Fix repeat crash with transform. Just remove stupid twmat, don't need to cache results in view3d. Made it more safe too.
This commit is contained in:
@@ -4522,7 +4522,6 @@ static void view3d_split_250(View3D *v3d, ListBase *regions)
|
||||
rv3d->dist= v3d->dist;
|
||||
VECCOPY(rv3d->ofs, v3d->ofs);
|
||||
QUATCOPY(rv3d->viewquat, v3d->viewquat);
|
||||
Mat4One(rv3d->twmat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,7 +183,6 @@ static SpaceLink *view3d_new(const bContext *C)
|
||||
rv3d->persp= 1;
|
||||
rv3d->view= 7;
|
||||
rv3d->dist= 10.0;
|
||||
Mat4One(rv3d->twmat);
|
||||
|
||||
return (SpaceLink *)v3d;
|
||||
}
|
||||
|
||||
@@ -985,9 +985,8 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
|
||||
RNA_boolean_set(op->ptr, "mirror", t->flag & T_MIRROR);
|
||||
}
|
||||
|
||||
if (RNA_struct_find_property(op->ptr, "constraint_mode"))
|
||||
if (RNA_struct_find_property(op->ptr, "constraint_axis"))
|
||||
{
|
||||
RNA_int_set(op->ptr, "constraint_mode", t->con.mode);
|
||||
RNA_int_set(op->ptr, "constraint_orientation", t->current_orientation);
|
||||
|
||||
if (t->con.mode & CON_APPLY)
|
||||
@@ -1038,18 +1037,11 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
|
||||
return 0;
|
||||
}
|
||||
|
||||
initTransformOrientation(C, t);
|
||||
|
||||
if(t->spacetype == SPACE_VIEW3D)
|
||||
{
|
||||
//calc_manipulator_stats(curarea);
|
||||
if (t->ar->regiontype == RGN_TYPE_WINDOW)
|
||||
{
|
||||
RegionView3D *rv3d = t->ar->regiondata;
|
||||
Mat3CpyMat4(t->spacemtx, rv3d->twmat);
|
||||
}
|
||||
Mat3Ortho(t->spacemtx);
|
||||
|
||||
initTransformOrientation(C, t);
|
||||
|
||||
t->draw_handle = ED_region_draw_cb_activate(t->ar->type, drawTransform, t, REGION_DRAW_POST);
|
||||
}
|
||||
else if(t->spacetype == SPACE_IMAGE) {
|
||||
|
||||
@@ -405,7 +405,6 @@ int BIF_countTransformOrientation(const bContext *C) {
|
||||
void applyTransformOrientation(bContext *C, TransInfo *t) {
|
||||
TransformOrientation *ts;
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
RegionView3D *rv3d= CTX_wm_region_view3d(C);
|
||||
int selected_index = (v3d->twmode - V3D_MANIP_CUSTOM);
|
||||
int i;
|
||||
|
||||
@@ -414,7 +413,6 @@ void applyTransformOrientation(bContext *C, TransInfo *t) {
|
||||
if (selected_index == i) {
|
||||
strcpy(t->spacename, ts->name);
|
||||
Mat3CpyMat3(t->spacemtx, ts->mat);
|
||||
Mat4CpyMat3(rv3d->twmat, ts->mat);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -448,14 +446,11 @@ static int count_bone_select(bArmature *arm, ListBase *lb, int do_it)
|
||||
void initTransformOrientation(bContext *C, TransInfo *t)
|
||||
{
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
RegionView3D *rv3d = CTX_wm_region_view3d(C);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
Object *obedit = CTX_data_active_object(C);
|
||||
float normal[3]={0.0, 0.0, 0.0};
|
||||
float plane[3]={0.0, 0.0, 0.0};
|
||||
|
||||
if(t->spacetype != SPACE_VIEW3D) return;
|
||||
|
||||
switch(t->current_orientation) {
|
||||
case V3D_MANIP_GLOBAL:
|
||||
strcpy(t->spacename, "global");
|
||||
@@ -500,28 +495,35 @@ void initTransformOrientation(bContext *C, TransInfo *t)
|
||||
|
||||
if (type == ORIENTATION_NONE)
|
||||
{
|
||||
Mat4One(rv3d->twmat);
|
||||
Mat3One(t->spacemtx);
|
||||
}
|
||||
else
|
||||
{
|
||||
Mat4CpyMat3(rv3d->twmat, mat);
|
||||
Mat3CpyMat3(t->spacemtx, mat);
|
||||
}
|
||||
break;
|
||||
}
|
||||
/* no break we define 'normal' as 'local' in Object mode */
|
||||
case V3D_MANIP_LOCAL:
|
||||
strcpy(t->spacename, "local");
|
||||
Mat4CpyMat4(rv3d->twmat, ob->obmat);
|
||||
Mat4Ortho(rv3d->twmat);
|
||||
Mat3CpyMat4(t->spacemtx, ob->obmat);
|
||||
Mat3Ortho(t->spacemtx);
|
||||
break;
|
||||
|
||||
case V3D_MANIP_VIEW:
|
||||
if (t->ar->regiontype == RGN_TYPE_WINDOW)
|
||||
{
|
||||
RegionView3D *rv3d = t->ar->regiondata;
|
||||
float mat[3][3];
|
||||
|
||||
strcpy(t->spacename, "view");
|
||||
Mat3CpyMat4(mat, rv3d->viewinv);
|
||||
Mat3Ortho(mat);
|
||||
Mat4CpyMat3(rv3d->twmat, mat);
|
||||
Mat3CpyMat3(t->spacemtx, mat);
|
||||
}
|
||||
else
|
||||
{
|
||||
Mat3One(t->spacemtx);
|
||||
}
|
||||
break;
|
||||
default: /* V3D_MANIP_CUSTOM */
|
||||
|
||||
@@ -78,7 +78,6 @@ typedef struct RegionView3D {
|
||||
float viewinv[4][4];
|
||||
float persmat[4][4];
|
||||
float persinv[4][4];
|
||||
float twmat[4][4]; /* transform widget */
|
||||
|
||||
float viewquat[4], dist, zfac; /* zfac is initgrabz() result */
|
||||
float camdx, camdy; /* camera view offsets, 1.0 = viewplane moves entire width/height */
|
||||
|
||||
Reference in New Issue
Block a user