change customdata mask from an 'unsigned int' to an 'u_int64_t', since BMesh branch...
authorCampbell Barton <ideasman42@gmail.com>
Fri, 23 Dec 2011 20:30:23 +0000 (20:30 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 23 Dec 2011 20:30:23 +0000 (20:30 +0000)
15 files changed:
source/blender/blenkernel/BKE_customdata.h
source/blender/blenkernel/depsgraph_private.h
source/blender/blenkernel/intern/customdata.c
source/blender/blenkernel/intern/mesh_validate.c
source/blender/blenkernel/intern/object.c
source/blender/editors/include/ED_view3d.h
source/blender/makesdna/DNA_defs.h
source/blender/makesdna/DNA_genfile.h
source/blender/makesdna/DNA_object_types.h
source/blender/makesdna/DNA_scene_types.h
source/blender/makesdna/intern/dna_genfile.c
source/blender/makesdna/intern/makesdna.c
source/blender/modifiers/intern/MOD_multires.c
source/blender/modifiers/intern/MOD_shrinkwrap.c
source/blender/windowmanager/intern/wm_event_system.c

index 1d344c6..fea706c 100644 (file)
@@ -41,7 +41,7 @@ extern "C" {
 struct ID;
 struct CustomData;
 struct CustomDataLayer;
-typedef unsigned int CustomDataMask;
+typedef u_int64_t CustomDataMask;
 
 extern const CustomDataMask CD_MASK_BAREMESH;
 extern const CustomDataMask CD_MASK_MESH;
@@ -65,6 +65,8 @@ extern const CustomDataMask CD_MASK_FACECORNERS;
 #define CD_DUPLICATE 4  /* do a full copy of all layers, only allowed if source
                                                   has same number of elements */
 
+#define CD_TYPE_AS_MASK(_type) (CustomDataMask)(1 << (CustomDataMask)(_type))
+
 /* initialises a CustomData object with the same layer setup as source.
  * mask is a bitfield where (mask & (1 << (layer type))) indicates
  * if a layer should be copied or not. alloctype must be one of the above. */
index 2dd1428..1c4d423 100644 (file)
@@ -69,7 +69,7 @@ typedef struct DagNode
        int ancestor_count;
        unsigned int lay;                               // accumulated layers of its relations + itself
        unsigned int scelay;                    // layers due to being in scene
-       unsigned int customdata_mask;   // customdata mask
+       u_int64_t customdata_mask;      // customdata mask
        int lasttime;           // if lasttime != DagForest->time, this node was not evaluated yet for flushing
        int BFS_dist;           // BFS distance
        int DFS_dist;           // DFS distance
index 5305372..289faaa 100644 (file)
@@ -943,7 +943,7 @@ void CustomData_merge(const struct CustomData *source, struct CustomData *dest,
                        number++;
 
                if(lastflag & CD_FLAG_NOCOPY) continue;
-               else if(!((int)mask & (int)(1 << (int)type))) continue;
+               else if(!(mask & CD_TYPE_AS_MASK(type))) continue;
                else if(number < CustomData_number_of_layers(dest, type)) continue;
 
                if((alloctype == CD_ASSIGN) && (lastflag & CD_FLAG_NOFREE))
@@ -1500,7 +1500,7 @@ void CustomData_set_only_copy(const struct CustomData *data,
        int i;
 
        for(i = 0; i < data->totlayer; ++i)
-               if(!((int)mask & (int)(1 << (int)data->layers[i].type)))
+               if(!(mask & CD_TYPE_AS_MASK(data->layers[i].type)))
                        data->layers[i].flag |= CD_FLAG_NOCOPY;
 }
 
@@ -2441,7 +2441,7 @@ void CustomData_external_reload(CustomData *data, ID *UNUSED(id), CustomDataMask
                layer = &data->layers[i];
                typeInfo = layerType_getInfo(layer->type);
 
-               if(!(mask & (1<<layer->type)));
+               if(!(mask & CD_TYPE_AS_MASK(layer->type)));
                else if((layer->flag & CD_FLAG_EXTERNAL) && (layer->flag & CD_FLAG_IN_MEMORY)) {
                        if(typeInfo->free)
                                typeInfo->free(layer->data, totelem, typeInfo->size);
@@ -2467,7 +2467,7 @@ void CustomData_external_read(CustomData *data, ID *id, CustomDataMask mask, int
                layer = &data->layers[i];
                typeInfo = layerType_getInfo(layer->type);
 
-               if(!(mask & (1<<layer->type)));
+               if(!(mask & CD_TYPE_AS_MASK(layer->type)));
                else if(layer->flag & CD_FLAG_IN_MEMORY);
                else if((layer->flag & CD_FLAG_EXTERNAL) && typeInfo->read)
                        update= 1;
@@ -2488,7 +2488,7 @@ void CustomData_external_read(CustomData *data, ID *id, CustomDataMask mask, int
                layer = &data->layers[i];
                typeInfo = layerType_getInfo(layer->type);
 
-               if(!(mask & (1<<layer->type)));
+               if(!(mask & CD_TYPE_AS_MASK(layer->type)));
                else if(layer->flag & CD_FLAG_IN_MEMORY);
                else if((layer->flag & CD_FLAG_EXTERNAL) && typeInfo->read) {
                        blay= cdf_layer_find(cdf, layer->type, layer->name);
@@ -2527,7 +2527,7 @@ void CustomData_external_write(CustomData *data, ID *id, CustomDataMask mask, in
                layer = &data->layers[i];
                typeInfo = layerType_getInfo(layer->type);
 
-               if(!(mask & (1<<layer->type)));
+               if(!(mask & CD_TYPE_AS_MASK(layer->type)));
                else if((layer->flag & CD_FLAG_EXTERNAL) && typeInfo->write)
                        update= 1;
        }
@@ -2641,7 +2641,7 @@ void CustomData_external_remove(CustomData *data, ID *id, int type, int totelem)
 
        if(layer->flag & CD_FLAG_EXTERNAL) {
                if(!(layer->flag & CD_FLAG_IN_MEMORY))
-                       CustomData_external_read(data, id, (1<<layer->type), totelem);
+                       CustomData_external_read(data, id, CD_TYPE_AS_MASK(layer->type), totelem);
 
                layer->flag &= ~CD_FLAG_EXTERNAL;
 
index 5a53d95..a1bf9cb 100644 (file)
@@ -395,7 +395,7 @@ static int mesh_validate_customdata(CustomData *data, short do_verbose, const sh
 
        while(i<data->totlayer) {
                CustomDataLayer *layer= &data->layers[i];
-               int mask= 1 << layer->type;
+               CustomDataMask mask= CD_TYPE_AS_MASK(layer->type);
                int ok= 1;
 
                if((mask&CD_MASK_MESH)==0) {
index 28c1aac..76f11b7 100644 (file)
@@ -2563,7 +2563,7 @@ void object_handle_update(Scene *scene, Object *ob)
 
 #else                          /* ensure CD_MASK_BAREMESH for now */
                                        EditMesh *em = (ob == scene->obedit)? BKE_mesh_get_editmesh(ob->data): NULL;
-                                       unsigned int data_mask= scene->customdata_mask | ob->customdata_mask | CD_MASK_BAREMESH;
+                                       u_int64_t data_mask= scene->customdata_mask | ob->customdata_mask | CD_MASK_BAREMESH;
                                        if(em) {
                                                makeDerivedMesh(scene, ob, em,  data_mask); /* was CD_MASK_BAREMESH */
                                                BKE_mesh_end_editmesh(ob->data, em);
index 476cf2a..fb41b2f 100644 (file)
@@ -286,8 +286,8 @@ Base *ED_view3d_give_base_under_cursor(struct bContext *C, const int mval[2]);
 void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar, short do_clip);
 int ED_view3d_lock(struct RegionView3D *rv3d);
 
-unsigned int ED_view3d_datamask(struct Scene *scene, struct View3D *v3d);
-unsigned int ED_viewedit_datamask(struct bScreen *screen);
+u_int64_t ED_view3d_datamask(struct Scene *scene, struct View3D *v3d);
+u_int64_t ED_viewedit_datamask(struct bScreen *screen);
 
 /* camera lock functions */
 int ED_view3d_camera_lock_check(struct View3D *v3d, struct RegionView3D *rv3d);
index 88401d3..25d9541 100644 (file)
@@ -42,4 +42,7 @@
 #  endif
 #endif
 
+/* hrmf, we need a better include then this */
+#include "../blenloader/BLO_sys_types.h" /* needed for int64_t only! */
+
 #endif /* DNA_DEFS_H */
index 83292d3..be13c8b 100644 (file)
@@ -48,12 +48,13 @@ typedef enum eSDNA_Type {
        SDNA_TYPE_ULONG    = 6,
        SDNA_TYPE_FLOAT    = 7,
        SDNA_TYPE_DOUBLE   = 8,
-       SDNA_TYPE_INT64    = 9
-       /* ,SDNA_TYPE_VOID     = 10 */ /* nothing uses yet */
+       SDNA_TYPE_INT64    = 9,
+       SDNA_TYPE_UINT64   = 10
+       /* ,SDNA_TYPE_VOID     = 11 */ /* nothing uses yet */
 } eSDNA_Type;
 
 /* define so switch statements don't complain */
-#define SDNA_TYPE_VOID 10
+#define SDNA_TYPE_VOID 11
 
 struct SDNA *DNA_sdna_from_data(void *data, int datalen, int do_endian_swap);
 void DNA_sdna_free(struct SDNA *sdna);
index 8707ae0..fcce21c 100644 (file)
@@ -250,8 +250,8 @@ typedef struct Object {
        struct FluidsimSettings *fluidsimSettings; /* if fluidsim enabled, store additional settings */
 
        struct DerivedMesh *derivedDeform, *derivedFinal;
-       unsigned int lastDataMask;   /* the custom data layer mask that was last used to calculate derivedDeform and derivedFinal */
-       unsigned int customdata_mask; /* (extra) custom data layer mask to use for creating derivedmesh, set by depsgraph */
+       u_int64_t lastDataMask;   /* the custom data layer mask that was last used to calculate derivedDeform and derivedFinal */
+       u_int64_t customdata_mask; /* (extra) custom data layer mask to use for creating derivedmesh, set by depsgraph */
        unsigned int state;                     /* bit masks of game controllers that are active */
        unsigned int init_state;        /* bit masks of initial state as recorded by the users */
 
index 345e78d..1288e8a 100644 (file)
@@ -915,8 +915,6 @@ typedef struct Scene {
        unsigned int lay;                       /* bitflags for layer visibility */
        int layact;             /* active layer */
        unsigned int lay_updated;       /* runtime flag, has layer ever been updated since load? */
-       unsigned int customdata_mask;   /* XXX. runtime flag for drawing, actually belongs in the window, only used by object_handle_update() */
-       unsigned int customdata_mask_modal; /* XXX. same as above but for temp operator use (gl renders) */
        
        short flag;                                                             /* various settings */
        
@@ -971,6 +969,9 @@ typedef struct Scene {
 
        /* Movie Tracking */
        struct MovieClip *clip;                 /* active movie clip */
+
+       u_int64_t customdata_mask;      /* XXX. runtime flag for drawing, actually belongs in the window, only used by object_handle_update() */
+       u_int64_t customdata_mask_modal; /* XXX. same as above but for temp operator use (gl renders) */
 } Scene;
 
 
index db0c2bc..d493083 100644 (file)
@@ -667,6 +667,7 @@ static eSDNA_Type sdna_type_nr(const char *dna_type)
        else if( strcmp(dna_type, "float")==0)                                                return SDNA_TYPE_FLOAT;
        else if( strcmp(dna_type, "double")==0)                                               return SDNA_TYPE_DOUBLE;
        else if( strcmp(dna_type, "int64_t")==0)                                              return SDNA_TYPE_INT64;
+       else if( strcmp(dna_type, "u_int64_t")==0)                                            return SDNA_TYPE_UINT64;
        else                                                                                  return -1; /* invalid! */
 }
 
@@ -711,6 +712,8 @@ static void cast_elem(const char *ctype, const char *otype, const char *name, ch
                        val= *( (double *)olddata); break;
                case SDNA_TYPE_INT64:
                        val= *( (int64_t *)olddata); break;
+               case SDNA_TYPE_UINT64:
+                       val= *( (u_int64_t *)olddata); break;
                }
                
                switch(ctypenr) {
@@ -736,6 +739,8 @@ static void cast_elem(const char *ctype, const char *otype, const char *name, ch
                        *( (double *)curdata)= val; break;
                case SDNA_TYPE_INT64:
                        *( (int64_t *)curdata)= val; break;
+               case SDNA_TYPE_UINT64:
+                       *( (u_int64_t *)curdata)= val; break;
                }
 
                olddata+= oldlen;
@@ -1093,7 +1098,9 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
                                                cpo+= 4;
                                        }
                                }
-                               else if ( (spc[0]==SDNA_TYPE_INT64)) {
+                               else if ( (spc[0]==SDNA_TYPE_INT64) ||
+                                         (spc[0]==SDNA_TYPE_UINT64))
+                               {
                                        mul= DNA_elem_array_size(name, strlen(name));
                                        cpo= cur;
                                        while(mul--) {
@@ -1170,6 +1177,7 @@ int DNA_elem_type_size(const eSDNA_Type elem_nr)
                        return 4;
                case SDNA_TYPE_DOUBLE:
                case SDNA_TYPE_INT64:
+               case SDNA_TYPE_UINT64:
                        return 8;
        }
 
index 0c417e9..31f5286 100644 (file)
@@ -939,6 +939,7 @@ static int make_structDNA(char *baseDirectory, FILE *file)
        add_type("float", 4);   /* SDNA_TYPE_FLOAT */
        add_type("double", 8);  /* SDNA_TYPE_DOUBLE */
        add_type("int64_t", 8); /* SDNA_TYPE_INT64 */
+       add_type("u_int64_t", 8); /* SDNA_TYPE_UINT64 */
        add_type("void", 0);    /* SDNA_TYPE_VOID */
 
        // the defines above shouldn't be output in the padding file...
index 8bcaf88..55f2913 100644 (file)
 
 #include <stddef.h>
 
+#include "DNA_mesh_types.h"
+
 #include "BKE_cdderivedmesh.h"
 #include "BKE_multires.h"
 #include "BKE_modifier.h"
 #include "BKE_paint.h"
 #include "BKE_particle.h"
 
-#include "DNA_mesh_types.h"
-
 #include "MOD_util.h"
 
 static void initData(ModifierData *md)
index 6c047a8..e8f0997 100644 (file)
@@ -35,6 +35,8 @@
 
 #include <string.h>
 
+#include "DNA_object_types.h"
+
 #include "BLI_string.h"
 #include "BLI_utildefines.h"
 
@@ -42,8 +44,6 @@
 #include "BKE_modifier.h"
 #include "BKE_shrinkwrap.h"
 
-#include "DNA_object_types.h"
-
 #include "depsgraph_private.h"
 
 #include "MOD_util.h"
index 1593f14..064c98b 100644 (file)
@@ -186,7 +186,7 @@ void wm_event_do_notifiers(bContext *C)
        wmWindowManager *wm= CTX_wm_manager(C);
        wmNotifier *note, *next;
        wmWindow *win;
-       unsigned int win_combine_v3d_datamask= 0;
+       u_int64_t win_combine_v3d_datamask= 0;
        
        if(wm==NULL)
                return;