[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17564] branches/animsys2/source/blender: AnimSys2: More bugfixes for Mesh Joining + Shapekeys
Joshua Leung
aligorith at gmail.com
Tue Nov 25 01:59:16 CET 2008
Revision: 17564
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17564
Author: aligorith
Date: 2008-11-25 01:59:15 +0100 (Tue, 25 Nov 2008)
Log Message:
-----------
AnimSys2: More bugfixes for Mesh Joining + Shapekeys
* Joining mesh without shapekeys to mesh with shapekeys now works.
--> Joining mesh with shapekeys to mesh without still doesn't work ok though.
* Prevented unlikely crashes in key_get_named_keyblock()
Modified Paths:
--------------
branches/animsys2/source/blender/blenkernel/intern/key.c
branches/animsys2/source/blender/src/meshtools.c
Modified: branches/animsys2/source/blender/blenkernel/intern/key.c
===================================================================
--- branches/animsys2/source/blender/blenkernel/intern/key.c 2008-11-24 22:06:09 UTC (rev 17563)
+++ branches/animsys2/source/blender/blenkernel/intern/key.c 2008-11-25 00:59:15 UTC (rev 17564)
@@ -1413,7 +1413,7 @@
{
KeyBlock *kb;
- if (key) {
+ if (key && name) {
for (kb= key->block.first; kb; kb= kb->next) {
if (strcmp(name, kb->name)==0)
return kb;
Modified: branches/animsys2/source/blender/src/meshtools.c
===================================================================
--- branches/animsys2/source/blender/src/meshtools.c 2008-11-24 22:06:09 UTC (rev 17563)
+++ branches/animsys2/source/blender/src/meshtools.c 2008-11-25 00:59:15 UTC (rev 17564)
@@ -131,7 +131,7 @@
MFace *mface = NULL, *mfacemain;
Key *key, *nkey=NULL;
KeyBlock *kb, *okb, *kbn;
- float imat[4][4], cmat[4][4], *fp1, *fp2;
+ float imat[4][4], cmat[4][4], *fp1, *fp2, curpos;
int a, b, totcol, totedge=0, totvert=0, totface=0, ok=0, vertofs, map[MAXMAT];
int i, j, index, haskey=0, hasmulti=0, edgeofs, faceofs;
bDeformGroup *dg, *odg;
@@ -301,6 +301,13 @@
kbn->totelem= totvert;
kbn->weights= NULL;
+ okb= key->block.last;
+ curpos= (okb) ? okb->pos : -0.1f;
+ if (key->type == KEY_RELATIVE)
+ kbn->pos= curpos + 0.1f;
+ else
+ kbn->pos= curpos;
+
BLI_addtail(&key->block, kbn);
kbn->adrcode= key->totkey;
key->totkey++;
@@ -407,7 +414,7 @@
else {
/* copy this mesh's vertex coordinates to the destination shapekey */
mv= mvert;
- for (a=0; a < me->totvert; a++, fp1++, mv++) {
+ for (a=0; a < me->totvert; a++, fp1+=3, mv++) {
VECCOPY(fp1, mv->co);
}
}
@@ -415,7 +422,7 @@
}
}
else {
- /* for each shapekey in base:
+ /* for each shapekey in destination mesh:
* - if it was an 'original', copy the appropriate data from nkey
* - otherwise, copy across plain coordinates (no need to transform coordinates)
*/
@@ -436,7 +443,7 @@
else {
/* copy base-coordinates to the destination shapekey */
mv= mvert;
- for (a=0; a < me->totvert; a++, fp1++, mv++) {
+ for (a=0; a < me->totvert; a++, fp1+=3, mv++) {
VECCOPY(fp1, mv->co);
}
}
More information about the Bf-blender-cvs
mailing list