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:
Diffstat (limited to 'source/blender/editors/object/object_shapekey.c')
-rw-r--r--source/blender/editors/object/object_shapekey.c47
1 files changed, 43 insertions, 4 deletions
diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c
index 7c59278dcf5..fd2e7fd7c99 100644
--- a/source/blender/editors/object/object_shapekey.c
+++ b/source/blender/editors/object/object_shapekey.c
@@ -203,9 +203,9 @@ static int object_shape_key_mirror(bContext *C, Object *ob)
fp1= ((float *)kb->data) + i1*3;
fp2= ((float *)kb->data) + i2*3;
- VECCOPY(tvec, fp1);
- VECCOPY(fp1, fp2);
- VECCOPY(fp2, tvec);
+ copy_v3_v3(tvec, fp1);
+ copy_v3_v3(fp1, fp2);
+ copy_v3_v3(fp2, tvec);
/* flip x axis */
fp1[0] = -fp1[0];
@@ -217,7 +217,46 @@ static int object_shape_key_mirror(bContext *C, Object *ob)
mesh_octree_table(ob, NULL, NULL, 'e');
}
- /* todo, other types? */
+ else if (ob->type == OB_LATTICE) {
+ Lattice *lt= ob->data;
+ int i1, i2;
+ float *fp1, *fp2;
+ int u, v, w;
+ /* half but found up odd value */
+ const int pntsu_half = (((lt->pntsu / 2) + (lt->pntsu % 2))) ;
+
+ /* currently editmode isnt supported by mesh so
+ * ignore here for now too */
+
+ /* if(lt->editlatt) lt= lt->editlatt->latt; */
+
+ for(w=0; w<lt->pntsw; w++) {
+ for(v=0; v<lt->pntsv; v++) {
+ for(u=0; u<pntsu_half; u++) {
+ int u_inv= (lt->pntsu - 1) - u;
+ float tvec[3];
+ if(u == u_inv) {
+ i1= LT_INDEX(lt, u, v, w);
+ fp1= ((float *)kb->data) + i1*3;
+ fp1[0]= -fp1[0];
+ }
+ else {
+ i1= LT_INDEX(lt, u, v, w);
+ i2= LT_INDEX(lt, u_inv, v, w);
+
+ fp1= ((float *)kb->data) + i1*3;
+ fp2= ((float *)kb->data) + i2*3;
+
+ copy_v3_v3(tvec, fp1);
+ copy_v3_v3(fp1, fp2);
+ copy_v3_v3(fp2, tvec);
+ fp1[0]= -fp1[0];
+ fp2[0]= -fp2[0];
+ }
+ }
+ }
+ }
+ }
MEM_freeN(tag_elem);
}