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:
authorChris Want <cwant@ualberta.ca>2007-11-13 09:56:55 +0300
committerChris Want <cwant@ualberta.ca>2007-11-13 09:56:55 +0300
commite66f325dd7115351a40ddb72af8d347b141886c5 (patch)
treecf035bce9272602b8b0f78d7449a83d91d04999a /source/blender/src/editmesh_lib.c
parent924f7e514612e653eea7a2b941351b62c737df62 (diff)
==Mirror Modifier==
Support for using the axes of a different object as the line of mirror symmetry for a mirror modifier. As a nice consequence, this allows "clipping" to arbitrary planes in editmode. A fun example of using a couple of mirror modifiers and an array modifier to easily make a nice flower type model is here: http://bebop.cns.ualberta.ca/~cwant/chocolateC05.blend
Diffstat (limited to 'source/blender/src/editmesh_lib.c')
-rw-r--r--source/blender/src/editmesh_lib.c56
1 files changed, 44 insertions, 12 deletions
diff --git a/source/blender/src/editmesh_lib.c b/source/blender/src/editmesh_lib.c
index 14a522bdbff..d9b8fa93eb9 100644
--- a/source/blender/src/editmesh_lib.c
+++ b/source/blender/src/editmesh_lib.c
@@ -1142,22 +1142,38 @@ static short extrudeflag_edge(short flag, float *nor)
MirrorModifierData *mmd = (MirrorModifierData*) md;
if(mmd->flag & MOD_MIR_CLIPPING) {
+ float mtx[4][4];
+ if (mmd->mirror_ob) {
+ float imtx[4][4];
+ Mat4Invert(imtx, mmd->mirror_ob->obmat);
+ Mat4MulMat4(mtx, G.obedit->obmat, imtx);
+ }
+
for (eed= em->edges.first; eed; eed= eed->next) {
if(eed->f2 == 1) {
+ float co1[3], co2[3];
+
+ VecCopyf(co1, eed->v1->co);
+ VecCopyf(co2, eed->v2->co);
+
+ if (mmd->mirror_ob) {
+ VecMat4MulVecfl(co1, mtx, co1);
+ VecMat4MulVecfl(co2, mtx, co2);
+ }
if (mmd->flag & MOD_MIR_AXIS_X)
- if ( (fabs(eed->v1->co[0]) < mmd->tolerance) &&
- (fabs(eed->v2->co[0]) < mmd->tolerance) )
+ if ( (fabs(co1[0]) < mmd->tolerance) &&
+ (fabs(co2[0]) < mmd->tolerance) )
++eed->f2;
if (mmd->flag & MOD_MIR_AXIS_Y)
- if ( (fabs(eed->v1->co[1]) < mmd->tolerance) &&
- (fabs(eed->v2->co[1]) < mmd->tolerance) )
+ if ( (fabs(co1[1]) < mmd->tolerance) &&
+ (fabs(co2[1]) < mmd->tolerance) )
++eed->f2;
if (mmd->flag & MOD_MIR_AXIS_Z)
- if ( (fabs(eed->v1->co[2]) < mmd->tolerance) &&
- (fabs(eed->v2->co[2]) < mmd->tolerance) )
+ if ( (fabs(co1[2]) < mmd->tolerance) &&
+ (fabs(co2[2]) < mmd->tolerance) )
++eed->f2;
}
}
@@ -1408,21 +1424,37 @@ short extrudeflag_vert(short flag, float *nor)
MirrorModifierData *mmd = (MirrorModifierData*) md;
if(mmd->flag & MOD_MIR_CLIPPING) {
+ float mtx[4][4];
+ if (mmd->mirror_ob) {
+ float imtx[4][4];
+ Mat4Invert(imtx, mmd->mirror_ob->obmat);
+ Mat4MulMat4(mtx, G.obedit->obmat, imtx);
+ }
+
for (eed= em->edges.first; eed; eed= eed->next) {
if(eed->f2 == 2) {
+ float co1[3], co2[3];
+
+ VecCopyf(co1, eed->v1->co);
+ VecCopyf(co2, eed->v2->co);
+
+ if (mmd->mirror_ob) {
+ VecMat4MulVecfl(co1, mtx, co1);
+ VecMat4MulVecfl(co2, mtx, co2);
+ }
if (mmd->flag & MOD_MIR_AXIS_X)
- if ( (fabs(eed->v1->co[0]) < mmd->tolerance) &&
- (fabs(eed->v2->co[0]) < mmd->tolerance) )
+ if ( (fabs(co1[0]) < mmd->tolerance) &&
+ (fabs(co2[0]) < mmd->tolerance) )
++eed->f2;
if (mmd->flag & MOD_MIR_AXIS_Y)
- if ( (fabs(eed->v1->co[1]) < mmd->tolerance) &&
- (fabs(eed->v2->co[1]) < mmd->tolerance) )
+ if ( (fabs(co1[1]) < mmd->tolerance) &&
+ (fabs(co2[1]) < mmd->tolerance) )
++eed->f2;
if (mmd->flag & MOD_MIR_AXIS_Z)
- if ( (fabs(eed->v1->co[2]) < mmd->tolerance) &&
- (fabs(eed->v2->co[2]) < mmd->tolerance) )
+ if ( (fabs(co1[2]) < mmd->tolerance) &&
+ (fabs(co2[2]) < mmd->tolerance) )
++eed->f2;
}
}