2.5:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 28 Jan 2009 21:43:43 +0000 (21:43 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 28 Jan 2009 21:43:43 +0000 (21:43 +0000)
* UV Editor Transform, translate, rotate, scale, live unwrap, snap, gesture,
  etc work.
* Also for selection operators, used OPERATOR_FINISHED|OPERATOR_PASS_THROUGH
  instead of just OPERATOR_PASS_THROUGH to make gestures work, seems more
  correct to me.

16 files changed:
source/blender/editors/include/ED_image.h [new file with mode: 0644]
source/blender/editors/include/ED_uvedit.h
source/blender/editors/space_image/image_header.c
source/blender/editors/space_image/image_intern.h
source/blender/editors/space_image/space_image.c
source/blender/editors/space_ipo/ipo_select.c
source/blender/editors/space_node/node_select.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_generics.c
source/blender/editors/transform/transform_ops.c
source/blender/editors/transform/transform_snap.c
source/blender/editors/uvedit/uvedit_intern.h
source/blender/editors/uvedit/uvedit_ops.c
source/blender/editors/uvedit/uvedit_unwrap_ops.c
source/blender/makesrna/intern/rna_space.c

diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h
new file mode 100644 (file)
index 0000000..ac73aa1
--- /dev/null
@@ -0,0 +1,39 @@
+/**
+ * $Id:
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. 
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2008 Blender Foundation.
+ * All rights reserved.
+ * 
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef ED_IMAGE_H
+#define ED_IMAGE_H
+
+struct SpaceImage;
+
+/* space_image.c, exported for transform */
+struct Image *ED_space_image(struct SpaceImage *sima);
+void ED_space_image_size(struct SpaceImage *sima, int *width, int *height);
+void ED_space_image_uv_aspect(struct SpaceImage *sima, float *aspx, float *aspy);
+
+#endif /* ED_IMAGE_H */
+
index f027dbc89158225a6826f80fbb8cd03c7e59136a..fa106ff4360a3fa3ec4a19b256e6ef835f32621e 100644 (file)
@@ -30,6 +30,8 @@
 
 struct Scene;
 struct Object;
+struct MTFace;
+struct EditFace;
 struct Image;
 struct wmWindowManager;
 
@@ -41,5 +43,20 @@ void ED_uvedit_assign_image(struct Scene *scene, struct Object *obedit, struct I
 void ED_uvedit_set_tile(struct Scene *scene, struct Object *obedit, struct Image *ima, int curtile, int dotile);
 int ED_uvedit_minmax(struct Scene *scene, struct Image *ima, struct Object *obedit, float *min, float *max);
 
+int ED_uvedit_test_silent(struct Object *obedit);
+int ED_uvedit_test(struct Object *obedit);
+
+int uvedit_face_visible(struct Scene *scene, struct Image *ima, struct EditFace *efa, struct MTFace *tf);
+int uvedit_face_selected(struct Scene *scene, struct EditFace *efa, struct MTFace *tf);
+int uvedit_edge_selected(struct Scene *scene, struct EditFace *efa, struct MTFace *tf, int i);
+int uvedit_uv_selected(struct Scene *scene, struct EditFace *efa, struct MTFace *tf, int i);
+
+int ED_uvedit_nearest_uv(struct Scene *scene, struct Object *obedit, struct Image *ima, float co[2], float uv[2]);
+
+/* uvedit_unwrap.c */
+void ED_uvedit_live_unwrap_begin(struct Scene *scene, struct Object *obedit);
+void ED_uvedit_live_unwrap_re_solve(void);
+void ED_uvedit_live_unwrap_end(short cancel);
+
 #endif /* ED_UVEDIT_H */
 
index de39eb0fd27b1b34b8080c7a4a96457057b2bc00..f9601e175cef04d10bea849c283774b535722ff1 100644 (file)
@@ -662,10 +662,6 @@ static uiBlock *image_uvs_scriptsmenu (void *args_unused)
 static void do_uvsmenu(bContext *C, void *arg, int event)
 {
        switch(event) {
-       case 1: /* UVs Constrained Rectangular */
-               if(sima->flag & SI_BE_SQUARE) sima->flag &= ~SI_BE_SQUARE;
-               else sima->flag |= SI_BE_SQUARE;
-               break;
        case 2: /* UVs Clipped to Image Size */
                if(sima->flag & SI_CLIP_UV) sima->flag &= ~SI_CLIP_UV;
                else sima->flag |= SI_CLIP_UV;
@@ -727,7 +723,6 @@ static uiBlock *image_uvsmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_
        block= uiBeginBlock(C, handle->region, "image_imagemenu", UI_EMBOSSP, UI_HELV);
 
        uiDefMenuTogR(block, &uvptr, "snap_to_pixels", 0, NULL);
-       uiDefMenuTogR(block, &uvptr, "constrain_quads_rectangular", 0, NULL);
        uiDefMenuTogR(block, &uvptr, "constrain_to_image_bounds", 0, NULL);
 
        uiDefMenuSep(block);
index 85d4c476150378c9a22a0f93c7c10601534ba1e4..e8552e68020ab65900efc7c5a5e935d259b55361 100644 (file)
@@ -47,6 +47,7 @@ struct ImBuf *get_space_image_buffer(struct SpaceImage *sima);
 void get_space_image_size(struct SpaceImage *sima, int *width, int *height);
 void get_space_image_aspect(struct SpaceImage *sima, float *aspx, float *aspy);
 void get_space_image_zoom(struct SpaceImage *sima, struct ARegion *ar, float *zoomx, float *zoomy);
+void get_space_image_uv_aspect(struct SpaceImage *sima, float *aspx, float *aspy);
 
 int get_space_image_show_render(struct SpaceImage *sima);
 int get_space_image_show_paint(struct SpaceImage *sima);
index 5ac79ea46e68590c198055bfa1ecf5b0fa125f61..123094bf35a7761ecc5f4aa00961cb7d1b64d937 100644 (file)
@@ -53,6 +53,7 @@
 #include "IMB_imbuf.h"
 #include "IMB_imbuf_types.h"
 
+#include "ED_image.h"
 #include "ED_mesh.h"
 #include "ED_space_api.h"
 #include "ED_screen.h"
@@ -547,6 +548,17 @@ void get_space_image_zoom(SpaceImage *sima, ARegion *ar, float *zoomx, float *zo
        *zoomy= (float)(ar->winrct.ymax - ar->winrct.ymin)/(float)((ar->v2d.cur.ymax - ar->v2d.cur.ymin)*height);
 }
 
+void get_space_image_uv_aspect(SpaceImage *sima, float *aspx, float *aspy)
+{
+       int w, h;
+
+       get_space_image_aspect(sima, aspx, aspy);
+       get_space_image_size(sima, &w, &h);
+
+       *aspx *= (float)w;
+       *aspy *= (float)h;
+}
+
 int get_space_image_show_render(SpaceImage *sima)
 {
        return (sima->image && ELEM(sima->image->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE));
@@ -585,3 +597,21 @@ int get_space_image_show_uvshadow(SpaceImage *sima, Object *obedit)
        return 0;
 }
 
+/* Exported Functions */
+
+Image *ED_space_image(SpaceImage *sima)
+{
+       return get_space_image(sima);
+}
+
+void ED_space_image_size(SpaceImage *sima, int *width, int *height)
+{
+       get_space_image_size(sima, width, height);
+}
+
+void ED_space_image_uv_aspect(SpaceImage *sima, float *aspx, float *aspy)
+{
+       get_space_image_uv_aspect(sima, aspx, aspy);
+}
+
+
index 1f4fbe135e5411c2bce538408ea5de65750148c9..fff40f1c7399ebc62de1396e777710a0cad90eff 100644 (file)
@@ -871,7 +871,7 @@ static int graphkeys_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *ev
        ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_BOTH);
        
        /* for tweak grab to work */
-       return OPERATOR_PASS_THROUGH;
+       return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
 }
  
 void GRAPHEDIT_OT_keyframes_clickselect (wmOperatorType *ot)
index 25d9d45a93438ea2f426d6f3a874fbea269a0531..35391dfcda0bcdcb1e33adac95e0c772454a6140 100644 (file)
@@ -127,7 +127,7 @@ static int node_select_exec(bContext *C, wmOperator *op)
        WM_event_add_notifier(C, NC_SCENE|ND_NODES, NULL); /* Do we need to pass the scene? */
 
        /* allow tweak event to work too */
-       return OPERATOR_PASS_THROUGH;
+       return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
 }
 
 static int node_select_modal(bContext *C, wmOperator *op, wmEvent *event)
index 1c5e6396be44b748d9f84baa8c7d4a8c782f71ec..39fa4ed815b170affccc454923aa87c43feea430 100644 (file)
@@ -76,7 +76,6 @@
 //#include "BIF_editmesh.h"
 //#include "BIF_editsima.h"
 //#include "BIF_editparticle.h"
-//#include "BIF_drawimage.h"           /* uvco_to_areaco_noclip */
 //#include "BIF_editaction.h" 
 
 #include "BKE_action.h" /* get_action_frame */
 //#include "BSE_time.h"
 //#include "BSE_view.h"
 
-#include "ED_view3d.h"
+#include "ED_image.h"
 #include "ED_screen.h"
-#include "ED_util.h"
 #include "ED_space_api.h"
+#include "ED_util.h"
+#include "ED_view3d.h"
 
 #include "UI_view2d.h"
 #include "WM_types.h"
@@ -192,9 +192,7 @@ void convertViewVec(TransInfo *t, float *vec, short dx, short dy)
                View2D *v2d = t->view;
                float divx, divy, aspx, aspy;
                
-               // TRANSFORM_FIX_ME
-               //transform_aspect_ratio_tface_uv(&aspx, &aspy);
-               aspx= aspy= 1.0f;
+               ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy);
                
                divx= v2d->mask.xmax-v2d->mask.xmin;
                divy= v2d->mask.ymax-v2d->mask.ymin;
@@ -246,13 +244,11 @@ void projectIntView(TransInfo *t, float *vec, int *adr)
        else if(t->spacetype==SPACE_IMAGE) {
                float aspx, aspy, v[2];
                
-               // TRANSFORM_FIX_ME
-               //transform_aspect_ratio_tface_uv(&aspx, &aspy);
+               ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy);
                v[0]= vec[0]/aspx;
                v[1]= vec[1]/aspy;
                
-               // TRANSFORM_FIX_ME
-               //uvco_to_areaco_noclip(v, adr);
+               UI_view2d_to_region_no_clip(t->view, v[0], v[1], adr, adr+1);
        }
        else if(t->spacetype==SPACE_IPO) {
                int out[2] = {0, 0};
@@ -293,46 +289,44 @@ void projectFloatView(TransInfo *t, float *vec, float *adr)
 
 void applyAspectRatio(TransInfo *t, float *vec)
 {
-#if 0 // TRANSFORM_FIX_ME
-       TransInfo *t = BIF_GetTransInfo();
+       SpaceImage *sima= t->sa->spacedata.first;
 
        if ((t->spacetype==SPACE_IMAGE) && (t->mode==TFM_TRANSLATION)) {
                float aspx, aspy;
 
-               if((G.sima->flag & SI_COORDFLOATS)==0) {
+               if((sima->flag & SI_COORDFLOATS)==0) {
                        int width, height;
-                       transform_width_height_tface_uv(&width, &height);
+                       ED_space_image_size(sima, &width, &height);
 
                        vec[0] *= width;
                        vec[1] *= height;
                }
 
-               transform_aspect_ratio_tface_uv(&aspx, &aspy);
+               ED_space_image_uv_aspect(sima, &aspx, &aspy);
                vec[0] /= aspx;
                vec[1] /= aspy;
        }
-#endif
 }
 
 void removeAspectRatio(TransInfo *t, float *vec)
 {
-#if 0 // TRANSFORM_FIX_ME
+       SpaceImage *sima= t->sa->spacedata.first;
+
        if ((t->spacetype==SPACE_IMAGE) && (t->mode==TFM_TRANSLATION)) {
                float aspx, aspy;
 
-               if((G.sima->flag & SI_COORDFLOATS)==0) {
+               if((sima->flag & SI_COORDFLOATS)==0) {
                        int width, height;
-                       transform_width_height_tface_uv(&width, &height);
+                       ED_space_image_size(sima, &width, &height);
 
                        vec[0] /= width;
                        vec[1] /= height;
                }
 
-               transform_aspect_ratio_tface_uv(&aspx, &aspy);
+               ED_space_image_uv_aspect(sima, &aspx, &aspy);
                vec[0] *= aspx;
                vec[1] *= aspy;
        }
-#endif
 }
 
 static void viewRedrawForce(bContext *C, TransInfo *t)
@@ -371,12 +365,16 @@ static void viewRedrawForce(bContext *C, TransInfo *t)
        {
                WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, NULL);
        }
-#if 0 // TRANSFORM_FIX_ME
        else if (t->spacetype==SPACE_IMAGE) {
-               if (G.sima->lock) force_draw_plus(SPACE_VIEW3D, 0);
+#if 0
+               SpaceImage *sima= (SpaceImage*)t->sa->spacedata.first;
+               if(sima->lock) force_draw_plus(SPACE_VIEW3D, 0);
                else force_draw(0);
+#endif
+
+               // XXX better notifier, and how to deal with lock?
+               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, t->obedit);
        }
-#endif 
 }
 
 static void viewRedrawPost(TransInfo *t)
index 63b15fec3b819a1ef1ed93fec82c089fd10a30e8..9b6aff67da12b3531bd56953bb62bc987fc48f92 100644 (file)
 #include "ED_anim_api.h"
 #include "ED_armature.h"
 #include "ED_editparticle.h"
+#include "ED_image.h"
 #include "ED_keyframing.h"
 #include "ED_keyframes_edit.h"
 #include "ED_mesh.h"
 #include "ED_types.h"
+#include "ED_uvedit.h"
 #include "ED_view3d.h"
 
 #include "UI_view2d.h"
 //#include "BDR_drawaction.h"          // list of keyframes in action
 //#include "BDR_editobject.h"          // reset_slowparents()
 //#include "BDR_gpencil.h"
-//#include "BDR_unwrapper.h"
 
 #include "BLI_arithb.h"
 #include "BLI_blenlib.h"
@@ -157,11 +158,6 @@ extern ListBase editelems;
 
 #include "BLO_sys_types.h" // for intptr_t support
 
-/************ STUBS TO GET COMPILE ************/
-void transform_aspect_ratio_tface_uv(float *a1, float *a2) {}
-
-
-
 /* local function prototype - for Object/Bone Constraints */
 static short constraints_list_needinv(TransInfo *t, ListBase *list);
 
@@ -2380,11 +2376,11 @@ void flushTransSeq(TransInfo *t)
 
 /* ********************* UV ****************** */
 
-static void UVsToTransData(TransData *td, TransData2D *td2d, float *uv, int selected)
+static void UVsToTransData(SpaceImage *sima, TransData *td, TransData2D *td2d, float *uv, int selected)
 {
        float aspx, aspy;
 
-       transform_aspect_ratio_tface_uv(&aspx, &aspy);
+       ED_space_image_uv_aspect(sima, &aspx, &aspy);
 
        /* uv coords are scaled by aspects. this is needed for rotations and
           proportional editing to be consistent with the stretchted uv coords
@@ -2418,61 +2414,35 @@ static void UVsToTransData(TransData *td, TransData2D *td2d, float *uv, int sele
 
 static void createTransUVs(bContext *C, TransInfo *t)
 {
-#if 0 // TRANSFORM_FIX_ME
        SpaceImage *sima = (SpaceImage*)CTX_wm_space_data(C);
+       Image *ima = CTX_data_edit_image(C);
+       Scene *scene = CTX_data_scene(C);
        TransData *td = NULL;
        TransData2D *td2d = NULL;
        MTFace *tf;
        int count=0, countsel=0;
        int propmode = t->flag & T_PROP_EDIT;
-       int efa_s1,efa_s2,efa_s3,efa_s4;
 
        EditMesh *em = ((Mesh *)t->obedit->data)->edit_mesh;
        EditFace *efa;
        
-       if(is_uv_tface_editing_allowed()==0) return;
+       if(!ED_uvedit_test(t->obedit)) return;
 
        /* count */
-       if (sima->flag & SI_BE_SQUARE && !propmode) {
-               for (efa= em->faces.first; efa; efa= efa->next) {
-                       /* store face pointer for second loop, prevent second lookup */
-                       tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-                       if (simaFaceDraw_Check(efa, tf)) {
-                               efa->tmp.p = tf;
-                               
-                               efa_s1 = simaUVSel_Check(efa, tf, 0);
-                               efa_s2 = simaUVSel_Check(efa, tf, 1);
-                               efa_s3 = simaUVSel_Check(efa, tf, 2);
-                               if (efa->v4) {
-                                       efa_s4 = simaUVSel_Check(efa, tf, 3);
-                                       if ( efa_s1 || efa_s2 || efa_s3 || efa_s4 ) {
-                                               countsel += 4; /* all corners of this quad need their edges moved. so we must store TD for each */
-                                       }
-                               } else {
-                                       /* tri's are delt with normally when SI_BE_SQUARE's enabled */
-                                       if (efa_s1) countsel++; 
-                                       if (efa_s2) countsel++; 
-                                       if (efa_s3) countsel++;
-                               }
-                       } else {
-                               efa->tmp.p = NULL;
-                       }
-               }
-       } else {
-               for (efa= em->faces.first; efa; efa= efa->next) {
-                       tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-                       if (simaFaceDraw_Check(efa, tf)) {
-                               efa->tmp.p = tf;
-                               
-                               if (simaUVSel_Check(efa, tf, 0)) countsel++; 
-                               if (simaUVSel_Check(efa, tf, 1)) countsel++; 
-                               if (simaUVSel_Check(efa, tf, 2)) countsel++; 
-                               if (efa->v4 && simaUVSel_Check(efa, tf, 3)) countsel++;
-                               if(propmode)
-                                       count += (efa->v4)? 4: 3;
-                       } else {
-                               efa->tmp.p = NULL;
-                       }
+       for (efa= em->faces.first; efa; efa= efa->next) {
+               tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+
+               if(uvedit_face_visible(scene, ima, efa, tf)) {
+                       efa->tmp.p = tf;
+                       
+                       if (uvedit_uv_selected(scene, efa, tf, 0)) countsel++; 
+                       if (uvedit_uv_selected(scene, efa, tf, 1)) countsel++; 
+                       if (uvedit_uv_selected(scene, efa, tf, 2)) countsel++; 
+                       if (efa->v4 && uvedit_uv_selected(scene, efa, tf, 3)) countsel++;
+                       if(propmode)
+                               count += (efa->v4)? 4: 3;
+               } else {
+                       efa->tmp.p = NULL;
                }
        }
        
@@ -2491,81 +2461,36 @@ static void createTransUVs(bContext *C, TransInfo *t)
        td= t->data;
        td2d= t->data2d;
        
-       if (sima->flag & SI_BE_SQUARE && !propmode) {
-               for (efa= em->faces.first; efa; efa= efa->next) {
-                       tf=(MTFace *)efa->tmp.p;
-                       if (tf) {
-                               efa_s1 = simaUVSel_Check(efa, tf, 0);
-                               efa_s2 = simaUVSel_Check(efa, tf, 1);
-                               efa_s3 = simaUVSel_Check(efa, tf, 2);
-                               
-                               if (efa->v4) {
-                                       efa_s4 = simaUVSel_Check(efa, tf, 3);
-                                       
-                                       if ( efa_s1 || efa_s2 || efa_s3 || efa_s4 ) {
-                                               /* all corners of this quad need their edges moved. so we must store TD for each */
-
-                                               UVsToTransData(td, td2d, tf->uv[0], efa_s1);
-                                               if (!efa_s1)    td->flag |= TD_SKIP;
-                                               td++; td2d++;
-
-                                               UVsToTransData(td, td2d, tf->uv[1], efa_s2);
-                                               if (!efa_s2)    td->flag |= TD_SKIP;
-                                               td++; td2d++;
-
-                                               UVsToTransData(td, td2d, tf->uv[2], efa_s3);
-                                               if (!efa_s3)    td->flag |= TD_SKIP;
-                                               td++; td2d++;
-
-                                               UVsToTransData(td, td2d, tf->uv[3], efa_s4);
-                                               if (!efa_s4)    td->flag |= TD_SKIP;
-                                               td++; td2d++;
-                                       }
-                               } else {
-                                       /* tri's are delt with normally when SI_BE_SQUARE's enabled */
-                                       if (efa_s1) UVsToTransData(td++, td2d++, tf->uv[0], 1); 
-                                       if (efa_s2) UVsToTransData(td++, td2d++, tf->uv[1], 1); 
-                                       if (efa_s3) UVsToTransData(td++, td2d++, tf->uv[2], 1);
-                               }
-                       }
-               }
-       } else {
-               for (efa= em->faces.first; efa; efa= efa->next) {
-                       /*tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-                       if (simaFaceDraw_Check(efa, tf)) {*/
-                       if ((tf=(MTFace *)efa->tmp.p)) {
-                               if (propmode) {
-                                       UVsToTransData(td++, td2d++, tf->uv[0], simaUVSel_Check(efa, tf, 0));
-                                       UVsToTransData(td++, td2d++, tf->uv[1], simaUVSel_Check(efa, tf, 1));
-                                       UVsToTransData(td++, td2d++, tf->uv[2], simaUVSel_Check(efa, tf, 2));
-                                       if(efa->v4)
-                                               UVsToTransData(td++, td2d++, tf->uv[3], simaUVSel_Check(efa, tf, 3));
-                               } else {
-                                       if(simaUVSel_Check(efa, tf, 0))                         UVsToTransData(td++, td2d++, tf->uv[0], 1);
-                                       if(simaUVSel_Check(efa, tf, 1))                         UVsToTransData(td++, td2d++, tf->uv[1], 1);
-                                       if(simaUVSel_Check(efa, tf, 2))                         UVsToTransData(td++, td2d++, tf->uv[2], 1);
-                                       if(efa->v4 && simaUVSel_Check(efa, tf, 3))      UVsToTransData(td++, td2d++, tf->uv[3], 1);
-                               }
+       for (efa= em->faces.first; efa; efa= efa->next) {
+               if ((tf=(MTFace *)efa->tmp.p)) {
+                       if (propmode) {
+                               UVsToTransData(sima, td++, td2d++, tf->uv[0], uvedit_uv_selected(scene, efa, tf, 0));
+                               UVsToTransData(sima, td++, td2d++, tf->uv[1], uvedit_uv_selected(scene, efa, tf, 1));
+                               UVsToTransData(sima, td++, td2d++, tf->uv[2], uvedit_uv_selected(scene, efa, tf, 2));
+                               if(efa->v4)
+                                       UVsToTransData(sima, td++, td2d++, tf->uv[3], uvedit_uv_selected(scene, efa, tf, 3));
+                       } else {
+                               if(uvedit_uv_selected(scene, efa, tf, 0))                               UVsToTransData(sima, td++, td2d++, tf->uv[0], 1);
+                               if(uvedit_uv_selected(scene, efa, tf, 1))                               UVsToTransData(sima, td++, td2d++, tf->uv[1], 1);
+                               if(uvedit_uv_selected(scene, efa, tf, 2))                               UVsToTransData(sima, td++, td2d++, tf->uv[2], 1);
+                               if(efa->v4 && uvedit_uv_selected(scene, efa, tf, 3))    UVsToTransData(sima, td++, td2d++, tf->uv[3], 1);
                        }
                }
        }
        
        if (sima->flag & SI_LIVE_UNWRAP)
-               unwrap_lscm_live_begin();
-#endif
+               ED_uvedit_live_unwrap_begin(t->scene, t->obedit);
 }
 
 void flushTransUVs(TransInfo *t)
 {
-#if 0 // TRANSFORM_FIX_ME
+       SpaceImage *sima = t->sa->spacedata.first;
        TransData2D *td;
        int a, width, height;
-       Object *ob= OBACT;
-       EditMesh *em = ((Mesh *)ob->data)->edit_mesh;
        float aspx, aspy, invx, invy;
 
-       transform_aspect_ratio_tface_uv(&aspx, &aspy);
-       transform_width_height_tface_uv(&width, &height);
+       ED_space_image_uv_aspect(sima, &aspx, &aspy);
+       ED_space_image_size(sima, &width, &height);
        invx= 1.0f/aspx;
        invy= 1.0f/aspy;
 
@@ -2574,28 +2499,20 @@ void flushTransUVs(TransInfo *t)
                td->loc2d[0]= td->loc[0]*invx;
                td->loc2d[1]= td->loc[1]*invy;
                
-               if((G.sima->flag & SI_PIXELSNAP) && (t->state != TRANS_CANCEL)) {
+               if((sima->flag & SI_PIXELSNAP) && (t->state != TRANS_CANCEL)) {
                        td->loc2d[0]= (float)floor(width*td->loc2d[0] + 0.5f)/width;
                        td->loc2d[1]= (float)floor(height*td->loc2d[1] + 0.5f)/height;
                }
        }
-       
-       if((G.sima->flag & SI_BE_SQUARE) && (t->flag & T_PROP_EDIT)==0 && (t->state != TRANS_CANCEL)) 
-               be_square_tface_uv(em);
-
-       /* this is overkill if G.sima->lock is not set, but still needed */
-       object_uvs_changed(ob);
-#endif
 }
 
 int clipUVTransform(TransInfo *t, float *vec, int resize)
 {
-#if 0 // TRANSFORM_FIX_ME
        TransData *td;
        int a, clipx=1, clipy=1;
        float aspx, aspy, min[2], max[2];
 
-       transform_aspect_ratio_tface_uv(&aspx, &aspy);
+       ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy);
        min[0]= min[1]= 0.0f;
        max[0]= aspx; max[1]= aspy;
 
@@ -2635,11 +2552,8 @@ int clipUVTransform(TransInfo *t, float *vec, int resize)
        }       
 
        return (clipx || clipy);
-#endif
-return 0;
 }
 
-
 /* ********************* ACTION/NLA EDITOR ****************** */
 
 /* Called by special_aftertrans_update to make sure selected gp-frames replace
index 490a2a83da311fa07a8788e15fd0da496434f093..0a0b6e6f07a6360cd65f841c9a97f79a8fc3029c 100644 (file)
 
 #include "ED_anim_api.h"
 #include "ED_armature.h"
-#include "ED_view3d.h"
+#include "ED_image.h"
 #include "ED_mesh.h"
 #include "ED_space_api.h"
+#include "ED_uvedit.h"
+#include "ED_view3d.h"
 
 //#include "BDR_unwrapper.h"
 
@@ -446,10 +448,13 @@ void recalcData(TransInfo *t)
        else if (t->obedit) {
                if (t->obedit->type == OB_MESH) {
                        if(t->spacetype==SPACE_IMAGE) {
+                               SpaceImage *sima= t->sa->spacedata.first;
+
                                flushTransUVs(t);
-                               /* TRANSFORM_FIX_ME */
-//                             if (G.sima->flag & SI_LIVE_UNWRAP)
-//                                     unwrap_lscm_live_re_solve();
+                               if(sima->flag & SI_LIVE_UNWRAP)
+                                       ED_uvedit_live_unwrap_re_solve();
+       
+                               DAG_object_flush_update(t->scene, t->obedit, OB_RECALC_DATA);
                        } else {
                                EditMesh *em = ((Mesh*)t->obedit->data)->edit_mesh;
                                /* mirror modifier clipping? */
@@ -728,11 +733,9 @@ void initTransInfo (bContext *C, TransInfo *t, wmEvent *event)
        }
        else if(t->spacetype==SPACE_IMAGE || t->spacetype==SPACE_NODE)
        {
-               View2D *v2d = sa->spacedata.first; // XXX no!
-
-               t->view = v2d;
-
-               t->around = v2d->around;
+               // XXX for now, get View2D  from the active region
+               t->view = &ar->v2d;
+               t->around = ar->v2d.around;
        }
        else
        {
@@ -776,10 +779,9 @@ void postTrans (TransInfo *t)
        }
 
        if(t->spacetype==SPACE_IMAGE) {
-#if 0 // TRANSFORM_FIX_ME
-               if (G.sima->flag & SI_LIVE_UNWRAP)
-                       unwrap_lscm_live_end(t->state == TRANS_CANCEL);
-#endif
+               SpaceImage *sima= t->sa->spacedata.first;
+               if(sima->flag & SI_LIVE_UNWRAP)
+                       ED_uvedit_live_unwrap_end(t->state == TRANS_CANCEL);
        }
        else if(t->spacetype==SPACE_ACTION) {
                if (t->customData)
@@ -908,16 +910,17 @@ void calculateCenterCursor(TransInfo *t)
 
 void calculateCenterCursor2D(TransInfo *t)
 {
-#if 0 // TRANSFORM_FIX_ME
+       View2D *v2d= t->view;
        float aspx=1.0, aspy=1.0;
        
        if(t->spacetype==SPACE_IMAGE) /* only space supported right now but may change */
-               transform_aspect_ratio_tface_uv(&aspx, &aspy);
-       if (G.v2d) {
-               t->center[0] = G.v2d->cursor[0] * aspx; 
-               t->center[1] = G.v2d->cursor[1] * aspy; 
+               ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy);
+
+       if (v2d) {
+               t->center[0] = v2d->cursor[0] * aspx; 
+               t->center[1] = v2d->cursor[1] * aspy; 
        }
-#endif
+
        calculateCenter2D(t);
 }
 
index 9fcddf3965f17d86dd6c7af3933352e3295911d0..03f634145f57639371d4d7485793478a8ff8aa40 100644 (file)
@@ -322,6 +322,22 @@ void transform_keymap_for_space(struct wmWindowManager *wm, struct ListBase *key
                        km= WM_keymap_add_item(keymap, "TFM_OT_transform", EKEY, KM_PRESS, 0, 0);
                        RNA_int_set(km->ptr, "mode", TFM_TIME_EXTEND);
                        break;
+               case SPACE_IMAGE:
+                       km = WM_keymap_add_item(keymap, "TFM_OT_transform", GKEY, KM_PRESS, 0, 0);
+                       RNA_int_set(km->ptr, "mode", TFM_TRANSLATION);
+                       
+                       km= WM_keymap_add_item(keymap, "TFM_OT_transform", EVT_TWEAK_S, KM_ANY, 0, 0);
+                       RNA_int_set(km->ptr, "mode", TFM_TRANSLATION);
+                       
+                       km = WM_keymap_add_item(keymap, "TFM_OT_transform", RKEY, KM_PRESS, 0, 0);
+                       RNA_int_set(km->ptr, "mode", TFM_ROTATION);
+
+                       km = WM_keymap_add_item(keymap, "TFM_OT_transform", SKEY, KM_PRESS, 0, 0);
+                       RNA_int_set(km->ptr, "mode", TFM_RESIZE);
+
+                       km = WM_keymap_add_item(keymap, "TFM_OT_transform", SKEY, KM_PRESS, KM_ALT|KM_CTRL|KM_SHIFT, 0);
+                       RNA_int_set(km->ptr, "mode", TFM_SHEAR);
+                       break;
                default:
                        break;
        }
index 7663f3418fbddbdd766609c10ad0bfdb1d4b8a1a..447c4b810ab3f1c58c1898834b33563c4db856a7 100644 (file)
 #include "BKE_anim.h" /* for duplis */
 #include "BKE_context.h"
 
-#include "ED_view3d.h"
+#include "ED_image.h"
 #include "ED_mesh.h"
+#include "ED_uvedit.h"
+#include "ED_view3d.h"
 
 #include "WM_types.h"
 
 #include "UI_resources.h"
+#include "UI_view2d.h"
 
 #include "MEM_guardedalloc.h"
 
@@ -172,9 +175,8 @@ void drawSnapping(TransInfo *t)
                        myortho2(G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin, G.v2d->cur.ymax);
                        glLoadIdentity();
                        
-                       aspect_sima(G.sima, &xuser_asp, &yuser_asp);
-                       
-                       transform_width_height_tface_uv(&wi, &hi);
+                       ED_space_image_aspect(t->sa->spacedata.first, &xuser_aspx, &yuser_asp);
+                       ED_space_image_width(t->sa->spacedata.first, &wi, &hi);
                        w = (((float)wi)/256.0f)*G.sima->zoom * xuser_asp;
                        h = (((float)hi)/256.0f)*G.sima->zoom * yuser_asp;
                        
@@ -559,20 +561,16 @@ void CalcSnapGeometry(TransInfo *t, float *vec)
                        }
                }
                else if (t->spacetype == SPACE_IMAGE)
-               {       /* same as above but for UV's */
-                       MTFace *nearesttf=NULL;
-                       float aspx, aspy;
-                       int face_corner;
+               {
+                       /* same as above but for UV's */
+                       Image *ima= ED_space_image(t->sa->spacedata.first);
+                       float aspx, aspy, co[2];
                        
-                       // TRANSFORM_FIX_ME
-                       //find_nearest_uv(&nearesttf, NULL, NULL, &face_corner);
+                       UI_view2d_region_to_view(&t->ar->v2d, t->mval[0], t->mval[1], co, co+1);
 
-                       if (nearesttf != NULL)
+                       if(ED_uvedit_nearest_uv(t->scene, t->obedit, ima, co, t->tsnap.snapPoint))
                        {
-                               VECCOPY2D(t->tsnap.snapPoint, nearesttf->uv[face_corner]);
-
-                               // TRANSFORM_FIX_ME
-                               //transform_aspect_ratio_tface_uv(&aspx, &aspy);
+                               ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy);
                                t->tsnap.snapPoint[0] *= aspx;
                                t->tsnap.snapPoint[1] *= aspy;
 
@@ -1311,8 +1309,7 @@ static void applyGrid(TransInfo *t, float *val, int max_index, float fac[3], Gea
        
        /* evil hack - snapping needs to be adapted for image aspect ratio */
        if((t->spacetype==SPACE_IMAGE) && (t->mode==TFM_TRANSLATION)) {
-               // TRANSFORM_FIX_ME
-               //transform_aspect_ratio_tface_uv(asp, asp+1);
+               ED_space_image_uv_aspect(t->sa->spacedata.first, asp, asp+1);
        }
 
        for (i=0; i<=max_index; i++) {
index ea188848e1e614b303928b311d6a14f7a0a1536f..eb58562239ede940d62edde16399aac332b2e390 100644 (file)
@@ -44,10 +44,6 @@ struct wmOperatorType;
 #define TF_PIN_MASK(id) (TF_PIN1 << id)
 #define TF_SEL_MASK(id) (TF_SEL1 << id)
 
-/* state testing */
-int uvedit_test(struct Object *obedit);
-int uvedit_test_silent(struct Object *obedit);
-
 /* visibility and selection */
 int uvedit_face_visible_nolocal(struct Scene *scene, struct EditFace *efa);
 int uvedit_face_visible(struct Scene *scene, struct Image *ima, struct EditFace *efa, struct MTFace *tf);
index 38e959aeff790ad42cefc807d83a806b1c3dde83..24b664daa1336ec92f180365d44153f598d4a85c 100644 (file)
@@ -56,6 +56,8 @@
 
 #include "IMB_imbuf_types.h" // XXX remove?
 
+#include "BIF_transform.h"
+
 #include "ED_mesh.h"
 #include "ED_screen.h"
 
@@ -77,7 +79,7 @@ void uvface_setsel__internal(bContext *C, SpaceImage *sima, Scene *scene, Object
 
 /************************* state testing ************************/
 
-int uvedit_test_silent(Object *obedit)
+int ED_uvedit_test_silent(Object *obedit)
 {
        if(obedit->type != OB_MESH)
                return 0;
@@ -85,12 +87,12 @@ int uvedit_test_silent(Object *obedit)
        return EM_texFaceCheck(((Mesh*)obedit->data)->edit_mesh);
 }
 
-int uvedit_test(Object *obedit)
+int ED_uvedit_test(Object *obedit)
 {
        // XXX if(!obedit)
        // XXX  error("Enter Edit Mode to perform this action");
 
-       return uvedit_test_silent(obedit);
+       return ED_uvedit_test_silent(obedit);
 }
 
 /************************* assign image ************************/
@@ -160,7 +162,7 @@ void ED_uvedit_set_tile(Scene *scene, Object *obedit, Image *ima, int curtile, i
        MTFace *tf;
        
        /* verify if we have something to do */
-       if(!ima || !uvedit_test_silent(obedit))
+       if(!ima || !ED_uvedit_test_silent(obedit))
                return;
        
        /* skip assigning these procedural images... */
@@ -436,69 +438,6 @@ int uvedit_center(Scene *scene, Image *ima, Object *obedit, float *cent, int mod
        return 0;
 }
 
-/************************** constraints ****************************/
-
-void uvedit_constrain_square(Scene *scene, Image *ima, EditMesh *em)
-{
-       EditFace *efa;
-       MTFace *tf;
-
-       /* if 1 vertex selected: doit (with the selected vertex) */
-       for(efa= em->faces.first; efa; efa= efa->next) {
-               if(efa->v4) {
-                       tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-
-                       if(uvedit_face_visible(scene, ima, efa, tf)) {
-                               if(uvedit_uv_selected(scene, efa, tf, 0)) {
-                                       if(tf->uv[1][0] == tf->uv[2][0] ) {
-                                               tf->uv[1][1]= tf->uv[0][1];
-                                               tf->uv[3][0]= tf->uv[0][0];
-                                       }
-                                       else {  
-                                               tf->uv[1][0]= tf->uv[0][0];
-                                               tf->uv[3][1]= tf->uv[0][1];
-                                       }
-                                       
-                               }
-
-                               if(uvedit_uv_selected(scene, efa, tf, 1)) {
-                                       if(tf->uv[2][1] == tf->uv[3][1] ) {
-                                               tf->uv[2][0]= tf->uv[1][0];
-                                               tf->uv[0][1]= tf->uv[1][1];
-                                       }
-                                       else {
-                                               tf->uv[2][1]= tf->uv[1][1];
-                                               tf->uv[0][0]= tf->uv[1][0];
-                                       }
-
-                               }
-
-                               if(uvedit_uv_selected(scene, efa, tf, 2)) {
-                                       if(tf->uv[3][0] == tf->uv[0][0] ) {
-                                               tf->uv[3][1]= tf->uv[2][1];
-                                               tf->uv[1][0]= tf->uv[2][0];
-                                       }
-                                       else {
-                                               tf->uv[3][0]= tf->uv[2][0];
-                                               tf->uv[1][1]= tf->uv[2][1];
-                                       }
-                               }
-
-                               if(uvedit_uv_selected(scene, efa, tf, 3)) {
-                                       if(tf->uv[0][1] == tf->uv[1][1] ) {
-                                               tf->uv[0][0]= tf->uv[3][0];
-                                               tf->uv[2][1]= tf->uv[3][1];
-                                       }
-                                       else  {
-                                               tf->uv[0][1]= tf->uv[3][1];
-                                               tf->uv[2][0]= tf->uv[3][0];
-                                       }
-                               }
-                       }
-               }
-       }
-}
-
 /************************** find nearest ****************************/
 
 typedef struct NearestHit {
@@ -652,6 +591,41 @@ static void find_nearest_uv_vert(Scene *scene, Image *ima, EditMesh *em, float c
        }
 }
 
+int ED_uvedit_nearest_uv(Scene *scene, Object *obedit, Image *ima, float co[2], float uv[2])
+{
+       EditMesh *em= ((Mesh*)obedit->data)->edit_mesh;
+       EditFace *efa;
+       MTFace *tf;
+       float mindist, dist;
+       int i, nverts, found= 0;
+
+       mindist= 1e10f;
+       uv[0]= co[0];
+       uv[1]= co[1];
+       
+       for(efa= em->faces.first; efa; efa= efa->next) {
+               tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+
+               if(uvedit_face_visible(scene, ima, efa, tf)) {
+                       nverts= efa->v4? 4: 3;
+
+                       for(i=0; i<nverts; i++) {
+                               dist= fabs(co[0]-tf->uv[i][0]) + fabs(co[1]-tf->uv[i][1]);
+
+                               if(dist<=mindist) {
+                                       mindist= dist;
+
+                                       uv[0]= tf->uv[i][0];
+                                       uv[1]= tf->uv[i][1];
+                                       found= 1;
+                               }
+                       }
+               }
+       }
+
+       return found;
+}
+
 /*********************** loop select ***********************/
 
 static void uv_vertex_loop_flag(UvMapVert *first)
@@ -1323,9 +1297,6 @@ static int stitch_exec(bContext *C, wmOperator *op)
                MEM_freeN(uv_average);
        }
 
-       // XXX if(sima->flag & SI_BE_SQUARE)
-       // XXX  uvedit_constrain_square(scene, sima->image, em);
-
        DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); // XXX
 
@@ -1747,7 +1718,7 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop)
        DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
 
-       return OPERATOR_FINISHED;
+       return OPERATOR_PASS_THROUGH|OPERATOR_FINISHED;
 }
 
 static int select_exec(bContext *C, wmOperator *op)
@@ -1947,7 +1918,7 @@ void borderselect_sima(bContext *C, SpaceImage *sima, Scene *scene, Image *ima,
        int val, ok = 1;
        short mval[2], select;
 
-       if(!uvedit_test(obedit)) return;
+       if(!ED_uvedit_test(obedit)) return;
 
        val= 0; // XXX get_border(&rect, 3);
        select = 0; // XXX (val==LEFTMOUSE) ? 1 : 0; 
@@ -2236,7 +2207,7 @@ void snap_uv_curs_to_pixels(SpaceImage *sima, View2D *v2d)
 
 int snap_uv_curs_to_sel(Scene *scene, Image *ima, Object *obedit, View2D *v2d)
 {
-       if(!uvedit_test(obedit)) return 0;
+       if(!ED_uvedit_test(obedit)) return 0;
        return uvedit_center(scene, ima, obedit, v2d->cursor, 0);
 }
 
@@ -2244,7 +2215,7 @@ void snap_menu_sima(SpaceImage *sima, Scene *scene, Object *obedit, View2D *v2d)
 {
        short event;
 
-       if(!uvedit_test(obedit) || !v2d) return; /* !G.v2d should never happen */
+       if(!ED_uvedit_test(obedit) || !v2d) return; /* !G.v2d should never happen */
        
        event = 0; // XXX pupmenu("Snap %t|Selection -> Pixels%x1|Selection -> Cursor%x2|Selection -> Adjacent Unselected%x3|Cursor -> Selection%x4|Cursor -> Pixel%x5");
        switch (event) {
@@ -2515,7 +2486,7 @@ void pin_tface_uv(Scene *scene, Image *ima, Object *obedit, int mode)
        EditFace *efa;
        MTFace *tface;
        
-       if(!uvedit_test(obedit)) return;
+       if(!ED_uvedit_test(obedit)) return;
        
        for(efa= em->faces.first; efa; efa= efa->next) {
                tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
@@ -2547,7 +2518,7 @@ void select_pinned_tface_uv(Scene *scene, Image *ima, Object *obedit)
        EditFace *efa;
        MTFace *tface;
        
-       if(!uvedit_test(obedit)) return;
+       if(!ED_uvedit_test(obedit)) return;
        
        for(efa= em->faces.first; efa; efa= efa->next) {
                tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
@@ -2597,11 +2568,16 @@ void ED_keymap_uvedit(wmWindowManager *wm)
        // XXX not working?
        RNA_boolean_set(WM_keymap_add_item(keymap, "UV_OT_loop_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, KM_ALT)->ptr, "extend", 1);
 
+       /* generates event, needs to be after select to work */
+       WM_keymap_add_item(keymap, "WM_OT_tweak_gesture", SELECTMOUSE, KM_PRESS, 0, 0);
+
        WM_keymap_add_item(keymap, "UV_OT_select_linked", LKEY, KM_PRESS, KM_CTRL, 0);
        WM_keymap_add_item(keymap, "UV_OT_unlink_selection", LKEY, KM_PRESS, KM_ALT, 0);
        WM_keymap_add_item(keymap, "UV_OT_de_select_all", AKEY, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "UV_OT_select_invert", IKEY, KM_PRESS, KM_CTRL, 0);
 
        WM_keymap_add_item(keymap, "UV_OT_stitch", VKEY, KM_PRESS, 0, 0);
+
+       transform_keymap_for_space(wm, keymap, SPACE_IMAGE);
 }
 
index 0fe907677f3a465cbf326ce88fd7e867575c0040..de5838823d12449371e373004b88a526f179b093 100644 (file)
@@ -53,6 +53,7 @@
 #include "PIL_time.h"
 
 #include "ED_mesh.h"
+#include "ED_uvedit.h"
 
 #include "uvedit_intern.h"
 #include "uvedit_parametrizer.h"
@@ -166,12 +167,12 @@ void unwrap_lscm(Scene *scene, Object *obedit, short seamcut)
        short fillholes = scene->toolsettings->uvcalc_flag & UVCALC_FILLHOLES;
        
        /* add uvs if there not here */
-       if (!uvedit_test(obedit)) {
+       if (!ED_uvedit_test(obedit)) {
 #if 0
                if (em && em->faces.first)
                        EM_add_data_layer(&em->fdata, CD_MTFACE);
                
-               if (!uvedit_test(obedit))
+               if (!ED_uvedit_test(obedit))
                        return;
                
                if (G.sima && G.sima->image) /* this is a bit of a kludge, but assume they want the image on their mesh when UVs are added */
@@ -219,7 +220,7 @@ void minimize_stretch_tface_uv(Scene *scene, Object *obedit)
        unsigned short event = 0;
        short fillholes = scene->toolsettings->uvcalc_flag & UVCALC_FILLHOLES;
        
-       if(!uvedit_test(obedit)) return;
+       if(!ED_uvedit_test(obedit)) return;
 
        handle = construct_param_handle(scene, em, 1, fillholes, 1);
 
@@ -309,7 +310,7 @@ void pack_charts_tface_uv(Scene *scene, Object *obedit)
        EditMesh *em= ((Mesh*)obedit->data)->edit_mesh;
        ParamHandle *handle;
        
-       if(!uvedit_test(obedit)) return;
+       if(!ED_uvedit_test(obedit)) return;
 
        handle = construct_param_handle(scene, em, 1, 0, 1);
        param_pack(handle);
@@ -330,7 +331,7 @@ void average_charts_tface_uv(Scene *scene, Object *obedit)
        EditMesh *em= ((Mesh*)obedit->data)->edit_mesh;
        ParamHandle *handle;
        
-       if(!uvedit_test(obedit)) return;
+       if(!ED_uvedit_test(obedit)) return;
 
        handle = construct_param_handle(scene, em, 1, 0, 1);
        param_average(handle);
@@ -349,20 +350,20 @@ void average_charts_tface_uv(Scene *scene, Object *obedit)
 
 static ParamHandle *liveHandle = NULL;
 
-void unwrap_lscm_live_begin(Scene *scene, Object *obedit)
+void ED_uvedit_live_unwrap_begin(Scene *scene, Object *obedit)
 {
        EditMesh *em= ((Mesh*)obedit->data)->edit_mesh;
        short abf = scene->toolsettings->unwrapper == 1;
        short fillholes = scene->toolsettings->uvcalc_flag & UVCALC_FILLHOLES;
 
-       if(!uvedit_test(obedit)) return;
+       if(!ED_uvedit_test(obedit)) return;
 
        liveHandle = construct_param_handle(scene, em, 0, fillholes, 1);
 
        param_lscm_begin(liveHandle, PARAM_TRUE, abf);
 }
 
-void unwrap_lscm_live_re_solve(void)
+void ED_uvedit_live_unwrap_re_solve(void)
 {
        if (liveHandle) {
                param_lscm_solve(liveHandle);
@@ -370,7 +371,7 @@ void unwrap_lscm_live_re_solve(void)
        }
 }
        
-void unwrap_lscm_live_end(short cancel)
+void ED_uvedit_live_unwrap_end(short cancel)
 {
        if (liveHandle) {
                param_lscm_end(liveHandle);
index 2c366093e15f6a86210d83558136e63f730bee1e..25542fd6d655d5c6f5be1f6275e66f3fad0ba462 100644 (file)
@@ -210,10 +210,6 @@ static void rna_def_space_image_uv(BlenderRNA *brna)
        RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_PIXELSNAP);
        RNA_def_property_ui_text(prop, "Snap to Pixels", "Snap UVs to pixel locations while editing.");
 
-       prop= RNA_def_property(srna, "constrain_quads_rectangular", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_BE_SQUARE);
-       RNA_def_property_ui_text(prop, "Constrain Quads Rectangular", "Constrain quads to be rectangular while editing.");
-
        prop= RNA_def_property(srna, "constrain_to_image_bounds", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_CLIP_UV);
        RNA_def_property_ui_text(prop, "Constrain to Image Bounds", "Constraint to stay within the image bounds while editing.");