From f20f4e4307b0fc63dd26984b68e296344ac8c95f Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Sun, 11 Sep 2005 10:12:31 +0000 Subject: [PATCH] Bug fix #3033 Using "make parent armature with creating vertex groups" option gave corrupted memory when one or more bones had the "Deform" option not set. Was caused by old boneclass SKINNABLE variable. To end this confusement, removed this define from code. Note for future Armature tool coders; don't use this bonelooper functionality. Operations in Object mode for armatures should use the Pose Channels, which is a simple ListBase to go over. I have to recode the 'create vertexgroups' still... --- source/blender/include/BIF_editarmature.h | 2 - source/blender/makesdna/DNA_armature_types.h | 5 --- source/blender/python/api2_2x/Bone.c | 1 - source/blender/src/editarmature.c | 43 ++------------------ 4 files changed, 3 insertions(+), 48 deletions(-) diff --git a/source/blender/include/BIF_editarmature.h b/source/blender/include/BIF_editarmature.h index 02ad26b8878..284ab9dee3f 100644 --- a/source/blender/include/BIF_editarmature.h +++ b/source/blender/include/BIF_editarmature.h @@ -115,8 +115,6 @@ void show_all_pose_bones(void); int bone_looper(Object *ob, struct Bone *bone, void *data, int (*bone_func)(Object *, struct Bone *, void *)); -int ik_chain_looper(Object *ob, struct Bone *bone, void *data, - int (*bone_func)(Object *, struct Bone *, void *)); void undo_push_armature(char *name); void armature_bone_rename(struct bArmature *arm, char *oldname, char *newname); diff --git a/source/blender/makesdna/DNA_armature_types.h b/source/blender/makesdna/DNA_armature_types.h index 947a3631932..4a041208bd1 100644 --- a/source/blender/makesdna/DNA_armature_types.h +++ b/source/blender/makesdna/DNA_armature_types.h @@ -129,9 +129,4 @@ typedef struct bArmature { #define BONE_NO_DEFORM 4096 -enum { - BONE_SKINNABLE = 0, - BONE_UNSKINNABLE -}; - #endif diff --git a/source/blender/python/api2_2x/Bone.c b/source/blender/python/api2_2x/Bone.c index 8d66b08265a..6a6980107a2 100644 --- a/source/blender/python/api2_2x/Bone.c +++ b/source/blender/python/api2_2x/Bone.c @@ -619,7 +619,6 @@ static PyObject *M_Bone_New( PyObject * self, PyObject * args ) BLI_strncpy( py_bone->parent, parent_str, strlen( parent_str ) + 1 ); py_bone->roll = 0.0f; py_bone->flag = 32; - py_bone->boneclass = BONE_SKINNABLE; py_bone->dist = 1.0f; py_bone->weight = 1.0f; Vector_Zero( py_bone->head ); diff --git a/source/blender/src/editarmature.c b/source/blender/src/editarmature.c index 8c7e386ba25..7464849bcc9 100644 --- a/source/blender/src/editarmature.c +++ b/source/blender/src/editarmature.c @@ -1961,43 +1961,6 @@ int bone_looper(Object *ob, Bone *bone, void *data, return count; } -int ik_chain_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 ik chain -- feed ikchain_looper a bone in the chain and - * a pointer to the bone_func and watch it go!. The int count - * can be useful for counting bones with a certain property - * (e.g. skinnable) - */ - Bone *curBone; - int count = 0; - - if (bone) { - - /* This bone */ - count += bone_func(ob, bone, data); - - /* The parents */ - for (curBone = bone; curBone; curBone=curBone->parent) { - if (!curBone->parent) - break; - else if (!(curBone->flag & BONE_CONNECTED)) - break; - count += bone_func(ob, curBone->parent, data); - } - - /* The children */ - for (curBone = bone->childbase.first; curBone; curBone=curBone->next){ - if (curBone->flag & BONE_CONNECTED) { - count += bone_func(ob, curBone, data); - } - } - } - - return count; -} static int bone_skinnable(Object *ob, Bone *bone, void *data) { @@ -2053,7 +2016,7 @@ static int add_defgroup_unique_bone(Object *ob, Bone *bone, void *data) static int dgroup_skinnable(Object *ob, Bone *bone, void *data) { - /* Bones that are not of boneclass BONE_UNSKINNABLE + /* Bones that are deforming * are regarded to be "skinnable" and are eligible for * auto-skinning. * @@ -2078,7 +2041,7 @@ static int dgroup_skinnable(Object *ob, Bone *bone, void *data) */ bDeformGroup ***hgroup, *defgroup; - if ( bone->boneclass != BONE_UNSKINNABLE ) { + if (!(bone->flag & BONE_NO_DEFORM)) { if ( !(defgroup = get_named_vertexgroup(ob, bone->name)) ) { defgroup = add_defgroup_name(ob, bone->name); } @@ -2138,7 +2101,7 @@ static void add_verts_to_closest_dgroup(Object *ob, Object *par) /* count the number of skinnable bones */ numbones = bone_looper(ob, arm->bonebase.first, NULL, bone_skinnable); - + /* create an array of pointer to bones that are skinnable * and fill it with all of the skinnable bones */