code cleanup: rename transform Slide operations to EdgeSlide.
[blender.git] / source / blender / editors / transform / transform.c
index 3b443e8bbac169c36ad9dd901450c6aadd72f824..7cc6006970c8302e2a5ce5a6d3abd90fb72703e2 100644 (file)
 #include "DNA_movieclip_types.h"
 #include "DNA_scene_types.h"  /* PET modes */
 
-#include "RNA_access.h"
-
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-
-#include "BLF_api.h"
+#include "BLI_utildefines.h"
+#include "BLI_math.h"
+#include "BLI_rect.h"
+#include "BLI_listbase.h"
+#include "BLI_string.h"
+#include "BLI_ghash.h"
+#include "BLI_linklist.h"
+#include "BLI_smallhash.h"
 
 #include "BKE_nla.h"
 #include "BKE_bmesh.h"
@@ -69,6 +71,9 @@
 #include "BKE_unit.h"
 #include "BKE_mask.h"
 
+#include "BIF_gl.h"
+#include "BIF_glutil.h"
+
 #include "ED_image.h"
 #include "ED_keyframing.h"
 #include "ED_screen.h"
 #include "ED_clip.h"
 #include "ED_mask.h"
 
-#include "UI_view2d.h"
 #include "WM_types.h"
 #include "WM_api.h"
 
-#include "BLI_math.h"
-#include "BLI_blenlib.h"
-#include "BLI_utildefines.h"
-#include "BLI_ghash.h"
-#include "BLI_linklist.h"
-#include "BLI_smallhash.h"
-#include "BLI_array.h"
-
+#include "UI_view2d.h"
 #include "UI_interface_icons.h"
 #include "UI_resources.h"
 
+#include "RNA_access.h"
+
+#include "BLF_api.h"
+
 #include "transform.h"
 
 static void drawTransformApply(const struct bContext *C, ARegion *ar, void *arg);
@@ -462,7 +463,10 @@ static void viewRedrawForce(const bContext *C, TransInfo *t)
                        WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
                else
                        WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
-               
+
+               if (t->mode == TFM_EDGE_SLIDE && (t->settings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT))
+                       WM_event_add_notifier(C, NC_GEOM | ND_DATA, NULL);
+
                /* for realtime animation record - send notifiers recognised by animation editors */
                // XXX: is this notifier a lame duck?
                if ((t->animtimer) && IS_AUTOKEY_ON(t->scene))
@@ -4899,9 +4903,9 @@ static BMLoop *get_next_loop(BMVert *v, BMLoop *l,
        return NULL;
 }
 
-static void calcNonProportionalEdgeSlide(TransInfo *t, SlideData *sld, const float mval[2])
+static void calcNonProportionalEdgeSlide(TransInfo *t, EdgeSlideData *sld, const float mval[2])
 {
-       TransDataSlideVert *sv = sld->sv;
+       TransDataEdgeSlideVert *sv = sld->sv;
 
        if (sld->totsv > 0) {
                int i = 0;
@@ -4930,17 +4934,17 @@ static void calcNonProportionalEdgeSlide(TransInfo *t, SlideData *sld, const flo
        }
 }
 
-static int createSlideVerts(TransInfo *t)
+static int createEdgeSlideVerts(TransInfo *t)
 {
        BMEditMesh *em = BMEdit_FromObject(t->obedit);
        BMesh *bm = em->bm;
        BMIter iter;
        BMEdge *e, *e1;
        BMVert *v, *v2, *first;
-       TransDataSlideVert *sv_array;
+       TransDataEdgeSlideVert *sv_array;
        BMBVHTree *btree;
        SmallHash table;
-       SlideData *sld = MEM_callocN(sizeof(*sld), "sld");
+       EdgeSlideData *sld = MEM_callocN(sizeof(*sld), "sld");
        View3D *v3d = NULL;
        RegionView3D *rv3d = NULL;
        ARegion *ar = t->ar;
@@ -5037,7 +5041,7 @@ static int createSlideVerts(TransInfo *t)
                return 0;
        }
 
-       sv_array = MEM_callocN(sizeof(TransDataSlideVert) * j, "sv_array");
+       sv_array = MEM_callocN(sizeof(TransDataEdgeSlideVert) * j, "sv_array");
        loop_nr = 0;
 
        j = 0;
@@ -5099,7 +5103,7 @@ static int createSlideVerts(TransInfo *t)
                /*iterate over the loop*/
                first = v;
                do {
-                       TransDataSlideVert *sv = sv_array + j;
+                       TransDataEdgeSlideVert *sv = sv_array + j;
 
                        sv->v = v;
                        sv->origvert = *v;
@@ -5262,7 +5266,7 @@ static int createSlideVerts(TransInfo *t)
                if (dot_v3v3(loop_dir[l_nr], dir) < 0.0f) {
                        swap_v3_v3(sv_array->upvec, sv_array->downvec);
                        SWAP(BMVert, sv_array->vup, sv_array->vdown);
-                       SWAP(BMVert*, sv_array->up, sv_array->down);
+                       SWAP(BMVert *, sv_array->up, sv_array->down);
                }
        }
 
@@ -5302,10 +5306,10 @@ static int createSlideVerts(TransInfo *t)
        return 1;
 }
 
-void projectSVData(TransInfo *t, int final)
+void projectEdgeSlideData(TransInfo *t, bool is_final)
 {
-       SlideData *sld = t->customData;
-       TransDataSlideVert *sv;
+       EdgeSlideData *sld = t->customData;
+       TransDataEdgeSlideVert *sv;
        BMEditMesh *em = sld->em;
        SmallHash visit;
        int i;
@@ -5424,7 +5428,7 @@ void projectSVData(TransInfo *t, int final)
                                        }
 
                                }
-                               
+
                                if (!affected)
                                        continue;
 
@@ -5432,7 +5436,7 @@ void projectSVData(TransInfo *t, int final)
                                 * and we do not want to mess up other shape keys */
                                BM_loop_interp_from_face(em->bm, l, f_copy_flip, FALSE, FALSE);
 
-                               if (final) {
+                               if (is_final) {
                                        BM_loop_interp_multires(em->bm, l, f_copy_flip);
                                        if (f_copy != f_copy_flip) {
                                                BM_loop_interp_multires(em->bm, l, f_copy);
@@ -5456,7 +5460,7 @@ void projectSVData(TransInfo *t, int final)
        BLI_smallhash_release(&visit);
 }
 
-void freeSlideTempFaces(SlideData *sld)
+void freeEdgeSlideTempFaces(EdgeSlideData *sld)
 {
        if (sld->origfaces_init) {
                SmallHashIter hiter;
@@ -5477,13 +5481,13 @@ void freeSlideTempFaces(SlideData *sld)
 }
 
 
-void freeSlideVerts(TransInfo *t)
+void freeEdgeSlideVerts(TransInfo *t)
 {
-       SlideData *sld = t->customData;
+       EdgeSlideData *sld = t->customData;
        
 #if 0 /*BMESH_TODO*/
        if (me->drawflag & ME_DRAWEXTRA_EDGELEN) {
-               TransDataSlideVert *sv;
+               TransDataEdgeSlideVert *sv;
                LinkNode *look = sld->vertlist;
                GHash *vertgh = sld->vhash;
                while (look) {
@@ -5500,7 +5504,7 @@ void freeSlideVerts(TransInfo *t)
        if (!sld)
                return;
        
-       freeSlideTempFaces(sld);
+       freeEdgeSlideTempFaces(sld);
 
        bmesh_edit_end(sld->em->bm, BMO_OP_FLAG_UNTAN_MULTIRES);
 
@@ -5516,13 +5520,13 @@ void freeSlideVerts(TransInfo *t)
 
 void initEdgeSlide(TransInfo *t)
 {
-       SlideData *sld;
+       EdgeSlideData *sld;
 
        t->mode = TFM_EDGE_SLIDE;
        t->transform = EdgeSlide;
        t->handleEvent = handleEventEdgeSlide;
 
-       if (!createSlideVerts(t)) {
+       if (!createEdgeSlideVerts(t)) {
                t->state = TRANS_CANCEL;
                return;
        }
@@ -5532,7 +5536,7 @@ void initEdgeSlide(TransInfo *t)
        if (!sld)
                return;
 
-       t->customFree = freeSlideVerts;
+       t->customFree = freeEdgeSlideVerts;
 
        /* set custom point first if you want value to be initialized by init */
        setCustomPoints(t, &t->mouse, sld->end, sld->start);
@@ -5552,7 +5556,7 @@ void initEdgeSlide(TransInfo *t)
 int handleEventEdgeSlide(struct TransInfo *t, struct wmEvent *event)
 {
        if (t->mode == TFM_EDGE_SLIDE) {
-               SlideData *sld = t->customData;
+               EdgeSlideData *sld = t->customData;
 
                if (sld) {
                        switch (event->type) {
@@ -5598,14 +5602,14 @@ int handleEventEdgeSlide(struct TransInfo *t, struct wmEvent *event)
 void drawNonPropEdge(const struct bContext *C, TransInfo *t)
 {
        if (t->mode == TFM_EDGE_SLIDE) {
-               SlideData *sld = (SlideData *)t->customData;
+               EdgeSlideData *sld = (EdgeSlideData *)t->customData;
                /* Non-Prop mode */
                if (sld && sld->is_proportional == FALSE) {
                        View3D *v3d = CTX_wm_view3d(C);
                        float marker[3];
                        float v1[3], v2[3];
                        float interp_v;
-                       TransDataSlideVert *curr_sv = &sld->sv[sld->curr_sv_index];
+                       TransDataEdgeSlideVert *curr_sv = &sld->sv[sld->curr_sv_index];
                        const float ctrl_size = UI_GetThemeValuef(TH_FACEDOT_SIZE) + 1.5f;
                        const float guide_size = ctrl_size - 0.5f;
                        const float line_size = UI_GetThemeValuef(TH_OUTLINE_WIDTH) + 0.5f;
@@ -5671,8 +5675,8 @@ void drawNonPropEdge(const struct bContext *C, TransInfo *t)
 
 static int doEdgeSlide(TransInfo *t, float perc)
 {
-       SlideData *sld = t->customData;
-       TransDataSlideVert *svlist = sld->sv, *sv;
+       EdgeSlideData *sld = t->customData;
+       TransDataEdgeSlideVert *svlist = sld->sv, *sv;
        int i;
 
        sld->perc = perc;
@@ -5702,7 +5706,7 @@ static int doEdgeSlide(TransInfo *t, float perc)
                 * \note len_v3v3(curr_sv->upvec, curr_sv->downvec)
                 * is the same as the distance between the original vert locations, same goes for the lines below.
                 */
-               TransDataSlideVert *curr_sv = &sld->sv[sld->curr_sv_index];
+               TransDataEdgeSlideVert *curr_sv = &sld->sv[sld->curr_sv_index];
                const float curr_length_perc = curr_sv->edge_len * (((sld->flipped_vtx ? perc : -perc) + 1.0f) / 2.0f);
 
                float down_co[3];
@@ -5725,7 +5729,7 @@ static int doEdgeSlide(TransInfo *t, float perc)
                }
        }
        
-       projectSVData(t, 0);
+       projectEdgeSlideData(t, 0);
        
        return 1;
 }
@@ -5734,7 +5738,7 @@ int EdgeSlide(TransInfo *t, const int UNUSED(mval[2]))
 {
        char str[128];
        float final;
-       SlideData *sld =  t->customData;
+       EdgeSlideData *sld =  t->customData;
        int flipped = sld->flipped_vtx;
        int is_proportional = sld->is_proportional;