2.5 - Bugfixes
authorJoshua Leung <aligorith@gmail.com>
Mon, 20 Jul 2009 00:02:03 +0000 (00:02 +0000)
committerJoshua Leung <aligorith@gmail.com>
Mon, 20 Jul 2009 00:02:03 +0000 (00:02 +0000)
* Fix for crash when holding down downarrow in the info-header search box. Was caused by badly written poll callback for file-browser. Thanks pidhash for noticing the error

* Made add constraint operators work again from 3D-View. They were using the wrong context pointer when in the 3D-View, since the old one was only valid for the buttons-window. Now they check which window they're in.

source/blender/editors/object/editconstraint.c
source/blender/editors/space_file/file_ops.c

index 477d04a818b894ffe901bbf794a029ef85c2372f..e3ec72b502c9293aad18e1a5eecb06e1aee5cb87 100644 (file)
@@ -1329,8 +1329,14 @@ static int object_constraint_add_invoke(bContext *C, wmOperator *op, wmEvent *ev
 /* dummy operator callback */
 static int object_constraint_add_exec(bContext *C, wmOperator *op)
 {
-       Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
-
+       ScrArea *sa= CTX_wm_area(C);
+       Object *ob;
+       
+       if (sa->spacetype == SPACE_BUTS)
+               ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
+       else
+               ob= CTX_data_active_object(C);
+       
        if (!ob)
                return OPERATOR_CANCELLED;
 
@@ -1372,8 +1378,14 @@ static int pose_constraint_add_invoke(bContext *C, wmOperator *op, wmEvent *evt)
 /* dummy operator callback */
 static int pose_constraint_add_exec(bContext *C, wmOperator *op)
 {
-       Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
-
+       ScrArea *sa= CTX_wm_area(C);
+       Object *ob;
+       
+       if (sa->spacetype == SPACE_BUTS)
+               ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
+       else
+               ob= CTX_data_active_object(C);
+       
        if (!ob)
                return OPERATOR_CANCELLED;
        
index cd981b7b419dd47ffb5e21bf87c8f01a6b6fb8bd..0bc2e310810221081f80c4bd2d070a18444eb475 100644 (file)
@@ -876,14 +876,17 @@ int file_delete_poll(bContext *C)
        SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
        struct direntry* file;
 
-       if(!sfile->params ) poll= 0;
-
-       if (sfile->params->active_file < 0) { 
-               poll= 0;
-       } else {
-               file = filelist_file(sfile->files, sfile->params->active_file);
-               if (file && S_ISDIR(file->type)) poll= 0;
+       if (sfile->params) {
+               if (sfile->params->active_file < 0) { 
+                       poll= 0;
+               } else {
+                       file = filelist_file(sfile->files, sfile->params->active_file);
+                       if (file && S_ISDIR(file->type)) poll= 0;
+               }
        }
+       else
+               poll= 0;
+               
        return poll;
 }