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
path: root/source
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2005-10-22 23:34:31 +0400
committerTon Roosendaal <ton@blender.org>2005-10-22 23:34:31 +0400
commitac3e3eceba2506235652a5a92a85b5f4567f91f1 (patch)
tree254870fe996e8c6f2bbcb22d6a466a49292801ee /source
parent9e197399447007e64ee2f8aec36330fd55ddf44f (diff)
Long on the wishlist!
- CTRL+click in EditMesh now extrudes selection. If no selection, it adds a new vertex. Try it on a full selected monkey. Fun! :) - CTRL+click now also adds the new stuff aligned with the view, as if you had translated it to the mouse cursor. Only new vertices are added with respect to 3D cursor location.
Diffstat (limited to 'source')
-rw-r--r--source/blender/include/BIF_editmesh.h2
-rw-r--r--source/blender/src/editmesh_add.c98
-rw-r--r--source/blender/src/editview.c2
3 files changed, 70 insertions, 32 deletions
diff --git a/source/blender/include/BIF_editmesh.h b/source/blender/include/BIF_editmesh.h
index 3829afb04be..1895a960f70 100644
--- a/source/blender/include/BIF_editmesh.h
+++ b/source/blender/include/BIF_editmesh.h
@@ -66,7 +66,7 @@ extern void separate_mesh_loose(void);
/* ******************* editmesh_add.c */
extern void add_primitiveMesh(int type);
extern void adduplicate_mesh(void);
-extern void addvert_mesh(void);
+extern void add_click_mesh(void);
extern void addedgeface_mesh(void);
/* ******************* editmesh_lib.c */
diff --git a/source/blender/src/editmesh_add.c b/source/blender/src/editmesh_add.c
index e79806e7cf9..544bfd3e74f 100644
--- a/source/blender/src/editmesh_add.c
+++ b/source/blender/src/editmesh_add.c
@@ -116,46 +116,84 @@ static short icoface[20][3] = {
{10,9,11}
};
-void addvert_mesh(void)
+static void get_view_aligned_coordinate(float *fp)
{
- EditMesh *em = G.editMesh;
- EditVert *eve,*v1=0;
- float *curs, mat[3][3],imat[3][3];
-
- // hurms, yah...
- if(G.scene->selectmode==SCE_SELECT_FACE) return;
-
- TEST_EDITMESH
-
- Mat3CpyMat4(mat, G.obedit->obmat);
- Mat3Inv(imat, mat);
-
- v1= em->verts.first;
- while(v1) {
- if(v1->f & SELECT) break;
- v1= v1->next;
+ float dvec[3];
+ short mx, my, mval[0];
+
+ getmouseco_areawin(mval);
+ mx= mval[0];
+ my= mval[1];
+
+ project_short_noclip(fp, mval);
+
+ initgrabz(fp[0], fp[1], fp[2]);
+
+ if(mval[0]!=IS_CLIPPED) {
+ window_to_3d(dvec, mval[0]-mx, mval[1]-my);
+ VecSubf(fp, fp, dvec);
}
- eve= v1;
+}
- /* prevent there are more selected */
- EM_clear_flag_all(SELECT);
+void add_click_mesh(void)
+{
+ EditMesh *em = G.editMesh;
+ EditVert *eve, *v1;
+ float min[3], max[3];
+ int done= 0;
- eve= addvertlist(0);
+ TEST_EDITMESH
- curs= give_cursor();
- VECCOPY(eve->co, curs);
- VecSubf(eve->co, eve->co, G.obedit->obmat[3]);
+ INIT_MINMAX(min, max);
+
+ for(v1= em->verts.first;v1; v1=v1->next) {
+ if(v1->f & SELECT) {
+ DO_MINMAX(v1->co, min, max);
+ done= 1;
+ }
+ }
- Mat3MulVecfl(imat, eve->co);
- eve->f= SELECT;
+ /* call extrude? */
+ if(done) {
+ float vec[3];
+ float nor[3]= {0.0, 0.0, 0.0};
+
+ /* centre */
+ VecAddf(min, min, max);
+ VecMulf(min, 0.5f);
+ VECCOPY(vec, min);
+
+ Mat4MulVecfl(G.obedit->obmat, min); // view space
+ get_view_aligned_coordinate(min);
+ Mat4Invert(G.obedit->imat, G.obedit->obmat);
+ Mat4MulVecfl(G.obedit->imat, min); // back in object space
+
+ VecSubf(min, min, vec);
+
+ extrudeflag(SELECT, nor);
+ translateflag(SELECT, min);
+ recalc_editnormals();
+ }
+ else {
+ float mat[3][3],imat[3][3];
+ float *curs= give_cursor();
+
+ eve= addvertlist(0);
+
+ Mat3CpyMat4(mat, G.obedit->obmat);
+ Mat3Inv(imat, mat);
+
+ VECCOPY(eve->co, curs);
+ VecSubf(eve->co, eve->co, G.obedit->obmat[3]);
- if(v1) {
- addedgelist(v1, eve, NULL);
- v1->f= 0;
+ Mat3MulVecfl(imat, eve->co);
+
+ eve->f= SELECT;
}
+
countall();
- BIF_undo_push("Add vertex");
+ BIF_undo_push("Add vertex/edge/face");
allqueue(REDRAWVIEW3D, 0);
DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
diff --git a/source/blender/src/editview.c b/source/blender/src/editview.c
index 7f45e353ecd..7c343058d8a 100644
--- a/source/blender/src/editview.c
+++ b/source/blender/src/editview.c
@@ -853,7 +853,7 @@ void mouse_cursor(void)
allqueue(REDRAWVIEW3D, 1);
if(lr_click) {
- if(G.obedit->type==OB_MESH) addvert_mesh();
+ if(G.obedit->type==OB_MESH) add_click_mesh();
else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) addvert_Nurb(0);
else if (G.obedit->type==OB_ARMATURE) addvert_armature();
VECCOPY(fp, oldcurs);