diff options
author | Ton Roosendaal <ton@blender.org> | 2006-11-15 14:10:00 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2006-11-15 14:10:00 +0300 |
commit | e50112d441aca2d43387f20cb54bd6ee02781fb0 (patch) | |
tree | 62bc44c9064164156a5d65f1e53caadcdb1ebfb5 | |
parent | a3c1c543f6e1bcb4a2151b6be0786247887bb14c (diff) |
Bugfix #5230
Vertex Parent option didn't have index correction for editing Meshes.
That caused the parenting to flip around when you deleted or added stuff.
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 7 | ||||
-rw-r--r-- | source/blender/src/editmesh.c | 27 |
2 files changed, 28 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 862f2f8e626..f314159a9f9 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1308,11 +1308,8 @@ static void give_parvert(Object *par, int nr, float *vec) EditMesh *em = G.editMesh; EditVert *eve; - if(nr >= G.totvert) nr= 0; - - count= 0; - for(eve= em->verts.first; eve; eve= eve->next, count++) { - if(count==nr) { + for(eve= em->verts.first; eve; eve= eve->next) { + if(eve->keyindex==nr) { memcpy(vec, eve->co, 12); break; } diff --git a/source/blender/src/editmesh.c b/source/blender/src/editmesh.c index 34fb0f1d17a..820c6ca0f73 100644 --- a/source/blender/src/editmesh.c +++ b/source/blender/src/editmesh.c @@ -1197,7 +1197,7 @@ void load_editMesh(void) me->mcol = CustomData_get(&mfdata, 0, LAYERTYPE_MCOL); CustomData_free(&mfdata); - /* patch hook indices */ + /* patch hook indices and vertex parents */ { Object *ob; ModifierData *md; @@ -1205,6 +1205,31 @@ void load_editMesh(void) int i,j; for (ob=G.main->object.first; ob; ob=ob->id.next) { + if (ob->parent==G.obedit && ELEM(ob->partype, PARVERT1,PARVERT3)) { + + /* duplicate code from below, make it function later...? */ + if (!vertMap) { + vertMap = MEM_callocN(sizeof(*vertMap)*ototvert, "vertMap"); + + for (eve=em->verts.first; eve; eve=eve->next) { + if (eve->keyindex!=-1) + vertMap[eve->keyindex] = eve; + } + } + if(ob->par1 < ototvert) { + eve = vertMap[ob->par1]; + if(eve) ob->par1= eve->tmp.l; + } + if(ob->par2 < ototvert) { + eve = vertMap[ob->par2]; + if(eve) ob->par2= eve->tmp.l; + } + if(ob->par3 < ototvert) { + eve = vertMap[ob->par3]; + if(eve) ob->par3= eve->tmp.l; + } + + } if (ob->data==me) { for (md=ob->modifiers.first; md; md=md->next) { if (md->type==eModifierType_Hook) { |