Armatures; the bones menu used for "Make Parent" (CTRL+P) used wrong

indices still.
Cleaned the code, moved to editobject.c
This commit is contained in:
2005-07-09 16:16:45 +00:00
parent 30f89a6db7
commit a4f907d2e0
4 changed files with 70 additions and 79 deletions

View File

@@ -1093,6 +1093,29 @@ int test_parent_loop(Object *par, Object *ob)
}
static char *make_bone_menu (Object *ob)
{
char *menustr=NULL;
bPoseChannel *pchan;
int size;
int index=0;
// Count the bones
for(size=0, pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next, size++);
size = size*48 + 256;
menustr = MEM_callocN(size, "bonemenu");
sprintf (menustr, "Select Bone%%t");
for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next, index++) {
sprintf (menustr, "%s|%s%%x%d", menustr, pchan->bone->name, index);
}
return menustr;
}
void make_parent(void)
{
Base *base;
@@ -1194,8 +1217,7 @@ void make_parent(void)
mode=PARBONE;
/* Make bone popup menu */
bonestr = make_bone_menu(get_armature(par));
// if(mbutton(&bone, bonestr, 1, 24, "Bone: ")==0) {
bonestr = make_bone_menu(par);
bonenr= pupmenu_col(bonestr, 20);
if (bonestr)