fix [#26618] StringProperty with sub_type of FILE_PATH not updated correctly from...
authorCampbell Barton <ideasman42@gmail.com>
Mon, 23 May 2011 10:14:07 +0000 (10:14 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 23 May 2011 10:14:07 +0000 (10:14 +0000)
source/blender/editors/space_buttons/buttons_ops.c
source/blender/editors/space_view3d/view3d_toolbar.c
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/intern/wm_operators.c

index 9190d5aff546710d2155fce0b6b91df9084eb9b7..9b914df1b3c85a7cb67ed60ee0f7d6f682709395 100644 (file)
@@ -51,6 +51,7 @@
 #include "WM_types.h"
 
 #include "ED_screen.h"
+#include "ED_util.h"
 
 #include "RNA_access.h"
 
@@ -131,7 +132,19 @@ static int file_browse_exec(bContext *C, wmOperator *op)
        RNA_property_update(C, &fbo->ptr, fbo->prop);
        MEM_freeN(str);
 
+
+       /* special, annoying exception, filesel on redo panel [#26618] */
+       {
+               wmOperator *redo_op= WM_operator_last_redo(C);
+               if(redo_op) {
+                       if(fbo->ptr.data == redo_op->ptr->data) {
+                               ED_undo_operator_repeat(C, redo_op);
+                       }
+               }
+       }
+
        MEM_freeN(op->customdata);
+
        return OPERATOR_FINISHED;
 }
 
index 7fad19f16a6445c37e822e4337e20c7dc1178afd..2e96800bf3be04c392277613c5647085a9cd064f 100644 (file)
 
 /* ******************* view3d space & buttons ************** */
 
-static wmOperator *view3d_last_operator(const bContext *C)
-{
-       wmWindowManager *wm= CTX_wm_manager(C);
-       wmOperator *op;
-
-       /* only for operators that are registered and did an undo push */
-       for(op= wm->operators.last; op; op= op->prev)
-               if((op->type->flag & OPTYPE_REGISTER) && (op->type->flag & OPTYPE_UNDO))
-                       break;
-
-       return op;
-}
-
 static void view3d_panel_operator_redo_buts(const bContext *C, Panel *pa, wmOperator *op)
 {
        uiLayoutOperatorButs(C, pa->layout, op, NULL, 'V', 0);
@@ -89,7 +76,7 @@ static void view3d_panel_operator_redo_buts(const bContext *C, Panel *pa, wmOper
 
 static void view3d_panel_operator_redo_header(const bContext *C, Panel *pa)
 {
-       wmOperator *op= view3d_last_operator(C);
+       wmOperator *op= WM_operator_last_redo(C);
 
        if(op) BLI_strncpy(pa->drawname, op->type->name, sizeof(pa->drawname));
        else BLI_strncpy(pa->drawname, "Operator", sizeof(pa->drawname));
@@ -110,7 +97,7 @@ static void view3d_panel_operator_redo_operator(const bContext *C, Panel *pa, wm
 
 static void view3d_panel_operator_redo(const bContext *C, Panel *pa)
 {
-       wmOperator *op= view3d_last_operator(C);
+       wmOperator *op= WM_operator_last_redo(C);
        uiBlock *block;
        
        if(op==NULL)
index e08e681f494811019ea8b54a3103c6e4dd3f2630..3f9a3f636d086246152bf4e9af0ea9ec8c644b52 100644 (file)
@@ -247,6 +247,8 @@ void                WM_operator_properties_gesture_border(struct wmOperatorType *ot, int exten
 void           WM_operator_properties_gesture_straightline(struct wmOperatorType *ot, int cursor);
 void           WM_operator_properties_select_all(struct wmOperatorType *ot);
 
+wmOperator *WM_operator_last_redo(const struct bContext *C);
+
 /* MOVE THIS SOMEWHERE ELSE */
 #define        SEL_TOGGLE              0
 #define        SEL_SELECT              1
index 745ae0ae47e05ccdfc779a1d9b5aebbc9ad284a9..fc2c0338bdfeb32467295be1be250aa5bb2194c5 100644 (file)
@@ -882,6 +882,19 @@ int WM_operator_winactive(bContext *C)
        return 1;
 }
 
+wmOperator *WM_operator_last_redo(const bContext *C)
+{
+       wmWindowManager *wm= CTX_wm_manager(C);
+       wmOperator *op;
+
+       /* only for operators that are registered and did an undo push */
+       for(op= wm->operators.last; op; op= op->prev)
+               if((op->type->flag & OPTYPE_REGISTER) && (op->type->flag & OPTYPE_UNDO))
+                       break;
+
+       return op;
+}
+
 static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op)
 {
        wmOperator *op= arg_op;