diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-09-28 11:34:48 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-09-28 11:34:48 +0400 |
commit | 4a157de23d43c22abec8bd6922f0355334e413f8 (patch) | |
tree | c8ca75fef261ce1316ea9042aa4bd689aa4eb584 /source/blender | |
parent | dbdb58f2a3c0d086afabdacab40c4d83c79e1a04 (diff) | |
parent | bc593cac2354c863f074d9d51cffb3dca9f499a3 (diff) |
svn merge ^/trunk/blender -r40587:40643
Diffstat (limited to 'source/blender')
88 files changed, 1148 insertions, 1019 deletions
diff --git a/source/blender/avi/intern/avirgb.c b/source/blender/avi/intern/avirgb.c index 7050aec9bf6..c7d47b9da0d 100644 --- a/source/blender/avi/intern/avirgb.c +++ b/source/blender/avi/intern/avirgb.c @@ -44,7 +44,8 @@ /* implementation */ -void *avi_converter_from_avi_rgb (AviMovie *movie, int stream, unsigned char *buffer, int *size) { +void *avi_converter_from_avi_rgb (AviMovie *movie, int stream, unsigned char *buffer, int *size) +{ int x, y,i, rowstride; unsigned char *buf; AviBitmapInfoHeader *bi; @@ -116,7 +117,8 @@ void *avi_converter_from_avi_rgb (AviMovie *movie, int stream, unsigned char *bu } } -void *avi_converter_to_avi_rgb (AviMovie *movie, int stream, unsigned char *buffer, int *size) { +void *avi_converter_to_avi_rgb (AviMovie *movie, int stream, unsigned char *buffer, int *size) +{ int y, x, i, rowstride; unsigned char *buf; diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 10bc910c279..2a8d0fb0fb9 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -365,8 +365,9 @@ if(WITH_GAMEENGINE) ) endif() -if(MSVC) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX") -endif() +## Warnings as errors, this is too strict! +#if(MSVC) +# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX") +#endif() blender_add_lib(bf_blenkernel "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/blenkernel/intern/BME_structure.c b/source/blender/blenkernel/intern/BME_structure.c index ce7601d1fd8..2a16f8f18ff 100644 --- a/source/blender/blenkernel/intern/BME_structure.c +++ b/source/blender/blenkernel/intern/BME_structure.c @@ -504,16 +504,16 @@ void BME_disk_remove_edge(BME_Edge *e, BME_Vert *v) BME_Edge *BME_disk_next_edgeflag(BME_Edge *e, BME_Vert *v, int eflag, int tflag){ - BME_CycleNode *diskbase; + /* BME_CycleNode *diskbase; */ /* UNUSED */ BME_Edge *curedge; - int len, ok; + int /* len, */ /* UNUSED */ ok; if(eflag && tflag) return NULL; ok = BME_vert_in_edge(e,v); if(ok){ - diskbase = BME_disk_getpointer(e, v); - len = BME_cycle_length(diskbase); + /* diskbase = BME_disk_getpointer(e, v); */ /* UNUSED */ + /* len = BME_cycle_length(diskbase); */ /* UNUSED */ curedge = BME_disk_nextedge(e,v); while(curedge != e){ if(tflag){ diff --git a/source/blender/blenkernel/intern/BME_tools.c b/source/blender/blenkernel/intern/BME_tools.c index c9b746cec33..17df83f1edc 100644 --- a/source/blender/blenkernel/intern/BME_tools.c +++ b/source/blender/blenkernel/intern/BME_tools.c @@ -394,19 +394,19 @@ static float BME_bevel_project_vec(float *vec1, float *vec2, float *up_vec, int * and transform properties, and set the max limits. * Finally, return the split vert. */ static BME_Vert *BME_bevel_split_edge(BME_Mesh *bm, BME_Vert *v, BME_Vert *v1, BME_Loop *l, float *up_vec, float value, BME_TransData_Head *td) { - BME_TransData *vtd, *vtd1, *vtd2; - BME_Vert *sv, *v2, *v3, *ov; + BME_TransData *vtd, *vtd1 /* , *vtd2 */ /* UNUSED */; + BME_Vert *sv, *v2, *v3 /* , *ov */ /* UNUSED */; BME_Loop *lv1, *lv2; BME_Edge *ne, *e1, *e2; float maxfactor, scale, len, dis, vec1[3], vec2[3], t_up_vec[3]; - int is_edge, forward, is_split_vert; + int is_edge, forward /* , is_split_vert */ /* UNUSED */; if (l == NULL) { /* what you call operator overloading in C :) * I wanted to use the same function for both wire edges and poly loops * so... here we walk around edges to find the needed verts */ forward = 1; - is_split_vert = 0; + /* is_split_vert = 0; */ /* UNUSED */ if (v->e == NULL) { //printf("We can't split a loose vert's edge!\n"); return NULL; @@ -429,7 +429,7 @@ static BME_Vert *BME_bevel_split_edge(BME_Mesh *bm, BME_Vert *v, BME_Vert *v1, B else { e1 = e2; } - ov = BME_edge_getothervert(e1,v); + /* ov = BME_edge_getothervert(e1,v); */ /* UNUSED */ sv = BME_split_edge(bm,v,e1,&ne,0); //BME_data_interp_from_verts(bm, v, ov, sv, 0.25); /*this is technically wrong...*/ //BME_data_interp_from_faceverts(bm, v, ov, sv, 0.25); @@ -465,14 +465,14 @@ static BME_Vert *BME_bevel_split_edge(BME_Mesh *bm, BME_Vert *v, BME_Vert *v1, B } if (BME_bevel_is_split_vert(lv1)) { - is_split_vert = 1; + /* is_split_vert = 1; */ /* UNUSED */ sv = v1; if (forward) v1 = l->next->next->v; else v1 = l->prev->v; } else { - is_split_vert = 0; - ov = BME_edge_getothervert(l->e,v); + /* is_split_vert = 0; */ /* UNUSED */ + /* ov = BME_edge_getothervert(l->e,v); */ /* UNUSED */ sv = BME_split_edge(bm,v,l->e,&ne,0); //BME_data_interp_from_verts(bm, v, ov, sv, 0.25); /*this is technically wrong...*/ //BME_data_interp_from_faceverts(bm, v, ov, sv, 0.25); @@ -495,7 +495,7 @@ static BME_Vert *BME_bevel_split_edge(BME_Mesh *bm, BME_Vert *v, BME_Vert *v1, B vtd = BME_get_transdata(td, sv); vtd1 = BME_get_transdata(td, v); - vtd2 = BME_get_transdata(td,v1); + /* vtd2 = BME_get_transdata(td,v1); */ /* UNUSED */ if (vtd1->loc == NULL) { /* this is a vert with data only for calculating initial weights */ @@ -718,7 +718,7 @@ static BME_Loop *BME_bevel_edge(BME_Mesh *bm, BME_Loop *l, float value, int UNUS static BME_Loop *BME_bevel_vert(BME_Mesh *bm, BME_Loop *l, float value, int UNUSED(options), float *up_vec, BME_TransData_Head *td) { BME_Vert *v1, *v2; - BME_Poly *f; + /* BME_Poly *f; */ /* UNUSED */ /* get/make the first vert to be used in SFME */ /* may need to split the previous edge */ @@ -731,7 +731,7 @@ static BME_Loop *BME_bevel_vert(BME_Mesh *bm, BME_Loop *l, float value, int UNUS l = l->next->next; /* "cut off" this corner */ - f = BME_split_face(bm,l->f,v2,v1,NULL,l->e); + /* f = */ /* UNUSED */ BME_split_face(bm,l->f,v2,v1,NULL,l->e); return l; } @@ -930,16 +930,16 @@ static BME_Mesh *BME_bevel_initialize(BME_Mesh *bm, int options, int UNUSED(defg BME_Vert *v; BME_Edge *e; BME_Poly *f; - BME_TransData *vtd; - MDeformVert *dvert; - MDeformWeight *dw; + /* BME_TransData *vtd; */ /* UNUSED */ + /* MDeformVert *dvert; */ /* UNUSED */ + /* MDeformWeight *dw; */ /* UNUSED */ int len; float weight, threshold; /* vert pass */ for (v=bm->verts.first; v; v=v->next) { - dvert = NULL; - dw = NULL; + /* dvert = NULL; */ /* UNUSED */ + /* dw = NULL; */ /* UNUSED */ v->tflag1 = BME_BEVEL_ORIG; /* originally coded, a vertex gets tagged with BME_BEVEL_BEVEL in this pass if * the vert is manifold (or is shared by only two edges - wire bevel) @@ -963,7 +963,7 @@ static BME_Mesh *BME_bevel_initialize(BME_Mesh *bm, int options, int UNUSED(defg else { len = BME_cycle_length(BME_disk_getpointer(v->e,v)); /* we'll assign a default transform data to every vert (except the loose ones) */ - vtd = BME_assign_transdata(td, bm, v, v->co, v->co, NULL, NULL, 0, -1, -1, NULL); + /* vtd = */ /* UNUSED */ BME_assign_transdata(td, bm, v, v->co, v->co, NULL, NULL, 0, -1, -1, NULL); } /* check for non-manifold vert */ @@ -991,11 +991,11 @@ static BME_Mesh *BME_bevel_initialize(BME_Mesh *bm, int options, int UNUSED(defg //~ } //~ if (!dw || dw->weight == 0.0) continue; if (v->bweight == 0.0) continue; - vtd = BME_assign_transdata(td, bm, v, v->co, v->co, NULL, NULL, 1.0, v->bweight, -1, NULL); + /* vtd = */ /* UNUSED */ BME_assign_transdata(td, bm, v, v->co, v->co, NULL, NULL, 1.0, v->bweight, -1, NULL); v->tflag1 |= BME_BEVEL_BEVEL; } else { - vtd = BME_assign_transdata(td, bm, v, v->co, v->co, NULL, NULL, 1.0, 1.0, -1, NULL); + /* vtd = */ /* UNUSED */ BME_assign_transdata(td, bm, v, v->co, v->co, NULL, NULL, 1.0, 1.0, -1, NULL); v->tflag1 |= BME_BEVEL_BEVEL; } } diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c index 3966caa1fa9..f9f210fbae4 100644 --- a/source/blender/blenkernel/intern/boids.c +++ b/source/blender/blenkernel/intern/boids.c @@ -908,7 +908,8 @@ static int apply_boid_rule(BoidBrainData *bbd, BoidRule *rule, BoidValues *val, else return 0; } -static BoidState *get_boid_state(BoidSettings *boids, ParticleData *pa) { +static BoidState *get_boid_state(BoidSettings *boids, ParticleData *pa) +{ BoidState *state = boids->states.first; BoidParticle *bpa = pa->boid; diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index 700c6693a24..fcf9f69ed0c 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -1375,7 +1375,8 @@ static CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2, BVHTree return collpair; } -static void machine_epsilon_offset(Cloth *cloth) { +static void machine_epsilon_offset(Cloth *cloth) +{ ClothVertex *cv; int i, j; diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 7472e03d6d1..0031acd5dc7 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -3937,7 +3937,8 @@ static bConstraintTypeInfo *constraintsTypeInfo[NUM_CONSTRAINT_TYPES]; static short CTI_INIT= 1; /* when non-zero, the list needs to be updated */ /* This function only gets called when CTI_INIT is non-zero */ -static void constraints_init_typeinfo (void) { +static void constraints_init_typeinfo (void) +{ constraintsTypeInfo[0]= NULL; /* 'Null' Constraint */ constraintsTypeInfo[1]= &CTI_CHILDOF; /* ChildOf Constraint */ constraintsTypeInfo[2]= &CTI_TRACKTO; /* TrackTo Constraint */ diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index 8c7e17ca59b..883230723e4 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -1408,7 +1408,8 @@ void makeDispListCurveTypes_forOrco(struct Scene *scene, struct Object *ob, stru } /* add Orco layer to the displist object which has got derived mesh and return orco */ -float *makeOrcoDispList(Scene *scene, Object *ob, DerivedMesh *derivedFinal, int forRender) { +float *makeOrcoDispList(Scene *scene, Object *ob, DerivedMesh *derivedFinal, int forRender) +{ float *orco; if (derivedFinal == NULL) diff --git a/source/blender/blenkernel/intern/idcode.c b/source/blender/blenkernel/intern/idcode.c index f37e05e9842..5994b8a3a38 100755 --- a/source/blender/blenkernel/intern/idcode.c +++ b/source/blender/blenkernel/intern/idcode.c @@ -109,7 +109,8 @@ int BKE_idcode_is_valid(int code) return idtype_from_code(code)?1:0; } -int BKE_idcode_is_linkable(int code) { +int BKE_idcode_is_linkable(int code) +{ IDType *idt= idtype_from_code(code); return idt?(idt->flags&IDTYPE_FLAGS_ISLINKABLE):0; } diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index b603deaca8e..e7203775a22 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -2839,7 +2839,8 @@ void object_sculpt_modifiers_changed(Object *ob) } } -float give_timeoffset(Object *ob) { +float give_timeoffset(Object *ob) +{ if ((ob->ipoflag & OB_OFFS_PARENTADD) && ob->parent) { return ob->sf + give_timeoffset(ob->parent); } else { @@ -2847,7 +2848,8 @@ float give_timeoffset(Object *ob) { } } -int give_obdata_texspace(Object *ob, short **texflag, float **loc, float **size, float **rot) { +int give_obdata_texspace(Object *ob, short **texflag, float **loc, float **size, float **rot) +{ if (ob->data==NULL) return 0; diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index a56010a5ccf..fb69db17b97 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -2544,7 +2544,8 @@ static void ptcache_dt_to_str(char *str, double dtime) sprintf(str, "%is", ((int)dtime) % 60); } -static void *ptcache_bake_thread(void *ptr) { +static void *ptcache_bake_thread(void *ptr) +{ int usetimer = 0, sfra, efra; double stime, ptime, ctime, fetd; char run[32], cur[32], etd[32]; diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c index d529a6d94c9..a75a075dfc1 100644 --- a/source/blender/blenkernel/intern/sca.c +++ b/source/blender/blenkernel/intern/sca.c @@ -641,6 +641,8 @@ void sca_remove_ob_poin(Object *obt, Object *ob) bMessageActuator *ma; bParentActuator *para; bArmatureActuator *aa; + bSteeringActuator *sta; + sens= obt->sensors.first; while(sens) { @@ -688,6 +690,10 @@ void sca_remove_ob_poin(Object *obt, Object *ob) if (aa->target == ob) aa->target = NULL; if (aa->subtarget == ob) aa->subtarget = NULL; break; + case ACT_STEERING: + sta = act->data; + if (sta->navmesh == ob) sta->navmesh = NULL; + if (sta->target == ob) sta->target = NULL; } act= act->next; } diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 6741ff2d018..d8ae36b4ab5 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -56,6 +56,7 @@ #include "BLI_math.h" #include "BLI_blenlib.h" #include "BLI_utildefines.h" +#include "BLI_callbacks.h" #include "BKE_anim.h" #include "BKE_animsys.h" @@ -1022,6 +1023,9 @@ void scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay) float ctime = BKE_curframe(sce); Scene *sce_iter; + /* keep this first */ + BLI_exec_cb(bmain, (ID *)sce, BLI_CB_EVT_FRAME_CHANGE_PRE); + sound_set_cfra(sce->r.cfra); /* clear animation overrides */ @@ -1048,6 +1052,9 @@ void scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay) /* object_handle_update() on all objects, groups and sets */ scene_update_tagged_recursive(bmain, sce, sce); + + /* keep this last */ + BLI_exec_cb(bmain, (ID *)sce, BLI_CB_EVT_FRAME_CHANGE_POST); } /* return default layer, also used to patch old files */ diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 743111b925f..08848c35add 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -2852,7 +2852,8 @@ void update_changed_seq_and_deps(Scene *scene, Sequence *changed_seq, int len_ch left and right are the bounds at which the sequence is rendered, start and end are from the start and fixed length of the sequence. */ -int seq_tx_get_start(Sequence *seq) { +int seq_tx_get_start(Sequence *seq) +{ return seq->start; } int seq_tx_get_end(Sequence *seq) diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 2c507370288..02cffcec249 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -2792,7 +2792,8 @@ int setcurr_tab_spaces (Text *text, int space) /*********************************/ /* Creates and adds a marker to the list maintaining sorted order */ -void txt_add_marker(Text *text, TextLine *line, int start, int end, const unsigned char color[4], int group, int flags) { +void txt_add_marker(Text *text, TextLine *line, int start, int end, const unsigned char color[4], int group, int flags) +{ TextMarker *tmp, *marker; marker= MEM_mallocN(sizeof(TextMarker), "text_marker"); @@ -2841,7 +2842,8 @@ TextMarker *txt_find_marker_region(Text *text, TextLine *line, int start, int en /* Clears all markers on the specified line between two points. If the group or flags fields are non-zero the returned flag must be in the specified group and have at least the specified flags set. */ -short txt_clear_marker_region(Text *text, TextLine *line, int start, int end, int group, int flags) { +short txt_clear_marker_region(Text *text, TextLine *line, int start, int end, int group, int flags) +{ TextMarker *marker, *next; int lineno= txt_get_span(text->lines.first, line); short cleared= 0; @@ -2866,7 +2868,8 @@ short txt_clear_marker_region(Text *text, TextLine *line, int start, int end, in /* Clears all markers in the specified group (if given) with at least the specified flags set. Useful for clearing temporary markers (group=0, flags=TMARK_TEMP) */ -short txt_clear_markers(Text *text, int group, int flags) { +short txt_clear_markers(Text *text, int group, int flags) +{ TextMarker *marker, *next; short cleared= 0; diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index 13875ff19f7..3cb32f9ad12 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -808,7 +808,8 @@ void flush_ffmpeg(void) ********************************************************************** */ /* Get the output filename-- similar to the other output formats */ -void filepath_ffmpeg(char* string, RenderData* rd) { +void filepath_ffmpeg(char* string, RenderData* rd) +{ char autosplit[20]; const char ** exts = get_file_extensions(rd->ffcodecdata.type); diff --git a/source/blender/blenlib/BLI_callbacks.h b/source/blender/blenlib/BLI_callbacks.h index 5c3180ba9c5..91f53bc2b80 100644 --- a/source/blender/blenlib/BLI_callbacks.h +++ b/source/blender/blenlib/BLI_callbacks.h @@ -40,6 +40,8 @@ struct Main; struct ID; typedef enum { + BLI_CB_EVT_FRAME_CHANGE_PRE, + BLI_CB_EVT_FRAME_CHANGE_POST, BLI_CB_EVT_RENDER_PRE, BLI_CB_EVT_RENDER_POST, BLI_CB_EVT_RENDER_STATS, diff --git a/source/blender/blenlib/intern/BLI_args.c b/source/blender/blenlib/intern/BLI_args.c index 5f31565d65b..cf3605a80ff 100644 --- a/source/blender/blenlib/intern/BLI_args.c +++ b/source/blender/blenlib/intern/BLI_args.c @@ -76,7 +76,8 @@ struct bArgs { int *passes; }; -static unsigned int case_strhash(const void *ptr) { +static unsigned int case_strhash(const void *ptr) +{ const char *s= ptr; unsigned int i= 0; unsigned char c; diff --git a/source/blender/blenlib/intern/BLI_dynstr.c b/source/blender/blenlib/intern/BLI_dynstr.c index 7587a5195a2..e877e985d94 100644 --- a/source/blender/blenlib/intern/BLI_dynstr.c +++ b/source/blender/blenlib/intern/BLI_dynstr.c @@ -70,7 +70,8 @@ struct DynStr { /***/ -DynStr *BLI_dynstr_new(void) { +DynStr *BLI_dynstr_new(void) +{ DynStr *ds= MEM_mallocN(sizeof(*ds), "DynStr"); ds->elems= ds->last= NULL; ds->curlen= 0; @@ -78,7 +79,8 @@ DynStr *BLI_dynstr_new(void) { return ds; } -void BLI_dynstr_append(DynStr *ds, const char *cstr) { +void BLI_dynstr_append(DynStr *ds, const char *cstr) +{ DynStrElem *dse= malloc(sizeof(*dse)); int cstrlen= strlen(cstr); @@ -220,7 +222,8 @@ void BLI_dynstr_appendf(DynStr *ds, const char *format, ...) } } -int BLI_dynstr_get_len(DynStr *ds) { +int BLI_dynstr_get_len(DynStr *ds) +{ return ds->curlen; } diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c index eae4f918a67..8e68d42456f 100644 --- a/source/blender/blenlib/intern/BLI_kdopbvh.c +++ b/source/blender/blenlib/intern/BLI_kdopbvh.c @@ -350,7 +350,8 @@ static void sort_along_axis(BVHTree *tree, int start, int end, int axis) //after a call to this function you can expect one of: // every node to left of a[n] are smaller or equal to it // every node to the right of a[n] are greater or equal to it -static int partition_nth_element(BVHNode **a, int _begin, int _end, int n, int axis){ +static int partition_nth_element(BVHNode **a, int _begin, int _end, int n, int axis) +{ int begin = _begin, end = _end, cut; while(end-begin > 3) { diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c index 654ade8955f..485b8137a02 100644 --- a/source/blender/blenlib/intern/bpath.c +++ b/source/blender/blenlib/intern/bpath.c @@ -644,7 +644,8 @@ void BLI_bpathIterator_step(struct BPathIterator *bpi) } } -int BLI_bpathIterator_isDone( struct BPathIterator *bpi) { +int BLI_bpathIterator_isDone( struct BPathIterator *bpi) +{ return bpi->type==BPATH_DONE; } @@ -699,7 +700,8 @@ static void bpath_as_report(struct BPathIterator *bpi, const char *message, Repo } /* high level function */ -void checkMissingFiles(Main *bmain, ReportList *reports) { +void checkMissingFiles(Main *bmain, ReportList *reports) +{ struct BPathIterator *bpi; /* be sure there is low chance of the path being too short */ @@ -718,7 +720,8 @@ void checkMissingFiles(Main *bmain, ReportList *reports) { } /* dont log any errors at the moment, should probably do this */ -void makeFilesRelative(Main *bmain, const char *basedir, ReportList *reports) { +void makeFilesRelative(Main *bmain, const char *basedir, ReportList *reports) +{ int tot= 0, changed= 0, failed= 0, linked= 0; struct BPathIterator *bpi; char filepath[FILE_MAX]; @@ -886,7 +889,8 @@ static int findFileRecursive(char *filename_new, const char *dirname, const char } /* high level function - call from fileselector */ -void findMissingFiles(Main *bmain, const char *str) { +void findMissingFiles(Main *bmain, const char *str) +{ struct BPathIterator *bpi; /* be sure there is low chance of the path being too short */ diff --git a/source/blender/blenlib/intern/math_base.c b/source/blender/blenlib/intern/math_base.c index 8ad93495f6d..3e18517f3e5 100644 --- a/source/blender/blenlib/intern/math_base.c +++ b/source/blender/blenlib/intern/math_base.c @@ -64,7 +64,8 @@ double round(double x); /* from python 3.1 floatobject.c * ndigits must be between 0 and 21 */ -double double_round(double x, int ndigits) { +double double_round(double x, int ndigits) +{ double pow1, pow2, y, z; if (ndigits >= 0) { pow1 = pow(10.0, (double)ndigits); diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index 0cc790ea082..807a42e82d7 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -786,7 +786,8 @@ void BLI_getlastdir(const char* dir, char *last, const size_t maxlen) /* This is now only used to really get the user's default document folder */ /* On Windows I chose the 'Users/<MyUserName>/Documents' since it's used as default location to save documents */ -const char *BLI_getDefaultDocumentFolder(void) { +const char *BLI_getDefaultDocumentFolder(void) +{ #if !defined(WIN32) return getenv("HOME"); @@ -1207,7 +1208,8 @@ void BLI_char_switch(char *string, char from, char to) } } -void BLI_make_exist(char *dir) { +void BLI_make_exist(char *dir) +{ int a; BLI_char_switch(dir, ALTSEP, SEP); @@ -1551,7 +1553,8 @@ int BKE_rebase_path(char *abs, size_t abs_len, char *rel, size_t rel_len, const return 1; } -char *BLI_first_slash(char *string) { +char *BLI_first_slash(char *string) +{ char *ffslash, *fbslash; ffslash= strchr(string, '/'); @@ -1564,7 +1567,8 @@ char *BLI_first_slash(char *string) { else return fbslash; } -char *BLI_last_slash(const char *string) { +char *BLI_last_slash(const char *string) +{ char *lfslash, *lbslash; lfslash= strrchr(string, '/'); @@ -1578,7 +1582,8 @@ char *BLI_last_slash(const char *string) { } /* adds a slash if there isnt one there already */ -int BLI_add_slash(char *string) { +int BLI_add_slash(char *string) +{ int len = strlen(string); #ifdef WIN32 if (len==0 || string[len-1]!='\\') { @@ -1597,7 +1602,8 @@ int BLI_add_slash(char *string) { } /* removes a slash if there is one */ -void BLI_del_slash(char *string) { +void BLI_del_slash(char *string) +{ int len = strlen(string); while (len) { #ifdef WIN32 diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index 8be86a4b407..e336b914ffa 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -469,7 +469,8 @@ int BLI_exist(const char *name) } /* would be better in fileops.c except that it needs stat.h so add here */ -int BLI_is_dir(const char *file) { +int BLI_is_dir(const char *file) +{ return S_ISDIR(BLI_exist(file)); } diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c index 8315161aeda..db5d4dc99eb 100644 --- a/source/blender/blenlib/intern/string.c +++ b/source/blender/blenlib/intern/string.c @@ -43,14 +43,16 @@ #include "BLI_dynstr.h" #include "BLI_string.h" -char *BLI_strdupn(const char *str, const size_t len) { +char *BLI_strdupn(const char *str, const size_t len) +{ char *n= MEM_mallocN(len+1, "strdup"); memcpy(n, str, len); n[len]= '\0'; return n; } -char *BLI_strdup(const char *str) { +char *BLI_strdup(const char *str) +{ return BLI_strdupn(str, strlen(str)); } @@ -67,7 +69,8 @@ char *BLI_strdupcat(const char *str1, const char *str2) return n; } -char *BLI_strncpy(char *dst, const char *src, const size_t maxncpy) { +char *BLI_strncpy(char *dst, const char *src, const size_t maxncpy) +{ size_t srclen= strlen(src); size_t cpylen= (srclen>(maxncpy-1))?(maxncpy-1):srclen; @@ -87,7 +90,8 @@ size_t BLI_snprintf(char *buffer, size_t count, const char *format, ...) if (n != -1 && n < count) { buffer[n] = '\0'; - } else { + } + else { buffer[count-1] = '\0'; } @@ -280,7 +284,8 @@ char *BLI_strcasestr(const char *s, const char *find) } -int BLI_strcasecmp(const char *s1, const char *s2) { +int BLI_strcasecmp(const char *s1, const char *s2) +{ int i; for (i=0; ; i++) { @@ -299,7 +304,8 @@ int BLI_strcasecmp(const char *s1, const char *s2) { return 0; } -int BLI_strncasecmp(const char *s1, const char *s2, size_t len) { +int BLI_strncasecmp(const char *s1, const char *s2, size_t len) +{ int i; for (i=0; i<len; i++) { diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c index 7604c2b8b0e..6442f0947b8 100644 --- a/source/blender/blenlib/intern/threads.c +++ b/source/blender/blenlib/intern/threads.c @@ -219,7 +219,8 @@ static void *tslot_thread_start(void *tslot_p) return tslot->do_thread(tslot->callerdata); } -int BLI_thread_is_main(void) { +int BLI_thread_is_main(void) +{ return pthread_equal(pthread_self(), mainid); } diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c index 31b3724e9f6..0e93e5fa8c0 100644 --- a/source/blender/blenloader/intern/readblenentry.c +++ b/source/blender/blenloader/intern/readblenentry.c @@ -240,7 +240,8 @@ LinkNode *BLO_blendhandle_get_linkable_groups(BlendHandle *bh) return names; } -void BLO_blendhandle_close(BlendHandle *bh) { +void BLO_blendhandle_close(BlendHandle *bh) +{ FileData *fd= (FileData*) bh; blo_freefiledata(fd); diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index 9d96814c403..61f1b1dfa08 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -426,7 +426,7 @@ virtual void AnimationImporter::change_eul_to_quat(Object *ob, bAction *act) //sets the rna_path and array index to curve -void AnimationImporter::modify_fcurve(std::vector<FCurve*>* curves , char* rna_path , int array_index ) +void AnimationImporter::modify_fcurve(std::vector<FCurve*>* curves , const char* rna_path , int array_index ) { std::vector<FCurve*>::iterator it; int i; diff --git a/source/blender/collada/AnimationImporter.h b/source/blender/collada/AnimationImporter.h index 9e8f7b42069..77587114374 100644 --- a/source/blender/collada/AnimationImporter.h +++ b/source/blender/collada/AnimationImporter.h @@ -164,7 +164,7 @@ public: int setAnimType ( const COLLADAFW::Animatable * prop , int type, int addition); - void modify_fcurve(std::vector<FCurve*>* curves , char* rna_path , int array_index ); + void modify_fcurve(std::vector<FCurve*>* curves , const char* rna_path , int array_index ); // prerequisites: // animlist_map - map animlist id -> animlist // curve_map - map anim id -> curve(s) diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 8c0424bd583..a52f181a0c9 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -6537,8 +6537,8 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob) return nu; } -static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf) { - +static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf) +{ Object *obedit= CTX_data_edit_object(C); ListBase *editnurb; Nurb *nu; @@ -6607,11 +6607,13 @@ static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf) return OPERATOR_FINISHED; } -static int curve_prim_add(bContext *C, wmOperator *op, int type) { +static int curve_prim_add(bContext *C, wmOperator *op, int type) +{ return curvesurf_prim_add(C, op, type, 0); } -static int surf_prim_add(bContext *C, wmOperator *op, int type) { +static int surf_prim_add(bContext *C, wmOperator *op, int type) +{ return curvesurf_prim_add(C, op, type, 1); } diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index aad67b6b0be..286906402b9 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -2804,7 +2804,8 @@ uiBut *uiDefBut(uiBlock *block, int type, int retval, const char *str, int x1, i * otherwise return -1. * (1<<findBitIndex(x))==x for powers of two. */ -static int findBitIndex(unsigned int x) { +static int findBitIndex(unsigned int x) +{ if (!x || (x&(x-1))!=0) { /* x&(x-1) strips lowest bit */ return -1; } else { diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 568eaf358e5..082ddb5b060 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1684,7 +1684,7 @@ static void ui_textedit_end(bContext *C, uiBut *but, uiHandleButtonData *data) /* not a file?, strip non utf-8 chars */ if(strip) { /* wont happen often so isnt that annoying to keep it here for a while */ - printf("invalid utf8 - stripped chars %d\n", strip); + printf("%s: invalid utf8 - stripped chars %d\n", __func__, strip); } } @@ -5914,7 +5914,7 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE); } else { - printf("Error, but->menu_key type: %d\n", but->type); + printf("%s: error, but->menu_key type: %d\n", __func__, but->type); } break; diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index c3a0f438fbe..fbad34252e7 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -752,7 +752,7 @@ int UI_icon_get_width(int icon_id) if (icon==NULL) { if (G.f & G_DEBUG) - printf("UI_icon_get_width: Internal error, no icon for icon ID: %d\n", icon_id); + printf("%s: Internal error, no icon for icon ID: %d\n", __func__, icon_id); return 0; } @@ -777,7 +777,7 @@ int UI_icon_get_height(int icon_id) if (icon==NULL) { if (G.f & G_DEBUG) - printf("UI_icon_get_height: Internal error, no icon for icon ID: %d\n", icon_id); + printf("%s: Internal error, no icon for icon ID: %d\n", __func__, icon_id); return 0; } @@ -825,7 +825,7 @@ static void icon_create_rect(struct PreviewImage* prv_img, enum eIconSizes size) if (!prv_img) { if (G.f & G_DEBUG) - printf("Error: requested preview image does not exist"); + printf("%s, error: requested preview image does not exist", __func__); } if (!prv_img->rect[size]) { prv_img->w[size] = render_size; @@ -842,7 +842,7 @@ static void icon_set_image(bContext *C, ID *id, PreviewImage* prv_img, enum eIco { if (!prv_img) { if (G.f & G_DEBUG) - printf("No preview image for this ID: %s\n", id->name); + printf("%s: no preview image for this ID: %s\n", __func__, id->name); return; } @@ -858,7 +858,7 @@ static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), /* sanity check */ if(w<=0 || h<=0 || w>2000 || h>2000) { - printf("icon_draw_rect: icons are %i x %i pixels?\n", w, h); + printf("%s: icons are %i x %i pixels?\n", __func__, w, h); BLI_assert(!"invalid icon size"); return; } @@ -948,19 +948,19 @@ static int get_draw_size(enum eIconSizes size) return 0; } -static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, float *rgb, enum eIconSizes size, int draw_size, int UNUSED(nocreate), int is_preview) +static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, float *rgb, enum eIconSizes size, int draw_size, int UNUSED(nocreate), short is_preview) { Icon *icon = NULL; DrawInfo *di = NULL; IconImage *iimg; - float fdraw_size= UI_DPI_ICON_FAC*draw_size; + float fdraw_size= is_preview ? draw_size : (draw_size * UI_DPI_ICON_FAC); int w, h; icon = BKE_icon_get(icon_id); if (icon==NULL) { if (G.f & G_DEBUG) - printf("icon_draw_mipmap: Internal error, no icon for icon ID: %d\n", icon_id); + printf("%s: Internal error, no icon for icon ID: %d\n", __func__, icon_id); return; } diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 4a9eb8113fe..c898ba983c7 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -174,7 +174,7 @@ static MenuData *decompose_menu_string(const char *str) *s= '\0'; s++; } else if (s[1]=='t') { - nitem_is_title= 1; + nitem_is_title= (s != instr); /* check for empty title */ *s= '\0'; s++; @@ -213,11 +213,13 @@ static MenuData *decompose_menu_string(const char *str) nicon= 0; } - if (c=='\0') + if (c=='\0') { break; - } else if (!nitem) + } + } else if (!nitem) { nitem= s; - + } + s++; } @@ -233,6 +235,7 @@ void ui_set_name_menu(uiBut *but, int value) for (i=0; i<md->nitems; i++) { if (md->items[i].retval==value) { BLI_strncpy(but->drawstr, md->items[i].str, sizeof(but->drawstr)); + break; } } @@ -1647,11 +1650,12 @@ static void ui_block_func_MENUSTR(bContext *UNUSED(C), uiLayout *layout, void *a } /* inconsistent, but menus with labels do not look good flipped */ - for(a=0, b=0; a<md->nitems; a++, b++) { - entry= &md->items[a]; - - if(entry->sepr && entry->str[0]) + entry= md->items; + for(a=0; a<md->nitems; a++, entry++) { + if(entry->sepr && entry->str[0]) { block->flag |= UI_BLOCK_NO_FLIP; + break; + } } /* create items */ @@ -2555,7 +2559,7 @@ void uiPupMenuInvoke(bContext *C, const char *idname) MenuType *mt= WM_menutype_find(idname, TRUE); if(mt==NULL) { - printf("uiPupMenuInvoke: named menu \"%s\" not found\n", idname); + printf("%s: named menu \"%s\" not found\n", __func__, idname); return; } diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index 3009d4fea09..92d02ff3dc2 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -42,6 +42,7 @@ #include "BLI_listbase.h" #include "BLI_rect.h" #include "BLI_string.h" +#include "BLI_utildefines.h" #include "BKE_global.h" @@ -357,7 +358,7 @@ void uiStyleInit(void) if (font->blf_id == -1) { if (G.f & G_DEBUG) - printf("uiStyleInit error, no fonts available\n"); + printf("%s: error, no fonts available\n", __func__); } else { /* ? just for speed to initialize? diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index a4622f50725..44aa6d1e090 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -1040,7 +1040,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con) /* enabled */ uiBlockSetEmboss(block, UI_EMBOSSN); - uiItemR(row, &ptr, "mute", 0, "", (con->flag & CONSTRAINT_OFF) ? ICON_MUTE_IPO_ON : ICON_MUTE_IPO_OFF); + uiItemR(row, &ptr, "mute", 0, "", (con->flag & CONSTRAINT_OFF) ? ICON_RESTRICT_VIEW_ON : ICON_RESTRICT_VIEW_OFF); uiBlockSetEmboss(block, UI_EMBOSS); uiLayoutSetOperatorContext(row, WM_OP_INVOKE_DEFAULT); diff --git a/source/blender/editors/mesh/CMakeLists.txt b/source/blender/editors/mesh/CMakeLists.txt index aff5f69e9d5..93fca6fe52b 100644 --- a/source/blender/editors/mesh/CMakeLists.txt +++ b/source/blender/editors/mesh/CMakeLists.txt @@ -56,4 +56,16 @@ set(SRC mesh_intern.h ) +if(WITH_GAMEENGINE) + add_definitions(-DWITH_GAMEENGINE) + + list(APPEND INC + ../../../../extern/recastnavigation + ) + + list(APPEND SRC + mesh_navmesh.c + ) +endif() + blender_add_lib(bf_editor_mesh "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/mesh/SConscript b/source/blender/editors/mesh/SConscript index 88df192c2fa..8142faf67a1 100644 --- a/source/blender/editors/mesh/SConscript +++ b/source/blender/editors/mesh/SConscript @@ -3,6 +3,8 @@ Import ('env') sources = env.Glob('*.c') +defs = [] + incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf' incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include' incs += ' ../../gpu ../../blenloader' @@ -16,4 +18,10 @@ if env['OURPLATFORM'] == 'linux': if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): incs += ' ' + env['BF_PTHREADS_INC'] -env.BlenderLib ( 'bf_editors_mesh', sources, Split(incs), [], libtype=['core'], priority=[45] ) +if env['WITH_BF_GAMEENGINE']: + incs += ' #/extern/recastnavigation' + defs.append('WITH_GAMEENGINE') +else: + sources.remove('mesh_navmesh.c') + +env.BlenderLib ( 'bf_editors_mesh', sources, Split(incs), defs, libtype=['core'], priority=[45] ) diff --git a/source/blender/editors/mesh/mesh_navmesh.c b/source/blender/editors/mesh/mesh_navmesh.c new file mode 100644 index 00000000000..1cd5dcdb241 --- /dev/null +++ b/source/blender/editors/mesh/mesh_navmesh.c @@ -0,0 +1,597 @@ +/** +* $Id$ +* +* ***** BEGIN GPL LICENSE BLOCK ***** +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software Foundation, +* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +* +* The Original Code is Copyright (C) 2011 by Blender Foundation +* All rights reserved. +* +* The Original Code is: all of this file. +* +* Contributor(s): Benoit Bolsee, +* Nick Samarin +* +* ***** END GPL LICENSE BLOCK ***** +*/ + +#include <math.h> + +#include "MEM_guardedalloc.h" + +#include "DNA_scene_types.h" +#include "DNA_object_types.h" +#include "DNA_meshdata_types.h" +#include "DNA_modifier_types.h" +#include "DNA_ID.h" + +#include "BKE_library.h" +#include "BKE_depsgraph.h" +#include "BKE_context.h" +#include "BKE_main.h" +#include "BKE_mesh.h" +#include "BKE_modifier.h" +#include "BKE_scene.h" +#include "BKE_DerivedMesh.h" +#include "BKE_cdderivedmesh.h" + +#include "BLI_editVert.h" +#include "BLI_listbase.h" +#include "BLI_utildefines.h" +#include "BLI_math_vector.h" + +#include "ED_object.h" +#include "ED_mesh.h" +#include "ED_screen.h" + +#include "RNA_access.h" + +#include "WM_api.h" +#include "WM_types.h" + +#include "mesh_intern.h" +#include "recast-capi.h" + +static void createVertsTrisData(bContext *C, LinkNode* obs, int *nverts_r, float **verts_r, int *ntris_r, int **tris_r) +{ + MVert *mvert; + int nfaces= 0, *tri, i, curnverts, basenverts, curnfaces; + MFace *mface; + float co[3], wco[3]; + Object *ob; + LinkNode *oblink, *dmlink; + DerivedMesh *dm; + Scene* scene= CTX_data_scene(C); + LinkNode* dms= NULL; + + int nverts, ntris, *tris; + float *verts; + + nverts= 0; + ntris= 0; + + /* calculate number of verts and tris */ + for(oblink= obs; oblink; oblink= oblink->next) { + ob= (Object*) oblink->link; + dm= mesh_create_derived_no_virtual(scene, ob, NULL, CD_MASK_MESH); + BLI_linklist_append(&dms, (void*)dm); + + nverts+= dm->getNumVerts(dm); + nfaces= dm->getNumFaces(dm); + ntris+= nfaces; + + /* resolve quad faces */ + mface= dm->getFaceArray(dm); + for(i= 0; i<nfaces; i++) { + MFace* mf= &mface[i]; + if(mf->v4) + ntris+=1; + } + } + + /* create data */ + verts= MEM_mallocN(sizeof(float)*3*nverts, "createVertsTrisData verts"); + tris= MEM_mallocN(sizeof(int)*3*ntris, "createVertsTrisData faces"); + + basenverts= 0; + tri= tris; + for(oblink= obs, dmlink= dms; oblink && dmlink; + oblink= oblink->next, dmlink= dmlink->next) { + ob= (Object*) oblink->link; + dm= (DerivedMesh*) dmlink->link; + + curnverts= dm->getNumVerts(dm); + mvert= dm->getVertArray(dm); + + /* copy verts */ + for(i= 0; i<curnverts; i++) { + MVert *v= &mvert[i]; + + copy_v3_v3(co, v->co); + mul_v3_m4v3(wco, ob->obmat, co); + + verts[3*(basenverts+i)+0]= wco[0]; + verts[3*(basenverts+i)+1]= wco[2]; + verts[3*(basenverts+i)+2]= wco[1]; + } + + /* create tris */ + curnfaces= dm->getNumFaces(dm); + mface= dm->getFaceArray(dm); + + for(i= 0; i<curnfaces; i++) { + MFace* mf= &mface[i]; + + tri[0]= basenverts + mf->v1; + tri[1]= basenverts + mf->v3; + tri[2]= basenverts + mf->v2; + tri += 3; + + if(mf->v4) { + tri[0]= basenverts + mf->v1; + tri[1]= basenverts + mf->v4; + tri[2]= basenverts + mf->v3; + tri += 3; + } + } + + basenverts+= curnverts; + } + + /* release derived mesh */ + for(dmlink= dms; dmlink; dmlink= dmlink->next) { + dm= (DerivedMesh*) dmlink->link; + dm->release(dm); + } + + BLI_linklist_free(dms, NULL); + + *nverts_r= nverts; + *verts_r= verts; + *ntris_r= ntris; + *tris_r= tris; +} + +static int buildNavMesh(const RecastData *recastParams, int nverts, float *verts, int ntris, int *tris, + struct recast_polyMesh **pmesh, struct recast_polyMeshDetail **dmesh) +{ + float bmin[3], bmax[3]; + struct recast_heightfield *solid; + unsigned char *triflags; + struct recast_compactHeightfield* chf; + struct recast_contourSet *cset; + int width, height, walkableHeight, walkableClimb, walkableRadius; + int minRegionSize, mergeRegionSize, maxEdgeLen; + float detailSampleDist, detailSampleMaxError; + + recast_calcBounds(verts, nverts, bmin, bmax); + + /* ** Step 1. Initialize build config ** */ + walkableHeight= (int)ceilf(recastParams->agentheight/ recastParams->cellheight); + walkableClimb= (int)floorf(recastParams->agentmaxclimb / recastParams->cellheight); + walkableRadius= (int)ceilf(recastParams->agentradius / recastParams->cellsize); + minRegionSize= (int)(recastParams->regionminsize * recastParams->regionminsize); + mergeRegionSize= (int)(recastParams->regionmergesize * recastParams->regionmergesize); + maxEdgeLen= (int)(recastParams->edgemaxlen/recastParams->cellsize); + detailSampleDist= recastParams->detailsampledist< 0.9f ? 0 : + recastParams->cellsize * recastParams->detailsampledist; + detailSampleMaxError= recastParams->cellheight * recastParams->detailsamplemaxerror; + + /* Set the area where the navigation will be build. */ + recast_calcGridSize(bmin, bmax, recastParams->cellsize, &width, &height); + + /* ** Step 2: Rasterize input polygon soup ** */ + /* Allocate voxel heightfield where we rasterize our input data to */ + solid= recast_newHeightfield(); + + if(!recast_createHeightfield(solid, width, height, bmin, bmax, recastParams->cellsize, recastParams->cellheight)) { + recast_destroyHeightfield(solid); + + return 0; + } + + /* Allocate array that can hold triangle flags */ + triflags= MEM_callocN(sizeof(unsigned char)*ntris, "buildNavMesh triflags"); + + /* Find triangles which are walkable based on their slope and rasterize them */ + recast_markWalkableTriangles(RAD2DEG(recastParams->agentmaxslope), verts, nverts, tris, ntris, triflags); + recast_rasterizeTriangles(verts, nverts, tris, triflags, ntris, solid); + MEM_freeN(triflags); + + /* ** Step 3: Filter walkables surfaces ** */ + recast_filterLedgeSpans(walkableHeight, walkableClimb, solid); + recast_filterWalkableLowHeightSpans(walkableHeight, solid); + + /* ** Step 4: Partition walkable surface to simple regions ** */ + + chf= recast_newCompactHeightfield(); + if(!recast_buildCompactHeightfield(walkableHeight, walkableClimb, RECAST_WALKABLE, solid, chf)) { + recast_destroyHeightfield(solid); + recast_destroyCompactHeightfield(chf); + + return 0; + } + + recast_destroyHeightfield(solid); + + /* Prepare for region partitioning, by calculating distance field along the walkable surface */ + if(!recast_buildDistanceField(chf)) { + recast_destroyCompactHeightfield(chf); + + return 0; + } + + /* Partition the walkable surface into simple regions without holes */ + if(!recast_buildRegions(chf, walkableRadius, 0, minRegionSize, mergeRegionSize)) { + recast_destroyCompactHeightfield(chf); + + return 0; + } + + /* ** Step 5: Trace and simplify region contours ** */ + /* Create contours */ + cset= recast_newContourSet(); + + if(!recast_buildContours(chf, recastParams->edgemaxerror, maxEdgeLen, cset)) { + recast_destroyCompactHeightfield(chf); + recast_destroyContourSet(cset); + + return 0; + } + + /* ** Step 6: Build polygons mesh from contours ** */ + *pmesh= recast_newPolyMesh(); + if(!recast_buildPolyMesh(cset, recastParams->vertsperpoly, *pmesh)) { + recast_destroyCompactHeightfield(chf); + recast_destroyContourSet(cset); + recast_destroyPolyMesh(*pmesh); + + return 0; + } + + + /* ** Step 7: Create detail mesh which allows to access approximate height on each polygon ** */ + + *dmesh= recast_newPolyMeshDetail(); + if(!recast_buildPolyMeshDetail(*pmesh, chf, detailSampleDist, detailSampleMaxError, *dmesh)) { + recast_destroyCompactHeightfield(chf); + recast_destroyContourSet(cset); + recast_destroyPolyMesh(*pmesh); + recast_destroyPolyMeshDetail(*dmesh); + + return 0; + } + + recast_destroyCompactHeightfield(chf); + recast_destroyContourSet(cset); + + return 1; +} + +static Object* createRepresentation(bContext *C, struct recast_polyMesh *pmesh, struct recast_polyMeshDetail *dmesh, Base* base) +{ + float co[3], rot[3]; + EditMesh *em; + int i,j, k; + unsigned short* v; + int face[3]; + Main *bmain= CTX_data_main(C); + Scene *scene= CTX_data_scene(C); + Object* obedit; + int createob= base==NULL; + int nverts, nmeshes, nvp; + unsigned short *verts, *meshes, *polys; + float bmin[3], cs, ch, *dverts; + unsigned char *tris; + ModifierData *md; + + zero_v3(co); + zero_v3(rot); + + if(createob) { + /* create new object */ + obedit= ED_object_add_type(C, OB_MESH, co, rot, FALSE, 1); + } + else { + obedit= base->object; + scene_select_base(scene, base); + copy_v3_v3(obedit->loc, co); + copy_v3_v3(obedit->rot, rot); + } + + ED_object_enter_editmode(C, EM_DO_UNDO|EM_IGNORE_LAYER); + em= BKE_mesh_get_editmesh(((Mesh *)obedit->data)); + + if(!createob) { + /* clear */ + if(em->verts.first) free_vertlist(em, &em->verts); + if(em->edges.first) free_edgelist(em, &em->edges); + if(em->faces.first) free_facelist(em, &em->faces); + if(em->selected.first) BLI_freelistN(&(em->selected)); + } + + /* create verts for polygon mesh */ + verts= recast_polyMeshGetVerts(pmesh, &nverts); + recast_polyMeshGetBoundbox(pmesh, bmin, NULL); + recast_polyMeshGetCell(pmesh, &cs, &ch); + + for(i= 0; i<nverts; i++) { + v= &verts[3*i]; + co[0]= bmin[0] + v[0]*cs; + co[1]= bmin[1] + v[1]*ch; + co[2]= bmin[2] + v[2]*cs; + SWAP(float, co[1], co[2]); + addvertlist(em, co, NULL); + } + + /* create custom data layer to save polygon idx */ + CustomData_add_layer_named(&em->fdata, CD_RECAST, CD_CALLOC, NULL, 0, "createRepresentation recastData"); + + /* create verts and faces for detailed mesh */ + meshes= recast_polyMeshDetailGetMeshes(dmesh, &nmeshes); + polys= recast_polyMeshGetPolys(pmesh, NULL, &nvp); + dverts= recast_polyMeshDetailGetVerts(dmesh, NULL); + tris= recast_polyMeshDetailGetTris(dmesh, NULL); + + for(i= 0; i<nmeshes; i++) { + int uniquevbase= em->totvert; + unsigned short vbase= meshes[4*i+0]; + unsigned short ndv= meshes[4*i+1]; + unsigned short tribase= meshes[4*i+2]; + unsigned short trinum= meshes[4*i+3]; + const unsigned short* p= &polys[i*nvp*2]; + int nv= 0; + + for(j= 0; j < nvp; ++j) { + if(p[j]==0xffff) break; + nv++; + } + + /* create unique verts */ + for(j= nv; j<ndv; j++) { + copy_v3_v3(co, &dverts[3*(vbase + j)]); + SWAP(float, co[1], co[2]); + addvertlist(em, co, NULL); + } + + EM_init_index_arrays(em, 1, 0, 0); + + /* create faces */ + for(j= 0; j<trinum; j++) { + unsigned char* tri= &tris[4*(tribase+j)]; + EditFace* newFace; + int* polygonIdx; + + for(k= 0; k<3; k++) { + if(tri[k]<nv) + face[k]= p[tri[k]]; /* shared vertex */ + else + face[k]= uniquevbase+tri[k]-nv; /* unique vertex */ + } + newFace= addfacelist(em, EM_get_vert_for_index(face[0]), EM_get_vert_for_index(face[2]), + EM_get_vert_for_index(face[1]), NULL, NULL, NULL); + + /* set navigation polygon idx to the custom layer */ + polygonIdx= (int*)CustomData_em_get(&em->fdata, newFace->data, CD_RECAST); + *polygonIdx= i+1; /* add 1 to avoid zero idx */ + } + + EM_free_index_arrays(); + } + + recast_destroyPolyMesh(pmesh); + recast_destroyPolyMeshDetail(dmesh); + + BKE_mesh_end_editmesh((Mesh*)obedit->data, em); + + DAG_id_tag_update((ID*)obedit->data, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); + + + ED_object_exit_editmode(C, EM_FREEDATA); + WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, obedit); + + if(createob) { + obedit->gameflag&= ~OB_COLLISION; + obedit->gameflag|= OB_NAVMESH; + obedit->body_type= OB_BODY_TYPE_NAVMESH; + rename_id((ID *)obedit, "Navmesh"); + } + + md= modifiers_findByType(obedit, eModifierType_NavMesh); + if(!md) { + ED_object_modifier_add(NULL, bmain, scene, obedit, NULL, eModifierType_NavMesh); + } + + return obedit; +} + +static int create_navmesh_exec(bContext *C, wmOperator *UNUSED(op)) +{ + Scene* scene= CTX_data_scene(C); + int nverts= 0, ntris= 0; + float *verts= NULL; + int *tris= 0; + struct recast_polyMesh *pmesh= NULL; + struct recast_polyMeshDetail *dmesh= NULL; + LinkNode* obs= NULL; + Base* navmeshBase= NULL; + + CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) { + if(base->object->body_type==OB_BODY_TYPE_NAVMESH) { + if(!navmeshBase || base==CTX_data_active_base(C)) + navmeshBase= base; + } + else + BLI_linklist_append(&obs, (void*)base->object); + } + CTX_DATA_END; + + createVertsTrisData(C, obs, &nverts, &verts, &ntris, &tris); + BLI_linklist_free(obs, NULL); + buildNavMesh(&scene->gm.recastData, nverts, verts, ntris, tris, &pmesh, &dmesh); + createRepresentation(C, pmesh, dmesh, navmeshBase); + + MEM_freeN(verts); + MEM_freeN(tris); + + return OPERATOR_FINISHED; +} + +void MESH_OT_create_navmesh(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Create navigation mesh"; + ot->description= "Create navigation mesh for selected objects"; + ot->idname= "MESH_OT_create_navmesh"; + + /* api callbacks */ + ot->exec= create_navmesh_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + +static int assign_navpolygon_exec(bContext *C, wmOperator *UNUSED(op)) +{ + Object *obedit= CTX_data_edit_object(C); + EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); + + /* do work here */ + int targetPolyIdx= -1; + EditFace *ef, *efa; + efa= EM_get_actFace(em, 0); + + if(efa) { + if(CustomData_has_layer(&em->fdata, CD_RECAST)) { + targetPolyIdx= *(int*)CustomData_em_get(&em->fdata, efa->data, CD_RECAST); + targetPolyIdx= targetPolyIdx>=0? targetPolyIdx : -targetPolyIdx; + + if(targetPolyIdx>0) { + /* set target poly idx to other selected faces */ + ef= (EditFace*)em->faces.last; + while(ef) { + if((ef->f & SELECT )&& ef!=efa) { + int* recastDataBlock= (int*)CustomData_em_get(&em->fdata, ef->data, CD_RECAST); + *recastDataBlock= targetPolyIdx; + } + ef= ef->prev; + } + } + } + } + + DAG_id_tag_update((ID*)obedit->data, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); + + BKE_mesh_end_editmesh((Mesh*)obedit->data, em); + + return OPERATOR_FINISHED; +} + +void MESH_OT_assign_navpolygon(struct wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Assign polygon index"; + ot->description= "Assign polygon index to face by active face"; + ot->idname= "MESH_OT_assign_navpolygon"; + + /* api callbacks */ + ot->poll= ED_operator_editmesh; + ot->exec= assign_navpolygon_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + +static int compare(const void * a, const void * b){ + return ( *(int*)a - *(int*)b ); +} + +static int findFreeNavPolyIndex(EditMesh* em) +{ + /* construct vector of indices */ + int numfaces= em->totface; + int* indices= MEM_callocN(sizeof(int)*numfaces, "findFreeNavPolyIndex(indices)"); + EditFace* ef= (EditFace*)em->faces.last; + int i, idx= 0, freeIdx= 1; + + while(ef) { + int polyIdx= *(int*)CustomData_em_get(&em->fdata, ef->data, CD_RECAST); + indices[idx]= polyIdx; + idx++; + ef= ef->prev; + } + + qsort(indices, numfaces, sizeof(int), compare); + + /* search first free index */ + freeIdx= 1; + for(i= 0; i<numfaces; i++) { + if(indices[i]==freeIdx) + freeIdx++; + else if(indices[i]>freeIdx) + break; + } + + MEM_freeN(indices); + + return freeIdx; +} + +static int assign_new_navpolygon_exec(bContext *C, wmOperator *UNUSED(op)) +{ + Object *obedit= CTX_data_edit_object(C); + EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); + EditFace *ef; + + if(CustomData_has_layer(&em->fdata, CD_RECAST)) { + int targetPolyIdx= findFreeNavPolyIndex(em); + + if(targetPolyIdx>0) { + /* set target poly idx to selected faces */ + ef= (EditFace*)em->faces.last; + while(ef) { + if(ef->f & SELECT) { + int *recastDataBlock= (int*)CustomData_em_get(&em->fdata, ef->data, CD_RECAST); + *recastDataBlock= targetPolyIdx; + } + ef= ef->prev; + } + } + } + + DAG_id_tag_update((ID*)obedit->data, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); + + BKE_mesh_end_editmesh((Mesh*)obedit->data, em); + return OPERATOR_FINISHED; +} + +void MESH_OT_assign_new_navpolygon(struct wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Assign new polygon index"; + ot->description= "Assign new polygon index to face"; + ot->idname= "MESH_OT_assign_new_navpolygon"; + + /* api callbacks */ + ot->poll= ED_operator_editmesh; + ot->exec= assign_new_navpolygon_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index c0e0714c43e..d7a93283640 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -162,6 +162,12 @@ void ED_operatortypes_mesh(void) WM_operatortype_append(EXPORT_MESH_OT_wavefront); WM_operatortype_append(MESH_OT_bridge_edge_loops); + +#ifdef WITH_GAMEENGINE + WM_operatortype_append(MESH_OT_create_navmesh); + WM_operatortype_append(MESH_OT_assign_navpolygon); + WM_operatortype_append(MESH_OT_assign_new_navpolygon); +#endif } #if 0 /* UNUSED, remove? */ diff --git a/source/blender/editors/object/CMakeLists.txt b/source/blender/editors/object/CMakeLists.txt index 4cf1955ce93..081b0f1feaf 100644 --- a/source/blender/editors/object/CMakeLists.txt +++ b/source/blender/editors/object/CMakeLists.txt @@ -59,16 +59,6 @@ set(SRC object_intern.h ) -if(WITH_GAMEENGINE) - list(APPEND INC - ../../../../extern/recastnavigation/Recast/Include - ) - - list(APPEND SRC - object_navmesh.cpp - ) -endif() - if(WITH_PYTHON) add_definitions(-DWITH_PYTHON) endif() diff --git a/source/blender/editors/object/SConscript b/source/blender/editors/object/SConscript index 4607cc4b1bf..883d0ca20ae 100644 --- a/source/blender/editors/object/SConscript +++ b/source/blender/editors/object/SConscript @@ -1,13 +1,13 @@ #!/usr/bin/python Import ('env') -sources = env.Glob('*.c') + env.Glob('*.cpp') +sources = env.Glob('*.c') incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf' incs += ' ../../windowmanager #/intern/guardedalloc ../../blenloader' incs += ' ../../makesrna ../../python ../../ikplugin ../../bmesh' incs += ' ../../render/extern/include ../../gpu' # for object_bake.c -incs += ' #extern/recastnavigation/Recast/Include' +incs += ' #extern/recastnavigation' defs = [] diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index f0df2431304..1260979ead8 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -927,7 +927,8 @@ static void multiresbake_start(MultiresBakeRender *bkr) finish_images(bkr); } -static int multiresbake_check(bContext *C, wmOperator *op) { +static int multiresbake_check(bContext *C, wmOperator *op) +{ Scene *scene= CTX_data_scene(C); Object *ob; Mesh *me; diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h index 02e5f9e7e75..a4d16984c56 100644 --- a/source/blender/editors/object/object_intern.h +++ b/source/blender/editors/object/object_intern.h @@ -226,10 +226,5 @@ void OBJECT_OT_group_remove(struct wmOperatorType *ot); /* object_bake.c */ void OBJECT_OT_bake_image(wmOperatorType *ot); -/* object_navmesh.cpp */ -void OBJECT_OT_create_navmesh(struct wmOperatorType *ot); -void OBJECT_OT_assign_navpolygon(struct wmOperatorType *ot); -void OBJECT_OT_assign_new_navpolygon(struct wmOperatorType *ot); - #endif /* ED_OBJECT_INTERN_H */ diff --git a/source/blender/editors/object/object_navmesh.cpp b/source/blender/editors/object/object_navmesh.cpp deleted file mode 100644 index ae97b40eb49..00000000000 --- a/source/blender/editors/object/object_navmesh.cpp +++ /dev/null @@ -1,628 +0,0 @@ -/** -* $Id$ -* -* ***** BEGIN GPL LICENSE BLOCK ***** -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software Foundation, -* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -* -* The Original Code is Copyright (C) 2004 by Blender Foundation -* All rights reserved. -* -* The Original Code is: all of this file. -* -* Contributor(s): none yet. -* -* ***** END GPL LICENSE BLOCK ***** -*/ - -#include <math.h> -#include "Recast.h" - -extern "C" -{ -#include "MEM_guardedalloc.h" - -#include "DNA_scene_types.h" -#include "DNA_object_types.h" -#include "DNA_meshdata_types.h" -#include "DNA_modifier_types.h" -#include "DNA_ID.h" - -#include "BKE_library.h" -#include "BKE_depsgraph.h" -#include "BKE_context.h" -#include "BKE_mesh.h" -#include "BKE_modifier.h" -#include "BKE_scene.h" -#include "BKE_DerivedMesh.h" -#include "BKE_cdderivedmesh.h" -#include "BLI_editVert.h" -#include "BLI_listbase.h" -#include "BLI_utildefines.h" -#include "ED_object.h" -#include "BLI_math_vector.h" - -#include "RNA_access.h" - -#include "ED_mesh.h" - -/*mesh/mesh_intern.h */ -extern struct EditVert *addvertlist(EditMesh *em, float *vec, struct EditVert *example); -extern struct EditFace *addfacelist(EditMesh *em, struct EditVert *v1, struct EditVert *v2, struct EditVert *v3, struct EditVert *v4, struct EditFace *example, struct EditFace *exampleEdges); -extern void free_vertlist(EditMesh *em, ListBase *edve); -extern void free_edgelist(EditMesh *em, ListBase *lb); -extern void free_facelist(EditMesh *em, ListBase *lb); - -#include "WM_api.h" -#include "WM_types.h" - -static void createVertsTrisData(bContext *C, LinkNode* obs, int& nverts, float*& verts, int &ntris, int*& tris) -{ - MVert *mvert; - int nfaces = 0, *tri, i, curnverts, basenverts, curnfaces; - MFace *mface; - float co[3], wco[3]; - Object *ob; - LinkNode *oblink, *dmlink; - DerivedMesh *dm; - Scene* scene = CTX_data_scene(C); - LinkNode* dms = NULL; - - nverts = 0; - ntris = 0; - //calculate number of verts and tris - for (oblink = obs; oblink; oblink = oblink->next) - { - ob = (Object*) oblink->link; - DerivedMesh *dm = mesh_create_derived_no_virtual(scene, ob, NULL, CD_MASK_MESH); - BLI_linklist_append(&dms, (void*)dm); - - nverts += dm->getNumVerts(dm); - nfaces = dm->getNumFaces(dm); - ntris += nfaces; - - //resolve quad faces - mface = dm->getFaceArray(dm); - for (i=0; i<nfaces; i++) - { - MFace* mf = &mface[i]; - if (mf->v4) - ntris+=1; - } - } - - //create data - verts = (float*) MEM_mallocN(sizeof(float)*3*nverts, "verts"); - tris = (int*) MEM_mallocN(sizeof(int)*3*ntris, "faces"); - - basenverts = 0; - tri = tris; - for (oblink = obs, dmlink = dms; oblink && dmlink; - oblink = oblink->next, dmlink = dmlink->next) - { - ob = (Object*) oblink->link; - dm = (DerivedMesh*) dmlink->link; - - curnverts = dm->getNumVerts(dm); - mvert = dm->getVertArray(dm); - //copy verts - for (i=0; i<curnverts; i++) - { - MVert *v = &mvert[i]; - copy_v3_v3(co, v->co); - mul_v3_m4v3(wco, ob->obmat, co); - verts[3*(basenverts+i)+0] = wco[0]; - verts[3*(basenverts+i)+1] = wco[2]; - verts[3*(basenverts+i)+2] = wco[1]; - } - - //create tris - curnfaces = dm->getNumFaces(dm); - mface = dm->getFaceArray(dm); - for (i=0; i<curnfaces; i++) - { - MFace* mf = &mface[i]; - tri[0]= basenverts + mf->v1; tri[1]= basenverts + mf->v3; tri[2]= basenverts + mf->v2; - tri += 3; - if (mf->v4) - { - tri[0]= basenverts + mf->v1; tri[1]= basenverts + mf->v4; tri[2]= basenverts + mf->v3; - tri += 3; - } - } - basenverts += curnverts; - } - - //release derived mesh - for (dmlink = dms; dmlink; dmlink = dmlink->next) - { - dm = (DerivedMesh*) dmlink->link; - dm->release(dm); - } - BLI_linklist_free(dms, NULL); -} - -static bool buildNavMesh(const RecastData& recastParams, int nverts, float* verts, int ntris, int* tris, - rcPolyMesh*& pmesh, rcPolyMeshDetail*& dmesh) -{ - float bmin[3], bmax[3]; - rcHeightfield* solid; - unsigned char *triflags; - rcCompactHeightfield* chf; - rcContourSet *cset; - - rcCalcBounds(verts, nverts, bmin, bmax); - - // - // Step 1. Initialize build config. - // - rcConfig cfg; - memset(&cfg, 0, sizeof(cfg)); - { -/* - float cellsize = 0.3f; - float cellheight = 0.2f; - float agentmaxslope = M_PI/4; - float agentmaxclimb = 0.9f; - float agentheight = 2.0f; - float agentradius = 0.6f; - float edgemaxlen = 12.0f; - float edgemaxerror = 1.3f; - float regionminsize = 50.f; - float regionmergesize = 20.f; - int vertsperpoly = 6; - float detailsampledist = 6.0f; - float detailsamplemaxerror = 1.0f; - cfg.cs = cellsize; - cfg.ch = cellheight; - cfg.walkableSlopeAngle = agentmaxslope/M_PI*180.f; - cfg.walkableHeight = (int)ceilf(agentheight/ cfg.ch); - cfg.walkableClimb = (int)floorf(agentmaxclimb / cfg.ch); - cfg.walkableRadius = (int)ceilf(agentradius / cfg.cs); - cfg.maxEdgeLen = (int)(edgemaxlen/cellsize); - cfg.maxSimplificationError = edgemaxerror; - cfg.minRegionSize = (int)rcSqr(regionminsize); - cfg.mergeRegionSize = (int)rcSqr(regionmergesize); - cfg.maxVertsPerPoly = vertsperpoly; - cfg.detailSampleDist = detailsampledist< 0.9f ? 0 : cellsize * detailsampledist; - cfg.detailSampleMaxError = cellheight * detailsamplemaxerror; -*/ - cfg.cs = recastParams.cellsize; - cfg.ch = recastParams.cellheight; - cfg.walkableSlopeAngle = recastParams.agentmaxslope/((float)M_PI)*180.f; - cfg.walkableHeight = (int)ceilf(recastParams.agentheight/ cfg.ch); - cfg.walkableClimb = (int)floorf(recastParams.agentmaxclimb / cfg.ch); - cfg.walkableRadius = (int)ceilf(recastParams.agentradius / cfg.cs); - cfg.maxEdgeLen = (int)(recastParams.edgemaxlen/recastParams.cellsize); - cfg.maxSimplificationError = recastParams.edgemaxerror; - cfg.minRegionSize = (int)rcSqr(recastParams.regionminsize); - cfg.mergeRegionSize = (int)rcSqr(recastParams.regionmergesize); - cfg.maxVertsPerPoly = recastParams.vertsperpoly; - cfg.detailSampleDist = recastParams.detailsampledist< 0.9f ? 0 : - recastParams.cellsize * recastParams.detailsampledist; - cfg.detailSampleMaxError = recastParams.cellheight * recastParams.detailsamplemaxerror; - - } - - // Set the area where the navigation will be build. - vcopy(cfg.bmin, bmin); - vcopy(cfg.bmax, bmax); - rcCalcGridSize(cfg.bmin, cfg.bmax, cfg.cs, &cfg.width, &cfg.height); - - // - // Step 2. Rasterize input polygon soup. - // - // Allocate voxel heightfield where we rasterize our input data to. - solid = new rcHeightfield; - if (!solid) - return false; - - if (!rcCreateHeightfield(*solid, cfg.width, cfg.height, cfg.bmin, cfg.bmax, cfg.cs, cfg.ch)) - return false; - - // Allocate array that can hold triangle flags. - triflags = (unsigned char*) MEM_mallocN(sizeof(unsigned char)*ntris, "triflags"); - if (!triflags) - return false; - // Find triangles which are walkable based on their slope and rasterize them. - memset(triflags, 0, ntris*sizeof(unsigned char)); - rcMarkWalkableTriangles(cfg.walkableSlopeAngle, verts, nverts, tris, ntris, triflags); - rcRasterizeTriangles(verts, nverts, tris, triflags, ntris, *solid); - MEM_freeN(triflags); - MEM_freeN(verts); - MEM_freeN(tris); - - // - // Step 3. Filter walkables surfaces. - // - rcFilterLedgeSpans(cfg.walkableHeight, cfg.walkableClimb, *solid); - rcFilterWalkableLowHeightSpans(cfg.walkableHeight, *solid); - - // - // Step 4. Partition walkable surface to simple regions. - // - - chf = new rcCompactHeightfield; - if (!chf) - return false; - if (!rcBuildCompactHeightfield(cfg.walkableHeight, cfg.walkableClimb, RC_WALKABLE, *solid, *chf)) - return false; - - delete solid; - - // Prepare for region partitioning, by calculating distance field along the walkable surface. - if (!rcBuildDistanceField(*chf)) - return false; - - // Partition the walkable surface into simple regions without holes. - if (!rcBuildRegions(*chf, cfg.walkableRadius, cfg.borderSize, cfg.minRegionSize, cfg.mergeRegionSize)) - return false; - - // - // Step 5. Trace and simplify region contours. - // - // Create contours. - cset = new rcContourSet; - if (!cset) - return false; - - if (!rcBuildContours(*chf, cfg.maxSimplificationError, cfg.maxEdgeLen, *cset)) - return false; - - // - // Step 6. Build polygons mesh from contours. - // - pmesh = new rcPolyMesh; - if (!pmesh) - return false; - if (!rcBuildPolyMesh(*cset, cfg.maxVertsPerPoly, *pmesh)) - return false; - - - // - // Step 7. Create detail mesh which allows to access approximate height on each polygon. - // - - dmesh = new rcPolyMeshDetail; - if (!dmesh) - return false; - - if (!rcBuildPolyMeshDetail(*pmesh, *chf, cfg.detailSampleDist, cfg.detailSampleMaxError, *dmesh)) - return false; - - delete chf; - delete cset; - - return true; -} - -static Object* createRepresentation(bContext *C, rcPolyMesh*& pmesh, rcPolyMeshDetail*& dmesh, Base* base) -{ - float co[3], rot[3]; - EditMesh *em; - int i,j, k; - unsigned short* v; - int face[3]; - Main *bmain = CTX_data_main(C); - Scene *scene= CTX_data_scene(C); - Object* obedit; - int createob = base==NULL; - zero_v3(co); - zero_v3(rot); - if (createob) - { - //create new object - obedit = ED_object_add_type(C, OB_MESH, co, rot, FALSE, 1); - } - else - { - obedit = base->object; - scene_select_base(scene, base); - copy_v3_v3(obedit->loc, co); - copy_v3_v3(obedit->rot, rot); - } - - ED_object_enter_editmode(C, EM_DO_UNDO|EM_IGNORE_LAYER); - em = BKE_mesh_get_editmesh(((Mesh *)obedit->data)); - - if (!createob) - { - //clear - if(em->verts.first) free_vertlist(em, &em->verts); - if(em->edges.first) free_edgelist(em, &em->edges); - if(em->faces.first) free_facelist(em, &em->faces); - if(em->selected.first) BLI_freelistN(&(em->selected)); - } - - //create verts for polygon mesh - for(i = 0; i < pmesh->nverts; i++) { - v = &pmesh->verts[3*i]; - co[0] = pmesh->bmin[0] + v[0]*pmesh->cs; - co[1] = pmesh->bmin[1] + v[1]*pmesh->ch; - co[2] = pmesh->bmin[2] + v[2]*pmesh->cs; - SWAP(float, co[1], co[2]); - addvertlist(em, co, NULL); - } - - //create custom data layer to save polygon idx - CustomData_add_layer_named(&em->fdata, CD_RECAST, CD_CALLOC, NULL, 0, "recastData"); - - //create verts and faces for detailed mesh - for (i=0; i<dmesh->nmeshes; i++) - { - int uniquevbase = em->totvert; - unsigned short vbase = dmesh->meshes[4*i+0]; - unsigned short ndv = dmesh->meshes[4*i+1]; - unsigned short tribase = dmesh->meshes[4*i+2]; - unsigned short trinum = dmesh->meshes[4*i+3]; - const unsigned short* p = &pmesh->polys[i*pmesh->nvp*2]; - int nv = 0; - for (j = 0; j < pmesh->nvp; ++j) - { - if (p[j] == 0xffff) break; - nv++; - } - //create unique verts - for (j=nv; j<ndv; j++) - { - copy_v3_v3(co, &dmesh->verts[3*(vbase + j)]); - SWAP(float, co[1], co[2]); - addvertlist(em, co, NULL); - } - - EM_init_index_arrays(em, 1, 0, 0); - - //create faces - for (j=0; j<trinum; j++) - { - unsigned char* tri = &dmesh->tris[4*(tribase+j)]; - EditFace* newFace; - for (k=0; k<3; k++) - { - if (tri[k]<nv) - face[k] = p[tri[k]]; //shared vertex - else - face[k] = uniquevbase+tri[k]-nv; //unique vertex - } - newFace = addfacelist(em, EM_get_vert_for_index(face[0]), EM_get_vert_for_index(face[2]), - EM_get_vert_for_index(face[1]), NULL, NULL, NULL); - - //set navigation polygon idx to the custom layer - int* polygonIdx = (int*)CustomData_em_get(&em->fdata, newFace->data, CD_RECAST); - *polygonIdx = i+1; //add 1 to avoid zero idx - } - - EM_free_index_arrays(); - } - - delete pmesh; pmesh = NULL; - delete dmesh; dmesh = NULL; - - BKE_mesh_end_editmesh((Mesh*)obedit->data, em); - - DAG_id_tag_update((ID*)obedit->data, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); - - - ED_object_exit_editmode(C, EM_FREEDATA); - WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, obedit); - - if (createob) - { - obedit->gameflag &= ~OB_COLLISION; - obedit->gameflag |= OB_NAVMESH; - obedit->body_type = OB_BODY_TYPE_NAVMESH; - rename_id((ID *)obedit, "Navmesh"); - } - - ModifierData *md= modifiers_findByType(obedit, eModifierType_NavMesh); - if (!md) - { - ED_object_modifier_add(NULL, bmain, scene, obedit, NULL, eModifierType_NavMesh); - } - - return obedit; -} - -static int create_navmesh_exec(bContext *C, wmOperator *op) -{ - Scene* scene = CTX_data_scene(C); - int nverts, ntris; - float* verts; - int* tris; - rcPolyMesh* pmesh; - rcPolyMeshDetail* dmesh; - LinkNode* obs = NULL; - Base* navmeshBase = NULL; - //CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) //expand macros to avoid error in convertion from void* - { - ListBase ctx_data_list; - CollectionPointerLink *ctx_link; - CTX_data_selected_editable_bases(C, &ctx_data_list); - for(ctx_link = (CollectionPointerLink *)ctx_data_list.first; - ctx_link; ctx_link = (CollectionPointerLink *)ctx_link->next) { - Base* base= (Base*)ctx_link->ptr.data; - { - if (base->object->body_type==OB_BODY_TYPE_NAVMESH) - { - if (!navmeshBase || base==CTX_data_active_base(C)) - navmeshBase = base; - } - else - BLI_linklist_append(&obs, (void*)base->object); - } - CTX_DATA_END; - createVertsTrisData(C, obs, nverts, verts, ntris, tris); - BLI_linklist_free(obs, NULL); - buildNavMesh(scene->gm.recastData, nverts, verts, ntris, tris, pmesh, dmesh); - createRepresentation(C, pmesh, dmesh, navmeshBase); - - return OPERATOR_FINISHED; -} - -void OBJECT_OT_create_navmesh(wmOperatorType *ot) -{ - /* identifiers */ - ot->name= "Create navigation mesh"; - ot->description= "Create navigation mesh for selected objects"; - ot->idname= "OBJECT_OT_create_navmesh"; - - /* api callbacks */ - ot->exec= create_navmesh_exec; - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; -} - -static int assign_navpolygon_poll(bContext *C) -{ - Object *ob= (Object *)CTX_data_pointer_get_type(C, "object", &RNA_Object).data; - if (!ob || !ob->data) - return 0; - return (((Mesh*)ob->data)->edit_mesh != NULL); -} - -static int assign_navpolygon_exec(bContext *C, wmOperator *op) -{ - Object *obedit= CTX_data_edit_object(C); - EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); - - //do work here - int targetPolyIdx = -1; - EditFace *ef, *efa; - efa = EM_get_actFace(em, 0); - if (efa) - { - if (CustomData_has_layer(&em->fdata, CD_RECAST)) - { - targetPolyIdx = *(int*)CustomData_em_get(&em->fdata, efa->data, CD_RECAST); - targetPolyIdx = targetPolyIdx>=0? targetPolyIdx : -targetPolyIdx; - if (targetPolyIdx>0) - { - //set target poly idx to other selected faces - ef = (EditFace*)em->faces.last; - while(ef) - { - if((ef->f & SELECT )&& ef!=efa) - { - int* recastDataBlock = (int*)CustomData_em_get(&em->fdata, ef->data, CD_RECAST); - *recastDataBlock = targetPolyIdx; - } - ef = ef->prev; - } - } - } - } - - DAG_id_tag_update((ID*)obedit->data, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); - - BKE_mesh_end_editmesh((Mesh*)obedit->data, em); - return OPERATOR_FINISHED; -} - -void OBJECT_OT_assign_navpolygon(struct wmOperatorType *ot) -{ - /* identifiers */ - ot->name= "Assign polygon index"; - ot->description= "Assign polygon index to face by active face"; - ot->idname= "OBJECT_OT_assign_navpolygon"; - - /* api callbacks */ - ot->poll = assign_navpolygon_poll; - ot->exec= assign_navpolygon_exec; - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; -} - -static int compare(const void * a, const void * b){ - return ( *(int*)a - *(int*)b ); -} -static int findFreeNavPolyIndex(EditMesh* em) -{ - //construct vector of indices - int numfaces = em->totface; - int* indices = new int[numfaces]; - EditFace* ef = (EditFace*)em->faces.last; - int idx = 0; - while(ef) - { - int polyIdx = *(int*)CustomData_em_get(&em->fdata, ef->data, CD_RECAST); - indices[idx] = polyIdx; - idx++; - ef = ef->prev; - } - qsort(indices, numfaces, sizeof(int), compare); - //search first free index - int freeIdx = 1; - for (int i=0; i<numfaces; i++) - { - if (indices[i]==freeIdx) - freeIdx++; - else if (indices[i]>freeIdx) - break; - } - delete [] indices; - return freeIdx; -} - -static int assign_new_navpolygon_exec(bContext *C, wmOperator *op) -{ - Object *obedit= CTX_data_edit_object(C); - EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); - - EditFace *ef; - if (CustomData_has_layer(&em->fdata, CD_RECAST)) - { - int targetPolyIdx = findFreeNavPolyIndex(em); - if (targetPolyIdx>0) - { - //set target poly idx to selected faces - ef = (EditFace*)em->faces.last; - while(ef) - { - if(ef->f & SELECT ) - { - int* recastDataBlock = (int*)CustomData_em_get(&em->fdata, ef->data, CD_RECAST); - *recastDataBlock = targetPolyIdx; - } - ef = ef->prev; - } - } - } - - DAG_id_tag_update((ID*)obedit->data, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); - - BKE_mesh_end_editmesh((Mesh*)obedit->data, em); - return OPERATOR_FINISHED; -} - -void OBJECT_OT_assign_new_navpolygon(struct wmOperatorType *ot) -{ - /* identifiers */ - ot->name= "Assign new polygon index"; - ot->description= "Assign new polygon index to face"; - ot->idname= "OBJECT_OT_assign_new_navpolygon"; - - /* api callbacks */ - ot->poll = assign_navpolygon_poll; - ot->exec= assign_new_navpolygon_exec; - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; -} -} diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index f115642cf8e..e083528e2ca 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -216,12 +216,6 @@ void ED_operatortypes_object(void) WM_operatortype_append(OBJECT_OT_drop_named_material); WM_operatortype_append(OBJECT_OT_test_multires); - -#ifdef WITH_GAMEENGINE - WM_operatortype_append(OBJECT_OT_create_navmesh); - WM_operatortype_append(OBJECT_OT_assign_navpolygon); - WM_operatortype_append(OBJECT_OT_assign_new_navpolygon); -#endif } void ED_operatormacros_object(void) diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 866a0c1c495..4bee89ef3ba 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -758,7 +758,8 @@ static void vgroup_normalize(Object *ob) It returns the number that it added (0-2) It relies on verts having -1 for unassigned indices */ -static int tryToAddVerts(int *verts, int length, int a, int b) { +static int tryToAddVerts(int *verts, int length, int a, int b) +{ char containsA = FALSE; char containsB = FALSE; int added = 0; @@ -788,7 +789,8 @@ and returns an array of indices of size count count is an int passed by reference so it can be assigned the value of the length here. */ -static int* getSurroundingVerts(Mesh *me, int vert, int *count) { +static int* getSurroundingVerts(Mesh *me, int vert, int *count) +{ int length = 0; int *tverts; int *verts = NULL; @@ -850,7 +852,8 @@ static int* getSurroundingVerts(Mesh *me, int vert, int *count) { /* get a single point in space by averaging a point cloud (vectors of size 3) coord is the place the average is stored, points is the point cloud, count is the number of points in the cloud */ -static void getSingleCoordinate(MVert *points, int count, float coord[3]) { +static void getSingleCoordinate(MVert *points, int count, float coord[3]) +{ int i; zero_v3(coord); for(i = 0; i < count; i++) { @@ -877,7 +880,8 @@ static void getNearestPointOnPlane(const float norm[3], const float coord[3], co } /* distance of two vectors a and b of size length */ -static float distance(float* a, float *b, int length) { +static float distance(float* a, float *b, int length) +{ int i; float sum = 0; for(i = 0; i < length; i++) { @@ -890,7 +894,8 @@ static float distance(float* a, float *b, int length) { compute the amount of vertical distance relative to the plane and store it in dists, then get the horizontal and vertical change and store them in changes */ -static void getVerticalAndHorizontalChange(float *norm, float d, float *coord, float *start, float distToStart, float *end, float (*changes)[2], float *dists, int index) { +static void getVerticalAndHorizontalChange(float *norm, float d, float *coord, float *start, float distToStart, float *end, float (*changes)[2], float *dists, int index) +{ // A=Q-((Q-P).N)N // D = (a*x0 + b*y0 +c*z0 +d) float projA[3] = {0}, projB[3] = {0}; @@ -908,7 +913,8 @@ static void getVerticalAndHorizontalChange(float *norm, float d, float *coord, f } // I need the derived mesh to be forgotten so the positions are recalculated with weight changes (see dm_deform_recalc) -static void dm_deform_clear(DerivedMesh *dm, Object *ob) { +static void dm_deform_clear(DerivedMesh *dm, Object *ob) +{ if(ob->derivedDeform && (ob->derivedDeform)==dm) { ob->derivedDeform->needsFree = 1; ob->derivedDeform->release(ob->derivedDeform); @@ -921,7 +927,8 @@ static void dm_deform_clear(DerivedMesh *dm, Object *ob) { } // recalculate the deformation -static DerivedMesh* dm_deform_recalc(Scene *scene, Object *ob) { +static DerivedMesh* dm_deform_recalc(Scene *scene, Object *ob) +{ return mesh_get_derived_deform(scene, ob, CD_MASK_BAREMESH); } @@ -933,7 +940,8 @@ index is the index of the vertex being moved norm and d are the plane's properties for the equation: ax + by + cz + d = 0 coord is a point on the plane */ -static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, int index, float norm[3], float coord[3], float d, float distToBe, float strength, float cp) { +static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, int index, float norm[3], float coord[3], float d, float distToBe, float strength, float cp) +{ DerivedMesh *dm; MDeformWeight *dw; MVert m; diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index 11796d01620..2f62e55bcd8 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -844,7 +844,7 @@ static void fluidsim_delete_until_lastframe(FluidsimSettings *fss) return; } -static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain) +static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, short do_job) { Scene *scene= CTX_data_scene(C); int i; @@ -871,12 +871,10 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain) ListBase *fobjects = MEM_callocN(sizeof(ListBase), "fluid objects"); FluidsimModifierData *fluidmd = NULL; Mesh *mesh = NULL; - - wmJob *steve; + FluidBakeJob *fb; elbeemSimulationSettings *fsset= MEM_callocN(sizeof(elbeemSimulationSettings), "Fluid sim settings"); - - steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Fluid Simulation", WM_JOB_PROGRESS); + fb= MEM_callocN(sizeof(FluidBakeJob), "fluid bake job"); if(getenv(strEnvName)) { @@ -1083,12 +1081,25 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain) /* custom data for fluid bake job */ fb->settings = fsset; - /* setup job */ - WM_jobs_customdata(steve, fb, fluidbake_free); - WM_jobs_timer(steve, 0.1, NC_SCENE|ND_FRAME, NC_SCENE|ND_FRAME); - WM_jobs_callbacks(steve, fluidbake_startjob, NULL, NULL, fluidbake_endjob); - - WM_jobs_start(CTX_wm_manager(C), steve); + if(do_job) { + wmJob *steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Fluid Simulation", WM_JOB_PROGRESS); + + /* setup job */ + WM_jobs_customdata(steve, fb, fluidbake_free); + WM_jobs_timer(steve, 0.1, NC_SCENE|ND_FRAME, NC_SCENE|ND_FRAME); + WM_jobs_callbacks(steve, fluidbake_startjob, NULL, NULL, fluidbake_endjob); + + WM_jobs_start(CTX_wm_manager(C), steve); + } + else { + short dummy_stop, dummy_do_update; + float dummy_progress; + + /* blocking, use with exec() */ + fluidbake_startjob((void *)fb, &dummy_stop, &dummy_do_update, &dummy_progress); + fluidbake_endjob((void *)fb); + fluidbake_free((void *)fb); + } /* ******** free stored animation data ******** */ fluidbake_free_data(channels, fobjects, NULL, NULL); @@ -1121,7 +1132,7 @@ FluidsimSettings* fluidsimSettingsCopy(FluidsimSettings *UNUSED(fss)) } /* only compile dummy functions */ -static int fluidsimBake(bContext *UNUSED(C), ReportList *UNUSED(reports), Object *UNUSED(ob)) +static int fluidsimBake(bContext *UNUSED(C), ReportList *UNUSED(reports), Object *UNUSED(ob), short UNUSED(do_job)) { return 0; } @@ -1130,13 +1141,21 @@ static int fluidsimBake(bContext *UNUSED(C), ReportList *UNUSED(reports), Object /***************************** Operators ******************************/ -static int fluid_bake_exec(bContext *C, wmOperator *op) +static int fluid_bake_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { /* only one bake job at a time */ if(WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C))) return 0; - if(!fluidsimBake(C, op->reports, CTX_data_active_object(C))) + if(!fluidsimBake(C, op->reports, CTX_data_active_object(C), TRUE)) + return OPERATOR_CANCELLED; + + return OPERATOR_FINISHED; +} + +static int fluid_bake_exec(bContext *C, wmOperator *op) +{ + if(!fluidsimBake(C, op->reports, CTX_data_active_object(C), FALSE)) return OPERATOR_CANCELLED; return OPERATOR_FINISHED; @@ -1150,6 +1169,7 @@ void FLUID_OT_bake(wmOperatorType *ot) ot->idname= "FLUID_OT_bake"; /* api callbacks */ + ot->invoke= fluid_bake_invoke; ot->exec= fluid_bake_exec; ot->poll= ED_operator_object_active_editable; } diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index 589d652a275..827c14b1c0d 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -364,7 +364,8 @@ void fdrawXORcirc(float xofs, float yofs, float rad) set_inverted_drawing(0); } -void glutil_draw_filled_arc(float start, float angle, float radius, int nsegments) { +void glutil_draw_filled_arc(float start, float angle, float radius, int nsegments) +{ int i; glBegin(GL_TRIANGLE_FAN); @@ -378,7 +379,8 @@ void glutil_draw_filled_arc(float start, float angle, float radius, int nsegment glEnd(); } -void glutil_draw_lined_arc(float start, float angle, float radius, int nsegments) { +void glutil_draw_lined_arc(float start, float angle, float radius, int nsegments) +{ int i; glBegin(GL_LINE_STRIP); @@ -797,7 +799,8 @@ void bglBegin(int mode) } } -int bglPointHack(void) { +int bglPointHack(void) +{ float value[4]; int pointhack_px; glGetFloatv(GL_POINT_SIZE_RANGE, value); diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 354e81cb52c..45724f0f32f 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -1857,11 +1857,13 @@ static int IsectPT2Df_limit(float pt[2], float v1[2], float v2[2], float v3[2], /* Clip the face by a bucket and set the uv-space bucket_bounds_uv * so we have the clipped UV's to do pixel intersection tests with * */ -static int float_z_sort_flip(const void *p1, const void *p2) { +static int float_z_sort_flip(const void *p1, const void *p2) +{ return (((float *)p1)[2] < ((float *)p2)[2] ? 1:-1); } -static int float_z_sort(const void *p1, const void *p2) { +static int float_z_sort(const void *p1, const void *p2) +{ return (((float *)p1)[2] < ((float *)p2)[2] ?-1:1); } @@ -3690,7 +3692,8 @@ static void do_projectpaint_draw(ProjPaintState *ps, ProjPixel *projPixel, float } } -static void do_projectpaint_draw_f(ProjPaintState *ps, ProjPixel *projPixel, float *rgba, float alpha, float mask, int use_color_correction) { +static void do_projectpaint_draw_f(ProjPaintState *ps, ProjPixel *projPixel, float *rgba, float alpha, float mask, int use_color_correction) +{ if (ps->is_texbrush) { /* rgba already holds a texture result here from higher level function */ float rgba_br[3]; diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 512fa781fc2..fc7e5593e5a 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -154,7 +154,7 @@ static int sculpt_modifiers_active(Scene *scene, Sculpt *sd, Object *ob) if(mmd) return 0; - /* non-locked shaoe keys could be handled in the same way as deformed mesh */ + /* non-locked shape keys could be handled in the same way as deformed mesh */ if((ob->shapeflag&OB_SHAPE_LOCK)==0 && me->key && ob->shapenr) return 1; diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index c7ada4a5801..c2e45c5ad8a 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -244,7 +244,8 @@ static int compare_size(const void *a1, const void *a2) else return BLI_natstrcmp(entry1->relname,entry2->relname); } -static int compare_extension(const void *a1, const void *a2) { +static int compare_extension(const void *a1, const void *a2) +{ const struct direntry *entry1=a1, *entry2=a2; const char *sufix1, *sufix2; const char *nil=""; diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 3a4371e8bb9..eec8bfb469b 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -1747,6 +1747,7 @@ static int get_col_actuator(int type) case ACT_CONSTRAINT: return TH_PANEL; case ACT_STATE: return TH_PANEL; case ACT_ARMATURE: return TH_PANEL; + case ACT_STEERING: return TH_PANEL; default: return TH_PANEL; } } diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 916e59eae9c..baa755ef841 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -3266,7 +3266,8 @@ void NODE_OT_delete(wmOperatorType *ot) } /* ****************** Delete with reconnect ******************* */ -static int is_connected_to_input_socket(bNode* node, bNodeLink* link) { +static int is_connected_to_input_socket(bNode* node, bNodeLink* link) +{ bNodeSocket *sock; if (link->tonode == node) { for(sock= node->inputs.first; sock; sock= sock->next) { diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index c0919ef3043..3ea27899128 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -530,7 +530,8 @@ void SEQUENCER_OT_select(wmOperatorType *ot) /* run recursivly to select linked */ -static int select_more_less_seq__internal(Scene *scene, int sel, int linked) { +static int select_more_less_seq__internal(Scene *scene, int sel, int linked) +{ Editing *ed= seq_give_editing(scene, FALSE); Sequence *seq, *neighbor; int change=0; diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 76074b84136..cb7ee18e829 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -1762,7 +1762,8 @@ static void drawSelectedVertices__mapFunc(void *userData, int index, float *co, } } -static void drawSelectedVertices(DerivedMesh *dm, Mesh *me) { +static void drawSelectedVertices(DerivedMesh *dm, Mesh *me) +{ glBegin(GL_POINTS); dm->foreachMappedVert(dm, drawSelectedVertices__mapFunc, me->mvert); glEnd(); diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index a949c6a2aa4..3cb11b95665 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -1237,7 +1237,7 @@ static void view3d_panel_object(const bContext *C, Panel *pa) Object *ob= OBACT; // TransformProperties *tfp; // UNUSED PointerRNA obptr; - uiLayout *col, *row; + uiLayout *col /* , *row */ /* UNUSED */; float lim; if(ob==NULL) return; @@ -1265,7 +1265,7 @@ static void view3d_panel_object(const bContext *C, Panel *pa) uiBlockSetHandleFunc(block, do_view3d_region_buttons, NULL); col= uiLayoutColumn(pa->layout, 0); - row= uiLayoutRow(col, 0); + /* row= uiLayoutRow(col, 0); */ /* UNUSED */ RNA_id_pointer_create(&ob->id, &obptr); if(ob==obedit) { diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 0854f9f3685..d3d7b1b1505 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -3226,7 +3226,7 @@ static int set_3dcursor_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *eve else WM_event_add_notifier(C, NC_SCENE|NA_EDITED, scene); - return OPERATOR_FINISHED; + return OPERATOR_PASS_THROUGH; } void VIEW3D_OT_cursor3d(wmOperatorType *ot) diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 50cf1518ada..89bfad1693e 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -1787,7 +1787,7 @@ static int game_engine_exec(bContext *C, wmOperator *op) { #ifdef WITH_GAMEENGINE Scene *startscene = CTX_data_scene(C); - ScrArea *sa, *prevsa= CTX_wm_area(C); + ScrArea /* *sa, */ /* UNUSED */ *prevsa= CTX_wm_area(C); ARegion *ar, *prevar= CTX_wm_region(C); wmWindow *prevwin= CTX_wm_window(C); RegionView3D *rv3d; @@ -1800,7 +1800,7 @@ static int game_engine_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; rv3d= CTX_wm_region_view3d(C); - sa= CTX_wm_area(C); + /* sa= CTX_wm_area(C); */ /* UNUSED */ ar= CTX_wm_region(C); view3d_operator_needs_opengl(C); diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 7fe2675c7c0..c633efd7486 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -1272,7 +1272,8 @@ void applyTransObjects(TransInfo *t) recalcData(t); } -static void restoreElement(TransData *td) { +static void restoreElement(TransData *td) +{ /* TransData for crease has no loc */ if (td->loc) { copy_v3_v3(td->loc, td->iloc); diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c index b3608305a7a..a1e1c0e0b1d 100644 --- a/source/blender/editors/transform/transform_input.c +++ b/source/blender/editors/transform/transform_input.c @@ -118,7 +118,8 @@ static void InputTrackBall(TransInfo *UNUSED(t), MouseInput *mi, const int mval[ output[1] *= mi->factor; } -static void InputHorizontalRatio(TransInfo *t, MouseInput *mi, const int mval[2], float output[3]) { +static void InputHorizontalRatio(TransInfo *t, MouseInput *mi, const int mval[2], float output[3]) +{ float x, pad; pad = t->ar->winx / 10; @@ -135,7 +136,8 @@ static void InputHorizontalRatio(TransInfo *t, MouseInput *mi, const int mval[2] output[0] = (x - pad) / (t->ar->winx - 2 * pad); } -static void InputHorizontalAbsolute(TransInfo *t, MouseInput *mi, const int mval[2], float output[3]) { +static void InputHorizontalAbsolute(TransInfo *t, MouseInput *mi, const int mval[2], float output[3]) +{ float vec[3]; InputVector(t, mi, mval, vec); @@ -144,7 +146,8 @@ static void InputHorizontalAbsolute(TransInfo *t, MouseInput *mi, const int mval output[0] = dot_v3v3(t->viewinv[0], vec) * 2.0f; } -static void InputVerticalRatio(TransInfo *t, MouseInput *mi, const int mval[2], float output[3]) { +static void InputVerticalRatio(TransInfo *t, MouseInput *mi, const int mval[2], float output[3]) +{ float y, pad; pad = t->ar->winy / 10; @@ -160,7 +163,8 @@ static void InputVerticalRatio(TransInfo *t, MouseInput *mi, const int mval[2], output[0] = (y - pad) / (t->ar->winy - 2 * pad); } -static void InputVerticalAbsolute(TransInfo *t, MouseInput *mi, const int mval[2], float output[3]) { +static void InputVerticalAbsolute(TransInfo *t, MouseInput *mi, const int mval[2], float output[3]) +{ float vec[3]; InputVector(t, mi, mval, vec); diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 91adf0302a4..a0674b772fa 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -1602,7 +1602,8 @@ static int snapObject(Scene *scene, ARegion *ar, Object *ob, int editobject, flo return retval; } -static int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, float mval[2], int *dist, float *loc, float *no, SnapMode mode) { +static int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, float mval[2], int *dist, float *loc, float *no, SnapMode mode) +{ Base *base; float depth = FLT_MAX; int retval = 0; @@ -1934,7 +1935,8 @@ int peelObjectsContext(bContext *C, ListBase *depth_peels, float mval[2]) static void applyGrid(TransInfo *t, float *val, int max_index, float fac[3], GearsType action); -void snapGridAction(TransInfo *t, float *val, GearsType action) { +void snapGridAction(TransInfo *t, float *val, GearsType action) +{ float fac[3]; fac[NO_GEARS] = t->snap[0]; @@ -1945,7 +1947,8 @@ void snapGridAction(TransInfo *t, float *val, GearsType action) { } -void snapGrid(TransInfo *t, float *val) { +void snapGrid(TransInfo *t, float *val) +{ GearsType action; // Only do something if using Snap to Grid diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index 35672cdfcb5..e124c50615f 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -1058,7 +1058,8 @@ void GPU_uvedge_setup(DerivedMesh *dm) GLStates |= GPU_BUFFER_VERTEX_STATE; } -static int GPU_typesize(int type) { +static int GPU_typesize(int type) +{ switch(type) { case GL_FLOAT: return sizeof(float); @@ -1075,7 +1076,8 @@ static int GPU_typesize(int type) { } } -int GPU_attrib_element_size(GPUAttrib data[], int numdata) { +int GPU_attrib_element_size(GPUAttrib data[], int numdata) +{ int i, elementsize = 0; for(i = 0; i < numdata; i++) { @@ -1086,7 +1088,8 @@ int GPU_attrib_element_size(GPUAttrib data[], int numdata) { return elementsize; } -void GPU_interleaved_attrib_setup(GPUBuffer *buffer, GPUAttrib data[], int numdata) { +void GPU_interleaved_attrib_setup(GPUBuffer *buffer, GPUAttrib data[], int numdata) +{ int i; int elementsize; intptr_t offset = 0; diff --git a/source/blender/imbuf/intern/bmp.c b/source/blender/imbuf/intern/bmp.c index d79acc88a80..bfec60245b8 100644 --- a/source/blender/imbuf/intern/bmp.c +++ b/source/blender/imbuf/intern/bmp.c @@ -101,8 +101,8 @@ static int checkbmp(unsigned char *mem) return(ret_val); } -int imb_is_a_bmp(unsigned char *buf) { - +int imb_is_a_bmp(unsigned char *buf) +{ return checkbmp(buf); } @@ -200,8 +200,8 @@ static int putShortLSB(unsigned short us,FILE *ofile) { } /* Found write info at http://users.ece.gatech.edu/~slabaugh/personal/c/bitmapUnix.c */ -int imb_savebmp(struct ImBuf *ibuf, const char *name, int flags) { - +int imb_savebmp(struct ImBuf *ibuf, const char *name, int flags) +{ BMPINFOHEADER infoheader; int bytesize, extrabytes, x, y, t, ptr; uchar *data; diff --git a/source/blender/imbuf/intern/imageprocess.c b/source/blender/imbuf/intern/imageprocess.c index 1ac4e4e06cb..49f81edd4b2 100644 --- a/source/blender/imbuf/intern/imageprocess.c +++ b/source/blender/imbuf/intern/imageprocess.c @@ -111,7 +111,8 @@ static void pixel_from_buffer(struct ImBuf *ibuf, unsigned char **outI, float ** */ /* function assumes out to be zero'ed, only does RGBA */ -static float P(float k){ +static float P(float k) +{ float p1, p2, p3, p4; p1 = MAX2(k+2.0f,0); p2 = MAX2(k+1.0f,0); @@ -123,7 +124,8 @@ static float P(float k){ #if 0 /* older, slower function, works the same as above */ -static float P(float k){ +static float P(float k) +{ return (float)(1.0f/6.0f)*( pow( MAX2(k+2.0f,0) , 3.0f ) - 4.0f * pow( MAX2(k+1.0f,0) , 3.0f ) + 6.0f * pow( MAX2(k,0) , 3.0f ) - 4.0f * pow( MAX2(k-1.0f,0) , 3.0f)); } #endif diff --git a/source/blender/imbuf/intern/indexer_dv.c b/source/blender/imbuf/intern/indexer_dv.c index d1202136d56..aa258a6b9ee 100644 --- a/source/blender/imbuf/intern/indexer_dv.c +++ b/source/blender/imbuf/intern/indexer_dv.c @@ -56,7 +56,8 @@ static unsigned long bitstream_get_bits(indexer_dv_bitstream * This, int num) return rval; } -static int parse_num(indexer_dv_bitstream * b, int numbits) { +static int parse_num(indexer_dv_bitstream * b, int numbits) +{ return bitstream_get_bits(b, numbits); } diff --git a/source/blender/imbuf/intern/jpeg.c b/source/blender/imbuf/intern/jpeg.c index b87b46ca464..53d4a403190 100644 --- a/source/blender/imbuf/intern/jpeg.c +++ b/source/blender/imbuf/intern/jpeg.c @@ -84,8 +84,8 @@ type 3 is unsupported as of jul 05 2000 Frank. static int jpeg_default_quality; static int ibuf_ftype; -int imb_is_a_jpeg(unsigned char *mem) { - +int imb_is_a_jpeg(unsigned char *mem) +{ if ((mem[0]== 0xFF) && (mem[1] == 0xD8))return 1; return 0; } diff --git a/source/blender/imbuf/intern/targa.c b/source/blender/imbuf/intern/targa.c index ec00b15c079..c757b435d90 100644 --- a/source/blender/imbuf/intern/targa.c +++ b/source/blender/imbuf/intern/targa.c @@ -338,7 +338,8 @@ static int checktarga(TARGA *tga, unsigned char *mem) return(1); } -int imb_is_a_targa(unsigned char *buf) { +int imb_is_a_targa(unsigned char *buf) +{ TARGA tga; return checktarga(&tga, buf); diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index b52de6a49b6..b995b5ab731 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -1111,7 +1111,7 @@ int RNA_property_pointer_poll(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *va return 1; } - printf("RNA_property_pointer_poll %s: is not a pointer property.\n", prop->identifier); + printf("%s %s: is not a pointer property.\n", __func__, prop->identifier); return 0; } @@ -2511,7 +2511,7 @@ void RNA_property_pointer_add(PointerRNA *ptr, PropertyRNA *prop) IDP_AddToGroup(group, IDP_New(IDP_GROUP, val, (char*)prop->identifier)); } else - printf("RNA_property_pointer_add %s.%s: only supported for id properties.\n", ptr->type->identifier, prop->identifier); + printf("%s %s.%s: only supported for id properties.\n", __func__, ptr->type->identifier, prop->identifier); } void RNA_property_pointer_remove(PointerRNA *ptr, PropertyRNA *prop) @@ -2530,7 +2530,7 @@ void RNA_property_pointer_remove(PointerRNA *ptr, PropertyRNA *prop) } } else - printf("RNA_property_pointer_remove %s.%s: only supported for id properties.\n", ptr->type->identifier, prop->identifier); + printf("%s %s.%s: only supported for id properties.\n", __func__, ptr->type->identifier, prop->identifier); } static void rna_property_collection_get_idp(CollectionPropertyIterator *iter) @@ -2663,7 +2663,7 @@ void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA } } /*else - printf("RNA_property_collection_add %s.%s: not implemented for this property.\n", ptr->type->identifier, prop->identifier);*/ + printf("%s %s.%s: not implemented for this property.\n", __func__, ptr->type->identifier, prop->identifier);*/ #endif if(r_ptr) { @@ -2722,7 +2722,7 @@ int RNA_property_collection_remove(PointerRNA *ptr, PropertyRNA *prop, int key) return 0; } /*else - printf("RNA_property_collection_remove %s.%s: only supported for id properties.\n", ptr->type->identifier, prop->identifier);*/ + printf("%s %s.%s: only supported for id properties.\n", __func__, ptr->type->identifier, prop->identifier);*/ #endif return 0; } @@ -3999,7 +3999,7 @@ int RNA_boolean_get(PointerRNA *ptr, const char *name) return RNA_property_boolean_get(ptr, prop); } else { - printf("RNA_boolean_get: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); return 0; } } @@ -4011,7 +4011,7 @@ void RNA_boolean_set(PointerRNA *ptr, const char *name, int value) if(prop) RNA_property_boolean_set(ptr, prop, value); else - printf("RNA_boolean_set: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); } void RNA_boolean_get_array(PointerRNA *ptr, const char *name, int *values) @@ -4021,7 +4021,7 @@ void RNA_boolean_get_array(PointerRNA *ptr, const char *name, int *values) if(prop) RNA_property_boolean_get_array(ptr, prop, values); else - printf("RNA_boolean_get_array: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); } void RNA_boolean_set_array(PointerRNA *ptr, const char *name, const int *values) @@ -4031,7 +4031,7 @@ void RNA_boolean_set_array(PointerRNA *ptr, const char *name, const int *values) if(prop) RNA_property_boolean_set_array(ptr, prop, values); else - printf("RNA_boolean_set_array: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); } int RNA_int_get(PointerRNA *ptr, const char *name) @@ -4042,7 +4042,7 @@ int RNA_int_get(PointerRNA *ptr, const char *name) return RNA_property_int_get(ptr, prop); } else { - printf("RNA_int_get: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); return 0; } } @@ -4054,7 +4054,7 @@ void RNA_int_set(PointerRNA *ptr, const char *name, int value) if(prop) RNA_property_int_set(ptr, prop, value); else - printf("RNA_int_set: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); } void RNA_int_get_array(PointerRNA *ptr, const char *name, int *values) @@ -4064,7 +4064,7 @@ void RNA_int_get_array(PointerRNA *ptr, const char *name, int *values) if(prop) RNA_property_int_get_array(ptr, prop, values); else - printf("RNA_int_get_array: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); } void RNA_int_set_array(PointerRNA *ptr, const char *name, const int *values) @@ -4074,7 +4074,7 @@ void RNA_int_set_array(PointerRNA *ptr, const char *name, const int *values) if(prop) RNA_property_int_set_array(ptr, prop, values); else - printf("RNA_int_set_array: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); } float RNA_float_get(PointerRNA *ptr, const char *name) @@ -4085,7 +4085,7 @@ float RNA_float_get(PointerRNA *ptr, const char *name) return RNA_property_float_get(ptr, prop); } else { - printf("RNA_float_get: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); return 0; } } @@ -4097,7 +4097,7 @@ void RNA_float_set(PointerRNA *ptr, const char *name, float value) if(prop) RNA_property_float_set(ptr, prop, value); else - printf("RNA_float_set: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); } void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values) @@ -4107,7 +4107,7 @@ void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values) if(prop) RNA_property_float_get_array(ptr, prop, values); else - printf("RNA_float_get_array: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); } void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values) @@ -4117,7 +4117,7 @@ void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values) if(prop) RNA_property_float_set_array(ptr, prop, values); else - printf("RNA_float_set_array: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); } int RNA_enum_get(PointerRNA *ptr, const char *name) @@ -4128,7 +4128,7 @@ int RNA_enum_get(PointerRNA *ptr, const char *name) return RNA_property_enum_get(ptr, prop); } else { - printf("RNA_enum_get: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); return 0; } } @@ -4140,7 +4140,7 @@ void RNA_enum_set(PointerRNA *ptr, const char *name, int value) if(prop) RNA_property_enum_set(ptr, prop, value); else - printf("RNA_enum_set: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); } void RNA_enum_set_identifier(PointerRNA *ptr, const char *name, const char *id) @@ -4152,9 +4152,11 @@ void RNA_enum_set_identifier(PointerRNA *ptr, const char *name, const char *id) if(RNA_property_enum_value(NULL, ptr, prop, id, &value)) RNA_property_enum_set(ptr, prop, value); else - printf("RNA_enum_set_identifier: %s.%s has no enum id '%s'.\n", ptr->type->identifier, name, id); - } else - printf("RNA_enum_set_identifier: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s has no enum id '%s'.\n", __func__, ptr->type->identifier, name, id); + } + else { + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); + } } int RNA_enum_is_equal(bContext *C, PointerRNA *ptr, const char *name, const char *enumname) @@ -4173,11 +4175,11 @@ int RNA_enum_is_equal(bContext *C, PointerRNA *ptr, const char *name, const char if(free) MEM_freeN(item); - printf("RNA_enum_is_equal: %s.%s item %s not found.\n", ptr->type->identifier, name, enumname); + printf("%s: %s.%s item %s not found.\n", __func__, ptr->type->identifier, name, enumname); return 0; } else { - printf("RNA_enum_is_equal: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); return 0; } } @@ -4226,7 +4228,7 @@ void RNA_string_get(PointerRNA *ptr, const char *name, char *value) RNA_property_string_get(ptr, prop, value); } else { - printf("RNA_string_get: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); value[0]= '\0'; } } @@ -4239,7 +4241,7 @@ char *RNA_string_get_alloc(PointerRNA *ptr, const char *name, char *fixedbuf, in return RNA_property_string_get_alloc(ptr, prop, fixedbuf, fixedlen); } else { - printf("RNA_string_get_alloc: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); return NULL; } } @@ -4252,7 +4254,7 @@ int RNA_string_length(PointerRNA *ptr, const char *name) return RNA_property_string_length(ptr, prop); } else { - printf("RNA_string_length: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); return 0; } } @@ -4264,7 +4266,7 @@ void RNA_string_set(PointerRNA *ptr, const char *name, const char *value) if(prop) RNA_property_string_set(ptr, prop, value); else - printf("RNA_string_set: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); } PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name) @@ -4275,7 +4277,7 @@ PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name) return RNA_property_pointer_get(ptr, prop); } else { - printf("RNA_pointer_get: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); return PointerRNA_NULL; } @@ -4289,7 +4291,7 @@ void RNA_pointer_set(PointerRNA *ptr, const char *name, PointerRNA ptr_value) RNA_property_pointer_set(ptr, prop, ptr_value); } else { - printf("RNA_pointer_set: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); } } @@ -4300,7 +4302,7 @@ void RNA_pointer_add(PointerRNA *ptr, const char *name) if(prop) RNA_property_pointer_add(ptr, prop); else - printf("RNA_pointer_set: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); } void RNA_collection_begin(PointerRNA *ptr, const char *name, CollectionPropertyIterator *iter) @@ -4310,7 +4312,7 @@ void RNA_collection_begin(PointerRNA *ptr, const char *name, CollectionPropertyI if(prop) RNA_property_collection_begin(ptr, prop, iter); else - printf("RNA_collection_begin: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); } void RNA_collection_add(PointerRNA *ptr, const char *name, PointerRNA *r_value) @@ -4320,7 +4322,7 @@ void RNA_collection_add(PointerRNA *ptr, const char *name, PointerRNA *r_value) if(prop) RNA_property_collection_add(ptr, prop, r_value); else - printf("RNA_collection_add: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); } void RNA_collection_clear(PointerRNA *ptr, const char *name) @@ -4330,7 +4332,7 @@ void RNA_collection_clear(PointerRNA *ptr, const char *name) if(prop) RNA_property_collection_clear(ptr, prop); else - printf("RNA_collection_clear: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); } int RNA_collection_length(PointerRNA *ptr, const char *name) @@ -4341,7 +4343,7 @@ int RNA_collection_length(PointerRNA *ptr, const char *name) return RNA_property_collection_length(ptr, prop); } else { - printf("RNA_collection_length: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); return 0; } } @@ -4358,7 +4360,7 @@ int RNA_property_is_set(PointerRNA *ptr, const char *name) } else { /* python raises an error */ - /* printf("RNA_property_is_set: %s.%s not found.\n", ptr->type->identifier, name); */ + /* printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); */ return 0; } } diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index 0a47c98aebb..ebf8990adf3 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -272,7 +272,7 @@ static void rna_ksPath_RnaPath_set(PointerRNA *ptr, const char *value) if (ksp->rna_path) MEM_freeN(ksp->rna_path); - if (strlen(value)) + if (value[0]) ksp->rna_path= BLI_strdup(value); else ksp->rna_path= NULL; diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 63b3aed4a3b..63a41762f4c 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -134,7 +134,7 @@ StructDefRNA *rna_find_struct_def(StructRNA *srna) if(!DefRNA.preprocess) { /* we should never get here */ - fprintf(stderr, "rna_find_struct_def: only at preprocess time.\n"); + fprintf(stderr, "%s: only at preprocess time.\n", __func__); return NULL; } @@ -153,7 +153,7 @@ PropertyDefRNA *rna_find_struct_property_def(StructRNA *srna, PropertyRNA *prop) if(!DefRNA.preprocess) { /* we should never get here */ - fprintf(stderr, "rna_find_struct_property_def: only at preprocess time.\n"); + fprintf(stderr, "%s: only at preprocess time.\n", __func__); return NULL; } @@ -181,7 +181,7 @@ static PropertyDefRNA *rna_find_property_def(PropertyRNA *prop) if(!DefRNA.preprocess) { /* we should never get here */ - fprintf(stderr, "rna_find_property_def: only at preprocess time.\n"); + fprintf(stderr, "%s: only at preprocess time.\n", __func__); return NULL; } @@ -204,7 +204,7 @@ FunctionDefRNA *rna_find_function_def(FunctionRNA *func) if(!DefRNA.preprocess) { /* we should never get here */ - fprintf(stderr, "rna_find_function_def: only at preprocess time.\n"); + fprintf(stderr, "%s: only at preprocess time.\n", __func__); return NULL; } @@ -233,7 +233,7 @@ PropertyDefRNA *rna_find_parameter_def(PropertyRNA *parm) if(!DefRNA.preprocess) { /* we should never get here */ - fprintf(stderr, "rna_find_parameter_def: only at preprocess time.\n"); + fprintf(stderr, "%s: only at preprocess time.\n", __func__); return NULL; } @@ -267,7 +267,7 @@ static ContainerDefRNA *rna_find_container_def(ContainerRNA *cont) if(!DefRNA.preprocess) { /* we should never get here */ - fprintf(stderr, "rna_find_container_def: only at preprocess time.\n"); + fprintf(stderr, "%s: only at preprocess time.\n", __func__); return NULL; } @@ -513,7 +513,7 @@ void RNA_struct_free(BlenderRNA *brna, StructRNA *srna) /* if(srna->flag & STRUCT_RUNTIME) { if(RNA_struct_py_type_get(srna)) { - fprintf(stderr, "RNA_struct_free '%s' freed while holding a python reference\n", srna->identifier); + fprintf(stderr, "%s '%s' freed while holding a python reference\n", __func__, srna->identifier); } } */ @@ -617,7 +617,7 @@ StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char * char error[512]; if (rna_validate_identifier(identifier, error, 0) == 0) { - fprintf(stderr, "RNA_def_struct: struct identifier \"%s\" error - %s\n", identifier, error); + fprintf(stderr, "%s: struct identifier \"%s\" error - %s\n", __func__, identifier, error); DefRNA.error= 1; } } @@ -629,7 +629,7 @@ StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char * break; if(!srnafrom) { - fprintf(stderr, "RNA_def_struct: struct %s not found to define %s.\n", from, identifier); + fprintf(stderr, "%s: struct %s not found to define %s.\n", __func__, from, identifier); DefRNA.error= 1; } } @@ -726,7 +726,7 @@ void RNA_def_struct_sdna(StructRNA *srna, const char *structname) StructDefRNA *ds; if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_struct_sdna: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } @@ -734,7 +734,7 @@ void RNA_def_struct_sdna(StructRNA *srna, const char *structname) if(!DNA_struct_find_nr(DefRNA.sdna, structname)) { if(!DefRNA.silent) { - fprintf(stderr, "RNA_def_struct_sdna: %s not found.\n", structname); + fprintf(stderr, "%s: %s not found.\n", __func__, structname); DefRNA.error= 1; } return; @@ -748,20 +748,20 @@ void RNA_def_struct_sdna_from(StructRNA *srna, const char *structname, const cha StructDefRNA *ds; if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_struct_sdna_from: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } ds= rna_find_def_struct(srna); if(!ds->dnaname) { - fprintf(stderr, "RNA_def_struct_sdna_from: %s base struct must know DNA already.\n", structname); + fprintf(stderr, "%s: %s base struct must know DNA already.\n", __func__, structname); return; } if(!DNA_struct_find_nr(DefRNA.sdna, structname)) { if(!DefRNA.silent) { - fprintf(stderr, "RNA_def_struct_sdna_from: %s not found.\n", structname); + fprintf(stderr, "%s: %s not found.\n", __func__, structname); DefRNA.error= 1; } return; @@ -774,7 +774,7 @@ void RNA_def_struct_sdna_from(StructRNA *srna, const char *structname, const cha void RNA_def_struct_name_property(struct StructRNA *srna, struct PropertyRNA *prop) { if(prop->type != PROP_STRING) { - fprintf(stderr, "RNA_def_struct_name_property: \"%s.%s\", must be a string property.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", must be a string property.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; } else @@ -791,7 +791,7 @@ void RNA_def_struct_nested(BlenderRNA *brna, StructRNA *srna, const char *struct break; if(!srnafrom) { - fprintf(stderr, "RNA_def_struct_nested: struct %s not found for %s.\n", structname, srna->identifier); + fprintf(stderr, "%s: struct %s not found for %s.\n", __func__, structname, srna->identifier); DefRNA.error= 1; } @@ -811,7 +811,7 @@ void RNA_def_struct_clear_flag(StructRNA *srna, int flag) void RNA_def_struct_refine_func(StructRNA *srna, const char *refine) { if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_struct_refine_func: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } @@ -821,7 +821,7 @@ void RNA_def_struct_refine_func(StructRNA *srna, const char *refine) void RNA_def_struct_idprops_func(StructRNA *srna, const char *idproperties) { if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_struct_idprops_func: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } @@ -831,7 +831,7 @@ void RNA_def_struct_idprops_func(StructRNA *srna, const char *idproperties) void RNA_def_struct_register_funcs(StructRNA *srna, const char *reg, const char *unreg, const char *instance) { if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_struct_register_funcs: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } @@ -843,7 +843,7 @@ void RNA_def_struct_register_funcs(StructRNA *srna, const char *reg, const char void RNA_def_struct_path_func(StructRNA *srna, const char *path) { if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_struct_path_func: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } @@ -853,7 +853,7 @@ void RNA_def_struct_path_func(StructRNA *srna, const char *path) void RNA_def_struct_identifier(StructRNA *srna, const char *identifier) { if(DefRNA.preprocess) { - fprintf(stderr, "RNA_def_struct_name_runtime: only at runtime.\n"); + fprintf(stderr, "%s: only at runtime.\n", __func__); return; } @@ -887,7 +887,7 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier char error[512]; if (rna_validate_identifier(identifier, error, 1) == 0) { - fprintf(stderr, "RNA_def_property: property identifier \"%s.%s\" - %s\n", CONTAINER_RNA_ID(cont), identifier, error); + fprintf(stderr, "%s: property identifier \"%s.%s\" - %s\n", __func__, CONTAINER_RNA_ID(cont), identifier, error); DefRNA.error= 1; } @@ -895,7 +895,7 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier /* XXX - toto, detect supertype collisions */ if(rna_findlink(&dcont->properties, identifier)) { - fprintf(stderr, "RNA_def_property: duplicate identifier \"%s.%s\"\n", CONTAINER_RNA_ID(cont), identifier); + fprintf(stderr, "%s: duplicate identifier \"%s.%s\"\n", __func__, CONTAINER_RNA_ID(cont), identifier); DefRNA.error= 1; } @@ -953,7 +953,7 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier case PROP_COLLECTION: break; default: - fprintf(stderr, "RNA_def_property: \"%s.%s\", invalid property type.\n", CONTAINER_RNA_ID(cont), identifier); + fprintf(stderr, "%s: \"%s.%s\", invalid property type.\n", __func__, CONTAINER_RNA_ID(cont), identifier); DefRNA.error= 1; return NULL; } @@ -1054,19 +1054,19 @@ void RNA_def_property_array(PropertyRNA *prop, int length) StructRNA *srna= DefRNA.laststruct; if(length<0) { - fprintf(stderr, "RNA_def_property_array: \"%s.%s\", array length must be zero of greater.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", array length must be zero of greater.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; return; } if(length>RNA_MAX_ARRAY_LENGTH) { - fprintf(stderr, "RNA_def_property_array: \"%s.%s\", array length must be smaller than %d.\n", srna->identifier, prop->identifier, RNA_MAX_ARRAY_LENGTH); + fprintf(stderr, "%s: \"%s.%s\", array length must be smaller than %d.\n", __func__, srna->identifier, prop->identifier, RNA_MAX_ARRAY_LENGTH); DefRNA.error= 1; return; } if(prop->arraydimension > 1) { - fprintf(stderr, "RNA_def_property_array: \"%s.%s\", array dimensions has been set to %u but would be overwritten as 1.\n", srna->identifier, prop->identifier, prop->arraydimension); + fprintf(stderr, "%s: \"%s.%s\", array dimensions has been set to %u but would be overwritten as 1.\n", __func__, srna->identifier, prop->identifier, prop->arraydimension); DefRNA.error= 1; return; } @@ -1080,7 +1080,7 @@ void RNA_def_property_array(PropertyRNA *prop, int length) prop->arraydimension= 1; break; default: - fprintf(stderr, "RNA_def_property_array: \"%s.%s\", only boolean/int/float can be array.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", only boolean/int/float can be array.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1092,7 +1092,7 @@ void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int le int i; if (dimension < 1 || dimension > RNA_MAX_ARRAY_DIMENSION) { - fprintf(stderr, "RNA_def_property_multi_array: \"%s.%s\", array dimension must be between 1 and %d.\n", srna->identifier, prop->identifier, RNA_MAX_ARRAY_DIMENSION); + fprintf(stderr, "%s: \"%s.%s\", array dimension must be between 1 and %d.\n", __func__, srna->identifier, prop->identifier, RNA_MAX_ARRAY_DIMENSION); DefRNA.error= 1; return; } @@ -1103,7 +1103,7 @@ void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int le case PROP_FLOAT: break; default: - fprintf(stderr, "RNA_def_property_multi_array: \"%s.%s\", only boolean/int/float can be array.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", only boolean/int/float can be array.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1160,7 +1160,7 @@ void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double break; } default: - fprintf(stderr, "RNA_def_property_ui_range: \"%s.%s\", invalid type for ui range.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", invalid type for ui range.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1188,7 +1188,7 @@ void RNA_def_property_range(PropertyRNA *prop, double min, double max) break; } default: - fprintf(stderr, "RNA_def_property_range: \"%s.%s\", invalid type for range.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", invalid type for range.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1199,7 +1199,7 @@ void RNA_def_property_struct_type(PropertyRNA *prop, const char *type) StructRNA *srna= DefRNA.laststruct; if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_struct_type \"%s.%s\": only during preprocessing.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s \"%s.%s\": only during preprocessing.\n", __func__, srna->identifier, prop->identifier); return; } @@ -1215,7 +1215,7 @@ void RNA_def_property_struct_type(PropertyRNA *prop, const char *type) break; } default: - fprintf(stderr, "RNA_def_property_struct_type: \"%s.%s\", invalid type for struct type.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", invalid type for struct type.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1226,7 +1226,7 @@ void RNA_def_property_struct_runtime(PropertyRNA *prop, StructRNA *type) StructRNA *srna= DefRNA.laststruct; if(DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_struct_runtime: only at runtime.\n"); + fprintf(stderr, "%s: only at runtime.\n", __func__); return; } @@ -1246,7 +1246,7 @@ void RNA_def_property_struct_runtime(PropertyRNA *prop, StructRNA *type) break; } default: - fprintf(stderr, "RNA_def_property_struct_runtime: \"%s.%s\", invalid type for struct type.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", invalid type for struct type.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1281,7 +1281,7 @@ void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item break; } default: - fprintf(stderr, "RNA_def_property_enum_items: \"%s.%s\", invalid type for struct type.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", invalid type for struct type.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1298,7 +1298,7 @@ void RNA_def_property_string_maxlength(PropertyRNA *prop, int maxlength) break; } default: - fprintf(stderr, "RNA_def_property_string_maxlength: \"%s.%s\", type is not string.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not string.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1315,7 +1315,7 @@ void RNA_def_property_boolean_default(PropertyRNA *prop, int value) break; } default: - fprintf(stderr, "RNA_def_property_boolean_default: \"%s.%s\", type is not boolean.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not boolean.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1332,7 +1332,7 @@ void RNA_def_property_boolean_array_default(PropertyRNA *prop, const int *array) break; } default: - fprintf(stderr, "RNA_def_property_boolean_default: \"%s.%s\", type is not boolean.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not boolean.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1349,7 +1349,7 @@ void RNA_def_property_int_default(PropertyRNA *prop, int value) break; } default: - fprintf(stderr, "RNA_def_property_int_default: \"%s.%s\", type is not int.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not int.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1366,7 +1366,7 @@ void RNA_def_property_int_array_default(PropertyRNA *prop, const int *array) break; } default: - fprintf(stderr, "RNA_def_property_int_default: \"%s.%s\", type is not int.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not int.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1383,7 +1383,7 @@ void RNA_def_property_float_default(PropertyRNA *prop, float value) break; } default: - fprintf(stderr, "RNA_def_property_float_default: \"%s.%s\", type is not float.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not float.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1400,7 +1400,7 @@ void RNA_def_property_float_array_default(PropertyRNA *prop, const float *array) break; } default: - fprintf(stderr, "RNA_def_property_float_default: \"%s.%s\", type is not float.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not float.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1417,7 +1417,7 @@ void RNA_def_property_string_default(PropertyRNA *prop, const char *value) break; } default: - fprintf(stderr, "RNA_def_property_string_default: \"%s.%s\", type is not string.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not string.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1443,7 +1443,7 @@ void RNA_def_property_enum_default(PropertyRNA *prop, int value) } if(eprop->defaultvalue & ~totflag) { - fprintf(stderr, "RNA_def_property_enum_default: \"%s.%s\", default includes unused bits (%d).\n", srna->identifier, prop->identifier, eprop->defaultvalue & ~totflag); + fprintf(stderr, "%s: \"%s.%s\", default includes unused bits (%d).\n", __func__, srna->identifier, prop->identifier, eprop->defaultvalue & ~totflag); DefRNA.error= 1; } } @@ -1458,7 +1458,7 @@ void RNA_def_property_enum_default(PropertyRNA *prop, int value) eprop->defaultvalue= eprop->item[0].value; } else { - fprintf(stderr, "RNA_def_property_enum_default: \"%s.%s\", default is not in items.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", default is not in items.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; } } @@ -1467,7 +1467,7 @@ void RNA_def_property_enum_default(PropertyRNA *prop, int value) break; } default: - fprintf(stderr, "RNA_def_property_enum_default: \"%s.%s\", type is not enum.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not enum.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1506,7 +1506,7 @@ static PropertyDefRNA *rna_def_property_sdna(PropertyRNA *prop, const char *stru return dp; } else { - fprintf(stderr, "rna_def_property_sdna: \"%s.%s\" not found.\n", structname, propname); + fprintf(stderr, "%s: \"%s.%s\" not found.\n", __func__, structname, propname); DefRNA.error= 1; return NULL; } @@ -1539,12 +1539,12 @@ void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, co StructRNA *srna= DefRNA.laststruct; if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_*_sdna: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } if(prop->type != PROP_BOOLEAN) { - fprintf(stderr, "RNA_def_property_boolean_sdna: \"%s.%s\", type is not boolean.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not boolean.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; return; } @@ -1554,7 +1554,7 @@ void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, co if(DefRNA.silent == 0) { /* error check to ensure floats are not wrapped as ints/bools */ if(dp->dnatype && *dp->dnatype && IS_DNATYPE_INT_COMPAT(dp->dnatype) == 0) { - fprintf(stderr, "RNA_def_property_boolean_sdna: %s.%s is a '%s' but wrapped as type '%s'.\n", srna->identifier, prop->identifier, dp->dnatype, RNA_property_typename(prop->type)); + fprintf(stderr, "%s: %s.%s is a '%s' but wrapped as type '%s'.\n", __func__, srna->identifier, prop->identifier, dp->dnatype, RNA_property_typename(prop->type)); DefRNA.error= 1; return; } @@ -1583,12 +1583,12 @@ void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const StructRNA *srna= DefRNA.laststruct; if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_*_sdna: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } if(prop->type != PROP_INT) { - fprintf(stderr, "RNA_def_property_int_sdna: \"%s.%s\", type is not int.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not int.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; return; } @@ -1598,7 +1598,7 @@ void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const /* error check to ensure floats are not wrapped as ints/bools */ if(DefRNA.silent == 0) { if(dp->dnatype && *dp->dnatype && IS_DNATYPE_INT_COMPAT(dp->dnatype) == 0) { - fprintf(stderr, "RNA_def_property_int_sdna: %s.%s is a '%s' but wrapped as type '%s'.\n", srna->identifier, prop->identifier, dp->dnatype, RNA_property_typename(prop->type)); + fprintf(stderr, "%s: %s.%s is a '%s' but wrapped as type '%s'.\n", __func__, srna->identifier, prop->identifier, dp->dnatype, RNA_property_typename(prop->type)); DefRNA.error= 1; return; } @@ -1632,12 +1632,12 @@ void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, cons StructRNA *srna= DefRNA.laststruct; if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_*_sdna: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } if(prop->type != PROP_FLOAT) { - fprintf(stderr, "RNA_def_property_float_sdna: \"%s.%s\", type is not float.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not float.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; return; } @@ -1647,7 +1647,7 @@ void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, cons if(DefRNA.silent == 0) { if(dp->dnatype && *dp->dnatype && IS_DNATYPE_FLOAT_COMPAT(dp->dnatype) == 0) { if(prop->subtype != PROP_COLOR_GAMMA) { /* colors are an exception. these get translated */ - fprintf(stderr, "RNA_def_property_float_sdna: %s.%s is a '%s' but wrapped as type '%s'.\n", srna->identifier, prop->identifier, dp->dnatype, RNA_property_typename(prop->type)); + fprintf(stderr, "%s: %s.%s is a '%s' but wrapped as type '%s'.\n", __func__, srna->identifier, prop->identifier, dp->dnatype, RNA_property_typename(prop->type)); DefRNA.error= 1; return; } @@ -1664,12 +1664,12 @@ void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const StructRNA *srna= DefRNA.laststruct; if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_*_sdna: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } if(prop->type != PROP_ENUM) { - fprintf(stderr, "RNA_def_property_enum_sdna: \"%s.%s\", type is not enum.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not enum.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; return; } @@ -1680,7 +1680,7 @@ void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const prop->totarraylength= 0; if(!DefRNA.silent) { - fprintf(stderr, "RNA_def_property_enum_sdna: \"%s.%s\", array not supported for enum type.\n", structname, propname); + fprintf(stderr, "%s: \"%s.%s\", array not supported for enum type.\n", __func__, structname, propname); DefRNA.error= 1; } } @@ -1706,12 +1706,12 @@ void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, con StructRNA *srna= DefRNA.laststruct; if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_*_sdna: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } if(prop->type != PROP_STRING) { - fprintf(stderr, "RNA_def_property_string_sdna: \"%s.%s\", type is not string.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not string.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; return; } @@ -1731,12 +1731,12 @@ void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, co StructRNA *srna= DefRNA.laststruct; if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_*_sdna: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } if(prop->type != PROP_POINTER) { - fprintf(stderr, "RNA_def_property_pointer_sdna: \"%s.%s\", type is not pointer.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not pointer.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; return; } @@ -1747,7 +1747,7 @@ void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, co prop->totarraylength= 0; if(!DefRNA.silent) { - fprintf(stderr, "RNA_def_property_pointer_sdna: \"%s.%s\", array not supported for pointer type.\n", structname, propname); + fprintf(stderr, "%s: \"%s.%s\", array not supported for pointer type.\n", __func__, structname, propname); DefRNA.error= 1; } } @@ -1761,12 +1761,12 @@ void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, StructRNA *srna= DefRNA.laststruct; if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_*_sdna: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } if(prop->type != PROP_COLLECTION) { - fprintf(stderr, "RNA_def_property_collection_sdna: \"%s.%s\", type is not collection.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not collection.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; return; } @@ -1777,7 +1777,7 @@ void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, prop->totarraylength= 0; if(!DefRNA.silent) { - fprintf(stderr, "RNA_def_property_collection_sdna: \"%s.%s\", array of collections not supported.\n", structname, propname); + fprintf(stderr, "%s: \"%s.%s\", array of collections not supported.\n", __func__, structname, propname); DefRNA.error= 1; } } @@ -1818,7 +1818,7 @@ void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, } else { if(!DefRNA.silent) { - fprintf(stderr, "RNA_def_property_collection_sdna: \"%s.%s\" not found.\n", structname, lengthpropname); + fprintf(stderr, "%s: \"%s.%s\" not found.\n", __func__, structname, lengthpropname); DefRNA.error= 1; } } @@ -1830,7 +1830,7 @@ void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable) { if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_editable_func: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } @@ -1840,7 +1840,7 @@ void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable) void RNA_def_property_editable_array_func(PropertyRNA *prop, const char *editable) { if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_editable_array_func: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } @@ -1850,7 +1850,7 @@ void RNA_def_property_editable_array_func(PropertyRNA *prop, const char *editabl void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func) { if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_update: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } @@ -1866,12 +1866,12 @@ void RNA_def_property_update_runtime(PropertyRNA *prop, void *func) void RNA_def_property_dynamic_array_funcs(PropertyRNA *prop, const char *getlength) { if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_*_funcs: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } if (!(prop->flag & PROP_DYNAMIC)) { - fprintf(stderr, "RNA_def_property_dynamic_array_funcs: property is a not dynamic array.\n"); + fprintf(stderr, "%s: property is a not dynamic array.\n", __func__); DefRNA.error= 1; return; } @@ -1884,7 +1884,7 @@ void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const ch StructRNA *srna= DefRNA.laststruct; if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_*_funcs: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } @@ -1903,7 +1903,7 @@ void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const ch break; } default: - fprintf(stderr, "RNA_def_property_boolean_funcs: \"%s.%s\", type is not boolean.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not boolean.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1914,7 +1914,7 @@ void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char * StructRNA *srna= DefRNA.laststruct; if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_*_funcs: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } @@ -1934,7 +1934,7 @@ void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char * break; } default: - fprintf(stderr, "RNA_def_property_int_funcs: \"%s.%s\", type is not int.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not int.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1945,7 +1945,7 @@ void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char StructRNA *srna= DefRNA.laststruct; if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_*_funcs: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } @@ -1965,7 +1965,7 @@ void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char break; } default: - fprintf(stderr, "RNA_def_property_float_funcs: \"%s.%s\", type is not float.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not float.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1976,7 +1976,7 @@ void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char StructRNA *srna= DefRNA.laststruct; if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_*_funcs: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } @@ -1990,7 +1990,7 @@ void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char break; } default: - fprintf(stderr, "RNA_def_property_enum_funcs: \"%s.%s\", type is not enum.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not enum.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -2001,7 +2001,7 @@ void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const cha StructRNA *srna= DefRNA.laststruct; if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_*_funcs: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } @@ -2015,7 +2015,7 @@ void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const cha break; } default: - fprintf(stderr, "RNA_def_property_string_funcs: \"%s.%s\", type is not string.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not string.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -2026,7 +2026,7 @@ void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const ch StructRNA *srna= DefRNA.laststruct; if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_*_funcs: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } @@ -2041,7 +2041,7 @@ void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const ch break; } default: - fprintf(stderr, "RNA_def_property_pointer_funcs: \"%s.%s\", type is not pointer.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not pointer.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -2052,7 +2052,7 @@ void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, con StructRNA *srna= DefRNA.laststruct; if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_*_funcs: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } @@ -2070,7 +2070,7 @@ void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, con break; } default: - fprintf(stderr, "RNA_def_property_collection_funcs: \"%s.%s\", type is not collection.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not collection.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -2280,7 +2280,7 @@ PropertyRNA *RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, co PropertyRNA *prop; if(!items) { - printf("RNA_def_enum: items not allowed to be NULL.\n"); + printf("%s: items not allowed to be NULL.\n", __func__); return NULL; } @@ -2300,7 +2300,7 @@ PropertyRNA *RNA_def_enum_flag(StructOrFunctionRNA *cont_, const char *identifie PropertyRNA *prop; if(!items) { - printf("RNA_def_enum_flag: items not allowed to be NULL.\n"); + printf("%s: items not allowed to be NULL.\n", __func__); return NULL; } @@ -2530,7 +2530,7 @@ static FunctionRNA *rna_def_function(StructRNA *srna, const char *identifier) char error[512]; if (rna_validate_identifier(identifier, error, 0) == 0) { - fprintf(stderr, "RNA_def_function: function identifier \"%s\" - %s\n", identifier, error); + fprintf(stderr, "%s: function identifier \"%s\" - %s\n", __func__, identifier, error); DefRNA.error= 1; } } @@ -2561,7 +2561,7 @@ FunctionRNA *RNA_def_function(StructRNA *srna, const char *identifier, const cha func= rna_def_function(srna, identifier); if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_function: only at preprocess time.\n"); + fprintf(stderr, "%s: only at preprocess time.\n", __func__); return func; } @@ -2578,7 +2578,7 @@ FunctionRNA *RNA_def_function_runtime(StructRNA *srna, const char *identifier, C func= rna_def_function(srna, identifier); if(DefRNA.preprocess) { - fprintf(stderr, "RNA_def_function_call_runtime: only at runtime.\n"); + fprintf(stderr, "%s: only at runtime.\n", __func__); return func; } @@ -2592,11 +2592,11 @@ FunctionRNA *RNA_def_function_runtime(StructRNA *srna, const char *identifier, C void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret) { if (ret->flag & PROP_DYNAMIC) { - fprintf(stderr, "RNA_def_function_return: \"%s.%s\", dynamic values are not allowed as strict returns, use RNA_def_function_output instead.\n", func->identifier, ret->identifier); + fprintf(stderr, "%s: \"%s.%s\", dynamic values are not allowed as strict returns, use RNA_def_function_output instead.\n", __func__, func->identifier, ret->identifier); return; } else if (ret->arraydimension) { - fprintf(stderr, "RNA_def_function_return: \"%s.%s\", arrays are not allowed as strict returns, use RNA_def_function_output instead.\n", func->identifier, ret->identifier); + fprintf(stderr, "%s: \"%s.%s\", arrays are not allowed as strict returns, use RNA_def_function_output instead.\n", __func__, func->identifier, ret->identifier); return; } diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index 11eec6a0a47..a08e030215c 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -236,7 +236,7 @@ static void rna_DriverTarget_RnaPath_set(PointerRNA *ptr, const char *value) if (dtar->rna_path) MEM_freeN(dtar->rna_path); - if (strlen(value)) + if (value[0]) dtar->rna_path= BLI_strdup(value); else dtar->rna_path= NULL; @@ -329,7 +329,7 @@ static void rna_FCurve_RnaPath_set(PointerRNA *ptr, const char *value) if (fcu->rna_path) MEM_freeN(fcu->rna_path); - if (strlen(value)) { + if (value[0]) { fcu->rna_path= BLI_strdup(value); fcu->flag &= ~FCURVE_DISABLED; } diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 96e6eea22af..d7e0113f56e 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -463,10 +463,8 @@ static void rna_Sequence_filepath_set(PointerRNA *ptr, const char *value) static void rna_Sequence_filepath_get(PointerRNA *ptr, char *value) { Sequence *seq= (Sequence*)(ptr->data); - char path[FILE_MAX]; - BLI_join_dirfile(path, sizeof(path), seq->strip->dir, seq->strip->stripdata->name); - BLI_strncpy(value, path, strlen(path)+1); + BLI_join_dirfile(value, FILE_MAX, seq->strip->dir, seq->strip->stripdata->name); } static int rna_Sequence_filepath_length(PointerRNA *ptr) @@ -475,7 +473,7 @@ static int rna_Sequence_filepath_length(PointerRNA *ptr) char path[FILE_MAX]; BLI_join_dirfile(path, sizeof(path), seq->strip->dir, seq->strip->stripdata->name); - return strlen(path)+1; + return strlen(path); } static void rna_Sequence_proxy_filepath_set(PointerRNA *ptr, const char *value) @@ -491,10 +489,8 @@ static void rna_Sequence_proxy_filepath_set(PointerRNA *ptr, const char *value) static void rna_Sequence_proxy_filepath_get(PointerRNA *ptr, char *value) { StripProxy *proxy= (StripProxy*)(ptr->data); - char path[FILE_MAX]; - BLI_join_dirfile(path, sizeof(path), proxy->dir, proxy->file); - BLI_strncpy(value, path, strlen(path)+1); + BLI_join_dirfile(value, FILE_MAX, proxy->dir, proxy->file); } static int rna_Sequence_proxy_filepath_length(PointerRNA *ptr) @@ -503,7 +499,7 @@ static int rna_Sequence_proxy_filepath_length(PointerRNA *ptr) char path[FILE_MAX]; BLI_join_dirfile(path, sizeof(path), proxy->dir, proxy->file); - return strlen(path)+1; + return strlen(path); } static void rna_Sequence_volume_set(PointerRNA *ptr, float value) diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 36c45cfa59e..e561065cb09 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -78,14 +78,16 @@ static EnumPropertyItem draw_channels_items[] = { {0, "COLOR", ICON_IMAGE_RGB, "Color", "Draw image with RGB colors"}, {SI_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha", "Draw image with RGB colors and alpha transparency"}, {SI_SHOW_ALPHA, "ALPHA", ICON_IMAGE_ALPHA, "Alpha", "Draw alpha transparency channel"}, - {SI_SHOW_ZBUF, "Z_BUFFER", ICON_IMAGE_ZDEPTH, "Z-Buffer", "Draw Z-buffer associated with image (mapped from camera clip start to end)"}, + {SI_SHOW_ZBUF, "Z_BUFFER", ICON_IMAGE_ZDEPTH, "Z-Buffer", + "Draw Z-buffer associated with image (mapped from camera clip start to end)"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem transform_orientation_items[] = { {V3D_MANIP_GLOBAL, "GLOBAL", 0, "Global", "Align the transformation axes to world space"}, {V3D_MANIP_LOCAL, "LOCAL", 0, "Local", "Align the transformation axes to the selected objects' local space"}, {V3D_MANIP_GIMBAL, "GIMBAL", 0, "Gimbal", "Align each axis to the Euler rotation axis as used for input"}, - {V3D_MANIP_NORMAL, "NORMAL", 0, "Normal", "Align the transformation axes to average normal of selected elements (bone Y axis for pose mode)"}, + {V3D_MANIP_NORMAL, "NORMAL", 0, "Normal", + "Align the transformation axes to average normal of selected elements (bone Y axis for pose mode)"}, {V3D_MANIP_VIEW, "VIEW", 0, "View", "Align the transformation axes to the window"}, {V3D_MANIP_CUSTOM, "CUSTOM", 0, "Custom", "Use a custom transform orientation"}, {0, NULL, 0, NULL, NULL}}; @@ -219,7 +221,8 @@ static PointerRNA rna_CurrentOrientation_get(PointerRNA *ptr) if (v3d->twmode < V3D_MANIP_CUSTOM) return rna_pointer_inherit_refine(ptr, &RNA_TransformOrientation, NULL); else - return rna_pointer_inherit_refine(ptr, &RNA_TransformOrientation, BLI_findlink(&scene->transform_spaces, v3d->twmode - V3D_MANIP_CUSTOM)); + return rna_pointer_inherit_refine(ptr, &RNA_TransformOrientation, + BLI_findlink(&scene->transform_spaces, v3d->twmode - V3D_MANIP_CUSTOM)); } EnumPropertyItem *rna_TransformOrientation_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free) @@ -472,7 +475,8 @@ static void rna_SpaceImageEditor_image_set(PointerRNA *ptr, PointerRNA value) ED_space_image_set(NULL, sima, sc->scene, sc->scene->obedit, (Image*)value.data); } -static EnumPropertyItem *rna_SpaceImageEditor_draw_channels_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free) +static EnumPropertyItem *rna_SpaceImageEditor_draw_channels_itemf(bContext *UNUSED(C), PointerRNA *ptr, + PropertyRNA *UNUSED(prop), int *free) { SpaceImage *sima= (SpaceImage*)ptr->data; EnumPropertyItem *item= NULL; @@ -726,14 +730,16 @@ static void rna_SpaceDopeSheetEditor_action_set(PointerRNA *ptr, PointerRNA valu if (act->idroot == ID_OB) saction->action = act; else - printf("ERROR: cannot assign Action '%s' to Action Editor, as action is not object-level animation\n", act->id.name+2); + printf("ERROR: cannot assign Action '%s' to Action Editor, as action is not object-level animation\n", + act->id.name+2); } else if (saction->mode == SACTCONT_SHAPEKEY) { /* as the name says, "shapekey-level" only... */ if (act->idroot == ID_KE) saction->action = act; else - printf("ERROR: cannot assign Action '%s' to Shape Key Editor, as action doesn't animate Shape Keys\n", act->id.name+2); + printf("ERROR: cannot assign Action '%s' to Shape Key Editor, as action doesn't animate Shape Keys\n", + act->id.name+2); } else { printf("ACK: who's trying to set an action while not in a mode displaying a single Action only?\n"); @@ -861,7 +867,8 @@ static void rna_SpaceNodeEditor_node_tree_update(Main *bmain, Scene *scene, Poin ED_node_tree_update(snode, scene); } -static EnumPropertyItem *rna_SpaceProperties_texture_context_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free) +static EnumPropertyItem *rna_SpaceProperties_texture_context_itemf(bContext *C, PointerRNA *UNUSED(ptr), + PropertyRNA *UNUSED(prop), int *free) { Scene *scene = CTX_data_scene(C); Object *ob = CTX_data_active_object(C); @@ -940,8 +947,10 @@ static void rna_def_space_image_uv(BlenderRNA *brna) static EnumPropertyItem sticky_mode_items[] = { {SI_STICKY_DISABLE, "DISABLED", ICON_STICKY_UVS_DISABLE, "Disabled", "Sticky vertex selection disabled"}, - {SI_STICKY_LOC, "SHARED_LOCATION", ICON_STICKY_UVS_LOC, "Shared Location", "Select UVs that are at the same location and share a mesh vertex"}, - {SI_STICKY_VERTEX, "SHARED_VERTEX", ICON_STICKY_UVS_VERT, "Shared Vertex", "Select UVs that share mesh vertex, irrespective if they are in the same location"}, + {SI_STICKY_LOC, "SHARED_LOCATION", ICON_STICKY_UVS_LOC, "Shared Location", + "Select UVs that are at the same location and share a mesh vertex"}, + {SI_STICKY_VERTEX, "SHARED_VERTEX", ICON_STICKY_UVS_VERT, "Shared Vertex", + "Select UVs that share mesh vertex, irrespective if they are in the same location"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem dt_uv_items[] = { @@ -971,7 +980,8 @@ static void rna_def_space_image_uv(BlenderRNA *brna) prop= RNA_def_property(srna, "sticky_select_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "sticky"); RNA_def_property_enum_items(prop, sticky_mode_items); - RNA_def_property_ui_text(prop, "Sticky Selection Mode", "Automatically select also UVs sharing the same vertex as the ones being selected"); + RNA_def_property_ui_text(prop, "Sticky Selection Mode", + "Automatically select also UVs sharing the same vertex as the ones being selected"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL); /* drawing */ @@ -988,7 +998,9 @@ static void rna_def_space_image_uv(BlenderRNA *brna) prop= RNA_def_property(srna, "show_stretch", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAW_STRETCH); - RNA_def_property_ui_text(prop, "Draw Stretch", "Draw faces colored according to the difference in shape between UVs and their 3D coordinates (blue for low distortion, red for high distortion)"); + RNA_def_property_ui_text(prop, "Draw Stretch", + "Draw faces colored according to the difference in shape between UVs and " + "their 3D coordinates (blue for low distortion, red for high distortion)"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL); prop= RNA_def_property(srna, "draw_stretch_type", PROP_ENUM, PROP_NONE); @@ -1019,7 +1031,8 @@ static void rna_def_space_image_uv(BlenderRNA *brna) prop= RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ); RNA_def_property_array(prop, 2); - RNA_def_property_float_funcs(prop, "rna_SpaceImageEditor_cursor_location_get", "rna_SpaceImageEditor_cursor_location_set", NULL); + RNA_def_property_float_funcs(prop, "rna_SpaceImageEditor_cursor_location_get", + "rna_SpaceImageEditor_cursor_location_set", NULL); RNA_def_property_ui_text(prop, "2D Cursor Location", "2D cursor location for this view"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL); @@ -1037,7 +1050,8 @@ static void rna_def_space_image_uv(BlenderRNA *brna) prop= RNA_def_property(srna, "use_live_unwrap", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_LIVE_UNWRAP); - RNA_def_property_ui_text(prop, "Live Unwrap", "Continuously unwrap the selected UV island while transforming pinned vertices"); + RNA_def_property_ui_text(prop, "Live Unwrap", + "Continuously unwrap the selected UV island while transforming pinned vertices"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL); prop= RNA_def_property(srna, "pivot_point", PROP_ENUM, PROP_NONE); @@ -1140,12 +1154,12 @@ static void rna_def_background_image(BlenderRNA *brna) prop= RNA_def_property(srna, "offset_x", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "xof"); - RNA_def_property_ui_text(prop, "X Offset", "Offsets image horizontally from the world origin"); + RNA_def_property_ui_text(prop, "X Offset", "Offset image horizontally from the world origin"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); prop= RNA_def_property(srna, "offset_y", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "yof"); - RNA_def_property_ui_text(prop, "Y Offset", "Offsets image vertically from the world origin"); + RNA_def_property_ui_text(prop, "Y Offset", "Offset image vertically from the world origin"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE); @@ -1181,7 +1195,8 @@ static void rna_def_space_view3d(BlenderRNA *brna) const int matrix_dimsize[]= {4, 4}; static EnumPropertyItem pivot_items[] = { - {V3D_CENTER, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center", "Pivot around bounding box center of selected object(s)"}, + {V3D_CENTER, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center", + "Pivot around bounding box center of selected object(s)"}, {V3D_CURSOR, "CURSOR", ICON_CURSOR, "3D Cursor", "Pivot around the 3D cursor"}, {V3D_LOCAL, "INDIVIDUAL_ORIGINS", ICON_ROTATECOLLECTION, "Individual Origins", "Pivot around each object's own origin"}, {V3D_CENTROID, "MEDIAN_POINT", ICON_ROTATECENTER, "Median Point", "Pivot around the median point of selected objects"}, @@ -1257,19 +1272,19 @@ static void rna_def_space_view3d(BlenderRNA *brna) prop= RNA_def_property(srna, "grid_scale", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "grid"); - RNA_def_property_ui_text(prop, "Grid Scale", "The distance between 3D View grid lines"); + RNA_def_property_ui_text(prop, "Grid Scale", "Distance between 3D View grid lines"); RNA_def_property_range(prop, 0.0f, FLT_MAX); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); prop= RNA_def_property(srna, "grid_lines", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "gridlines"); - RNA_def_property_ui_text(prop, "Grid Lines", "The number of grid lines to display in perspective view"); + RNA_def_property_ui_text(prop, "Grid Lines", "Number of grid lines to display in perspective view"); RNA_def_property_range(prop, 0, 1024); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); prop= RNA_def_property(srna, "grid_subdivisions", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "gridsubdiv"); - RNA_def_property_ui_text(prop, "Grid Subdivisions", "The number of subdivisions between grid lines"); + RNA_def_property_ui_text(prop, "Grid Subdivisions", "Number of subdivisions between grid lines"); RNA_def_property_range(prop, 1, 1024); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); @@ -1295,12 +1310,14 @@ static void rna_def_space_view3d(BlenderRNA *brna) prop= RNA_def_property(srna, "show_outline_selected", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SELECT_OUTLINE); - RNA_def_property_ui_text(prop, "Outline Selected", "Show an outline highlight around selected objects in non-wireframe views"); + RNA_def_property_ui_text(prop, "Outline Selected", + "Show an outline highlight around selected objects in non-wireframe views"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); prop= RNA_def_property(srna, "show_all_objects_origin", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_DRAW_CENTERS); - RNA_def_property_ui_text(prop, "All Object Origins", "Show the object origin center dot for all (selected and unselected) objects"); + RNA_def_property_ui_text(prop, "All Object Origins", + "Show the object origin center dot for all (selected and unselected) objects"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); prop= RNA_def_property(srna, "show_relationship_lines", PROP_BOOLEAN, PROP_NONE); @@ -1386,12 +1403,13 @@ static void rna_def_space_view3d(BlenderRNA *brna) prop= RNA_def_property(srna, "current_orientation", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "TransformOrientation"); RNA_def_property_pointer_funcs(prop, "rna_CurrentOrientation_get", NULL, NULL, NULL); - RNA_def_property_ui_text(prop, "Current Transform Orientation", "Current Transformation orientation"); + RNA_def_property_ui_text(prop, "Current Transform Orientation", "Current transformation orientation"); prop= RNA_def_property(srna, "lock_camera_and_layers", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "scenelock", 1); RNA_def_property_boolean_funcs(prop, NULL, "rna_SpaceView3D_lock_camera_and_layers_set"); - RNA_def_property_ui_text(prop, "Lock Camera and Layers", "Use the scene's active camera and layers in this view, rather than local layers"); + RNA_def_property_ui_text(prop, "Lock Camera and Layers", + "Use the scene's active camera and layers in this view, rather than local layers"); RNA_def_property_ui_icon(prop, ICON_LOCKVIEW_OFF, 1); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); @@ -1651,7 +1669,9 @@ static void rna_def_space_image(BlenderRNA *brna) /* update */ prop= RNA_def_property(srna, "use_realtime_update", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "lock", 0); - RNA_def_property_ui_text(prop, "Update Automatically", "Update other affected window spaces automatically to reflect changes during interactive operations such as transform"); + RNA_def_property_ui_text(prop, "Update Automatically", + "Update other affected window spaces automatically to reflect changes " + "during interactive operations such as transform"); /* state */ prop= RNA_def_property(srna, "show_render", PROP_BOOLEAN, PROP_NONE); @@ -1708,14 +1728,14 @@ static void rna_def_space_sequencer(BlenderRNA *brna) prop= RNA_def_property(srna, "view_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "view"); RNA_def_property_enum_items(prop, view_type_items); - RNA_def_property_ui_text(prop, "View Type", "The type of the Sequencer view (sequencer, preview or both)"); + RNA_def_property_ui_text(prop, "View Type", "Type of the Sequencer view (sequencer, preview or both)"); RNA_def_property_update(prop, 0, "rna_Sequencer_view_type_update"); /* display type, fairly important */ prop= RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "mainb"); RNA_def_property_enum_items(prop, display_mode_items); - RNA_def_property_ui_text(prop, "Display Mode", "The view mode to use for displaying sequencer output"); + RNA_def_property_ui_text(prop, "Display Mode", "View mode to use for displaying sequencer output"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL); /* flag's */ @@ -1746,7 +1766,7 @@ static void rna_def_space_sequencer(BlenderRNA *brna) prop= RNA_def_property(srna, "use_grease_pencil", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_DRAW_GPENCIL); - RNA_def_property_ui_text(prop, "Use Grease Pencil", "Display and edit the grease pencil freehand annotations overlay"); + RNA_def_property_ui_text(prop, "Use Grease Pencil", "Display and edit the grease pencil freehand annotations overlay"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL); /* grease pencil */ @@ -1758,7 +1778,8 @@ static void rna_def_space_sequencer(BlenderRNA *brna) prop= RNA_def_property(srna, "display_channel", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "chanshown"); - RNA_def_property_ui_text(prop, "Display Channel", "The channel number shown in the image preview. 0 is the result of all strips combined"); + RNA_def_property_ui_text(prop, "Display Channel", + "The channel number shown in the image preview. 0 is the result of all strips combined"); RNA_def_property_range(prop, -5, MAXSEQ); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL); @@ -1778,12 +1799,12 @@ static void rna_def_space_sequencer(BlenderRNA *brna) /* not sure we need rna access to these but adding anyway */ prop= RNA_def_property(srna, "offset_x", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "xof"); - RNA_def_property_ui_text(prop, "X Offset", "Offsets image horizontally from the view center"); + RNA_def_property_ui_text(prop, "X Offset", "Offset image horizontally from the view center"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL); prop= RNA_def_property(srna, "offset_y", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "yof"); - RNA_def_property_ui_text(prop, "Y Offset", "Offsets image horizontally from the view center"); + RNA_def_property_ui_text(prop, "Y Offset", "Offset image vertically from the view center"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL); prop= RNA_def_property(srna, "zoom", PROP_FLOAT, PROP_NONE); @@ -1945,7 +1966,9 @@ static void rna_def_space_dopesheet(BlenderRNA *brna) prop= RNA_def_property(srna, "show_pose_markers", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_POSEMARKERS_SHOW); - RNA_def_property_ui_text(prop, "Show Pose Markers", "Show markers belonging to the active action instead of Scene markers (Action and Shape Key Editors only)"); + RNA_def_property_ui_text(prop, "Show Pose Markers", + "Show markers belonging to the active action instead of Scene markers " + "(Action and Shape Key Editors only)"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_DOPESHEET, NULL); /* editing */ @@ -1956,7 +1979,8 @@ static void rna_def_space_dopesheet(BlenderRNA *brna) prop= RNA_def_property(srna, "use_realtime_update", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SACTION_NOREALTIMEUPDATES); - RNA_def_property_ui_text(prop, "Realtime Updates", "When transforming keyframes, changes to the animation data are flushed to other views"); + RNA_def_property_ui_text(prop, "Realtime Updates", + "When transforming keyframes, changes to the animation data are flushed to other views"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_DOPESHEET, NULL); prop= RNA_def_property(srna, "use_marker_sync", PROP_BOOLEAN, PROP_NONE); @@ -2032,7 +2056,8 @@ static void rna_def_space_graph(BlenderRNA *brna) prop= RNA_def_property(srna, "use_only_selected_curves_handles", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_SELCUVERTSONLY); - RNA_def_property_ui_text(prop, "Only Selected Curve Keyframes", "Only keyframes of selected F-Curves are visible and editable"); + RNA_def_property_ui_text(prop, "Only Selected Curve Keyframes", + "Only keyframes of selected F-Curves are visible and editable"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL); prop= RNA_def_property(srna, "use_only_selected_keyframe_handles", PROP_BOOLEAN, PROP_NONE); @@ -2042,7 +2067,8 @@ static void rna_def_space_graph(BlenderRNA *brna) prop= RNA_def_property(srna, "use_beauty_drawing", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_BEAUTYDRAW_OFF); - RNA_def_property_ui_text(prop, "Use High Quality Drawing", "Draw F-Curves using Anti-Aliasing and other fancy effects. Disable for better performance"); + RNA_def_property_ui_text(prop, "Use High Quality Drawing", + "Draw F-Curves using Anti-Aliasing and other fancy effects. Disable for better performance"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL); /* editing */ @@ -2053,7 +2079,8 @@ static void rna_def_space_graph(BlenderRNA *brna) prop= RNA_def_property(srna, "use_realtime_update", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NOREALTIMEUPDATES); - RNA_def_property_ui_text(prop, "Realtime Updates", "When transforming keyframes, changes to the animation data are flushed to other views"); + RNA_def_property_ui_text(prop, "Realtime Updates", + "When transforming keyframes, changes to the animation data are flushed to other views"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL); /* cursor */ @@ -2123,7 +2150,8 @@ static void rna_def_space_nla(BlenderRNA *brna) /* editing */ prop= RNA_def_property(srna, "use_realtime_update", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SNLA_NOREALTIMEUPDATES); - RNA_def_property_ui_text(prop, "Realtime Updates", "When transforming strips, changes to the animation data are flushed to other views"); + RNA_def_property_ui_text(prop, "Realtime Updates", + "When transforming strips, changes to the animation data are flushed to other views"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NLA, NULL); /* dopesheet */ @@ -2152,7 +2180,7 @@ static void rna_def_space_time(BlenderRNA *brna) /* view settings */ prop= RNA_def_property(srna, "show_only_selected", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", TIME_ONLYACTSEL); - RNA_def_property_ui_text(prop, "Only Selected Channels", "Show keyframes for active Object and/or its selected bones only"); + RNA_def_property_ui_text(prop, "Only Selected Channels", "Show keyframes for active Object and/or its selected bones only"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL); prop= RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE); @@ -2444,7 +2472,8 @@ static void rna_def_space_node(BlenderRNA *brna) static EnumPropertyItem backdrop_channels_items[] = { {0, "COLOR", ICON_IMAGE_RGB, "Color", "Draw image with RGB colors"}, - {SNODE_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha", "Draw image with RGB colors and alpha transparency"}, + {SNODE_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha", + "Draw image with RGB colors and alpha transparency"}, {SNODE_SHOW_ALPHA, "ALPHA", ICON_IMAGE_ALPHA, "Alpha", "Draw alpha transparency channel"}, {0, NULL, 0, NULL, NULL}}; diff --git a/source/blender/makesrna/intern/rna_text.c b/source/blender/makesrna/intern/rna_text.c index 6a1e93fce41..4e23fb6b095 100644 --- a/source/blender/makesrna/intern/rna_text.c +++ b/source/blender/makesrna/intern/rna_text.c @@ -69,7 +69,7 @@ static void rna_Text_filename_set(PointerRNA *ptr, const char *value) if(text->name) MEM_freeN(text->name); - if(strlen(value)) + if(value[0]) text->name= BLI_strdup(value); else text->name= NULL; diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index bfd4be66c03..645079ca24e 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -543,7 +543,8 @@ static void remap_uvs_23(DerivedMesh *dm, DerivedMesh *split, int numlayer, int } } -static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm){ +static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm) +{ DerivedMesh *splitdm; MFace *mf=NULL,*df1=NULL; MFace *mface=dm->getTessFaceArray(dm); diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c index 2c94c4d1505..dcdb6b4dde8 100644 --- a/source/blender/modifiers/intern/MOD_weightvg_util.c +++ b/source/blender/modifiers/intern/MOD_weightvg_util.c @@ -225,7 +225,8 @@ void weightvg_do_mask(int num, const int *indices, float *org_w, const float *ne } /* Adds the given vertex to the specified vertex group, with given weight. */ -static void defvert_add_to_group(MDeformVert *dv, int defgrp_idx, const float weight) { +static void defvert_add_to_group(MDeformVert *dv, int defgrp_idx, const float weight) +{ /* TODO, move into deform.c as a generic function. This assumes the vertex * groups have already been checked, so this has to remain low level. */ MDeformWeight *newdw; @@ -244,7 +245,8 @@ static void defvert_add_to_group(MDeformVert *dv, int defgrp_idx, const float we /* Removes the given vertex from the vertex group, specified either by its defgrp_idx, * or directly by its MDeformWeight pointer, if dw is not NULL. * WARNING: This function frees the given MDeformWeight, do not use it afterward! */ -static void defvert_remove_from_group(MDeformVert *dv, int defgrp_idx, MDeformWeight *dw) { +static void defvert_remove_from_group(MDeformVert *dv, int defgrp_idx, MDeformWeight *dw) +{ /* TODO, move this into deform.c as a generic function. */ MDeformWeight *newdw; int i; diff --git a/source/blender/nodes/composite/nodes/node_composite_common.c b/source/blender/nodes/composite/nodes/node_composite_common.c index d5ae442c25f..ed85d1c2fb8 100644 --- a/source/blender/nodes/composite/nodes/node_composite_common.c +++ b/source/blender/nodes/composite/nodes/node_composite_common.c @@ -174,7 +174,8 @@ static void group_move_outputs(bNode *node, bNodeStack **out, bNodeStack *gstack } /* Free internal buffers */ -static void group_free_internal(bNodeTreeExec *gexec) { +static void group_free_internal(bNodeTreeExec *gexec) +{ bNodeStack *ns; int i; diff --git a/source/blender/python/generic/IDProp.c b/source/blender/python/generic/IDProp.c index 2543d34f58c..e6883eb30af 100644 --- a/source/blender/python/generic/IDProp.c +++ b/source/blender/python/generic/IDProp.c @@ -269,7 +269,7 @@ static int idp_sequence_type(PyObject *seq) PyObject *item; int type= IDP_INT; - int i, len = PySequence_Size(seq); + Py_ssize_t i, len = PySequence_Size(seq); for (i=0; i < len; i++) { item = PySequence_GetItem(seq, i); if (PyFloat_Check(item)) { diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c index 44d42a479ec..35c211d5424 100644 --- a/source/blender/python/generic/bgl.c +++ b/source/blender/python/generic/bgl.c @@ -286,8 +286,8 @@ static PyObject *Buffer_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject Buffer *buffer; int dimensions[MAX_DIMENSIONS]; - int i, type; - int ndimensions = 0; + int type; + Py_ssize_t i, ndimensions = 0; if(kwds && PyDict_Size(kwds)) { PyErr_SetString(PyExc_TypeError, diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index d5bd44fc288..bf14102bb0d 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -107,7 +107,8 @@ int PyC_AsArray(void *array, PyObject *value, const int length, const PyTypeObje /* for debugging */ -void PyC_ObSpit(const char *name, PyObject *var) { +void PyC_ObSpit(const char *name, PyObject *var) +{ fprintf(stderr, "<%s> : ", name); if (var==NULL) { fprintf(stderr, "<NIL>"); @@ -126,7 +127,8 @@ void PyC_ObSpit(const char *name, PyObject *var) { fprintf(stderr, "\n"); } -void PyC_LineSpit(void) { +void PyC_LineSpit(void) +{ const char *filename; int lineno; @@ -363,12 +365,15 @@ const char *PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce) * chars since blender doesnt limit this */ return result; } - else if(PyBytes_Check(py_str)) { - PyErr_Clear(); - return PyBytes_AS_STRING(py_str); - } else { - return PyBytes_AS_STRING((*coerce= PyUnicode_EncodeFSDefault(py_str))); + PyErr_Clear(); + + if(PyBytes_Check(py_str)) { + return PyBytes_AS_STRING(py_str); + } + else { + return PyBytes_AS_STRING((*coerce= PyUnicode_EncodeFSDefault(py_str))); + } } } diff --git a/source/blender/python/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c index 5dcaf9e5423..fe747cdcce5 100644 --- a/source/blender/python/intern/bpy_app_handlers.c +++ b/source/blender/python/intern/bpy_app_handlers.c @@ -40,6 +40,8 @@ void bpy_app_generic_callback(struct Main *main, struct ID *id, void *arg); static PyTypeObject BlenderAppCbType; static PyStructSequence_Field app_cb_info_fields[]= { + {(char *)"frame_change_pre", NULL}, + {(char *)"frame_change_post", NULL}, {(char *)"render_pre", NULL}, {(char *)"render_post", NULL}, {(char *)"render_stats", NULL}, diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index a3d5bc99ad8..04c64bcbd3c 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -973,7 +973,7 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i PyErr_Format(PyExc_TypeError, "EnumProperty(..., default=\'%s\'): not found in enum members", - def); + def_cmp); return NULL; } } diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 3175c0d088e..cbd6affb117 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -1718,7 +1718,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb } case PROP_COLLECTION: { - int seq_len, i; + Py_ssize_t seq_len, i; PyObject *item; PointerRNA itemptr; ListBase *lb; @@ -1736,7 +1736,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb } seq_len= PySequence_Size(value); - for(i=0; i<seq_len; i++) { + for(i=0; i < seq_len; i++) { item= PySequence_GetItem(value, i); if(item==NULL) { @@ -4140,8 +4140,8 @@ static PyObject *pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject * /* only needed for subtyping, so a new class gets a valid BPy_StructRNA * todo - also accept useful args */ -static PyObject *pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds)) { - +static PyObject *pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds)) +{ BPy_PropertyRNA *base; if (!PyArg_ParseTuple(args, "O!:bpy_prop.__new__", &pyrna_prop_Type, &base)) diff --git a/source/blender/python/intern/bpy_rna_array.c b/source/blender/python/intern/bpy_rna_array.c index e50ce233671..cab57724d6d 100644 --- a/source/blender/python/intern/bpy_rna_array.c +++ b/source/blender/python/intern/bpy_rna_array.c @@ -61,12 +61,12 @@ typedef void (*RNA_SetIndexFunc)(PointerRNA *, PropertyRNA *, int index, void *) static int validate_array_type(PyObject *seq, int dim, int totdim, int dimsize[], ItemTypeCheckFunc check_item_type, const char *item_type_str, const char *error_prefix) { - int i; + Py_ssize_t i; /* not the last dimension */ if (dim + 1 < totdim) { /* check that a sequence contains dimsize[dim] items */ - const int seq_size= PySequence_Size(seq); + const Py_ssize_t seq_size= PySequence_Size(seq); if(seq_size == -1) { PyErr_Format(PyExc_ValueError, "%s sequence expected at dimension %d, not '%s'", error_prefix, (int)dim + 1, Py_TYPE(seq)->tp_name); @@ -147,8 +147,8 @@ static int count_items(PyObject *seq, int dim) int totitem= 0; if(dim > 1) { - const int seq_size= PySequence_Size(seq); - int i; + const Py_ssize_t seq_size= PySequence_Size(seq); + Py_ssize_t i; for (i= 0; i < seq_size; i++) { PyObject *item= PySequence_GetItem(seq, i); if(item) { @@ -281,9 +281,9 @@ static char *copy_value_single(PyObject *item, PointerRNA *ptr, PropertyRNA *pro static char *copy_values(PyObject *seq, PointerRNA *ptr, PropertyRNA *prop, int dim, char *data, unsigned int item_size, int *index, ItemConvertFunc convert_item, RNA_SetIndexFunc rna_set_index) { - unsigned int i; int totdim= RNA_property_array_dimension(ptr, prop, NULL); - const int seq_size= PySequence_Size(seq); + const Py_ssize_t seq_size= PySequence_Size(seq); + Py_ssize_t i; /* Regarding PySequence_GetItem() failing. * diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c index 32a4648c7f8..8939ffd85a9 100644 --- a/source/blender/windowmanager/intern/wm_cursors.c +++ b/source/blender/windowmanager/intern/wm_cursors.c @@ -317,8 +317,8 @@ are for */ #define BEGIN_CURSOR_BLOCK { #define END_CURSOR_BLOCK } -void wm_init_cursor_data(void){ - +void wm_init_cursor_data(void) +{ /********************** NW_ARROW Cursor **************************/ BEGIN_CURSOR_BLOCK static char nw_sbm[]={ diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index dad43b4fe69..cfeaee18416 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -1270,10 +1270,7 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand if(ot) retval= wm_operator_invoke(C, ot, event, properties, NULL, FALSE); } - /* Finished and pass through flag as handled */ - if(retval == (OPERATOR_FINISHED|OPERATOR_PASS_THROUGH)) - return WM_HANDLER_HANDLED; /* Modal unhandled, break */ if(retval == (OPERATOR_PASS_THROUGH|OPERATOR_RUNNING_MODAL)) diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 68cd95c1b99..841198c0664 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -863,7 +863,8 @@ void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type, RNA_def_boolean(ot->srna, "relative_path", (U.flag & USER_RELPATHS) ? 1:0, "Relative Path", "Select the file relative to the blend file"); } -void WM_operator_properties_select_all(wmOperatorType *ot) { +void WM_operator_properties_select_all(wmOperatorType *ot) +{ static EnumPropertyItem select_all_actions[] = { {SEL_TOGGLE, "TOGGLE", 0, N_("Toggle"), "Toggle selection for all elements"}, {SEL_SELECT, "SELECT", 0, N_("Select"), "Select all elements"}, |