forked from bartvdbraak/blender
various small fixes
- undo stops all running jobs (operator redo was crashing with threaded render) - adding new armatures was crashing if there was no valid view3d - transform with an active hidden object would crash
This commit is contained in:
parent
88b38c30a1
commit
98527a7106
@ -536,6 +536,9 @@ static int read_undosave(bContext *C, UndoElem *uel)
|
||||
char scestr[FILE_MAXDIR+FILE_MAXFILE];
|
||||
int success=0, fileflags;
|
||||
|
||||
/* This is needed so undoing/redoing doesnt crash with threaded previews going */
|
||||
WM_jobs_stop(CTX_wm_manager(C), CTX_wm_screen(C));
|
||||
|
||||
strcpy(scestr, G.sce); /* temporal store */
|
||||
fileflags= G.fileflags;
|
||||
G.fileflags |= G_FILE_NO_UI;
|
||||
|
@ -2242,7 +2242,7 @@ void add_primitive_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d)
|
||||
|
||||
VECCOPY(bone->head, curs);
|
||||
|
||||
if ( (U.flag & USER_ADD_VIEWALIGNED) )
|
||||
if (rv3d && (U.flag & USER_ADD_VIEWALIGNED))
|
||||
VecAddf(bone->tail, bone->head, imat[1]); // bone with unit length 1
|
||||
else
|
||||
VecAddf(bone->tail, bone->head, imat[2]); // bone with unit length 1, pointing up Z
|
||||
@ -3423,7 +3423,7 @@ static int armature_bone_primitive_add_exec(bContext *C, wmOperator *op)
|
||||
Mat4Invert(obedit->imat, obedit->obmat);
|
||||
Mat4MulVecfl(obedit->imat, curs);
|
||||
|
||||
if (U.flag & USER_ADD_VIEWALIGNED)
|
||||
if (rv3d && (U.flag & USER_ADD_VIEWALIGNED))
|
||||
Mat3CpyMat4(obmat, rv3d->viewmat);
|
||||
else Mat3One(obmat);
|
||||
|
||||
@ -3438,7 +3438,7 @@ static int armature_bone_primitive_add_exec(bContext *C, wmOperator *op)
|
||||
|
||||
VECCOPY(bone->head, curs);
|
||||
|
||||
if(U.flag & USER_ADD_VIEWALIGNED)
|
||||
if(rv3d && (U.flag & USER_ADD_VIEWALIGNED))
|
||||
VecAddf(bone->tail, bone->head, imat[1]); // bone with unit length 1
|
||||
else
|
||||
VecAddf(bone->tail, bone->head, imat[2]); // bone with unit length 1, pointing up Z
|
||||
|
@ -4729,7 +4729,7 @@ Nurb *add_nurbs_primitive(bContext *C, int type, int newname)
|
||||
cent[2]-= obedit->obmat[3][2];
|
||||
|
||||
if(rv3d) {
|
||||
if (!newname && U.flag & USER_ADD_VIEWALIGNED)
|
||||
if (!newname && (U.flag & USER_ADD_VIEWALIGNED))
|
||||
Mat3CpyMat4(imat, rv3d->viewmat);
|
||||
else
|
||||
Mat3One(imat);
|
||||
|
@ -129,7 +129,7 @@ MetaElem *add_metaball_primitive(bContext *C, int type, int newname)
|
||||
cent[2]-= obedit->obmat[3][2];
|
||||
|
||||
if (rv3d) {
|
||||
if (!(newname) || U.flag & USER_ADD_VIEWALIGNED || !rv3d)
|
||||
if (!(newname) || U.flag & USER_ADD_VIEWALIGNED)
|
||||
Mat3CpyMat4(imat, rv3d->viewmat);
|
||||
else
|
||||
Mat3One(imat);
|
||||
|
@ -518,6 +518,7 @@ void initTransformOrientation(bContext *C, TransInfo *t)
|
||||
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};
|
||||
|
||||
|
||||
switch(t->current_orientation) {
|
||||
case V3D_MANIP_GLOBAL:
|
||||
@ -530,7 +531,7 @@ void initTransformOrientation(bContext *C, TransInfo *t)
|
||||
gimbalAxis(ob, t->spacemtx);
|
||||
break;
|
||||
case V3D_MANIP_NORMAL:
|
||||
if(obedit || ob->mode & OB_MODE_POSE) {
|
||||
if(obedit || (ob && ob->mode & OB_MODE_POSE)) {
|
||||
float mat[3][3];
|
||||
int type;
|
||||
|
||||
@ -579,7 +580,12 @@ void initTransformOrientation(bContext *C, TransInfo *t)
|
||||
/* no break we define 'normal' as 'local' in Object mode */
|
||||
case V3D_MANIP_LOCAL:
|
||||
strcpy(t->spacename, "local");
|
||||
Mat3CpyMat4(t->spacemtx, ob->obmat);
|
||||
|
||||
if(ob)
|
||||
Mat3CpyMat4(t->spacemtx, ob->obmat);
|
||||
else
|
||||
Mat3One(t->spacemtx);
|
||||
|
||||
Mat3Ortho(t->spacemtx);
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user