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:
authorTon Roosendaal <ton@blender.org>2009-01-30 21:18:41 +0300
committerTon Roosendaal <ton@blender.org>2009-01-30 21:18:41 +0300
commit480be71514a010549b62c302e2bb1216c4339b0c (patch)
tree4bad708e39a5eed6945d96a149dd8e92e30a19d1 /source/blender/editors/mesh/editmesh_add.c
parent128c8167afa003984b7446ad53915c79f872fdbf (diff)
2.5
- Edit mesh: Add ctrl+click add vertex or extrude. I've made it not move the 3d cursor in that case. Also found out tweak events conflicted with existing keymap definitions; on tweak failure (= no mousemove) it now passes on the mouse event as 'mouse down' for the remaining keymaps to check. These then actually respond to mouse-up instead of down... The location in the keymaps where tweaks get generated remains important. Examples: 1 - 'select' mouse-handler, operator return pass-through 2 - tweak handler checks, and makes tweak event 3 - grabber responds to tweak event 1 - ctrl+mouse tweak handler checks, makes tweak event, or passes event on 2 - if tweak event, it runs lasso 3 - else when passed on, ctrl+click extrude happens In the first case, select works on mouse-down, immediate. In the second case, extrude happens on mouse-release, even though the keymap defined mouse-press. This will make designing nice balanced keymaps still not simple; especially because you can't tell operators to pass on the key... although we can add the convention that select-mouse operators always pass on to enable tweaks. Still a good reason to wait with custom keymaps when this is fully settled!
Diffstat (limited to 'source/blender/editors/mesh/editmesh_add.c')
-rw-r--r--source/blender/editors/mesh/editmesh_add.c39
1 files changed, 31 insertions, 8 deletions
diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c
index 54445f87150..ef648932eb4 100644
--- a/source/blender/editors/mesh/editmesh_add.c
+++ b/source/blender/editors/mesh/editmesh_add.c
@@ -118,6 +118,8 @@ static short icoface[20][3] = {
{10,9,11}
};
+/* *************** add-click-mesh (extrude) operator ************** */
+
static void get_view_aligned_coordinate(ViewContext *vc, float *fp, short mval[2])
{
float dvec[3];
@@ -136,15 +138,19 @@ static void get_view_aligned_coordinate(ViewContext *vc, float *fp, short mval[2
}
}
-void add_click_mesh(bContext *C)
+static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event)
{
ViewContext vc;
EditVert *eve, *v1;
float min[3], max[3];
int done= 0;
+ short mval[2];
em_setup_viewcontext(C, &vc);
+ mval[0]= event->x - vc.ar->winrct.xmin;
+ mval[1]= event->y - vc.ar->winrct.ymin;
+
INIT_MINMAX(min, max);
for(v1= vc.em->verts.first;v1; v1=v1->next) {
@@ -159,7 +165,6 @@ void add_click_mesh(bContext *C)
EditEdge *eed;
float vec[3], cent[3], mat[3][3];
float nor[3]= {0.0, 0.0, 0.0};
- short mval[2];
/* check for edges that are half selected, use for rotation */
done= 0;
@@ -220,27 +225,45 @@ void add_click_mesh(bContext *C)
float mat[3][3],imat[3][3];
float *curs= give_cursor(vc.scene, vc.v3d);
+ VECCOPY(min, curs);
+ get_view_aligned_coordinate(&vc, min, mval);
+
eve= addvertlist(vc.em, 0, NULL);
Mat3CpyMat4(mat, vc.obedit->obmat);
Mat3Inv(imat, mat);
- VECCOPY(eve->co, curs);
- VecSubf(eve->co, eve->co, vc.obedit->obmat[3]);
-
+ VECCOPY(eve->co, min);
Mat3MulVecfl(imat, eve->co);
+ VecSubf(eve->co, eve->co, vc.obedit->obmat[3]);
eve->f= SELECT;
}
//retopo_do_all();
+ WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, vc.obedit);
+ DAG_object_flush_update(vc.scene, vc.obedit, OB_RECALC_DATA);
- BIF_undo_push("Add vertex/edge/face");
- DAG_object_flush_update(vc.scene, vc.obedit, OB_RECALC_DATA);
-
+ return OPERATOR_FINISHED;
+}
+void MESH_OT_dupli_extrude_cursor(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Duplicate or Extrude at 3D Cursor";
+ ot->idname= "MESH_OT_dupli_extrude_cursor";
+
+ /* api callbacks */
+ ot->invoke= dupli_extrude_cursor;
+ ot->poll= ED_operator_editmesh;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
}
+
+/* ********************** */
+
/* selected faces get hidden edges */
static void make_fgon(EditMesh *em, int make)
{