Support for auto-skinning when parenting a mesh to an armature.

Applies to bones that do not have a boneclass of unskinnable
(set per bone in editmode in the button window).
This commit is contained in:
Chris Want
2003-04-24 00:48:43 +00:00
parent 788fa67bdf
commit c95692df7c
10 changed files with 746 additions and 13 deletions

View File

@@ -73,7 +73,6 @@
/* Function prototypes */
static void apply_pose_bonechildren (Bone* bone, bPose* pose, int doit);
static float dist_to_bone (float vec[3], float b1[3], float b2[3]);
static Bone *get_named_bone_bonechildren (Bone *bone, const char *name);
static Bone *get_indexed_bone_bonechildren (Bone *bone, int *index);
/*void make_bone_parent_matrix (Bone* bone);*/
@@ -568,7 +567,7 @@ static int verify_boneptr_children (Bone *cBone, Bone *tBone)
}
static float dist_to_bone (float vec[3], float b1[3], float b2[3])
float dist_to_bone (float vec[3], float b1[3], float b2[3])
{
/* float dist=0; */
float bdelta[3];

View File

@@ -901,3 +901,44 @@ DispList* subsurf_mesh_to_displist(Mesh *me, DispList *dl, short subdiv)
return subsurf_subdivide_to_displist(hme, subdiv);
}
void subsurf_calculate_limit_positions(Mesh *me, float (*positions_r)[3])
{
/* Finds the subsurf limit positions for the verts in a mesh
* and puts them in an array of floats. Please note that the
* calculated vert positions is incorrect for the verts
* on the boundary of the mesh.
*/
HyperMesh *hme= hypermesh_from_mesh(me, NULL);
HyperMesh *nme= hypermesh_new();
float edge_sum[3], face_sum[3];
HyperVert *hv;
LinkNode *l;
int i;
hypermesh_subdivide(hme, nme);
for (i= me->totvert-1,hv=hme->verts; i>=0; i--,hv=hv->next) {
int N= 0;
edge_sum[0]= edge_sum[1]= edge_sum[2]= 0.0;
face_sum[0]= face_sum[1]= face_sum[2]= 0.0;
for (N=0,l=hv->edges; l; N++,l= l->next) {
Vec3Add(edge_sum, ((HyperEdge*) l->link)->ep->co);
}
for (l=hv->faces; l; l= l->next) {
Vec3Add(face_sum, ((HyperFace*) l->link)->mid->co);
}
positions_r[i][0] =
(hv->nmv->co[0]*N*N + edge_sum[0]*4 + face_sum[0])/(N*(N+5));
positions_r[i][1] =
(hv->nmv->co[1]*N*N + edge_sum[1]*4 + face_sum[1])/(N*(N+5));
positions_r[i][2] =
(hv->nmv->co[2]*N*N + edge_sum[2]*4 + face_sum[2])/(N*(N+5));
}
hypermesh_free(nme);
hypermesh_free(hme);
}