Revision: 18843
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18843
Author:   blendix
Date:     2009-02-07 02:27:46 +0100 (Sat, 07 Feb 2009)

Log Message:
-----------
2.5: UV Editor, more operators.

Border Select
Circle Select
Pin
Select Pinned
Unwrap
Minimize Stretch
Pack Islands
Average Islands Scale
Snap Cursor
Snap Selection

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/include/ED_mesh.h
    branches/blender2.5/blender/source/blender/editors/include/ED_screen.h
    branches/blender2.5/blender/source/blender/editors/include/UI_interface.h
    
branches/blender2.5/blender/source/blender/editors/interface/interface_regions.c
    branches/blender2.5/blender/source/blender/editors/mesh/editmesh_mods.c
    branches/blender2.5/blender/source/blender/editors/screen/screen_ops.c
    
branches/blender2.5/blender/source/blender/editors/space_image/image_header.c
    branches/blender2.5/blender/source/blender/editors/space_image/space_image.c
    
branches/blender2.5/blender/source/blender/editors/space_view3d/space_view3d.c
    branches/blender2.5/blender/source/blender/editors/transform/transform.c
    branches/blender2.5/blender/source/blender/editors/uvedit/uvedit_intern.h
    branches/blender2.5/blender/source/blender/editors/uvedit/uvedit_ops.c
    
branches/blender2.5/blender/source/blender/editors/uvedit/uvedit_unwrap_ops.c
    branches/blender2.5/blender/source/blender/windowmanager/WM_types.h

Modified: branches/blender2.5/blender/source/blender/editors/include/ED_mesh.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/ED_mesh.h        
2009-02-06 21:18:36 UTC (rev 18842)
+++ branches/blender2.5/blender/source/blender/editors/include/ED_mesh.h        
2009-02-07 01:27:46 UTC (rev 18843)
@@ -112,6 +112,8 @@
 void           EM_select_edge(struct EditEdge *eed, int sel);
 void           EM_select_face(struct EditFace *efa, int sel);
 void           EM_select_face_fgon(struct EditMesh *em, struct EditFace *efa, 
int val);
+void           EM_select_swap(struct EditMesh *em);
+void           EM_toggle_select_all(struct EditMesh *em);
 void           EM_selectmode_flush(struct EditMesh *em);
 void           EM_deselect_flush(struct EditMesh *em);
 void           EM_selectmode_set(struct EditMesh *em);

Modified: branches/blender2.5/blender/source/blender/editors/include/ED_screen.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/ED_screen.h      
2009-02-06 21:18:36 UTC (rev 18842)
+++ branches/blender2.5/blender/source/blender/editors/include/ED_screen.h      
2009-02-07 01:27:46 UTC (rev 18843)
@@ -114,6 +114,7 @@
 int            ED_operator_editarmature(struct bContext *C);
 int            ED_operator_editcurve(struct bContext *C);
 int            ED_operator_uvedit(struct bContext *C);
+int            ED_operator_uvmap(struct bContext *C);
 int            ED_operator_posemode(struct bContext *C);
 
 

Modified: 
branches/blender2.5/blender/source/blender/editors/include/UI_interface.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/UI_interface.h   
2009-02-06 21:18:36 UTC (rev 18842)
+++ branches/blender2.5/blender/source/blender/editors/include/UI_interface.h   
2009-02-07 01:27:46 UTC (rev 18843)
@@ -212,7 +212,7 @@
 void uiMenuItemVal(uiMenuItem *head, const char *name, int icon, int argval);
 
 void uiMenuItemEnumO(uiMenuItem *head, int icon, char *opname, char *propname, 
int value);
-void uiMenuItemBooleanO(uiMenuItem *head, int icon, char *opname, char 
*propname, int value);
+void uiMenuItemBooleanO(uiMenuItem *head, const char *name, int icon, char 
*opname, char *propname, int value);
 void uiMenuItemsEnumO(uiMenuItem *head, char *opname, char *propname);
 void uiMenuItemIntO(uiMenuItem *head, const char *name, int icon, char 
*opname, char *propname, int value);
 void uiMenuItemFloatO(uiMenuItem *head, const char *name, int icon, char 
*opname, char *propname, float value);

Modified: 
branches/blender2.5/blender/source/blender/editors/interface/interface_regions.c
===================================================================
--- 
branches/blender2.5/blender/source/blender/editors/interface/interface_regions.c
    2009-02-06 21:18:36 UTC (rev 18842)
+++ 
branches/blender2.5/blender/source/blender/editors/interface/interface_regions.c
    2009-02-07 01:27:46 UTC (rev 18843)
@@ -2035,9 +2035,9 @@
 }
 
 /* single operator item with property */
-void uiMenuItemBooleanO(uiMenuItem *head, int icon, char *opname, char 
*propname, int value)
+void uiMenuItemBooleanO(uiMenuItem *head, const char *name, int icon, char 
*opname, char *propname, int value)
 {
-       uiMenuItem *item= ui_menu_add_item(head, "", icon, 0);
+       uiMenuItem *item= ui_menu_add_item(head, name, icon, 0);
        
        item->opname= opname; // static!
        item->propname= propname; // static!

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-06 21:18:36 UTC (rev 18842)
+++ branches/blender2.5/blender/source/blender/editors/mesh/editmesh_mods.c     
2009-02-07 01:27:46 UTC (rev 18843)
@@ -3354,7 +3354,7 @@
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
-static void selectswap_mesh(EditMesh *em) /* UI level */
+void EM_select_swap(EditMesh *em) /* exported for UV */
 {
        EditVert *eve;
        EditEdge *eed;
@@ -3395,7 +3395,7 @@
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= ((Mesh *)obedit->data)->edit_mesh;
        
-       selectswap_mesh(em);
+       EM_select_swap(em);
        
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
        return OPERATOR_FINISHED;       
@@ -3417,21 +3417,23 @@
        
 /* ******************** (de)select all operator **************** */
 
+void EM_toggle_select_all(EditMesh *em) /* exported for UV */
+{
+       if(EM_nvertices_selected(em))
+               EM_clear_flag_all(em, SELECT);
+       else 
+               EM_set_flag_all(em, SELECT);
+}
+
 static int toggle_select_all_exec(bContext *C, wmOperator *op)
 {
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= ((Mesh *)obedit->data)->edit_mesh;
        
-       if( EM_nvertices_selected(em) ) {
-               EM_clear_flag_all(em, SELECT);
-       }
-       else  {
-               EM_set_flag_all(em, SELECT);
-       }
-               
-//             if (EM_texFaceCheck())
+       EM_toggle_select_all(em);
        
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+
        return OPERATOR_FINISHED;
 }
 

Modified: branches/blender2.5/blender/source/blender/editors/screen/screen_ops.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/screen/screen_ops.c      
2009-02-06 21:18:36 UTC (rev 18842)
+++ branches/blender2.5/blender/source/blender/editors/screen/screen_ops.c      
2009-02-07 01:27:46 UTC (rev 18843)
@@ -210,6 +210,20 @@
        return 0;
 }
 
+int ED_operator_uvmap(bContext *C)
+{
+       Object *obedit= CTX_data_edit_object(C);
+       EditMesh *em= NULL;
+
+       if(obedit && obedit->type==OB_MESH)
+               em= ((Mesh *)obedit->data)->edit_mesh;
+
+    if(em && (em->faces.first))
+               return 1;
+
+       return 0;
+}
+
 int ED_operator_editcurve(bContext *C)
 {
        Object *obedit= CTX_data_edit_object(C);

Modified: 
branches/blender2.5/blender/source/blender/editors/space_image/image_header.c
===================================================================
--- 
branches/blender2.5/blender/source/blender/editors/space_image/image_header.c   
    2009-02-06 21:18:36 UTC (rev 18842)
+++ 
branches/blender2.5/blender/source/blender/editors/space_image/image_header.c   
    2009-02-07 01:27:46 UTC (rev 18843)
@@ -160,39 +160,21 @@
        else uiMenuItemO(head, 0, "SCREEN_OT_screen_full_area"); // "Maximize 
Window", Ctr DownArrow
 }
 
-#if 0
-static void do_selectmenu(bContext *C, void *arg, int event)
-{
-       switch(event)
-       {
-       case 0: /* Border Select */
-               borderselect_sima(UV_SELECT_ALL);
-               break;
-       case 8: /* Border Select Pinned */
-               borderselect_sima(UV_SELECT_PINNED);
-               break;
-       case 7: /* Pinned UVs */
-               select_pinned_tface_uv();
-               break;
-       }
-}
-#endif
-
 static void image_selectmenu(bContext *C, uiMenuItem *head, void *arg_unused)
 {
-       uiMenuItemO(head, 0, "UV_OT_border_select"); // Border Select|B
-       uiMenuItemO(head, 0, "UV_OT_border_select_pinned"); // Border Select 
Pinned|Shift B
+       uiMenuItemO(head, 0, "UV_OT_border_select");
+       uiMenuItemBooleanO(head, "Border Select Pinned", 0, 
"UV_OT_border_select", "pinned", 1); // Border Select Pinned|Shift B
 
        uiMenuSeparator(head);
        
        uiMenuItemO(head, 0, "UV_OT_de_select_all");
        uiMenuItemO(head, 0, "UV_OT_select_invert");
-       uiMenuItemO(head, 0, "UV_OT_unlink_selection"); // Unlink Selection|Alt 
L
+       uiMenuItemO(head, 0, "UV_OT_unlink_selection");
        
        uiMenuSeparator(head);
 
-       uiMenuItemO(head, 0, "UV_OT_select_pinned"); // Select Pinned|Shift P
-       uiMenuItemO(head, 0, "UV_OT_select_linked"); // Select Linked|Ctrl L
+       uiMenuItemO(head, 0, "UV_OT_select_pinned");
+       uiMenuItemO(head, 0, "UV_OT_select_linked");
 }
 
 #if 0
@@ -376,59 +358,12 @@
        uiMenuItemO(head, 0, "UV_OT_scale"); // Scale|S
 }
 
-#if 0
-static void do_image_uvs_mirrormenu(void *arg, int event)
-{
-       float mat[3][3];
-       
-       Mat3One(mat);
-       
-       switch(event) {
-       case 0: /* X axis */
-               initTransform(TFM_MIRROR, CTX_NO_PET|CTX_AUTOCONFIRM);
-               BIF_setSingleAxisConstraint(mat[0], " on global X axis");
-               Transform();
-               break;
-       case 1: /* Y axis */
-               initTransform(TFM_MIRROR, CTX_NO_PET|CTX_AUTOCONFIRM);
-               BIF_setSingleAxisConstraint(mat[1], " on global Y axis");
-               Transform();
-               break;
-       }
-       
-       BIF_undo_push("Mirror UV");
-}
-#endif
-
 static void image_uvs_mirrormenu(bContext *C, uiMenuItem *head, void 
*arg_unused)
 {
        uiMenuItemEnumO(head, 0, "UV_OT_mirror", "axis", 'x'); // "X Axis", M, 1
        uiMenuItemEnumO(head, 0, "UV_OT_mirror", "axis", 'y'); // "Y Axis", M, 2
 }
 
-#if 0
-static void do_image_uvs_weldalignmenu(void *arg, int event)
-{
-       switch(event) {
-       case 0: /* Weld */
-               weld_align_tface_uv('w');
-               break;
-       case 1: /* Align Auto */
-               weld_align_tface_uv('a');
-               break;
-       case 2: /* Align X */
-               weld_align_tface_uv('x');
-               break;
-       case 3: /* Align Y */
-               weld_align_tface_uv('y');
-               break;
-       }
-       
-       if(event==0) BIF_undo_push("Weld UV");
-       else if(ELEM3(event, 1, 2, 3)) BIF_undo_push("Align UV");
-}
-#endif
-
 static void image_uvs_weldalignmenu(bContext *C, uiMenuItem *head, void 
*arg_unused)
 {
        uiMenuItemO(head, 0, "UV_OT_weld"); // W, 1
@@ -474,32 +409,9 @@
 static void do_uvsmenu(bContext *C, void *arg, int event)
 {
        switch(event) {
-       case 2: /* UVs Clipped to Image Size */
-               if(sima->flag & SI_CLIP_UV) sima->flag &= ~SI_CLIP_UV;
-               else sima->flag |= SI_CLIP_UV;
-               break;
-       case 5: /* Proportional Edit (toggle) */
-               if(G.scene->proportional)
-                       G.scene->proportional= 0;
-               else
-                       G.scene->proportional= 1;
-               break;
-       case 7: /* UVs Snap to Pixel */
-               sima->flag ^= SI_PIXELSNAP;
-               break;
-    case 8:
-               pin_tface_uv(1);
-               break;
-    case 9:
-               pin_tface_uv(0);
-               break;
     case 10:
                unwrap_lscm(0);
                break;
-       case 11:
-               if(sima->flag & SI_LIVE_UNWRAP) sima->flag &= ~SI_LIVE_UNWRAP;
-               else sima->flag |= SI_LIVE_UNWRAP;
-               break;
        case 12:
                minimize_stretch_tface_uv();
                break;
@@ -536,15 +448,15 @@
        uiMenuSeparator(head);
 
        uiMenuItemBooleanR(head, &uvptr, "live_unwrap");
-       uiMenuItemO(head, 0, "UV_OT_unwrap"); // Unwrap|E
-       uiMenuItemO(head, 0, "UV_OT_unpin"); // Unpin|Alt P
-       uiMenuItemO(head, 0, "UV_OT_pin"); // Pin|P
+       uiMenuItemO(head, 0, "UV_OT_unwrap");
+       uiMenuItemBooleanO(head, "Unpin", 0, "UV_OT_pin", "clear", 1);
+       uiMenuItemO(head, 0, "UV_OT_pin");
 
        uiMenuSeparator(head);
 
-       uiMenuItemO(head, 0, "UV_OT_pack_islands"); // Pack Islands|Ctr P
-       uiMenuItemO(head, 0, "UV_OT_average_islands"); // Average Islands 
Scale|Ctrl A
-       uiMenuItemO(head, 0, "UV_OT_minimize_stretch"); // Minimize 
Stretch...|Ctrl V
+       uiMenuItemO(head, 0, "UV_OT_pack_islands");
+       uiMenuItemO(head, 0, "UV_OT_average_islands_scale");
+       uiMenuItemO(head, 0, "UV_OT_minimize_stretch");

@@ 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