change customdata mask from an 'unsigned int' to an 'u_int64_t', since BMesh branch has run out of bits

This commit is contained in:
Campbell Barton 2011-12-23 20:30:23 +00:00
parent 5df049f390
commit ddcf56366d
15 changed files with 42 additions and 26 deletions

View 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. */

View 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

View 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;

View 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) {

View 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);

View 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);

View 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 */

View 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);

View 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 */

View 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;

View 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;
}

View 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...

View File

@ -35,14 +35,14 @@
#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)

View 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"

View 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;