diff options
Diffstat (limited to 'source/blender/blenkernel')
19 files changed, 390 insertions, 395 deletions
diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h index fa3a1a6897a..3b9328ae1aa 100644 --- a/source/blender/blenkernel/BKE_curve.h +++ b/source/blender/blenkernel/BKE_curve.h @@ -53,72 +53,83 @@ struct Scene; #define CU_DO_TILT(cu, nu) (((nu->flag & CU_2D) && (cu->flag & CU_3D)==0) ? 0 : 1) #define CU_DO_RADIUS(cu, nu) ((CU_DO_TILT(cu, nu) || ((cu)->flag & CU_PATH_RADIUS) || (cu)->bevobj || (cu)->ext1!=0.0f || (cu)->ext2!=0.0f) ? 1:0) +/* ** Curve ** */ +void BKE_curve_unlink(struct Curve *cu); +void BKE_curve_free(struct Curve *cu); +void BKE_curve_editfont_free(struct Curve *cu); +struct Curve *BKE_curve_add(const char *name, int type); +struct Curve *BKE_curve_copy(struct Curve *cu); +void BKE_curve_make_local(struct Curve *cu); +short BKE_curve_type_get(struct Curve *cu); +void BKE_curve_type_test(struct Object *ob); +void BKE_curve_curve_dimension_update(struct Curve *cu); +void BKE_curve_tex_space_calc(struct Curve *cu); -void unlink_curve(struct Curve *cu); -void free_curve_editNurb_keyIndex(struct EditNurb *editnurb); -void free_curve_editNurb(struct Curve *cu); -void free_curve(struct Curve *cu); -void BKE_free_editfont(struct Curve *cu); -struct Curve *add_curve(const char *name, int type); -struct Curve *copy_curve(struct Curve *cu); -void make_local_curve(struct Curve *cu); -struct ListBase *curve_editnurbs(struct Curve *cu); -short curve_type(struct Curve *cu); -void test_curve_type(struct Object *ob); -void update_curve_dimension(struct Curve *cu ); -void tex_space_curve(struct Curve *cu); -int count_curveverts(struct ListBase *nurb); -int count_curveverts_without_handles(struct ListBase *nurb); -void freeNurb(struct Nurb *nu); -void freeNurblist(struct ListBase *lb); -struct Nurb *duplicateNurb(struct Nurb *nu); -void duplicateNurblist(struct ListBase *lb1, struct ListBase *lb2); -void test2DNurb(struct Nurb *nu); -void minmaxNurb(struct Nurb *nu, float *min, float *max); - -void nurbs_knot_calc_u(struct Nurb *nu); -void nurbs_knot_calc_v(struct Nurb *nu); - -void makeNurbfaces(struct Nurb *nu, float *coord_array, int rowstride, int resolu, int resolv); -void makeNurbcurve(struct Nurb *nu, float *coord_array, float *tilt_array, float *radius_array, float *weight_array, int resolu, int stride); -void forward_diff_bezier(float q0, float q1, float q2, float q3, float *p, int it, int stride); -float *make_orco_curve(struct Scene *scene, struct Object *ob); -float *make_orco_surf(struct Object *ob); -void makebevelcurve(struct Scene *scene, struct Object *ob, struct ListBase *disp, int forRender); - -void makeBevelList(struct Object *ob); - -void calchandleNurb(struct BezTriple *bezt, struct BezTriple *prev, struct BezTriple *next, int mode); -void calchandlesNurb(struct Nurb *nu); -void testhandlesNurb(struct Nurb *nu); -void autocalchandlesNurb(struct Nurb *nu, int flag); -void autocalchandlesNurb_all(ListBase *editnurb, int flag); -void sethandlesNurb(ListBase *editnurb, short code); - -void switchdirectionNurb(struct Nurb *nu); - -void addNurbPoints(struct Nurb *nu, int number); -void addNurbPointsBezier(struct Nurb *nu, int number); - -float (*curve_getVertexCos(struct Curve *cu, struct ListBase *lb, int *numVerts_r))[3]; -void curve_applyVertexCos(struct Curve *cu, struct ListBase *lb, float (*vertexCos)[3]); - -float (*curve_getKeyVertexCos(struct Curve *cu, struct ListBase *lb, float *key))[3]; -void curve_applyKeyVertexTilts(struct Curve *cu, struct ListBase *lb, float *key); +int BKE_curve_minmax(struct Curve *cu, float min[3], float max[3]); +int BKE_curve_center_median(struct Curve *cu, float cent[3]); +int BKE_curve_center_bounds(struct Curve *cu, float cent[3]); +void BKE_curve_translate(struct Curve *cu, float offset[3], int do_keys); +void BKE_curve_delete_material_index(struct Curve *cu, int index); + +ListBase *BKE_curve_nurbs_get(struct Curve *cu); + +float (*BKE_curve_vertexCos_get(struct Curve *cu, struct ListBase *lb, int *numVerts_r))[3]; +void BK_curve_vertexCos_apply(struct Curve *cu, struct ListBase *lb, float (*vertexCos)[3]); + +float (*BKE_curve_keyVertexCos_get(struct Curve *cu, struct ListBase *lb, float *key))[3]; +void BKE_curve_keyVertexTilts_apply(struct Curve *cu, struct ListBase *lb, float *key); + +void BKE_curve_editNurb_keyIndex_free(struct EditNurb *editnurb); +void BKE_curve_editNurb_free(struct Curve *cu); +struct ListBase *BKE_curve_editNurbs_get(struct Curve *cu); + +float *BKE_curve_make_orco(struct Scene *scene, struct Object *ob); +float *BKE_curve_surf_make_orco(struct Object *ob); + +void BKE_curve_bevelList_make(struct Object *ob); +void BKE_curve_bevel_make(struct Scene *scene, struct Object *ob, struct ListBase *disp, int forRender); + +void BKE_curve_forward_diff_bezier(float q0, float q1, float q2, float q3, float *p, int it, int stride); + +/* ** Nurbs ** */ + +int BKE_nurbList_verts_count(struct ListBase *nurb); +int BKE_nurbList_verts_count_without_handles(struct ListBase *nurb); + +void BKE_nurbList_free(struct ListBase *lb); +void BKE_nurbList_duplicate(struct ListBase *lb1, struct ListBase *lb2); +void BKE_nurbList_handles_set(struct ListBase *editnurb, short code); + +void BKE_nurbList_handles_autocalc(ListBase *editnurb, int flag); + +void BKE_nurb_free(struct Nurb *nu); +struct Nurb *BKE_nurb_duplicate(struct Nurb *nu); + +void BKE_nurb_test2D(struct Nurb *nu); +void BKE_nurb_minmax(struct Nurb *nu, float *min, float *max); + +void BKE_nurb_makeFaces(struct Nurb *nu, float *coord_array, int rowstride, int resolu, int resolv); +void BKE_nurb_makeCurve(struct Nurb *nu, float *coord_array, float *tilt_array, float *radius_array, float *weight_array, int resolu, int stride); + +void BKE_nurb_knot_calc_u(struct Nurb *nu); +void BKE_nurb_knot_calc_v(struct Nurb *nu); /* nurb checks if they can be drawn, also clamp order func */ -int check_valid_nurb_u(struct Nurb *nu); -int check_valid_nurb_v(struct Nurb *nu); +int BKE_nurb_check_valid_u(struct Nurb *nu); +int BKE_nurb_check_valid_v(struct Nurb *nu); -int clamp_nurb_order_u(struct Nurb *nu); -int clamp_nurb_order_v(struct Nurb *nu); +int BKE_nurb_order_clamp_u(struct Nurb *nu); +int BKE_nurb_order_clamp_v(struct Nurb *nu); -ListBase *BKE_curve_nurbs(struct Curve *cu); +void BKE_nurb_direction_switch(struct Nurb *nu); -int minmax_curve(struct Curve *cu, float min[3], float max[3]); -int curve_center_median(struct Curve *cu, float cent[3]); -int curve_center_bounds(struct Curve *cu, float cent[3]); -void curve_translate(struct Curve *cu, float offset[3], int do_keys); -void curve_delete_material_index(struct Curve *cu, int index); -#endif +void BKE_nurb_points_add(struct Nurb *nu, int number); +void BKE_nurb_bezierPoints_add(struct Nurb *nu, int number); + +void BKE_nurb_handle_calc(struct BezTriple *bezt, struct BezTriple *prev, struct BezTriple *next, int mode); +void BKE_nurb_handles_calc(struct Nurb *nu); +void BKE_nurb_handles_autocalc(struct Nurb *nu, int flag); +void BKE_nurb_handles_test(struct Nurb *nu); + +#endif diff --git a/source/blender/blenkernel/BKE_mball.h b/source/blender/blenkernel/BKE_mball.h index fafd2a3d30e..018ee7f6c94 100644 --- a/source/blender/blenkernel/BKE_mball.h +++ b/source/blender/blenkernel/BKE_mball.h @@ -37,147 +37,30 @@ struct Object; struct Scene; struct MetaElem; -typedef struct point { /* a three-dimensional point */ - float x, y, z; /* its coordinates */ -} MB_POINT; +void BKE_metaball_unlink(struct MetaBall *mb); +void BKE_metaball_free(struct MetaBall *mb); +struct MetaBall *BKE_metaball_add(const char *name); +struct MetaBall *BKE_metaball_copy(struct MetaBall *mb); -typedef struct vertex { /* surface vertex */ - MB_POINT position, normal; /* position and surface normal */ -} VERTEX; +void BKE_metaball_make_local(struct MetaBall *mb); -typedef struct vertices { /* list of vertices in polygonization */ - int count, max; /* # vertices, max # allowed */ - VERTEX *ptr; /* dynamically allocated */ -} VERTICES; +void BKE_metaball_cubeTable_free(void); -typedef struct corner { /* corner of a cube */ - int i, j, k; /* (i, j, k) is index within lattice */ - float x, y, z, value; /* location and function value */ - struct corner *next; -} CORNER; +void BKE_metaball_polygonize(struct Scene *scene, struct Object *ob, struct ListBase *dispbase); +int BKE_metaball_is_basis_for(struct Object *ob1, struct Object *ob2); +int BKE_metaball_is_basis(struct Object *ob); +struct Object *BKE_metaball_basis_find(struct Scene *scene, struct Object *ob); -typedef struct cube { /* partitioning cell (cube) */ - int i, j, k; /* lattice location of cube */ - CORNER *corners[8]; /* eight corners */ -} CUBE; +void BKE_metaball_tex_space_calc(struct Object *ob); +float *BKE_metaball_make_orco(struct Object *ob, struct ListBase *dispbase); -typedef struct cubes { /* linked list of cubes acting as stack */ - CUBE cube; /* a single cube */ - struct cubes *next; /* remaining elements */ -} CUBES; - -typedef struct centerlist { /* list of cube locations */ - int i, j, k; /* cube location */ - struct centerlist *next; /* remaining elements */ -} CENTERLIST; - -typedef struct edgelist { /* list of edges */ - int i1, j1, k1, i2, j2, k2; /* edge corner ids */ - int vid; /* vertex id */ - struct edgelist *next; /* remaining elements */ -} EDGELIST; - -typedef struct intlist { /* list of integers */ - int i; /* an integer */ - struct intlist *next; /* remaining elements */ -} INTLIST; - -typedef struct intlists { /* list of list of integers */ - INTLIST *list; /* a list of integers */ - struct intlists *next; /* remaining elements */ -} INTLISTS; - -typedef struct process { /* parameters, function, storage */ - /* what happens here? floats, I think. */ - /* float (*function)(void); */ /* implicit surface function */ - float (*function)(float, float, float); - float size, delta; /* cube size, normal delta */ - int bounds; /* cube range within lattice */ - CUBES *cubes; /* active cubes */ - VERTICES vertices; /* surface vertices */ - CENTERLIST **centers; /* cube center hash table */ - CORNER **corners; /* corner value hash table */ - EDGELIST **edges; /* edge and vertex id hash table */ -} PROCESS; - -/* dividing scene using octal tree makes polygonisation faster */ -typedef struct ml_pointer { - struct ml_pointer *next, *prev; - struct MetaElem *ml; -} ml_pointer; - -typedef struct octal_node { - struct octal_node *nodes[8]; /* children of current node */ - struct octal_node *parent; /* parent of current node */ - struct ListBase elems; /* ListBase of MetaElem pointers (ml_pointer) */ - float x_min, y_min, z_min; /* 1st border point */ - float x_max, y_max, z_max; /* 7th border point */ - float x,y,z; /* center of node */ - int pos, neg; /* number of positive and negative MetaElements in the node */ - int count; /* number of MetaElems, which belongs to the node */ -} octal_node; - -typedef struct octal_tree { - struct octal_node *first; /* first node */ - int pos, neg; /* number of positive and negative MetaElements in the scene */ - short depth; /* number of scene subdivision */ -} octal_tree; - -struct pgn_elements { - struct pgn_elements *next, *prev; - char *data; -}; - -octal_node* find_metaball_octal_node(octal_node *node, float x, float y, float z, short depth); - -void freepolygonize(PROCESS *p); -void docube(CUBE *cube, PROCESS *p, struct MetaBall *mb); -void testface(int i, int j, int k, CUBE* old, int bit, int c1, int c2, int c3, int c4, PROCESS *p); -CORNER *setcorner (PROCESS* p, int i, int j, int k); -int vertid (CORNER *c1, CORNER *c2, PROCESS *p, struct MetaBall *mb); -int setcenter(CENTERLIST *table[], int i, int j, int k); -int otherface (int edge, int face); -void makecubetable (void); -void setedge (EDGELIST *table[], int i1, int j1, int k1, int i2, int j2, int k2, int vid); -int getedge (EDGELIST *table[], int i1, int j1, int k1, int i2, int j2, int k2); -void addtovertices (VERTICES *vertices, VERTEX v); -void vnormal (MB_POINT *point, PROCESS *p, MB_POINT *v); -void converge (MB_POINT *p1, MB_POINT *p2, float v1, float v2, float (*function)(float, float, float), MB_POINT *p, struct MetaBall *mb, int f); -void add_cube(PROCESS *mbproc, int i, int j, int k, int count); -void find_first_points(PROCESS *mbproc, struct MetaBall *mb, int a); - -void fill_metaball_octal_node(octal_node *node, struct MetaElem *ml, short i); -void subdivide_metaball_octal_node(octal_node *node, float size_x, float size_y, float size_z, short depth); -void free_metaball_octal_node(octal_node *node); -void init_metaball_octal_tree(int depth); -void polygonize(PROCESS *mbproc, struct MetaBall *mb); -float init_meta(struct Scene *scene, struct Object *ob); - -void unlink_mball(struct MetaBall *mb); -void free_mball(struct MetaBall *mb); -struct MetaBall *add_mball(const char *name); -struct MetaBall *copy_mball(struct MetaBall *mb); -void make_local_mball(struct MetaBall *mb); -struct MetaElem *add_metaball_element(struct MetaBall *mb, const int type); -void tex_space_mball(struct Object *ob); -float *make_orco_mball(struct Object *ob, struct ListBase *dispbase); -void copy_mball_properties(struct Scene *scene, struct Object *active_object); -struct Object *find_basis_mball(struct Scene *scene, struct Object *ob); -int is_basis_mball(struct Object *ob); -int is_mball_basis_for(struct Object *ob1, struct Object *ob2); -void metaball_polygonize(struct Scene *scene, struct Object *ob, struct ListBase *dispbase); -void calc_mballco(struct MetaElem *ml, float vec[3]); -float densfunc(struct MetaElem *ball, float x, float y, float z); -float metaball(float x, float y, float z); -void accum_mballfaces(int i1, int i2, int i3, int i4); -void *new_pgn_element(int size); -int nextcwedge (int edge, int face); -void BKE_freecubetable(void); +void BKE_metaball_properties_copy(struct Scene *scene, struct Object *active_object); int BKE_metaball_minmax(struct MetaBall *mb, float min[3], float max[3]); int BKE_metaball_center_median(struct MetaBall *mb, float cent[3]); int BKE_metaball_center_bounds(struct MetaBall *mb, float cent[3]); void BKE_metaball_translate(struct MetaBall *mb, float offset[3]); -#endif +struct MetaElem *BKE_metaball_element_add(struct MetaBall *mb, const int type); +#endif diff --git a/source/blender/blenkernel/BKE_movieclip.h b/source/blender/blenkernel/BKE_movieclip.h index d7b2f271a83..29924542494 100644 --- a/source/blender/blenkernel/BKE_movieclip.h +++ b/source/blender/blenkernel/BKE_movieclip.h @@ -40,10 +40,10 @@ struct MovieClipUser; struct MovieTrackingTrack; struct MovieDistortion; -void free_movieclip(struct MovieClip *clip); -void unlink_movieclip(struct Main *bmain, struct MovieClip *clip); +void BKE_movieclip_free(struct MovieClip *clip); +void BKE_movieclip_unlink(struct Main *bmain, struct MovieClip *clip); -struct MovieClip *BKE_add_movieclip_file(const char *name); +struct MovieClip *BKE_movieclip_file_add(const char *name); void BKE_movieclip_reload(struct MovieClip *clip); struct ImBuf *BKE_movieclip_get_ibuf(struct MovieClip *clip, struct MovieClipUser *user); diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 05171a5d9f5..38c73ba72b9 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -482,7 +482,7 @@ void calc_curvepath(Object *ob) if (ob==NULL || ob->type != OB_CURVE) return; cu= ob->data; - nurbs= BKE_curve_nurbs(cu); + nurbs= BKE_curve_nurbs_get(cu); nu= nurbs->first; if (cu->path) free_path(cu->path); diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 931aa2d6242..d1d6833e903 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -566,13 +566,13 @@ Mat4 *b_bone_spline_setup(bPoseChannel *pchan, int rest) if (bone->segments > MAX_BBONE_SUBDIV) bone->segments = MAX_BBONE_SUBDIV; - forward_diff_bezier(0.0, h1[0], h2[0], 0.0, data[0], + BKE_curve_forward_diff_bezier(0.0, h1[0], h2[0], 0.0, data[0], MAX_BBONE_SUBDIV, 4*sizeof(float)); - forward_diff_bezier(0.0, h1[1], length + h2[1], length, data[0]+1, + BKE_curve_forward_diff_bezier(0.0, h1[1], length + h2[1], length, data[0]+1, MAX_BBONE_SUBDIV, 4*sizeof(float)); - forward_diff_bezier(0.0, h1[2], h2[2], 0.0, data[0]+2, + BKE_curve_forward_diff_bezier(0.0, h1[2], h2[2], 0.0, data[0]+2, MAX_BBONE_SUBDIV, 4*sizeof(float)); - forward_diff_bezier(roll1, roll1 + 0.390464f*(roll2-roll1), roll2 - 0.390464f*(roll2-roll1), roll2, data[0]+3, + BKE_curve_forward_diff_bezier(roll1, roll1 + 0.390464f*(roll2-roll1), roll2 - 0.390464f*(roll2-roll1), roll2, data[0]+3, MAX_BBONE_SUBDIV, 4*sizeof(float)); equalize_bezier(data[0], bone->segments); /* note: does stride 4! */ diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 2d5631509b4..6dc1b2a4b00 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -499,8 +499,8 @@ static void curvemap_make_table(CurveMap *cuma, rctf *clipr) for (a=0; a<cuma->totpoint-1; a++, fp += 2*CM_RESOL) { correct_bezpart(bezt[a].vec[1], bezt[a].vec[2], bezt[a+1].vec[0], bezt[a+1].vec[1]); - forward_diff_bezier(bezt[a].vec[1][0], bezt[a].vec[2][0], bezt[a+1].vec[0][0], bezt[a+1].vec[1][0], fp, CM_RESOL-1, 2*sizeof(float)); - forward_diff_bezier(bezt[a].vec[1][1], bezt[a].vec[2][1], bezt[a+1].vec[0][1], bezt[a+1].vec[1][1], fp+1, CM_RESOL-1, 2*sizeof(float)); + BKE_curve_forward_diff_bezier(bezt[a].vec[1][0], bezt[a].vec[2][0], bezt[a+1].vec[0][0], bezt[a+1].vec[1][0], fp, CM_RESOL-1, 2*sizeof(float)); + BKE_curve_forward_diff_bezier(bezt[a].vec[1][1], bezt[a].vec[2][1], bezt[a+1].vec[0][1], bezt[a+1].vec[1][1], fp+1, CM_RESOL-1, 2*sizeof(float)); } /* store first and last handle for extrapolation, unit length */ diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index e5b2e5f69c7..e0cadac586b 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -70,7 +70,7 @@ static int cu_isectLL(const float v1[3], const float v2[3], const float v3[3], c short cox, short coy, float *labda, float *mu, float vec[3]); -void unlink_curve(Curve *cu) +void BKE_curve_unlink(Curve *cu) { int a; @@ -95,7 +95,7 @@ void unlink_curve(Curve *cu) } /* frees editcurve entirely */ -void BKE_free_editfont(Curve *cu) +void BKE_curve_editfont_free(Curve *cu) { if (cu->editfont) { EditFont *ef= cu->editfont; @@ -112,7 +112,7 @@ void BKE_free_editfont(Curve *cu) } } -void free_curve_editNurb_keyIndex(EditNurb *editnurb) +void BKE_curve_editNurb_keyIndex_free(EditNurb *editnurb) { if (!editnurb->keyindex) { return; @@ -121,26 +121,26 @@ void free_curve_editNurb_keyIndex(EditNurb *editnurb) editnurb->keyindex= NULL; } -void free_curve_editNurb (Curve *cu) +void BKE_curve_editNurb_free (Curve *cu) { if (cu->editnurb) { - freeNurblist(&cu->editnurb->nurbs); - free_curve_editNurb_keyIndex(cu->editnurb); + BKE_nurbList_free(&cu->editnurb->nurbs); + BKE_curve_editNurb_keyIndex_free(cu->editnurb); MEM_freeN(cu->editnurb); cu->editnurb= NULL; } } /* don't free curve itself */ -void free_curve(Curve *cu) +void BKE_curve_free(Curve *cu) { - freeNurblist(&cu->nurb); + BKE_nurbList_free(&cu->nurb); BLI_freelistN(&cu->bev); freedisplist(&cu->disp); - BKE_free_editfont(cu); + BKE_curve_editfont_free(cu); - free_curve_editNurb(cu); - unlink_curve(cu); + BKE_curve_editNurb_free(cu); + BKE_curve_unlink(cu); BKE_free_animdata((ID *)cu); if (cu->mat) MEM_freeN(cu->mat); @@ -151,7 +151,7 @@ void free_curve(Curve *cu) if (cu->tb) MEM_freeN(cu->tb); } -Curve *add_curve(const char *name, int type) +Curve *BKE_curve_add(const char *name, int type) { Curve *cu; @@ -187,14 +187,14 @@ Curve *add_curve(const char *name, int type) return cu; } -Curve *copy_curve(Curve *cu) +Curve *BKE_curve_copy(Curve *cu) { Curve *cun; int a; cun= copy_libblock(&cu->id); cun->nurb.first= cun->nurb.last= NULL; - duplicateNurblist( &(cun->nurb), &(cu->nurb)); + BKE_nurbList_duplicate( &(cun->nurb), &(cu->nurb)); cun->mat= MEM_dupallocN(cu->mat); for (a=0; a<cun->totcol; a++) { @@ -242,7 +242,7 @@ static void extern_local_curve(Curve *cu) } } -void make_local_curve(Curve *cu) +void BKE_curve_make_local(Curve *cu) { Main *bmain= G.main; Object *ob; @@ -273,7 +273,7 @@ void make_local_curve(Curve *cu) extern_local_curve(cu); } else if (is_local && is_lib) { - Curve *cu_new= copy_curve(cu); + Curve *cu_new= BKE_curve_copy(cu); cu_new->id.us= 0; BKE_id_lib_local_paths(bmain, cu->id.lib, &cu_new->id); @@ -291,7 +291,7 @@ void make_local_curve(Curve *cu) } /* Get list of nurbs from editnurbs structure */ -ListBase *curve_editnurbs(Curve *cu) +ListBase *BKE_curve_editNurbs_get(Curve *cu) { if (cu->editnurb) { return &cu->editnurb->nurbs; @@ -300,7 +300,7 @@ ListBase *curve_editnurbs(Curve *cu) return NULL; } -short curve_type(Curve *cu) +short BKE_curve_type_get(Curve *cu) { Nurb *nu; int type= cu->type; @@ -322,9 +322,9 @@ short curve_type(Curve *cu) return type; } -void update_curve_dimension(Curve *cu) +void BKE_curve_curve_dimension_update(Curve *cu) { - ListBase *nurbs= BKE_curve_nurbs(cu); + ListBase *nurbs= BKE_curve_nurbs_get(cu); Nurb *nu= nurbs->first; if (cu->flag&CU_3D) { @@ -335,24 +335,24 @@ void update_curve_dimension(Curve *cu) else { for ( ; nu; nu= nu->next) { nu->flag |= CU_2D; - test2DNurb(nu); + BKE_nurb_test2D(nu); /* since the handles are moved they need to be auto-located again */ if (nu->type == CU_BEZIER) - calchandlesNurb(nu); + BKE_nurb_handles_calc(nu); } } } -void test_curve_type(Object *ob) +void BKE_curve_type_test(Object *ob) { - ob->type= curve_type(ob->data); + ob->type= BKE_curve_type_get(ob->data); if (ob->type==OB_CURVE) - update_curve_dimension((Curve *)ob->data); + BKE_curve_curve_dimension_update((Curve *)ob->data); } -void tex_space_curve(Curve *cu) +void BKE_curve_tex_space_calc(Curve *cu) { DispList *dl; BoundBox *bb; @@ -408,7 +408,7 @@ void tex_space_curve(Curve *cu) } } -int count_curveverts(ListBase *nurb) +int BKE_nurbList_verts_count(ListBase *nurb) { Nurb *nu; int tot=0; @@ -423,7 +423,7 @@ int count_curveverts(ListBase *nurb) return tot; } -int count_curveverts_without_handles(ListBase *nurb) +int BKE_nurbList_verts_count_without_handles(ListBase *nurb) { Nurb *nu; int tot=0; @@ -440,7 +440,7 @@ int count_curveverts_without_handles(ListBase *nurb) /* **************** NURBS ROUTINES ******************** */ -void freeNurb(Nurb *nu) +void BKE_nurb_free(Nurb *nu) { if (nu==NULL) return; @@ -460,7 +460,7 @@ void freeNurb(Nurb *nu) } -void freeNurblist(ListBase *lb) +void BKE_nurbList_free(ListBase *lb) { Nurb *nu, *next; @@ -469,13 +469,13 @@ void freeNurblist(ListBase *lb) nu= lb->first; while (nu) { next= nu->next; - freeNurb(nu); + BKE_nurb_free(nu); nu= next; } lb->first= lb->last= NULL; } -Nurb *duplicateNurb(Nurb *nu) +Nurb *BKE_nurb_duplicate(Nurb *nu) { Nurb *newnu; int len; @@ -515,22 +515,22 @@ Nurb *duplicateNurb(Nurb *nu) return newnu; } -void duplicateNurblist(ListBase *lb1, ListBase *lb2) +void BKE_nurbList_duplicate(ListBase *lb1, ListBase *lb2) { Nurb *nu, *nun; - freeNurblist(lb1); + BKE_nurbList_free(lb1); nu= lb2->first; while (nu) { - nun= duplicateNurb(nu); + nun= BKE_nurb_duplicate(nu); BLI_addtail(lb1, nun); nu= nu->next; } } -void test2DNurb(Nurb *nu) +void BKE_nurb_test2D(Nurb *nu) { BezTriple *bezt; BPoint *bp; @@ -559,7 +559,7 @@ void test2DNurb(Nurb *nu) } } -void minmaxNurb(Nurb *nu, float *min, float *max) +void BKE_nurb_minmax(Nurb *nu, float *min, float *max) { BezTriple *bezt; BPoint *bp; @@ -586,7 +586,7 @@ void minmaxNurb(Nurb *nu, float *min, float *max) } /* be sure to call makeknots after this */ -void addNurbPoints(Nurb *nu, int number) +void BKE_nurb_points_add(Nurb *nu, int number) { BPoint *tmp= nu->bp; int i; @@ -606,7 +606,7 @@ void addNurbPoints(Nurb *nu, int number) nu->pntsu += number; } -void addNurbPointsBezier(Nurb *nu, int number) +void BKE_nurb_bezierPoints_add(Nurb *nu, int number) { BezTriple *tmp= nu->bezt; int i; @@ -706,7 +706,7 @@ static void makeknots(Nurb *nu, short uv) if (nu->type == CU_NURBS) { if (uv == 1) { if (nu->knotsu) MEM_freeN(nu->knotsu); - if (check_valid_nurb_u(nu)) { + if (BKE_nurb_check_valid_u(nu)) { nu->knotsu= MEM_callocN(4+sizeof(float)*KNOTSU(nu), "makeknots"); if (nu->flagu & CU_NURB_CYCLIC) { calcknots(nu->knotsu, nu->pntsu, nu->orderu, 0); /* cyclic should be uniform */ @@ -721,7 +721,7 @@ static void makeknots(Nurb *nu, short uv) } else if (uv == 2) { if (nu->knotsv) MEM_freeN(nu->knotsv); - if (check_valid_nurb_v(nu)) { + if (BKE_nurb_check_valid_v(nu)) { nu->knotsv= MEM_callocN(4+sizeof(float)*KNOTSV(nu), "makeknots"); if (nu->flagv & CU_NURB_CYCLIC) { calcknots(nu->knotsv, nu->pntsv, nu->orderv, 0); /* cyclic should be uniform */ @@ -736,12 +736,12 @@ static void makeknots(Nurb *nu, short uv) } } -void nurbs_knot_calc_u(Nurb *nu) +void BKE_nurb_knot_calc_u(Nurb *nu) { makeknots(nu, 1); } -void nurbs_knot_calc_v(Nurb *nu) +void BKE_nurb_knot_calc_v(Nurb *nu) { makeknots(nu, 2); } @@ -809,7 +809,7 @@ static void basisNurb(float t, short order, short pnts, float *knots, float *bas } -void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride, int resolu, int resolv) +void BKE_nurb_makeFaces(Nurb *nu, float *coord_array, int rowstride, int resolu, int resolv) /* coord_array has to be 3*4*resolu*resolv in size, and zero-ed */ { BPoint *bp; @@ -972,7 +972,7 @@ void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride, int resolu, int MEM_freeN(jend); } -void makeNurbcurve(Nurb *nu, float *coord_array, float *tilt_array, float *radius_array, float *weight_array, int resolu, int stride) +void BKE_nurb_makeCurve(Nurb *nu, float *coord_array, float *tilt_array, float *radius_array, float *weight_array, int resolu, int stride) /* coord_array has to be 3*4*pntsu*resolu in size and zero-ed * tilt_array and radius_array will be written to if valid */ { @@ -1074,7 +1074,7 @@ void makeNurbcurve(Nurb *nu, float *coord_array, float *tilt_array, float *radiu } /* forward differencing method for bezier curve */ -void forward_diff_bezier(float q0, float q1, float q2, float q3, float *p, int it, int stride) +void BKE_curve_forward_diff_bezier(float q0, float q1, float q2, float q3, float *p, int it, int stride) { float rt0,rt1,rt2,rt3,f; int a; @@ -1122,7 +1122,7 @@ static void forward_diff_bezier_cotangent(float *p0, float *p1, float *p2, float /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ -float *make_orco_surf(Object *ob) +float *BKE_curve_surf_make_orco(Object *ob) { /* Note: this function is used in convertblender only atm, so * suppose nonzero curve's render resolution should always be used */ @@ -1190,7 +1190,7 @@ float *make_orco_surf(Object *ob) float *_tdata= MEM_callocN((nu->pntsu*resolu) * (nu->pntsv*resolv) *3*sizeof(float), "temp data"); float *tdata= _tdata; - makeNurbfaces(nu, tdata, 0, resolu, resolv); + BKE_nurb_makeFaces(nu, tdata, 0, resolu, resolv); for (b=0; b<sizeu; b++) { int use_b= b; @@ -1224,7 +1224,7 @@ float *make_orco_surf(Object *ob) /* NOTE: This routine is tied to the order of vertex * built by displist and as passed to the renderer. */ -float *make_orco_curve(Scene *scene, Object *ob) +float *BKE_curve_make_orco(Scene *scene, Object *ob) { Curve *cu = ob->data; DispList *dl; @@ -1312,7 +1312,7 @@ float *make_orco_curve(Scene *scene, Object *ob) /* ***************** BEVEL ****************** */ -void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender) +void BKE_curve_bevel_make(Scene *scene, Object *ob, ListBase *disp, int forRender) { DispList *dl, *dlnew; Curve *bevcu, *cu; @@ -2083,7 +2083,7 @@ static void make_bevel_list_segment_3D(BevList *bl) -void makeBevelList(Object *ob) +void BKE_curve_bevelList_make(Object *ob) { /* * - convert all curves to polys, with indication of resol and flags for double-vertices @@ -2112,7 +2112,7 @@ void makeBevelList(Object *ob) BLI_freelistN(&(cu->bev)); if (cu->editnurb && ob->type!=OB_FONT) { - ListBase *nurbs= curve_editnurbs(cu); + ListBase *nurbs= BKE_curve_editNurbs_get(cu); nu = nurbs->first; } else { @@ -2128,7 +2128,7 @@ void makeBevelList(Object *ob) /* check we are a single point? also check we are not a surface and that the orderu is sane, * enforced in the UI but can go wrong possibly */ - if (!check_valid_nurb_u(nu)) { + if (!BKE_nurb_check_valid_u(nu)) { bl= MEM_callocN(sizeof(BevList)+1*sizeof(BevPoint), "makeBevelList1"); BLI_addtail(&(cu->bev), bl); bl->nr= 0; @@ -2201,7 +2201,7 @@ void makeBevelList(Object *ob) /* BevPoint must stay aligned to 4 so sizeof(BevPoint)/sizeof(float) works */ for (j=0; j<3; j++) { - forward_diff_bezier( prevbezt->vec[1][j], prevbezt->vec[2][j], + BKE_curve_forward_diff_bezier( prevbezt->vec[1][j], prevbezt->vec[2][j], bezt->vec[0][j], bezt->vec[1][j], &(bevp->vec[j]), resolu, sizeof(BevPoint)); } @@ -2256,7 +2256,7 @@ void makeBevelList(Object *ob) else bl->poly= -1; bevp= (BevPoint *)(bl+1); - makeNurbcurve( nu, &bevp->vec[0], + BKE_nurb_makeCurve( nu, &bevp->vec[0], do_tilt ? &bevp->alfa : NULL, do_radius ? &bevp->radius : NULL, do_weight ? &bevp->weight : NULL, @@ -2719,18 +2719,18 @@ static void calchandlesNurb_intern(Nurb *nu, int skip_align) } } -void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode) +void BKE_nurb_handle_calc(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode) { calchandleNurb_intern(bezt, prev, next, mode, FALSE); } -void calchandlesNurb(Nurb *nu) /* first, if needed, set handle flags */ +void BKE_nurb_handles_calc(Nurb *nu) /* first, if needed, set handle flags */ { calchandlesNurb_intern(nu, FALSE); } -void testhandlesNurb(Nurb *nu) +void BKE_nurb_handles_test(Nurb *nu) { /* use when something has changed with handles. * it treats all BezTriples with the following rules: @@ -2770,10 +2770,10 @@ void testhandlesNurb(Nurb *nu) bezt++; } - calchandlesNurb(nu); + BKE_nurb_handles_calc(nu); } -void autocalchandlesNurb(Nurb *nu, int flag) +void BKE_nurb_handles_autocalc(Nurb *nu, int flag) { /* checks handle coordinates and calculates type */ @@ -2841,21 +2841,21 @@ void autocalchandlesNurb(Nurb *nu, int flag) bezt2++; } - calchandlesNurb(nu); + BKE_nurb_handles_calc(nu); } -void autocalchandlesNurb_all(ListBase *editnurb, int flag) +void BKE_nurbList_handles_autocalc(ListBase *editnurb, int flag) { Nurb *nu; nu= editnurb->first; while (nu) { - autocalchandlesNurb(nu, flag); + BKE_nurb_handles_autocalc(nu, flag); nu= nu->next; } } -void sethandlesNurb(ListBase *editnurb, short code) +void BKE_nurbList_handles_set(ListBase *editnurb, short code) { /* code==1: set autohandle */ /* code==2: set vectorhandle */ @@ -2884,7 +2884,7 @@ void sethandlesNurb(ListBase *editnurb, short code) } bezt++; } - calchandlesNurb(nu); + BKE_nurb_handles_calc(nu); } nu= nu->next; } @@ -2928,7 +2928,7 @@ void sethandlesNurb(ListBase *editnurb, short code) bezt++; } - calchandlesNurb(nu); + BKE_nurb_handles_calc(nu); } nu= nu->next; } @@ -2958,7 +2958,7 @@ static void swapdata(void *adr1, void *adr2, int len) } } -void switchdirectionNurb(Nurb *nu) +void BKE_nurb_direction_switch(Nurb *nu) { BezTriple *bezt1, *bezt2; BPoint *bp1, *bp2; @@ -3064,9 +3064,9 @@ void switchdirectionNurb(Nurb *nu) } -float (*curve_getVertexCos(Curve *UNUSED(cu), ListBase *lb, int *numVerts_r))[3] +float (*BKE_curve_vertexCos_get(Curve *UNUSED(cu), ListBase *lb, int *numVerts_r))[3] { - int i, numVerts = *numVerts_r = count_curveverts(lb); + int i, numVerts = *numVerts_r = BKE_nurbList_verts_count(lb); float *co, (*cos)[3] = MEM_mallocN(sizeof(*cos)*numVerts, "cu_vcos"); Nurb *nu; @@ -3093,7 +3093,7 @@ float (*curve_getVertexCos(Curve *UNUSED(cu), ListBase *lb, int *numVerts_r))[3] return cos; } -void curve_applyVertexCos(Curve *UNUSED(cu), ListBase *lb, float (*vertexCos)[3]) +void BK_curve_vertexCos_apply(Curve *UNUSED(cu), ListBase *lb, float (*vertexCos)[3]) { float *co = vertexCos[0]; Nurb *nu; @@ -3121,9 +3121,9 @@ void curve_applyVertexCos(Curve *UNUSED(cu), ListBase *lb, float (*vertexCos)[3] } } -float (*curve_getKeyVertexCos(Curve *UNUSED(cu), ListBase *lb, float *key))[3] +float (*BKE_curve_keyVertexCos_get(Curve *UNUSED(cu), ListBase *lb, float *key))[3] { - int i, numVerts = count_curveverts(lb); + int i, numVerts = BKE_nurbList_verts_count(lb); float *co, (*cos)[3] = MEM_mallocN(sizeof(*cos)*numVerts, "cu_vcos"); Nurb *nu; @@ -3152,7 +3152,7 @@ float (*curve_getKeyVertexCos(Curve *UNUSED(cu), ListBase *lb, float *key))[3] return cos; } -void curve_applyKeyVertexTilts(Curve *UNUSED(cu), ListBase *lb, float *key) +void BKE_curve_keyVertexTilts_apply(Curve *UNUSED(cu), ListBase *lb, float *key) { Nurb *nu; int i; @@ -3179,7 +3179,7 @@ void curve_applyKeyVertexTilts(Curve *UNUSED(cu), ListBase *lb, float *key) } } -int check_valid_nurb_u( struct Nurb *nu ) +int BKE_nurb_check_valid_u( struct Nurb *nu ) { if (nu==NULL) return 0; if (nu->pntsu <= 1) return 0; @@ -3194,7 +3194,7 @@ int check_valid_nurb_u( struct Nurb *nu ) } return 1; } -int check_valid_nurb_v( struct Nurb *nu) +int BKE_nurb_check_valid_v( struct Nurb *nu) { if (nu==NULL) return 0; if (nu->pntsv <= 1) return 0; @@ -3210,7 +3210,7 @@ int check_valid_nurb_v( struct Nurb *nu) return 1; } -int clamp_nurb_order_u( struct Nurb *nu ) +int BKE_nurb_order_clamp_u( struct Nurb *nu ) { int change = 0; if (nu->pntsu<nu->orderu) { @@ -3224,7 +3224,7 @@ int clamp_nurb_order_u( struct Nurb *nu ) return change; } -int clamp_nurb_order_v( struct Nurb *nu) +int BKE_nurb_order_clamp_v( struct Nurb *nu) { int change = 0; if (nu->pntsv<nu->orderv) { @@ -3239,10 +3239,10 @@ int clamp_nurb_order_v( struct Nurb *nu) } /* Get edit nurbs or normal nurbs list */ -ListBase *BKE_curve_nurbs(Curve *cu) +ListBase *BKE_curve_nurbs_get(Curve *cu) { if (cu->editnurb) { - return curve_editnurbs(cu); + return BKE_curve_editNurbs_get(cu); } return &cu->nurb; @@ -3250,20 +3250,20 @@ ListBase *BKE_curve_nurbs(Curve *cu) /* basic vertex data functions */ -int minmax_curve(Curve *cu, float min[3], float max[3]) +int BKE_curve_minmax(Curve *cu, float min[3], float max[3]) { - ListBase *nurb_lb= BKE_curve_nurbs(cu); + ListBase *nurb_lb= BKE_curve_nurbs_get(cu); Nurb *nu; for (nu= nurb_lb->first; nu; nu= nu->next) - minmaxNurb(nu, min, max); + BKE_nurb_minmax(nu, min, max); return (nurb_lb->first != NULL); } -int curve_center_median(Curve *cu, float cent[3]) +int BKE_curve_center_median(Curve *cu, float cent[3]) { - ListBase *nurb_lb= BKE_curve_nurbs(cu); + ListBase *nurb_lb= BKE_curve_nurbs_get(cu); Nurb *nu; int total= 0; @@ -3297,11 +3297,11 @@ int curve_center_median(Curve *cu, float cent[3]) return (total != 0); } -int curve_center_bounds(Curve *cu, float cent[3]) +int BKE_curve_center_bounds(Curve *cu, float cent[3]) { float min[3], max[3]; INIT_MINMAX(min, max); - if (minmax_curve(cu, min, max)) { + if (BKE_curve_minmax(cu, min, max)) { mid_v3_v3v3(cent, min, max); return 1; } @@ -3309,9 +3309,9 @@ int curve_center_bounds(Curve *cu, float cent[3]) return 0; } -void curve_translate(Curve *cu, float offset[3], int do_keys) +void BKE_curve_translate(Curve *cu, float offset[3], int do_keys) { - ListBase *nurb_lb= BKE_curve_nurbs(cu); + ListBase *nurb_lb= BKE_curve_nurbs_get(cu); Nurb *nu; int i; @@ -3346,9 +3346,9 @@ void curve_translate(Curve *cu, float offset[3], int do_keys) } } -void curve_delete_material_index(Curve *cu, int index) +void BKE_curve_delete_material_index(Curve *cu, int index) { - const int curvetype= curve_type(cu); + const int curvetype= BKE_curve_type_get(cu); if (curvetype == OB_FONT) { struct CharInfo *info= cu->strinfo; diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 246c973169e..045d85242f1 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -539,7 +539,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O break; case OB_MBALL: { - Object *mom= find_basis_mball(scene, ob); + Object *mom= BKE_metaball_basis_find(scene, ob); if (mom!=ob) { node2 = dag_get_node(dag, mom); diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index fcd80698d5c..3d79386e19a 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -1,4 +1,5 @@ /* + * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -296,7 +297,7 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase, i else resolu= nu->resolu; - if (!check_valid_nurb_u(nu)); + if (!BKE_nurb_check_valid_u(nu)); else if (nu->type == CU_BEZIER) { /* count */ @@ -351,7 +352,7 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase, i else { int j; for (j=0; j<3; j++) { - forward_diff_bezier( prevbezt->vec[1][j], + BKE_curve_forward_diff_bezier( prevbezt->vec[1][j], prevbezt->vec[2][j], bezt->vec[0][j], bezt->vec[1][j], @@ -384,7 +385,7 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase, i data= dl->verts; if (nu->flagu & CU_NURB_CYCLIC) dl->type= DL_POLY; else dl->type= DL_SEGM; - makeNurbcurve(nu, data, NULL, NULL, NULL, resolu, 3*sizeof(float)); + BKE_nurb_makeCurve(nu, data, NULL, NULL, NULL, resolu, 3*sizeof(float)); } else if (nu->type == CU_POLY) { len= nu->pntsu; @@ -672,9 +673,9 @@ void makeDispListMBall(Scene *scene, Object *ob) freedisplist(&(ob->disp)); if (ob->type==OB_MBALL) { - if (ob==find_basis_mball(scene, ob)) { - metaball_polygonize(scene, ob, &ob->disp); - tex_space_mball(ob); + if (ob==BKE_metaball_basis_find(scene, ob)) { + BKE_metaball_polygonize(scene, ob, &ob->disp); + BKE_metaball_tex_space_calc(ob); object_deform_mball(ob, &ob->disp); } @@ -685,8 +686,8 @@ void makeDispListMBall(Scene *scene, Object *ob) void makeDispListMBall_forRender(Scene *scene, Object *ob, ListBase *dispbase) { - metaball_polygonize(scene, ob, dispbase); - tex_space_mball(ob); + BKE_metaball_polygonize(scene, ob, dispbase); + BKE_metaball_tex_space_calc(ob); object_deform_mball(ob, dispbase); } @@ -730,7 +731,7 @@ static void curve_calc_modifiers_pre(Scene *scene, Object *ob, int forRender, fl ModifierData *md = modifiers_getVirtualModifierList(ob); ModifierData *pretessellatePoint; Curve *cu= ob->data; - ListBase *nurb= BKE_curve_nurbs(cu); + ListBase *nurb= BKE_curve_nurbs_get(cu); int numVerts = 0; int editmode = (!forRender && cu->editnurb); float (*originalVerts)[3] = NULL; @@ -753,9 +754,9 @@ static void curve_calc_modifiers_pre(Scene *scene, Object *ob, int forRender, fl * tilts, which is passed through in the modifier stack. * this is also the reason curves do not use a virtual * shape key modifier yet. */ - deformedVerts= curve_getKeyVertexCos(cu, nurb, keyVerts); + deformedVerts= BKE_curve_keyVertexCos_get(cu, nurb, keyVerts); originalVerts= MEM_dupallocN(deformedVerts); - numVerts = count_curveverts_without_handles(nurb); + numVerts = BKE_nurbList_verts_count_without_handles(nurb); } } @@ -770,7 +771,7 @@ static void curve_calc_modifiers_pre(Scene *scene, Object *ob, int forRender, fl if (mti->type!=eModifierTypeType_OnlyDeform) continue; if (!deformedVerts) { - deformedVerts = curve_getVertexCos(cu, nurb, &numVerts); + deformedVerts = BKE_curve_vertexCos_get(cu, nurb, &numVerts); originalVerts = MEM_dupallocN(deformedVerts); } @@ -782,9 +783,9 @@ static void curve_calc_modifiers_pre(Scene *scene, Object *ob, int forRender, fl } if (deformedVerts) - curve_applyVertexCos(cu, nurb, deformedVerts); + BK_curve_vertexCos_apply(cu, nurb, deformedVerts); if (keyVerts) /* these are not passed through modifier stack */ - curve_applyKeyVertexTilts(cu, nurb, keyVerts); + BKE_curve_keyVertexTilts_apply(cu, nurb, keyVerts); if (keyVerts) MEM_freeN(keyVerts); @@ -834,7 +835,7 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba ModifierData *md = modifiers_getVirtualModifierList(ob); ModifierData *pretessellatePoint; Curve *cu= ob->data; - ListBase *nurb= BKE_curve_nurbs(cu); + ListBase *nurb= BKE_curve_nurbs_get(cu); int required_mode = 0, totvert = 0; int editmode = (!forRender && cu->editnurb); DerivedMesh *dm= NULL, *ndm; @@ -956,7 +957,7 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba } if (deformedVerts) { - curve_applyVertexCos(ob->data, nurb, originalVerts); + BK_curve_vertexCos_apply(ob->data, nurb, originalVerts); MEM_freeN(originalVerts); MEM_freeN(deformedVerts); } @@ -1023,7 +1024,7 @@ static void add_orco_dm(Scene *scene, Object *ob, DerivedMesh *dm, DerivedMesh * dm->getVertCos(dm, orco); } else { - orco= (float(*)[3])make_orco_curve(scene, ob); + orco= (float(*)[3])BKE_curve_make_orco(scene, ob); } for (a=0; a<totvert; a++) { @@ -1108,7 +1109,7 @@ void makeDispListSurf(Scene *scene, Object *ob, ListBase *dispbase, float (*deformedVerts)[3]; if (!forRender && cu->editnurb) - nubase= curve_editnurbs(cu); + nubase= BKE_curve_editNurbs_get(cu); else nubase= &cu->nurb; @@ -1144,7 +1145,7 @@ void makeDispListSurf(Scene *scene, Object *ob, ListBase *dispbase, if (nu->flagu & CU_NURB_CYCLIC) dl->type= DL_POLY; else dl->type= DL_SEGM; - makeNurbcurve(nu, data, NULL, NULL, NULL, resolu, 3*sizeof(float)); + BKE_nurb_makeCurve(nu, data, NULL, NULL, NULL, resolu, 3*sizeof(float)); } else { len= (nu->pntsu*resolu) * (nu->pntsv*resolv); @@ -1168,7 +1169,7 @@ void makeDispListSurf(Scene *scene, Object *ob, ListBase *dispbase, if (nu->flagv & CU_NURB_CYCLIC) dl->flag|= DL_CYCL_U; /* reverse too! */ if (nu->flagu & CU_NURB_CYCLIC) dl->flag|= DL_CYCL_V; - makeNurbfaces(nu, data, 0, resolu, resolv); + BKE_nurb_makeFaces(nu, data, 0, resolu, resolv); /* gl array drawing: using indices */ displist_surf_indices(dl); @@ -1182,7 +1183,7 @@ void makeDispListSurf(Scene *scene, Object *ob, ListBase *dispbase, copy_displist(&cu->disp, dispbase); if (!forRender) { - tex_space_curve(cu); + BKE_curve_tex_space_calc(cu); } if (!forOrco) @@ -1262,7 +1263,7 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba float (*deformedVerts)[3]; int numVerts; - nubase= BKE_curve_nurbs(cu); + nubase= BKE_curve_nurbs_get(cu); BLI_freelistN(&(cu->bev)); @@ -1273,10 +1274,10 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba if (!forOrco) curve_calc_modifiers_pre(scene, ob, forRender, &originalVerts, &deformedVerts, &numVerts); - makeBevelList(ob); + BKE_curve_bevelList_make(ob); /* If curve has no bevel will return nothing */ - makebevelcurve(scene, ob, &dlbev, forRender); + BKE_curve_bevel_make(scene, ob, &dlbev, forRender); /* no bevel or extrude, and no width correction? */ if (!dlbev.first && cu->width==1.0f) { @@ -1410,7 +1411,7 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba copy_displist(&cu->disp, dispbase); if (!forRender) { - tex_space_curve(cu); + BKE_curve_tex_space_calc(cu); } if (!forOrco) curve_calc_modifiers_post(scene, ob, dispbase, derivedFinal, forRender, originalVerts, deformedVerts); diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 806d795cc9d..e85432581d5 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -800,7 +800,7 @@ void calchandles_fcurve (FCurve *fcu) if (bezt->vec[2][0] < bezt->vec[1][0]) bezt->vec[2][0]= bezt->vec[1][0]; /* calculate auto-handles */ - calchandleNurb(bezt, prev, next, 1); /* 1==special autohandle */ + BKE_nurb_handle_calc(bezt, prev, next, 1); /* 1==special autohandle */ /* for automatic ease in and out */ if (ELEM(bezt->h1,HD_AUTO,HD_AUTO_ANIM) && ELEM(bezt->h2,HD_AUTO,HD_AUTO_ANIM)) { diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index cdc923600d7..5d7960a9823 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -1011,7 +1011,7 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m if (mode == FO_EDIT) { /* make nurbdata */ - freeNurblist(&cu->nurb); + BKE_nurbList_free(&cu->nurb); ct= chartransdata; if (cu->sepchar==0) { diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 0a1c0467244..54a2613991a 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -1594,7 +1594,7 @@ void curve_to_key(Curve *cu, KeyBlock *kb, ListBase *nurb) int a, tot; /* count */ - tot = count_curveverts(nurb); + tot = BKE_nurbList_verts_count(nurb); if (tot == 0) return; if (kb->data) MEM_freeN(kb->data); @@ -1647,7 +1647,7 @@ void key_to_curve(KeyBlock *kb, Curve *UNUSED(cu), ListBase *nurb) nu = nurb->first; fp = kb->data; - tot = count_curveverts(nurb); + tot = BKE_nurbList_verts_count(nurb); tot = MIN2(kb->totelem, tot); @@ -1742,7 +1742,7 @@ float (*key_to_vertcos(Object * ob, KeyBlock * kb))[3] } else if (ELEM(ob->type, OB_CURVE, OB_SURF)) { Curve *cu = (Curve *)ob->data; - tot = count_curveverts(&cu->nurb); + tot = BKE_nurbList_verts_count(&cu->nurb); } if (tot == 0) return NULL; @@ -1822,7 +1822,7 @@ void vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3]) else if (ELEM(ob->type, OB_CURVE, OB_SURF)) { Curve *cu = (Curve *)ob->data; elemsize = cu->key->elemsize; - tot = count_curveverts(&cu->nurb); + tot = BKE_nurbList_verts_count(&cu->nurb); } if (tot == 0) { diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 07839b10ef1..71266275fbd 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -198,12 +198,12 @@ int id_make_local(ID *id, int test) return 1; case ID_CU: if (!test) { - make_local_curve((Curve*)id); + BKE_curve_make_local((Curve*)id); make_local_key(((Curve*)id)->key); } return 1; case ID_MB: - if (!test) make_local_mball((MetaBall*)id); + if (!test) BKE_metaball_make_local((MetaBall*)id); return 1; case ID_MA: if (!test) make_local_material((Material*)id); @@ -291,10 +291,10 @@ int id_copy(ID *id, ID **newid, int test) if (!test) *newid= (ID*)copy_mesh((Mesh*)id); return 1; case ID_CU: - if (!test) *newid= (ID*)copy_curve((Curve*)id); + if (!test) *newid= (ID*)BKE_curve_copy((Curve*)id); return 1; case ID_MB: - if (!test) *newid= (ID*)copy_mball((MetaBall*)id); + if (!test) *newid= (ID*)BKE_metaball_copy((MetaBall*)id); return 1; case ID_MA: if (!test) *newid= (ID*)copy_material((Material*)id); @@ -810,10 +810,10 @@ void free_libblock(ListBase *lb, void *idv) free_mesh((Mesh *)id, 1); break; case ID_CU: - free_curve((Curve *)id); + BKE_curve_free((Curve *)id); break; case ID_MB: - free_mball((MetaBall *)id); + BKE_metaball_free((MetaBall *)id); break; case ID_MA: free_material((Material *)id); @@ -886,7 +886,7 @@ void free_libblock(ListBase *lb, void *idv) free_gpencil_data((bGPdata *)id); break; case ID_MC: - free_movieclip((MovieClip *)id); + BKE_movieclip_free((MovieClip *)id); break; } diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 21a91b34e8d..2dfd41f299a 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -530,7 +530,7 @@ static void data_delete_material_index_id(ID *id, short index) mesh_delete_material_index((Mesh *)id, index); break; case ID_CU: - curve_delete_material_index((Curve *)id, index); + BKE_curve_delete_material_index((Curve *)id, index); break; case ID_MB: /* meta-elems don't have materials atm */ diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index 60ccfa2a7cb..73e3576b57f 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -65,6 +65,106 @@ #include "BKE_object.h" #include "BKE_material.h" +/* Data types */ + +typedef struct point { /* a three-dimensional point */ + float x, y, z; /* its coordinates */ +} MB_POINT; + +typedef struct vertex { /* surface vertex */ + MB_POINT position, normal; /* position and surface normal */ +} VERTEX; + +typedef struct vertices { /* list of vertices in polygonization */ + int count, max; /* # vertices, max # allowed */ + VERTEX *ptr; /* dynamically allocated */ +} VERTICES; + +typedef struct corner { /* corner of a cube */ + int i, j, k; /* (i, j, k) is index within lattice */ + float x, y, z, value; /* location and function value */ + struct corner *next; +} CORNER; + +typedef struct cube { /* partitioning cell (cube) */ + int i, j, k; /* lattice location of cube */ + CORNER *corners[8]; /* eight corners */ +} CUBE; + +typedef struct cubes { /* linked list of cubes acting as stack */ + CUBE cube; /* a single cube */ + struct cubes *next; /* remaining elements */ +} CUBES; + +typedef struct centerlist { /* list of cube locations */ + int i, j, k; /* cube location */ + struct centerlist *next; /* remaining elements */ +} CENTERLIST; + +typedef struct edgelist { /* list of edges */ + int i1, j1, k1, i2, j2, k2; /* edge corner ids */ + int vid; /* vertex id */ + struct edgelist *next; /* remaining elements */ +} EDGELIST; + +typedef struct intlist { /* list of integers */ + int i; /* an integer */ + struct intlist *next; /* remaining elements */ +} INTLIST; + +typedef struct intlists { /* list of list of integers */ + INTLIST *list; /* a list of integers */ + struct intlists *next; /* remaining elements */ +} INTLISTS; + +typedef struct process { /* parameters, function, storage */ + /* what happens here? floats, I think. */ + /* float (*function)(void); */ /* implicit surface function */ + float (*function)(float, float, float); + float size, delta; /* cube size, normal delta */ + int bounds; /* cube range within lattice */ + CUBES *cubes; /* active cubes */ + VERTICES vertices; /* surface vertices */ + CENTERLIST **centers; /* cube center hash table */ + CORNER **corners; /* corner value hash table */ + EDGELIST **edges; /* edge and vertex id hash table */ +} PROCESS; + +/* dividing scene using octal tree makes polygonisation faster */ +typedef struct ml_pointer { + struct ml_pointer *next, *prev; + struct MetaElem *ml; +} ml_pointer; + +typedef struct octal_node { + struct octal_node *nodes[8]; /* children of current node */ + struct octal_node *parent; /* parent of current node */ + struct ListBase elems; /* ListBase of MetaElem pointers (ml_pointer) */ + float x_min, y_min, z_min; /* 1st border point */ + float x_max, y_max, z_max; /* 7th border point */ + float x,y,z; /* center of node */ + int pos, neg; /* number of positive and negative MetaElements in the node */ + int count; /* number of MetaElems, which belongs to the node */ +} octal_node; + +typedef struct octal_tree { + struct octal_node *first; /* first node */ + int pos, neg; /* number of positive and negative MetaElements in the scene */ + short depth; /* number of scene subdivision */ +} octal_tree; + +struct pgn_elements { + struct pgn_elements *next, *prev; + char *data; +}; + +/* Forward declarations */ +static int vertid(CORNER *c1, CORNER *c2, PROCESS *p, MetaBall *mb); +static int setcenter(CENTERLIST *table[], int i, int j, int k); +static CORNER *setcorner(PROCESS* p, int i, int j, int k); +static void converge (MB_POINT *p1, MB_POINT *p2, float v1, float v2, + float (*function)(float, float, float), MB_POINT *p, MetaBall *mb, int f); + /* Global variables */ static float thresh= 0.6f; @@ -73,7 +173,7 @@ static MetaElem **mainb; static octal_tree *metaball_tree = NULL; /* Functions */ -void unlink_mball(MetaBall *mb) +void BKE_metaball_unlink(MetaBall *mb) { int a; @@ -85,9 +185,9 @@ void unlink_mball(MetaBall *mb) /* do not free mball itself */ -void free_mball(MetaBall *mb) +void BKE_metaball_free(MetaBall *mb) { - unlink_mball(mb); + BKE_metaball_unlink(mb); if (mb->adt) { BKE_free_animdata((ID *)mb); @@ -99,7 +199,7 @@ void free_mball(MetaBall *mb) if (mb->disp.first) freedisplist(&mb->disp); } -MetaBall *add_mball(const char *name) +MetaBall *BKE_metaball_add(const char *name) { MetaBall *mb; @@ -115,7 +215,7 @@ MetaBall *add_mball(const char *name) return mb; } -MetaBall *copy_mball(MetaBall *mb) +MetaBall *BKE_metaball_copy(MetaBall *mb) { MetaBall *mbn; int a; @@ -143,7 +243,7 @@ static void extern_local_mball(MetaBall *mb) } } -void make_local_mball(MetaBall *mb) +void BKE_metaball_make_local(MetaBall *mb) { Main *bmain= G.main; Object *ob; @@ -174,7 +274,7 @@ void make_local_mball(MetaBall *mb) extern_local_mball(mb); } else if (is_local && is_lib) { - MetaBall *mb_new= copy_mball(mb); + MetaBall *mb_new= BKE_metaball_copy(mb); mb_new->id.us= 0; /* Remap paths of new ID using old library as base. */ @@ -194,7 +294,7 @@ void make_local_mball(MetaBall *mb) /* most simple meta-element adding function * don't do context manipulation here (rna uses) */ -MetaElem *add_metaball_element(MetaBall *mb, const int type) +MetaElem *BKE_metaball_element_add(MetaBall *mb, const int type) { MetaElem *ml= MEM_callocN(sizeof(MetaElem), "metaelem"); @@ -246,7 +346,7 @@ MetaElem *add_metaball_element(MetaBall *mb, const int type) * basic MetaBall (usually with name Meta). All other MetaBalls (with * names Meta.001, Meta.002, etc) are included in this Bounding Box. */ -void tex_space_mball(Object *ob) +void BKE_metaball_tex_space_calc(Object *ob) { DispList *dl; BoundBox *bb; @@ -290,7 +390,7 @@ void tex_space_mball(Object *ob) boundbox_set_from_min_max(bb, min, max); } -float *make_orco_mball(Object *ob, ListBase *dispbase) +float *BKE_metaball_make_orco(Object *ob, ListBase *dispbase) { BoundBox *bb; DispList *dl; @@ -342,7 +442,7 @@ float *make_orco_mball(Object *ob, ListBase *dispbase) * It test last character of Object ID name. If last character * is digit it return 0, else it return 1. */ -int is_basis_mball(Object *ob) +int BKE_metaball_is_basis(Object *ob) { int len; @@ -353,7 +453,7 @@ int is_basis_mball(Object *ob) } /* return nonzero if ob1 is a basis mball for ob */ -int is_mball_basis_for (Object *ob1, Object *ob2) +int BKE_metaball_is_basis_for (Object *ob1, Object *ob2) { int basis1nr, basis2nr; char basis1name[MAX_ID_NAME], basis2name[MAX_ID_NAME]; @@ -361,7 +461,7 @@ int is_mball_basis_for (Object *ob1, Object *ob2) BLI_split_name_num(basis1name, &basis1nr, ob1->id.name+2, '.'); BLI_split_name_num(basis2name, &basis2nr, ob2->id.name+2, '.'); - if (!strcmp(basis1name, basis2name)) return is_basis_mball(ob1); + if (!strcmp(basis1name, basis2name)) return BKE_metaball_is_basis(ob1); else return 0; } @@ -371,7 +471,7 @@ int is_mball_basis_for (Object *ob1, Object *ob2) * are copied to all metaballs in same "group" (metaballs with same base name: MBall, * MBall.001, MBall.002, etc). The most important is to copy properties to the base metaball, * because this metaball influence polygonisation of metaballs. */ -void copy_mball_properties(Scene *scene, Object *active_object) +void BKE_metaball_properties_copy(Scene *scene, Object *active_object) { Scene *sce_iter= scene; Base *base; @@ -416,7 +516,7 @@ void copy_mball_properties(Scene *scene, Object *active_object) * * warning!, is_basis_mball() can fail on returned object, see long note above. */ -Object *find_basis_mball(Scene *scene, Object *basis) +Object *BKE_metaball_basis_find(Scene *scene, Object *basis) { Scene *sce_iter= scene; Base *base; @@ -522,14 +622,14 @@ Object *find_basis_mball(Scene *scene, Object *basis) /* **************** POLYGONIZATION ************************ */ -void calc_mballco(MetaElem *ml, float vec[3]) +static void calc_mballco(MetaElem *ml, float vec[3]) { if (ml->mat) { mul_m4_v3((float (*)[4])ml->mat, vec); } } -float densfunc(MetaElem *ball, float x, float y, float z) +static float densfunc(MetaElem *ball, float x, float y, float z) { float dist2 = 0.0, dx, dy, dz; float vec[3]; @@ -605,7 +705,7 @@ float densfunc(MetaElem *ball, float x, float y, float z) } } -octal_node* find_metaball_octal_node(octal_node *node, float x, float y, float z, short depth) +static octal_node* find_metaball_octal_node(octal_node *node, float x, float y, float z, short depth) { if (!depth) return node; @@ -673,7 +773,7 @@ octal_node* find_metaball_octal_node(octal_node *node, float x, float y, float z return node; } -float metaball(float x, float y, float z) +static float metaball(float x, float y, float z) /* float x, y, z; */ { struct octal_node *node; @@ -713,7 +813,7 @@ static int *indices=NULL; static int totindex, curindex; -void accum_mballfaces(int i1, int i2, int i3, int i4) +static void accum_mballfaces(int i1, int i2, int i3, int i4) { int *newi, *cur; /* static int i=0; I would like to delete altogether, but I don't dare to, yet */ @@ -746,7 +846,7 @@ void accum_mballfaces(int i1, int i2, int i3, int i4) } /* ******************* MEMORY MANAGEMENT *********************** */ -void *new_pgn_element(int size) +static void *new_pgn_element(int size) { /* during polygonize 1000s of elements are allocated * and never freed in between. Freeing only done at the end. @@ -789,7 +889,7 @@ void *new_pgn_element(int size) return cur->data; } -void freepolygonize(PROCESS *p) +static void freepolygonize(PROCESS *p) { MEM_freeN(p->corners); MEM_freeN(p->edges); @@ -832,7 +932,7 @@ static int rightface[12] = { /* docube: triangulate the cube directly, without decomposition */ -void docube(CUBE *cube, PROCESS *p, MetaBall *mb) +static void docube(CUBE *cube, PROCESS *p, MetaBall *mb) { INTLISTS *polys; CORNER *c1, *c2; @@ -900,7 +1000,7 @@ void docube(CUBE *cube, PROCESS *p, MetaBall *mb) * if surface crosses face, compute other four corners of adjacent cube * and add new cube to cube stack */ -void testface(int i, int j, int k, CUBE* old, int bit, int c1, int c2, int c3, int c4, PROCESS *p) +static void testface(int i, int j, int k, CUBE* old, int bit, int c1, int c2, int c3, int c4, PROCESS *p) { CUBE newc; CUBES *oldcubes = p->cubes; @@ -951,7 +1051,7 @@ void testface(int i, int j, int k, CUBE* old, int bit, int c1, int c2, int c3, i /* setcorner: return corner with the given lattice location * set (and cache) its function value */ -CORNER *setcorner (PROCESS* p, int i, int j, int k) +static CORNER *setcorner (PROCESS* p, int i, int j, int k) { /* for speed, do corner value caching here */ CORNER *c; @@ -986,7 +1086,7 @@ CORNER *setcorner (PROCESS* p, int i, int j, int k) /* nextcwedge: return next clockwise edge from given edge around given face */ -int nextcwedge (int edge, int face) +static int nextcwedge (int edge, int face) { switch (edge) { case LB: @@ -1020,7 +1120,7 @@ int nextcwedge (int edge, int face) /* otherface: return face adjoining edge that is not the given face */ -int otherface (int edge, int face) +static int otherface (int edge, int face) { int other = leftface[edge]; return face == other? rightface[edge] : other; @@ -1029,7 +1129,7 @@ int otherface (int edge, int face) /* makecubetable: create the 256 entry table for cubical polygonization */ -void makecubetable (void) +static void makecubetable (void) { static int isdone= 0; int i, e, c, done[12], pos[8]; @@ -1070,7 +1170,7 @@ void makecubetable (void) } } -void BKE_freecubetable(void) +void BKE_metaball_cubeTable_free(void) { int i; INTLISTS *lists, *nlists; @@ -1100,7 +1200,7 @@ void BKE_freecubetable(void) /* setcenter: set (i,j,k) entry of table[] * return 1 if already set; otherwise, set and return 0 */ -int setcenter(CENTERLIST *table[], int i, int j, int k) +static int setcenter(CENTERLIST *table[], int i, int j, int k) { int index; CENTERLIST *newc, *l, *q; @@ -1125,7 +1225,7 @@ int setcenter(CENTERLIST *table[], int i, int j, int k) /* setedge: set vertex id for edge */ -void setedge (EDGELIST *table[], +static void setedge (EDGELIST *table[], int i1, int j1, int k1, int i2, int j2, int k2, @@ -1161,7 +1261,7 @@ void setedge (EDGELIST *table[], /* getedge: return vertex id for edge; return -1 if not set */ -int getedge (EDGELIST *table[], +static int getedge (EDGELIST *table[], int i1, int j1, int k1, int i2, int j2, int k2) { @@ -1202,7 +1302,7 @@ int getedge (EDGELIST *table[], /* addtovertices: add v to sequence of vertices */ -void addtovertices (VERTICES *vertices, VERTEX v) +static void addtovertices (VERTICES *vertices, VERTEX v) { if (vertices->count == vertices->max) { int i; @@ -1220,7 +1320,7 @@ void addtovertices (VERTICES *vertices, VERTEX v) /* vnormal: compute unit length surface normal at point */ -void vnormal (MB_POINT *point, PROCESS *p, MB_POINT *v) +static void vnormal (MB_POINT *point, PROCESS *p, MB_POINT *v) { float delta= 0.2f*p->delta; float f = p->function(point->x, point->y, point->z); @@ -1270,7 +1370,7 @@ void vnormal (MB_POINT *point, PROCESS *p, MB_POINT *v) } -int vertid (CORNER *c1, CORNER *c2, PROCESS *p, MetaBall *mb) +static int vertid (CORNER *c1, CORNER *c2, PROCESS *p, MetaBall *mb) { VERTEX v; MB_POINT a, b; @@ -1299,7 +1399,7 @@ int vertid (CORNER *c1, CORNER *c2, PROCESS *p, MetaBall *mb) /* converge: from two points of differing sign, converge to zero crossing */ /* watch it: p1 and p2 are used to calculate */ -void converge (MB_POINT *p1, MB_POINT *p2, float v1, float v2, +static void converge (MB_POINT *p1, MB_POINT *p2, float v1, float v2, float (*function)(float, float, float), MB_POINT *p, MetaBall *mb, int f) { int i = 0; @@ -1399,7 +1499,7 @@ void converge (MB_POINT *p1, MB_POINT *p2, float v1, float v2, } /* ************************************** */ -void add_cube(PROCESS *mbproc, int i, int j, int k, int count) +static void add_cube(PROCESS *mbproc, int i, int j, int k, int count) { CUBES *ncube; int n; @@ -1429,7 +1529,7 @@ void add_cube(PROCESS *mbproc, int i, int j, int k, int count) } -void find_first_points(PROCESS *mbproc, MetaBall *mb, int a) +static void find_first_points(PROCESS *mbproc, MetaBall *mb, int a) { MB_POINT IN, in, OUT, out; /*point;*/ MetaElem *ml; @@ -1549,7 +1649,7 @@ void find_first_points(PROCESS *mbproc, MetaBall *mb, int a) } } -void polygonize(PROCESS *mbproc, MetaBall *mb) +static void polygonize(PROCESS *mbproc, MetaBall *mb) { CUBE c; int a; @@ -1589,7 +1689,7 @@ void polygonize(PROCESS *mbproc, MetaBall *mb) } } -float init_meta(Scene *scene, Object *ob) /* return totsize */ +static float init_meta(Scene *scene, Object *ob) /* return totsize */ { Scene *sce_iter= scene; Base *base; @@ -1815,7 +1915,7 @@ float init_meta(Scene *scene, Object *ob) /* return totsize */ /* if MetaElem lies in node, then node includes MetaElem pointer (ml_p) * pointing at MetaElem (ml) */ -void fill_metaball_octal_node(octal_node *node, MetaElem *ml, short i) +static void fill_metaball_octal_node(octal_node *node, MetaElem *ml, short i) { ml_pointer *ml_p; @@ -1847,7 +1947,7 @@ void fill_metaball_octal_node(octal_node *node, MetaElem *ml, short i) * +------+------+ * */ -void subdivide_metaball_octal_node(octal_node *node, float size_x, float size_y, float size_z, short depth) +static void subdivide_metaball_octal_node(octal_node *node, float size_x, float size_y, float size_z, short depth) { MetaElem *ml; ml_pointer *ml_p; @@ -2104,7 +2204,7 @@ void subdivide_metaball_octal_node(octal_node *node, float size_x, float size_y, } /* free all octal nodes recursively */ -void free_metaball_octal_node(octal_node *node) +static void free_metaball_octal_node(octal_node *node) { int a; for (a=0;a<8;a++) { @@ -2115,7 +2215,7 @@ void free_metaball_octal_node(octal_node *node) } /* If scene include more then one MetaElem, then octree is used */ -void init_metaball_octal_tree(int depth) +static void init_metaball_octal_tree(int depth) { struct octal_node *node; ml_pointer *ml_p; @@ -2173,7 +2273,7 @@ void init_metaball_octal_tree(int depth) subdivide_metaball_octal_node(node, size[0], size[1], size[2], metaball_tree->depth); } -void metaball_polygonize(Scene *scene, Object *ob, ListBase *dispbase) +void BKE_metaball_polygonize(Scene *scene, Object *ob, ListBase *dispbase) { PROCESS mbproc; MetaBall *mb; diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 14ccd401a30..c7f6bf93831 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -1616,7 +1616,7 @@ void mesh_to_curve(Scene *scene, Object *ob) BLI_edgehash_free(eh, NULL); if (edges.first) { - Curve *cu = add_curve(ob->id.name+2, OB_CURVE); + Curve *cu = BKE_curve_add(ob->id.name+2, OB_CURVE); cu->flag |= CU_3D; while (edges.first) { diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index a3baa883a4a..d548d7589bb 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -450,7 +450,7 @@ static MovieClip *movieclip_alloc(const char *name) * otherwise creates new. * does not load ibuf itself * pass on optional frame for #name images */ -MovieClip *BKE_add_movieclip_file(const char *name) +MovieClip *BKE_movieclip_file_add(const char *name) { MovieClip *clip; MovieClipUser user; @@ -1149,14 +1149,14 @@ void BKE_movieclip_build_proxy_frame(MovieClip *clip, int clip_flag, struct Movi } } -void free_movieclip(MovieClip *clip) +void BKE_movieclip_free(MovieClip *clip) { free_buffers(clip); BKE_tracking_free(&clip->tracking); } -void unlink_movieclip(Main *bmain, MovieClip *clip) +void BKE_movieclip_unlink(Main *bmain, MovieClip *clip) { bScreen *scr; ScrArea *area; diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 6b44ba976d5..3ffd8115914 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -319,8 +319,8 @@ void free_object(Object *ob) id->us--; if (id->us==0) { if (ob->type==OB_MESH) unlink_mesh(ob->data); - else if (ob->type==OB_CURVE) unlink_curve(ob->data); - else if (ob->type==OB_MBALL) unlink_mball(ob->data); + else if (ob->type==OB_CURVE) BKE_curve_unlink(ob->data); + else if (ob->type==OB_MBALL) BKE_metaball_unlink(ob->data); } ob->data= NULL; } @@ -459,7 +459,7 @@ void unlink_object(Object *ob) } } else if (ELEM(OB_MBALL, ob->type, obt->type)) { - if (is_mball_basis_for (obt, ob)) + if (BKE_metaball_is_basis_for (obt, ob)) obt->recalc|= OB_RECALC_DATA; } @@ -749,10 +749,10 @@ static void *add_obdata_from_type(int type) { switch (type) { case OB_MESH: return add_mesh("Mesh"); - case OB_CURVE: return add_curve("Curve", OB_CURVE); - case OB_SURF: return add_curve("Surf", OB_SURF); - case OB_FONT: return add_curve("Text", OB_FONT); - case OB_MBALL: return add_mball("Meta"); + case OB_CURVE: return BKE_curve_add("Curve", OB_CURVE); + case OB_SURF: return BKE_curve_add("Surf", OB_SURF); + case OB_FONT: return BKE_curve_add("Text", OB_FONT); + case OB_MBALL: return BKE_metaball_add("Meta"); case OB_CAMERA: return add_camera("Camera"); case OB_LAMP: return add_lamp("Lamp"); case OB_LATTICE: return add_lattice("Lattice"); @@ -1822,7 +1822,7 @@ static void give_parvert(Object *par, int nr, float vec[3]) ListBase *nurbs; cu= par->data; - nurbs= BKE_curve_nurbs(cu); + nurbs= BKE_curve_nurbs_get(cu); nu= nurbs->first; count= 0; @@ -2268,7 +2268,7 @@ void minmax_object(Object *ob, float min[3], float max[3]) { Curve *cu= ob->data; - if (cu->bb==NULL) tex_space_curve(cu); + if (cu->bb==NULL) BKE_curve_tex_space_calc(cu); bb= *(cu->bb); for (a=0; a<8; a++) { @@ -2930,7 +2930,7 @@ static KeyBlock *insert_curvekey(Scene *scene, Object *ob, const char *name, int Curve *cu= ob->data; Key *key= cu->key; KeyBlock *kb; - ListBase *lb= BKE_curve_nurbs(cu); + ListBase *lb= BKE_curve_nurbs_get(cu); int newkey= 0; if (key==NULL) { @@ -2957,7 +2957,7 @@ static KeyBlock *insert_curvekey(Scene *scene, Object *ob, const char *name, int /* create new block with prepared data */ kb = add_keyblock_ctime(key, name, FALSE); - kb->totelem= count_curveverts(lb); + kb->totelem= BKE_nurbList_verts_count(lb); kb->data= data; } diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index d0eca731a1a..5d8a4955e58 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -3559,7 +3559,7 @@ static void curve_surf_to_softbody(Scene *scene, Object *ob) int a, curindex=0; int totvert, totspring = 0, setgoal=0; - totvert= count_curveverts(&cu->nurb); + totvert= BKE_nurbList_verts_count(&cu->nurb); if (ob->softflag & OB_SB_EDGES) { if (ob->type==OB_CURVE) { |