Revision: 19044
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19044
Author:   ton
Date:     2009-02-19 20:03:53 +0100 (Thu, 19 Feb 2009)

Log Message:
-----------
2.5

- Mesh Rip back (Vkey). For those who keep wondering how
  it works: just put mouse cursor somewhere close to the
  selection, press V and mouse mouse away from it. Feels
  like real rip!

- Made extrude sorta work, no menu/options yet though.
  But it does transform!

- Added an short event->mval[2] with region coords, 
  easier coding for the guys :)

- Fill operator standard delivers 'beauty' now

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/include/ED_view3d.h
    branches/blender2.5/blender/source/blender/editors/mesh/editmesh_add.c
    branches/blender2.5/blender/source/blender/editors/mesh/editmesh_mods.c
    branches/blender2.5/blender/source/blender/editors/mesh/editmesh_tools.c
    branches/blender2.5/blender/source/blender/editors/mesh/mesh_intern.h
    branches/blender2.5/blender/source/blender/editors/mesh/mesh_ops.c
    
branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_intern.h
    
branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_select.c
    branches/blender2.5/blender/source/blender/editors/space_view3d/vpaint.c
    branches/blender2.5/blender/source/blender/windowmanager/WM_types.h
    
branches/blender2.5/blender/source/blender/windowmanager/intern/wm_event_system.c

Modified: branches/blender2.5/blender/source/blender/editors/include/ED_view3d.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/ED_view3d.h      
2009-02-19 18:53:43 UTC (rev 19043)
+++ branches/blender2.5/blender/source/blender/editors/include/ED_view3d.h      
2009-02-19 19:03:53 UTC (rev 19044)
@@ -90,6 +90,8 @@
 void viewray(struct ARegion *ar, struct View3D *v3d, short mval[2], float 
ray_start[3], float ray_normal[3]);
 
 int get_view3d_viewplane(struct View3D *v3d, struct RegionView3D *rv3d, int 
winxi, int winyi, rctf *viewplane, float *clipsta, float *clipend, float 
*pixsize);
+void view3d_get_object_project_mat(struct RegionView3D *v3d, struct Object 
*ob, float pmat[4][4], float vmat[4][4]);
+void view3d_project_float(struct ARegion *a, float *vec, float *adr, float 
mat[4][4]);
 
 /* drawobject.c itterators */
 void mesh_foreachScreenVert(struct ViewContext *vc, void (*func)(void 
*userData, struct EditVert *eve, int x, int y, int index), void *userData, int 
clipVerts);

Modified: branches/blender2.5/blender/source/blender/editors/mesh/editmesh_add.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/mesh/editmesh_add.c      
2009-02-19 18:53:43 UTC (rev 19043)
+++ branches/blender2.5/blender/source/blender/editors/mesh/editmesh_add.c      
2009-02-19 19:03:53 UTC (rev 19044)
@@ -124,13 +124,9 @@
        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) {
@@ -164,7 +160,7 @@
                VECCOPY(min, cent);
                
                Mat4MulVecfl(vc.obedit->obmat, min);    // view space
-               view3d_get_view_aligned_coordinate(&vc, min, mval);
+               view3d_get_view_aligned_coordinate(&vc, min, event->mval);
                Mat4Invert(vc.obedit->imat, vc.obedit->obmat); 
                Mat4MulVecfl(vc.obedit->imat, min); // back in object space
                
@@ -206,7 +202,7 @@
                float *curs= give_cursor(vc.scene, vc.v3d);
                
                VECCOPY(min, curs);
-               view3d_get_view_aligned_coordinate(&vc, min, mval);
+               view3d_get_view_aligned_coordinate(&vc, min, event->mval);
                
                eve= addvertlist(vc.em, 0, NULL);
 

Modified: 
branches/blender2.5/blender/source/blender/editors/mesh/editmesh_mods.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/mesh/editmesh_mods.c     
2009-02-19 18:53:43 UTC (rev 19043)
+++ branches/blender2.5/blender/source/blender/editors/mesh/editmesh_mods.c     
2009-02-19 19:03:53 UTC (rev 19044)
@@ -2024,15 +2024,10 @@
 
 static int mesh_loop_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-       ARegion *ar= CTX_wm_region(C);
-       short mval[2];  
        
-       mval[0]= event->x - ar->winrct.xmin;
-       mval[1]= event->y - ar->winrct.ymin;
-       
        view3d_operator_needs_opengl(C);
        
-       mouse_mesh_loop(C, mval, RNA_boolean_get(op->ptr, "extend"),
+       mouse_mesh_loop(C, event->mval, RNA_boolean_get(op->ptr, "extend"),
                                        RNA_boolean_get(op->ptr, "ring"));
        
        /* cannot do tweaks for as long this keymap is after transform map */
@@ -2130,15 +2125,10 @@
 
 static int mesh_shortest_path_select_invoke(bContext *C, wmOperator *op, 
wmEvent *event)
 {
-       ARegion *ar= CTX_wm_region(C);
-       short mval[2];  
        
-       mval[0]= event->x - ar->winrct.xmin;
-       mval[1]= event->y - ar->winrct.ymin;
-       
        view3d_operator_needs_opengl(C);
 
-       mouse_mesh_shortest_path(C, mval);
+       mouse_mesh_shortest_path(C, event->mval);
        
        return OPERATOR_FINISHED;
 }
@@ -2365,8 +2355,8 @@
        
        if(vc.em->edges.first==0) return OPERATOR_CANCELLED;
        
-       vc.mval[0]= event->x - vc.ar->winrct.xmin;
-       vc.mval[1]= event->y - vc.ar->winrct.ymin;
+       vc.mval[0]= event->mval[0];
+       vc.mval[1]= event->mval[1];
        
        /* return warning! */
        if(limit) {

Modified: 
branches/blender2.5/blender/source/blender/editors/mesh/editmesh_tools.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/mesh/editmesh_tools.c    
2009-02-19 18:53:43 UTC (rev 19043)
+++ branches/blender2.5/blender/source/blender/editors/mesh/editmesh_tools.c    
2009-02-19 19:03:53 UTC (rev 19044)
@@ -88,6 +88,7 @@
 #include "ED_view3d.h"
 #include "ED_util.h"
 #include "ED_screen.h"
+#include "BIF_transform.h"
 
 #include "UI_interface.h"
 
@@ -632,26 +633,26 @@
                else if(em->totvertsel==1) nr= 4;
                else if(em->totedgesel==0) nr= 4;
                else if(em->totfacesel==0) 
-                       nr= pupmenu("Extrude %t|Only Edges%x3|Only 
Vertices%x4");
+                       nr= 3; // pupmenu("Extrude %t|Only Edges%x3|Only 
Vertices%x4");
                else if(em->totfacesel==1)
-                       nr= pupmenu("Extrude %t|Region %x1|Only Edges%x3|Only 
Vertices%x4");
+                       nr= 1; // pupmenu("Extrude %t|Region %x1|Only 
Edges%x3|Only Vertices%x4");
                else 
-                       nr= pupmenu("Extrude %t|Region %x1||Individual Faces 
%x2|Only Edges%x3|Only Vertices%x4");
+                       nr= 1; // pupmenu("Extrude %t|Region %x1||Individual 
Faces %x2|Only Edges%x3|Only Vertices%x4");
        }
        else if(em->selectmode & SCE_SELECT_EDGE) {
                if (em->totedgesel==0) nr = 0;
                else if (em->totedgesel==1) nr = 3;
                else if(em->totfacesel==0) nr = 3;
                else if(em->totfacesel==1)
-                       nr= pupmenu("Extrude %t|Region %x1|Only Edges%x3");
+                       nr= 1; // pupmenu("Extrude %t|Region %x1|Only 
Edges%x3");
                else
-                       nr= pupmenu("Extrude %t|Region %x1||Individual Faces 
%x2|Only Edges%x3");
+                       nr= 1; // pupmenu("Extrude %t|Region %x1||Individual 
Faces %x2|Only Edges%x3");
        }
        else {
                if (em->totfacesel == 0) nr = 0;
                else if (em->totfacesel == 1) nr = 1;
                else
-                       nr= pupmenu("Extrude %t|Region %x1||Individual Faces 
%x2");
+                       nr= 1; // pupmenu("Extrude %t|Region %x1||Individual 
Faces %x2");
        }
                
        if(nr<1) return;
@@ -696,18 +697,35 @@
 }
 
 // XXX should be a menu item
-static int mesh_extrude_exec(bContext *C, wmOperator *op)
+static int mesh_extrude_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= ((Mesh *)obedit->data)->edit_mesh;
 
        extrude_mesh(obedit,em, op);
-               
+       
+       RNA_int_set(op->ptr, "mode", TFM_TRANSLATION);
+       WM_operator_name_call(C, "TFM_OT_transform", WM_OP_INVOKE_REGION_WIN, 
op->ptr);
+
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
        
        return OPERATOR_FINISHED;       
 }
 
+/* extrude without transform */
+static int mesh_extrude_exec(bContext *C, wmOperator *op)
+{
+       Object *obedit= CTX_data_edit_object(C);
+       EditMesh *em= ((Mesh *)obedit->data)->edit_mesh;
+       
+       extrude_mesh(obedit,em, op);
+       
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       
+       return OPERATOR_FINISHED;       
+}
+
+
 void MESH_OT_extrude(wmOperatorType *ot)
 {
        /* identifiers */
@@ -715,11 +733,15 @@
        ot->idname= "MESH_OT_extrude";
        
        /* api callbacks */
+       ot->invoke= mesh_extrude_invoke;
        ot->exec= mesh_extrude_exec;
        ot->poll= ED_operator_editmesh;
        
        /* flags */
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+       /* to give to transform */
+       RNA_def_int(ot->srna, "mode", TFM_TRANSLATION, 0, INT_MAX, "Mode", "", 
0, INT_MAX);
 }
 
 static int split_mesh(bContext *C, wmOperator *op)
@@ -1258,88 +1280,7 @@
        RNA_def_enum(ot->srna, "type", prop_mesh_delete_types, 10, "Type", 
"Method used for deleting mesh data");
 }
 
-/* Got this from scanfill.c. You will need to juggle around the
- * callbacks for the scanfill.c code a bit for this to work. */
-void fill_mesh(EditMesh *em)
-{
-       EditVert *eve,*v1;
-       EditEdge *eed,*e1,*nexted;
-       EditFace *efa,*nextvl, *efan;
-       short ok;
 
-       if(em==NULL) return;
-       waitcursor(1);
-
-       /* copy all selected vertices */
-       eve= em->verts.first;
-       while(eve) {
-               if(eve->f & SELECT) {
-                       v1= BLI_addfillvert(eve->co);
-                       eve->tmp.v= v1;
-                       v1->tmp.v= eve;
-                       v1->xs= 0;      // used for counting edges
-               }
-               eve= eve->next;
-       }
-       /* copy all selected edges */
-       eed= em->edges.first;
-       while(eed) {
-               if( (eed->v1->f & SELECT) && (eed->v2->f & SELECT) ) {
-                       e1= BLI_addfilledge(eed->v1->tmp.v, eed->v2->tmp.v);
-                       e1->v1->xs++; 
-                       e1->v2->xs++;
-               }
-               eed= eed->next;
-       }
-       /* from all selected faces: remove vertices and edges to prevent 
doubles */
-       /* all edges add values, faces subtract,
-          then remove edges with vertices ->xs<2 */
-       efa= em->faces.first;
-       ok= 0;
-       while(efa) {
-               nextvl= efa->next;
-               if( faceselectedAND(efa, 1) ) {
-                       efa->v1->tmp.v->xs--;
-                       efa->v2->tmp.v->xs--;
-                       efa->v3->tmp.v->xs--;
-                       if(efa->v4) efa->v4->tmp.v->xs--;
-                       ok= 1;
-                       
-               }
-               efa= nextvl;
-       }
-       if(ok) {        /* there are faces selected */
-               eed= filledgebase.first;
-               while(eed) {
-                       nexted= eed->next;
-                       if(eed->v1->xs<2 || eed->v2->xs<2) {
-                               BLI_remlink(&filledgebase,eed);
-                       }
-                       eed= nexted;
-               }
-       }
-
-       if(BLI_edgefill(0, em->mat_nr)) {
-               efa= fillfacebase.first;
-               while(efa) {
-                       /* normals default pointing up */
-                       efan= addfacelist(em, efa->v3->tmp.v, efa->v2->tmp.v, 
-                                                         efa->v1->tmp.v, 0, 
NULL, NULL);
-                       if(efan) EM_select_face(efan, 1);
-                       efa= efa->next;
-               }
-       }
-
-       BLI_end_edgefill();
-
-       // XXX option beautyfill */
-
-       WM_cursor_wait(0);
-       EM_select_flush(em);
-//     DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-
-}
-
 /*GB*/
 
/*-------------------------------------------------------------------------------*/
 /*--------------------------- Edge Based Subdivide 
------------------------------*/
@@ -3104,173 +3045,7 @@
        }       
 }      
 
-/* note; the EM_selectmode_set() calls here illustrate how badly constructed 
it all is... from before the
-   edge/face flags, with very mixed results.... */
-void beauty_fill(EditMesh *em)
-{
-       EditVert *v1, *v2, *v3, *v4;
-       EditEdge *eed, *nexted;
-       EditEdge dia1, dia2;
-       EditFace *efa, *w;
-       // void **efaar, **efaa;
-       EVPTuple *efaar;
-       EVPtr *efaa;
-       float len1, len2, len3, len4, len5, len6, opp1, opp2, fac1, fac2;
-       int totedge, ok, notbeauty=8, onedone, vindex[4];
-       
-       /* - all selected edges with two faces
-               * - find the faces: store them in edges (using datablock)
-               * - per edge: - test convex
-               *                          - test edge: flip?
-               *                          - if true: remedge,  addedge, all 
edges at the edge get new face pointers
-               */
-       
-       EM_selectmode_set(em);  // makes sure in selectmode 'face' the edges of 
selected faces are selected too 
 
-       totedge = count_selected_edges(em->edges.first);
-       if(totedge==0) return;
-
-       /* temp block with face pointers */
-       efaar= (EVPTuple *) MEM_callocN(totedge * sizeof(EVPTuple), 
"beautyfill");
-
-       while (notbeauty) {
-               notbeauty--;
-

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to