[#20213] Align to Transform Orientation crashes Blender

Align needs to be call with region context.

Also added checks to prevent this from crashing if not called properly.
This commit is contained in:
Martin Poirier 2009-12-02 19:59:57 +00:00
parent bce687ef36
commit 63fc267929
3 changed files with 3 additions and 3 deletions

@ -139,7 +139,7 @@ class VIEW3D_MT_transform(bpy.types.Menu):
if context.edit_object and context.edit_object.type == 'ARMATURE':
layout.operator("armature.align")
else:
layout.operator_context = 'EXEC_AREA'
layout.operator_context = 'EXEC_REGION_WIN'
layout.operator("tfm.transform", text="Align to Transform Orientation").mode = 'ALIGN' # XXX see alignmenu() in edit.c of b2.4x to get this working
layout.separator()

@ -126,7 +126,7 @@
void setTransformViewMatrices(TransInfo *t)
{
if(t->spacetype==SPACE_VIEW3D && t->ar->regiontype == RGN_TYPE_WINDOW) {
if(t->spacetype==SPACE_VIEW3D && t->ar && t->ar->regiontype == RGN_TYPE_WINDOW) {
RegionView3D *rv3d = t->ar->regiondata;
copy_m4_m4(t->viewmat, rv3d->viewmat);

@ -1357,7 +1357,7 @@ void calculateCenter(TransInfo *t)
/* for panning from cameraview */
if(t->flag & T_OBJECT)
{
if(t->spacetype==SPACE_VIEW3D && t->ar->regiontype == RGN_TYPE_WINDOW)
if(t->spacetype==SPACE_VIEW3D && t->ar && t->ar->regiontype == RGN_TYPE_WINDOW)
{
View3D *v3d = t->view;
Scene *scene = t->scene;