NLA SoC: Merge from 2.5
authorJoshua Leung <aligorith@gmail.com>
Sat, 6 Jun 2009 05:00:40 +0000 (05:00 +0000)
committerJoshua Leung <aligorith@gmail.com>
Sat, 6 Jun 2009 05:00:40 +0000 (05:00 +0000)
20571 to 20667

1  2 
release/ui/buttons_data_modifier.py
source/blender/blenloader/intern/readfile.c
source/blender/editors/screen/screen_ops.c
source/blender/editors/space_file/filesel.c
source/blender/editors/space_view3d/space_view3d.c
source/blender/makesdna/DNA_space_types.h

index 6de2d6454714d0920b73ccf3c6ded0df1d250243,0f5d446f889b2f788214cb02159d4fb4d70f94dd..72b2f29100eb4ecbb1a194e4ed37e67194dbe934
@@@ -7,7 -7,7 +7,7 @@@ class DataButtonsPanel(bpy.types.Panel)
        __context__ = "modifier"
  
        def poll(self, context):
-               ob = context.active_object
+               ob = context.object
                return (ob and ob.type in ('MESH', 'CURVE', 'SURFACE', 'TEXT', 'LATTICE'))
                
  class DATA_PT_modifiers(DataButtonsPanel):
@@@ -15,7 -15,7 +15,7 @@@
        __label__ = "Modifiers"
  
        def draw(self, context):
-               ob = context.active_object
+               ob = context.object
                layout = self.layout
  
                row = layout.row()
@@@ -23,9 -23,9 +23,9 @@@
                row.itemL();
  
                for md in ob.modifiers:
 -                      box = layout.template_modifier(md)
 +                      box = layout.template_modifier(context, md)
  
 -                      if box:
 +                      if md.expanded:
                                if md.type == 'ARMATURE':
                                        self.armature(box, md)
                                if md.type == 'ARRAY':
@@@ -61,7 -61,7 +61,7 @@@
                                if md.type == 'MASK':
                                        self.mask(box, md)
                                if md.type == 'MESH_DEFORM':
-                                       self.meshdeform(box, md)
+                                       self.mesh_deform(box, md)
                                if md.type == 'MIRROR':
                                        self.mirror(box, md)
                                if md.type == 'MULTIRES':
                if md.fit_type == 'FIT_LENGTH':
                        layout.itemR(md, "length")
                if md.fit_type == 'FIT_CURVE':
 -                      layout.itemR(md, "curve")
 +                              layout.itemR(md, "curve")
+               layout.itemS()
                
                split = layout.split()
                
                col.itemR(md, "constant_offset")
                colsub = col.column()
                colsub.active = md.constant_offset
-               colsub.itemR(md, "constant_offset_displacement", text="Displacement")
+               colsub.itemR(md, "constant_offset_displacement", text="")
+               col.itemS()
                sub = col.row().itemR(md, "merge_adjacent_vertices", text="Merge")
                colsub = col.column()
                colsub.active = md.merge_adjacent_vertices
                col.itemR(md, "relative_offset")
                colsub = col.column()
                colsub.active = md.relative_offset
-               colsub.itemR(md, "relative_offset_displacement", text="Displacement")
+               colsub.itemR(md, "relative_offset_displacement", text="")
+               col.itemS()
                col = col.column()
                col.itemR(md, "add_offset_object")
                colsub = col.column()
                colsub.active = md.add_offset_object
-               colsub.itemR(md, "offset_object")
+               colsub.itemR(md, "offset_object", text="")
+               layout.itemS()
                
                col = layout.column()
                col.itemR(md, "start_cap")
                layout.itemL(text="See Collision panel.")
                
        def curve(self, layout, md):
 -              layout.itemR(md, "object")
 +              layout.itemR(md, "curve")
                layout.itemR(md, "vertex_group")
                layout.itemR(md, "deform_axis")
                
                # Missing: "Reset" and "Recenter"
                
        def lattice(self, layout, md):
 -              layout.itemR(md, "object")
 +              layout.itemR(md, "lattice")
                layout.itemR(md, "vertex_group")
                
        def mask(self, layout, md):
                        layout.itemR(md, "vertex_group")
                layout.itemR(md, "inverse")
                
-       def meshdeform(self, layout, md):
+       def mesh_deform(self, layout, md):
 -              layout.itemR(md, "object")
 +              layout.itemR(md, "mesh")
                layout.itemR(md, "vertex_group")
                layout.itemR(md, "invert")
-               layout.itemR(md, "precision")
-               layout.itemR(md, "dynamic")
-               # Missing: "Bind"
+               layout.itemS()
+               layout.itemO("OBJECT_OT_modifier_mdef_bind", text="Bind")
+               row = layout.row()
+               row.itemR(md, "precision")
+               row.itemR(md, "dynamic")
                
        def mirror(self, layout, md):
                layout.itemR(md, "merge_limit")
index 160b094392810979b890aace891be52450581f55,c459d7669374db081b70239c5dc6a84d2e0a2e6c..e3869d4bc8a06dc5daec823f9485bd2694f1f952
@@@ -1657,26 -1657,10 +1657,26 @@@ static void lib_link_constraint_channel
  
  /* Data Linking ----------------------------- */
  
 +static void lib_link_fmodifiers(FileData *fd, ID *id, ListBase *list)
 +{
 +      FModifier *fcm;
 +      
 +      for (fcm= list->first; fcm; fcm= fcm->next) {
 +              /* data for specific modifiers */
 +              switch (fcm->type) {
 +                      case FMODIFIER_TYPE_PYTHON:
 +                      {
 +                              FMod_Python *data= (FMod_Python *)fcm->data;
 +                              data->script = newlibadr(fd, id->lib, data->script);
 +                      }
 +                              break;
 +              }
 +      }
 +}
 +
  static void lib_link_fcurves(FileData *fd, ID *id, ListBase *list) 
  {
        FCurve *fcu;
 -      FModifier *fcm;
        
        /* relink ID-block references... */
        for (fcu= list->first; fcu; fcu= fcu->next) {
                }
                
                /* modifiers */
 -              for (fcm= fcu->modifiers.first; fcm; fcm= fcm->next) {
 -                      /* data for specific modifiers */
 -                      switch (fcm->type) {
 -                              case FMODIFIER_TYPE_PYTHON:
 -                              {
 -                                      FMod_Python *data= (FMod_Python *)fcm->data;
 -                                      data->script = newlibadr(fd, id->lib, data->script);
 -                              }
 -                                      break;
 +              lib_link_fmodifiers(fd, id, &fcu->modifiers);
 +      }
 +}
 +
 +
 +/* NOTE: this assumes that link_list has already been called on the list */
 +static void direct_link_fmodifiers(FileData *fd, ListBase *list)
 +{
 +      FModifier *fcm;
 +      
 +      for (fcm= list->first; fcm; fcm= fcm->next) {
 +              /* relink general data */
 +              fcm->data = newdataadr(fd, fcm->data);
 +              fcm->edata= NULL;
 +              
 +              /* do relinking of data for specific types */
 +              switch (fcm->type) {
 +                      case FMODIFIER_TYPE_GENERATOR:
 +                      {
 +                              FMod_Generator *data= (FMod_Generator *)fcm->data;
 +                              
 +                              data->coefficients= newdataadr(fd, data->coefficients);
 +                      }
 +                              break;
 +                      case FMODIFIER_TYPE_ENVELOPE:
 +                      {
 +                              FMod_Envelope *data= (FMod_Envelope *)fcm->data;
 +                              
 +                              data->data= newdataadr(fd, data->data);
                        }
 +                              break;
 +                      case FMODIFIER_TYPE_PYTHON:
 +                      {
 +                              FMod_Python *data= (FMod_Python *)fcm->data;
 +                              
 +                              data->prop = newdataadr(fd, data->prop);
 +                              IDP_DirectLinkProperty(data->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
 +                      }
 +                              break;
                }
        }
  }
  static void direct_link_fcurves(FileData *fd, ListBase *list)
  {
        FCurve *fcu;
 -      FModifier *fcm;
        
        /* link F-Curve data to F-Curve again (non ID-libs) */
        for (fcu= list->first; fcu; fcu= fcu->next) {
                
                /* modifiers */
                link_list(fd, &fcu->modifiers);
 -              for (fcm= fcu->modifiers.first; fcm; fcm= fcm->next) {
 -                      /* relink general data */
 -                      fcm->data = newdataadr(fd, fcm->data);
 -                      fcm->edata= NULL;
 -                      
 -                      /* do relinking of data for specific types */
 -                      switch (fcm->type) {
 -                              case FMODIFIER_TYPE_GENERATOR:
 -                              {
 -                                      FMod_Generator *data= (FMod_Generator *)fcm->data;
 -                                      
 -                                      data->coefficients= newdataadr(fd, data->coefficients);
 -                              }
 -                                      break;
 -                              case FMODIFIER_TYPE_ENVELOPE:
 -                              {
 -                                      FMod_Envelope *data= (FMod_Envelope *)fcm->data;
 -                                      
 -                                      data->data= newdataadr(fd, data->data);
 -                              }
 -                                      break;
 -                              case FMODIFIER_TYPE_PYTHON:
 -                              {
 -                                      FMod_Python *data= (FMod_Python *)fcm->data;
 -                                      
 -                                      data->prop = newdataadr(fd, data->prop);
 -                                      IDP_DirectLinkProperty(data->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
 -                              }
 -                                      break;
 -                      }
 -              }
 +              direct_link_fmodifiers(fd, &fcu->modifiers);
        }
  }
  
@@@ -1816,44 -1802,6 +1816,44 @@@ static void direct_link_action(FileDat
        }
  }
  
 +
 +static void lib_link_nladata (FileData *fd, ID *id, ListBase *list)
 +{
 +      NlaTrack *nlt;
 +      NlaStrip *strip;
 +      
 +      /* we only acare about the NLA strips inside the tracks */
 +      for (nlt= list->first; nlt; nlt= nlt->next) {
 +              for (strip= nlt->strips.first; strip; strip= strip->next) {
 +                      /* reassign the counted-reference to action */
 +                      strip->act = newlibadr_us(fd, id->lib, strip->act);
 +              }
 +      }
 +}
 +
 +/* NOTE: this assumes that link_list has already been called on the list */
 +static void direct_link_nladata(FileData *fd, ListBase *list)
 +{
 +      NlaTrack *nlt;
 +      NlaStrip *strip;
 +      
 +      for (nlt= list->first; nlt; nlt= nlt->next) {
 +              /* relink list of strips */
 +              link_list(fd, &nlt->strips);
 +              
 +              /* relink strip data */
 +              for (strip= nlt->strips.first; strip; strip= strip->next) {
 +                      /* strip's F-Curves */
 +                      link_list(fd, &strip->fcurves);
 +                      direct_link_fcurves(fd, &strip->fcurves);
 +                      
 +                      /* strip's F-Modifiers */
 +                      link_list(fd, &strip->modifiers);
 +                      direct_link_fcurves(fd, &strip->modifiers);
 +              }
 +      }
 +}
 +
  /* ------- */
  
  static void lib_link_keyingsets(FileData *fd, ID *id, ListBase *list)
@@@ -1903,7 -1851,7 +1903,7 @@@ static void lib_link_animdata(FileData 
        /* overrides don't have lib-link for now, so no need to do anything */
        
        /* link NLA-data */
 -      // TODO... 
 +      lib_link_nladata(fd, id, &adt->nla_tracks);
  }
  
  static void direct_link_animdata(FileData *fd, AnimData *adt)
        // TODO...
        
        /* link NLA-data */
 -      // TODO...
 +      link_list(fd, &adt->nla_tracks);
 +      direct_link_nladata(fd, &adt->nla_tracks);
  }     
  
  /* ************ READ NODE TREE *************** */
@@@ -4243,6 -4190,7 +4243,7 @@@ static void lib_link_screen(FileData *f
                                                SpaceButs *sbuts= (SpaceButs *)sl;
                                                sbuts->lockpoin= NULL;
                                                sbuts->ri= NULL;
+                                               sbuts->pinid= newlibadr(fd, sc->id.lib, sbuts->pinid);
                                                if(main->versionfile<132)
                                                        butspace_version_132(sbuts);
                                        }
@@@ -4444,6 -4392,7 +4445,7 @@@ void lib_link_screen_restore(Main *newm
                                else if(sl->spacetype==SPACE_BUTS) {
                                        SpaceButs *sbuts= (SpaceButs *)sl;
                                        sbuts->lockpoin= NULL;
+                                       sbuts->pinid = restore_pointer_by_name(newmain, sbuts->pinid, 0);
                                        //XXX if (sbuts->ri) sbuts->ri->curtile = 0;
                                }
                                else if(sl->spacetype==SPACE_FILE) {
@@@ -4688,11 -4637,6 +4690,11 @@@ static void direct_link_screen(FileDat
                                sipo->ads= newdataadr(fd, sipo->ads);
                                sipo->ghostCurves.first= sipo->ghostCurves.last= NULL;
                        }
 +                      else if (sl->spacetype==SPACE_NLA) {
 +                              SpaceNla *snla= (SpaceNla*)sl;
 +                              
 +                              snla->ads= newdataadr(fd, snla->ads);
 +                      }
                        else if (sl->spacetype==SPACE_OUTLINER) {
                                SpaceOops *soops= (SpaceOops*) sl;
                                
                                        direct_link_gpencil(fd, sseq->gpd);
                                }
                        }
+                       else if(sl->spacetype==SPACE_BUTS) {
+                               SpaceButs *sbuts= (SpaceButs *)sl;
+                               sbuts->path= NULL;
+                       }
                }
                
                sa->actionzones.first= sa->actionzones.last= NULL;
@@@ -5681,7 -5629,7 +5687,7 @@@ static void area_add_window_regions(Scr
                                ar->v2d.scroll = (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
                                ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
                                ar->v2d.keepzoom= V2D_LOCKZOOM_Y;
 -                              ar->v2d.align= V2D_ALIGN_NO_POS_Y;
 +                              ar->v2d.align= V2D_ALIGN_NO_NEG_Y;
                                ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
                                break;
                        }
@@@ -6802,26 -6750,26 +6808,26 @@@ static void do_versions(FileData *fd, L
                                        
                                                if(sbuts->mainb==BUTS_LAMP) {
                                                        sbuts->mainb= CONTEXT_SHADING;
-                                                       sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_LAMP;
+                                                       //sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_LAMP;
                                                }
                                                else if(sbuts->mainb==BUTS_MAT) {
                                                        sbuts->mainb= CONTEXT_SHADING;
-                                                       sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_MAT;
+                                                       //sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_MAT;
                                                }
                                                else if(sbuts->mainb==BUTS_TEX) {
                                                        sbuts->mainb= CONTEXT_SHADING;
-                                                       sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_TEX;
+                                                       //sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_TEX;
                                                }
                                                else if(sbuts->mainb==BUTS_ANIM) {
                                                        sbuts->mainb= CONTEXT_OBJECT;
                                                }
                                                else if(sbuts->mainb==BUTS_WORLD) {
                                                        sbuts->mainb= CONTEXT_SCENE;
-                                                       sbuts->tab[CONTEXT_SCENE]= TAB_SCENE_WORLD;
+                                                       //sbuts->tab[CONTEXT_SCENE]= TAB_SCENE_WORLD;
                                                }
                                                else if(sbuts->mainb==BUTS_RENDER) {
                                                        sbuts->mainb= CONTEXT_SCENE;
-                                                       sbuts->tab[CONTEXT_SCENE]= TAB_SCENE_RENDER;
+                                                       //sbuts->tab[CONTEXT_SCENE]= TAB_SCENE_RENDER;
                                                }
                                                else if(sbuts->mainb==BUTS_GAME) {
                                                        sbuts->mainb= CONTEXT_LOGIC;
                                                }
                                                else if(sbuts->mainb==BUTS_RADIO) {
                                                        sbuts->mainb= CONTEXT_SHADING;
-                                                       sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_RAD;
+                                                       //sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_RAD;
                                                }
                                                else if(sbuts->mainb==BUTS_CONSTRAINT) {
                                                        sbuts->mainb= CONTEXT_OBJECT;
  
                                                part->draw_as = PART_DRAW_PATH;
                                                part->type = PART_HAIR;
-                                               psys->recalc |= PSYS_RECALC_HAIR;
+                                               psys->recalc |= PSYS_RECALC_REDO;
  
                                                part->normfac *= fac;
                                                part->randfac *= fac;
                Mesh *me;
                Scene *sce;
                Tex *tx;
+               ParticleSettings *part;
                
                for(screen= main->screen.first; screen; screen= screen->id.next) {
                        do_versions_windowmanager_2_50(screen);
                for(me= main->mesh.first; me; me= me->id.next) {
                        me->drawflag= ME_DRAWEDGES|ME_DRAWFACES|ME_DRAWCREASES;
                }
+               /* particle settings conversion */
+               for(part= main->particle.first; part; part= part->id.next) {
+                       if(part->draw_as) {
+                               if(part->draw_as == PART_DRAW_DOT) {
+                                       part->ren_as = PART_DRAW_HALO;
+                                       part->draw_as = PART_DRAW_REND;
+                               }
+                               else if(part->draw_as <= PART_DRAW_AXIS) {
+                                       part->ren_as = PART_DRAW_HALO;
+                               }
+                               else {
+                                       part->ren_as = part->draw_as;
+                                       part->draw_as = PART_DRAW_REND;
+                               }
+                       }
+               }
        }
  
        /* TODO: should be moved into one of the version blocks once this branch moves to trunk and we can
@@@ -9377,8 -9343,6 +9401,8 @@@ static void expand_keyingsets(FileData 
  static void expand_animdata(FileData *fd, Main *mainvar, AnimData *adt)
  {
        FCurve *fcd;
 +      NlaTrack *nlt;
 +      NlaStrip *strip;
        
        /* own action */
        expand_doit(fd, mainvar, adt->action);
                for (dtar= driver->targets.first; dtar; dtar= dtar->next)
                        expand_doit(fd, mainvar, dtar->id);
        }
 +      
 +      /* nla-data - referenced actions */
 +      for (nlt= adt->nla_tracks.first; nlt; nlt= nlt->next) {
 +              for (strip= nlt->strips.first; strip; strip= strip->next) 
 +                      expand_doit(fd, mainvar, strip->act);
 +      }
  }     
  
  static void expand_particlesettings(FileData *fd, Main *mainvar, ParticleSettings *part)
index db1a39ed056ec779dbe0633ab6584242c4f3e9d7,a61db5d5e1a48bc43f41ef890dab349b2c717a44..3e237bff46a6ec5247813c1ae0441c968c22ed97
@@@ -164,7 -164,6 +164,7 @@@ int ED_operator_node_active(bContext *C
        return 0;
  }
  
 +// XXX rename
  int ED_operator_ipo_active(bContext *C)
  {
        return ed_spacetype_test(C, SPACE_IPO);
@@@ -180,11 -179,6 +180,11 @@@ int ED_operator_image_active(bContext *
        return ed_spacetype_test(C, SPACE_IMAGE);
  }
  
 +int ED_operator_nla_active(bContext *C)
 +{
 +      return ed_spacetype_test(C, SPACE_NLA);
 +}
 +
  int ED_operator_object_active(bContext *C)
  {
        return NULL != CTX_data_active_object(C);
@@@ -231,7 -225,8 +231,8 @@@ int ED_operator_uvedit(bContext *C
                return 1;
        }
  
-       BKE_mesh_end_editmesh(obedit->data, em);
+       if(obedit)
+               BKE_mesh_end_editmesh(obedit->data, em);
        return 0;
  }
  
@@@ -248,7 -243,8 +249,8 @@@ int ED_operator_uvmap(bContext *C
                return 1;
        }
  
-       BKE_mesh_end_editmesh(obedit->data, em);
+       if(obedit)
+               BKE_mesh_end_editmesh(obedit->data, em);
        return 0;
  }
  
@@@ -612,18 -608,25 +614,25 @@@ static int area_dupli_invoke(bContext *
        bScreen *newsc, *sc;
        ScrArea *sa;
        rcti rect;
-       sActionzoneData *sad= event->customdata;
-       if(sad==NULL)
-               return OPERATOR_PASS_THROUGH;
        
        win= CTX_wm_window(C);
        sc= CTX_wm_screen(C);
-       sa= sad->sa1;
+       sa= CTX_wm_area(C);
+       
+       /* XXX hrmf! */
+       if(event->type==EVT_ACTIONZONE_AREA) {
+               sActionzoneData *sad= event->customdata;
  
+               if(sad==NULL)
+                       return OPERATOR_PASS_THROUGH;
+       
+               sa= sad->sa1;
+       }
+       
        /*  poll() checks area context, but we don't accept full-area windows */
        if(sc->full != SCREENNORMAL) {
-               actionzone_exit(C, op);
+               if(event->type==EVT_ACTIONZONE_AREA)
+                       actionzone_exit(C, op);
                return OPERATOR_CANCELLED;
        }
        
        /* screen, areas init */
        WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
  
-       actionzone_exit(C, op);
+       if(event->type==EVT_ACTIONZONE_AREA)
+               actionzone_exit(C, op);
        
        return OPERATOR_FINISHED;
  }
@@@ -1976,37 -1980,6 +1986,6 @@@ static int region_flip_exec(bContext *C
        return OPERATOR_FINISHED;
  }
  
- static void testfunc(bContext *C, void *argv, int arg)
- {
-       printf("arg %d\n", arg);
- }
- static void newlevel1(bContext *C, uiLayout *layout, void *arg)
- {
-       uiLayoutSetFunc(layout, testfunc, NULL);
-       
-       uiItemV(layout, "First", ICON_PROP_ON, 1);
-       uiItemV(layout, "Second", ICON_PROP_CON, 2);
-       uiItemV(layout, "Third", ICON_SMOOTHCURVE, 3);
-       uiItemV(layout, "Fourth", ICON_SHARPCURVE, 4);  
- }
- static int testing123(bContext *C, wmOperator *op, wmEvent *event)
- {
-       uiPopupMenu *pup= uiPupMenuBegin(C, "Hello world", 0);
-       uiLayout *layout= uiPupMenuLayout(pup);
-       
-       uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT);
-       uiItemO(layout, NULL, ICON_PROP_ON, "SCREEN_OT_region_flip");
-       uiItemO(layout, NULL, ICON_PROP_CON, "SCREEN_OT_screen_full_area");
-       uiItemO(layout, NULL, ICON_SMOOTHCURVE, "SCREEN_OT_region_foursplit");
-       uiItemMenuF(layout, "Submenu", 0, newlevel1);
-       
-       uiPupMenuEnd(C, pup);
-       
-       /* this operator is only for a menu, not used further */
-       return OPERATOR_CANCELLED;
- }
  
  void SCREEN_OT_region_flip(wmOperatorType *ot)
  {
        ot->idname= "SCREEN_OT_region_flip";
        
        /* api callbacks */
-       ot->invoke= testing123; // XXX WM_operator_confirm;
        ot->exec= region_flip_exec;
        
        ot->poll= ED_operator_areaactive;
        ot->flag= OPTYPE_REGISTER;
-       
-       RNA_def_int(ot->srna, "test", 0, INT_MIN, INT_MAX, "test", "", INT_MIN, INT_MAX);
  
  }
  
index 091319cd4020276ea69f21ac98f63c122c8a35c8,d57fc7f90bc4ef7c73bdd146f195a0dac3831c25..4c2def72de06530e07e7f419befa1775e85f7133
  FileSelectParams* ED_fileselect_get_params(struct SpaceFile *sfile)
  {
        if (!sfile->params) {
-               ED_fileselect_set_params(sfile, FILE_UNIX, "", "/", 0, FILE_SHORTDISPLAY, 0);
+               ED_fileselect_set_params(sfile, "", "/", 0, FILE_SHORTDISPLAY, 0, FILE_SORTALPHA);
        }
        return sfile->params;
  }
  
- short ED_fileselect_set_params(SpaceFile *sfile, int type, const char *title, const char *path,
-                                                          short flag, short display, short filter)
+ short ED_fileselect_set_params(SpaceFile *sfile, const char *title, const char *path,
+                                                          short flag, short display, short filter, short sort)
  {
        char name[FILE_MAX], dir[FILE_MAX], file[FILE_MAX];
        FileSelectParams *params;
  
        params = sfile->params;
  
-       params->type = type;
        params->flag = flag;
        params->display = display;
        params->filter = filter;
+       params->sort = sort;
  
        BLI_strncpy(params->title, title, sizeof(params->title));
        
        BLI_strncpy(name, path, sizeof(name));
        BLI_convertstringcode(name, G.sce);
-       
-       switch(type) {
-               case FILE_MAIN:
-                       break;
-               case FILE_LOADLIB:
-                       break;
-               case FILE_BLENDER:
-               case FILE_LOADFONT:
-               default:
-                       {
-                               BLI_split_dirfile(name, dir, file);
-                               BLI_strncpy(params->file, file, sizeof(params->file));
-                               BLI_strncpy(params->dir, dir, sizeof(params->dir));
-                               BLI_make_file_string(G.sce, params->dir, dir, ""); /* XXX needed ? - also solve G.sce */                        
-                       }
-                       break;
-       }
+       BLI_split_dirfile(name, dir, file);
+       BLI_strncpy(params->file, file, sizeof(params->file));
+       BLI_strncpy(params->dir, dir, sizeof(params->dir));
+       BLI_make_file_string(G.sce, params->dir, dir, ""); /* XXX needed ? - also solve G.sce */                        
  
        return 1;
  }
  
  void ED_fileselect_reset_params(SpaceFile *sfile)
  {
-       sfile->params->type = FILE_UNIX;
        sfile->params->flag = 0;
        sfile->params->title[0] = '\0';
  }
@@@ -144,9 -131,6 +131,9 @@@ int ED_fileselect_layout_offset(FileLay
        int offsetx, offsety;
        int active_file;
  
 +      if (layout == NULL)
 +              return NULL;
 +      
        offsetx = (x)/(layout->tile_w + 2*layout->tile_border_x);
        offsety = (y)/(layout->tile_h + 2*layout->tile_border_y);
        
index 3b3fd5109cfc4e068aeb8fb047d76e597c74daf9,6e33b1dcaabdef06ca1df958d9303841ae5abd02..eaff77aabe92511d7da1de517bbe43812563e1fb
@@@ -393,7 -393,9 +393,8 @@@ static void view3d_main_area_listener(A
                                case ND_GEOM_DATA:
                                case ND_DRAW:
                                case ND_MODIFIER:
 -                              case ND_CONSTRAINT:
                                case ND_KEYS:
+                               case ND_PARTICLE:
                                        ED_region_tag_redraw(ar);
                                        break;
                        }
index ba4ef1f164a6deb49efd20d6905f70554b34a75a,b2c5121c1eda9d46ff7101c23316f0cb37f64473..0a342634753db4bb46989d87163129e6bb3cb9c5
@@@ -121,7 -121,7 +121,7 @@@ typedef struct SpaceButs 
        struct RenderInfo *ri;
  
        short cursens, curact;
-       short align, tabo;              /* align for panels, tab is old tab */
+       short align, pad;               /* align for panels */
        View2D v2d; /* depricated, copied to region */
        
        short mainb, menunr;    /* texnr and menunr have to remain shorts */
        short oldkeypress;              /* for keeping track of the sub tab key cycling */
        char flag, texact;
        
-       char tab[8];    /* storing tabs for each context */
-               
+       void *path;             /* runtime */
+       ID *pinid;
  } SpaceButs;
  
  typedef struct SpaceSeq {
@@@ -244,11 -244,10 +244,11 @@@ typedef struct SpaceNla 
  
        short blockhandler[8];
  
 -      short menunr, lock;
        short autosnap;                 /* this uses the same settings as autosnap for Action Editor */
        short flag;
 +      int pad;
        
 +      struct bDopeSheet *ads;
        View2D v2d;      /* depricated, copied to region */
  } SpaceNla;
  
@@@ -464,6 -463,22 +464,22 @@@ typedef struct SpaceImaSel 
  #define TAB_SCENE_SOUND               3
  #define TAB_SCENE_SEQUENCER   4
  
+ /* warning: the values of these defines are used in sbuts->tabs[8] */
+ /* buts->mainb new */
+ #define BCONTEXT_SCENE                0
+ #define BCONTEXT_WORLD                1
+ #define BCONTEXT_OBJECT               2
+ #define BCONTEXT_DATA         3
+ #define BCONTEXT_MATERIAL     4
+ #define BCONTEXT_TEXTURE      5
+ #define BCONTEXT_PARTICLE     6
+ #define BCONTEXT_PHYSICS      7
+ #define BCONTEXT_GAME         8
+ #define BCONTEXT_BONE         9
+ #define BCONTEXT_MODIFIER     10
  /* sbuts->flag */
  #define SB_PRV_OSA                    1