[#20213] Align to Transform Orientation crashes Blender
authorMartin Poirier <theeth@yahoo.com>
Wed, 2 Dec 2009 19:59:57 +0000 (19:59 +0000)
committerMartin Poirier <theeth@yahoo.com>
Wed, 2 Dec 2009 19:59:57 +0000 (19:59 +0000)
Align needs to be call with region context.

Also added checks to prevent this from crashing if not called properly.

release/scripts/ui/space_view3d.py
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform_generics.c

index 5ad63a578d2a0a41de67a9c0421fc5f2e078a248..ea44e43c85155098fa739a4ce1c81cbc12768ebd 100644 (file)
@@ -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()
index cbcb3953f49cec205fa88cf5aabb3f23b5b39cd9..ffc6ea868358b5c75260d6f5145175810374616d 100644 (file)
 
 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);
index 71a5affb57372294bdf260e4ee5630c274f2acbe..c9b5b17091e43a2f77298c64783d6d8248ecdae9 100644 (file)
@@ -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;