diff options
author | Ove Murberg Henriksen <sorayasilvermoon@hotmail.com> | 2012-05-08 02:28:59 +0400 |
---|---|---|
committer | Ove Murberg Henriksen <sorayasilvermoon@hotmail.com> | 2012-05-08 02:28:59 +0400 |
commit | 1d5440350d36ef8891063464733cc6d6a434898f (patch) | |
tree | fbbd888ebce98696e913401139244c9fd3fe43b8 | |
parent | bc86c410f773aabeb4526679dd0d4c6aba66e793 (diff) | |
parent | 364388b9f2a2ddc838f8182537c1ddf3f0ea0f0b (diff) |
svn merge ^/trunk/blender -r46330:46335
51 files changed, 443 insertions, 413 deletions
diff --git a/release/scripts/startup/bl_ui/properties_animviz.py b/release/scripts/startup/bl_ui/properties_animviz.py index 3f25006766e..1f798f46590 100644 --- a/release/scripts/startup/bl_ui/properties_animviz.py +++ b/release/scripts/startup/bl_ui/properties_animviz.py @@ -65,12 +65,10 @@ class MotionPathButtonsPanel(): sub.prop(mpath, "frame_start", text="From") sub.prop(mpath, "frame_end", text="To") - sub = col.column() # align=True - sub.operator_context = 'EXEC_DEFAULT' if bones: - col.operator("pose.paths_calculate", text="Update", icon='BONE_DATA') + col.operator("pose.paths_update", text="Update Paths", icon='BONE_DATA') else: - col.operator("object.paths_calculate", text="Update", icon='OBJECT_DATA') + col.operator("object.paths_update", text="Update Paths", icon='OBJECT_DATA') else: col.label(text="Not available yet...", icon='ERROR') col.label(text="Calculate Paths first", icon='INFO') diff --git a/release/scripts/startup/bl_ui/properties_data_armature.py b/release/scripts/startup/bl_ui/properties_data_armature.py index 63dc64190bb..529d7c5f981 100644 --- a/release/scripts/startup/bl_ui/properties_data_armature.py +++ b/release/scripts/startup/bl_ui/properties_data_armature.py @@ -65,14 +65,10 @@ class DATA_PT_skeleton(ArmatureButtonsPanel, Panel): col.label(text="Protected Layers:") col.prop(arm, "layers_protected", text="") - layout.label(text="Deform:") - flow = layout.column_flow() - flow.prop(arm, "use_deform_vertex_groups", text="Vertex Groups") - flow.prop(arm, "use_deform_envelopes", text="Envelopes") - flow.prop(arm, "use_deform_preserve_volume", text="Quaternion") - if context.scene.render.engine == 'BLENDER_GAME': - layout.row().prop(arm, "deform_method", expand=True) + col = layout.column() + col.label(text="Deform:") + col.prop(arm, "deform_method", expand=True) class DATA_PT_display(ArmatureButtonsPanel, Panel): diff --git a/source/blender/blenkernel/BKE_constraint.h b/source/blender/blenkernel/BKE_constraint.h index b12ab538184..35d07e7a7a7 100644 --- a/source/blender/blenkernel/BKE_constraint.h +++ b/source/blender/blenkernel/BKE_constraint.h @@ -87,8 +87,6 @@ typedef struct bConstraintTypeInfo { /* data management function pointers - special handling */ /* free any data that is allocated separately (optional) */ void (*free_data)(struct bConstraint *con); - /* adjust pointer to other ID-data using ID_NEW(), but not to targets (optional) */ - void (*relink_data)(struct bConstraint *con); /* run the provided callback function on all the ID-blocks linked to the constraint */ void (*id_looper)(struct bConstraint *con, ConstraintIDFunc func, void *userdata); /* copy any special data that is allocated separately (optional) */ diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h index 3b9328ae1aa..6267104022c 100644 --- a/source/blender/blenkernel/BKE_curve.h +++ b/source/blender/blenkernel/BKE_curve.h @@ -63,7 +63,7 @@ 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 BKE_curve_texspace_calc(struct Curve *cu); int BKE_curve_minmax(struct Curve *cu, float min[3], float max[3]); int BKE_curve_center_median(struct Curve *cu, float cent[3]); diff --git a/source/blender/blenkernel/BKE_mball.h b/source/blender/blenkernel/BKE_mball.h index 018ee7f6c94..8a35690442d 100644 --- a/source/blender/blenkernel/BKE_mball.h +++ b/source/blender/blenkernel/BKE_mball.h @@ -51,7 +51,7 @@ 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); -void BKE_metaball_tex_space_calc(struct Object *ob); +void BKE_metaball_texspace_calc(struct Object *ob); float *BKE_metaball_make_orco(struct Object *ob, struct ListBase *dispbase); void BKE_metaball_properties_copy(struct Scene *scene, struct Object *active_object); diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index 256d4b1cae1..88a92d9028e 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -76,109 +76,109 @@ struct BMesh *BKE_mesh_to_bmesh(struct Mesh *me, struct Object *ob); * if both of the above are 0, it'll use the indices of the mpolys of the MPoly * data in pdata, and ignore the origindex layer altogether. */ -int mesh_recalcTessellation(struct CustomData *fdata, struct CustomData *ldata, struct CustomData *pdata, - struct MVert *mvert, - int totface, int totloop, int totpoly, - const int do_face_normals); +int BKE_mesh_recalc_tessellation(struct CustomData *fdata, struct CustomData *ldata, struct CustomData *pdata, + struct MVert *mvert, + int totface, int totloop, int totpoly, + const int do_face_normals); /* for forwards compat only quad->tri polys to mface, skip ngons. */ -int mesh_mpoly_to_mface(struct CustomData *fdata, struct CustomData *ldata, - struct CustomData *pdata, int totface, int totloop, int totpoly); +int BKE_mesh_mpoly_to_mface(struct CustomData *fdata, struct CustomData *ldata, + struct CustomData *pdata, int totface, int totloop, int totpoly); /*calculates a face normal.*/ void mesh_calc_poly_normal(struct MPoly *mpoly, struct MLoop *loopstart, struct MVert *mvarray, float no[3]); -void mesh_calc_poly_normal_coords(struct MPoly *mpoly, struct MLoop *loopstart, - const float (*vertex_coords)[3], float no[3]); +void BKE_mesh_calc_poly_normal_coords(struct MPoly *mpoly, struct MLoop *loopstart, + const float (*vertex_coords)[3], float no[3]); -void mesh_calc_poly_center(struct MPoly *mpoly, struct MLoop *loopstart, - struct MVert *mvarray, float cent[3]); +void BKE_mesh_calc_poly_center(struct MPoly *mpoly, struct MLoop *loopstart, + struct MVert *mvarray, float cent[3]); -float mesh_calc_poly_area(struct MPoly *mpoly, struct MLoop *loopstart, - struct MVert *mvarray, float polynormal[3]); +float BKE_mesh_calc_poly_area(struct MPoly *mpoly, struct MLoop *loopstart, + struct MVert *mvarray, float polynormal[3]); /* Find the index of the loop in 'poly' which references vertex, * returns -1 if not found */ int poly_find_loop_from_vert(const struct MPoly *poly, - const struct MLoop *loopstart, - unsigned vert); + const struct MLoop *loopstart, + unsigned vert); /* Fill 'adj_r' with the loop indices in 'poly' adjacent to the * vertex. Returns the index of the loop matching vertex, or -1 if the * vertex is not in 'poly' */ int poly_get_adj_loops_from_vert(unsigned adj_r[3], const struct MPoly *poly, - const struct MLoop *mloop, unsigned vert); + const struct MLoop *mloop, unsigned vert); /* update the hide flag for edges and polys from the corresponding * flag in verts */ -void mesh_flush_hidden_from_verts(const struct MVert *mvert, - const struct MLoop *mloop, - struct MEdge *medge, int totedge, - struct MPoly *mpoly, int totpoly); +void BKE_mesh_flush_hidden_from_verts(const struct MVert *mvert, + const struct MLoop *mloop, + struct MEdge *medge, int totedge, + struct MPoly *mpoly, int totpoly); -void unlink_mesh(struct Mesh *me); +void BKE_mesh_unlink(struct Mesh *me); void BKE_mesh_free(struct Mesh *me, int unlink); struct Mesh *BKE_mesh_add(const char *name); struct Mesh *BKE_mesh_copy(struct Mesh *me); void mesh_update_customdata_pointers(struct Mesh *me, const short do_ensure_tess_cd); void BKE_mesh_make_local(struct Mesh *me); -void boundbox_mesh(struct Mesh *me, float *loc, float *size); -void tex_space_mesh(struct Mesh *me); -float *get_mesh_orco_verts(struct Object *ob); -void transform_mesh_orco_verts(struct Mesh *me, float (*orco)[3], int totvert, int invert); +void BKE_mesh_boundbox_calc(struct Mesh *me, float *loc, float *size); +void BKE_mesh_texspace_calc(struct Mesh *me); +float *BKE_mesh_orco_verts_get(struct Object *ob); +void BKE_mesh_orco_verts_transform(struct Mesh *me, float (*orco)[3], int totvert, int invert); int test_index_face(struct MFace *mface, struct CustomData *mfdata, int mfindex, int nr); struct Mesh *BKE_mesh_from_object(struct Object *ob); void set_mesh(struct Object *ob, struct Mesh *me); -void mball_to_mesh(struct ListBase *lb, struct Mesh *me); -int nurbs_to_mdata(struct Object *ob, struct MVert **allvert, int *totvert, - struct MEdge **alledge, int *totedge, struct MLoop **allloop, struct MPoly **allpoly, - int *totloop, int *totpoly); -int nurbs_to_mdata_customdb(struct Object *ob, struct ListBase *dispbase, struct MVert **allvert, int *_totvert, - struct MEdge **alledge, int *_totedge, struct MLoop **allloop, struct MPoly **allpoly, - int *_totloop, int *_totpoly); -void nurbs_to_mesh(struct Object *ob); -void mesh_to_curve(struct Scene *scene, struct Object *ob); +void BKE_mesh_from_metaball(struct ListBase *lb, struct Mesh *me); +int BKE_mesh_nurbs_to_mdata(struct Object *ob, struct MVert **allvert, int *totvert, + struct MEdge **alledge, int *totedge, struct MLoop **allloop, struct MPoly **allpoly, + int *totloop, int *totpoly); +int BKE_mesh_nurbs_to_mdata_customdb(struct Object *ob, struct ListBase *dispbase, struct MVert **allvert, int *_totvert, + struct MEdge **alledge, int *_totedge, struct MLoop **allloop, struct MPoly **allpoly, + int *_totloop, int *_totpoly); +void BKE_mesh_from_nurbs(struct Object *ob); +void BKE_mesh_from_curve(struct Scene *scene, struct Object *ob); void free_dverts(struct MDeformVert *dvert, int totvert); void copy_dverts(struct MDeformVert *dst, struct MDeformVert *src, int totvert); /* __NLA */ -void mesh_delete_material_index(struct Mesh *me, short index); -void mesh_set_smooth_flag(struct Object *meshOb, int enableSmooth); +void BKE_mesh_delete_material_index(struct Mesh *me, short index); +void BKE_mesh_smooth_flag_set(struct Object *meshOb, int enableSmooth); void BKE_mesh_convert_mfaces_to_mpolys(struct Mesh *mesh); -void mesh_calc_normals_tessface(struct MVert *mverts, int numVerts, struct MFace *mfaces, int numFaces, float (*faceNors_r)[3]); +void BKE_mesh_calc_normals_tessface(struct MVert *mverts, int numVerts, struct MFace *mfaces, int numFaces, float (*faceNors_r)[3]); /* used for unit testing; compares two meshes, checking only * differences we care about. should be usable with leaf's * testing framework I get RNA work done, will use hackish * testing code for now.*/ -const char *mesh_cmp(struct Mesh *me1, struct Mesh *me2, float thresh); +const char *BKE_mesh_cmp(struct Mesh *me1, struct Mesh *me2, float thresh); -struct BoundBox *mesh_get_bb(struct Object *ob); -void mesh_get_texspace(struct Mesh *me, float r_loc[3], float r_rot[3], float r_size[3]); +struct BoundBox *BKE_mesh_boundbox_get(struct Object *ob); +void BKE_mesh_texspace_get(struct Mesh *me, float r_loc[3], float r_rot[3], float r_size[3]); /* if old, it converts mface->edcode to edge drawflags */ -void make_edges(struct Mesh *me, int old); +void BKE_mesh_make_edges(struct Mesh *me, int old); -void mesh_strip_loose_faces(struct Mesh *me); /* Needed for compatibility (some old read code). */ -void mesh_strip_loose_polysloops(struct Mesh *me); -void mesh_strip_loose_edges(struct Mesh *me); +void BKE_mesh_strip_loose_faces(struct Mesh *me); /* Needed for compatibility (some old read code). */ +void BKE_mesh_strip_loose_polysloops(struct Mesh *me); +void BKE_mesh_strip_loose_edges(struct Mesh *me); /* Calculate vertex and face normals, face normals are returned in *faceNors_r if non-NULL * and vertex normals are stored in actual mverts. */ -void mesh_calc_normals_mapping( +void BKE_mesh_calc_normals_mapping( struct MVert *mverts, int numVerts, struct MLoop *mloop, struct MPoly *mpolys, int numLoops, int numPolys, float (*polyNors_r)[3], struct MFace *mfaces, int numFaces, int *origIndexFace, float (*faceNors_r)[3]); - /* extended version of 'mesh_calc_normals' with option not to calc vertex normals */ -void mesh_calc_normals_mapping_ex( + /* extended version of 'BKE_mesh_calc_normals' with option not to calc vertex normals */ +void BKE_mesh_calc_normals_mapping_ex( struct MVert *mverts, int numVerts, struct MLoop *mloop, struct MPoly *mpolys, int numLoops, int numPolys, float (*polyNors_r)[3], struct MFace *mfaces, int numFaces, int *origIndexFace, float (*faceNors_r)[3], const short only_face_normals); -void mesh_calc_normals( +void BKE_mesh_calc_normals( struct MVert *mverts, int numVerts, struct MLoop *mloop, struct MPoly *mpolys, int numLoops, int numPolys, float (*polyNors_r)[3]); @@ -246,9 +246,10 @@ typedef struct UvElementMap { * to make that many islands, he can bite me :p */ #define INVALID_ISLAND 0xFFFF -UvVertMap *make_uv_vert_map(struct MPoly *mpoly, struct MLoop *mloop, struct MLoopUV *mloopuv, unsigned int totpoly, unsigned int totvert, int selected, float *limit); -UvMapVert *get_uv_map_vert(UvVertMap *vmap, unsigned int v); -void free_uv_vert_map(UvVertMap *vmap); +UvVertMap *BKE_mesh_uv_vert_map_make(struct MPoly *mpoly, struct MLoop *mloop, struct MLoopUV *mloopuv, + unsigned int totpoly, unsigned int totvert, int selected, float *limit); +UvMapVert *BKE_mesh_uv_vert_map_get_vert(UvVertMap *vmap, unsigned int v); +void BKE_mesh_uv_vert_map_free(UvVertMap *vmap); /* Connectivity data */ typedef struct MeshElemMap { @@ -270,10 +271,10 @@ void create_vert_edge_map(struct ListBase **map, IndexNode **mem, const struct M /* vertex level transformations & checks (no derived mesh) */ -int minmax_mesh(struct Mesh *me, float min[3], float max[3]); -int mesh_center_median(struct Mesh *me, float cent[3]); -int mesh_center_bounds(struct Mesh *me, float cent[3]); -void mesh_translate(struct Mesh *me, float offset[3], int do_keys); +int BKE_mesh_minmax(struct Mesh *me, float r_min[3], float r_max[3]); +int BKE_mesh_center_median(struct Mesh *me, float cent[3]); +int BKE_mesh_center_bounds(struct Mesh *me, float cent[3]); +void BKE_mesh_translate(struct Mesh *me, float offset[3], int do_keys); /* mesh_validate.c */ /* XXX Loop v/e are unsigned, so using max uint_32 value as invalid marker... */ @@ -298,10 +299,10 @@ void BKE_mesh_tessface_ensure(struct Mesh *mesh); void BKE_mesh_tessface_clear(struct Mesh *mesh); /* Convert a triangle or quadrangle of loop/poly data to tessface data */ -void mesh_loops_to_mface_corners(struct CustomData *fdata, struct CustomData *ldata, - struct CustomData *pdata, int lindex[4], int findex, - const int polyindex, const int mf_len, - const int numTex, const int numCol, const int hasPCol, const int hasOrigSpace); +void BKE_mesh_loops_to_mface_corners(struct CustomData *fdata, struct CustomData *ldata, + struct CustomData *pdata, int lindex[4], int findex, + const int polyindex, const int mf_len, + const int numTex, const int numCol, const int hasPCol, const int hasOrigSpace); #ifdef __cplusplus } diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 34dee93d95a..c0bf798478c 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -446,10 +446,10 @@ void DM_update_tessface_data(DerivedMesh *dm) not_done--; } } - mesh_loops_to_mface_corners(fdata, ldata, pdata, - ml_idx, mf_idx, polyindex[mf_idx], - mf_len, - numTex, numCol, hasPCol, hasOrigSpace); + BKE_mesh_loops_to_mface_corners(fdata, ldata, pdata, + ml_idx, mf_idx, polyindex[mf_idx], + mf_len, + numTex, numCol, hasPCol, hasOrigSpace); } if (G.debug & G_DEBUG) @@ -870,7 +870,7 @@ static void *get_orco_coords_dm(Object *ob, BMEditMesh *em, int layer, int *free if (em) return (float(*)[3])get_editbmesh_orco_verts(em); else - return (float(*)[3])get_mesh_orco_verts(ob); + return (float(*)[3])BKE_mesh_orco_verts_get(ob); } else if (layer == CD_CLOTH_ORCO) { /* apply shape key for cloth, this should really be solved @@ -932,7 +932,7 @@ static void add_orco_dm(Object *ob, BMEditMesh *em, DerivedMesh *dm, if (orco) { if (layer == CD_ORCO) - transform_mesh_orco_verts(ob->data, orco, totvert, 0); + BKE_mesh_orco_verts_transform(ob->data, orco, totvert, 0); if (!(layerorco = DM_get_vert_data_layer(dm, layer))) { DM_add_vert_layer(dm, layer, CD_CALLOC, NULL); diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 1d05ecca909..f3b106efe33 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -931,8 +931,8 @@ static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, fl dm= mesh_get_derived_deform(scene, par, CD_MASK_BAREMESH); if (G.rendering) { - vdd.orco= (float(*)[3])get_mesh_orco_verts(par); - transform_mesh_orco_verts(me, vdd.orco, me->totvert, 0); + vdd.orco= (float(*)[3])BKE_mesh_orco_verts_get(par); + BKE_mesh_orco_verts_transform(me, vdd.orco, me->totvert, 0); } else vdd.orco= NULL; @@ -1063,8 +1063,8 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa if (G.rendering) { - orco= (float(*)[3])get_mesh_orco_verts(par); - transform_mesh_orco_verts(me, orco, me->totvert, 0); + orco= (float(*)[3])BKE_mesh_orco_verts_get(par); + BKE_mesh_orco_verts_transform(me, orco, me->totvert, 0); mloopuv= me->mloopuv; } else { @@ -1143,7 +1143,7 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa } /* translation */ - mesh_calc_poly_center(mp, loopstart, mvert, cent); + BKE_mesh_calc_poly_center(mp, loopstart, mvert, cent); mul_m4_v3(pmat, cent); @@ -1160,7 +1160,7 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa /* scale */ if (par->transflag & OB_DUPLIFACES_SCALE) { - float size= mesh_calc_poly_area(mp, loopstart, mvert, NULL); + float size= BKE_mesh_calc_poly_area(mp, loopstart, mvert, NULL); size= sqrtf(size) * par->dupfacesca; mul_m3_fl(mat, size); } diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 19e66b957eb..6fdaa3043cb 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -1521,10 +1521,10 @@ void CDDM_recalc_tessellation_ex(DerivedMesh *dm, const int do_face_nor_cpy) { CDDerivedMesh *cddm = (CDDerivedMesh*)dm; - dm->numTessFaceData = mesh_recalcTessellation(&dm->faceData, &dm->loopData, &dm->polyData, - cddm->mvert, - dm->numTessFaceData, dm->numLoopData, dm->numPolyData, - do_face_nor_cpy); + dm->numTessFaceData = BKE_mesh_recalc_tessellation(&dm->faceData, &dm->loopData, &dm->polyData, + cddm->mvert, + dm->numTessFaceData, dm->numLoopData, dm->numPolyData, + do_face_nor_cpy); if (!CustomData_get_layer(&dm->faceData, CD_ORIGINDEX)) { int *polyIndex = CustomData_get_layer(&dm->faceData, CD_POLYINDEX); @@ -1723,8 +1723,9 @@ DerivedMesh *CDDM_from_curve_customDB(Object *ob, ListBase *dispbase) MPoly *allpoly; int totvert, totedge, totloop, totpoly; - if (nurbs_to_mdata_customdb(ob, dispbase, &allvert, &totvert, &alledge, - &totedge, &allloop, &allpoly, &totloop, &totpoly) != 0) { + if (BKE_mesh_nurbs_to_mdata_customdb(ob, dispbase, &allvert, &totvert, &alledge, + &totedge, &allloop, &allpoly, &totloop, &totpoly) != 0) + { /* Error initializing mdata. This often happens when curve is empty */ return CDDM_new(0, 0, 0, 0, 0); } @@ -2116,10 +2117,10 @@ void CDDM_calc_normals_mapping_ex(DerivedMesh *dm, const short only_face_normals face_nors = MEM_mallocN(sizeof(float)*3*dm->numTessFaceData, "face_nors"); /* calculate face normals */ - mesh_calc_normals_mapping_ex(cddm->mvert, dm->numVertData, CDDM_get_loops(dm), CDDM_get_polys(dm), - dm->numLoopData, dm->numPolyData, NULL, cddm->mface, dm->numTessFaceData, - CustomData_get_layer(&dm->faceData, CD_POLYINDEX), face_nors, - only_face_normals); + BKE_mesh_calc_normals_mapping_ex(cddm->mvert, dm->numVertData, CDDM_get_loops(dm), CDDM_get_polys(dm), + dm->numLoopData, dm->numPolyData, NULL, cddm->mface, dm->numTessFaceData, + CustomData_get_layer(&dm->faceData, CD_POLYINDEX), face_nors, + only_face_normals); CustomData_add_layer(&dm->faceData, CD_NORMAL, CD_ASSIGN, face_nors, dm->numTessFaceData); @@ -2151,8 +2152,8 @@ void CDDM_calc_normals(DerivedMesh *dm) poly_nors = CustomData_add_layer(&dm->polyData, CD_NORMAL, CD_CALLOC, NULL, dm->numPolyData); } - mesh_calc_normals(cddm->mvert, dm->numVertData, CDDM_get_loops(dm), CDDM_get_polys(dm), - dm->numLoopData, dm->numPolyData, poly_nors); + BKE_mesh_calc_normals(cddm->mvert, dm->numVertData, CDDM_get_loops(dm), CDDM_get_polys(dm), + dm->numLoopData, dm->numPolyData, poly_nors); } void CDDM_calc_normals_tessface(DerivedMesh *dm) @@ -2171,8 +2172,8 @@ void CDDM_calc_normals_tessface(DerivedMesh *dm) face_nors = CustomData_add_layer(&dm->faceData, CD_NORMAL, CD_CALLOC, NULL, dm->numTessFaceData); } - mesh_calc_normals_tessface(cddm->mvert, dm->numVertData, - cddm->mface, dm->numTessFaceData, face_nors); + BKE_mesh_calc_normals_tessface(cddm->mvert, dm->numVertData, + cddm->mface, dm->numTessFaceData, face_nors); } #if 1 diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 66209e8a924..9e47d136863 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -648,7 +648,6 @@ static bConstraintTypeInfo CTI_CONSTRNAME = { "ConstrName", /* name */ "bConstrNameConstraint", /* struct name */ constrname_free, /* free data */ - constrname_relink, /* relink data */ constrname_id_looper, /* id looper */ constrname_copy, /* copy data */ constrname_new_data, /* new data */ @@ -874,7 +873,7 @@ static void childof_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *ta */ copy_m4_m4(tempmat, cob->matrix); mult_m4_m4m4(cob->matrix, parmat, tempmat); - + /* without this, changes to scale and rotation can change location * of a parentless bone or a disconnected bone. Even though its set * to zero above. */ @@ -892,7 +891,6 @@ static bConstraintTypeInfo CTI_CHILDOF = { "ChildOf", /* name */ "bChildOfConstraint", /* struct name */ NULL, /* free data */ - NULL, /* relink data */ childof_id_looper, /* id looper */ NULL, /* copy data */ childof_new_data, /* new data */ @@ -1070,7 +1068,6 @@ static bConstraintTypeInfo CTI_TRACKTO = { "TrackTo", /* name */ "bTrackToConstraint", /* struct name */ NULL, /* free data */ - NULL, /* relink data */ trackto_id_looper, /* id looper */ NULL, /* copy data */ trackto_new_data, /* new data */ @@ -1164,7 +1161,6 @@ static bConstraintTypeInfo CTI_KINEMATIC = { "IK", /* name */ "bKinematicConstraint", /* struct name */ NULL, /* free data */ - NULL, /* relink data */ kinematic_id_looper, /* id looper */ NULL, /* copy data */ kinematic_new_data, /* new data */ @@ -1350,7 +1346,6 @@ static bConstraintTypeInfo CTI_FOLLOWPATH = { "Follow Path", /* name */ "bFollowPathConstraint", /* struct name */ NULL, /* free data */ - NULL, /* relink data */ followpath_id_looper, /* id looper */ NULL, /* copy data */ followpath_new_data, /* new data */ @@ -1399,7 +1394,6 @@ static bConstraintTypeInfo CTI_LOCLIMIT = { "Limit Location", /* name */ "bLocLimitConstraint", /* struct name */ NULL, /* free data */ - NULL, /* relink data */ NULL, /* id looper */ NULL, /* copy data */ NULL, /* new data */ @@ -1457,7 +1451,6 @@ static bConstraintTypeInfo CTI_ROTLIMIT = { "Limit Rotation", /* name */ "bRotLimitConstraint", /* struct name */ NULL, /* free data */ - NULL, /* relink data */ NULL, /* id looper */ NULL, /* copy data */ NULL, /* new data */ @@ -1517,7 +1510,6 @@ static bConstraintTypeInfo CTI_SIZELIMIT = { "Limit Scaling", /* name */ "bSizeLimitConstraint", /* struct name */ NULL, /* free data */ - NULL, /* relink data */ NULL, /* id looper */ NULL, /* copy data */ NULL, /* new data */ @@ -1608,7 +1600,6 @@ static bConstraintTypeInfo CTI_LOCLIKE = { "Copy Location", /* name */ "bLocateLikeConstraint", /* struct name */ NULL, /* free data */ - NULL, /* relink data */ loclike_id_looper, /* id looper */ NULL, /* copy data */ loclike_new_data, /* new data */ @@ -1721,7 +1712,6 @@ static bConstraintTypeInfo CTI_ROTLIKE = { "Copy Rotation", /* name */ "bRotateLikeConstraint", /* struct name */ NULL, /* free data */ - NULL, /* relink data */ rotlike_id_looper, /* id looper */ NULL, /* copy data */ rotlike_new_data, /* new data */ @@ -1818,7 +1808,6 @@ static bConstraintTypeInfo CTI_SIZELIKE = { "Copy Scale", /* name */ "bSizeLikeConstraint", /* struct name */ NULL, /* free data */ - NULL, /* relink data */ sizelike_id_looper, /* id looper */ NULL, /* copy data */ sizelike_new_data, /* new data */ @@ -1880,7 +1869,6 @@ static bConstraintTypeInfo CTI_TRANSLIKE = { "Copy Transforms", /* name */ "bTransLikeConstraint", /* struct name */ NULL, /* free data */ - NULL, /* relink data */ translike_id_looper, /* id looper */ NULL, /* copy data */ NULL, /* new data */ @@ -1937,7 +1925,6 @@ static bConstraintTypeInfo CTI_SAMEVOL = { "Maintain Volume", /* name */ "bSameVolumeConstraint", /* struct name */ NULL, /* free data */ - NULL, /* relink data */ NULL, /* id looper */ NULL, /* copy data */ samevolume_new_data, /* new data */ @@ -1961,13 +1948,6 @@ static void pycon_free (bConstraint *con) BLI_freelistN(&data->targets); } -static void pycon_relink (bConstraint *con) -{ - bPythonConstraint *data= con->data; - - ID_NEW(data->text); -} - static void pycon_copy (bConstraint *con, bConstraint *srccon) { bPythonConstraint *pycon = (bPythonConstraint *)con->data; @@ -2076,7 +2056,6 @@ static bConstraintTypeInfo CTI_PYTHON = { "Script", /* name */ "bPythonConstraint", /* struct name */ pycon_free, /* free data */ - pycon_relink, /* relink data */ pycon_id_looper, /* id looper */ pycon_copy, /* copy data */ pycon_new_data, /* new data */ @@ -2088,12 +2067,6 @@ static bConstraintTypeInfo CTI_PYTHON = { /* -------- Action Constraint ----------- */ -static void actcon_relink (bConstraint *con) -{ - bActionConstraint *data= con->data; - ID_NEW(data->act); -} - static void actcon_new_data (void *cdata) { bActionConstraint *data= (bActionConstraint *)cdata; @@ -2248,7 +2221,6 @@ static bConstraintTypeInfo CTI_ACTION = { "Action", /* name */ "bActionConstraint", /* struct name */ NULL, /* free data */ - actcon_relink, /* relink data */ actcon_id_looper, /* id looper */ NULL, /* copy data */ actcon_new_data, /* new data */ @@ -2560,7 +2532,6 @@ static bConstraintTypeInfo CTI_LOCKTRACK = { "Locked Track", /* name */ "bLockTrackConstraint", /* struct name */ NULL, /* free data */ - NULL, /* relink data */ locktrack_id_looper, /* id looper */ NULL, /* copy data */ locktrack_new_data, /* new data */ @@ -2685,7 +2656,6 @@ static bConstraintTypeInfo CTI_DISTLIMIT = { "Limit Distance", /* name */ "bDistLimitConstraint", /* struct name */ NULL, /* free data */ - NULL, /* relink data */ distlimit_id_looper, /* id looper */ NULL, /* copy data */ distlimit_new_data, /* new data */ @@ -2860,7 +2830,6 @@ static bConstraintTypeInfo CTI_STRETCHTO = { "Stretch To", /* name */ "bStretchToConstraint", /* struct name */ NULL, /* free data */ - NULL, /* relink data */ stretchto_id_looper, /* id looper */ NULL, /* copy data */ stretchto_new_data, /* new data */ @@ -3005,7 +2974,6 @@ static bConstraintTypeInfo CTI_MINMAX = { "Floor", /* name */ "bMinMaxConstraint", /* struct name */ NULL, /* free data */ - NULL, /* relink data */ minmax_id_looper, /* id looper */ NULL, /* copy data */ minmax_new_data, /* new data */ @@ -3066,7 +3034,6 @@ static bConstraintTypeInfo CTI_RIGIDBODYJOINT = { "Rigid Body Joint", /* name */ "bRigidBodyJointConstraint", /* struct name */ NULL, /* free data */ - NULL, /* relink data */ rbj_id_looper, /* id looper */ NULL, /* copy data */ rbj_new_data, /* new data */ @@ -3242,7 +3209,6 @@ static bConstraintTypeInfo CTI_CLAMPTO = { "Clamp To", /* name */ "bClampToConstraint", /* struct name */ NULL, /* free data */ - NULL, /* relink data */ clampto_id_looper, /* id looper */ NULL, /* copy data */ NULL, /* new data */ @@ -3389,7 +3355,6 @@ static bConstraintTypeInfo CTI_TRANSFORM = { "Transform", /* name */ "bTransformConstraint", /* struct name */ NULL, /* free data */ - NULL, /* relink data */ transform_id_looper, /* id looper */ NULL, /* copy data */ transform_new_data, /* new data */ @@ -3547,7 +3512,6 @@ static bConstraintTypeInfo CTI_SHRINKWRAP = { "Shrinkwrap", /* name */ "bShrinkwrapConstraint", /* struct name */ NULL, /* free data */ - NULL, /* relink data */ shrinkwrap_id_looper, /* id looper */ NULL, /* copy data */ NULL, /* new data */ @@ -3675,7 +3639,6 @@ static bConstraintTypeInfo CTI_DAMPTRACK = { "Damped Track", /* name */ "bDampTrackConstraint", /* struct name */ NULL, /* free data */ - NULL, /* relink data */ damptrack_id_looper, /* id looper */ NULL, /* copy data */ damptrack_new_data, /* new data */ @@ -3773,7 +3736,6 @@ static bConstraintTypeInfo CTI_SPLINEIK = { "Spline IK", /* name */ "bSplineIKConstraint", /* struct name */ splineik_free, /* free data */ - NULL, /* relink data */ splineik_id_looper, /* id looper */ splineik_copy, /* copy data */ splineik_new_data, /* new data */ @@ -3898,7 +3860,6 @@ static bConstraintTypeInfo CTI_PIVOT = { "Pivot", /* name */ "bPivotConstraint", /* struct name */ NULL, /* free data */ - NULL, /* relink data */ pivotcon_id_looper, /* id looper */ NULL, /* copy data */ NULL, /* new data */ // XXX: might be needed to get 'normal' pivot behavior... @@ -4092,7 +4053,6 @@ static bConstraintTypeInfo CTI_FOLLOWTRACK = { "Follow Track", /* name */ "bFollowTrackConstraint", /* struct name */ NULL, /* free data */ - NULL, /* relink data */ followtrack_id_looper, /* id looper */ NULL, /* copy data */ followtrack_new_data, /* new data */ @@ -4147,7 +4107,6 @@ static bConstraintTypeInfo CTI_CAMERASOLVER = { "Camera Solver", /* name */ "bCameraSolverConstraint", /* struct name */ NULL, /* free data */ - NULL, /* relink data */ camerasolver_id_looper, /* id looper */ NULL, /* copy data */ camerasolver_new_data, /* new data */ @@ -4221,7 +4180,6 @@ static bConstraintTypeInfo CTI_OBJECTSOLVER = { "Object Solver", /* name */ "bObjectSolverConstraint", /* struct name */ NULL, /* free data */ - NULL, /* relink data */ objectsolver_id_looper, /* id looper */ NULL, /* copy data */ objectsolver_new_data, /* new data */ @@ -4318,17 +4276,31 @@ bConstraintTypeInfo *constraint_get_typeinfo (bConstraint *con) /* ---------- Data Management ------- */ +/* helper function for free_constraint_data() - unlinks references */ +static void con_unlink_refs_cb(bConstraint *UNUSED(con), ID **idpoin, short isReference, void *UNUSED(userData)) +{ + if (*idpoin && isReference) + id_us_min(*idpoin); +} + /* Free data of a specific constraint if it has any info. * be sure to run BIK_clear_data() when freeing an IK constraint, - * unless DAG_scene_sort is called. */ + * unless DAG_scene_sort is called. + */ void free_constraint_data(bConstraint *con) { if (con->data) { bConstraintTypeInfo *cti= constraint_get_typeinfo(con); - /* perform any special freeing constraint may have */ - if (cti && cti->free_data) - cti->free_data(con); + if (cti) { + /* perform any special freeing constraint may have */ + if (cti->free_data) + cti->free_data(con); + + /* unlink the referenced resources it uses */ + if (cti->id_looper) + cti->id_looper(con, con_unlink_refs_cb, NULL); + } /* free constraint data now */ MEM_freeN(con->data); @@ -4487,36 +4459,27 @@ bConstraint *add_ob_constraint(Object *ob, const char *name, short type) /* ......... */ +/* helper for relink_constraints() - call ID_NEW() on every ID reference the constraint has */ +static void con_relink_id_cb(bConstraint *UNUSED(con), ID **idpoin, short UNUSED(isReference), void *UNUSED(userdata)) +{ + /* ID_NEW() expects a struct with inline "id" member as first + * since we've got the actual ID block, let's just inline this + * code. + * + * See ID_NEW(a) in BKE_utildefines.h + */ + if ((*idpoin) && (*idpoin)->newid) + (*idpoin) = (void *)(*idpoin)->newid; +} + /* Reassign links that constraints have to other data (called during file loading?) */ void relink_constraints(ListBase *conlist) { - bConstraint *con; - bConstraintTarget *ct; - - for (con= conlist->first; con; con= con->next) { - bConstraintTypeInfo *cti= constraint_get_typeinfo(con); - - if (cti) { - /* relink any targets */ - if (cti->get_constraint_targets) { - ListBase targets = {NULL, NULL}; - - cti->get_constraint_targets(con, &targets); - for (ct= targets.first; ct; ct= ct->next) { - ID_NEW(ct->tar); - } - - if (cti->flush_constraint_targets) - cti->flush_constraint_targets(con, &targets, 0); - } - - /* relink any other special data */ - if (cti->relink_data) - cti->relink_data(con); - } - } + /* just a wrapper around ID-loop for just calling ID_NEW() on all ID refs */ + id_loop_constraints(conlist, con_relink_id_cb, NULL); } + /* Run the given callback on all ID-blocks in list of constraints */ void id_loop_constraints(ListBase *conlist, ConstraintIDFunc func, void *userdata) { diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index f4879b8d851..771ba5e98a0 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -352,7 +352,7 @@ void BKE_curve_type_test(Object *ob) BKE_curve_curve_dimension_update((Curve *)ob->data); } -void BKE_curve_tex_space_calc(Curve *cu) +void BKE_curve_texspace_calc(Curve *cu) { DispList *dl; BoundBox *bb; diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index 7bd95dfa7dd..e7226a403bb 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -674,7 +674,7 @@ void makeDispListMBall(Scene *scene, Object *ob) if (ob->type==OB_MBALL) { if (ob==BKE_metaball_basis_find(scene, ob)) { BKE_metaball_polygonize(scene, ob, &ob->disp); - BKE_metaball_tex_space_calc(ob); + BKE_metaball_texspace_calc(ob); object_deform_mball(ob, &ob->disp); } @@ -686,7 +686,7 @@ void makeDispListMBall(Scene *scene, Object *ob) void makeDispListMBall_forRender(Scene *scene, Object *ob, ListBase *dispbase) { BKE_metaball_polygonize(scene, ob, dispbase); - BKE_metaball_tex_space_calc(ob); + BKE_metaball_texspace_calc(ob); object_deform_mball(ob, dispbase); } @@ -1182,7 +1182,7 @@ void makeDispListSurf(Scene *scene, Object *ob, ListBase *dispbase, copy_displist(&cu->disp, dispbase); if (!forRender) { - BKE_curve_tex_space_calc(cu); + BKE_curve_texspace_calc(cu); } if (!forOrco) @@ -1410,7 +1410,7 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba copy_displist(&cu->disp, dispbase); if (!forRender) { - BKE_curve_tex_space_calc(cu); + BKE_curve_texspace_calc(cu); } if (!forOrco) curve_calc_modifiers_post(scene, ob, dispbase, derivedFinal, forRender, originalVerts, deformedVerts); diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index f4d9bcfd218..13cfb40a0eb 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -527,7 +527,7 @@ static void data_delete_material_index_id(ID *id, short index) { switch (GS(id->name)) { case ID_ME: - mesh_delete_material_index((Mesh *)id, index); + BKE_mesh_delete_material_index((Mesh *)id, index); break; case ID_CU: BKE_curve_delete_material_index((Curve *)id, index); diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index a841649e007..be6459bac90 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -346,7 +346,7 @@ MetaElem *BKE_metaball_element_add(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 BKE_metaball_tex_space_calc(Object *ob) +void BKE_metaball_texspace_calc(Object *ob) { DispList *dl; BoundBox *bb; diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 79bc7395d6d..f431b21b78c 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -277,7 +277,7 @@ static int customdata_compare(CustomData *c1, CustomData *c2, Mesh *m1, Mesh *m2 } /*used for testing. returns an error string the two meshes don't match*/ -const char *mesh_cmp(Mesh *me1, Mesh *me2, float thresh) +const char *BKE_mesh_cmp(Mesh *me1, Mesh *me2, float thresh) { int c; @@ -392,7 +392,7 @@ void mesh_update_customdata_pointers(Mesh *me, const short do_ensure_tess_cd) * we need a more generic method, like the expand() functions in * readfile.c */ -void unlink_mesh(Mesh *me) +void BKE_mesh_unlink(Mesh *me) { int a; @@ -415,7 +415,7 @@ void unlink_mesh(Mesh *me) void BKE_mesh_free(Mesh *me, int unlink) { if (unlink) - unlink_mesh(me); + BKE_mesh_unlink(me); CustomData_free(&me->vdata, me->totvert); CustomData_free(&me->edata, me->totedge); @@ -658,7 +658,7 @@ void BKE_mesh_make_local(Mesh *me) } } -void boundbox_mesh(Mesh *me, float *loc, float *size) +void BKE_mesh_boundbox_calc(Mesh *me, float r_loc[3], float r_size[3]) { BoundBox *bb; float min[3], max[3]; @@ -667,30 +667,30 @@ void boundbox_mesh(Mesh *me, float *loc, float *size) if (me->bb==NULL) me->bb= MEM_callocN(sizeof(BoundBox), "boundbox"); bb= me->bb; - if (!loc) loc= mloc; - if (!size) size= msize; + if (!r_loc) r_loc= mloc; + if (!r_size) r_size= msize; INIT_MINMAX(min, max); - if (!minmax_mesh(me, min, max)) { + if (!BKE_mesh_minmax(me, min, max)) { min[0] = min[1] = min[2] = -1.0f; max[0] = max[1] = max[2] = 1.0f; } - mid_v3_v3v3(loc, min, max); + mid_v3_v3v3(r_loc, min, max); - size[0]= (max[0]-min[0])/2.0f; - size[1]= (max[1]-min[1])/2.0f; - size[2]= (max[2]-min[2])/2.0f; + r_size[0]= (max[0]-min[0])/2.0f; + r_size[1]= (max[1]-min[1])/2.0f; + r_size[2]= (max[2]-min[2])/2.0f; BKE_boundbox_init_from_minmax(bb, min, max); } -void tex_space_mesh(Mesh *me) +void BKE_mesh_texspace_calc(Mesh *me) { float loc[3], size[3]; int a; - boundbox_mesh(me, loc, size); + BKE_mesh_boundbox_calc(me, loc, size); if (me->texflag & ME_AUTOSPACE) { for (a=0; a<3; a++) { @@ -705,7 +705,7 @@ void tex_space_mesh(Mesh *me) } } -BoundBox *mesh_get_bb(Object *ob) +BoundBox *BKE_mesh_boundbox_get(Object *ob) { Mesh *me= ob->data; @@ -713,15 +713,15 @@ BoundBox *mesh_get_bb(Object *ob) return ob->bb; if (!me->bb) - tex_space_mesh(me); + BKE_mesh_texspace_calc(me); return me->bb; } -void mesh_get_texspace(Mesh *me, float r_loc[3], float r_rot[3], float r_size[3]) +void BKE_mesh_texspace_get(Mesh *me, float r_loc[3], float r_rot[3], float r_size[3]) { if (!me->bb) { - tex_space_mesh(me); + BKE_mesh_texspace_calc(me); } if (r_loc) copy_v3_v3(r_loc, me->loc); @@ -729,7 +729,7 @@ void mesh_get_texspace(Mesh *me, float r_loc[3], float r_rot[3], float r_size[3] if (r_size) copy_v3_v3(r_size, me->size); } -float *get_mesh_orco_verts(Object *ob) +float *BKE_mesh_orco_verts_get(Object *ob) { Mesh *me = ob->data; MVert *mvert = NULL; @@ -749,12 +749,12 @@ float *get_mesh_orco_verts(Object *ob) return (float*)vcos; } -void transform_mesh_orco_verts(Mesh *me, float (*orco)[3], int totvert, int invert) +void BKE_mesh_orco_verts_transform(Mesh *me, float (*orco)[3], int totvert, int invert) { float loc[3], size[3]; int a; - mesh_get_texspace(me->texcomesh?me->texcomesh:me, loc, NULL, size); + BKE_mesh_texspace_get(me->texcomesh ? me->texcomesh : me, loc, NULL, size); if (invert) { for (a=0; a<totvert; a++) { @@ -962,7 +962,7 @@ static void make_edges_mdata(MVert *UNUSED(allvert), MFace *allface, MLoop *alll } final++; - (*alledge)= medge= MEM_callocN(sizeof (MEdge) * final, "make_edges mdge"); + (*alledge)= medge= MEM_callocN(sizeof (MEdge) * final, "BKE_mesh_make_edges mdge"); (*_totedge)= final; for (a=totedge, ed=edsort; a>1; a--, ed++) { @@ -1015,7 +1015,7 @@ static void make_edges_mdata(MVert *UNUSED(allvert), MFace *allface, MLoop *alll BLI_edgehash_free(hash, NULL); } -void make_edges(Mesh *me, int old) +void BKE_mesh_make_edges(Mesh *me, int old) { MEdge *medge; int totedge=0; @@ -1032,11 +1032,11 @@ void make_edges(Mesh *me, int old) me->medge= medge; me->totedge= totedge; - mesh_strip_loose_faces(me); + BKE_mesh_strip_loose_faces(me); } /* We need to keep this for edge creation (for now?), and some old readfile code... */ -void mesh_strip_loose_faces(Mesh *me) +void BKE_mesh_strip_loose_faces(Mesh *me) { MFace *f; int a, b; @@ -1060,7 +1060,7 @@ void mesh_strip_loose_faces(Mesh *me) /* Note: It won't try to guess which loops of an invalid poly to remove! * this is the work of the caller, to mark those loops... * See e.g. BKE_mesh_validate_arrays(). */ -void mesh_strip_loose_polysloops(Mesh *me) +void BKE_mesh_strip_loose_polysloops(Mesh *me) { MPoly *p; MLoop *l; @@ -1131,7 +1131,7 @@ void mesh_strip_loose_polysloops(Mesh *me) MEM_freeN(new_idx); } -void mesh_strip_loose_edges(Mesh *me) +void BKE_mesh_strip_loose_edges(Mesh *me) { MEdge *e; MLoop *l; @@ -1166,7 +1166,7 @@ void mesh_strip_loose_edges(Mesh *me) MEM_freeN(new_idx); } -void mball_to_mesh(ListBase *lb, Mesh *me) +void BKE_mesh_from_metaball(ListBase *lb, Mesh *me) { DispList *dl; MVert *mvert; @@ -1223,7 +1223,7 @@ void mball_to_mesh(ListBase *lb, Mesh *me) mesh_update_customdata_pointers(me, TRUE); - mesh_calc_normals(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL); + BKE_mesh_calc_normals(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL); BKE_mesh_calc_edges(me, TRUE); } @@ -1231,15 +1231,15 @@ void mball_to_mesh(ListBase *lb, Mesh *me) /* Initialize mverts, medges and, faces for converting nurbs to mesh and derived mesh */ /* return non-zero on error */ -int nurbs_to_mdata(Object *ob, MVert **allvert, int *totvert, - MEdge **alledge, int *totedge, MLoop **allloop, MPoly **allpoly, - int *totloop, int *totpoly) +int BKE_mesh_nurbs_to_mdata(Object *ob, MVert **allvert, int *totvert, + MEdge **alledge, int *totedge, MLoop **allloop, MPoly **allpoly, + int *totloop, int *totpoly) { - return nurbs_to_mdata_customdb(ob, &ob->disp, - allvert, totvert, - alledge, totedge, - allloop, allpoly, - totloop, totpoly); + return BKE_mesh_nurbs_to_mdata_customdb(ob, &ob->disp, + allvert, totvert, + alledge, totedge, + allloop, allpoly, + totloop, totpoly); } /* BMESH: this doesn't calculate all edges from polygons, @@ -1247,11 +1247,11 @@ int nurbs_to_mdata(Object *ob, MVert **allvert, int *totvert, /* Initialize mverts, medges and, faces for converting nurbs to mesh and derived mesh */ /* use specified dispbase */ -int nurbs_to_mdata_customdb(Object *ob, ListBase *dispbase, - MVert **allvert, int *_totvert, - MEdge **alledge, int *_totedge, - MLoop **allloop, MPoly **allpoly, - int *_totloop, int *_totpoly) +int BKE_mesh_nurbs_to_mdata_customdb(Object *ob, ListBase *dispbase, + MVert **allvert, int *_totvert, + MEdge **alledge, int *_totedge, + MLoop **allloop, MPoly **allpoly, + int *_totloop, int *_totpoly) { DispList *dl; Curve *cu; @@ -1467,7 +1467,7 @@ int nurbs_to_mdata_customdb(Object *ob, ListBase *dispbase, } /* this may fail replacing ob->data, be sure to check ob->type */ -void nurbs_to_mesh(Object *ob) +void BKE_mesh_from_nurbs(Object *ob) { Main *bmain= G.main; Object *ob1; @@ -1483,7 +1483,10 @@ void nurbs_to_mesh(Object *ob) cu= ob->data; if (dm == NULL) { - if (nurbs_to_mdata(ob, &allvert, &totvert, &alledge, &totedge, &allloop, &allpoly, &totloop, &totpoly) != 0) { + if (BKE_mesh_nurbs_to_mdata(ob, &allvert, &totvert, + &alledge, &totedge, &allloop, + &allpoly, &totloop, &totpoly) != 0) + { /* Error initializing */ return; } @@ -1500,7 +1503,7 @@ void nurbs_to_mesh(Object *ob) me->mloop= CustomData_add_layer(&me->ldata, CD_MLOOP, CD_ASSIGN, allloop, me->totloop); me->mpoly= CustomData_add_layer(&me->pdata, CD_MPOLY, CD_ASSIGN, allpoly, me->totpoly); - mesh_calc_normals(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL); + BKE_mesh_calc_normals(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL); BKE_mesh_calc_edges(me, TRUE); } @@ -1512,7 +1515,7 @@ void nurbs_to_mesh(Object *ob) me->totcol= cu->totcol; me->mat= cu->mat; - tex_space_mesh(me); + BKE_mesh_texspace_calc(me); cu->mat= NULL; cu->totcol= 0; @@ -1560,7 +1563,7 @@ static void appendPolyLineVert(ListBase *lb, unsigned int index) BLI_addtail(lb, vl); } -void mesh_to_curve(Scene *scene, Object *ob) +void BKE_mesh_from_curve(Scene *scene, Object *ob) { /* make new mesh data from the original copy */ DerivedMesh *dm= mesh_get_derived_final(scene, ob, CD_MASK_MESH); @@ -1732,7 +1735,7 @@ void mesh_to_curve(Scene *scene, Object *ob) } } -void mesh_delete_material_index(Mesh *me, short index) +void BKE_mesh_delete_material_index(Mesh *me, short index) { int i; @@ -1749,7 +1752,7 @@ void mesh_delete_material_index(Mesh *me, short index) } } -void mesh_set_smooth_flag(Object *meshOb, int enableSmooth) +void BKE_mesh_smooth_flag_set(Object *meshOb, int enableSmooth) { Mesh *me = meshOb->data; int i; @@ -1777,16 +1780,16 @@ void mesh_set_smooth_flag(Object *meshOb, int enableSmooth) } } -void mesh_calc_normals_mapping(MVert *mverts, int numVerts, +void BKE_mesh_calc_normals_mapping(MVert *mverts, int numVerts, MLoop *mloop, MPoly *mpolys, int numLoops, int numPolys, float (*polyNors_r)[3], MFace *mfaces, int numFaces, int *origIndexFace, float (*faceNors_r)[3]) { - mesh_calc_normals_mapping_ex(mverts, numVerts, mloop, mpolys, - numLoops, numPolys, polyNors_r, mfaces, numFaces, - origIndexFace, faceNors_r, TRUE); + BKE_mesh_calc_normals_mapping_ex(mverts, numVerts, mloop, mpolys, + numLoops, numPolys, polyNors_r, mfaces, numFaces, + origIndexFace, faceNors_r, FALSE); } -void mesh_calc_normals_mapping_ex(MVert *mverts, int numVerts, +void BKE_mesh_calc_normals_mapping_ex(MVert *mverts, int numVerts, MLoop *mloop, MPoly *mpolys, int numLoops, int numPolys, float (*polyNors_r)[3], MFace *mfaces, int numFaces, int *origIndexFace, float (*faceNors_r)[3], @@ -1814,7 +1817,7 @@ void mesh_calc_normals_mapping_ex(MVert *mverts, int numVerts, if (only_face_normals == FALSE) { /* vertex normals are optional, they require some extra calculations, * so make them optional */ - mesh_calc_normals(mverts, numVerts, mloop, mpolys, numLoops, numPolys, pnors); + BKE_mesh_calc_normals(mverts, numVerts, mloop, mpolys, numLoops, numPolys, pnors); } else { /* only calc poly normals */ @@ -1836,7 +1839,7 @@ void mesh_calc_normals_mapping_ex(MVert *mverts, int numVerts, } else { /* eek, we're not corresponding to polys */ - printf("error in mesh_calc_normals; tessellation face indices are incorrect. normals may look bad.\n"); + printf("error in BKE_mesh_calc_normals; tessellation face indices are incorrect. normals may look bad.\n"); } } } @@ -1848,8 +1851,8 @@ void mesh_calc_normals_mapping_ex(MVert *mverts, int numVerts, } -void mesh_calc_normals(MVert *mverts, int numVerts, MLoop *mloop, MPoly *mpolys, - int UNUSED(numLoops), int numPolys, float (*polyNors_r)[3]) +void BKE_mesh_calc_normals(MVert *mverts, int numVerts, MLoop *mloop, MPoly *mpolys, + int UNUSED(numLoops), int numPolys, float (*polyNors_r)[3]) { float (*pnors)[3] = polyNors_r; @@ -1910,7 +1913,7 @@ void mesh_calc_normals(MVert *mverts, int numVerts, MLoop *mloop, MPoly *mpolys, if (pnors != polyNors_r) MEM_freeN(pnors); } -void mesh_calc_normals_tessface(MVert *mverts, int numVerts, MFace *mfaces, int numFaces, float (*faceNors_r)[3]) +void BKE_mesh_calc_normals_tessface(MVert *mverts, int numVerts, MFace *mfaces, int numFaces, float (*faceNors_r)[3]) { float (*tnorms)[3]= MEM_callocN(numVerts*sizeof(*tnorms), "tnorms"); float (*fnors)[3]= (faceNors_r)? faceNors_r: MEM_callocN(sizeof(*fnors)*numFaces, "meshnormals"); @@ -2132,7 +2135,7 @@ float (*mesh_getVertexCos(Mesh *me, int *numVerts_r))[3] /* this replaces the non bmesh function (in trunk) which takes MTFace's, if we ever need it back we could * but for now this replaces it because its unused. */ -UvVertMap *make_uv_vert_map(struct MPoly *mpoly, struct MLoop *mloop, struct MLoopUV *mloopuv, unsigned int totpoly, unsigned int totvert, int selected, float *limit) +UvVertMap *BKE_mesh_uv_vert_map_make(struct MPoly *mpoly, struct MLoop *mloop, struct MLoopUV *mloopuv, unsigned int totpoly, unsigned int totvert, int selected, float *limit) { UvVertMap *vmap; UvMapVert *buf; @@ -2159,7 +2162,7 @@ UvVertMap *make_uv_vert_map(struct MPoly *mpoly, struct MLoop *mloop, struct MLo buf= vmap->buf= (UvMapVert*)MEM_callocN(sizeof(*vmap->buf)*totuv, "UvMapVert"); if (!vmap->vert || !vmap->buf) { - free_uv_vert_map(vmap); + BKE_mesh_uv_vert_map_free(vmap); return NULL; } @@ -2223,12 +2226,12 @@ UvVertMap *make_uv_vert_map(struct MPoly *mpoly, struct MLoop *mloop, struct MLo return vmap; } -UvMapVert *get_uv_map_vert(UvVertMap *vmap, unsigned int v) +UvMapVert *BKE_mesh_uv_vert_map_get_vert(UvVertMap *vmap, unsigned int v) { return vmap->vert[v]; } -void free_uv_vert_map(UvVertMap *vmap) +void BKE_mesh_uv_vert_map_free(UvVertMap *vmap) { if (vmap) { if (vmap->vert) MEM_freeN(vmap->vert); @@ -2302,17 +2305,17 @@ void create_vert_edge_map(ListBase **map, IndexNode **mem, const MEdge *medge, c } } -void mesh_loops_to_mface_corners(CustomData *fdata, CustomData *ldata, - CustomData *pdata, int lindex[4], int findex, - const int polyindex, - const int mf_len, /* 3 or 4 */ +void BKE_mesh_loops_to_mface_corners(CustomData *fdata, CustomData *ldata, + CustomData *pdata, int lindex[4], int findex, + const int polyindex, + const int mf_len, /* 3 or 4 */ - /* cache values to avoid lookups every time */ - const int numTex, /* CustomData_number_of_layers(pdata, CD_MTEXPOLY) */ - const int numCol, /* CustomData_number_of_layers(ldata, CD_MLOOPCOL) */ - const int hasPCol, /* CustomData_has_layer(ldata, CD_PREVIEW_MLOOPCOL) */ - const int hasOrigSpace /* CustomData_has_layer(ldata, CD_ORIGSPACE_MLOOP) */ - ) + /* cache values to avoid lookups every time */ + const int numTex, /* CustomData_number_of_layers(pdata, CD_MTEXPOLY) */ + const int numCol, /* CustomData_number_of_layers(ldata, CD_MLOOPCOL) */ + const int hasPCol, /* CustomData_has_layer(ldata, CD_PREVIEW_MLOOPCOL) */ + const int hasOrigSpace /* CustomData_has_layer(ldata, CD_ORIGSPACE_MLOOP) */ + ) { MTFace *texface; MTexPoly *texpoly; @@ -2366,7 +2369,7 @@ void mesh_loops_to_mface_corners(CustomData *fdata, CustomData *ldata, * this function recreates a tessellation. * returns number of tessellation faces. */ -int mesh_recalcTessellation(CustomData *fdata, +int BKE_mesh_recalc_tessellation(CustomData *fdata, CustomData *ldata, CustomData *pdata, MVert *mvert, int totface, int UNUSED(totloop), int totpoly, @@ -2618,14 +2621,14 @@ int mesh_recalcTessellation(CustomData *fdata, if (mf_len == 4) mf->v4 = mloop[mf->v4].v; #endif - mesh_loops_to_mface_corners(fdata, ldata, pdata, - lindex, mface_index, mface_to_poly_map[mface_index], + BKE_mesh_loops_to_mface_corners(fdata, ldata, pdata, + lindex, mface_index, mface_to_poly_map[mface_index], #ifdef USE_TESSFACE_QUADS - mf_len, + mf_len, #else - 3, + 3, #endif - numTex, numCol, hasPCol, hasOrigSpace); + numTex, numCol, hasPCol, hasOrigSpace); #ifdef USE_TESSFACE_QUADS @@ -2647,7 +2650,7 @@ int mesh_recalcTessellation(CustomData *fdata, * this function recreates a tessellation. * returns number of tessellation faces. */ -int mesh_mpoly_to_mface(struct CustomData *fdata, struct CustomData *ldata, +int BKE_mesh_mpoly_to_mface(struct CustomData *fdata, struct CustomData *ldata, struct CustomData *pdata, int totface, int UNUSED(totloop), int totpoly) { MLoop *mloop; @@ -2719,9 +2722,9 @@ int mesh_mpoly_to_mface(struct CustomData *fdata, struct CustomData *ldata, mf->v2 = mloop[mf->v2].v; mf->v3 = mloop[mf->v3].v; - mesh_loops_to_mface_corners(fdata, ldata, pdata, - lindex, k, i, 3, - numTex, numCol, hasPCol, hasOrigSpace); + BKE_mesh_loops_to_mface_corners(fdata, ldata, pdata, + lindex, k, i, 3, + numTex, numCol, hasPCol, hasOrigSpace); test_index_face(mf, fdata, k, 3); } else { @@ -2739,9 +2742,9 @@ int mesh_mpoly_to_mface(struct CustomData *fdata, struct CustomData *ldata, mf->v3 = mloop[mf->v3].v; mf->v4 = mloop[mf->v4].v; - mesh_loops_to_mface_corners(fdata, ldata, pdata, - lindex, k, i, 4, - numTex, numCol, hasPCol, hasOrigSpace); + BKE_mesh_loops_to_mface_corners(fdata, ldata, pdata, + lindex, k, i, 4, + numTex, numCol, hasPCol, hasOrigSpace); test_index_face(mf, fdata, k, 4); } @@ -2907,7 +2910,7 @@ static void mesh_calc_ngon_normal_coords(MPoly *mpoly, MLoop *loopstart, normal[2] = (float) n[2]; } -void mesh_calc_poly_normal_coords(MPoly *mpoly, MLoop *loopstart, +void BKE_mesh_calc_poly_normal_coords(MPoly *mpoly, MLoop *loopstart, const float (*vertex_coords)[3], float no[3]) { if (mpoly->totloop > 4) { @@ -2948,7 +2951,7 @@ static void mesh_calc_ngon_center(MPoly *mpoly, MLoop *loopstart, } } -void mesh_calc_poly_center(MPoly *mpoly, MLoop *loopstart, +void BKE_mesh_calc_poly_center(MPoly *mpoly, MLoop *loopstart, MVert *mvarray, float cent[3]) { if (mpoly->totloop == 3) { @@ -2972,7 +2975,7 @@ void mesh_calc_poly_center(MPoly *mpoly, MLoop *loopstart, } /* note, passing polynormal is only a speedup so we can skip calculating it */ -float mesh_calc_poly_area(MPoly *mpoly, MLoop *loopstart, +float BKE_mesh_calc_poly_area(MPoly *mpoly, MLoop *loopstart, MVert *mvarray, float polynormal[3]) { if (mpoly->totloop == 3) { @@ -3052,7 +3055,7 @@ int poly_get_adj_loops_from_vert(unsigned adj_r[3], const MPoly *poly, /* update the hide flag for edges and faces from the corresponding * flag in verts */ -void mesh_flush_hidden_from_verts(const MVert *mvert, +void BKE_mesh_flush_hidden_from_verts(const MVert *mvert, const MLoop *mloop, MEdge *medge, int totedge, MPoly *mpoly, int totpoly) @@ -3081,18 +3084,18 @@ void mesh_flush_hidden_from_verts(const MVert *mvert, } /* basic vertex data functions */ -int minmax_mesh(Mesh *me, float min[3], float max[3]) +int BKE_mesh_minmax(Mesh *me, float r_min[3], float r_max[3]) { - int i= me->totvert; + int i = me->totvert; MVert *mvert; - for (mvert= me->mvert; i--; mvert++) { - DO_MINMAX(mvert->co, min, max); + for (mvert = me->mvert; i--; mvert++) { + DO_MINMAX(mvert->co, r_min, r_max); } return (me->totvert != 0); } -int mesh_center_median(Mesh *me, float cent[3]) +int BKE_mesh_center_median(Mesh *me, float cent[3]) { int i= me->totvert; MVert *mvert; @@ -3108,11 +3111,11 @@ int mesh_center_median(Mesh *me, float cent[3]) return (me->totvert != 0); } -int mesh_center_bounds(Mesh *me, float cent[3]) +int BKE_mesh_center_bounds(Mesh *me, float cent[3]) { float min[3], max[3]; INIT_MINMAX(min, max); - if (minmax_mesh(me, min, max)) { + if (BKE_mesh_minmax(me, min, max)) { mid_v3_v3v3(cent, min, max); return 1; } @@ -3120,7 +3123,7 @@ int mesh_center_bounds(Mesh *me, float cent[3]) return 0; } -void mesh_translate(Mesh *me, float offset[3], int do_keys) +void BKE_mesh_translate(Mesh *me, float offset[3], int do_keys) { int i= me->totvert; MVert *mvert; @@ -3157,7 +3160,7 @@ void BKE_mesh_ensure_navmesh(Mesh *me) void BKE_mesh_tessface_calc(Mesh *mesh) { - mesh->totface = mesh_recalcTessellation(&mesh->fdata, &mesh->ldata, &mesh->pdata, + mesh->totface = BKE_mesh_recalc_tessellation(&mesh->fdata, &mesh->ldata, &mesh->pdata, mesh->mvert, mesh->totface, mesh->totloop, mesh->totpoly, /* calc normals right after, don't copy from polys here */ diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c index 446ad399e11..1645a8c9c9b 100644 --- a/source/blender/blenkernel/intern/mesh_validate.c +++ b/source/blender/blenkernel/intern/mesh_validate.c @@ -536,11 +536,11 @@ int BKE_mesh_validate_arrays(Mesh *mesh, if (mesh) { if (do_polyloop_free) { - mesh_strip_loose_polysloops(mesh); + BKE_mesh_strip_loose_polysloops(mesh); } if (do_edge_free) { - mesh_strip_loose_edges(mesh); + BKE_mesh_strip_loose_edges(mesh); } if (do_edge_recalc) { diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 98cbc957201..5b824c04836 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -416,6 +416,7 @@ ModifierData *modifiers_getLastPreview(struct Scene *scene, ModifierData *md, in return tmp_md; } +/* NOTE: these aren't used anymore */ ModifierData *modifiers_getVirtualModifierList(Object *ob) { /* Kinda hacky, but should be fine since we are never diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index e432428eae4..35ee0549554 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -779,7 +779,7 @@ void multiresModifier_base_apply(MultiresModifierData *mmd, Object *ob) float no[3]; /* set up poly, loops, and coords in order to call - * mesh_calc_poly_normal_coords() */ + * BKE_mesh_calc_poly_normal_coords() */ fake_poly.totloop = p->totloop; fake_poly.loopstart = 0; fake_loops = MEM_mallocN(sizeof(MLoop) * p->totloop, "fake_loops"); @@ -796,8 +796,8 @@ void multiresModifier_base_apply(MultiresModifierData *mmd, Object *ob) copy_v3_v3(fake_co[k], origco[vndx]); } - mesh_calc_poly_normal_coords(&fake_poly, fake_loops, - (const float(*)[3])fake_co, no); + BKE_mesh_calc_poly_normal_coords(&fake_poly, fake_loops, + (const float(*)[3])fake_co, no); MEM_freeN(fake_loops); MEM_freeN(fake_co); diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index c04fdc4f410..fae96a732a7 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -299,7 +299,7 @@ void BKE_object_free(Object *ob) ID *id= ob->data; id->us--; if (id->us==0) { - if (ob->type==OB_MESH) unlink_mesh(ob->data); + if (ob->type==OB_MESH) BKE_mesh_unlink(ob->data); else if (ob->type==OB_CURVE) BKE_curve_unlink(ob->data); else if (ob->type==OB_MBALL) BKE_metaball_unlink(ob->data); } @@ -2177,7 +2177,7 @@ BoundBox *BKE_object_boundbox_get(Object *ob) BoundBox *bb= NULL; if (ob->type==OB_MESH) { - bb = mesh_get_bb(ob); + bb = BKE_mesh_boundbox_get(ob); } else if (ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) { bb= ob->bb ? ob->bb : ((Curve *)ob->data )->bb; @@ -2251,7 +2251,7 @@ void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3]) { Curve *cu= ob->data; - if (cu->bb==NULL) BKE_curve_tex_space_calc(cu); + if (cu->bb==NULL) BKE_curve_texspace_calc(cu); bb= *(cu->bb); for (a=0; a<8; a++) { @@ -2295,7 +2295,7 @@ void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3]) Mesh *me= BKE_mesh_from_object(ob); if (me) { - bb = *mesh_get_bb(ob); + bb = *BKE_mesh_boundbox_get(ob); for (a=0; a<8; a++) { mul_m4_v3(ob->obmat, bb.vec[a]); diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 0e56839a6e9..2a8a4ebc34b 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -863,7 +863,7 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot) mul_v3_fl(facecenter[a], 1.0f/facetotvert[a]); /* for conversion from BU area / pixel area to reference screen size */ - mesh_get_texspace(me, 0, 0, size); + BKE_mesh_texspace_get(me, 0, 0, size); fac= ((size[0] + size[1] + size[2])/3.0f)/part->simplify_refsize; fac= fac*fac; @@ -3385,7 +3385,7 @@ static void psys_face_mat(Object *ob, DerivedMesh *dm, ParticleData *pa, float m /* ugly hack to use non-transformed orcos, since only those * give symmetric results for mirroring in particle mode */ if (DM_get_vert_data_layer(dm, CD_ORIGINDEX)) - transform_mesh_orco_verts(ob->data, v, 3, 1); + BKE_mesh_orco_verts_transform(ob->data, v, 3, 1); } else { dm->getVertCo(dm, mface->v1, v[0]); @@ -3414,7 +3414,7 @@ void psys_mat_hair_to_orco(Object *ob, DerivedMesh *dm, short from, ParticleData /* see psys_face_mat for why this function is called */ if (DM_get_vert_data_layer(dm, CD_ORIGINDEX)) - transform_mesh_orco_verts(ob->data, &orco, 1, 1); + BKE_mesh_orco_verts_transform(ob->data, &orco, 1, 1); copy_v3_v3(hairmat[3], orco); } diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index b89daea1249..2af1645bba5 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -772,7 +772,7 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch int w, maxw; psys_particle_on_dm(ctx->dm, from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, co1, 0, 0, 0, orco1, 0); - transform_mesh_orco_verts((Mesh*)ob->data, &orco1, 1, 1); + BKE_mesh_orco_verts_transform((Mesh*)ob->data, &orco1, 1, 1); maxw = BLI_kdtree_find_n_nearest(ctx->tree, 3, orco1, NULL, ptn); for (w=0; w<maxw; w++) { @@ -895,7 +895,7 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch float pweight[10]; psys_particle_on_dm(dm, cfrom, cpa->num, DMCACHE_ISCHILD, cpa->fuv, cpa->foffset, co1, nor1, NULL, NULL, orco1, NULL); - transform_mesh_orco_verts((Mesh*)ob->data, &orco1, 1, 1); + BKE_mesh_orco_verts_transform((Mesh*)ob->data, &orco1, 1, 1); maxw = BLI_kdtree_find_n_nearest(ctx->tree, 4, orco1, NULL, ptn); maxd=ptn[maxw-1].dist; @@ -1085,7 +1085,7 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D for (p=0, pa=psys->particles; p<totpart; p++, pa++) { psys_particle_on_dm(dm, part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, co, nor, 0, 0, orco, ornor); - transform_mesh_orco_verts((Mesh*)ob->data, &orco, 1, 1); + BKE_mesh_orco_verts_transform((Mesh*)ob->data, &orco, 1, 1); BLI_kdtree_insert(tree, p, orco, ornor); } @@ -1106,7 +1106,7 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D } /* we need orco for consistent distributions */ - DM_add_vert_layer(dm, CD_ORCO, CD_ASSIGN, get_mesh_orco_verts(ob)); + DM_add_vert_layer(dm, CD_ORCO, CD_ASSIGN, BKE_mesh_orco_verts_get(ob)); if (from == PART_FROM_VERT) { MVert *mv= dm->getVertDataArray(dm, CD_MVERT); @@ -1118,7 +1118,7 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D for (p=0; p<totvert; p++) { if (orcodata) { copy_v3_v3(co, orcodata[p]); - transform_mesh_orco_verts((Mesh*)ob->data, &co, 1, 1); + BKE_mesh_orco_verts_transform((Mesh*)ob->data, &co, 1, 1); } else copy_v3_v3(co, mv[p].co); @@ -1165,12 +1165,12 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D copy_v3_v3(co1, orcodata[mf->v1]); copy_v3_v3(co2, orcodata[mf->v2]); copy_v3_v3(co3, orcodata[mf->v3]); - transform_mesh_orco_verts((Mesh*)ob->data, &co1, 1, 1); - transform_mesh_orco_verts((Mesh*)ob->data, &co2, 1, 1); - transform_mesh_orco_verts((Mesh*)ob->data, &co3, 1, 1); + BKE_mesh_orco_verts_transform((Mesh*)ob->data, &co1, 1, 1); + BKE_mesh_orco_verts_transform((Mesh*)ob->data, &co2, 1, 1); + BKE_mesh_orco_verts_transform((Mesh*)ob->data, &co3, 1, 1); if (mf->v4) { copy_v3_v3(co4, orcodata[mf->v4]); - transform_mesh_orco_verts((Mesh*)ob->data, &co4, 1, 1); + BKE_mesh_orco_verts_transform((Mesh*)ob->data, &co4, 1, 1); } } else { diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index ddc605eb3e0..99880cd659f 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -244,7 +244,7 @@ static void get_face_uv_map_vert(UvVertMap *vmap, struct MPoly *mpoly, struct ML int j, nverts = mpoly[fi].totloop; for (j = 0; j < nverts; j++) { - for (nv = v = get_uv_map_vert(vmap, ml[j].v); v; v = v->next) { + for (nv = v = BKE_mesh_uv_vert_map_get_vert(vmap, ml[j].v); v; v = v->next) { if (v->separate) nv = v; if (v->f == fi) @@ -273,7 +273,7 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm, float uv[3] = {0.0f, 0.0f, 0.0f}; /* only first 2 values are written into */ limit[0] = limit[1] = STD_UV_CONNECT_LIMIT; - vmap = make_uv_vert_map(mpoly, mloop, mloopuv, totface, totvert, 0, limit); + vmap = BKE_mesh_uv_vert_map_make(mpoly, mloop, mloopuv, totface, totvert, 0, limit); if (!vmap) return 0; @@ -281,16 +281,16 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm, /* create vertices */ for (i = 0; i < totvert; i++) { - if (!get_uv_map_vert(vmap, i)) + if (!BKE_mesh_uv_vert_map_get_vert(vmap, i)) continue; - for (v = get_uv_map_vert(vmap, i)->next; v; v = v->next) + for (v = BKE_mesh_uv_vert_map_get_vert(vmap, i)->next; v; v = v->next) if (v->separate) break; seam = (v != NULL) || ((mvert + i)->flag & ME_VERT_MERGED); - for (v = get_uv_map_vert(vmap, i); v; v = v->next) { + for (v = BKE_mesh_uv_vert_map_get_vert(vmap, i); v; v = v->next) { if (v->separate) { CCGVert *ssv; int loopid = mpoly[v->f].loopstart + v->tfindex; @@ -358,7 +358,7 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm, BLI_array_free(fverts); - free_uv_vert_map(vmap); + BKE_mesh_uv_vert_map_free(vmap); ccgSubSurf_processSync(ss); return 1; diff --git a/source/blender/blenlib/intern/pbvh.c b/source/blender/blenlib/intern/pbvh.c index 8ab55f9ac85..4ad350c7786 100644 --- a/source/blender/blenlib/intern/pbvh.c +++ b/source/blender/blenlib/intern/pbvh.c @@ -35,8 +35,8 @@ #include "BLI_pbvh.h" #include "BKE_DerivedMesh.h" -#include "BKE_mesh.h" /* for mesh_calc_normals */ -#include "BKE_global.h" /* for mesh_calc_normals */ +#include "BKE_mesh.h" /* for BKE_mesh_calc_normals */ +#include "BKE_global.h" /* for BKE_mesh_calc_normals */ #include "BKE_paint.h" #include "BKE_subsurf.h" @@ -1743,7 +1743,7 @@ void BLI_pbvh_apply_vertCos(PBVH *pbvh, float (*vertCos)[3]) } /* coordinates are new -- normals should also be updated */ - mesh_calc_normals_tessface(pbvh->verts, pbvh->totvert, pbvh->faces, pbvh->totprim, NULL); + BKE_mesh_calc_normals_tessface(pbvh->verts, pbvh->totvert, pbvh->faces, pbvh->totprim, NULL); for (a= 0; a < pbvh->totnode; ++a) BLI_pbvh_node_mark_update(&pbvh->nodes[a]); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 479b45b82a3..04585b726f3 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -3794,7 +3794,7 @@ static void direct_link_mdisps(FileData *fd, int count, MDisps *mdisps, int exte * overwritten with the correct value in * bm_corners_to_loops() */ float gridsize = sqrtf(mdisps[i].totdisp); - mdisps[i].level = (int)(logf(gridsize - 1.0f) / M_LN2) + 1; + mdisps[i].level = (int)(logf(gridsize - 1.0f) / (float)M_LN2) + 1; } if ( (fd->flags & FD_FLAGS_SWITCH_ENDIAN) && (mdisps[i].disps) ) { @@ -3893,7 +3893,7 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh) if (mesh->mpoly) { /* be clever and load polygons as mfaces */ - mesh->totface= mesh_mpoly_to_mface(&mesh->fdata, &mesh->ldata, &mesh->pdata, + mesh->totface= BKE_mesh_mpoly_to_mface(&mesh->fdata, &mesh->ldata, &mesh->pdata, mesh->totface, mesh->totloop, mesh->totpoly); CustomData_free(&mesh->pdata, mesh->totpoly); @@ -13386,7 +13386,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) { Lamp *la; for (la= main->lamp.first; la; la= la->id.next) { - if (la->shadow_frustum_size == 0.0) + if (la->shadow_frustum_size == 0.0f) la->shadow_frustum_size= 10.0f; } } diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 3e2c140d6d2..0c44c631511 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -1784,8 +1784,8 @@ static void write_meshs(WriteData *wd, ListBase *idbase) /* now fill in polys to mfaces*/ - mesh->totface= mesh_mpoly_to_mface(&mesh->fdata, &backup_mesh.ldata, &backup_mesh.pdata, - mesh->totface, backup_mesh.totloop, backup_mesh.totpoly); + mesh->totface = BKE_mesh_mpoly_to_mface(&mesh->fdata, &backup_mesh.ldata, &backup_mesh.pdata, + mesh->totface, backup_mesh.totloop, backup_mesh.totpoly); mesh_update_customdata_pointers(mesh, FALSE); diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp index 5560a80f68e..f59dfbc5d30 100644 --- a/source/blender/collada/MeshImporter.cpp +++ b/source/blender/collada/MeshImporter.cpp @@ -732,7 +732,13 @@ void MeshImporter::bmeshConversion() for (std::map<COLLADAFW::UniqueId, Mesh*>::iterator m = uid_mesh_map.begin(); m != uid_mesh_map.end(); ++m) { - if ((*m).second) BKE_mesh_convert_mfaces_to_mpolys((*m).second); + if ((*m).second) { + Mesh *me = (*m).second; + BKE_mesh_convert_mfaces_to_mpolys(me); + BKE_mesh_tessface_clear(me); + + BKE_mesh_calc_normals_mapping(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL, NULL, 0, NULL, NULL); + } } } @@ -970,7 +976,7 @@ bool MeshImporter::write_geometry(const COLLADAFW::Geometry* geom) read_faces(mesh, me, new_tris); - make_edges(me, 0); + BKE_mesh_make_edges(me, 0); mesh_calc_normals_mapping(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL, NULL, 0, NULL, NULL); diff --git a/source/blender/collada/SkinInfo.cpp b/source/blender/collada/SkinInfo.cpp index 75cec3337e8..eaabecda216 100644 --- a/source/blender/collada/SkinInfo.cpp +++ b/source/blender/collada/SkinInfo.cpp @@ -218,7 +218,8 @@ void SkinInfo::link_armature(bContext *C, Object *ob, std::map<COLLADAFW::Unique Scene *scene = CTX_data_scene(C); ModifierData *md = ED_object_modifier_add(NULL, bmain, scene, ob, NULL, eModifierType_Armature); - ((ArmatureModifierData *)md)->object = ob_arm; + ArmatureModifierData *amd = (ArmatureModifierData *)md; + amd->object = ob_arm; copy_m4_m4(ob->obmat, bind_shape_matrix); BKE_object_apply_mat4(ob, ob->obmat, 0, 0); @@ -239,7 +240,7 @@ void SkinInfo::link_armature(bContext *C, Object *ob, std::map<COLLADAFW::Unique WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); #endif - ((bArmature*)ob_arm->data)->deformflag = ARM_DEF_VGROUP; + amd->deformflag = ARM_DEF_VGROUP; // create all vertex groups std::vector<JointData>::iterator it; diff --git a/source/blender/editors/armature/armature_intern.h b/source/blender/editors/armature/armature_intern.h index 72d261ec187..11129f34f3e 100644 --- a/source/blender/editors/armature/armature_intern.h +++ b/source/blender/editors/armature/armature_intern.h @@ -117,6 +117,7 @@ void POSE_OT_group_select(struct wmOperatorType *ot); void POSE_OT_group_deselect(struct wmOperatorType *ot); void POSE_OT_paths_calculate(struct wmOperatorType *ot); +void POSE_OT_paths_update(struct wmOperatorType *ot); void POSE_OT_paths_clear(struct wmOperatorType *ot); void POSE_OT_autoside_names(struct wmOperatorType *ot); diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c index 9a15a100179..d7814e1eb4c 100644 --- a/source/blender/editors/armature/armature_ops.c +++ b/source/blender/editors/armature/armature_ops.c @@ -133,6 +133,7 @@ void ED_operatortypes_armature(void) WM_operatortype_append(POSE_OT_group_deselect); WM_operatortype_append(POSE_OT_paths_calculate); + WM_operatortype_append(POSE_OT_paths_update); WM_operatortype_append(POSE_OT_paths_clear); WM_operatortype_append(POSE_OT_autoside_names); diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index 15d2d32c073..2ed5421e8ba 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -197,6 +197,7 @@ void ED_pose_recalculate_paths(Scene *scene, Object *ob) BLI_freelistN(&targets); } + /* show popup to determine settings */ static int pose_calculate_paths_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { @@ -291,6 +292,41 @@ void POSE_OT_paths_calculate(wmOperatorType *ot) /* --------- */ +static int pose_update_paths_exec(bContext *C, wmOperator *UNUSED(op)) +{ + Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C)); + Scene *scene = CTX_data_scene(C); + + if (ELEM(NULL, ob, scene)) + return OPERATOR_CANCELLED; + + /* calculate the bones that now have motionpaths... */ + // TODO: only make for the selected bones? + ED_pose_recalculate_paths(scene, ob); + + /* notifiers for updates */ + WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob); + + return OPERATOR_FINISHED; +} + +void POSE_OT_paths_update(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Update Bone Paths"; + ot->idname = "POSE_OT_paths_update"; + ot->description = "Recalculate paths for bones that already have them"; + + /* api callbakcs */ + ot->exec = pose_update_paths_exec; + ot->poll = ED_operator_posemode; /* TODO: this should probably check for active bone and/or existing paths */ + + /* flags */ + ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; +} + +/* --------- */ + /* for the object with pose/action: clear path curves for selected bones only */ static void ED_pose_clear_paths(Object *ob) { diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index 75e220395db..b465e729ea2 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -611,7 +611,7 @@ UvVertMap *EDBM_uv_vert_map_create(BMEditMesh *em, int selected, int do_face_idx buf = vmap->buf = (UvMapVert *)MEM_callocN(sizeof(*vmap->buf) * totuv, "UvMapVert"); if (!vmap->vert || !vmap->buf) { - free_uv_vert_map(vmap); + BKE_mesh_uv_vert_map_free(vmap); if (do_face_idx_array) EDBM_index_arrays_free(em); return NULL; diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index d38c7e8da1e..a303c49147f 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -808,16 +808,16 @@ void ED_mesh_update(Mesh *mesh, bContext *C, int calc_edges, int calc_tessface) * contain the normal of the poly the face was tessellated from. */ face_nors = CustomData_add_layer(&mesh->fdata, CD_NORMAL, CD_CALLOC, NULL, mesh->totface); - mesh_calc_normals_mapping_ex(mesh->mvert, mesh->totvert, - mesh->mloop, mesh->mpoly, - mesh->totloop, mesh->totpoly, - NULL /* polyNors_r */, - mesh->mface, mesh->totface, - polyindex, face_nors, FALSE); + BKE_mesh_calc_normals_mapping_ex(mesh->mvert, mesh->totvert, + mesh->mloop, mesh->mpoly, + mesh->totloop, mesh->totpoly, + NULL /* polyNors_r */, + mesh->mface, mesh->totface, + polyindex, face_nors, FALSE); #else - mesh_calc_normals(mesh->mvert, mesh->totvert, - mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly, - NULL); + BKE_mesh_calc_normals(mesh->mvert, mesh->totvert, + mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly, + NULL); (void)polyindex; (void)face_nors; #endif @@ -1138,13 +1138,13 @@ void ED_mesh_polys_add(Mesh *mesh, ReportList *reports, int count) void ED_mesh_calc_normals(Mesh *mesh) { #ifdef USE_BMESH_MPOLY_NORMALS - mesh_calc_normals_mapping_ex(mesh->mvert, mesh->totvert, - mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly, - NULL, NULL, 0, NULL, NULL, FALSE); + BKE_mesh_calc_normals_mapping_ex(mesh->mvert, mesh->totvert, + mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly, + NULL, NULL, 0, NULL, NULL, FALSE); #else - mesh_calc_normals(mesh->mvert, mesh->totvert, - mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly, - NULL); + BKE_mesh_calc_normals(mesh->mvert, mesh->totvert, + mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly, + NULL); #endif } diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index b9aff50d243..42aa2af11f1 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -1241,7 +1241,7 @@ static void curvetomesh(Scene *scene, Object *ob) if (ob->disp.first == NULL) makeDispListCurveTypes(scene, ob, 0); /* force creation */ - nurbs_to_mesh(ob); /* also does users */ + BKE_mesh_from_nurbs(ob); /* also does users */ if (ob->type == OB_MESH) BKE_object_free_modifiers(ob); @@ -1347,7 +1347,7 @@ static int convert_exec(bContext *C, wmOperator *op) newob = ob; } - mesh_to_curve(scene, newob); + BKE_mesh_from_curve(scene, newob); if (newob->type == OB_CURVE) BKE_object_free_modifiers(newob); /* after derivedmesh calls! */ @@ -1509,7 +1509,7 @@ static int convert_exec(bContext *C, wmOperator *op) for (a = 0; a < newob->totcol; a++) id_us_plus((ID *)me->mat[a]); } - mball_to_mesh(&baseob->disp, newob->data); + BKE_mesh_from_metaball(&baseob->disp, newob->data); if (obact->type == OB_MBALL) { basact = basen; diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index d6d7342f900..96099d51dc9 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -749,10 +749,10 @@ static void copy_texture_space(Object *to, Object *ob) /* pass */ } else if (to->type == OB_MBALL) { - BKE_metaball_tex_space_calc(to); + BKE_metaball_texspace_calc(to); } else { - BKE_curve_tex_space_calc(to->data); + BKE_curve_texspace_calc(to->data); } } @@ -1125,6 +1125,7 @@ void ED_objects_recalculate_paths(bContext *C, Scene *scene) BLI_freelistN(&targets); } + /* show popup to determine settings */ static int object_calculate_paths_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { @@ -1200,6 +1201,39 @@ void OBJECT_OT_paths_calculate(wmOperatorType *ot) /* --------- */ +static int object_update_paths_exec(bContext *C, wmOperator *UNUSED(op)) +{ + Scene *scene = CTX_data_scene(C); + + if (scene == NULL) + return OPERATOR_CANCELLED; + + /* calculate the paths for objects that have them (and are tagged to get refreshed) */ + ED_objects_recalculate_paths(C, scene); + + /* notifiers for updates */ + WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); + + return OPERATOR_FINISHED; +} + +void OBJECT_OT_paths_update(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Update Object Paths"; + ot->idname = "OBJECT_OT_paths_update"; + ot->description = "Recalculate paths for selected objects"; + + /* api callbakcs */ + ot->exec = object_update_paths_exec; + ot->poll = ED_operator_object_active_editable; /* TODO: this should probably check for existing paths */ + + /* flags */ + ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; +} + +/* --------- */ + /* Clear motion paths for selected objects only */ void ED_objects_clear_paths(bContext *C) { @@ -1256,7 +1290,7 @@ static int shade_smooth_exec(bContext *C, wmOperator *op) { if (ob->type == OB_MESH) { - mesh_set_smooth_flag(ob, !clear); + BKE_mesh_smooth_flag_set(ob, !clear); DAG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); @@ -1350,7 +1384,7 @@ static void UNUSED_FUNCTION(image_aspect) (Scene * scene, View3D * v3d) space = 1.0; if (ob->type == OB_MESH) { float size[3]; - mesh_get_texspace(ob->data, NULL, NULL, size); + BKE_mesh_texspace_get(ob->data, NULL, NULL, size); space = size[0] / size[1]; } else if (ELEM3(ob->type, OB_CURVE, OB_FONT, OB_SURF)) { diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h index 28de0b4b33f..e29ab687fff 100644 --- a/source/blender/editors/object/object_intern.h +++ b/source/blender/editors/object/object_intern.h @@ -84,6 +84,7 @@ void OBJECT_OT_proxy_make(struct wmOperatorType *ot); void OBJECT_OT_shade_smooth(struct wmOperatorType *ot); void OBJECT_OT_shade_flat(struct wmOperatorType *ot); void OBJECT_OT_paths_calculate(struct wmOperatorType *ot); +void OBJECT_OT_paths_update(struct wmOperatorType *ot); void OBJECT_OT_paths_clear(struct wmOperatorType *ot); void OBJECT_OT_forcefield_toggle(struct wmOperatorType *ot); diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index 311240d189f..9f5ae7e255f 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -77,6 +77,7 @@ void ED_operatortypes_object(void) WM_operatortype_append(OBJECT_OT_shade_smooth); WM_operatortype_append(OBJECT_OT_shade_flat); WM_operatortype_append(OBJECT_OT_paths_calculate); + WM_operatortype_append(OBJECT_OT_paths_update); WM_operatortype_append(OBJECT_OT_paths_clear); WM_operatortype_append(OBJECT_OT_forcefield_toggle); diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index 785b9c0a9b7..4825697f8c3 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -491,7 +491,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo } /* update normals */ - mesh_calc_normals_mapping(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL, NULL, 0, NULL, NULL); + BKE_mesh_calc_normals_mapping(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL, NULL, 0, NULL, NULL); } else if (ob->type == OB_ARMATURE) { ED_armature_apply_transform(ob, mat); @@ -772,11 +772,11 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) Mesh *me = ob->data; if (centermode == ORIGIN_TO_CURSOR) { /* done */ } - else if (around == V3D_CENTROID) { mesh_center_median(me, cent); } - else { mesh_center_bounds(me, cent); } + else if (around == V3D_CENTROID) { BKE_mesh_center_median(me, cent); } + else { BKE_mesh_center_bounds(me, cent); } negate_v3_v3(cent_neg, cent); - mesh_translate(me, cent_neg, 1); + BKE_mesh_translate(me, cent_neg, 1); tot_change++; me->id.flag |= LIB_DOIT; diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c index c96da7d52c6..a3c74b33f9e 100644 --- a/source/blender/editors/sculpt_paint/paint_hide.c +++ b/source/blender/editors/sculpt_paint/paint_hide.c @@ -328,9 +328,9 @@ static int hide_show_exec(bContext *C, wmOperator *op) /* ensure that edges and faces get hidden as well (not used by * sculpt but it looks wrong when entering editmode otherwise) */ if (pbvh_type == PBVH_FACES) { - mesh_flush_hidden_from_verts(me->mvert, me->mloop, - me->medge, me->totedge, - me->mpoly, me->totpoly); + BKE_mesh_flush_hidden_from_verts(me->mvert, me->mloop, + me->medge, me->totedge, + me->mpoly, me->totpoly); } ED_region_tag_redraw(ar); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 81b418b51f5..bb7789c5843 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -2303,7 +2303,7 @@ void sculpt_vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3]) for (a = 0; a < me->totvert; a++, mvert++) copy_v3_v3(mvert->co, vertCos[a]); - mesh_calc_normals_mapping(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL, NULL, 0, NULL, NULL); + BKE_mesh_calc_normals_mapping(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL, NULL, 0, NULL, NULL); } /* apply new coords on active key block */ @@ -2536,7 +2536,7 @@ static void sculpt_flush_stroke_deform(Sculpt *sd, Object *ob) /* Modifiers could depend on mesh normals, so we should update them/ * Note, then if sculpting happens on locked key, normals should be re-calculated * after applying coords from keyblock on base mesh */ - mesh_calc_normals(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL); + BKE_mesh_calc_normals(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL); } else if (ss->kb) { sculpt_update_keyblock(ob); diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index c08ed2e85b9..b021608a095 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -276,8 +276,8 @@ static void sculpt_undo_restore(bContext *C, ListBase *lb) if (ss->modifiers_active) { Mesh *mesh = ob->data; - mesh_calc_normals_tessface(mesh->mvert, mesh->totvert, - mesh->mface, mesh->totface, NULL); + BKE_mesh_calc_normals_tessface(mesh->mvert, mesh->totvert, + mesh->mface, mesh->totface, NULL); free_sculptsession_deformMats(ss); tag_update |= 1; diff --git a/source/blender/editors/space_view3d/drawanimviz.c b/source/blender/editors/space_view3d/drawanimviz.c index a9801012d67..f8d942b4fd1 100644 --- a/source/blender/editors/space_view3d/drawanimviz.c +++ b/source/blender/editors/space_view3d/drawanimviz.c @@ -88,38 +88,50 @@ void draw_motion_path_instance(Scene *scene, //RegionView3D *rv3d= ar->regiondata; bMotionPathVert *mpv, *mpv_start; int i, stepsize = avs->path_step; - int sfra, efra, len; - + int sfra, efra, sind, len; /* get frame ranges */ if (avs->path_type == MOTIONPATH_TYPE_ACFRA) { - int sind; - /* With "Around Current", we only choose frames from around - * the current frame to draw. However, this range is still - * restricted by the limits of the original path. + * the current frame to draw. */ sfra = CFRA - avs->path_bc; efra = CFRA + avs->path_ac; - if (sfra < mpath->start_frame) sfra = mpath->start_frame; - if (efra > mpath->end_frame) efra = mpath->end_frame; - - len = efra - sfra; - - sind = sfra - mpath->start_frame; - mpv_start = (mpath->points + sind); } else { + /* Use the current display range */ + sfra = avs->path_sf; + efra = avs->path_ef; + } + + /* no matter what, we can only show what is in the cache and no more + * - abort if whole range is past ends of path + * - otherwise clamp endpoints to extents of path + */ + if ((sfra > mpath->end_frame) || (efra < mpath->start_frame)) { + /* whole path is out of bounds */ + return; + } + + if (sfra < mpath->start_frame) { + /* start clamp */ sfra = mpath->start_frame; - efra = sfra + mpath->length; - len = mpath->length; - mpv_start = mpath->points; } - + if (efra > mpath->end_frame) { + /* end clamp */ + efra = mpath->end_frame; + } + + len = efra - sfra; + if (len <= 0) { return; } - + + /* get pointers to parts of path */ + sind = sfra - mpath->start_frame; + mpv_start = (mpath->points + sind); + /* draw curve-line of path */ glShadeModel(GL_SMOOTH); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index beb1cc57f6e..5186844f402 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -3598,7 +3598,7 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D finalDM->release(finalDM); } else { - /* don't create boundbox here with mesh_get_bb(), the derived system will make it, puts deformed bb's OK */ + /* don't create boundbox here with BKE_mesh_boundbox_get(), the derived system will make it, puts deformed bb's OK */ if (me->totpoly <= 4 || ED_view3d_boundbox_clip(rv3d, ob->obmat, (ob->bb) ? ob->bb : me->bb)) { glsl = draw_glsl_material(scene, ob, v3d, dt); check_alpha = check_alpha_pass(base); @@ -6152,7 +6152,7 @@ static void draw_bounding_volume(Scene *scene, Object *ob, char type) BoundBox *bb = NULL; if (ob->type == OB_MESH) { - bb = mesh_get_bb(ob); + bb = BKE_mesh_boundbox_get(ob); } else if (ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) { bb = ob->bb ? ob->bb : ( (Curve *)ob->data)->bb; @@ -6186,7 +6186,7 @@ static void drawtexspace(Object *ob) float vec[8][3], loc[3], size[3]; if (ob->type == OB_MESH) { - mesh_get_texspace(ob->data, loc, NULL, size); + BKE_mesh_texspace_get(ob->data, loc, NULL, size); } else if (ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) { Curve *cu = ob->data; diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index 79b776572cf..c97a4751135 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -894,7 +894,7 @@ static void rna_def_armature(BlenderRNA *brna) prop = RNA_def_property(srna, "deform_method", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "gevertdeformer"); RNA_def_property_enum_items(prop, prop_vdeformer); - RNA_def_property_ui_text(prop, "Vertex Deformer", ""); + RNA_def_property_ui_text(prop, "Vertex Deformer", "Vertex Deformer Method (Game Engine only)"); RNA_def_property_update(prop, 0, "rna_Armature_redraw_data"); RNA_def_property_flag(prop, PROP_LIB_EXCEPTION); @@ -973,30 +973,6 @@ static void rna_def_armature(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Armature_redraw_data"); RNA_def_property_flag(prop, PROP_LIB_EXCEPTION); /* XXX depreceated ....... old animviz for armatures only */ - - /* deformflag */ - prop = RNA_def_property(srna, "use_deform_vertex_groups", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_VGROUP); - RNA_def_property_ui_text(prop, "Deform Vertex Groups", "Enable Vertex Groups when defining deform"); - RNA_def_property_update(prop, 0, "rna_Armature_update_data"); - - prop = RNA_def_property(srna, "use_deform_envelopes", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_ENVELOPE); - RNA_def_property_ui_text(prop, "Deform Envelopes", "Enable Bone Envelopes when defining deform"); - RNA_def_property_update(prop, 0, "rna_Armature_update_data"); - - prop = RNA_def_property(srna, "use_deform_preserve_volume", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_QUATERNION); - RNA_def_property_ui_text(prop, "Use Dual Quaternion Deformation", "Enable deform rotation with Quaternions"); - RNA_def_property_update(prop, 0, "rna_Armature_update_data"); - -#if 0 - prop = RNA_def_property(srna, "deform_invert_vertexgroups", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "deformflag", ARM_DEF_INVERT_VGROUP); - RNA_def_property_ui_text(prop, "Invert Vertex Group Influence", - "Invert Vertex Group influence (only for Modifiers)"); - RNA_def_property_update(prop, 0, "rna_Armature_update_data"); -#endif /* Number fields */ /* XXX depreceated ....... old animviz for armatures only */ diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index cdfaa8aae1d..2c9347e5024 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -205,7 +205,7 @@ static void rna_Curve_texspace_set(Main *UNUSED(bmain), Scene *UNUSED(scene), Po Curve *cu = (Curve*)ptr->data; if (cu->texflag & CU_AUTOSPACE) - BKE_curve_tex_space_calc(cu); + BKE_curve_texspace_calc(cu); } static int rna_Curve_texspace_editable(PointerRNA *ptr) @@ -219,7 +219,7 @@ static void rna_Curve_texspace_loc_get(PointerRNA *ptr, float *values) Curve *cu = (Curve *)ptr->data; if (!cu->bb) - BKE_curve_tex_space_calc(cu); + BKE_curve_texspace_calc(cu); copy_v3_v3(values, cu->loc); } @@ -236,7 +236,7 @@ static void rna_Curve_texspace_size_get(PointerRNA *ptr, float *values) Curve *cu = (Curve *)ptr->data; if (!cu->bb) - BKE_curve_tex_space_calc(cu); + BKE_curve_texspace_calc(cu); copy_v3_v3(values, cu->size); } diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 0ecfa311913..436b6938e05 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -222,7 +222,7 @@ static float rna_MeshPolygon_area_get(PointerRNA *ptr) Mesh *me = (Mesh*)ptr->id.data; MPoly *mp = (MPoly*)ptr->data; - return mesh_calc_poly_area(mp, me->mloop+mp->loopstart, me->mvert, NULL); + return BKE_mesh_calc_poly_area(mp, me->mloop+mp->loopstart, me->mvert, NULL); } static void rna_MeshTessFace_normal_get(PointerRNA *ptr, float *values) diff --git a/source/blender/makesrna/intern/rna_mesh_api.c b/source/blender/makesrna/intern/rna_mesh_api.c index 41b232fdf8b..c0a9d19360d 100644 --- a/source/blender/makesrna/intern/rna_mesh_api.c +++ b/source/blender/makesrna/intern/rna_mesh_api.c @@ -42,7 +42,7 @@ #ifdef RNA_RUNTIME const char *rna_Mesh_unit_test_compare(struct Mesh *mesh, bContext *C, struct Mesh *mesh2) { - const char *ret = mesh_cmp(mesh, mesh2, FLT_EPSILON*60); + const char *ret = BKE_mesh_cmp(mesh, mesh2, FLT_EPSILON*60); if (!ret) ret = "Same"; diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c index e95e49e8150..f7531e1b556 100644 --- a/source/blender/makesrna/intern/rna_object_api.c +++ b/source/blender/makesrna/intern/rna_object_api.c @@ -110,9 +110,9 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_ copycu->editfont = NULL; copycu->editnurb = NULL; - nurbs_to_mesh(tmpobj); + BKE_mesh_from_nurbs(tmpobj); - /* nurbs_to_mesh changes the type to a mesh, check it worked */ + /* BKE_mesh_from_nurbs changes the type to a mesh, check it worked */ if (tmpobj->type != OB_MESH) { BKE_libblock_free_us(&(G.main->object), tmpobj); BKE_report(reports, RPT_ERROR, "cant convert curve to mesh. Does the curve have any segments?"); @@ -136,11 +136,11 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_ if (render) { ListBase disp = {NULL, NULL}; makeDispListMBall_forRender(sce, ob, &disp); - mball_to_mesh(&disp, tmpmesh); + BKE_mesh_from_metaball(&disp, tmpmesh); freedisplist(&disp); } else - mball_to_mesh(&ob->disp, tmpmesh); + BKE_mesh_from_metaball(&ob->disp, tmpmesh); break; } diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c index 57268d04947..df3f78b7f11 100644 --- a/source/blender/modifiers/intern/MOD_multires.c +++ b/source/blender/modifiers/intern/MOD_multires.c @@ -103,12 +103,12 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *dm, cddm->getVertArray(cddm), mdisps); - mesh_flush_hidden_from_verts(cddm->getVertArray(cddm), - cddm->getLoopArray(cddm), - cddm->getEdgeArray(cddm), - cddm->getNumEdges(cddm), - cddm->getPolyArray(cddm), - cddm->getNumPolys(cddm)); + BKE_mesh_flush_hidden_from_verts(cddm->getVertArray(cddm), + cddm->getLoopArray(cddm), + cddm->getEdgeArray(cddm), + cddm->getNumEdges(cddm), + cddm->getPolyArray(cddm), + cddm->getNumPolys(cddm)); } } diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c index 6a173362ade..2e8faaae5bf 100644 --- a/source/blender/modifiers/intern/MOD_util.c +++ b/source/blender/modifiers/intern/MOD_util.c @@ -207,7 +207,7 @@ DerivedMesh *get_dm(Object *ob, struct BMEditMesh *em, DerivedMesh *dm, float (* } if (orco) - DM_add_vert_layer(dm, CD_ORCO, CD_ASSIGN, get_mesh_orco_verts(ob)); + DM_add_vert_layer(dm, CD_ORCO, CD_ASSIGN, BKE_mesh_orco_verts_get(ob)); } else if (ELEM3(ob->type, OB_FONT, OB_CURVE, OB_SURF)) { dm= CDDM_from_curve(ob); diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c index df9a4f2d017..8694d7bf37d 100644 --- a/source/blender/modifiers/intern/MOD_uvproject.c +++ b/source/blender/modifiers/intern/MOD_uvproject.c @@ -325,7 +325,7 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd, float best_dot; /* get the untransformed face normal */ - mesh_calc_poly_normal_coords(mp, mloop + mp->loopstart, (const float (*)[3])coords, face_no); + BKE_mesh_calc_poly_normal_coords(mp, mloop + mp->loopstart, (const float (*)[3])coords, face_no); /* find the projector which the face points at most directly * (projector normal with largest dot product is best) diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 75901008d9f..8d2456b3001 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -401,7 +401,7 @@ static void calc_edge_stress(Render *UNUSED(re), ObjectRen *obr, Mesh *me) if (obr->totvert==0) return; - mesh_get_texspace(me, loc, NULL, size); + BKE_mesh_texspace_get(me, loc, NULL, size); accum= MEM_callocN(2*sizeof(float)*obr->totvert, "temp accum for stress"); |