use const pointers for file loading and booleans for animation system return values passed as pointers.

This commit is contained in:
Campbell Barton 2013-03-17 19:13:04 +00:00
parent 16b82845ee
commit 09c41019a8
20 changed files with 65 additions and 63 deletions

@ -70,7 +70,7 @@ int BKE_read_file(struct bContext *C, const char *filepath, struct ReportList *r
#define BKE_READ_FILE_OK 1 /* OK */ #define BKE_READ_FILE_OK 1 /* OK */
#define BKE_READ_FILE_OK_USERPREFS 2 /* OK, and with new user settings */ #define BKE_READ_FILE_OK_USERPREFS 2 /* OK, and with new user settings */
int BKE_read_file_from_memory(struct bContext *C, char *filebuf, int filelength, struct ReportList *reports); int BKE_read_file_from_memory(struct bContext *C, const void *filebuf, int filelength, struct ReportList *reports);
int BKE_read_file_from_memfile(struct bContext *C, struct MemFile *memfile, struct ReportList *reports); int BKE_read_file_from_memfile(struct bContext *C, struct MemFile *memfile, struct ReportList *reports);
int BKE_read_file_userdef(const char *filepath, struct ReportList *reports); int BKE_read_file_userdef(const char *filepath, struct ReportList *reports);
@ -105,8 +105,8 @@ extern struct Main *BKE_undo_get_main(struct Scene **scene);
/* copybuffer */ /* copybuffer */
void BKE_copybuffer_begin(void); void BKE_copybuffer_begin(void);
void BKE_copybuffer_tag_ID(struct ID *id); void BKE_copybuffer_tag_ID(struct ID *id);
int BKE_copybuffer_save(char *filename, struct ReportList *reports); int BKE_copybuffer_save(const char *filename, struct ReportList *reports);
int BKE_copybuffer_paste(struct bContext *C, char *libname, struct ReportList *reports); int BKE_copybuffer_paste(struct bContext *C, const char *libname, struct ReportList *reports);
#ifdef __cplusplus #ifdef __cplusplus
} }

@ -182,7 +182,7 @@ void evaluate_value_fmodifiers(ListBase *modifiers, struct FCurve *fcu, float *c
void fcurve_bake_modifiers(struct FCurve *fcu, int start, int end); void fcurve_bake_modifiers(struct FCurve *fcu, int start, int end);
int BKE_fcm_envelope_find_index(struct FCM_EnvelopeData *array, float frame, int arraylen, short *exists); int BKE_fcm_envelope_find_index(struct FCM_EnvelopeData *array, float frame, int arraylen, bool *r_exists);
/* ************** F-Curves API ******************** */ /* ************** F-Curves API ******************** */
@ -200,7 +200,7 @@ struct FCurve *list_find_fcurve(ListBase *list, const char rna_path[], const int
struct FCurve *iter_step_fcurve(struct FCurve *fcu_iter, const char rna_path[]); struct FCurve *iter_step_fcurve(struct FCurve *fcu_iter, const char rna_path[]);
/* high level function to get an fcurve from C without having the rna */ /* high level function to get an fcurve from C without having the rna */
struct FCurve *id_data_find_fcurve(ID *id, void *data, struct StructRNA *type, const char *prop_name, int index, char *driven); struct FCurve *id_data_find_fcurve(ID *id, void *data, struct StructRNA *type, const char *prop_name, int index, bool *r_driven);
/* Get list of LinkData's containing pointers to the F-Curves which control the types of data indicated /* Get list of LinkData's containing pointers to the F-Curves which control the types of data indicated
* e.g. numMatches = list_find_data_fcurves(matches, &act->curves, "pose.bones[", "MyFancyBone"); * e.g. numMatches = list_find_data_fcurves(matches, &act->curves, "pose.bones[", "MyFancyBone");
@ -208,12 +208,12 @@ struct FCurve *id_data_find_fcurve(ID *id, void *data, struct StructRNA *type, c
int list_find_data_fcurves(ListBase *dst, ListBase *src, const char *dataPrefix, const char *dataName); int list_find_data_fcurves(ListBase *dst, ListBase *src, const char *dataPrefix, const char *dataName);
/* find an f-curve based on an rna property */ /* find an f-curve based on an rna property */
struct FCurve *rna_get_fcurve(struct PointerRNA *ptr, struct PropertyRNA *prop, int rnaindex, struct bAction **action, int *driven); struct FCurve *rna_get_fcurve(struct PointerRNA *ptr, struct PropertyRNA *prop, int rnaindex, struct bAction **action, bool *r_driven);
/* Binary search algorithm for finding where to 'insert' BezTriple with given frame number. /* Binary search algorithm for finding where to 'insert' BezTriple with given frame number.
* Returns the index to insert at (data already at that index will be offset if replace is 0) * Returns the index to insert at (data already at that index will be offset if replace is 0)
*/ */
int binarysearch_bezt_index(struct BezTriple array[], float frame, int arraylen, short *replace); int binarysearch_bezt_index(struct BezTriple array[], float frame, int arraylen, bool *r_replace);
/* get the time extents for F-Curve */ /* get the time extents for F-Curve */
void calc_fcurve_range(struct FCurve *fcu, float *min, float *max, void calc_fcurve_range(struct FCurve *fcu, float *min, float *max,

@ -461,7 +461,7 @@ int BKE_read_file(bContext *C, const char *filepath, ReportList *reports)
return (bfd ? retval : BKE_READ_FILE_FAIL); return (bfd ? retval : BKE_READ_FILE_FAIL);
} }
int BKE_read_file_from_memory(bContext *C, char *filebuf, int filelength, ReportList *reports) int BKE_read_file_from_memory(bContext *C, const void *filebuf, int filelength, ReportList *reports)
{ {
BlendFileData *bfd; BlendFileData *bfd;
@ -906,7 +906,7 @@ static void copybuffer_doit(void *UNUSED(handle), Main *UNUSED(bmain), void *vid
} }
/* frees main in end */ /* frees main in end */
int BKE_copybuffer_save(char *filename, ReportList *reports) int BKE_copybuffer_save(const char *filename, ReportList *reports)
{ {
Main *mainb = MEM_callocN(sizeof(Main), "copybuffer"); Main *mainb = MEM_callocN(sizeof(Main), "copybuffer");
ListBase *lbarray[MAX_LIBARRAY], *fromarray[MAX_LIBARRAY]; ListBase *lbarray[MAX_LIBARRAY], *fromarray[MAX_LIBARRAY];
@ -959,7 +959,7 @@ int BKE_copybuffer_save(char *filename, ReportList *reports)
} }
/* return success (1) */ /* return success (1) */
int BKE_copybuffer_paste(bContext *C, char *libname, ReportList *reports) int BKE_copybuffer_paste(bContext *C, const char *libname, ReportList *reports)
{ {
Main *bmain = CTX_data_main(C); Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C); Scene *scene = CTX_data_scene(C);

@ -169,7 +169,7 @@ void copy_fcurves(ListBase *dst, ListBase *src)
/* ----------------- Finding F-Curves -------------------------- */ /* ----------------- Finding F-Curves -------------------------- */
/* high level function to get an fcurve from C without having the rna */ /* high level function to get an fcurve from C without having the rna */
FCurve *id_data_find_fcurve(ID *id, void *data, StructRNA *type, const char *prop_name, int index, char *driven) FCurve *id_data_find_fcurve(ID *id, void *data, StructRNA *type, const char *prop_name, int index, bool *r_driven)
{ {
/* anim vars */ /* anim vars */
AnimData *adt = BKE_animdata_from_id(id); AnimData *adt = BKE_animdata_from_id(id);
@ -180,8 +180,8 @@ FCurve *id_data_find_fcurve(ID *id, void *data, StructRNA *type, const char *pro
PropertyRNA *prop; PropertyRNA *prop;
char *path; char *path;
if (driven) if (r_driven)
*driven = FALSE; *r_driven = false;
/* only use the current action ??? */ /* only use the current action ??? */
if (ELEM(NULL, adt, adt->action)) if (ELEM(NULL, adt, adt->action))
@ -201,8 +201,8 @@ FCurve *id_data_find_fcurve(ID *id, void *data, StructRNA *type, const char *pro
/* if not animated, check if driven */ /* if not animated, check if driven */
if ((fcu == NULL) && (adt->drivers.first)) { if ((fcu == NULL) && (adt->drivers.first)) {
fcu = list_find_fcurve(&adt->drivers, path, index); fcu = list_find_fcurve(&adt->drivers, path, index);
if (fcu && driven) if (fcu && r_driven)
*driven = TRUE; *r_driven = true;
fcu = NULL; fcu = NULL;
} }
@ -305,11 +305,11 @@ int list_find_data_fcurves(ListBase *dst, ListBase *src, const char *dataPrefix,
return matches; return matches;
} }
FCurve *rna_get_fcurve(PointerRNA *ptr, PropertyRNA *prop, int rnaindex, bAction **action, int *driven) FCurve *rna_get_fcurve(PointerRNA *ptr, PropertyRNA *prop, int rnaindex, bAction **action, bool *r_driven)
{ {
FCurve *fcu = NULL; FCurve *fcu = NULL;
*driven = 0; *r_driven = false;
/* there must be some RNA-pointer + property combon */ /* there must be some RNA-pointer + property combon */
if (prop && ptr->id.data && RNA_property_animateable(ptr, prop)) { if (prop && ptr->id.data && RNA_property_animateable(ptr, prop)) {
@ -331,7 +331,7 @@ FCurve *rna_get_fcurve(PointerRNA *ptr, PropertyRNA *prop, int rnaindex, bAction
fcu = list_find_fcurve(&adt->drivers, path, rnaindex); fcu = list_find_fcurve(&adt->drivers, path, rnaindex);
if (fcu) if (fcu)
*driven = 1; *r_driven = true;
} }
if (fcu && action) if (fcu && action)
@ -354,13 +354,13 @@ FCurve *rna_get_fcurve(PointerRNA *ptr, PropertyRNA *prop, int rnaindex, bAction
/* Binary search algorithm for finding where to insert BezTriple. (for use by insert_bezt_fcurve) /* Binary search algorithm for finding where to insert BezTriple. (for use by insert_bezt_fcurve)
* Returns the index to insert at (data already at that index will be offset if replace is 0) * Returns the index to insert at (data already at that index will be offset if replace is 0)
*/ */
int binarysearch_bezt_index(BezTriple array[], float frame, int arraylen, short *replace) int binarysearch_bezt_index(BezTriple array[], float frame, int arraylen, bool *r_replace)
{ {
int start = 0, end = arraylen; int start = 0, end = arraylen;
int loopbreaker = 0, maxloop = arraylen * 2; int loopbreaker = 0, maxloop = arraylen * 2;
/* initialize replace-flag first */ /* initialize replace-flag first */
*replace = 0; *r_replace = false;
/* sneaky optimizations (don't go through searching process if...): /* sneaky optimizations (don't go through searching process if...):
* - keyframe to be added is to be added out of current bounds * - keyframe to be added is to be added out of current bounds
@ -377,7 +377,7 @@ int binarysearch_bezt_index(BezTriple array[], float frame, int arraylen, short
/* 'First' Keyframe (when only one keyframe, this case is used) */ /* 'First' Keyframe (when only one keyframe, this case is used) */
framenum = array[0].vec[1][0]; framenum = array[0].vec[1][0];
if (IS_EQT(frame, framenum, BEZT_BINARYSEARCH_THRESH)) { if (IS_EQT(frame, framenum, BEZT_BINARYSEARCH_THRESH)) {
*replace = 1; *r_replace = true;
return 0; return 0;
} }
else if (frame < framenum) else if (frame < framenum)
@ -386,7 +386,7 @@ int binarysearch_bezt_index(BezTriple array[], float frame, int arraylen, short
/* 'Last' Keyframe */ /* 'Last' Keyframe */
framenum = array[(arraylen - 1)].vec[1][0]; framenum = array[(arraylen - 1)].vec[1][0];
if (IS_EQT(frame, framenum, BEZT_BINARYSEARCH_THRESH)) { if (IS_EQT(frame, framenum, BEZT_BINARYSEARCH_THRESH)) {
*replace = 1; *r_replace = true;
return (arraylen - 1); return (arraylen - 1);
} }
else if (frame > framenum) else if (frame > framenum)
@ -404,7 +404,7 @@ int binarysearch_bezt_index(BezTriple array[], float frame, int arraylen, short
/* check if exactly equal to midpoint */ /* check if exactly equal to midpoint */
if (IS_EQT(frame, midfra, BEZT_BINARYSEARCH_THRESH)) { if (IS_EQT(frame, midfra, BEZT_BINARYSEARCH_THRESH)) {
*replace = 1; *r_replace = true;
return mid; return mid;
} }

@ -487,13 +487,13 @@ static FModifierTypeInfo FMI_ENVELOPE = {
*/ */
#define BINARYSEARCH_FRAMEEQ_THRESH 0.0001f #define BINARYSEARCH_FRAMEEQ_THRESH 0.0001f
int BKE_fcm_envelope_find_index(FCM_EnvelopeData array[], float frame, int arraylen, short *exists) int BKE_fcm_envelope_find_index(FCM_EnvelopeData array[], float frame, int arraylen, bool *r_exists)
{ {
int start = 0, end = arraylen; int start = 0, end = arraylen;
int loopbreaker = 0, maxloop = arraylen * 2; int loopbreaker = 0, maxloop = arraylen * 2;
/* initialize exists-flag first */ /* initialize exists-flag first */
*exists = 0; *r_exists = false;
/* sneaky optimizations (don't go through searching process if...): /* sneaky optimizations (don't go through searching process if...):
* - keyframe to be added is to be added out of current bounds * - keyframe to be added is to be added out of current bounds
@ -510,7 +510,7 @@ int BKE_fcm_envelope_find_index(FCM_EnvelopeData array[], float frame, int array
/* 'First' Point (when only one point, this case is used) */ /* 'First' Point (when only one point, this case is used) */
framenum = array[0].time; framenum = array[0].time;
if (IS_EQT(frame, framenum, BINARYSEARCH_FRAMEEQ_THRESH)) { if (IS_EQT(frame, framenum, BINARYSEARCH_FRAMEEQ_THRESH)) {
*exists = 1; *r_exists = true;
return 0; return 0;
} }
else if (frame < framenum) { else if (frame < framenum) {
@ -520,7 +520,7 @@ int BKE_fcm_envelope_find_index(FCM_EnvelopeData array[], float frame, int array
/* 'Last' Point */ /* 'Last' Point */
framenum = array[(arraylen - 1)].time; framenum = array[(arraylen - 1)].time;
if (IS_EQT(frame, framenum, BINARYSEARCH_FRAMEEQ_THRESH)) { if (IS_EQT(frame, framenum, BINARYSEARCH_FRAMEEQ_THRESH)) {
*exists = 1; *r_exists = true;
return (arraylen - 1); return (arraylen - 1);
} }
else if (frame > framenum) { else if (frame > framenum) {
@ -539,7 +539,7 @@ int BKE_fcm_envelope_find_index(FCM_EnvelopeData array[], float frame, int array
/* check if exactly equal to midpoint */ /* check if exactly equal to midpoint */
if (IS_EQT(frame, midfra, BINARYSEARCH_FRAMEEQ_THRESH)) { if (IS_EQT(frame, midfra, BINARYSEARCH_FRAMEEQ_THRESH)) {
*exists = 1; *r_exists = true;
return mid; return mid;
} }

@ -96,7 +96,7 @@ BlendFileData *BLO_read_from_file(const char *filepath, struct ReportList *repor
* indicating the cause of the failure. * indicating the cause of the failure.
* \return The data of the file. * \return The data of the file.
*/ */
BlendFileData *BLO_read_from_memory(void *mem, int memsize, struct ReportList *reports); BlendFileData *BLO_read_from_memory(const void *mem, int memsize, struct ReportList *reports);
/** /**
* oldmain is old main, from which we will keep libraries, images, .. * oldmain is old main, from which we will keep libraries, images, ..
@ -122,7 +122,7 @@ BLO_blendfiledata_free(BlendFileData *bfd);
* \return A handle on success, or NULL on failure. * \return A handle on success, or NULL on failure.
*/ */
BlendHandle * BlendHandle *
BLO_blendhandle_from_file(char *file, BLO_blendhandle_from_file(const char *filepath,
struct ReportList *reports); struct ReportList *reports);
/** /**
@ -134,7 +134,7 @@ BLO_blendhandle_from_file(char *file,
*/ */
BlendHandle * BlendHandle *
BLO_blendhandle_from_memory(void *mem, BLO_blendhandle_from_memory(const void *mem,
int memsize); int memsize);
/** /**

@ -74,16 +74,16 @@ void BLO_blendhandle_print_sizes(BlendHandle *, void *);
/* Access routines used by filesel. */ /* Access routines used by filesel. */
BlendHandle *BLO_blendhandle_from_file(char *file, ReportList *reports) BlendHandle *BLO_blendhandle_from_file(const char *filepath, ReportList *reports)
{ {
BlendHandle *bh; BlendHandle *bh;
bh = (BlendHandle *)blo_openblenderfile(file, reports); bh = (BlendHandle *)blo_openblenderfile(filepath, reports);
return bh; return bh;
} }
BlendHandle *BLO_blendhandle_from_memory(void *mem, int memsize) BlendHandle *BLO_blendhandle_from_memory(const void *mem, int memsize)
{ {
BlendHandle *bh; BlendHandle *bh;
@ -271,7 +271,7 @@ BlendFileData *BLO_read_from_file(const char *filepath, ReportList *reports)
return bfd; return bfd;
} }
BlendFileData *BLO_read_from_memory(void *mem, int memsize, ReportList *reports) BlendFileData *BLO_read_from_memory(const void *mem, int memsize, ReportList *reports)
{ {
BlendFileData *bfd = NULL; BlendFileData *bfd = NULL;
FileData *fd; FileData *fd;

@ -1041,7 +1041,7 @@ static int fd_read_gzip_from_memory_init(FileData *fd)
return 1; return 1;
} }
FileData *blo_openblendermemory(void *mem, int memsize, ReportList *reports) FileData *blo_openblendermemory(const void *mem, int memsize, ReportList *reports)
{ {
if (!mem || memsize<SIZEOFBLENDERHEADER) { if (!mem || memsize<SIZEOFBLENDERHEADER) {
BKE_report(reports, RPT_WARNING, (mem) ? TIP_("Unable to read"): TIP_("Unable to open")); BKE_report(reports, RPT_WARNING, (mem) ? TIP_("Unable to read"): TIP_("Unable to open"));
@ -1049,7 +1049,7 @@ FileData *blo_openblendermemory(void *mem, int memsize, ReportList *reports)
} }
else { else {
FileData *fd = filedata_new(); FileData *fd = filedata_new();
char *cp = mem; const char *cp = mem;
fd->buffer = mem; fd->buffer = mem;
fd->buffersize = memsize; fd->buffersize = memsize;
@ -1106,7 +1106,7 @@ void blo_freefiledata(FileData *fd)
} }
if (fd->buffer && !(fd->flags & FD_FLAGS_NOT_MY_BUFFER)) { if (fd->buffer && !(fd->flags & FD_FLAGS_NOT_MY_BUFFER)) {
MEM_freeN(fd->buffer); MEM_freeN((void *)fd->buffer);
fd->buffer = NULL; fd->buffer = NULL;
} }

@ -54,7 +54,7 @@ typedef struct FileData {
int (*read)(struct FileData *filedata, void *buffer, unsigned int size); int (*read)(struct FileData *filedata, void *buffer, unsigned int size);
// variables needed for reading from memory / stream // variables needed for reading from memory / stream
char *buffer; const char *buffer;
// variables needed for reading from memfile (undo) // variables needed for reading from memfile (undo)
struct MemFile *memfile; struct MemFile *memfile;
@ -123,7 +123,7 @@ void blo_split_main(ListBase *mainlist, struct Main *main);
BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath); BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath);
FileData *blo_openblenderfile(const char *filepath, struct ReportList *reports); FileData *blo_openblenderfile(const char *filepath, struct ReportList *reports);
FileData *blo_openblendermemory(void *buffer, int buffersize, struct ReportList *reports); FileData *blo_openblendermemory(const void *buffer, int buffersize, struct ReportList *reports);
FileData *blo_openblendermemfile(struct MemFile *memfile, struct ReportList *reports); FileData *blo_openblendermemfile(struct MemFile *memfile, struct ReportList *reports);
void blo_clear_proxy_pointers_from_lib(Main *oldmain); void blo_clear_proxy_pointers_from_lib(Main *oldmain);

@ -343,7 +343,7 @@ static void fmod_envelope_addpoint_cb(bContext *C, void *fcm_dv, void *UNUSED(ar
/* check that no data exists for the current frame... */ /* check that no data exists for the current frame... */
if (env->data) { if (env->data) {
short exists = -1; bool exists;
int i = BKE_fcm_envelope_find_index(env->data, (float)(scene->r.cfra), env->totvert, &exists); int i = BKE_fcm_envelope_find_index(env->data, (float)(scene->r.cfra), env->totvert, &exists);
/* binarysearch_...() will set exists by default to 0, so if it is non-zero, that means that the point exists already */ /* binarysearch_...() will set exists by default to 0, so if it is non-zero, that means that the point exists already */

@ -237,7 +237,7 @@ int insert_bezt_fcurve(FCurve *fcu, BezTriple *bezt, short flag)
/* are there already keyframes? */ /* are there already keyframes? */
if (fcu->bezt) { if (fcu->bezt) {
short replace = -1; bool replace;
i = binarysearch_bezt_index(fcu->bezt, bezt->vec[1][0], fcu->totvert, &replace); i = binarysearch_bezt_index(fcu->bezt, bezt->vec[1][0], fcu->totvert, &replace);
/* replace an existing keyframe? */ /* replace an existing keyframe? */
@ -1055,7 +1055,7 @@ short delete_keyframe(ReportList *reports, ID *id, bAction *act, const char grou
/* will only loop once unless the array index was -1 */ /* will only loop once unless the array index was -1 */
for (; array_index < array_index_max; array_index++) { for (; array_index < array_index_max; array_index++) {
FCurve *fcu = verify_fcurve(act, group, &ptr, rna_path, array_index, 0); FCurve *fcu = verify_fcurve(act, group, &ptr, rna_path, array_index, 0);
short found = -1; bool found;
int i; int i;
/* check if F-Curve exists and/or whether it can be edited */ /* check if F-Curve exists and/or whether it can be edited */
@ -1845,7 +1845,7 @@ short fcurve_frame_has_keyframe(FCurve *fcu, float frame, short filter)
/* we either include all regardless of muting, or only non-muted */ /* we either include all regardless of muting, or only non-muted */
if ((filter & ANIMFILTER_KEYS_MUTED) || (fcu->flag & FCURVE_MUTED) == 0) { if ((filter & ANIMFILTER_KEYS_MUTED) || (fcu->flag & FCURVE_MUTED) == 0) {
short replace = -1; bool replace;
int i = binarysearch_bezt_index(fcu->bezt, frame, fcu->totvert, &replace); int i = binarysearch_bezt_index(fcu->bezt, frame, fcu->totvert, &replace);
/* binarysearch_bezt_index will set replace to be 0 or 1 /* binarysearch_bezt_index will set replace to be 0 or 1

@ -1081,7 +1081,7 @@ static void pose_propagate_fcurve(wmOperator *op, Object *ob, FCurve *fcu,
BezTriple *bezt; BezTriple *bezt;
float refVal = 0.0f; float refVal = 0.0f;
short keyExists; bool keyExists;
int i, match; int i, match;
short first = 1; short first = 1;

@ -55,19 +55,19 @@
#include "interface_intern.h" #include "interface_intern.h"
static FCurve *ui_but_get_fcurve(uiBut *but, bAction **action, int *driven) static FCurve *ui_but_get_fcurve(uiBut *but, bAction **action, bool *r_driven)
{ {
/* for entire array buttons we check the first component, it's not perfect /* for entire array buttons we check the first component, it's not perfect
* but works well enough in typical cases */ * but works well enough in typical cases */
int rnaindex = (but->rnaindex == -1) ? 0 : but->rnaindex; int rnaindex = (but->rnaindex == -1) ? 0 : but->rnaindex;
return rna_get_fcurve(&but->rnapoin, but->rnaprop, rnaindex, action, driven); return rna_get_fcurve(&but->rnapoin, but->rnaprop, rnaindex, action, r_driven);
} }
void ui_but_anim_flag(uiBut *but, float cfra) void ui_but_anim_flag(uiBut *but, float cfra)
{ {
FCurve *fcu; FCurve *fcu;
int driven; bool driven;
but->flag &= ~(UI_BUT_ANIMATED | UI_BUT_ANIMATED_KEY | UI_BUT_DRIVEN); but->flag &= ~(UI_BUT_ANIMATED | UI_BUT_ANIMATED_KEY | UI_BUT_DRIVEN);
@ -90,7 +90,7 @@ int ui_but_anim_expression_get(uiBut *but, char *str, size_t maxlen)
{ {
FCurve *fcu; FCurve *fcu;
ChannelDriver *driver; ChannelDriver *driver;
int driven; bool driven;
fcu = ui_but_get_fcurve(but, NULL, &driven); fcu = ui_but_get_fcurve(but, NULL, &driven);
@ -110,7 +110,7 @@ int ui_but_anim_expression_set(uiBut *but, const char *str)
{ {
FCurve *fcu; FCurve *fcu;
ChannelDriver *driver; ChannelDriver *driver;
int driven; bool driven;
fcu = ui_but_get_fcurve(but, NULL, &driven); fcu = ui_but_get_fcurve(but, NULL, &driven);
@ -194,7 +194,7 @@ void ui_but_anim_autokey(bContext *C, uiBut *but, Scene *scene, float cfra)
ID *id; ID *id;
bAction *action; bAction *action;
FCurve *fcu; FCurve *fcu;
int driven; bool driven;
fcu = ui_but_get_fcurve(but, &action, &driven); fcu = ui_but_get_fcurve(but, &action, &driven);

@ -192,7 +192,7 @@ static Main *G_pr_main = NULL;
static Main *G_pr_main_cycles = NULL; static Main *G_pr_main_cycles = NULL;
#ifndef WITH_HEADLESS #ifndef WITH_HEADLESS
static Main *load_main_from_memory(char *blend, int blend_size) static Main *load_main_from_memory(const void *blend, int blend_size)
{ {
const int fileflags = G.fileflags; const int fileflags = G.fileflags;
Main *bmain = NULL; Main *bmain = NULL;

@ -221,7 +221,7 @@ static int sound_update_animation_flags_exec(bContext *C, wmOperator *UNUSED(op)
Sequence *seq; Sequence *seq;
Scene *scene = CTX_data_scene(C); Scene *scene = CTX_data_scene(C);
struct FCurve *fcu; struct FCurve *fcu;
char driven; bool driven;
SEQ_BEGIN(scene->ed, seq) SEQ_BEGIN(scene->ed, seq)
{ {

@ -646,7 +646,7 @@ static FCM_EnvelopeData *rna_FModifierEnvelope_points_add(FModifier *fmod, Repor
fed.f1 = fed.f2 = 0; fed.f1 = fed.f2 = 0;
if (env->data) { if (env->data) {
short exists = -1; bool exists;
i = BKE_fcm_envelope_find_index(env->data, frame, env->totvert, &exists); i = BKE_fcm_envelope_find_index(env->data, frame, env->totvert, &exists);
if (exists) { if (exists) {
BKE_reportf(reports, RPT_ERROR, "Already a control point at frame %.6f", frame); BKE_reportf(reports, RPT_ERROR, "Already a control point at frame %.6f", frame);

@ -393,7 +393,8 @@ static int node_animation_properties(bNodeTree *ntree, bNode *node)
lb = RNA_struct_type_properties(ptr.type); lb = RNA_struct_type_properties(ptr.type);
for (link = lb->first; link; link = link->next) { for (link = lb->first; link; link = link->next) {
int driven, len = 1, index; int len = 1, index;
bool driven;
prop = (PropertyRNA *)link; prop = (PropertyRNA *)link;
if (RNA_property_array_check(prop)) if (RNA_property_array_check(prop))
@ -409,7 +410,8 @@ static int node_animation_properties(bNodeTree *ntree, bNode *node)
/* now check node sockets */ /* now check node sockets */
for (sock = node->inputs.first; sock; sock = sock->next) { for (sock = node->inputs.first; sock; sock = sock->next) {
int driven, len = 1, index; int len = 1, index;
bool driven;
RNA_pointer_create((ID *)ntree, &RNA_NodeSocket, sock, &ptr); RNA_pointer_create((ID *)ntree, &RNA_NodeSocket, sock, &ptr);
prop = RNA_struct_find_property(&ptr, "default_value"); prop = RNA_struct_find_property(&ptr, "default_value");

@ -1050,12 +1050,12 @@ KX_LibLoadStatus *KX_BlenderSceneConverter::LinkBlendFileMemory(void *data, int
return LinkBlendFile(bpy_openlib, path, group, scene_merge, err_str, options); return LinkBlendFile(bpy_openlib, path, group, scene_merge, err_str, options);
} }
KX_LibLoadStatus *KX_BlenderSceneConverter::LinkBlendFilePath(const char *path, char *group, KX_Scene *scene_merge, char **err_str, short options) KX_LibLoadStatus *KX_BlenderSceneConverter::LinkBlendFilePath(const char *filepath, char *group, KX_Scene *scene_merge, char **err_str, short options)
{ {
BlendHandle *bpy_openlib = BLO_blendhandle_from_file((char *)path, NULL); BlendHandle *bpy_openlib = BLO_blendhandle_from_file(filepath, NULL);
// Error checking is done in LinkBlendFile // Error checking is done in LinkBlendFile
return LinkBlendFile(bpy_openlib, path, group, scene_merge, err_str, options); return LinkBlendFile(bpy_openlib, filepath, group, scene_merge, err_str, options);
} }
static void load_datablocks(Main *main_newlib, BlendHandle *bpy_openlib, const char *path, int idcode) static void load_datablocks(Main *main_newlib, BlendHandle *bpy_openlib, const char *path, int idcode)

@ -155,14 +155,14 @@ bool GPC_Engine::Start(const char *filename)
} }
bool GPC_Engine::Start(unsigned char *blenderDataBuffer, bool GPC_Engine::Start(const void *blenderDataBuffer,
unsigned int blenderDataBufferSize) unsigned int blenderDataBufferSize)
{ {
ReportList reports; ReportList reports;
BlendFileData *bfd; BlendFileData *bfd;
BKE_reports_init(&reports, RPT_STORE); BKE_reports_init(&reports, RPT_STORE);
bfd= BLO_read_from_memory(blenderDataBuffer, blenderDataBufferSize, &reports); bfd = BLO_read_from_memory(blenderDataBuffer, blenderDataBufferSize, &reports);
BKE_reports_clear(&reports); BKE_reports_clear(&reports);
if (!bfd) { if (!bfd) {

@ -103,7 +103,7 @@ public:
// different prototypes for Unix and Windows // different prototypes for Unix and Windows
void StartLoadingAnimation(); void StartLoadingAnimation();
bool Start(const char *filename); // file-on-disk starter bool Start(const char *filename); // file-on-disk starter
bool Start(unsigned char *blenderDataBuffer, bool Start(const void *blenderDataBuffer,
unsigned int blenderDataBufferSize); // file-in-memory starter unsigned int blenderDataBufferSize); // file-in-memory starter
void Stop(); void Stop();