Python/Depsgraph: bpy.data.*.is_updated now detects add/remove of any datablock.
authorTom Edwards <contact@steamreview.org>
Wed, 15 Jan 2014 15:37:03 +0000 (16:37 +0100)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Wed, 15 Jan 2014 15:47:53 +0000 (16:47 +0100)
Previously this only worked for some datablocks relevant to rendering, now it
can be used to detect if any type of datablock was added or removed (but not
yet to detect if it was modified, we need many more depsgraph tags for that).

Most of the changes are some function parameter changes, the important parts
are the DAG_id_type_tag calls.

Reviewed By: sergey, brecht

Differential Revision: https://developer.blender.org/D195

40 files changed:
source/blender/blenkernel/BKE_library.h
source/blender/blenkernel/intern/action.c
source/blender/blenkernel/intern/armature.c
source/blender/blenkernel/intern/blender.c
source/blender/blenkernel/intern/brush.c
source/blender/blenkernel/intern/camera.c
source/blender/blenkernel/intern/curve.c
source/blender/blenkernel/intern/font.c
source/blender/blenkernel/intern/gpencil.c
source/blender/blenkernel/intern/group.c
source/blender/blenkernel/intern/image.c
source/blender/blenkernel/intern/key.c
source/blender/blenkernel/intern/lamp.c
source/blender/blenkernel/intern/lattice.c
source/blender/blenkernel/intern/library.c
source/blender/blenkernel/intern/linestyle.c
source/blender/blenkernel/intern/mask.c
source/blender/blenkernel/intern/material.c
source/blender/blenkernel/intern/mball.c
source/blender/blenkernel/intern/mesh.c
source/blender/blenkernel/intern/movieclip.c
source/blender/blenkernel/intern/node.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/particle.c
source/blender/blenkernel/intern/scene.c
source/blender/blenkernel/intern/sound.c
source/blender/blenkernel/intern/speaker.c
source/blender/blenkernel/intern/text.c
source/blender/blenkernel/intern/texture.c
source/blender/blenkernel/intern/world.c
source/blender/blenloader/intern/readfile.c
source/blender/editors/object/object_add.c
source/blender/editors/object/object_shapekey.c
source/blender/editors/screen/screen_edit.c
source/blender/editors/space_node/node_group.c
source/blender/editors/space_text/text_ops.c
source/blender/makesrna/intern/rna_main_api.c
source/blender/windowmanager/intern/wm.c
source/blender/windowmanager/intern/wm_window.c
source/gameengine/Converter/BL_ShapeDeformer.cpp

index cb0ab239d44bdda36bad867529240fe571db5506..0a2ce0d3801164a0526e32d802ffd8178bd74420 100644 (file)
@@ -47,7 +47,7 @@ struct bContext;
 struct PointerRNA;
 struct PropertyRNA;
 
-void *BKE_libblock_alloc(struct ListBase *lb, short type, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
+void *BKE_libblock_alloc(struct Main *bmain, short type, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
 void *BKE_libblock_copy_ex(struct Main *bmain, struct ID *id) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
 void *BKE_libblock_copy(struct ID *id) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
 void  BKE_libblock_copy_data(struct ID *id, const struct ID *id_from, const bool do_action);
@@ -73,9 +73,9 @@ struct ListBase *which_libbase(struct Main *mainlib, short type);
 #define MAX_LIBARRAY    41
 int set_listbasepointers(struct Main *main, struct ListBase **lb);
 
-void BKE_libblock_free(struct ListBase *lb, void *idv);
-void BKE_libblock_free_ex(struct ListBase *lb, void *idv, bool do_id_user);
-void BKE_libblock_free_us(struct ListBase *lb, void *idv);
+void BKE_libblock_free(struct Main *bmain, void *idv);
+void BKE_libblock_free_ex(struct Main *bmain, void *idv, bool do_id_user);
+void BKE_libblock_free_us(struct Main *bmain, void *idv);
 void BKE_libblock_free_data(struct ID *id);
 
 
index 4991f1ce225d7088b988cbf4a27566a4ece9dc20..aea915b9ec45bae11a39519d1478a23a37e19680 100644 (file)
@@ -84,7 +84,7 @@ bAction *add_empty_action(Main *bmain, const char name[])
 {
        bAction *act;
        
-       act = BKE_libblock_alloc(&bmain->action, ID_AC, name);
+       act = BKE_libblock_alloc(bmain, ID_AC, name);
        
        return act;
 }      
index b0e720fc845cdb20ac95a89f2c3feebede93995f..829c0c7dd00ba778ff6ef7f094b20e680c3c46ee 100644 (file)
@@ -78,7 +78,7 @@ bArmature *BKE_armature_add(Main *bmain, const char *name)
 {
        bArmature *arm;
 
-       arm = BKE_libblock_alloc(&bmain->armature, ID_AR, name);
+       arm = BKE_libblock_alloc(bmain, ID_AR, name);
        arm->deformflag = ARM_DEF_VGROUP | ARM_DEF_ENVELOPE;
        arm->flag = ARM_COL_CUSTOM; /* custom bone-group colors */
        arm->layer = 1;
index 5b8eb13a5e7462da592bbe6d86431dfa543fe68f..2b87a7684d285abb526eb3256599c47022ac7270 100644 (file)
@@ -488,9 +488,9 @@ int BKE_read_file_from_memfile(bContext *C, MemFile *memfile, ReportList *report
        if (bfd) {
                /* remove the unused screens and wm */
                while (bfd->main->wm.first)
-                       BKE_libblock_free(&bfd->main->wm, bfd->main->wm.first);
+                       BKE_libblock_free_ex(bfd->main, bfd->main->wm.first, true);
                while (bfd->main->screen.first)
-                       BKE_libblock_free(&bfd->main->screen, bfd->main->screen.first);
+                       BKE_libblock_free_ex(bfd->main, bfd->main->screen.first, true);
                
                setup_app_data(C, bfd, "<memory1>");
        }
index f8fa549fcd9689f3cf43bc27659dbb3e40b1afd6..d6b48c72e89f2d9ac2a34009d4f2af013f8b2706 100644 (file)
@@ -135,7 +135,7 @@ Brush *BKE_brush_add(Main *bmain, const char *name)
 {
        Brush *brush;
 
-       brush = BKE_libblock_alloc(&bmain->brush, ID_BR, name);
+       brush = BKE_libblock_alloc(bmain, ID_BR, name);
 
        /* enable fake user by default */
        brush->id.flag |= LIB_FAKEUSER;
index 9dbada4d58fc263895533d2a5840a8b8b0c3306b..3290f0eae8e9c26ed8de5739bb3148972e9300d5 100644 (file)
@@ -54,7 +54,7 @@ void *BKE_camera_add(Main *bmain, const char *name)
 {
        Camera *cam;
        
-       cam =  BKE_libblock_alloc(&bmain->camera, ID_CA, name);
+       cam =  BKE_libblock_alloc(bmain, ID_CA, name);
 
        cam->lens = 35.0f;
        cam->sensor_x = DEFAULT_SENSOR_WIDTH;
index efb9788fd7970ceeaf83982e0067f3100653a092..c46cc83c21da29334f0f86ec2656be7b748bd93f 100644 (file)
@@ -165,7 +165,7 @@ Curve *BKE_curve_add(Main *bmain, const char *name, int type)
 {
        Curve *cu;
 
-       cu = BKE_libblock_alloc(&bmain->curve, ID_CU, name);
+       cu = BKE_libblock_alloc(bmain, ID_CU, name);
        copy_v3_fl(cu->size, 1.0f);
        cu->flag = CU_FRONT | CU_BACK | CU_DEFORM_BOUNDS_OFF | CU_PATH_RADIUS;
        cu->pathlen = 100;
index 36171c2630d4b924f95d6847439738692c1ec956..0b990d21e5f70af0c4e816fcdc6ceb080f0627f1 100644 (file)
@@ -232,7 +232,7 @@ VFont *BKE_vfont_load(Main *bmain, const char *name)
 
                vfd = BLI_vfontdata_from_freetypefont(pf);
                if (vfd) {
-                       vfont = BKE_libblock_alloc(&bmain->vfont, ID_VF, filename);
+                       vfont = BKE_libblock_alloc(bmain, ID_VF, filename);
                        vfont->data = vfd;
 
                        /* if there's a font name, use it for the ID name */
index 232ee335fbb2891e86fc1bfcdc4d3065885b24ec..9bace5e1ee3e0338e2ec83108d6ddda6ed0782a8 100644 (file)
@@ -204,7 +204,7 @@ bGPdata *gpencil_data_addnew(const char name[])
        bGPdata *gpd;
        
        /* allocate memory for a new block */
-       gpd = BKE_libblock_alloc(&G.main->gpencil, ID_GD, name);
+       gpd = BKE_libblock_alloc(G.main, ID_GD, name);
        
        /* initial settings */
        gpd->flag = (GP_DATA_DISPINFO | GP_DATA_EXPAND);
index 06e63e9b75450130a1c99d430861e988946ed518..82b6c0c04d584dd97308560adbecf5fc07470580 100644 (file)
@@ -138,7 +138,7 @@ Group *BKE_group_add(Main *bmain, const char *name)
 {
        Group *group;
        
-       group = BKE_libblock_alloc(&bmain->group, ID_GR, name);
+       group = BKE_libblock_alloc(bmain, ID_GR, name);
        group->layer = (1 << 20) - 1;
        return group;
 }
index 3ccc95635a39f3f5a3f692b615837e8e806d0321..db4a639d91c67bf6c9d7da9086a66baab30b68f6 100644 (file)
@@ -295,7 +295,7 @@ static Image *image_alloc(Main *bmain, const char *name, short source, short typ
 {
        Image *ima;
 
-       ima = BKE_libblock_alloc(&bmain->image, ID_IM, name);
+       ima = BKE_libblock_alloc(bmain, ID_IM, name);
        if (ima) {
                ima->ok = IMA_OK;
 
@@ -555,7 +555,7 @@ void BKE_image_merge(Image *dest, Image *source)
                }
                BLI_spin_unlock(&image_spin);
 
-               BKE_libblock_free(&G.main->image, source);
+               BKE_libblock_free(G.main, source);
        }
 }
 
index 7b73dee73fc4c802f106389edbc6789d834f8503..e01993d64d941a082dfb9e28d22823a6fad83492 100644 (file)
@@ -109,7 +109,7 @@ Key *BKE_key_add(ID *id)    /* common function */
        Key *key;
        char *el;
        
-       key = BKE_libblock_alloc(&G.main->key, ID_KE, "Key");
+       key = BKE_libblock_alloc(G.main, ID_KE, "Key");
        
        key->type = KEY_NORMAL;
        key->from = id;
index 904dbec24a4b1f8f210728707a422f94f3e3b66d..3cade886a04f70e5e7b85ef954f9ea188a57f724 100644 (file)
@@ -58,7 +58,7 @@ Lamp *BKE_lamp_add(Main *bmain, const char *name)
 {
        Lamp *la;
        
-       la =  BKE_libblock_alloc(&bmain->lamp, ID_LA, name);
+       la =  BKE_libblock_alloc(bmain, ID_LA, name);
        
        la->r = la->g = la->b = la->k = 1.0f;
        la->haint = la->energy = 1.0f;
index 8f7942f543ab5de2b399df42043a2fa641c8bdb7..525f9107a126fca862ad39631d96638f9f85045c 100644 (file)
@@ -249,7 +249,7 @@ Lattice *BKE_lattice_add(Main *bmain, const char *name)
 {
        Lattice *lt;
        
-       lt = BKE_libblock_alloc(&bmain->latt, ID_LT, name);
+       lt = BKE_libblock_alloc(bmain, ID_LT, name);
        
        lt->flag = LT_GRID;
        
index f2264190a5c99a004db5c38e289120f780a2f718..ac5c387efcac9b79d23cf4eda3482d5b5fb9b40d 100644 (file)
@@ -393,9 +393,9 @@ bool id_copy(ID *id, ID **newid, bool test)
 bool id_unlink(ID *id, int test)
 {
        Main *mainlib = G.main;
-       ListBase *lb;
+       short type = GS(id->name);
 
-       switch (GS(id->name)) {
+       switch (type) {
                case ID_TXT:
                        if (test) return true;
                        BKE_text_unlink(mainlib, (Text *)id);
@@ -413,8 +413,7 @@ bool id_unlink(ID *id, int test)
        if (id->us == 0) {
                if (test) return true;
 
-               lb = which_libbase(mainlib, GS(id->name));
-               BKE_libblock_free(lb, id);
+               BKE_libblock_free(mainlib, id);
 
                return true;
        }
@@ -743,9 +742,10 @@ static ID *alloc_libblock_notest(short type)
  * The user count is set to 1, all other content (apart from name and links) being
  * initialized to zero.
  */
-void *BKE_libblock_alloc(ListBase *lb, short type, const char *name)
+void *BKE_libblock_alloc(Main *bmain, short type, const char *name)
 {
        ID *id = NULL;
+       ListBase *lb = which_libbase(bmain, type);
        
        id = alloc_libblock_notest(type);
        if (id) {
@@ -756,6 +756,7 @@ void *BKE_libblock_alloc(ListBase *lb, short type, const char *name)
                new_id(lb, id, name);
                /* alphabetic insertion: is in new_id */
        }
+       DAG_id_type_tag(bmain, type);
        return id;
 }
 
@@ -789,7 +790,7 @@ void *BKE_libblock_copy_ex(Main *bmain, ID *id)
        size_t idn_len;
 
        lb = which_libbase(bmain, GS(id->name));
-       idn = BKE_libblock_alloc(lb, GS(id->name), id->name + 2);
+       idn = BKE_libblock_alloc(bmain, GS(id->name), id->name + 2);
 
        assert(idn != NULL);
 
@@ -872,16 +873,19 @@ void BKE_libblock_free_data(ID *id)
 }
 
 /* used in headerbuttons.c image.c mesh.c screen.c sound.c and library.c */
-void BKE_libblock_free_ex(ListBase *lb, void *idv, bool do_id_user)
+void BKE_libblock_free_ex(Main *bmain, void *idv, bool do_id_user)
 {
-       Main *bmain = G.main;  /* should eventually be an arg */
        ID *id = idv;
+       short type = GS(id->name);
+       ListBase *lb = which_libbase(bmain, type);
+
+       DAG_id_type_tag(bmain, type);
 
 #ifdef WITH_PYTHON
        BPY_id_release(id);
 #endif
 
-       switch (GS(id->name) ) {    /* GetShort from util.h */
+       switch (type) {    /* GetShort from util.h */
                case ID_SCE:
                        BKE_scene_free((Scene *)id);
                        break;
@@ -992,12 +996,12 @@ void BKE_libblock_free_ex(ListBase *lb, void *idv, bool do_id_user)
        MEM_freeN(id);
 }
 
-void BKE_libblock_free(ListBase *lb, void *idv)
+void BKE_libblock_free(Main *bmain, void *idv)
 {
-       BKE_libblock_free_ex(lb, idv, true);
+       BKE_libblock_free_ex(bmain, idv, true);
 }
 
-void BKE_libblock_free_us(ListBase *lb, void *idv)      /* test users */
+void BKE_libblock_free_us(Main *bmain, void *idv)      /* test users */
 {
        ID *id = idv;
        
@@ -1010,7 +1014,7 @@ void BKE_libblock_free_us(ListBase *lb, void *idv)      /* test users */
        if (id->us == 0) {
                if (GS(id->name) == ID_OB) BKE_object_unlink((Object *)id);
                
-               BKE_libblock_free(lb, id);
+               BKE_libblock_free(bmain, id);
        }
 }
 
@@ -1034,44 +1038,44 @@ void BKE_main_free(Main *mainvar)
                
                while ( (id = lb->first) ) {
 #if 1
-                       BKE_libblock_free_ex(lb, id, false);
+                       BKE_libblock_free_ex(mainvar, id, false);
 #else
                        /* errors freeing ID's can be hard to track down,
                         * enable this so valgrind will give the line number in its error log */
                        switch (a) {
-                               case   0: BKE_libblock_free_ex(lb, id, false); break;
-                               case   1: BKE_libblock_free_ex(lb, id, false); break;
-                               case   2: BKE_libblock_free_ex(lb, id, false); break;
-                               case   3: BKE_libblock_free_ex(lb, id, false); break;
-                               case   4: BKE_libblock_free_ex(lb, id, false); break;
-                               case   5: BKE_libblock_free_ex(lb, id, false); break;
-                               case   6: BKE_libblock_free_ex(lb, id, false); break;
-                               case   7: BKE_libblock_free_ex(lb, id, false); break;
-                               case   8: BKE_libblock_free_ex(lb, id, false); break;
-                               case   9: BKE_libblock_free_ex(lb, id, false); break;
-                               case  10: BKE_libblock_free_ex(lb, id, false); break;
-                               case  11: BKE_libblock_free_ex(lb, id, false); break;
-                               case  12: BKE_libblock_free_ex(lb, id, false); break;
-                               case  13: BKE_libblock_free_ex(lb, id, false); break;
-                               case  14: BKE_libblock_free_ex(lb, id, false); break;
-                               case  15: BKE_libblock_free_ex(lb, id, false); break;
-                               case  16: BKE_libblock_free_ex(lb, id, false); break;
-                               case  17: BKE_libblock_free_ex(lb, id, false); break;
-                               case  18: BKE_libblock_free_ex(lb, id, false); break;
-                               case  19: BKE_libblock_free_ex(lb, id, false); break;
-                               case  20: BKE_libblock_free_ex(lb, id, false); break;
-                               case  21: BKE_libblock_free_ex(lb, id, false); break;
-                               case  22: BKE_libblock_free_ex(lb, id, false); break;
-                               case  23: BKE_libblock_free_ex(lb, id, false); break;
-                               case  24: BKE_libblock_free_ex(lb, id, false); break;
-                               case  25: BKE_libblock_free_ex(lb, id, false); break;
-                               case  26: BKE_libblock_free_ex(lb, id, false); break;
-                               case  27: BKE_libblock_free_ex(lb, id, false); break;
-                               case  28: BKE_libblock_free_ex(lb, id, false); break;
-                               case  29: BKE_libblock_free_ex(lb, id, false); break;
-                               case  30: BKE_libblock_free_ex(lb, id, false); break;
-                               case  31: BKE_libblock_free_ex(lb, id, false); break;
-                               case  32: BKE_libblock_free_ex(lb, id, false); break;
+                               case   0: BKE_libblock_free_ex(mainvar, id, false); break;
+                               case   1: BKE_libblock_free_ex(mainvar, id, false); break;
+                               case   2: BKE_libblock_free_ex(mainvar, id, false); break;
+                               case   3: BKE_libblock_free_ex(mainvar, id, false); break;
+                               case   4: BKE_libblock_free_ex(mainvar, id, false); break;
+                               case   5: BKE_libblock_free_ex(mainvar, id, false); break;
+                               case   6: BKE_libblock_free_ex(mainvar, id, false); break;
+                               case   7: BKE_libblock_free_ex(mainvar, id, false); break;
+                               case   8: BKE_libblock_free_ex(mainvar, id, false); break;
+                               case   9: BKE_libblock_free_ex(mainvar, id, false); break;
+                               case  10: BKE_libblock_free_ex(mainvar, id, false); break;
+                               case  11: BKE_libblock_free_ex(mainvar, id, false); break;
+                               case  12: BKE_libblock_free_ex(mainvar, id, false); break;
+                               case  13: BKE_libblock_free_ex(mainvar, id, false); break;
+                               case  14: BKE_libblock_free_ex(mainvar, id, false); break;
+                               case  15: BKE_libblock_free_ex(mainvar, id, false); break;
+                               case  16: BKE_libblock_free_ex(mainvar, id, false); break;
+                               case  17: BKE_libblock_free_ex(mainvar, id, false); break;
+                               case  18: BKE_libblock_free_ex(mainvar, id, false); break;
+                               case  19: BKE_libblock_free_ex(mainvar, id, false); break;
+                               case  20: BKE_libblock_free_ex(mainvar, id, false); break;
+                               case  21: BKE_libblock_free_ex(mainvar, id, false); break;
+                               case  22: BKE_libblock_free_ex(mainvar, id, false); break;
+                               case  23: BKE_libblock_free_ex(mainvar, id, false); break;
+                               case  24: BKE_libblock_free_ex(mainvar, id, false); break;
+                               case  25: BKE_libblock_free_ex(mainvar, id, false); break;
+                               case  26: BKE_libblock_free_ex(mainvar, id, false); break;
+                               case  27: BKE_libblock_free_ex(mainvar, id, false); break;
+                               case  28: BKE_libblock_free_ex(mainvar, id, false); break;
+                               case  29: BKE_libblock_free_ex(mainvar, id, false); break;
+                               case  30: BKE_libblock_free_ex(mainvar, id, false); break;
+                               case  31: BKE_libblock_free_ex(mainvar, id, false); break;
+                               case  32: BKE_libblock_free_ex(mainvar, id, false); break;
                                default:
                                        BLI_assert(0);
                                        break;
index d3c9250694ccdbd7b3d3c91babdd739a21998b1c..71c917d4528549e85803751a2c14d44bb76857c5 100644 (file)
@@ -107,7 +107,7 @@ FreestyleLineStyle *BKE_new_linestyle(const char *name, struct Main *main)
        if (!main)
                main = G.main;
 
-       linestyle = (FreestyleLineStyle *)BKE_libblock_alloc(&main->linestyle, ID_LS, name);
+       linestyle = (FreestyleLineStyle *)BKE_libblock_alloc(main, ID_LS, name);
 
        default_linestyle_settings(linestyle);
 
index 66edda76634e4b80f04c41127a270bb30158c1f3..2b81034f1a015b8111b8dd93eb249603e84c3721 100644 (file)
@@ -701,7 +701,7 @@ static Mask *mask_alloc(Main *bmain, const char *name)
 {
        Mask *mask;
 
-       mask = BKE_libblock_alloc(&bmain->mask, ID_MSK, name);
+       mask = BKE_libblock_alloc(bmain, ID_MSK, name);
 
        mask->id.flag |= LIB_FAKEUSER;
 
index 9df523a5bfe22eea9022b188bfdbe765221f7582..0c1bf476908fa33c36eebc78de964f73190bb1d8 100644 (file)
@@ -211,7 +211,7 @@ Material *BKE_material_add(Main *bmain, const char *name)
 {
        Material *ma;
 
-       ma = BKE_libblock_alloc(&bmain->mat, ID_MA, name);
+       ma = BKE_libblock_alloc(bmain, ID_MA, name);
        
        init_material(ma);
        
index 40a12bd7e6c4090e66162097b74a2df5b0809888..0197415d1dd98bd8e3a28c31c69045a0c9405b7f 100644 (file)
@@ -209,7 +209,7 @@ MetaBall *BKE_mball_add(Main *bmain, const char *name)
 {
        MetaBall *mb;
        
-       mb = BKE_libblock_alloc(&bmain->mball, ID_MB, name);
+       mb = BKE_libblock_alloc(bmain, ID_MB, name);
        
        mb->size[0] = mb->size[1] = mb->size[2] = 1.0;
        mb->texflag = MB_AUTOSPACE;
index 14218c43fb69a1606e9217f05bea05d985a62320..e8504a369e7e9b920c1aee0a83ffe4643ec63998 100644 (file)
@@ -444,7 +444,7 @@ Mesh *BKE_mesh_add(Main *bmain, const char *name)
 {
        Mesh *me;
        
-       me = BKE_libblock_alloc(&bmain->mesh, ID_ME, name);
+       me = BKE_libblock_alloc(bmain, ID_ME, name);
        
        me->size[0] = me->size[1] = me->size[2] = 1.0;
        me->smoothresh = 30;
@@ -1456,7 +1456,7 @@ void BKE_mesh_from_nurbs_displist(Object *ob, ListBase *dispbase, const bool use
        cu->totcol = 0;
 
        if (ob->data) {
-               BKE_libblock_free(&bmain->curve, ob->data);
+               BKE_libblock_free(bmain, ob->data);
        }
        ob->data = me;
        ob->type = OB_MESH;
index fb489bffa66d5aae1c23fb0ca80d2824b1e22a4f..63d8119f3f03a5544b5747564cebe7849641c9d6 100644 (file)
@@ -553,7 +553,7 @@ static MovieClip *movieclip_alloc(Main *bmain, const char *name)
 {
        MovieClip *clip;
 
-       clip = BKE_libblock_alloc(&bmain->movieclip, ID_MC, name);
+       clip = BKE_libblock_alloc(bmain, ID_MC, name);
 
        clip->aspx = clip->aspy = 1.0f;
 
index 72544cba6bf3ff7e97ddc5bbf1167a7bf9dae96b..4a4140942c8dd58f36c72674cdacc8da7cf386e2 100644 (file)
@@ -1078,7 +1078,7 @@ bNodeTree *ntreeAddTree(Main *bmain, const char *name, const char *idname)
         * node groups and other tree types are created as library data.
         */
        if (bmain) {
-               ntree = BKE_libblock_alloc(&bmain->nodetree, ID_NT, name);
+               ntree = BKE_libblock_alloc(bmain, ID_NT, name);
        }
        else {
                ntree = MEM_callocN(sizeof(bNodeTree), "new node tree");
index 149ef6b0d56394a88971d74cf128a0631f196af7..e98382aa326278e539c87b46aeb2450d2fc6301f 100644 (file)
@@ -945,7 +945,7 @@ Object *BKE_object_add_only_object(Main *bmain, int type, const char *name)
        if (!name)
                name = get_obdata_defname(type);
 
-       ob = BKE_libblock_alloc(&bmain->object, ID_OB, name);
+       ob = BKE_libblock_alloc(bmain, ID_OB, name);
 
        /* default object vars */
        ob->type = type;
index b5825dab7c0ffdf4bd0011f2d0fefe328fc193d1..8e256f05f71965ba6abf03bc41b6f7c914d2b482 100644 (file)
@@ -3664,7 +3664,7 @@ ParticleSettings *psys_new_settings(const char *name, Main *main)
        if (main == NULL)
                main = G.main;
 
-       part = BKE_libblock_alloc(&main->particle, ID_PA, name);
+       part = BKE_libblock_alloc(main, ID_PA, name);
        
        default_particle_settings(part);
 
index 984a99915daa7bda1f284817f3455c1af0e2c8b0..c6a2dfb4482d65e5be7abade4dea439ab5ca3585 100644 (file)
@@ -419,7 +419,7 @@ Scene *BKE_scene_add(Main *bmain, const char *name)
        int a;
        const char *colorspace_name;
 
-       sce = BKE_libblock_alloc(&bmain->scene, ID_SCE, name);
+       sce = BKE_libblock_alloc(bmain, ID_SCE, name);
        sce->lay = sce->layact = 1;
        
        sce->r.mode = R_GAMMA | R_OSA | R_SHADOW | R_SSS | R_ENVMAP | R_RAYTRACE;
@@ -733,7 +733,7 @@ void BKE_scene_unlink(Main *bmain, Scene *sce, Scene *newsce)
                if (sc->scene == sce)
                        sc->scene = newsce;
 
-       BKE_libblock_free(&bmain->scene, sce);
+       BKE_libblock_free(bmain, sce);
 }
 
 /* used by metaballs
index 3910ef5cb69ff8b587a1d85330ba0b4c8373599e..3a8754e8dd24fdbde599567df43f1ed254a4a5dd 100644 (file)
@@ -84,14 +84,14 @@ bSound *sound_new_file(struct Main *bmain, const char *filename)
        while (len > 0 && filename[len - 1] != '/' && filename[len - 1] != '\\')
                len--;
 
-       sound = BKE_libblock_alloc(&bmain->sound, ID_SO, filename + len);
+       sound = BKE_libblock_alloc(bmain, ID_SO, filename + len);
        BLI_strncpy(sound->name, filename, FILE_MAX);
 // XXX unused currently        sound->type = SOUND_TYPE_FILE;
 
        sound_load(bmain, sound);
 
        if (!sound->playback_handle) {
-               BKE_libblock_free(&bmain->sound, sound);
+               BKE_libblock_free(bmain, sound);
                sound = NULL;
        }
 
@@ -233,7 +233,7 @@ bSound *sound_new_buffer(struct Main *bmain, bSound *source)
        strcpy(name, "buf_");
        strcpy(name + 4, source->id.name);
 
-       sound = BKE_libblock_alloc(&bmain->sound, ID_SO, name);
+       sound = BKE_libblock_alloc(bmain, ID_SO, name);
 
        sound->child_sound = source;
        sound->type = SOUND_TYPE_BUFFER;
@@ -242,7 +242,7 @@ bSound *sound_new_buffer(struct Main *bmain, bSound *source)
 
        if (!sound->playback_handle)
        {
-               BKE_libblock_free(&bmain->sound, sound);
+               BKE_libblock_free(bmain, sound);
                sound = NULL;
        }
 
@@ -257,7 +257,7 @@ bSound *sound_new_limiter(struct Main *bmain, bSound *source, float start, float
        strcpy(name, "lim_");
        strcpy(name + 4, source->id.name);
 
-       sound = BKE_libblock_alloc(&bmain->sound, ID_SO, name);
+       sound = BKE_libblock_alloc(bmain, ID_SO, name);
 
        sound->child_sound = source;
        sound->start = start;
@@ -268,7 +268,7 @@ bSound *sound_new_limiter(struct Main *bmain, bSound *source, float start, float
 
        if (!sound->playback_handle)
        {
-               BKE_libblock_free(&bmain->sound, sound);
+               BKE_libblock_free(bmain, sound);
                sound = NULL;
        }
 
@@ -281,7 +281,7 @@ void sound_delete(struct Main *bmain, bSound *sound)
        if (sound) {
                BKE_sound_free(sound);
 
-               BKE_libblock_free(&bmain->sound, sound);
+               BKE_libblock_free(bmain, sound);
        }
 }
 
index 3ed45c06b216e880eabb9496884f1dbe278e7d3e..332eef17ae7b5edc6999b183411cd4b6190a6858 100644 (file)
@@ -41,7 +41,7 @@ void *BKE_speaker_add(Main *bmain, const char *name)
 {
        Speaker *spk;
 
-       spk =  BKE_libblock_alloc(&bmain->speaker, ID_SPK, name);
+       spk =  BKE_libblock_alloc(bmain, ID_SPK, name);
 
        spk->attenuation = 1.0f;
        spk->cone_angle_inner = 360.0f;
index b2c10ca78ae116916d377320bf1885adafaa04d4..79ac2df1e88c049764b1f328616d0a155b833aba 100644 (file)
@@ -176,7 +176,7 @@ Text *BKE_text_add(Main *bmain, const char *name)
        Text *ta;
        TextLine *tmp;
        
-       ta = BKE_libblock_alloc(&bmain->text, ID_TXT, name);
+       ta = BKE_libblock_alloc(bmain, ID_TXT, name);
        ta->id.us = 1;
        
        ta->name = NULL;
@@ -379,7 +379,7 @@ Text *BKE_text_load_ex(Main *bmain, const char *file, const char *relpath, const
        fp = BLI_fopen(str, "r");
        if (fp == NULL) return NULL;
        
-       ta = BKE_libblock_alloc(&bmain->text, ID_TXT, BLI_path_basename(str));
+       ta = BKE_libblock_alloc(bmain, ID_TXT, BLI_path_basename(str));
        ta->id.us = 1;
 
        ta->lines.first = ta->lines.last = NULL;
index 542069d9b878e0c8774286772a01b44ee3c69c3f..a3ae6017706eed4474eeb7628cb9ae279a96d5dd 100644 (file)
@@ -582,7 +582,7 @@ Tex *add_texture(Main *bmain, const char *name)
 {
        Tex *tex;
 
-       tex = BKE_libblock_alloc(&bmain->tex, ID_TE, name);
+       tex = BKE_libblock_alloc(bmain, ID_TE, name);
        
        default_tex(tex);
        
index c5a932e4173ef82fbabd5274e3636f2e3c1580bd..a6c30ce0d3a47201fa96d64b41753987a2f41129 100644 (file)
@@ -83,7 +83,7 @@ World *add_world(Main *bmain, const char *name)
 {
        World *wrld;
 
-       wrld = BKE_libblock_alloc(&bmain->world, ID_WO, name);
+       wrld = BKE_libblock_alloc(bmain, ID_WO, name);
        
        wrld->horr = 0.05f;
        wrld->horg = 0.05f;
index 587b1e29c602342a77a74f2a3eb661ee39fd3e74..a63d70257083fcd7189add34796970b8a1ff4fb4 100644 (file)
@@ -549,7 +549,7 @@ static Main *blo_find_main(FileData *fd, const char *filepath, const char *relab
        m = BKE_main_new();
        BLI_addtail(mainlist, m);
        
-       lib = BKE_libblock_alloc(&m->library, ID_LI, "lib");
+       lib = BKE_libblock_alloc(m, ID_LI, "lib");
        BLI_strncpy(lib->name, filepath, sizeof(lib->name));
        BLI_strncpy(lib->filepath, name1, sizeof(lib->filepath));
        
@@ -7302,7 +7302,7 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, int flag, ID
        oldnewmap_clear(fd->datamap);
        
        if (wrong_id) {
-               BKE_libblock_free(lb, id);
+               BKE_libblock_free(main, id);
        }
        
        return (bhead);
index c2fbd09281c7d24b28097a56f252e8c049e20d02..c6dcc0b6723563167b830409d2ca528ba5a42b28 100644 (file)
@@ -1047,7 +1047,7 @@ void ED_base_object_free_and_unlink(Main *bmain, Scene *scene, Base *base)
        DAG_id_type_tag(bmain, ID_OB);
        BKE_scene_base_unlink(scene, base);
        object_delete_check_glsl_update(base->object);
-       BKE_libblock_free_us(&bmain->object, base->object);
+       BKE_libblock_free_us(bmain, base->object);
        if (scene->basact == base) scene->basact = NULL;
        MEM_freeN(base);
 }
index 5d10d67f0c972a412f7d00e4459eb264e419f6d6..57cd464b7ad88129f0c3ef5da201c89353c541db 100644 (file)
@@ -103,7 +103,7 @@ static bool ED_object_shape_key_remove_all(Main *bmain, Object *ob)
                case ID_LT: ((Lattice *)key->from)->key = NULL; break;
        }
 
-       BKE_libblock_free_us(&(bmain->key), key);
+       BKE_libblock_free_us(bmain, key);
 
        return true;
 }
@@ -161,7 +161,7 @@ static bool ED_object_shape_key_remove(Main *bmain, Object *ob)
                        case ID_LT: ((Lattice *)key->from)->key = NULL; break;
                }
 
-               BKE_libblock_free_us(&(bmain->key), key);
+               BKE_libblock_free_us(bmain, key);
        }
 
        return true;
index abf049ffc831e533a8b3ec2015cbce5c339fab8c..c10cb3313dec681af232d1c24d357b328b12d611 100644 (file)
@@ -466,7 +466,7 @@ bScreen *ED_screen_add(wmWindow *win, Scene *scene, const char *name)
        bScreen *sc;
        ScrVert *sv1, *sv2, *sv3, *sv4;
        
-       sc = BKE_libblock_alloc(&G.main->screen, ID_SCR, name);
+       sc = BKE_libblock_alloc(G.main, ID_SCR, name);
        sc->scene = scene;
        sc->do_refresh = TRUE;
        sc->redraws_flag = TIME_ALL_3D_WIN | TIME_ALL_ANIM_WIN;
@@ -1596,7 +1596,7 @@ void ED_screen_delete(bContext *C, bScreen *sc)
        ED_screen_set(C, newsc);
 
        if (delete && win->screen != sc)
-               BKE_libblock_free(&bmain->screen, sc);
+               BKE_libblock_free(bmain, sc);
 }
 
 static void ed_screen_set_3dview_camera(Scene *scene, bScreen *sc, ScrArea *sa, View3D *v3d)
@@ -1834,7 +1834,7 @@ ScrArea *ED_screen_full_toggle(bContext *C, wmWindow *win, ScrArea *sa)
                ED_screen_set(C, sc);
 
                BKE_screen_free(oldscreen);
-               BKE_libblock_free(&CTX_data_main(C)->screen, oldscreen);
+               BKE_libblock_free(CTX_data_main(C), oldscreen);
 
        }
        else {
index 62732de0ab3213527ea2ee96944ec6420c7f0fbc..1ecedf324999b67d1184d23b66ee73f7579c5f1d 100644 (file)
@@ -275,12 +275,12 @@ static int node_group_ungroup(bNodeTree *ntree, bNode *gnode)
                
                /* free temp action too */
                if (waction) {
-                       BKE_libblock_free(&G.main->action, waction);
+                       BKE_libblock_free(G.main, waction);
                }
        }
        
        /* free the group tree (takes care of user count) */
-       BKE_libblock_free(&G.main->nodetree, wgroup);
+       BKE_libblock_free(G.main, wgroup);
        
        /* restore external links to and from the gnode */
        /* note: the nodes have been copied to intermediate wgroup first (so need to use new_node),
index cd4c214e0d6e4139e8ba8007cd34ccfec00e0965..8ba701c8138ca6df1e5ab4a6ce9f8e8ea0d35ce1 100644 (file)
@@ -385,7 +385,7 @@ static int text_unlink_exec(bContext *C, wmOperator *UNUSED(op))
        }
 
        BKE_text_unlink(bmain, text);
-       BKE_libblock_free(&bmain->text, text);
+       BKE_libblock_free(bmain, text);
 
        text_drawcache_tag_update(st, 1);
        WM_event_add_notifier(C, NC_TEXT | NA_REMOVED, NULL);
index f2418bf07087d79456ea3354e9632ed83ddeccbc..98cf419246a668e820d767f20ac0b3c4b16e34cb 100644 (file)
@@ -114,7 +114,7 @@ static void rna_Main_cameras_remove(Main *bmain, ReportList *reports, PointerRNA
 {
        Camera *camera = camera_ptr->data;
        if (ID_REAL_USERS(camera) <= 0) {
-               BKE_libblock_free(&bmain->camera, camera);
+               BKE_libblock_free(bmain, camera);
                RNA_POINTER_INVALIDATE(camera_ptr);
        }
        else {
@@ -208,7 +208,7 @@ static void rna_Main_objects_remove(Main *bmain, ReportList *reports, PointerRNA
        Object *object = object_ptr->data;
        if (ID_REAL_USERS(object) <= 0) {
                BKE_object_unlink(object); /* needed or ID pointers to this are not cleared */
-               BKE_libblock_free(&bmain->object, object);
+               BKE_libblock_free(bmain, object);
                RNA_POINTER_INVALIDATE(object_ptr);
        }
        else {
@@ -227,7 +227,7 @@ static void rna_Main_materials_remove(Main *bmain, ReportList *reports, PointerR
 {
        Material *material = material_ptr->data;
        if (ID_REAL_USERS(material) <= 0) {
-               BKE_libblock_free(&bmain->mat, material);
+               BKE_libblock_free(bmain, material);
                RNA_POINTER_INVALIDATE(material_ptr);
        }
        else {
@@ -256,7 +256,7 @@ static void rna_Main_nodetree_remove(Main *bmain, ReportList *reports, PointerRN
 {
        bNodeTree *ntree = ntree_ptr->data;
        if (ID_REAL_USERS(ntree) <= 0) {
-               BKE_libblock_free(&bmain->nodetree, ntree);
+               BKE_libblock_free(bmain, ntree);
                RNA_POINTER_INVALIDATE(ntree_ptr);
        }
        else {
@@ -332,13 +332,13 @@ Mesh *rna_Main_meshes_new_from_object(
                         * if it didn't the curve did not have any segments or otherwise 
                         * would have generated an empty mesh */
                        if (tmpobj->type != OB_MESH) {
-                               BKE_libblock_free_us(&(G.main->object), tmpobj);
+                               BKE_libblock_free_us(G.main, tmpobj);
                                return NULL;
                        }
 
                        BKE_mesh_texspace_copy_from_object(tmpmesh, ob);
 
-                       BKE_libblock_free_us(&bmain->object, tmpobj);
+                       BKE_libblock_free_us(bmain, tmpobj);
                        break;
                }
 
@@ -493,7 +493,7 @@ static void rna_Main_meshes_remove(Main *bmain, ReportList *reports, PointerRNA
 {
        Mesh *mesh = mesh_ptr->data;
        if (ID_REAL_USERS(mesh) <= 0) {
-               BKE_libblock_free(&bmain->mesh, mesh);
+               BKE_libblock_free(bmain, mesh);
                RNA_POINTER_INVALIDATE(mesh_ptr);
        }
        else {
@@ -513,7 +513,7 @@ static void rna_Main_lamps_remove(Main *bmain, ReportList *reports, PointerRNA *
 {
        Lamp *lamp = lamp_ptr->data;
        if (ID_REAL_USERS(lamp) <= 0) {
-               BKE_libblock_free(&bmain->lamp, lamp);
+               BKE_libblock_free(bmain, lamp);
                RNA_POINTER_INVALIDATE(lamp_ptr);
        }
        else {
@@ -547,7 +547,7 @@ static void rna_Main_images_remove(Main *bmain, ReportList *reports, PointerRNA
 {
        Image *image = image_ptr->data;
        if (ID_REAL_USERS(image) <= 0) {
-               BKE_libblock_free(&bmain->image, image);
+               BKE_libblock_free(bmain, image);
                RNA_POINTER_INVALIDATE(image_ptr);
        }
        else {
@@ -566,7 +566,7 @@ static void rna_Main_lattices_remove(Main *bmain, ReportList *reports, PointerRN
 {
        Lattice *lt = lt_ptr->data;
        if (ID_REAL_USERS(lt) <= 0) {
-               BKE_libblock_free(&bmain->latt, lt);
+               BKE_libblock_free(bmain, lt);
                RNA_POINTER_INVALIDATE(lt_ptr);
        }
        else {
@@ -585,7 +585,7 @@ static void rna_Main_curves_remove(Main *bmain, ReportList *reports, PointerRNA
 {
        Curve *cu = cu_ptr->data;
        if (ID_REAL_USERS(cu) <= 0) {
-               BKE_libblock_free(&bmain->curve, cu);
+               BKE_libblock_free(bmain, cu);
                RNA_POINTER_INVALIDATE(cu_ptr);
        }
        else {
@@ -604,7 +604,7 @@ static void rna_Main_metaballs_remove(Main *bmain, ReportList *reports, PointerR
 {
        MetaBall *mb = mb_ptr->data;
        if (ID_REAL_USERS(mb) <= 0) {
-               BKE_libblock_free(&bmain->mball, mb);
+               BKE_libblock_free(bmain, mb);
                RNA_POINTER_INVALIDATE(mb_ptr);
        }
        else {
@@ -631,7 +631,7 @@ static void rna_Main_fonts_remove(Main *bmain, ReportList *reports, PointerRNA *
 {
        VFont *vfont = vfont_ptr->data;
        if (ID_REAL_USERS(vfont) <= 0) {
-               BKE_libblock_free(&bmain->vfont, vfont);
+               BKE_libblock_free(bmain, vfont);
                RNA_POINTER_INVALIDATE(vfont_ptr);
        }
        else {
@@ -651,7 +651,7 @@ static void rna_Main_textures_remove(Main *bmain, ReportList *reports, PointerRN
 {
        Tex *tex = tex_ptr->data;
        if (ID_REAL_USERS(tex) <= 0) {
-               BKE_libblock_free(&bmain->tex, tex);
+               BKE_libblock_free(bmain, tex);
                RNA_POINTER_INVALIDATE(tex_ptr);
        }
        else {
@@ -670,7 +670,7 @@ static void rna_Main_brushes_remove(Main *bmain, ReportList *reports, PointerRNA
 {
        Brush *brush = brush_ptr->data;
        if (ID_REAL_USERS(brush) <= 0) {
-               BKE_libblock_free(&bmain->brush, brush);
+               BKE_libblock_free(bmain, brush);
                RNA_POINTER_INVALIDATE(brush_ptr);
        }
        else {
@@ -689,7 +689,7 @@ static void rna_Main_worlds_remove(Main *bmain, ReportList *reports, PointerRNA
 {
        Group *world = world_ptr->data;
        if (ID_REAL_USERS(world) <= 0) {
-               BKE_libblock_free(&bmain->world, world);
+               BKE_libblock_free(bmain, world);
                RNA_POINTER_INVALIDATE(world_ptr);
        }
        else {
@@ -706,7 +706,7 @@ static void rna_Main_groups_remove(Main *bmain, PointerRNA *group_ptr)
 {
        Group *group = group_ptr->data;
        BKE_group_unlink(group);
-       BKE_libblock_free(&bmain->group, group);
+       BKE_libblock_free(bmain, group);
        RNA_POINTER_INVALIDATE(group_ptr);
 }
 
@@ -720,7 +720,7 @@ static void rna_Main_speakers_remove(Main *bmain, ReportList *reports, PointerRN
 {
        Speaker *speaker = speaker_ptr->data;
        if (ID_REAL_USERS(speaker) <= 0) {
-               BKE_libblock_free(&bmain->speaker, speaker);
+               BKE_libblock_free(bmain, speaker);
                RNA_POINTER_INVALIDATE(speaker_ptr);
        }
        else {
@@ -737,7 +737,7 @@ static void rna_Main_texts_remove(Main *bmain, PointerRNA *text_ptr)
 {
        Text *text = text_ptr->data;
        BKE_text_unlink(bmain, text);
-       BKE_libblock_free(&bmain->text, text);
+       BKE_libblock_free(bmain, text);
        RNA_POINTER_INVALIDATE(text_ptr);
 }
 
@@ -765,7 +765,7 @@ static void rna_Main_armatures_remove(Main *bmain, ReportList *reports, PointerR
 {
        bArmature *arm = arm_ptr->data;
        if (ID_REAL_USERS(arm) <= 0) {
-               BKE_libblock_free(&bmain->armature, arm);
+               BKE_libblock_free(bmain, arm);
                RNA_POINTER_INVALIDATE(arm_ptr);
        }
        else {
@@ -785,7 +785,7 @@ static void rna_Main_actions_remove(Main *bmain, ReportList *reports, PointerRNA
 {
        bAction *act = act_ptr->data;
        if (ID_REAL_USERS(act) <= 0) {
-               BKE_libblock_free(&bmain->action, act);
+               BKE_libblock_free(bmain, act);
                RNA_POINTER_INVALIDATE(act_ptr);
        }
        else {
@@ -804,7 +804,7 @@ static void rna_Main_particles_remove(Main *bmain, ReportList *reports, PointerR
 {
        ParticleSettings *part = part_ptr->data;
        if (ID_REAL_USERS(part) <= 0) {
-               BKE_libblock_free(&bmain->particle, part);
+               BKE_libblock_free(bmain, part);
                RNA_POINTER_INVALIDATE(part_ptr);
        }
        else {
@@ -831,7 +831,7 @@ static void rna_Main_movieclips_remove(Main *bmain, PointerRNA *clip_ptr)
 {
        MovieClip *clip = clip_ptr->data;
        BKE_movieclip_unlink(bmain, clip);
-       BKE_libblock_free(&bmain->movieclip, clip);
+       BKE_libblock_free(bmain, clip);
        RNA_POINTER_INVALIDATE(clip_ptr);
 }
 
@@ -848,7 +848,7 @@ static void rna_Main_masks_remove(Main *bmain, PointerRNA *mask_ptr)
 {
        Mask *mask = mask_ptr->data;
        BKE_mask_free(bmain, mask);
-       BKE_libblock_free(&bmain->mask, mask);
+       BKE_libblock_free(bmain, mask);
        RNA_POINTER_INVALIDATE(mask_ptr);
 }
 
@@ -857,7 +857,7 @@ static void rna_Main_grease_pencil_remove(Main *bmain, ReportList *reports, Poin
        bGPdata *gpd = gpd_ptr->data;
        if (ID_REAL_USERS(gpd) <= 0) {
                BKE_gpencil_free(gpd);
-               BKE_libblock_free(&bmain->gpencil, gpd);
+               BKE_libblock_free(bmain, gpd);
                RNA_POINTER_INVALIDATE(gpd_ptr);
        }
        else
@@ -875,7 +875,7 @@ FreestyleLineStyle *rna_Main_linestyles_new(Main *bmain, const char *name)
 void rna_Main_linestyles_remove(Main *bmain, ReportList *reports, FreestyleLineStyle *linestyle)
 {
        if (ID_REAL_USERS(linestyle) <= 0)
-               BKE_libblock_free(&bmain->linestyle, linestyle);
+               BKE_libblock_free(bmain, linestyle);
        else
                BKE_reportf(reports, RPT_ERROR, "Line style '%s' must have zero users to be removed, found %d",
                            linestyle->id.name + 2, ID_REAL_USERS(linestyle));
index 71d6d25c9a0c7ebf89a9d81583f4dc9db24d27d7..2fbf92ebed7904a41fb00d87e6b6e2ab8501affd 100644 (file)
@@ -402,7 +402,7 @@ void wm_clear_default_size(bContext *C)
 /* on startup, it adds all data, for matching */
 void wm_add_default(bContext *C)
 {
-       wmWindowManager *wm = BKE_libblock_alloc(&CTX_data_main(C)->wm, ID_WM, "WinMan");
+       wmWindowManager *wm = BKE_libblock_alloc(CTX_data_main(C), ID_WM, "WinMan");
        wmWindow *win;
        bScreen *screen = CTX_wm_screen(C); /* XXX from file read hrmf */
        
index 28fc222e187c4bd21a9af9b445ff4e696cce4c33..1e682be603be8681e7762116c6a6aa2009bb5e14 100644 (file)
@@ -306,7 +306,7 @@ void wm_window_close(bContext *C, wmWindowManager *wm, wmWindow *win)
                /* if temp screen, delete it after window free (it stops jobs that can access it) */
                if (screen->temp) {
                        Main *bmain = CTX_data_main(C);
-                       BKE_libblock_free(&bmain->screen, screen);
+                       BKE_libblock_free(bmain, screen);
                }
        }               
 }
index 5aec3c9e965b7ed5949abab433d03a94943d471d..ca5b26079b1adf4520977fa35b350a34bfe50eed 100644 (file)
@@ -97,7 +97,7 @@ BL_ShapeDeformer::~BL_ShapeDeformer()
 {
        if (m_key)
        {
-               BKE_libblock_free(&G.main->key, m_key);
+               BKE_libblock_free(G.main, m_key);
                m_key = NULL;
        }
 };