Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2008-03-20 13:50:46 +0300
committerJoshua Leung <aligorith@gmail.com>2008-03-20 13:50:46 +0300
commit4eb0614c5b4a7511ee5b344b6a12213ec15c78b7 (patch)
tree8d2f05e56b11a26c569ba5bb79cde84b65b1292b /source/blender/src/editarmature.c
parent3c7308614a92a0d09a3f72d212e523c9667d5052 (diff)
* Bugfix #8599a:
Deleting the first Action Channel in an Action Group acted odd. In some cases it crashed, other times it corrupted stuff (removing all subsequent Action Channels). Was missing a call to remove the Action Channel from group(s). * Fixed whitespace in many places...
Diffstat (limited to 'source/blender/src/editarmature.c')
-rw-r--r--source/blender/src/editarmature.c77
1 files changed, 36 insertions, 41 deletions
diff --git a/source/blender/src/editarmature.c b/source/blender/src/editarmature.c
index 10bec0a7e92..a93d81e04af 100644
--- a/source/blender/src/editarmature.c
+++ b/source/blender/src/editarmature.c
@@ -3036,7 +3036,6 @@ void deselectall_posearmature (Object *ob, int test, int doundo)
int bone_looper(Object *ob, Bone *bone, void *data,
int (*bone_func)(Object *, Bone *, void *))
{
-
/* We want to apply the function bone_func to every bone
* in an armature -- feed bone_looper the first bone and
* a pointer to the bone_func and watch it go!. The int count
@@ -3046,19 +3045,15 @@ int bone_looper(Object *ob, Bone *bone, void *data,
int count = 0;
if (bone) {
-
- /* only do bone_func if the bone is non null
- */
+ /* only do bone_func if the bone is non null */
count += bone_func(ob, bone, data);
-
- /* try to execute bone_func for the first child
- */
- count += bone_looper(ob, bone->childbase.first, data,
- bone_func);
-
- /* try to execute bone_func for the next bone at this
- * depth of the recursion.
- */
+
+ /* try to execute bone_func for the first child */
+ count += bone_looper(ob, bone->childbase.first, data, bone_func);
+
+ /* try to execute bone_func for the next bone at this
+ * depth of the recursion.
+ */
count += bone_looper(ob, bone->next, data, bone_func);
}
@@ -3096,15 +3091,15 @@ static int bone_skinnable(Object *ob, Bone *bone, void *datap)
if(!(G.f & G_WEIGHTPAINT) || !(bone->flag & BONE_HIDDEN_P)) {
if (!(bone->flag & BONE_NO_DEFORM)) {
- if(data->heat && data->armob->pose && get_pose_channel(data->armob->pose, bone->name))
+ if (data->heat && data->armob->pose && get_pose_channel(data->armob->pose, bone->name))
segments = bone->segments;
else
segments = 1;
-
+
if (data->list != NULL) {
hbone = (Bone ***) &data->list;
- for(a=0; a<segments; a++) {
+ for (a=0; a<segments; a++) {
**hbone = bone;
++*hbone;
}
@@ -3118,9 +3113,9 @@ static int bone_skinnable(Object *ob, Bone *bone, void *datap)
static int add_defgroup_unique_bone(Object *ob, Bone *bone, void *data)
{
/* This group creates a vertex group to ob that has the
- * same name as bone (provided the bone is skinnable).
+ * same name as bone (provided the bone is skinnable).
* If such a vertex group aleady exist the routine exits.
- */
+ */
if (!(bone->flag & BONE_NO_DEFORM)) {
if (!get_named_vertexgroup(ob,bone->name)) {
add_defgroup_name(ob, bone->name);
@@ -3159,19 +3154,19 @@ static int dgroup_skinnable(Object *ob, Bone *bone, void *datap)
int a, segments;
struct { Object *armob; void *list; int heat; } *data= datap;
- if(!(G.f & G_WEIGHTPAINT) || !(bone->flag & BONE_HIDDEN_P)) {
+ if (!(G.f & G_WEIGHTPAINT) || !(bone->flag & BONE_HIDDEN_P)) {
if (!(bone->flag & BONE_NO_DEFORM)) {
- if(data->heat && data->armob->pose && get_pose_channel(data->armob->pose, bone->name))
+ if (data->heat && data->armob->pose && get_pose_channel(data->armob->pose, bone->name))
segments = bone->segments;
else
segments = 1;
-
- if(!(defgroup = get_named_vertexgroup(ob, bone->name)))
+
+ if (!(defgroup = get_named_vertexgroup(ob, bone->name)))
defgroup = add_defgroup_name(ob, bone->name);
-
+
if (data->list != NULL) {
hgroup = (bDeformGroup ***) &data->list;
-
+
for(a=0; a<segments; a++) {
**hgroup = defgroup;
++*hgroup;
@@ -3203,15 +3198,15 @@ static void envelope_bone_weighting(Object *ob, Mesh *mesh, float (*verts)[3], i
/* for each vertex in the mesh */
for (i=0; i < mesh->totvert; i++) {
iflip = (dgroupflip)? mesh_get_x_mirror_vert(ob, i): 0;
-
+
/* for each skinnable bone */
for (j=0; j < numbones; ++j) {
if(!selected[j])
continue;
-
+
bone = bonelist[j];
dgroup = dgrouplist[j];
-
+
/* store the distance-factor from the vertex to the bone */
distance = distfactor_to_bone (verts[i], root[j], tip[j],
bone->rad_head * scale, bone->rad_tail * scale, bone->dist * scale);
@@ -3221,7 +3216,7 @@ static void envelope_bone_weighting(Object *ob, Mesh *mesh, float (*verts)[3], i
add_vert_to_defgroup (ob, dgroup, i, distance, WEIGHT_REPLACE);
else
remove_vert_defgroup (ob, dgroup, i);
-
+
/* do same for mirror */
if (dgroupflip && dgroupflip[j] && iflip >= 0) {
if (distance!=0.0)
@@ -3306,7 +3301,7 @@ void add_verts_to_dgroups(Object *ob, Object *par, int heat, int mirror)
if(segments == 0) {
segments = 1;
bbone = NULL;
-
+
if(par->pose && (pchan=get_pose_channel(par->pose, bone->name))) {
if(bone->segments > 1) {
segments = bone->segments;
@@ -3314,10 +3309,10 @@ void add_verts_to_dgroups(Object *ob, Object *par, int heat, int mirror)
}
}
}
-
+
segments--;
}
-
+
/* compute root and tip */
if(bbone) {
VECCOPY(root[j], bbone[segments].mat[3]);
@@ -3333,10 +3328,10 @@ void add_verts_to_dgroups(Object *ob, Object *par, int heat, int mirror)
VECCOPY(root[j], bone->arm_head);
VECCOPY(tip[j], bone->arm_tail);
}
-
+
Mat4MulVecfl(par->obmat, root[j]);
Mat4MulVecfl(par->obmat, tip[j]);
-
+
/* set selected */
if(wpmode) {
if ((arm->layer & bone->layer) && (bone->flag & BONE_SELECTED))
@@ -3344,7 +3339,7 @@ void add_verts_to_dgroups(Object *ob, Object *par, int heat, int mirror)
}
else
selected[j] = 1;
-
+
/* find flipped group */
if(mirror) {
char name[32];
@@ -3352,11 +3347,11 @@ void add_verts_to_dgroups(Object *ob, Object *par, int heat, int mirror)
BLI_strncpy(name, dgroup->name, 32);
// 0 = don't strip off number extensions
bone_flip_name(name, 0);
-
+
for (curdg = ob->defbase.first; curdg; curdg=curdg->next)
if (!strcmp(curdg->name, name))
break;
-
+
dgroupflip[j] = curdg;
}
}
@@ -3368,12 +3363,12 @@ void add_verts_to_dgroups(Object *ob, Object *par, int heat, int mirror)
if (wpmode) {
/* if in weight paint mode, use final verts from derivedmesh */
DerivedMesh *dm = mesh_get_derived_final(ob, CD_MASK_BAREMESH);
-
+
if(dm->foreachMappedVert) {
dm->foreachMappedVert(dm, add_vgroups__mapFunc, (void*)verts);
vertsfilled = 1;
}
-
+
dm->release(dm);
}
else if (modifiers_findByType(ob, eModifierType_Subsurf)) {
@@ -3439,9 +3434,9 @@ void create_vgroups_from_armature(Object *ob, Object *par)
add_defgroup_unique_bone);
if (ob->type == OB_MESH)
create_dverts(ob->data);
-
+
break;
-
+
case 3:
case 4:
/* Traverse the bone list, trying to create vertex groups
@@ -3477,7 +3472,7 @@ void hide_selected_pose_bones(void)
bone_looper(OBACT, arm->bonebase.first, NULL,
hide_selected_pose_bone);
-
+
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWBUTSEDIT, 0);
allqueue(REDRAWACTION, 0);