Revision: 19009
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19009
Author:   ton
Date:     2009-02-17 16:53:52 +0100 (Tue, 17 Feb 2009)

Log Message:
-----------
2.5

Fix for the 'repeat last operator' option. It didn't work yet well
outside editmode. Now undo/redo has to fully keep the UI alive,
even when called from within a running popup.

Another fix: when regions collapse/hide they were not effectively
disabled, still accepting events. (like Nkey in 3d window).

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/blenkernel/intern/blender.c
    branches/blender2.5/blender/source/blender/editors/interface/interface.c
    branches/blender2.5/blender/source/blender/editors/screen/area.c
    branches/blender2.5/blender/source/blender/editors/transform/transform.c

Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/blender.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/blender.c      
2009-02-17 14:56:07 UTC (rev 19008)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/blender.c      
2009-02-17 15:53:52 UTC (rev 19009)
@@ -321,10 +321,6 @@
        G.main= bfd->main;
 
        CTX_data_main_set(C, G.main);
-       CTX_wm_screen_set(C, NULL);
-       CTX_wm_area_set(C, NULL);
-       CTX_wm_region_set(C, NULL);
-       CTX_wm_ui_block_set(C, NULL, NULL);
        
        if (bfd->user) {
                
@@ -340,15 +336,19 @@
        
        /* case G_FILE_NO_UI or no screens in file */
        if(mode) {
-               CTX_wm_screen_set(C, curscreen);
+               /* leave entire context further unaltered? */
                CTX_data_scene_set(C, curscene);
        }
        else {
                G.winpos= bfd->winpos;
                G.displaymode= bfd->displaymode;
                G.fileflags= bfd->fileflags;
+               
                CTX_wm_screen_set(C, bfd->curscreen);
                CTX_data_scene_set(C, bfd->curscreen->scene);
+               CTX_wm_area_set(C, NULL);
+               CTX_wm_region_set(C, NULL);
+               CTX_wm_ui_block_set(C, NULL, NULL);
        }
        
        /* this can happen when active scene was lib-linked, and doesnt exist 
anymore */
@@ -372,8 +372,9 @@
                //setscreen(G.curscreen);
        }
        
-       // XXX is this in the right place?
-       do_versions_ipos_to_animato(G.main); // XXX fixme... complicated 
versionpatching
+       // XXX temporarily here
+       if(G.main->versionfile < 250)
+               do_versions_ipos_to_animato(G.main); // XXX fixme... 
complicated versionpatching
        
        /* baseflags, groups, make depsgraph, etc */
        set_scene_bg(CTX_data_scene(C));

Modified: 
branches/blender2.5/blender/source/blender/editors/interface/interface.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/interface.c    
2009-02-17 14:56:07 UTC (rev 19008)
+++ branches/blender2.5/blender/source/blender/editors/interface/interface.c    
2009-02-17 15:53:52 UTC (rev 19009)
@@ -1494,6 +1494,7 @@
        }
 }
 
+/* can be called with C==NULL */
 static void ui_free_but(const bContext *C, uiBut *but)
 {
        if(but->opptr) {
@@ -1501,13 +1502,21 @@
                MEM_freeN(but->opptr);
        }
        if(but->func_argN) MEM_freeN(but->func_argN);
-       if(but->active) ui_button_active_cancel(C, but);
+       if(but->active) {
+               /* XXX solve later, buttons should be free-able without 
context? */
+               if(C) 
+                       ui_button_active_cancel(C, but);
+               else
+                       if(but->active) 
+                               MEM_freeN(but->active);
+       }
        if(but->str && but->str != but->strdata) MEM_freeN(but->str);
        ui_free_link(but->link);
 
        MEM_freeN(but);
 }
 
+/* can be called with C==NULL */
 void uiFreeBlock(const bContext *C, uiBlock *block)
 {
        uiBut *but;
@@ -1525,6 +1534,7 @@
        MEM_freeN(block);
 }
 
+/* can be called with C==NULL */
 void uiFreeBlocks(const bContext *C, ListBase *lb)
 {
        uiBlock *block;

Modified: branches/blender2.5/blender/source/blender/editors/screen/area.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/screen/area.c    
2009-02-17 14:56:07 UTC (rev 19008)
+++ branches/blender2.5/blender/source/blender/editors/screen/area.c    
2009-02-17 15:53:52 UTC (rev 19009)
@@ -330,6 +330,8 @@
        if(ar==NULL)
                return;
        
+       BLI_init_rcti(&ar->winrct, 0, 0, 0, 0);
+       
        /* clear state flags first */
        ar->flag &= ~RGN_FLAG_TOO_SMALL;
        /* user errors */
@@ -603,11 +605,17 @@
        for(ar= sa->regionbase.first; ar; ar= ar->next) {
                region_subwindow(wm, win, ar);
                
-               /* default region handlers */
-               ed_default_handlers(wm, &ar->handlers, ar->type->keymapflag);
+               if(ar->swinid) {
+                       /* default region handlers */
+                       ed_default_handlers(wm, &ar->handlers, 
ar->type->keymapflag);
 
-               if(ar->type->init)
-                       ar->type->init(wm, ar);
+                       if(ar->type->init)
+                               ar->type->init(wm, ar);
+               }
+               else {
+                       /* prevent uiblocks to run */
+                       uiFreeBlocks(NULL, &ar->uiblocks);      
+               }
                
        }
        area_azone_initialize(sa);

Modified: 
branches/blender2.5/blender/source/blender/editors/transform/transform.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/transform/transform.c    
2009-02-17 14:56:07 UTC (rev 19008)
+++ branches/blender2.5/blender/source/blender/editors/transform/transform.c    
2009-02-17 15:53:52 UTC (rev 19009)
@@ -1175,11 +1175,11 @@
                /*  Undo as last, certainly after special_trans_update! */
 
                if(t->state == TRANS_CANCEL) {
-                       if(t->undostr) ED_undo_push(C, t->undostr);
+//                     if(t->undostr) ED_undo_push(C, t->undostr);
                }
                else {
-                       if(t->undostr) ED_undo_push(C, t->undostr);
-                       else ED_undo_push(C, transform_to_undostr(t));
+//                     if(t->undostr) ED_undo_push(C, t->undostr);
+//                     else ED_undo_push(C, transform_to_undostr(t));
                }
                t->undostr= NULL;
 


_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to