svn merge ^/trunk/blender -r55357:55372

This commit is contained in:
Campbell Barton 2013-03-18 21:45:29 +00:00
commit 29b7b344fc
102 changed files with 400 additions and 349 deletions

@ -165,7 +165,7 @@ extern "C" {
void MEM_printmemlist(void); void MEM_printmemlist(void);
/** calls the function on all allocated memory blocks. */ /** calls the function on all allocated memory blocks. */
void MEM_callbackmemlist(void (*func)(void*)); void MEM_callbackmemlist(void (*func)(void *));
/** Print statistics about memory usage */ /** Print statistics about memory usage */
void MEM_printmemlist_stats(void); void MEM_printmemlist_stats(void);

@ -170,7 +170,7 @@ bool Armature::popQ(CacheTS timestamp)
{ {
if (m_qCCh >= 0) { if (m_qCCh >= 0) {
double* item; double* item;
item = (double*)m_cache->getPreviousCacheItem(this, m_qCCh, &timestamp); item = (double *)m_cache->getPreviousCacheItem(this, m_qCCh, &timestamp);
if (item && m_qCTs != timestamp) { if (item && m_qCTs != timestamp) {
double* q = m_qKdl(0); double* q = m_qKdl(0);
memcpy(q, item, m_qKdl.rows()*sizeof(double)); memcpy(q, item, m_qKdl.rows()*sizeof(double));
@ -698,8 +698,8 @@ void Armature::updateControlOutput(const Timestamp& timestamp)
JointConstraint_struct* pConstraint = *it; JointConstraint_struct* pConstraint = *it;
unsigned int nr, i; unsigned int nr, i;
for (i=0, nr = pConstraint->segment->second.q_nr; i<pConstraint->v_nr; i++, nr++) { for (i=0, nr = pConstraint->segment->second.q_nr; i<pConstraint->v_nr; i++, nr++) {
*(double*)&pConstraint->value[i].y = m_qKdl[nr]; *(double *)&pConstraint->value[i].y = m_qKdl[nr];
*(double*)&pConstraint->value[i].ydot = m_qdotKdl[nr]; *(double *)&pConstraint->value[i].ydot = m_qdotKdl[nr];
} }
if (pConstraint->function && (pConstraint->substep || (!timestamp.reiterate && !timestamp.substep))) { if (pConstraint->function && (pConstraint->substep || (!timestamp.reiterate && !timestamp.substep))) {
(*pConstraint->function)(timestamp, pConstraint->values, pConstraint->v_nr, pConstraint->param); (*pConstraint->function)(timestamp, pConstraint->values, pConstraint->v_nr, pConstraint->param);

@ -390,10 +390,14 @@ class RENDER_PT_output(RenderButtonsPanel, Panel):
layout.prop(rd, "filepath", text="") layout.prop(rd, "filepath", text="")
flow = layout.column_flow() split = layout.split()
flow.prop(rd, "use_overwrite")
flow.prop(rd, "use_placeholder") col = split.column()
flow.prop(rd, "use_file_extension") col.active = not rd.is_movie_format
col.prop(rd, "use_overwrite")
col.prop(rd, "use_placeholder")
split.prop(rd, "use_file_extension")
layout.template_image_settings(image_settings, color_management=False) layout.template_image_settings(image_settings, color_management=False)

@ -480,6 +480,10 @@ class USERPREF_PT_system(Panel):
col.prop(system, "texture_collection_rate", text="Collection Rate") col.prop(system, "texture_collection_rate", text="Collection Rate")
col.separator() col.separator()
col.label(text="Images:")
col.prop(system, "image_gpubuffer_limit")
col.separator() col.separator()
col.separator() col.separator()

@ -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
} }

@ -72,7 +72,7 @@ float BKE_brush_curve_strength(struct Brush *br, float p, const float len); /* u
float BKE_brush_sample_tex_3D(const Scene *scene, struct Brush *br, const float point[3], float BKE_brush_sample_tex_3D(const Scene *scene, struct Brush *br, const float point[3],
float rgba[4], const int thread, struct ImagePool *pool); float rgba[4], const int thread, struct ImagePool *pool);
float BKE_brush_sample_tex_2D(const struct Scene *scene, struct Brush *brush, const float xy[2], float BKE_brush_sample_tex_2D(const struct Scene *scene, struct Brush *brush, const float xy[2],
float rgba[4], struct ImagePool *pool); float rgba[4]);
void BKE_brush_imbuf_new(const struct Scene *scene, struct Brush *brush, short flt, short texfalloff, int size, void BKE_brush_imbuf_new(const struct Scene *scene, struct Brush *brush, short flt, short texfalloff, int size,
struct ImBuf **imbuf, int use_color_correction); struct ImBuf **imbuf, int use_color_correction);

@ -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,

@ -81,7 +81,7 @@ struct BMesh *BKE_mesh_to_bmesh(struct Mesh *me, struct Object *ob);
int BKE_mesh_recalc_tessellation(struct CustomData *fdata, struct CustomData *ldata, struct CustomData *pdata, int BKE_mesh_recalc_tessellation(struct CustomData *fdata, struct CustomData *ldata, struct CustomData *pdata,
struct MVert *mvert, struct MVert *mvert,
int totface, int totloop, int totpoly, int totface, int totloop, int totpoly,
const int do_face_normals); const bool do_face_normals);
/* for forwards compat only quad->tri polys to mface, skip ngons. /* for forwards compat only quad->tri polys to mface, skip ngons.
*/ */
@ -150,7 +150,7 @@ void BKE_mesh_free(struct Mesh *me, int unlink);
struct Mesh *BKE_mesh_add(struct Main *bmain, const char *name); struct Mesh *BKE_mesh_add(struct Main *bmain, const char *name);
struct Mesh *BKE_mesh_copy_ex(struct Main *bmain, struct Mesh *me); struct Mesh *BKE_mesh_copy_ex(struct Main *bmain, struct Mesh *me);
struct Mesh *BKE_mesh_copy(struct Mesh *me); struct Mesh *BKE_mesh_copy(struct Mesh *me);
void mesh_update_customdata_pointers(struct Mesh *me, const short do_ensure_tess_cd); void BKE_mesh_update_customdata_pointers(struct Mesh *me, const bool do_ensure_tess_cd);
void BKE_mesh_make_local(struct Mesh *me); void BKE_mesh_make_local(struct Mesh *me);
void BKE_mesh_boundbox_calc(struct Mesh *me, float r_loc[3], float r_size[3]); void BKE_mesh_boundbox_calc(struct Mesh *me, float r_loc[3], float r_size[3]);
@ -159,7 +159,7 @@ float (*BKE_mesh_orco_verts_get(struct Object *ob))[3];
void BKE_mesh_orco_verts_transform(struct Mesh *me, float (*orco)[3], int totvert, int invert); void BKE_mesh_orco_verts_transform(struct Mesh *me, float (*orco)[3], int totvert, int invert);
int test_index_face(struct MFace *mface, struct CustomData *mfdata, int mfindex, int nr); int test_index_face(struct MFace *mface, struct CustomData *mfdata, int mfindex, int nr);
struct Mesh *BKE_mesh_from_object(struct Object *ob); struct Mesh *BKE_mesh_from_object(struct Object *ob);
void set_mesh(struct Object *ob, struct Mesh *me); void BKE_mesh_assign_object(struct Object *ob, struct Mesh *me);
void BKE_mesh_from_metaball(struct ListBase *lb, struct Mesh *me); void BKE_mesh_from_metaball(struct ListBase *lb, struct Mesh *me);
int BKE_mesh_nurbs_to_mdata(struct Object *ob, struct MVert **allvert, int *totvert, int BKE_mesh_nurbs_to_mdata(struct Object *ob, struct MVert **allvert, int *totvert,
struct MEdge **alledge, int *totedge, struct MLoop **allloop, struct MPoly **allpoly, struct MEdge **alledge, int *totedge, struct MLoop **allloop, struct MPoly **allpoly,
@ -167,7 +167,7 @@ int BKE_mesh_nurbs_to_mdata(struct Object *ob, struct MVert **allvert, int *tot
int BKE_mesh_nurbs_displist_to_mdata(struct Object *ob, struct ListBase *dispbase, struct MVert **allvert, int *_totvert, int BKE_mesh_nurbs_displist_to_mdata(struct Object *ob, struct ListBase *dispbase, struct MVert **allvert, int *_totvert,
struct MEdge **alledge, int *_totedge, struct MLoop **allloop, struct MPoly **allpoly, struct MEdge **alledge, int *_totedge, struct MLoop **allloop, struct MPoly **allpoly,
struct MLoopUV **alluv, int *_totloop, int *_totpoly); struct MLoopUV **alluv, int *_totloop, int *_totpoly);
void BKE_mesh_from_nurbs_displist(struct Object *ob, struct ListBase *dispbase, int use_orco_uv); void BKE_mesh_from_nurbs_displist(struct Object *ob, struct ListBase *dispbase, const bool use_orco_uv);
void BKE_mesh_from_nurbs(struct Object *ob); void BKE_mesh_from_nurbs(struct Object *ob);
void BKE_mesh_to_curve_nurblist(struct DerivedMesh *dm, struct ListBase *nurblist, const int edge_users_test); void BKE_mesh_to_curve_nurblist(struct DerivedMesh *dm, struct ListBase *nurblist, const int edge_users_test);
void BKE_mesh_to_curve(struct Scene *scene, struct Object *ob); void BKE_mesh_to_curve(struct Scene *scene, struct Object *ob);
@ -221,7 +221,7 @@ void BKE_mesh_calc_normals(
/* Return a newly MEM_malloc'd array of all the mesh vertex locations /* Return a newly MEM_malloc'd array of all the mesh vertex locations
* (_numVerts_r_ may be NULL) */ * (_numVerts_r_ may be NULL) */
float (*mesh_getVertexCos(struct Mesh *me, int *numVerts_r))[3]; float (*mesh_getVertexCos(struct Mesh *me, int *r_numVerts))[3];
/* map from uv vertex to face (for select linked, stitch, uv suburf) */ /* map from uv vertex to face (for select linked, stitch, uv suburf) */
@ -280,7 +280,7 @@ typedef struct UvElementMap {
* to make that many islands, he can bite me :p */ * to make that many islands, he can bite me :p */
#define INVALID_ISLAND 0xFFFF #define INVALID_ISLAND 0xFFFF
UvVertMap *BKE_mesh_uv_vert_map_make(struct MPoly *mpoly, struct MLoop *mloop, struct MLoopUV *mloopuv, UvVertMap *BKE_mesh_uv_vert_map_create(struct MPoly *mpoly, struct MLoop *mloop, struct MLoopUV *mloopuv,
unsigned int totpoly, unsigned int totvert, int selected, float *limit); unsigned int totpoly, unsigned int totvert, int selected, float *limit);
UvMapVert *BKE_mesh_uv_vert_map_get_vert(UvVertMap *vmap, unsigned int v); UvMapVert *BKE_mesh_uv_vert_map_get_vert(UvVertMap *vmap, unsigned int v);
void BKE_mesh_uv_vert_map_free(UvVertMap *vmap); void BKE_mesh_uv_vert_map_free(UvVertMap *vmap);
@ -296,12 +296,12 @@ typedef struct IndexNode {
int index; int index;
} IndexNode; } IndexNode;
void create_vert_poly_map(MeshElemMap **map, int **mem, void BKE_mesh_vert_poly_map_create(MeshElemMap **map, int **mem,
const struct MPoly *mface, const struct MLoop *mloop, const struct MPoly *mface, const struct MLoop *mloop,
int totvert, int totface, int totloop); int totvert, int totface, int totloop);
void create_vert_edge_map(MeshElemMap **map, int **mem, void BKE_mesh_vert_edge_map_create(MeshElemMap **map, int **mem,
const struct MEdge *medge, int totvert, int totedge); const struct MEdge *medge, int totvert, int totedge);
/* vertex level transformations & checks (no derived mesh) */ /* vertex level transformations & checks (no derived mesh) */
@ -309,7 +309,7 @@ int BKE_mesh_minmax(struct Mesh *me, float r_min[3], float r_max[3]);
int BKE_mesh_center_median(struct Mesh *me, float cent[3]); int BKE_mesh_center_median(struct Mesh *me, float cent[3]);
int BKE_mesh_center_bounds(struct Mesh *me, float cent[3]); int BKE_mesh_center_bounds(struct Mesh *me, float cent[3]);
int BKE_mesh_center_centroid(struct Mesh *me, float cent[3]); int BKE_mesh_center_centroid(struct Mesh *me, float cent[3]);
void BKE_mesh_translate(struct Mesh *me, float offset[3], int do_keys); void BKE_mesh_translate(struct Mesh *me, const float offset[3], const bool do_keys);
/* mesh_validate.c */ /* mesh_validate.c */
/* XXX Loop v/e are unsigned, so using max uint_32 value as invalid marker... */ /* XXX Loop v/e are unsigned, so using max uint_32 value as invalid marker... */
@ -322,8 +322,8 @@ int BKE_mesh_validate_arrays(
struct MLoop *mloops, unsigned int totloop, struct MLoop *mloops, unsigned int totloop,
struct MPoly *mpolys, unsigned int totpoly, struct MPoly *mpolys, unsigned int totpoly,
struct MDeformVert *dverts, /* assume totvert length */ struct MDeformVert *dverts, /* assume totvert length */
const short do_verbose, const short do_fixes); const bool do_verbose, const bool do_fixes);
int BKE_mesh_validate(struct Mesh *me, int do_verbose); int BKE_mesh_validate(struct Mesh *me, const int do_verbose);
int BKE_mesh_validate_dm(struct DerivedMesh *dm); int BKE_mesh_validate_dm(struct DerivedMesh *dm);
void BKE_mesh_calc_edges(struct Mesh *mesh, bool update, const bool select); void BKE_mesh_calc_edges(struct Mesh *mesh, bool update, const bool select);

@ -542,7 +542,7 @@ void DM_to_mesh(DerivedMesh *dm, Mesh *me, Object *ob)
} }
/* yes, must be before _and_ after tessellate */ /* yes, must be before _and_ after tessellate */
mesh_update_customdata_pointers(&tmp, false); BKE_mesh_update_customdata_pointers(&tmp, false);
/* since 2.65 caller must do! */ /* since 2.65 caller must do! */
// BKE_mesh_tessface_calc(&tmp); // BKE_mesh_tessface_calc(&tmp);

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

@ -563,7 +563,7 @@ float BKE_brush_sample_tex_3D(const Scene *scene, Brush *br,
/* Brush Sampling for 2D brushes. when we unify the brush systems this will be necessarily a separate function */ /* Brush Sampling for 2D brushes. when we unify the brush systems this will be necessarily a separate function */
float BKE_brush_sample_tex_2D(const Scene *scene, Brush *brush, const float xy[2], float rgba[4], struct ImagePool *pool) float BKE_brush_sample_tex_2D(const Scene *scene, Brush *brush, const float xy[2], float rgba[4])
{ {
UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings; UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;
MTex *mtex = &brush->mtex; MTex *mtex = &brush->mtex;
@ -598,7 +598,7 @@ float BKE_brush_sample_tex_2D(const Scene *scene, Brush *brush, const float xy[2
co[1] = y + brush->mtex.ofs[1]; co[1] = y + brush->mtex.ofs[1];
co[2] = 0.0f; co[2] = 0.0f;
hasrgb = externtex(mtex, co, &tin, &tr, &tg, &tb, &ta, 0, pool); hasrgb = externtex(mtex, co, &tin, &tr, &tg, &tb, &ta, 0, NULL);
if (hasrgb) { if (hasrgb) {
rgba[0] = tr; rgba[0] = tr;
@ -660,15 +660,15 @@ void BKE_brush_imbuf_new(const Scene *scene, Brush *brush, short flt, short texf
dstf[3] = alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius); dstf[3] = alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius);
} }
else if (texfall == 1) { else if (texfall == 1) {
BKE_brush_sample_tex_2D(scene, brush, xy, dstf, 0); BKE_brush_sample_tex_2D(scene, brush, xy, dstf);
} }
else if (texfall == 2) { else if (texfall == 2) {
BKE_brush_sample_tex_2D(scene, brush, xy, rgba, 0); BKE_brush_sample_tex_2D(scene, brush, xy, rgba);
mul_v3_v3v3(dstf, rgba, brush_rgb); mul_v3_v3v3(dstf, rgba, brush_rgb);
dstf[3] = rgba[3] * alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius); dstf[3] = rgba[3] * alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius);
} }
else { else {
BKE_brush_sample_tex_2D(scene, brush, xy, rgba, 0); BKE_brush_sample_tex_2D(scene, brush, xy, rgba);
copy_v3_v3(dstf, brush_rgb); copy_v3_v3(dstf, brush_rgb);
dstf[3] = rgba[3] * alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius); dstf[3] = rgba[3] * alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius);
} }
@ -695,11 +695,11 @@ void BKE_brush_imbuf_new(const Scene *scene, Brush *brush, short flt, short texf
dst[3] = FTOCHAR(alpha_f); dst[3] = FTOCHAR(alpha_f);
} }
else if (texfall == 1) { else if (texfall == 1) {
BKE_brush_sample_tex_2D(scene, brush, xy, rgba, 0); BKE_brush_sample_tex_2D(scene, brush, xy, rgba);
rgba_float_to_uchar(dst, rgba); rgba_float_to_uchar(dst, rgba);
} }
else if (texfall == 2) { else if (texfall == 2) {
BKE_brush_sample_tex_2D(scene, brush, xy, rgba, 0); BKE_brush_sample_tex_2D(scene, brush, xy, rgba);
mul_v3_v3(rgba, brush->rgb); mul_v3_v3(rgba, brush->rgb);
alpha_f = rgba[3] * alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius); alpha_f = rgba[3] * alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius);
@ -708,7 +708,7 @@ void BKE_brush_imbuf_new(const Scene *scene, Brush *brush, short flt, short texf
dst[3] = FTOCHAR(alpha_f); dst[3] = FTOCHAR(alpha_f);
} }
else { else {
BKE_brush_sample_tex_2D(scene, brush, xy, rgba, 0); BKE_brush_sample_tex_2D(scene, brush, xy, rgba);
alpha_f = rgba[3] * alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius); alpha_f = rgba[3] * alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius);
dst[0] = crgb[0]; dst[0] = crgb[0];

@ -215,7 +215,7 @@ static const MeshElemMap *cdDM_getPolyMap(Object *ob, DerivedMesh *dm)
if (!cddm->pmap && ob->type == OB_MESH) { if (!cddm->pmap && ob->type == OB_MESH) {
Mesh *me = ob->data; Mesh *me = ob->data;
create_vert_poly_map(&cddm->pmap, &cddm->pmap_mem, BKE_mesh_vert_poly_map_create(&cddm->pmap, &cddm->pmap_mem,
me->mpoly, me->mloop, me->mpoly, me->mloop,
me->totvert, me->totpoly, me->totloop); me->totvert, me->totpoly, me->totloop);
} }

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

@ -348,7 +348,7 @@ static void mesh_ensure_tessellation_customdata(Mesh *me)
* note that for undo mesh data we want to skip 'ensure_tess_cd' call since * note that for undo mesh data we want to skip 'ensure_tess_cd' call since
* we don't want to store memory for tessface when its only used for older * we don't want to store memory for tessface when its only used for older
* versions of the mesh. - campbell*/ * versions of the mesh. - campbell*/
static void mesh_update_linked_customdata(Mesh *me, const short do_ensure_tess_cd) static void mesh_update_linked_customdata(Mesh *me, const bool do_ensure_tess_cd)
{ {
if (me->edit_btmesh) if (me->edit_btmesh)
BMEdit_UpdateLinkedCustomData(me->edit_btmesh); BMEdit_UpdateLinkedCustomData(me->edit_btmesh);
@ -360,7 +360,7 @@ static void mesh_update_linked_customdata(Mesh *me, const short do_ensure_tess_c
CustomData_bmesh_update_active_layers(&me->fdata, &me->pdata, &me->ldata); CustomData_bmesh_update_active_layers(&me->fdata, &me->pdata, &me->ldata);
} }
void mesh_update_customdata_pointers(Mesh *me, const short do_ensure_tess_cd) void BKE_mesh_update_customdata_pointers(Mesh *me, const bool do_ensure_tess_cd)
{ {
mesh_update_linked_customdata(me, do_ensure_tess_cd); mesh_update_linked_customdata(me, do_ensure_tess_cd);
@ -493,7 +493,7 @@ Mesh *BKE_mesh_copy_ex(Main *bmain, Mesh *me)
mesh_tessface_clear_intern(men, FALSE); mesh_tessface_clear_intern(men, FALSE);
} }
mesh_update_customdata_pointers(men, do_tessface); BKE_mesh_update_customdata_pointers(men, do_tessface);
/* ensure indirect linked data becomes lib-extern */ /* ensure indirect linked data becomes lib-extern */
for (i = 0; i < me->fdata.totlayer; i++) { for (i = 0; i < me->fdata.totlayer; i++) {
@ -622,7 +622,7 @@ void BKE_mesh_make_local(Mesh *me)
for (ob = bmain->object.first; ob; ob = ob->id.next) { for (ob = bmain->object.first; ob; ob = ob->id.next) {
if (me == ob->data) { if (me == ob->data) {
if (ob->id.lib == NULL) { if (ob->id.lib == NULL) {
set_mesh(ob, me_new); BKE_mesh_assign_object(ob, me_new);
} }
} }
} }
@ -825,7 +825,7 @@ Mesh *BKE_mesh_from_object(Object *ob)
else return NULL; else return NULL;
} }
void set_mesh(Object *ob, Mesh *me) void BKE_mesh_assign_object(Object *ob, Mesh *me)
{ {
Mesh *old = NULL; Mesh *old = NULL;
@ -1194,7 +1194,7 @@ void BKE_mesh_from_metaball(ListBase *lb, Mesh *me)
index += 4; index += 4;
} }
mesh_update_customdata_pointers(me, TRUE); BKE_mesh_update_customdata_pointers(me, true);
BKE_mesh_calc_normals(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL); BKE_mesh_calc_normals(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL);
@ -1477,7 +1477,7 @@ int BKE_mesh_nurbs_displist_to_mdata(Object *ob, ListBase *dispbase,
/* this may fail replacing ob->data, be sure to check ob->type */ /* this may fail replacing ob->data, be sure to check ob->type */
void BKE_mesh_from_nurbs_displist(Object *ob, ListBase *dispbase, int use_orco_uv) void BKE_mesh_from_nurbs_displist(Object *ob, ListBase *dispbase, const bool use_orco_uv)
{ {
Main *bmain = G.main; Main *bmain = G.main;
Object *ob1; Object *ob1;
@ -2063,7 +2063,7 @@ void BKE_mesh_convert_mfaces_to_mpolys(Mesh *mesh)
mesh->medge, mesh->mface, mesh->medge, mesh->mface,
&mesh->totloop, &mesh->totpoly, &mesh->mloop, &mesh->mpoly); &mesh->totloop, &mesh->totpoly, &mesh->mloop, &mesh->mpoly);
mesh_update_customdata_pointers(mesh, TRUE); BKE_mesh_update_customdata_pointers(mesh, true);
} }
/* the same as BKE_mesh_convert_mfaces_to_mpolys but oriented to be used in do_versions from readfile.c /* the same as BKE_mesh_convert_mfaces_to_mpolys but oriented to be used in do_versions from readfile.c
@ -2085,7 +2085,7 @@ void BKE_mesh_do_versions_convert_mfaces_to_mpolys(Mesh *mesh)
CustomData_bmesh_do_versions_update_active_layers(&mesh->fdata, &mesh->pdata, &mesh->ldata); CustomData_bmesh_do_versions_update_active_layers(&mesh->fdata, &mesh->pdata, &mesh->ldata);
mesh_update_customdata_pointers(mesh, TRUE); BKE_mesh_update_customdata_pointers(mesh, true);
} }
void BKE_mesh_convert_mfaces_to_mpolys_ex(ID *id, CustomData *fdata, CustomData *ldata, CustomData *pdata, void BKE_mesh_convert_mfaces_to_mpolys_ex(ID *id, CustomData *fdata, CustomData *ldata, CustomData *pdata,
@ -2190,12 +2190,12 @@ void BKE_mesh_convert_mfaces_to_mpolys_ex(ID *id, CustomData *fdata, CustomData
*mloop_r = mloop; *mloop_r = mloop;
} }
float (*mesh_getVertexCos(Mesh * me, int *numVerts_r))[3] float (*mesh_getVertexCos(Mesh * me, int *r_numVerts))[3]
{ {
int i, numVerts = me->totvert; int i, numVerts = me->totvert;
float (*cos)[3] = MEM_mallocN(sizeof(*cos) * numVerts, "vertexcos1"); float (*cos)[3] = MEM_mallocN(sizeof(*cos) * numVerts, "vertexcos1");
if (numVerts_r) *numVerts_r = numVerts; if (r_numVerts) *r_numVerts = numVerts;
for (i = 0; i < numVerts; i++) for (i = 0; i < numVerts; i++)
copy_v3_v3(cos[i], me->mvert[i].co); copy_v3_v3(cos[i], me->mvert[i].co);
@ -2207,7 +2207,8 @@ float (*mesh_getVertexCos(Mesh * me, int *numVerts_r))[3]
/* this replaces the non bmesh function (in trunk) which takes MTFace's, if we ever need it back we could /* this replaces the non bmesh function (in trunk) which takes MTFace's, if we ever need it back we could
* but for now this replaces it because its unused. */ * but for now this replaces it because its unused. */
UvVertMap *BKE_mesh_uv_vert_map_make(struct MPoly *mpoly, struct MLoop *mloop, struct MLoopUV *mloopuv, unsigned int totpoly, unsigned int totvert, int selected, float *limit) UvVertMap *BKE_mesh_uv_vert_map_create(struct MPoly *mpoly, struct MLoop *mloop, struct MLoopUV *mloopuv,
unsigned int totpoly, unsigned int totvert, int selected, float *limit)
{ {
UvVertMap *vmap; UvVertMap *vmap;
UvMapVert *buf; UvMapVert *buf;
@ -2315,9 +2316,9 @@ void BKE_mesh_uv_vert_map_free(UvVertMap *vmap)
/* Generates a map where the key is the vertex and the value is a list /* Generates a map where the key is the vertex and the value is a list
* of polys that use that vertex as a corner. The lists are allocated * of polys that use that vertex as a corner. The lists are allocated
* from one memory pool. */ * from one memory pool. */
void create_vert_poly_map(MeshElemMap **map, int **mem, void BKE_mesh_vert_poly_map_create(MeshElemMap **map, int **mem,
const MPoly *mpoly, const MLoop *mloop, const MPoly *mpoly, const MLoop *mloop,
int totvert, int totpoly, int totloop) int totvert, int totpoly, int totloop)
{ {
int i, j; int i, j;
int *indices; int *indices;
@ -2359,8 +2360,8 @@ void create_vert_poly_map(MeshElemMap **map, int **mem,
/* Generates a map where the key is the vertex and the value is a list /* Generates a map where the key is the vertex and the value is a list
* of edges that use that vertex as an endpoint. The lists are allocated * of edges that use that vertex as an endpoint. The lists are allocated
* from one memory pool. */ * from one memory pool. */
void create_vert_edge_map(MeshElemMap **map, int **mem, void BKE_mesh_vert_edge_map_create(MeshElemMap **map, int **mem,
const MEdge *medge, int totvert, int totedge) const MEdge *medge, int totvert, int totedge)
{ {
int i, *indices; int i, *indices;
@ -2465,7 +2466,7 @@ int BKE_mesh_recalc_tessellation(CustomData *fdata,
int totpoly, int totpoly,
/* when tessellating to recalculate normals after /* when tessellating to recalculate normals after
* we can skip copying here */ * we can skip copying here */
const int do_face_nor_cpy) const bool do_face_nor_cpy)
{ {
/* use this to avoid locking pthread for _every_ polygon /* use this to avoid locking pthread for _every_ polygon
* and calling the fill function */ * and calling the fill function */
@ -3335,7 +3336,7 @@ int BKE_mesh_center_centroid(Mesh *me, float cent[3])
return (me->totpoly != 0); return (me->totpoly != 0);
} }
void BKE_mesh_translate(Mesh *me, float offset[3], int do_keys) void BKE_mesh_translate(Mesh *me, const float offset[3], const bool do_keys)
{ {
int i = me->totvert; int i = me->totvert;
MVert *mvert; MVert *mvert;
@ -3374,9 +3375,9 @@ void BKE_mesh_tessface_calc(Mesh *mesh)
mesh->mvert, mesh->mvert,
mesh->totface, mesh->totloop, mesh->totpoly, mesh->totface, mesh->totloop, mesh->totpoly,
/* calc normals right after, don't copy from polys here */ /* calc normals right after, don't copy from polys here */
FALSE); false);
mesh_update_customdata_pointers(mesh, TRUE); BKE_mesh_update_customdata_pointers(mesh, true);
} }
void BKE_mesh_tessface_ensure(Mesh *mesh) void BKE_mesh_tessface_ensure(Mesh *mesh)

@ -190,13 +190,13 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
MLoop *mloops, unsigned int totloop, MLoop *mloops, unsigned int totloop,
MPoly *mpolys, unsigned int totpoly, MPoly *mpolys, unsigned int totpoly,
MDeformVert *dverts, /* assume totvert length */ MDeformVert *dverts, /* assume totvert length */
const short do_verbose, const short do_fixes) const bool do_verbose, const bool do_fixes)
{ {
# define REMOVE_EDGE_TAG(_me) { _me->v2 = _me->v1; do_edge_free = TRUE; } (void)0 # define REMOVE_EDGE_TAG(_me) { _me->v2 = _me->v1; do_edge_free = true; } (void)0
# define IS_REMOVED_EDGE(_me) (_me->v2 == _me->v1) # define IS_REMOVED_EDGE(_me) (_me->v2 == _me->v1)
# define REMOVE_LOOP_TAG(_ml) { _ml->e = INVALID_LOOP_EDGE_MARKER; do_polyloop_free = TRUE; } (void)0 # define REMOVE_LOOP_TAG(_ml) { _ml->e = INVALID_LOOP_EDGE_MARKER; do_polyloop_free = true; } (void)0
# define REMOVE_POLY_TAG(_mp) { _mp->totloop *= -1; do_polyloop_free = TRUE; } (void)0 # define REMOVE_POLY_TAG(_mp) { _mp->totloop *= -1; do_polyloop_free = true; } (void)0
MVert *mv = mverts; MVert *mv = mverts;
MEdge *me; MEdge *me;
@ -205,15 +205,15 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
unsigned int i, j; unsigned int i, j;
int *v; int *v;
short do_edge_free = FALSE; bool do_edge_free = false;
short do_face_free = FALSE; bool do_face_free = false;
short do_polyloop_free = FALSE; /* This regroups loops and polys! */ bool do_polyloop_free = false; /* This regroups loops and polys! */
short verts_fixed = FALSE; bool verts_fixed = false;
short vert_weights_fixed = FALSE; bool vert_weights_fixed = false;
int msel_fixed = FALSE; bool msel_fixed = false;
int do_edge_recalc = FALSE; bool do_edge_recalc = false;
EdgeHash *edge_hash = BLI_edgehash_new(); EdgeHash *edge_hash = BLI_edgehash_new();
@ -825,7 +825,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
return (verts_fixed || vert_weights_fixed || do_polyloop_free || do_edge_free || do_edge_recalc || msel_fixed); return (verts_fixed || vert_weights_fixed || do_polyloop_free || do_edge_free || do_edge_recalc || msel_fixed);
} }
static int mesh_validate_customdata(CustomData *data, short do_verbose, const short do_fixes) static int mesh_validate_customdata(CustomData *data, const bool do_verbose, const bool do_fixes)
{ {
int i = 0, has_fixes = 0; int i = 0, has_fixes = 0;
@ -859,7 +859,7 @@ static int mesh_validate_customdata(CustomData *data, short do_verbose, const sh
static int BKE_mesh_validate_all_customdata(CustomData *vdata, CustomData *edata, static int BKE_mesh_validate_all_customdata(CustomData *vdata, CustomData *edata,
CustomData *ldata, CustomData *pdata, CustomData *ldata, CustomData *pdata,
short do_verbose, const short do_fixes) const bool do_verbose, const short do_fixes)
{ {
int vfixed = 0, efixed = 0, lfixed = 0, pfixed = 0; int vfixed = 0, efixed = 0, lfixed = 0, pfixed = 0;
@ -871,7 +871,7 @@ static int BKE_mesh_validate_all_customdata(CustomData *vdata, CustomData *edata
return vfixed || efixed || lfixed || pfixed; return vfixed || efixed || lfixed || pfixed;
} }
int BKE_mesh_validate(Mesh *me, int do_verbose) int BKE_mesh_validate(Mesh *me, const int do_verbose)
{ {
int layers_fixed = 0, arrays_fixed = 0; int layers_fixed = 0, arrays_fixed = 0;
@ -887,13 +887,13 @@ int BKE_mesh_validate(Mesh *me, int do_verbose)
me->mloop, me->totloop, me->mloop, me->totloop,
me->mpoly, me->totpoly, me->mpoly, me->totpoly,
me->dvert, me->dvert,
do_verbose, TRUE); do_verbose, true);
if (layers_fixed || arrays_fixed) { if (layers_fixed || arrays_fixed) {
DAG_id_tag_update(&me->id, OB_RECALC_DATA); DAG_id_tag_update(&me->id, OB_RECALC_DATA);
return TRUE; return true;
} }
return FALSE; return false;
} }
int BKE_mesh_validate_dm(DerivedMesh *dm) int BKE_mesh_validate_dm(DerivedMesh *dm)

@ -1288,14 +1288,14 @@ void pbvh_bmesh_print(PBVH *bvh)
fprintf(stderr, "bm_face_to_node:\n"); fprintf(stderr, "bm_face_to_node:\n");
GHASH_ITER (gh_iter, bvh->bm_face_to_node) { GHASH_ITER (gh_iter, bvh->bm_face_to_node) {
fprintf(stderr, " %d -> %d\n", fprintf(stderr, " %d -> %d\n",
BM_elem_index_get((BMFace*)BLI_ghashIterator_getKey(&gh_iter)), BM_elem_index_get((BMFace *)BLI_ghashIterator_getKey(&gh_iter)),
GET_INT_FROM_POINTER(BLI_ghashIterator_getValue(&gh_iter))); GET_INT_FROM_POINTER(BLI_ghashIterator_getValue(&gh_iter)));
} }
fprintf(stderr, "bm_vert_to_node:\n"); fprintf(stderr, "bm_vert_to_node:\n");
GHASH_ITER (gh_iter, bvh->bm_vert_to_node) { GHASH_ITER (gh_iter, bvh->bm_vert_to_node) {
fprintf(stderr, " %d -> %d\n", fprintf(stderr, " %d -> %d\n",
BM_elem_index_get((BMVert*)BLI_ghashIterator_getKey(&gh_iter)), BM_elem_index_get((BMVert *)BLI_ghashIterator_getKey(&gh_iter)),
GET_INT_FROM_POINTER(BLI_ghashIterator_getValue(&gh_iter))); GET_INT_FROM_POINTER(BLI_ghashIterator_getValue(&gh_iter)));
} }
@ -1307,15 +1307,15 @@ void pbvh_bmesh_print(PBVH *bvh)
fprintf(stderr, "node %d\n faces:\n", n); fprintf(stderr, "node %d\n faces:\n", n);
GHASH_ITER (gh_iter, node->bm_faces) GHASH_ITER (gh_iter, node->bm_faces)
fprintf(stderr, " %d\n", fprintf(stderr, " %d\n",
BM_elem_index_get((BMFace*)BLI_ghashIterator_getKey(&gh_iter))); BM_elem_index_get((BMFace *)BLI_ghashIterator_getKey(&gh_iter)));
fprintf(stderr, " unique verts:\n"); fprintf(stderr, " unique verts:\n");
GHASH_ITER (gh_iter, node->bm_unique_verts) GHASH_ITER (gh_iter, node->bm_unique_verts)
fprintf(stderr, " %d\n", fprintf(stderr, " %d\n",
BM_elem_index_get((BMVert*)BLI_ghashIterator_getKey(&gh_iter))); BM_elem_index_get((BMVert *)BLI_ghashIterator_getKey(&gh_iter)));
fprintf(stderr, " other verts:\n"); fprintf(stderr, " other verts:\n");
GHASH_ITER (gh_iter, node->bm_other_verts) GHASH_ITER (gh_iter, node->bm_other_verts)
fprintf(stderr, " %d\n", fprintf(stderr, " %d\n",
BM_elem_index_get((BMVert*)BLI_ghashIterator_getKey(&gh_iter))); BM_elem_index_get((BMVert *)BLI_ghashIterator_getKey(&gh_iter)));
} }
} }

@ -295,7 +295,7 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm,
float uv[3] = {0.0f, 0.0f, 0.0f}; /* only first 2 values are written into */ float uv[3] = {0.0f, 0.0f, 0.0f}; /* only first 2 values are written into */
limit[0] = limit[1] = STD_UV_CONNECT_LIMIT; limit[0] = limit[1] = STD_UV_CONNECT_LIMIT;
vmap = BKE_mesh_uv_vert_map_make(mpoly, mloop, mloopuv, totface, totvert, 0, limit); vmap = BKE_mesh_uv_vert_map_create(mpoly, mloop, mloopuv, totface, totvert, 0, limit);
if (!vmap) if (!vmap)
return 0; return 0;
@ -2985,7 +2985,7 @@ static const MeshElemMap *ccgDM_getPolyMap(Object *ob, DerivedMesh *dm)
if (!ccgdm->multires.mmd && !ccgdm->pmap && ob->type == OB_MESH) { if (!ccgdm->multires.mmd && !ccgdm->pmap && ob->type == OB_MESH) {
Mesh *me = ob->data; Mesh *me = ob->data;
create_vert_poly_map(&ccgdm->pmap, &ccgdm->pmap_mem, BKE_mesh_vert_poly_map_create(&ccgdm->pmap, &ccgdm->pmap_mem,
me->mpoly, me->mloop, me->mpoly, me->mloop,
me->totvert, me->totpoly, me->totloop); me->totvert, me->totpoly, me->totloop);
} }

@ -86,10 +86,10 @@ void BLI_setenv_if_new(const char *env, const char *val);
void BLI_make_file_string(const char *relabase, char *string, const char *dir, const char *file); void BLI_make_file_string(const char *relabase, char *string, const char *dir, const char *file);
void BLI_make_exist(char *dir); void BLI_make_exist(char *dir);
void BLI_make_existing_file(const char *name); void BLI_make_existing_file(const char *name);
void BLI_split_dirfile(const char *string, char *dir, char *file, size_t dirlen, size_t filelen); void BLI_split_dirfile(const char *string, char *dir, char *file, const size_t dirlen, const size_t filelen);
void BLI_split_dir_part(const char *string, char *dir, size_t dirlen); void BLI_split_dir_part(const char *string, char *dir, const size_t dirlen);
void BLI_split_file_part(const char *string, char *file, size_t filelen); void BLI_split_file_part(const char *string, char *file, const size_t filelen);
void BLI_join_dirfile(char *string, size_t maxlen, const char *dir, const char *file); void BLI_join_dirfile(char *string, const size_t maxlen, const char *dir, const char *file);
const char *BLI_path_basename(const char *path); const char *BLI_path_basename(const char *path);
typedef enum bli_rebase_state { typedef enum bli_rebase_state {
@ -105,7 +105,7 @@ int BLI_add_slash(char *string);
void BLI_del_slash(char *string); void BLI_del_slash(char *string);
const char *BLI_first_slash(const char *string); const char *BLI_first_slash(const char *string);
void BLI_getlastdir(const char *dir, char *last, size_t maxlen); void BLI_getlastdir(const char *dir, char *last, const size_t maxlen);
bool BLI_testextensie(const char *str, const char *ext); bool BLI_testextensie(const char *str, const char *ext);
bool BLI_testextensie_array(const char *str, const char **ext_array); bool BLI_testextensie_array(const char *str, const char **ext_array);
bool BLI_testextensie_glob(const char *str, const char *ext_fnmatch); bool BLI_testextensie_glob(const char *str, const char *ext_fnmatch);
@ -117,7 +117,7 @@ bool BLI_uniquename_cb(bool (*unique_check)(void * arg, const char * name),
void BLI_newname(char *name, int add); void BLI_newname(char *name, int add);
int BLI_stringdec(const char *string, char *head, char *start, unsigned short *numlen); int BLI_stringdec(const char *string, char *head, char *start, unsigned short *numlen);
void BLI_stringenc(char *string, const char *head, const char *tail, unsigned short numlen, int pic); void BLI_stringenc(char *string, const char *head, const char *tail, unsigned short numlen, int pic);
int BLI_split_name_num(char *left, int *nr, const char *name, char delim); int BLI_split_name_num(char *left, int *nr, const char *name, const char delim);
/* make sure path separators conform to system one */ /* make sure path separators conform to system one */
void BLI_clean(char *path) void BLI_clean(char *path)

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

@ -1044,7 +1044,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"));
@ -1052,7 +1052,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;
@ -1109,7 +1109,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);

@ -453,7 +453,7 @@ static void customdata_version_242(Mesh *me)
} }
} }
mesh_update_customdata_pointers(me, TRUE); BKE_mesh_update_customdata_pointers(me, true);
} }
/*only copy render texface layer from active*/ /*only copy render texface layer from active*/

@ -1872,7 +1872,7 @@ static void write_meshs(WriteData *wd, ListBase *idbase)
mesh->totface = BKE_mesh_mpoly_to_mface(&mesh->fdata, &backup_mesh.ldata, &backup_mesh.pdata, mesh->totface = BKE_mesh_mpoly_to_mface(&mesh->fdata, &backup_mesh.ldata, &backup_mesh.pdata,
mesh->totface, backup_mesh.totloop, backup_mesh.totpoly); mesh->totface, backup_mesh.totloop, backup_mesh.totpoly);
mesh_update_customdata_pointers(mesh, FALSE); BKE_mesh_update_customdata_pointers(mesh, false);
writestruct(wd, ID_ME, "Mesh", 1, mesh); writestruct(wd, ID_ME, "Mesh", 1, mesh);
@ -1909,7 +1909,7 @@ static void write_meshs(WriteData *wd, ListBase *idbase)
mesh->totpoly = backup_mesh.totpoly; mesh->totpoly = backup_mesh.totpoly;
mesh->totloop = backup_mesh.totloop; mesh->totloop = backup_mesh.totloop;
/* -- */ /* -- */
mesh_update_customdata_pointers(mesh, FALSE); BKE_mesh_update_customdata_pointers(mesh, false);
/* --*/ /* --*/
mesh->edit_btmesh = backup_mesh.edit_btmesh; /* keep this after updating custom pointers */ mesh->edit_btmesh = backup_mesh.edit_btmesh; /* keep this after updating custom pointers */
/* restore */ /* restore */

@ -756,7 +756,7 @@ void BM_mesh_remap(BMesh *bm, int *vert_idx, int *edge_idx, int *face_idx)
BM_ITER_MESH (ed, &iter, bm, BM_EDGES_OF_MESH) { BM_ITER_MESH (ed, &iter, bm, BM_EDGES_OF_MESH) {
if (vptr_map) { if (vptr_map) {
/* printf("Edge v1: %p -> %p\n", ed->v1, BLI_ghash_lookup(vptr_map, (const void *)ed->v1));*/ /* printf("Edge v1: %p -> %p\n", ed->v1, BLI_ghash_lookup(vptr_map, (const void *)ed->v1));*/
/* printf("Edge v2: %p -> %p\n", ed->v2, BLI_ghash_lookup(vptr_map, (const void* )ed->v2));*/ /* printf("Edge v2: %p -> %p\n", ed->v2, BLI_ghash_lookup(vptr_map, (const void *)ed->v2));*/
ed->v1 = BLI_ghash_lookup(vptr_map, (const void *)ed->v1); ed->v1 = BLI_ghash_lookup(vptr_map, (const void *)ed->v1);
ed->v2 = BLI_ghash_lookup(vptr_map, (const void *)ed->v2); ed->v2 = BLI_ghash_lookup(vptr_map, (const void *)ed->v2);
} }

@ -660,7 +660,7 @@ void BM_mesh_bm_to_me(BMesh *bm, Mesh *me, bool do_tessface)
me->cd_flag = BM_mesh_cd_flag_from_bmesh(bm); me->cd_flag = BM_mesh_cd_flag_from_bmesh(bm);
/* this is called again, 'dotess' arg is used there */ /* this is called again, 'dotess' arg is used there */
mesh_update_customdata_pointers(me, 0); BKE_mesh_update_customdata_pointers(me, 0);
i = 0; i = 0;
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
@ -800,7 +800,7 @@ void BM_mesh_bm_to_me(BMesh *bm, Mesh *me, bool do_tessface)
BKE_mesh_tessface_calc(me); BKE_mesh_tessface_calc(me);
} }
mesh_update_customdata_pointers(me, do_tessface); BKE_mesh_update_customdata_pointers(me, do_tessface);
{ {
BMEditSelection *selected; BMEditSelection *selected;

@ -1087,7 +1087,7 @@ void BM_face_legal_splits(BMesh *bm, BMFace *f, BMLoop *(*loops)[2], int len)
* Small utility functions for fast access * Small utility functions for fast access
* *
* faster alternative to: * faster alternative to:
* BM_iter_as_array(bm, BM_VERTS_OF_FACE, f, (void**)v, 3); * BM_iter_as_array(bm, BM_VERTS_OF_FACE, f, (void **)v, 3);
*/ */
void BM_face_as_array_vert_tri(BMFace *f, BMVert *r_verts[3]) void BM_face_as_array_vert_tri(BMFace *f, BMVert *r_verts[3])
{ {
@ -1102,7 +1102,7 @@ void BM_face_as_array_vert_tri(BMFace *f, BMVert *r_verts[3])
/** /**
* faster alternative to: * faster alternative to:
* BM_iter_as_array(bm, BM_VERTS_OF_FACE, f, (void**)v, 4); * BM_iter_as_array(bm, BM_VERTS_OF_FACE, f, (void **)v, 4);
*/ */
void BM_face_as_array_vert_quad(BMFace *f, BMVert *r_verts[4]) void BM_face_as_array_vert_quad(BMFace *f, BMVert *r_verts[4])
{ {

@ -184,7 +184,7 @@ void AnimationExporter::make_anim_frames_from_targets(Object *ob, std::vector<fl
ListBase *conlist = get_active_constraints(ob); ListBase *conlist = get_active_constraints(ob);
if (conlist == NULL) return; if (conlist == NULL) return;
bConstraint *con; bConstraint *con;
for (con = (bConstraint*)conlist->first; con; con = con->next) { for (con = (bConstraint *)conlist->first; con; con = con->next) {
ListBase targets = {NULL, NULL}; ListBase targets = {NULL, NULL};
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con);
@ -200,7 +200,7 @@ void AnimationExporter::make_anim_frames_from_targets(Object *ob, std::vector<fl
*/ */
cti->get_constraint_targets(con, &targets); cti->get_constraint_targets(con, &targets);
if (cti) { if (cti) {
for (ct = (bConstraintTarget*)targets.first; ct; ct = ct->next) { for (ct = (bConstraintTarget *)targets.first; ct; ct = ct->next) {
obtar = ct->tar; obtar = ct->tar;
find_frames(obtar, frames); find_frames(obtar, frames);
} }
@ -544,7 +544,7 @@ void AnimationExporter::dae_baked_object_animation(std::vector<float> &fra, Obje
if (!fra.size()) if (!fra.size())
return; return;
BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s", (char*)translate_id(ob_name).c_str(), BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s", (char *)translate_id(ob_name).c_str(),
"object_matrix"); "object_matrix");
openAnimation(anim_id, COLLADABU::Utils::EMPTY_STRING); openAnimation(anim_id, COLLADABU::Utils::EMPTY_STRING);
@ -1535,7 +1535,7 @@ void AnimationExporter::calc_ob_mat_at_time(Object *ob, float ctime , float mat[
{ {
ListBase *conlist = get_active_constraints(ob); ListBase *conlist = get_active_constraints(ob);
bConstraint *con; bConstraint *con;
for (con = (bConstraint*)conlist->first; con; con = con->next) { for (con = (bConstraint *)conlist->first; con; con = con->next) {
ListBase targets = {NULL, NULL}; ListBase targets = {NULL, NULL};
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con);
@ -1544,7 +1544,7 @@ void AnimationExporter::calc_ob_mat_at_time(Object *ob, float ctime , float mat[
bConstraintTarget *ct; bConstraintTarget *ct;
Object *obtar; Object *obtar;
cti->get_constraint_targets(con, &targets); cti->get_constraint_targets(con, &targets);
for (ct = (bConstraintTarget*)targets.first; ct; ct = ct->next) { for (ct = (bConstraintTarget *)targets.first; ct; ct = ct->next) {
obtar = ct->tar; obtar = ct->tar;
BKE_animsys_evaluate_animdata(scene, &obtar->id, obtar->adt, ctime, ADT_RECALC_ANIM); BKE_animsys_evaluate_animdata(scene, &obtar->id, obtar->adt, ctime, ADT_RECALC_ANIM);
BKE_object_where_is_calc_time(scene, obtar, ctime); BKE_object_where_is_calc_time(scene, obtar, ctime);

@ -674,7 +674,7 @@ void ArmatureImporter::make_shape_keys()
if (source_ob) { if (source_ob) {
Mesh *source_me = (Mesh*) source_ob->data; Mesh *source_me = (Mesh *)source_ob->data;
//insert key to source mesh //insert key to source mesh
Key *key = source_me->key = BKE_key_add((ID *)source_me); Key *key = source_me->key = BKE_key_add((ID *)source_me);
key->type = KEY_RELATIVE; key->type = KEY_RELATIVE;

@ -352,7 +352,7 @@ std::string ControllerExporter::add_morph_targets(Key *key, Object *ob)
source.prepareToAppendValues(); source.prepareToAppendValues();
KeyBlock * kb = (KeyBlock*)key->block.first; KeyBlock *kb = (KeyBlock *)key->block.first;
//skip the basis //skip the basis
kb = kb->next; kb = kb->next;
for (; kb; kb = kb->next) { for (; kb; kb = kb->next) {
@ -381,7 +381,7 @@ std::string ControllerExporter::add_morph_weights(Key *key, Object *ob)
source.prepareToAppendValues(); source.prepareToAppendValues();
KeyBlock * kb = (KeyBlock*)key->block.first; KeyBlock *kb = (KeyBlock *)key->block.first;
//skip the basis //skip the basis
kb = kb->next; kb = kb->next;
for (; kb; kb = kb->next) { for (; kb; kb = kb->next) {
@ -399,7 +399,7 @@ void ControllerExporter::add_weight_extras(Key *key)
// can also try the base element and param alternative // can also try the base element and param alternative
COLLADASW::BaseExtraTechnique extra; COLLADASW::BaseExtraTechnique extra;
KeyBlock * kb = (KeyBlock*)key->block.first; KeyBlock * kb = (KeyBlock *)key->block.first;
//skip the basis //skip the basis
kb = kb->next; kb = kb->next;
for (; kb; kb = kb->next) { for (; kb; kb = kb->next) {

@ -155,7 +155,7 @@ void GeometryExporter::operator()(Object *ob)
if (this->export_settings->include_shapekeys) { if (this->export_settings->include_shapekeys) {
Key * key = BKE_key_from_object(ob); Key * key = BKE_key_from_object(ob);
if (key) { if (key) {
KeyBlock * kb = (KeyBlock*)key->block.first; KeyBlock * kb = (KeyBlock *)key->block.first;
//skip the basis //skip the basis
kb = kb->next; kb = kb->next;
for (; kb; kb = kb->next) { for (; kb; kb = kb->next) {

@ -465,7 +465,7 @@ void MeshImporter::mesh_add_edges(Mesh *mesh, int len)
CustomData_free(&mesh->edata, mesh->totedge); CustomData_free(&mesh->edata, mesh->totedge);
mesh->edata = edata; mesh->edata = edata;
mesh_update_customdata_pointers(mesh, FALSE); /* new edges don't change tessellation */ BKE_mesh_update_customdata_pointers(mesh, false); /* new edges don't change tessellation */
/* set default flags */ /* set default flags */
medge = &mesh->medge[mesh->totedge]; medge = &mesh->medge[mesh->totedge];
@ -1029,7 +1029,7 @@ Object *MeshImporter::create_mesh_object(COLLADAFW::Node *node, COLLADAFW::Insta
Mesh *old_mesh = (Mesh *)ob->data; Mesh *old_mesh = (Mesh *)ob->data;
Mesh *new_mesh = uid_mesh_map[*geom_uid]; Mesh *new_mesh = uid_mesh_map[*geom_uid];
set_mesh(ob, new_mesh); BKE_mesh_assign_object(ob, new_mesh);
if (old_mesh->id.us == 0) BKE_libblock_free(&G.main->mesh, old_mesh); if (old_mesh->id.us == 0) BKE_libblock_free(&G.main->mesh, old_mesh);
@ -1075,7 +1075,7 @@ bool MeshImporter::write_geometry(const COLLADAFW::Geometry *geom)
const std::string& str_geom_id = mesh->getName().size() ? mesh->getName() : mesh->getOriginalId(); const std::string& str_geom_id = mesh->getName().size() ? mesh->getName() : mesh->getOriginalId();
Mesh *me = BKE_mesh_add(G.main, (char *)str_geom_id.c_str()); Mesh *me = BKE_mesh_add(G.main, (char *)str_geom_id.c_str());
me->id.us--; // is already 1 here, but will be set later in set_mesh me->id.us--; // is already 1 here, but will be set later in BKE_mesh_assign_object
// store the Mesh pointer to link it later with an Object // store the Mesh pointer to link it later with an Object
// mesh_geom_map needed to map mesh to its geometry name (for shape key naming) // mesh_geom_map needed to map mesh to its geometry name (for shape key naming)

@ -190,7 +190,7 @@ void SceneExporter::writeNodes(Object *ob, Scene *sce)
} }
if (ob->constraints.first != NULL ) { if (ob->constraints.first != NULL ) {
bConstraint *con = (bConstraint*) ob->constraints.first; bConstraint *con = (bConstraint *) ob->constraints.first;
while (con) { while (con) {
std::string con_name(id_name(con)); std::string con_name(id_name(con));
std::string con_tag = con_name + "_constraint"; std::string con_tag = con_name + "_constraint";
@ -216,7 +216,7 @@ void SceneExporter::writeNodes(Object *ob, Scene *sce)
cti->get_constraint_targets(con, &targets); cti->get_constraint_targets(con, &targets);
if (cti) { if (cti) {
for (ct = (bConstraintTarget*)targets.first; ct; ct = ct->next) { for (ct = (bConstraintTarget *)targets.first; ct; ct = ct->next) {
obtar = ct->tar; obtar = ct->tar;
std::string tar_id(id_name(obtar)); std::string tar_id(id_name(obtar));
colladaNode.addExtraTechniqueChildParameter("blender",con_tag,"target_id",tar_id); colladaNode.addExtraTechniqueChildParameter("blender",con_tag,"target_id",tar_id);

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

@ -79,7 +79,7 @@ int ED_space_image_maskedit_mask_poll(struct bContext *C);
void ED_image_update_frame(const struct Main *mainp, int cfra); void ED_image_update_frame(const struct Main *mainp, int cfra);
void ED_image_draw_info(struct Scene *scene, struct ARegion *ar, int color_manage, int use_default_view, int channels, int x, int y, void ED_image_draw_info(struct Scene *scene, struct ARegion *ar, int color_manage, int use_default_view, int channels, int x, int y,
const unsigned char cp[4], const float fp[4], int *zp, float *zpf); const unsigned char cp[4], const float fp[4], const float linearcol[4], int *zp, float *zpf);
#endif /* __ED_IMAGE_H__ */ #endif /* __ED_IMAGE_H__ */

@ -216,7 +216,7 @@ bool ED_view3d_viewplane_get(struct View3D *v3d, struct RegionView3D *rv3d, int
struct rctf *r_viewplane, float *r_clipsta, float *r_clipend); struct rctf *r_viewplane, float *r_clipsta, float *r_clipend);
void ED_view3d_calc_camera_border(struct Scene *scene, struct ARegion *ar, void ED_view3d_calc_camera_border(struct Scene *scene, struct ARegion *ar,
struct View3D *v3d, struct RegionView3D *rv3d, struct View3D *v3d, struct RegionView3D *rv3d,
struct rctf *viewborder_r, const bool no_shift); struct rctf *r_viewborder, const bool no_shift);
void ED_view3d_calc_camera_border_size(struct Scene *scene, struct ARegion *ar, void ED_view3d_calc_camera_border_size(struct Scene *scene, struct ARegion *ar,
struct View3D *v3d, struct RegionView3D *rv3d, struct View3D *v3d, struct RegionView3D *rv3d,
float r_size[2]); float r_size[2]);
@ -244,7 +244,7 @@ unsigned int view3d_sample_backbuf_rect(struct ViewContext *vc, const int mval[2
unsigned int view3d_sample_backbuf(struct ViewContext *vc, int x, int y); unsigned int view3d_sample_backbuf(struct ViewContext *vc, int x, int y);
/* draws and does a 4x4 sample */ /* draws and does a 4x4 sample */
int ED_view3d_autodist(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, const int mval[2], float mouse_worldloc[3]); int ED_view3d_autodist(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, const int mval[2], float mouse_worldloc[3], bool alphaoverride);
/* only draw so ED_view3d_autodist_simple can be called many times after */ /* only draw so ED_view3d_autodist_simple can be called many times after */
int ED_view3d_autodist_init(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, int mode); int ED_view3d_autodist_init(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, int mode);
@ -268,7 +268,7 @@ int edge_inside_circle(const float cent[2], float radius, const float screen_co_
/* get 3d region from context, also if mouse is in header or toolbar */ /* get 3d region from context, also if mouse is in header or toolbar */
struct RegionView3D *ED_view3d_context_rv3d(struct bContext *C); struct RegionView3D *ED_view3d_context_rv3d(struct bContext *C);
int ED_view3d_context_user_region(struct bContext *C, struct View3D **v3d_r, struct ARegion **ar_r); int ED_view3d_context_user_region(struct bContext *C, struct View3D **r_v3d, struct ARegion **r_ar);
int ED_operator_rv3d_user_region_poll(struct bContext *C); int ED_operator_rv3d_user_region_poll(struct bContext *C);
void ED_view3d_init_mats_rv3d(struct Object *ob, struct RegionView3D *rv3d); void ED_view3d_init_mats_rv3d(struct Object *ob, struct RegionView3D *rv3d);

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

@ -4158,20 +4158,27 @@ static int ui_do_but_COLORBAND(bContext *C, uiBlock *block, uiBut *but, uiHandle
return WM_UI_HANDLER_CONTINUE; return WM_UI_HANDLER_CONTINUE;
} }
static int ui_numedit_but_CURVE(uiBut *but, uiHandleButtonData *data, int snap, static int ui_numedit_but_CURVE(uiBlock *block, uiBut *but, uiHandleButtonData *data, int snap,
float mx, float my, const short shift) int evtx, int evty, const short shift)
{ {
CurveMapping *cumap = (CurveMapping *)but->poin; CurveMapping *cumap = (CurveMapping *)but->poin;
CurveMap *cuma = cumap->cm + cumap->cur; CurveMap *cuma = cumap->cm + cumap->cur;
CurveMapPoint *cmp = cuma->curve; CurveMapPoint *cmp = cuma->curve;
float fx, fy, zoomx, zoomy /*, offsx, offsy */ /* UNUSED */; float fx, fy, zoomx, zoomy;
int mx, my, dragx, dragy;
int a, changed = 0; int a, changed = 0;
/* evtx evty and drag coords are absolute mousecoords, prevents errors when editing when layout changes */
mx = evtx;
my = evty;
ui_window_to_block(data->region, block, &mx, &my);
dragx = data->draglastx;
dragy = data->draglasty;
ui_window_to_block(data->region, block, &dragx, &dragy);
zoomx = BLI_rctf_size_x(&but->rect) / BLI_rctf_size_x(&cumap->curr); zoomx = BLI_rctf_size_x(&but->rect) / BLI_rctf_size_x(&cumap->curr);
zoomy = BLI_rctf_size_y(&but->rect) / BLI_rctf_size_y(&cumap->curr); zoomy = BLI_rctf_size_y(&but->rect) / BLI_rctf_size_y(&cumap->curr);
/* offsx = cumap->curr.xmin; */
/* offsy = cumap->curr.ymin; */
if (snap) { if (snap) {
float d[2]; float d[2];
@ -4187,8 +4194,8 @@ static int ui_numedit_but_CURVE(uiBut *but, uiHandleButtonData *data, int snap,
const float mval_factor = ui_mouse_scale_warp_factor(shift); const float mval_factor = ui_mouse_scale_warp_factor(shift);
int moved_point = 0; /* for ctrl grid, can't use orig coords because of sorting */ int moved_point = 0; /* for ctrl grid, can't use orig coords because of sorting */
fx = (mx - data->draglastx) / zoomx; fx = (mx - dragx) / zoomx;
fy = (my - data->draglasty) / zoomy; fy = (my - dragy) / zoomy;
fx *= mval_factor; fx *= mval_factor;
fy *= mval_factor; fy *= mval_factor;
@ -4212,8 +4219,8 @@ static int ui_numedit_but_CURVE(uiBut *but, uiHandleButtonData *data, int snap,
curvemapping_changed(cumap, FALSE); curvemapping_changed(cumap, FALSE);
if (moved_point) { if (moved_point) {
data->draglastx = mx; data->draglastx = evtx;
data->draglasty = my; data->draglasty = evty;
changed = 1; changed = 1;
#ifdef USE_CONT_MOUSE_CORRECT #ifdef USE_CONT_MOUSE_CORRECT
@ -4232,8 +4239,8 @@ static int ui_numedit_but_CURVE(uiBut *but, uiHandleButtonData *data, int snap,
data->dragchange = 1; /* mark for selection */ data->dragchange = 1; /* mark for selection */
} }
else { else {
fx = (mx - data->draglastx) / zoomx; fx = (mx - dragx) / zoomx;
fy = (my - data->draglasty) / zoomy; fy = (my - dragy) / zoomy;
/* clamp for clip */ /* clamp for clip */
if (cumap->flag & CUMA_DO_CLIP) { if (cumap->flag & CUMA_DO_CLIP) {
@ -4252,8 +4259,8 @@ static int ui_numedit_but_CURVE(uiBut *but, uiHandleButtonData *data, int snap,
cumap->curr.xmax -= fx; cumap->curr.xmax -= fx;
cumap->curr.ymax -= fy; cumap->curr.ymax -= fy;
data->draglastx = mx; data->draglastx = evtx;
data->draglasty = my; data->draglasty = evty;
changed = 1; changed = 1;
} }
@ -4268,7 +4275,7 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt
mx = event->x; mx = event->x;
my = event->y; my = event->y;
ui_window_to_block(data->region, block, &mx, &my); ui_window_to_block(data->region, block, &mx, &my);
if (data->state == BUTTON_STATE_HIGHLIGHT) { if (data->state == BUTTON_STATE_HIGHLIGHT) {
if (event->type == LEFTMOUSE && event->val == KM_PRESS) { if (event->type == LEFTMOUSE && event->val == KM_PRESS) {
CurveMapping *cumap = (CurveMapping *)but->poin; CurveMapping *cumap = (CurveMapping *)but->poin;
@ -4358,11 +4365,11 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt
} }
data->dragsel = sel; data->dragsel = sel;
data->dragstartx = mx; data->dragstartx = event->x;
data->dragstarty = my; data->dragstarty = event->y;
data->draglastx = mx; data->draglastx = event->x;
data->draglasty = my; data->draglasty = event->y;
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING); button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
return WM_UI_HANDLER_BREAK; return WM_UI_HANDLER_BREAK;
@ -4370,8 +4377,9 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt
} }
else if (data->state == BUTTON_STATE_NUM_EDITING) { else if (data->state == BUTTON_STATE_NUM_EDITING) {
if (event->type == MOUSEMOVE) { if (event->type == MOUSEMOVE) {
if (mx != data->draglastx || my != data->draglasty) { if (event->x != data->draglastx || event->y != data->draglasty) {
if (ui_numedit_but_CURVE(but, data, event->ctrl, mx, my, event->shift))
if (ui_numedit_but_CURVE(block, but, data, event->ctrl, event->x, event->y, event->shift))
ui_numedit_apply(C, block, but, data); ui_numedit_apply(C, block, but, data);
} }
} }

@ -159,7 +159,7 @@ static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *la
} }
else { else {
CustomData_free_layer_active(data, type, tot); CustomData_free_layer_active(data, type, tot);
mesh_update_customdata_pointers(me, TRUE); BKE_mesh_update_customdata_pointers(me, true);
} }
if (!CustomData_has_layer(data, type) && (type == CD_MLOOPCOL && (ob->mode & OB_MODE_VERTEX_PAINT))) if (!CustomData_has_layer(data, type) && (type == CD_MLOOPCOL && (ob->mode & OB_MODE_VERTEX_PAINT)))
@ -406,7 +406,7 @@ int ED_mesh_uv_texture_add(bContext *C, Mesh *me, const char *name, int active_s
CustomData_set_layer_active(&me->fdata, CD_MTFACE, layernum_dst); CustomData_set_layer_active(&me->fdata, CD_MTFACE, layernum_dst);
} }
mesh_update_customdata_pointers(me, TRUE); BKE_mesh_update_customdata_pointers(me, true);
} }
/* don't overwrite our copied coords */ /* don't overwrite our copied coords */
@ -489,7 +489,7 @@ int ED_mesh_color_add(bContext *C, Scene *UNUSED(scene), Object *UNUSED(ob), Mes
CustomData_set_layer_active(&me->fdata, CD_MCOL, layernum); CustomData_set_layer_active(&me->fdata, CD_MCOL, layernum);
} }
mesh_update_customdata_pointers(me, TRUE); BKE_mesh_update_customdata_pointers(me, true);
} }
DAG_id_tag_update(&me->id, 0); DAG_id_tag_update(&me->id, 0);
@ -942,7 +942,7 @@ static void mesh_add_verts(Mesh *mesh, int len)
CustomData_free(&mesh->vdata, mesh->totvert); CustomData_free(&mesh->vdata, mesh->totvert);
mesh->vdata = vdata; mesh->vdata = vdata;
mesh_update_customdata_pointers(mesh, FALSE); BKE_mesh_update_customdata_pointers(mesh, false);
/* scan the input list and insert the new vertices */ /* scan the input list and insert the new vertices */
@ -986,7 +986,7 @@ static void mesh_add_edges(Mesh *mesh, int len)
CustomData_free(&mesh->edata, mesh->totedge); CustomData_free(&mesh->edata, mesh->totedge);
mesh->edata = edata; mesh->edata = edata;
mesh_update_customdata_pointers(mesh, FALSE); /* new edges don't change tessellation */ BKE_mesh_update_customdata_pointers(mesh, false); /* new edges don't change tessellation */
/* set default flags */ /* set default flags */
medge = &mesh->medge[mesh->totedge]; medge = &mesh->medge[mesh->totedge];
@ -1016,7 +1016,7 @@ static void mesh_add_tessfaces(Mesh *mesh, int len)
CustomData_free(&mesh->fdata, mesh->totface); CustomData_free(&mesh->fdata, mesh->totface);
mesh->fdata = fdata; mesh->fdata = fdata;
mesh_update_customdata_pointers(mesh, TRUE); BKE_mesh_update_customdata_pointers(mesh, true);
/* set default flags */ /* set default flags */
mface = &mesh->mface[mesh->totface]; mface = &mesh->mface[mesh->totface];
@ -1045,7 +1045,7 @@ static void mesh_add_loops(Mesh *mesh, int len)
CustomData_free(&mesh->ldata, mesh->totloop); CustomData_free(&mesh->ldata, mesh->totloop);
mesh->ldata = ldata; mesh->ldata = ldata;
mesh_update_customdata_pointers(mesh, TRUE); BKE_mesh_update_customdata_pointers(mesh, true);
mesh->totloop = totloop; mesh->totloop = totloop;
} }
@ -1070,7 +1070,7 @@ static void mesh_add_polys(Mesh *mesh, int len)
CustomData_free(&mesh->pdata, mesh->totpoly); CustomData_free(&mesh->pdata, mesh->totpoly);
mesh->pdata = pdata; mesh->pdata = pdata;
mesh_update_customdata_pointers(mesh, TRUE); BKE_mesh_update_customdata_pointers(mesh, true);
/* set default flags */ /* set default flags */
mpoly = &mesh->mpoly[mesh->totpoly]; mpoly = &mesh->mpoly[mesh->totpoly];

@ -505,7 +505,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
me->pdata = pdata; me->pdata = pdata;
/* tessface data removed above, no need to update */ /* tessface data removed above, no need to update */
mesh_update_customdata_pointers(me, FALSE); BKE_mesh_update_customdata_pointers(me, false);
/* update normals in case objects with non-uniform scale are joined */ /* update normals in case objects with non-uniform scale are joined */
ED_mesh_calc_normals(me); ED_mesh_calc_normals(me);

@ -1754,7 +1754,7 @@ static Object *modifier_skin_armature_create(struct Scene *scene,
arm->edbo = MEM_callocN(sizeof(ListBase), "edbo armature"); arm->edbo = MEM_callocN(sizeof(ListBase), "edbo armature");
mvert_skin = CustomData_get_layer(&me->vdata, CD_MVERT_SKIN); mvert_skin = CustomData_get_layer(&me->vdata, CD_MVERT_SKIN);
create_vert_edge_map(&emap, &emap_mem, BKE_mesh_vert_edge_map_create(&emap, &emap_mem,
me->medge, me->totvert, me->totedge); me->medge, me->totvert, me->totedge);
edges_visited = BLI_BITMAP_NEW(me->totedge, "edge_visited"); edges_visited = BLI_BITMAP_NEW(me->totedge, "edge_visited");

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

@ -614,8 +614,8 @@ void PAINT_OT_image_paint(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
RNA_def_enum(ot->srna, "mode", stroke_mode_items, BRUSH_STROKE_NORMAL, RNA_def_enum(ot->srna, "mode", stroke_mode_items, BRUSH_STROKE_NORMAL,
"Paint Stroke Mode", "Paint Stroke Mode",
"Action taken when a paint stroke is made"); "Action taken when a paint stroke is made");
RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", ""); RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", "");
} }

@ -235,7 +235,7 @@ static void brush_painter_2d_do_partial(BrushPainter *painter, ImBuf *oldtexibuf
xy[0] = x + xoff; xy[0] = x + xoff;
xy[1] = y + yoff; xy[1] = y + yoff;
BKE_brush_sample_tex_2D(scene, brush, xy, tf, NULL); BKE_brush_sample_tex_2D(scene, brush, xy, tf);
} }
bf[0] = tf[0] * mf[0]; bf[0] = tf[0] * mf[0];
@ -266,7 +266,7 @@ static void brush_painter_2d_do_partial(BrushPainter *painter, ImBuf *oldtexibuf
xy[0] = x + xoff; xy[0] = x + xoff;
xy[1] = y + yoff; xy[1] = y + yoff;
BKE_brush_sample_tex_2D(scene, brush, xy, rgba, NULL); BKE_brush_sample_tex_2D(scene, brush, xy, rgba);
rgba_float_to_uchar(t, rgba); rgba_float_to_uchar(t, rgba);
} }

@ -4118,7 +4118,7 @@ int paint_proj_stroke(bContext *C, void *pps, const int prevmval_i[2], const int
view3d_operator_needs_opengl(C); view3d_operator_needs_opengl(C);
if (!ED_view3d_autodist(scene, ps->ar, v3d, mval_i, cursor)) if (!ED_view3d_autodist(scene, ps->ar, v3d, mval_i, cursor, false))
return 0; return 0;
ED_region_tag_redraw(ps->ar); ED_region_tag_redraw(ps->ar);

@ -354,7 +354,7 @@ static void make_vertexcol(Object *ob) /* single ob */
if (!me->mloopcol) { if (!me->mloopcol) {
CustomData_add_layer(&me->ldata, CD_MLOOPCOL, CD_DEFAULT, NULL, me->totloop); CustomData_add_layer(&me->ldata, CD_MLOOPCOL, CD_DEFAULT, NULL, me->totloop);
} }
mesh_update_customdata_pointers(me, TRUE); BKE_mesh_update_customdata_pointers(me, true);
} }
update_tessface_data(ob, me); update_tessface_data(ob, me);

@ -4553,7 +4553,7 @@ void sculpt_dynamic_topology_disable(bContext *C,
CustomData_copy(&unode->bm_enter_pdata, &me->pdata, CD_MASK_MESH, CustomData_copy(&unode->bm_enter_pdata, &me->pdata, CD_MASK_MESH,
CD_DUPLICATE, unode->bm_enter_totpoly); CD_DUPLICATE, unode->bm_enter_totpoly);
mesh_update_customdata_pointers(me, FALSE); BKE_mesh_update_customdata_pointers(me, false);
} }
else { else {
sculptsession_bm_to_me(ob, TRUE); sculptsession_bm_to_me(ob, TRUE);

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

@ -162,7 +162,7 @@ static void draw_render_info(Scene *scene, Image *ima, ARegion *ar, float zoomx,
/* used by node view too */ /* used by node view too */
void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_default_view, int channels, int x, int y, void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_default_view, int channels, int x, int y,
const unsigned char cp[4], const float fp[4], int *zp, float *zpf) const unsigned char cp[4], const float fp[4], const float linearcol[4], int *zp, float *zpf)
{ {
char str[256]; char str[256];
float dx = 6; float dx = 6;
@ -258,15 +258,23 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_def
dx += BLF_width(blf_mono_font, str); dx += BLF_width(blf_mono_font, str);
} }
if (color_manage && channels == 4) { if (color_manage) {
float pixel[4]; float rgba[4];
copy_v3_v3(rgba, linearcol);
if (channels == 3)
rgba[3] = 1.0f;
else
rgba[3] = linearcol[3];
(void)color_manage;
if (use_default_view) if (use_default_view)
IMB_colormanagement_pixel_to_display_space_v4(pixel, fp, NULL, &scene->display_settings); IMB_colormanagement_pixel_to_display_space_v4(rgba, rgba, NULL, &scene->display_settings);
else else
IMB_colormanagement_pixel_to_display_space_v4(pixel, fp, &scene->view_settings, &scene->display_settings); IMB_colormanagement_pixel_to_display_space_v4(rgba, rgba, &scene->view_settings, &scene->display_settings);
BLI_snprintf(str, sizeof(str), " | CM R:%-.4f G:%-.4f B:%-.4f", pixel[0], pixel[1], pixel[2]); BLI_snprintf(str, sizeof(str), " | CM R:%-.4f G:%-.4f B:%-.4f", rgba[0], rgba[1], rgba[2]);
BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0); BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str)); BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str); dx += BLF_width(blf_mono_font, str);
@ -287,26 +295,11 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_def
col[3] = 1.0f; col[3] = 1.0f;
} }
else if (channels == 3) { else if (channels == 3) {
if (fp) { copy_v3_v3(col, linearcol);
copy_v3_v3(col, fp);
}
else if (cp) {
rgb_uchar_to_float(col, cp);
}
else {
zero_v3(col);
}
col[3] = 1.0f; col[3] = 1.0f;
} }
else if (channels == 4) { else if (channels == 4) {
if (fp) copy_v4_v4(col, linearcol);
copy_v4_v4(col, fp);
else if (cp) {
rgba_uchar_to_float(col, cp);
}
else {
zero_v4(col);
}
} }
else { else {
BLI_assert(0); BLI_assert(0);

@ -2079,6 +2079,7 @@ typedef struct ImageSampleInfo {
unsigned char col[4]; unsigned char col[4];
float colf[4]; float colf[4];
float linearcol[4];
int z; int z;
float zf; float zf;
@ -2099,7 +2100,7 @@ static void image_sample_draw(const bContext *C, ARegion *ar, void *arg_info)
Scene *scene = CTX_data_scene(C); Scene *scene = CTX_data_scene(C);
ED_image_draw_info(scene, ar, info->color_manage, info->use_default_view, info->channels, ED_image_draw_info(scene, ar, info->color_manage, info->use_default_view, info->channels,
info->x, info->y, info->colp, info->colfp, info->zp, info->zfp); info->x, info->y, info->colp, info->colfp, info->linearcol, info->zp, info->zfp);
} }
} }
@ -2198,7 +2199,10 @@ static void image_sample_apply(bContext *C, wmOperator *op, const wmEvent *event
info->colf[3] = (float)cp[3] / 255.0f; info->colf[3] = (float)cp[3] / 255.0f;
info->colfp = info->colf; info->colfp = info->colf;
info->color_manage = FALSE; copy_v4_v4(info->linearcol, info->colf);
IMB_colormanagement_colorspace_to_scene_linear_v4(info->linearcol, false, ibuf->rect_colorspace);
info->color_manage = TRUE;
} }
if (ibuf->rect_float) { if (ibuf->rect_float) {
fp = (ibuf->rect_float + (ibuf->channels) * (y * ibuf->x + x)); fp = (ibuf->rect_float + (ibuf->channels) * (y * ibuf->x + x));
@ -2209,6 +2213,8 @@ static void image_sample_apply(bContext *C, wmOperator *op, const wmEvent *event
info->colf[3] = fp[3]; info->colf[3] = fp[3];
info->colfp = info->colf; info->colfp = info->colf;
copy_v4_v4(info->linearcol, info->colf);
info->color_manage = TRUE; info->color_manage = TRUE;
} }

@ -1129,7 +1129,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
if (snode->nodetree) { if (snode->nodetree) {
bNode *node; bNode *node;
/* void** highlights = 0; */ /* UNUSED */ /* void **highlights = 0; */ /* UNUSED */
node_uiblocks_init(C, snode->nodetree); node_uiblocks_init(C, snode->nodetree);

@ -56,6 +56,7 @@
#include "MEM_guardedalloc.h" #include "MEM_guardedalloc.h"
#include "IMB_colormanagement.h"
#include "IMB_imbuf.h" #include "IMB_imbuf.h"
#include "IMB_imbuf_types.h" #include "IMB_imbuf_types.h"
@ -335,6 +336,7 @@ typedef struct ImageSampleInfo {
unsigned char col[4]; unsigned char col[4];
float colf[4]; float colf[4];
float linearcol[4];
int z; int z;
float zf; float zf;
@ -353,7 +355,7 @@ static void sample_draw(const bContext *C, ARegion *ar, void *arg_info)
if (info->draw) { if (info->draw) {
ED_image_draw_info(scene, ar, info->color_manage, FALSE, info->channels, ED_image_draw_info(scene, ar, info->color_manage, FALSE, info->channels,
info->x, info->y, info->col, info->colf, info->x, info->y, info->col, info->colf, info->linearcol,
info->zp, info->zfp); info->zp, info->zfp);
} }
} }
@ -469,7 +471,10 @@ static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
info->colf[2] = (float)cp[2] / 255.0f; info->colf[2] = (float)cp[2] / 255.0f;
info->colf[3] = (float)cp[3] / 255.0f; info->colf[3] = (float)cp[3] / 255.0f;
info->color_manage = FALSE; copy_v4_v4(info->linearcol, info->colf);
IMB_colormanagement_colorspace_to_scene_linear_v4(info->linearcol, false, ibuf->rect_colorspace);
info->color_manage = TRUE;
} }
if (ibuf->rect_float) { if (ibuf->rect_float) {
fp = (ibuf->rect_float + (ibuf->channels) * (y * ibuf->x + x)); fp = (ibuf->rect_float + (ibuf->channels) * (y * ibuf->x + x));

@ -31,6 +31,7 @@
#include "MEM_guardedalloc.h" #include "MEM_guardedalloc.h"
#include "BLI_math.h"
#include "BLI_utildefines.h" #include "BLI_utildefines.h"
#include "DNA_scene_types.h" #include "DNA_scene_types.h"
@ -66,6 +67,7 @@ typedef struct ImageSampleInfo {
unsigned char col[4]; unsigned char col[4];
float colf[4]; float colf[4];
float linearcol[4];
unsigned char *colp; unsigned char *colp;
float *colfp; float *colfp;
@ -81,7 +83,8 @@ static void sample_draw(const bContext *C, ARegion *ar, void *arg_info)
if (info->draw) { if (info->draw) {
ED_image_draw_info(scene, ar, info->color_manage, FALSE, info->channels, ED_image_draw_info(scene, ar, info->color_manage, FALSE, info->channels,
info->x, info->y, info->colp, info->colfp, NULL, NULL); info->x, info->y, info->colp, info->colfp,
info->linearcol, NULL, NULL);
} }
} }
@ -134,7 +137,10 @@ static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
info->colf[3] = (float)cp[3] / 255.0f; info->colf[3] = (float)cp[3] / 255.0f;
info->colfp = info->colf; info->colfp = info->colf;
info->color_manage = FALSE; copy_v4_v4(info->linearcol, info->colf);
IMB_colormanagement_colorspace_to_scene_linear_v4(info->linearcol, false, ibuf->rect_colorspace);
info->color_manage = TRUE;
} }
if (ibuf->rect_float) { if (ibuf->rect_float) {
fp = (ibuf->rect_float + (ibuf->channels) * (y * ibuf->x + x)); fp = (ibuf->rect_float + (ibuf->channels) * (y * ibuf->x + x));

@ -159,12 +159,12 @@ RegionView3D *ED_view3d_context_rv3d(bContext *C)
/* ideally would return an rv3d but in some cases the region is needed too /* ideally would return an rv3d but in some cases the region is needed too
* so return that, the caller can then access the ar->regiondata */ * so return that, the caller can then access the ar->regiondata */
int ED_view3d_context_user_region(bContext *C, View3D **v3d_r, ARegion **ar_r) int ED_view3d_context_user_region(bContext *C, View3D **r_v3d, ARegion **r_ar)
{ {
ScrArea *sa = CTX_wm_area(C); ScrArea *sa = CTX_wm_area(C);
*v3d_r = NULL; *r_v3d = NULL;
*ar_r = NULL; *r_ar = NULL;
if (sa && sa->spacetype == SPACE_VIEW3D) { if (sa && sa->spacetype == SPACE_VIEW3D) {
ARegion *ar = CTX_wm_region(C); ARegion *ar = CTX_wm_region(C);
@ -173,8 +173,8 @@ int ED_view3d_context_user_region(bContext *C, View3D **v3d_r, ARegion **ar_r)
if (ar) { if (ar) {
RegionView3D *rv3d = ar->regiondata; RegionView3D *rv3d = ar->regiondata;
if (rv3d && rv3d->viewlock == 0) { if (rv3d && rv3d->viewlock == 0) {
*v3d_r = v3d; *r_v3d = v3d;
*ar_r = ar; *r_ar = ar;
return 1; return 1;
} }
else { else {
@ -196,14 +196,14 @@ int ED_view3d_context_user_region(bContext *C, View3D **v3d_r, ARegion **ar_r)
/* camera/perspective view get priority when the active region is locked */ /* camera/perspective view get priority when the active region is locked */
if (ar_unlock_user) { if (ar_unlock_user) {
*v3d_r = v3d; *r_v3d = v3d;
*ar_r = ar_unlock_user; *r_ar = ar_unlock_user;
return 1; return 1;
} }
if (ar_unlock) { if (ar_unlock) {
*v3d_r = v3d; *r_v3d = v3d;
*ar_r = ar_unlock; *r_ar = ar_unlock;
return 1; return 1;
} }
} }

@ -1008,9 +1008,9 @@ void ED_view3d_calc_camera_border_size(Scene *scene, ARegion *ar, View3D *v3d, R
} }
void ED_view3d_calc_camera_border(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, void ED_view3d_calc_camera_border(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d,
rctf *viewborder_r, const bool no_shift) rctf *r_viewborder, const bool no_shift)
{ {
view3d_camera_border(scene, ar, v3d, rv3d, viewborder_r, no_shift, false); view3d_camera_border(scene, ar, v3d, rv3d, r_viewborder, no_shift, false);
} }
static void drawviewborder_grid3(float x1, float x2, float y1, float y2, float fac) static void drawviewborder_grid3(float x1, float x2, float y1, float y2, float fac)
@ -2235,7 +2235,7 @@ void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d)
} }
void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (*func)(void *)) void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (*func)(void *), bool alphaoverride)
{ {
RegionView3D *rv3d = ar->regiondata; RegionView3D *rv3d = ar->regiondata;
Base *base; Base *base;
@ -2247,7 +2247,7 @@ void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (*func)(void *))
/* Setting these temporarily is not nice */ /* Setting these temporarily is not nice */
v3d->flag &= ~V3D_SELECT_OUTLINE; v3d->flag &= ~V3D_SELECT_OUTLINE;
U.glalphaclip = 0.5; /* not that nice but means we wont zoom into billboards */ U.glalphaclip = alphaoverride ? 0.5f : glalphaclip; /* not that nice but means we wont zoom into billboards */
U.obcenter_dia = 0; U.obcenter_dia = 0;
setwinmatrixview3d(ar, v3d, NULL); setwinmatrixview3d(ar, v3d, NULL);

@ -457,7 +457,7 @@ static void viewops_data_create(bContext *C, wmOperator *op, const wmEvent *even
view3d_operator_needs_opengl(C); /* needed for zbuf drawing */ view3d_operator_needs_opengl(C); /* needed for zbuf drawing */
if ((vod->use_dyn_ofs = ED_view3d_autodist(CTX_data_scene(C), vod->ar, vod->v3d, event->mval, vod->dyn_ofs))) { if ((vod->use_dyn_ofs = ED_view3d_autodist(CTX_data_scene(C), vod->ar, vod->v3d, event->mval, vod->dyn_ofs, true))) {
if (rv3d->is_persp) { if (rv3d->is_persp) {
float my_origin[3]; /* original G.vd->ofs */ float my_origin[3]; /* original G.vd->ofs */
float my_pivot[3]; /* view */ float my_pivot[3]; /* view */
@ -2896,7 +2896,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
/* Get Z Depths, needed for perspective, nice for ortho */ /* Get Z Depths, needed for perspective, nice for ortho */
bgl_get_mats(&mats); bgl_get_mats(&mats);
draw_depth(scene, ar, v3d, NULL); draw_depth(scene, ar, v3d, NULL, true);
{ {
/* avoid allocating the whole depth buffer */ /* avoid allocating the whole depth buffer */
@ -3745,7 +3745,7 @@ void ED_view3d_cursor3d_position(bContext *C, float fp[3], const int mval[2])
if (U.uiflag & USER_ZBUF_CURSOR) { /* maybe this should be accessed some other way */ if (U.uiflag & USER_ZBUF_CURSOR) { /* maybe this should be accessed some other way */
view3d_operator_needs_opengl(C); view3d_operator_needs_opengl(C);
if (ED_view3d_autodist(scene, ar, v3d, mval, fp)) if (ED_view3d_autodist(scene, ar, v3d, mval, fp, true))
depth_used = TRUE; depth_used = TRUE;
} }
@ -3917,7 +3917,7 @@ static float view_autodist_depth_margin(ARegion *ar, const int mval[2], int marg
} }
/* XXX todo Zooms in on a border drawn by the user */ /* XXX todo Zooms in on a border drawn by the user */
int ED_view3d_autodist(Scene *scene, ARegion *ar, View3D *v3d, const int mval[2], float mouse_worldloc[3]) int ED_view3d_autodist(Scene *scene, ARegion *ar, View3D *v3d, const int mval[2], float mouse_worldloc[3], bool alphaoverride)
{ {
bglMats mats; /* ZBuffer depth vars */ bglMats mats; /* ZBuffer depth vars */
float depth_close = FLT_MAX; float depth_close = FLT_MAX;
@ -3925,7 +3925,7 @@ int ED_view3d_autodist(Scene *scene, ARegion *ar, View3D *v3d, const int mval[2]
/* Get Z Depths, needed for perspective, nice for ortho */ /* Get Z Depths, needed for perspective, nice for ortho */
bgl_get_mats(&mats); bgl_get_mats(&mats);
draw_depth(scene, ar, v3d, NULL); draw_depth(scene, ar, v3d, NULL, alphaoverride);
depth_close = view_autodist_depth_margin(ar, mval, 4); depth_close = view_autodist_depth_margin(ar, mval, 4);
@ -3952,7 +3952,7 @@ int ED_view3d_autodist_init(Scene *scene, ARegion *ar, View3D *v3d, int mode)
/* Get Z Depths, needed for perspective, nice for ortho */ /* Get Z Depths, needed for perspective, nice for ortho */
switch (mode) { switch (mode) {
case 0: case 0:
draw_depth(scene, ar, v3d, NULL); draw_depth(scene, ar, v3d, NULL, true);
break; break;
case 1: case 1:
draw_depth_gpencil(scene, ar, v3d); draw_depth_gpencil(scene, ar, v3d);

@ -152,7 +152,7 @@ void draw_mesh_paint(View3D *v3d, RegionView3D *rv3d,
/* view3d_draw.c */ /* view3d_draw.c */
void view3d_main_area_draw(const struct bContext *C, struct ARegion *ar); void view3d_main_area_draw(const struct bContext *C, struct ARegion *ar);
void draw_depth(Scene *scene, struct ARegion *ar, View3D *v3d, int (*func)(void *)); void draw_depth(Scene *scene, struct ARegion *ar, View3D *v3d, int (*func)(void *), bool alphaoverride);
void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d); void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d);
void ED_view3d_after_add(ListBase *lb, Base *base, const short dflag); void ED_view3d_after_add(ListBase *lb, Base *base, const short dflag);

@ -1859,7 +1859,7 @@ static void editmesh_set_connectivity_distance(BMEditMesh *em, float mtx[3][3],
} }
/* loop-in-a-loop I know, but we need it! (ton) */ /* loop-in-a-loop I know, but we need it! (ton) */
static void get_face_center(float cent_r[3], BMVert *eve) static void get_face_center(float r_cent[3], BMVert *eve)
{ {
BMFace *efa; BMFace *efa;
@ -1867,20 +1867,20 @@ static void get_face_center(float cent_r[3], BMVert *eve)
BM_ITER_ELEM (efa, &iter, eve, BM_FACES_OF_VERT) { BM_ITER_ELEM (efa, &iter, eve, BM_FACES_OF_VERT) {
if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) { if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
BM_face_calc_center_mean(efa, cent_r); BM_face_calc_center_mean(efa, r_cent);
break; break;
} }
} }
} }
static void get_edge_center(float cent_r[3], BMVert *eve) static void get_edge_center(float r_cent[3], BMVert *eve)
{ {
BMEdge *eed; BMEdge *eed;
BMIter iter; BMIter iter;
BM_ITER_ELEM (eed, &iter, eve, BM_EDGES_OF_VERT) { BM_ITER_ELEM (eed, &iter, eve, BM_EDGES_OF_VERT) {
if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) { if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
mid_v3_v3v3(cent_r, eed->v1->co, eed->v2->co); mid_v3_v3v3(r_cent, eed->v1->co, eed->v2->co);
break; break;
} }
} }

@ -70,6 +70,8 @@ void IMB_colormanagement_transform_threaded(float *buffer, int width, int height
void IMB_colormanagement_transform_v4(float pixel[4], const char *from_colorspace, const char *to_colorspace); void IMB_colormanagement_transform_v4(float pixel[4], const char *from_colorspace, const char *to_colorspace);
void IMB_colormanagement_colorspace_to_scene_linear_v3(float pixel[3], struct ColorSpace *colorspace); void IMB_colormanagement_colorspace_to_scene_linear_v3(float pixel[3], struct ColorSpace *colorspace);
void IMB_colormanagement_colorspace_to_scene_linear_v4(float pixel[4], int predivide, struct ColorSpace *colorspace);
void IMB_colormanagement_scene_linear_to_colorspace_v3(float pixel[3], struct ColorSpace *colorspace); void IMB_colormanagement_scene_linear_to_colorspace_v3(float pixel[3], struct ColorSpace *colorspace);
void IMB_colormanagement_colorspace_to_scene_linear(float *buffer, int width, int height, int channels, struct ColorSpace *colorspace, int predivide); void IMB_colormanagement_colorspace_to_scene_linear(float *buffer, int width, int height, int channels, struct ColorSpace *colorspace, int predivide);

@ -179,7 +179,6 @@ typedef struct ImBuf {
* Note that the lower 11 bits is used for storing custom flags * Note that the lower 11 bits is used for storing custom flags
*/ */
#define IB_CUSTOM_FLAGS_MASK 0x7ff #define IB_CUSTOM_FLAGS_MASK 0x7ff
#define IB_ALPHA_MASK 0xff
#define PNG (1 << 30) #define PNG (1 << 30)
#define TGA (1 << 28) #define TGA (1 << 28)

@ -1583,6 +1583,26 @@ void IMB_colormanagement_scene_linear_to_colorspace_v3(float pixel[3], ColorSpac
OCIO_processorApplyRGB(processor, pixel); OCIO_processorApplyRGB(processor, pixel);
} }
void IMB_colormanagement_colorspace_to_scene_linear_v4(float pixel[4], int predivide, ColorSpace *colorspace)
{
OCIO_ConstProcessorRcPtr *processor;
if (!colorspace) {
/* should never happen */
printf("%s: perform conversion from unknown color space\n", __func__);
return;
}
processor = colorspace_to_scene_linear_processor(colorspace);
if (processor) {
if (predivide)
OCIO_processorApplyRGBA_predivide(processor, pixel);
else
OCIO_processorApplyRGBA(processor, pixel);
}
}
void IMB_colormanagement_colorspace_to_scene_linear(float *buffer, int width, int height, int channels, struct ColorSpace *colorspace, int predivide) void IMB_colormanagement_colorspace_to_scene_linear(float *buffer, int width, int height, int channels, struct ColorSpace *colorspace, int predivide)
{ {
OCIO_ConstProcessorRcPtr *processor; OCIO_ConstProcessorRcPtr *processor;

@ -517,7 +517,7 @@ void IMB_rectblend(struct ImBuf *dbuf, struct ImBuf *sbuf, int destx,
dr = drect; dr = drect;
sr = srect; sr = srect;
for (x = width; x > 0; x--, dr++, sr++) { for (x = width; x > 0; x--, dr++, sr++) {
if (*sr & IB_ALPHA_MASK) if (((char *)sr)[3])
func((char *)dr, (char *)dr, (char *)sr, ((char *)sr)[3]); func((char *)dr, (char *)dr, (char *)sr, ((char *)sr)[3]);
} }

@ -104,7 +104,7 @@ typedef struct IDProperty {
/* 2 characters for ID code and 64 for actual name */ /* 2 characters for ID code and 64 for actual name */
#define MAX_ID_NAME 66 #define MAX_ID_NAME 66
/* There's a nasty circular dependency here.... void* to the rescue! I /* There's a nasty circular dependency here.... 'void *' to the rescue! I
* really wonder why this is needed. */ * really wonder why this is needed. */
typedef struct ID { typedef struct ID {
void *next, *prev; void *next, *prev;

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

@ -528,7 +528,7 @@ static void rna_CustomDataLayer_active_set(PointerRNA *ptr, CustomData *data, in
else CustomData_set_layer_active(ldata, CD_MLOOPUV, n); else CustomData_set_layer_active(ldata, CD_MLOOPUV, n);
} }
mesh_update_customdata_pointers(me, TRUE); BKE_mesh_update_customdata_pointers(me, true);
} }
static void rna_CustomDataLayer_clone_set(PointerRNA *ptr, CustomData *data, int value, int type, int render) static void rna_CustomDataLayer_clone_set(PointerRNA *ptr, CustomData *data, int value, int type, int render)

@ -110,7 +110,7 @@
CustomData *ldata = rna_mesh_ldata_helper(me); \ CustomData *ldata = rna_mesh_ldata_helper(me); \
CustomData_set_layer_##active_type(ldata, CD_MLOOPUV, a); \ CustomData_set_layer_##active_type(ldata, CD_MLOOPUV, a); \
} \ } \
mesh_update_customdata_pointers(me, TRUE); \ BKE_mesh_update_customdata_pointers(me, true); \
return; \ return; \
} \ } \
} \ } \
@ -139,7 +139,7 @@
CustomData *ldata = rna_mesh_ldata_helper(me); \ CustomData *ldata = rna_mesh_ldata_helper(me); \
CustomData_set_layer_##active_type(ldata, CD_MLOOPUV, value); \ CustomData_set_layer_##active_type(ldata, CD_MLOOPUV, value); \
} \ } \
mesh_update_customdata_pointers(me, TRUE); \ BKE_mesh_update_customdata_pointers(me, true); \
} \ } \
} }

@ -341,7 +341,7 @@ static StructRNA *rna_NodeSocket_refine(PointerRNA *ptr)
#define SUBTYPE(socktype, stypename, id, idname) \ #define SUBTYPE(socktype, stypename, id, idname) \
{ \ { \
bNodeSocketValue##stypename * value = (bNodeSocketValue##stypename *)sock->default_value; \ bNodeSocketValue##stypename *value = (bNodeSocketValue##stypename *)sock->default_value; \
if (value->subtype == PROP_##id) \ if (value->subtype == PROP_##id) \
return &RNA_NodeSocket##stypename##idname; \ return &RNA_NodeSocket##stypename##idname; \
} }

@ -383,7 +383,7 @@ static void rna_Object_data_set(PointerRNA *ptr, PointerRNA value)
} }
} }
else if (ob->type == OB_MESH) { else if (ob->type == OB_MESH) {
set_mesh(ob, (Mesh *)id); BKE_mesh_assign_object(ob, (Mesh *)id);
} }
else { else {
if (ob->data) { if (ob->data) {

@ -1785,7 +1785,7 @@ static DerivedMesh *base_skin(DerivedMesh *origdm,
totvert = origdm->getNumVerts(origdm); totvert = origdm->getNumVerts(origdm);
totedge = origdm->getNumEdges(origdm); totedge = origdm->getNumEdges(origdm);
create_vert_edge_map(&emap, &emapmem, medge, totvert, totedge); BKE_mesh_vert_edge_map_create(&emap, &emapmem, medge, totvert, totedge);
emat = build_edge_mats(nodes, mvert, totvert, medge, emap, totedge); emat = build_edge_mats(nodes, mvert, totvert, medge, emap, totedge);
skin_nodes = build_frames(mvert, totvert, nodes, emap, emat); skin_nodes = build_frames(mvert, totvert, nodes, emap, emat);

@ -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");

@ -81,7 +81,7 @@ void bpy_import_init(PyObject *builtins)
/* move reload here /* move reload here
* XXX, use import hooks */ * XXX, use import hooks */
mod = PyImport_ImportModuleLevel((char *)"imp", NULL, NULL, NULL, 0); mod = PyImport_ImportModuleLevel("imp", NULL, NULL, NULL, 0);
if (mod) { if (mod) {
PyObject *mod_dict = PyModule_GetDict(mod); PyObject *mod_dict = PyModule_GetDict(mod);

@ -226,7 +226,7 @@ static PyMethodDef meth_bpy_resource_path =
static PyObject *bpy_import_test(const char *modname) static PyObject *bpy_import_test(const char *modname)
{ {
PyObject *mod = PyImport_ImportModuleLevel((char *)modname, NULL, NULL, NULL, 0); PyObject *mod = PyImport_ImportModuleLevel(modname, NULL, NULL, NULL, 0);
if (mod) { if (mod) {
Py_DECREF(mod); Py_DECREF(mod);
} }

@ -75,14 +75,14 @@ int bpy_pydriver_create_dict(void)
} }
/* add bpy to global namespace */ /* add bpy to global namespace */
mod = PyImport_ImportModuleLevel((char *)"bpy", NULL, NULL, NULL, 0); mod = PyImport_ImportModuleLevel("bpy", NULL, NULL, NULL, 0);
if (mod) { if (mod) {
PyDict_SetItemString(bpy_pydriver_Dict, "bpy", mod); PyDict_SetItemString(bpy_pydriver_Dict, "bpy", mod);
Py_DECREF(mod); Py_DECREF(mod);
} }
/* add noise to global namespace */ /* add noise to global namespace */
mod = PyImport_ImportModuleLevel((char *)"mathutils", NULL, NULL, NULL, 0); mod = PyImport_ImportModuleLevel("mathutils", NULL, NULL, NULL, 0);
if (mod) { if (mod) {
PyObject *modsub = PyDict_GetItemString(PyModule_GetDict(mod), "noise"); PyObject *modsub = PyDict_GetItemString(PyModule_GetDict(mod), "noise");
PyDict_SetItemString(bpy_pydriver_Dict, "noise", modsub); PyDict_SetItemString(bpy_pydriver_Dict, "noise", modsub);

@ -57,7 +57,7 @@ static void atexit_func_call(const char *func_name, PyObject *atexit_func_arg)
* this is intended, but if its problematic it could be changed * this is intended, but if its problematic it could be changed
* - campbell */ * - campbell */
PyObject *atexit_mod = PyImport_ImportModuleLevel((char *)"atexit", NULL, NULL, NULL, 0); PyObject *atexit_mod = PyImport_ImportModuleLevel("atexit", NULL, NULL, NULL, 0);
PyObject *atexit_func = PyObject_GetAttrString(atexit_mod, func_name); PyObject *atexit_func = PyObject_GetAttrString(atexit_mod, func_name);
PyObject *args = PyTuple_New(1); PyObject *args = PyTuple_New(1);
PyObject *ret; PyObject *ret;

@ -6118,7 +6118,7 @@ static PyObject *pyrna_srna_ExternalType(StructRNA *srna)
PyObject *newclass; PyObject *newclass;
if (bpy_types_dict == NULL) { if (bpy_types_dict == NULL) {
PyObject *bpy_types = PyImport_ImportModuleLevel((char *)"bpy_types", NULL, NULL, NULL, 0); PyObject *bpy_types = PyImport_ImportModuleLevel("bpy_types", NULL, NULL, NULL, 0);
if (bpy_types == NULL) { if (bpy_types == NULL) {
PyErr_Print(); PyErr_Print();

@ -870,16 +870,16 @@ PyMODINIT_FUNC PyInit_mathutils_noise_types(void)
{ {
PyObject *submodule = PyModule_Create(&M_NoiseTypes_module_def); PyObject *submodule = PyModule_Create(&M_NoiseTypes_module_def);
PyModule_AddIntConstant(submodule, (char *)"BLENDER", TEX_BLENDER); PyModule_AddIntConstant(submodule, "BLENDER", TEX_BLENDER);
PyModule_AddIntConstant(submodule, (char *)"STDPERLIN", TEX_STDPERLIN); PyModule_AddIntConstant(submodule, "STDPERLIN", TEX_STDPERLIN);
PyModule_AddIntConstant(submodule, (char *)"NEWPERLIN", TEX_NEWPERLIN); PyModule_AddIntConstant(submodule, "NEWPERLIN", TEX_NEWPERLIN);
PyModule_AddIntConstant(submodule, (char *)"VORONOI_F1", TEX_VORONOI_F1); PyModule_AddIntConstant(submodule, "VORONOI_F1", TEX_VORONOI_F1);
PyModule_AddIntConstant(submodule, (char *)"VORONOI_F2", TEX_VORONOI_F2); PyModule_AddIntConstant(submodule, "VORONOI_F2", TEX_VORONOI_F2);
PyModule_AddIntConstant(submodule, (char *)"VORONOI_F3", TEX_VORONOI_F3); PyModule_AddIntConstant(submodule, "VORONOI_F3", TEX_VORONOI_F3);
PyModule_AddIntConstant(submodule, (char *)"VORONOI_F4", TEX_VORONOI_F4); PyModule_AddIntConstant(submodule, "VORONOI_F4", TEX_VORONOI_F4);
PyModule_AddIntConstant(submodule, (char *)"VORONOI_F2F1", TEX_VORONOI_F2F1); PyModule_AddIntConstant(submodule, "VORONOI_F2F1", TEX_VORONOI_F2F1);
PyModule_AddIntConstant(submodule, (char *)"VORONOI_CRACKLE", TEX_VORONOI_CRACKLE); PyModule_AddIntConstant(submodule, "VORONOI_CRACKLE", TEX_VORONOI_CRACKLE);
PyModule_AddIntConstant(submodule, (char *)"CELLNOISE", TEX_CELLNOISE); PyModule_AddIntConstant(submodule, "CELLNOISE", TEX_CELLNOISE);
return submodule; return submodule;
} }
@ -900,13 +900,13 @@ PyMODINIT_FUNC PyInit_mathutils_noise_metrics(void)
{ {
PyObject *submodule = PyModule_Create(&M_NoiseMetrics_module_def); PyObject *submodule = PyModule_Create(&M_NoiseMetrics_module_def);
PyModule_AddIntConstant(submodule, (char *)"DISTANCE", TEX_DISTANCE); PyModule_AddIntConstant(submodule, "DISTANCE", TEX_DISTANCE);
PyModule_AddIntConstant(submodule, (char *)"DISTANCE_SQUARED", TEX_DISTANCE_SQUARED); PyModule_AddIntConstant(submodule, "DISTANCE_SQUARED", TEX_DISTANCE_SQUARED);
PyModule_AddIntConstant(submodule, (char *)"MANHATTAN", TEX_MANHATTAN); PyModule_AddIntConstant(submodule, "MANHATTAN", TEX_MANHATTAN);
PyModule_AddIntConstant(submodule, (char *)"CHEBYCHEV", TEX_CHEBYCHEV); PyModule_AddIntConstant(submodule, "CHEBYCHEV", TEX_CHEBYCHEV);
PyModule_AddIntConstant(submodule, (char *)"MINKOVSKY_HALF", TEX_MINKOVSKY_HALF); PyModule_AddIntConstant(submodule, "MINKOVSKY_HALF", TEX_MINKOVSKY_HALF);
PyModule_AddIntConstant(submodule, (char *)"MINKOVSKY_FOUR", TEX_MINKOVSKY_FOUR); PyModule_AddIntConstant(submodule, "MINKOVSKY_FOUR", TEX_MINKOVSKY_FOUR);
PyModule_AddIntConstant(submodule, (char *)"MINKOVSKY", TEX_MINKOVSKY); PyModule_AddIntConstant(submodule, "MINKOVSKY", TEX_MINKOVSKY);
return submodule; return submodule;
} }

@ -295,8 +295,8 @@ static OSStatus AudioConverterInputCallback(AudioConverterRef inAudioConverter,
qtexport->audioTotalExportedFrames += *ioNumberDataPackets; qtexport->audioTotalExportedFrames += *ioNumberDataPackets;
AUD_readDevice(qtexport->audioInputDevice, (UInt8*)qtexport->audioInputBuffer, AUD_readDevice(qtexport->audioInputDevice, (UInt8 *)qtexport->audioInputBuffer,
qtexport->audioInputFormat.mFramesPerPacket * *ioNumberDataPackets); qtexport->audioInputFormat.mFramesPerPacket * *ioNumberDataPackets);
ioData->mBuffers[0].mDataByteSize = qtexport->audioInputFormat.mBytesPerPacket * *ioNumberDataPackets; ioData->mBuffers[0].mDataByteSize = qtexport->audioInputFormat.mBytesPerPacket * *ioNumberDataPackets;
ioData->mBuffers[0].mData = qtexport->audioInputBuffer; ioData->mBuffers[0].mData = qtexport->audioInputBuffer;
@ -357,7 +357,7 @@ int start_qt(struct Scene *scene, struct RenderData *rd, int rectx, int recty, R
tmpnam(name); tmpnam(name);
strcat(name, extension); strcat(name, extension);
outputFileURL = CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault,(UInt8*) name, strlen(name), false); outputFileURL = CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault,(UInt8 *)name, strlen(name), false);
if (outputFileURL) { if (outputFileURL) {

@ -103,12 +103,12 @@ int RE_rayobjectcontrol_test_break(RayObjectControl *c);
#define RE_rayobject_isVlakPrimitive(o) ((((intptr_t)o)&3) == 3) #define RE_rayobject_isVlakPrimitive(o) ((((intptr_t)o)&3) == 3)
/* used to align a given ray object */ /* used to align a given ray object */
#define RE_rayobject_align(o) ((RayObject*)(((intptr_t)o)&(~3))) #define RE_rayobject_align(o) ((RayObject *)(((intptr_t)o)&(~3)))
/* used to unalign a given ray object */ /* used to unalign a given ray object */
#define RE_rayobject_unalignRayFace(o) ((RayObject*)(((intptr_t)o)|1)) #define RE_rayobject_unalignRayFace(o) ((RayObject *)(((intptr_t)o)|1))
#define RE_rayobject_unalignRayAPI(o) ((RayObject*)(((intptr_t)o)|2)) #define RE_rayobject_unalignRayAPI(o) ((RayObject *)(((intptr_t)o)|2))
#define RE_rayobject_unalignVlakPrimitive(o) ((RayObject*)(((intptr_t)o)|3)) #define RE_rayobject_unalignVlakPrimitive(o) ((RayObject *)(((intptr_t)o)|3))
/* /*
* This rayobject represents a generic object. With it's own callbacks for raytrace operations. * This rayobject represents a generic object. With it's own callbacks for raytrace operations.

@ -1500,7 +1500,7 @@ static void tag_scenes_for_render(Render *re)
if (node->id) { if (node->id) {
if (!MAIN_VERSION_ATLEAST(re->main, 265, 5)) { if (!MAIN_VERSION_ATLEAST(re->main, 265, 5)) {
if (rlayer_node_uses_alpha(re->scene->nodetree, node)) { if (rlayer_node_uses_alpha(re->scene->nodetree, node)) {
Scene *scene = (Scene*) node->id; Scene *scene = (Scene *)node->id;
if (scene->r.alphamode != R_ALPHAPREMUL) { if (scene->r.alphamode != R_ALPHAPREMUL) {
BKE_reportf(re->reports, RPT_WARNING, "Setting scene %s alpha mode to Premul", scene->id.name + 2); BKE_reportf(re->reports, RPT_WARNING, "Setting scene %s alpha mode to Premul", scene->id.name + 2);

@ -938,7 +938,7 @@ HaloRen *RE_findOrAddHalo(ObjectRen *obr, int nr)
// TABLEINITSIZE, obr->blohalen+TABLEINITSIZE ); // TABLEINITSIZE, obr->blohalen+TABLEINITSIZE );
temp=obr->bloha; temp=obr->bloha;
obr->bloha = (HaloRen**)MEM_callocN(sizeof(void *) * (obr->blohalen + TABLEINITSIZE), "Bloha"); obr->bloha = (HaloRen **)MEM_callocN(sizeof(void *) * (obr->blohalen + TABLEINITSIZE), "Bloha");
if (temp) memcpy(obr->bloha, temp, obr->blohalen*sizeof(void *)); if (temp) memcpy(obr->bloha, temp, obr->blohalen*sizeof(void *));
memset(&(obr->bloha[obr->blohalen]), 0, TABLEINITSIZE * sizeof(void *)); memset(&(obr->bloha[obr->blohalen]), 0, TABLEINITSIZE * sizeof(void *));
obr->blohalen+=TABLEINITSIZE; /*Does this really need to be power of 2?*/ obr->blohalen+=TABLEINITSIZE; /*Does this really need to be power of 2?*/

@ -2830,7 +2830,8 @@ int WM_gesture_circle_modal(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_FINISHED; /* use finish or we don't get an undo */ return OPERATOR_FINISHED; /* use finish or we don't get an undo */
} }
} }
// /* Allow view navigation??? */ /* Allow view navigation??? */
/* note, this gives issues: 1) other modal ops run on top (border select), 2) middlemouse is used now 3) tablet/trackpad? */
// else { // else {
// return OPERATOR_PASS_THROUGH; // return OPERATOR_PASS_THROUGH;
// } // }

@ -504,8 +504,8 @@ void WM_operator_properties_free(struct PointerRNA *ptr) {}
void WM_operator_properties_create(struct PointerRNA *ptr, const char *opstring) {} void WM_operator_properties_create(struct PointerRNA *ptr, const char *opstring) {}
void WM_operator_properties_create_ptr(struct PointerRNA *ptr, struct wmOperatorType *ot) {} void WM_operator_properties_create_ptr(struct PointerRNA *ptr, struct wmOperatorType *ot) {}
void WM_operator_properties_sanitize(struct PointerRNA *ptr, const short no_context) {}; void WM_operator_properties_sanitize(struct PointerRNA *ptr, const short no_context) {};
void WM_operatortype_append_ptr(void (*opfunc)(struct wmOperatorType*, void*), void *userdata) {} void WM_operatortype_append_ptr(void (*opfunc)(struct wmOperatorType*, void *), void *userdata) {}
void WM_operatortype_append_macro_ptr(void (*opfunc)(struct wmOperatorType*, void*), void *userdata) {} void WM_operatortype_append_macro_ptr(void (*opfunc)(struct wmOperatorType*, void *), void *userdata) {}
void WM_operator_bl_idname(char *to, const char *from) {} void WM_operator_bl_idname(char *to, const char *from) {}
void WM_operator_py_idname(char *to, const char *from) {} void WM_operator_py_idname(char *to, const char *from) {}
void WM_operator_ui_popup(struct bContext *C, struct wmOperator *op, int width, int height) {} void WM_operator_ui_popup(struct bContext *C, struct wmOperator *op, int width, int height) {}

@ -130,10 +130,10 @@ void BL_ArmatureConstraint::ReParent(BL_ArmatureObject* armature)
m_constraint = NULL; m_constraint = NULL;
m_posechannel = NULL; m_posechannel = NULL;
// and locate the constraint // and locate the constraint
for (pchan = (bPoseChannel*)newpose->chanbase.first; pchan; pchan=(bPoseChannel*)pchan->next) { for (pchan = (bPoseChannel*)newpose->chanbase.first; pchan; pchan = (bPoseChannel*)pchan->next) {
if (!strcmp(pchan->name, posechannel)) { if (!strcmp(pchan->name, posechannel)) {
// now locate the constraint // now locate the constraint
for (pcon = (bConstraint*)pchan->constraints.first; pcon; pcon=(bConstraint*)pcon->next) { for (pcon = (bConstraint *)pchan->constraints.first; pcon; pcon = (bConstraint *)pcon->next) {
if (!strcmp(pcon->name, constraint)) { if (!strcmp(pcon->name, constraint)) {
m_constraint = pcon; m_constraint = pcon;
m_posechannel = pchan; m_posechannel = pchan;

@ -100,14 +100,14 @@ void game_copy_pose(bPose **dst, bPose *src, int copy_constraint)
/* remap pointers */ /* remap pointers */
ghash= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "game_copy_pose gh"); ghash= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "game_copy_pose gh");
pchan= (bPoseChannel*)src->chanbase.first; pchan= (bPoseChannel *)src->chanbase.first;
outpchan= (bPoseChannel*)out->chanbase.first; outpchan= (bPoseChannel *)out->chanbase.first;
for (; pchan; pchan=pchan->next, outpchan=outpchan->next) for (; pchan; pchan=pchan->next, outpchan=outpchan->next)
BLI_ghash_insert(ghash, pchan, outpchan); BLI_ghash_insert(ghash, pchan, outpchan);
for (pchan = (bPoseChannel*)out->chanbase.first; pchan; pchan = pchan->next) { for (pchan = (bPoseChannel *)out->chanbase.first; pchan; pchan = pchan->next) {
pchan->parent= (bPoseChannel*)BLI_ghash_lookup(ghash, pchan->parent); pchan->parent= (bPoseChannel *)BLI_ghash_lookup(ghash, pchan->parent);
pchan->child= (bPoseChannel*)BLI_ghash_lookup(ghash, pchan->child); pchan->child= (bPoseChannel *)BLI_ghash_lookup(ghash, pchan->child);
if (copy_constraint) { if (copy_constraint) {
ListBase listb; ListBase listb;
@ -158,8 +158,8 @@ void game_blend_poses(bPose *dst, bPose *src, float srcweight/*, short mode*/)
dstweight = 1.0F; dstweight = 1.0F;
} }
schan= (bPoseChannel*)src->chanbase.first; schan= (bPoseChannel *)src->chanbase.first;
for (dchan = (bPoseChannel*)dst->chanbase.first; dchan; dchan=(bPoseChannel*)dchan->next, schan= (bPoseChannel*)schan->next) { for (dchan = (bPoseChannel *)dst->chanbase.first; dchan; dchan=(bPoseChannel *)dchan->next, schan= (bPoseChannel *)schan->next) {
// always blend on all channels since we don't know which one has been set // always blend on all channels since we don't know which one has been set
/* quat interpolation done separate */ /* quat interpolation done separate */
if (schan->rotmode == ROT_MODE_QUAT) { if (schan->rotmode == ROT_MODE_QUAT) {
@ -376,7 +376,7 @@ void BL_ArmatureObject::LoadChannels()
BL_ArmatureChannel* proxy; BL_ArmatureChannel* proxy;
m_channelNumber = 0; m_channelNumber = 0;
for (pchan = (bPoseChannel*)m_pose->chanbase.first; pchan; pchan=(bPoseChannel*)pchan->next) { for (pchan = (bPoseChannel *)m_pose->chanbase.first; pchan; pchan=(bPoseChannel *)pchan->next) {
proxy = new BL_ArmatureChannel(this, pchan); proxy = new BL_ArmatureChannel(this, pchan);
m_poseChannels.AddBack(proxy); m_poseChannels.AddBack(proxy);
m_channelNumber++; m_channelNumber++;

@ -2140,7 +2140,7 @@ static void UNUSED_FUNCTION(RBJconstraints)(Object *ob)//not used
conlist = get_active_constraints2(ob); conlist = get_active_constraints2(ob);
if (conlist) { if (conlist) {
for (curcon = (bConstraint *)conlist->first; curcon; curcon=(bConstraint *)curcon->next) { for (curcon = (bConstraint *)conlist->first; curcon; curcon = (bConstraint *)curcon->next) {
printf("%i\n",curcon->type); printf("%i\n",curcon->type);
} }
@ -2785,7 +2785,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
continue; continue;
if (conlist) { if (conlist) {
for (curcon = (bConstraint *)conlist->first; curcon; curcon=(bConstraint *)curcon->next) { for (curcon = (bConstraint *)conlist->first; curcon; curcon = (bConstraint *)curcon->next) {
if (curcon->type==CONSTRAINT_TYPE_RIGIDBODYJOINT) { if (curcon->type==CONSTRAINT_TYPE_RIGIDBODYJOINT) {
bRigidBodyJointConstraint *dat=(bRigidBodyJointConstraint *)curcon->data; bRigidBodyJointConstraint *dat=(bRigidBodyJointConstraint *)curcon->data;

@ -94,7 +94,7 @@ bool BL_DeformableGameObject::GetShape(vector<float> &shape)
if (key && key->type==KEY_RELATIVE) if (key && key->type==KEY_RELATIVE)
{ {
KeyBlock *kb; KeyBlock *kb;
for (kb = (KeyBlock*)key->block.first; kb; kb = (KeyBlock*)kb->next) for (kb = (KeyBlock *)key->block.first; kb; kb = (KeyBlock *)kb->next)
{ {
shape.push_back(kb->curval); shape.push_back(kb->curval);
} }

@ -176,9 +176,9 @@ void BL_ShapeActionActuator::BlendShape(Key* key, float srcweight)
dstweight = 1.0F - srcweight; dstweight = 1.0F - srcweight;
for (it=m_blendshape.begin(), kb = (KeyBlock*)key->block.first; for (it=m_blendshape.begin(), kb = (KeyBlock *)key->block.first;
kb && it != m_blendshape.end(); kb && it != m_blendshape.end();
kb = (KeyBlock*)kb->next, it++) kb = (KeyBlock *)kb->next, it++)
{ {
kb->curval = kb->curval * dstweight + (*it) * srcweight; kb->curval = kb->curval * dstweight + (*it) * srcweight;
} }
@ -439,7 +439,7 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
KeyBlock *kb; KeyBlock *kb;
// We go through and clear out the keyblocks so there isn't any interference // We go through and clear out the keyblocks so there isn't any interference
// from other shape actions // from other shape actions
for (kb=(KeyBlock*)key->block.first; kb; kb=(KeyBlock*)kb->next) for (kb=(KeyBlock *)key->block.first; kb; kb=(KeyBlock *)kb->next)
kb->curval = 0.f; kb->curval = 0.f;
animsys_evaluate_action(m_idptr, m_action, NULL, m_localtime); animsys_evaluate_action(m_idptr, m_action, NULL, m_localtime);

@ -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)

@ -270,7 +270,7 @@ void SCA_PythonController::ErrorPrint(const char *error_msg)
* their user count. Not to mention holding references to wrapped data. * their user count. Not to mention holding references to wrapped data.
* This is especially bad when the PyObject for the wrapped data is freed, after blender * This is especially bad when the PyObject for the wrapped data is freed, after blender
* has already dealocated the pointer */ * has already dealocated the pointer */
PySys_SetObject( (char *)"last_traceback", NULL); PySys_SetObject("last_traceback", NULL);
PyErr_Clear(); /* just to be sure */ PyErr_Clear(); /* just to be sure */
} }

@ -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();

@ -239,7 +239,7 @@ bool BL_Action::Play(const char* name,
// Now that we have the previous blend shape saved, we can clear out the key to avoid any // Now that we have the previous blend shape saved, we can clear out the key to avoid any
// further interference. // further interference.
KeyBlock *kb; KeyBlock *kb;
for (kb=(KeyBlock*)shape_deformer->GetKey()->block.first; kb; kb=(KeyBlock*)kb->next) for (kb=(KeyBlock *)shape_deformer->GetKey()->block.first; kb; kb=(KeyBlock *)kb->next)
kb->curval = 0.f; kb->curval = 0.f;
} }
} }
@ -358,9 +358,9 @@ void BL_Action::BlendShape(Key* key, float srcweight, std::vector<float>& blends
dstweight = 1.0F - srcweight; dstweight = 1.0F - srcweight;
//printf("Dst: %f\tSrc: %f\n", srcweight, dstweight); //printf("Dst: %f\tSrc: %f\n", srcweight, dstweight);
for (it=blendshape.begin(), kb = (KeyBlock*)key->block.first; for (it=blendshape.begin(), kb = (KeyBlock *)key->block.first;
kb && it != blendshape.end(); kb && it != blendshape.end();
kb = (KeyBlock*)kb->next, it++) kb = (KeyBlock *)kb->next, it++)
{ {
//printf("OirgKeys: %f\t%f\n", kb->curval, (*it)); //printf("OirgKeys: %f\t%f\n", kb->curval, (*it));
kb->curval = kb->curval * dstweight + (*it) * srcweight; kb->curval = kb->curval * dstweight + (*it) * srcweight;
@ -478,7 +478,7 @@ void BL_Action::Update(float curtime)
// We go through and clear out the keyblocks so there isn't any interference // We go through and clear out the keyblocks so there isn't any interference
// from other shape actions // from other shape actions
KeyBlock *kb; KeyBlock *kb;
for (kb=(KeyBlock*)key->block.first; kb; kb=(KeyBlock*)kb->next) for (kb=(KeyBlock *)key->block.first; kb; kb=(KeyBlock *)kb->next)
kb->curval = 0.f; kb->curval = 0.f;
// Now blend the shape // Now blend the shape

@ -80,7 +80,7 @@ void KX_ArmatureSensor::FindConstraint()
for (pchan = (bPoseChannel*)pose->chanbase.first; pchan; pchan=(bPoseChannel*)pchan->next) { for (pchan = (bPoseChannel*)pose->chanbase.first; pchan; pchan=(bPoseChannel*)pchan->next) {
if (!strcmp(pchan->name, m_posechannel)) { if (!strcmp(pchan->name, m_posechannel)) {
// now locate the constraint // now locate the constraint
for (pcon = (bConstraint*)pchan->constraints.first; pcon; pcon=(bConstraint*)pcon->next) { for (pcon = (bConstraint *)pchan->constraints.first; pcon; pcon = (bConstraint *)pcon->next) {
if (!strcmp(pcon->name, m_constraintname)) { if (!strcmp(pcon->name, m_constraintname)) {
if (pcon->flag & CONSTRAINT_DISABLE) if (pcon->flag & CONSTRAINT_DISABLE)
/* this constraint is not valid, can't use it */ /* this constraint is not valid, can't use it */

@ -154,7 +154,7 @@ bool KX_PolygonMaterial::Activate(RAS_IRasterizer* rasty, TCachingInfo& cachingI
{ {
PyErr_Print(); PyErr_Print();
PyErr_Clear(); PyErr_Clear();
PySys_SetObject( (char *)"last_traceback", NULL); PySys_SetObject("last_traceback", NULL);
} }
} }
else else

@ -1929,14 +1929,14 @@ PyObject *initGamePlayerPythonScripting(const STR_String& progname, TPythonSecur
/* mathutils types are used by the BGE even if we don't import them */ /* mathutils types are used by the BGE even if we don't import them */
{ {
PyObject *mod= PyImport_ImportModuleLevel((char *)"mathutils", NULL, NULL, NULL, 0); PyObject *mod = PyImport_ImportModuleLevel("mathutils", NULL, NULL, NULL, 0);
Py_DECREF(mod); Py_DECREF(mod);
} }
#ifdef WITH_AUDASPACE #ifdef WITH_AUDASPACE
/* accessing a SoundActuator's sound results in a crash if aud is not initialized... */ /* accessing a SoundActuator's sound results in a crash if aud is not initialized... */
{ {
PyObject *mod= PyImport_ImportModuleLevel((char *)"aud", NULL, NULL, NULL, 0); PyObject *mod = PyImport_ImportModuleLevel("aud", NULL, NULL, NULL, 0);
Py_DECREF(mod); Py_DECREF(mod);
} }
#endif #endif
@ -1993,7 +1993,7 @@ PyObject *initGamePythonScripting(const STR_String& progname, TPythonSecurityLev
#ifdef WITH_AUDASPACE #ifdef WITH_AUDASPACE
/* accessing a SoundActuator's sound results in a crash if aud is not initialized... */ /* accessing a SoundActuator's sound results in a crash if aud is not initialized... */
{ {
PyObject *mod= PyImport_ImportModuleLevel((char *)"aud", NULL, NULL, NULL, 0); PyObject *mod= PyImport_ImportModuleLevel("aud", NULL, NULL, NULL, 0);
Py_DECREF(mod); Py_DECREF(mod);
} }
#endif #endif

@ -172,9 +172,9 @@ void initPyTypes(void)
*/ */
/* For now just do PyType_Ready */ /* For now just do PyType_Ready */
PyObject *mod= PyModule_New("GameTypes"); PyObject *mod = PyModule_New("GameTypes");
PyObject *dict= PyModule_GetDict(mod); PyObject *dict = PyModule_GetDict(mod);
PyDict_SetItemString(PySys_GetObject((char *)"modules"), (char *)"GameTypes", mod); PyDict_SetItemString(PySys_GetObject("modules"), "GameTypes", mod);
Py_DECREF(mod); Py_DECREF(mod);

@ -115,7 +115,7 @@ RAS_MeshObject::RAS_MeshObject(Mesh* mesh)
int count=0; int count=0;
// initialize weight cache for shape objects // initialize weight cache for shape objects
// count how many keys in this mesh // count how many keys in this mesh
for (kb= (KeyBlock*)m_mesh->key->block.first; kb; kb= (KeyBlock*)kb->next) for (kb= (KeyBlock *)m_mesh->key->block.first; kb; kb= (KeyBlock *)kb->next)
count++; count++;
m_cacheWeightIndex.resize(count,-1); m_cacheWeightIndex.resize(count,-1);
} }
@ -129,7 +129,7 @@ RAS_MeshObject::~RAS_MeshObject()
{ {
KeyBlock *kb; KeyBlock *kb;
// remove the weight cache to avoid memory leak // remove the weight cache to avoid memory leak
for (kb= (KeyBlock*)m_mesh->key->block.first; kb; kb= (KeyBlock*)kb->next) { for (kb = (KeyBlock *)m_mesh->key->block.first; kb; kb = (KeyBlock *)kb->next) {
if (kb->weights) if (kb->weights)
MEM_freeN(kb->weights); MEM_freeN(kb->weights);
kb->weights= NULL; kb->weights= NULL;

Some files were not shown because too many files have changed in this diff Show More