svn merge -r38971:38972 https://svn.blender.org/svnroot/bf-blender/trunk/blender...
authorCampbell Barton <ideasman42@gmail.com>
Fri, 5 Aug 2011 08:16:09 +0000 (08:16 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 5 Aug 2011 08:16:09 +0000 (08:16 +0000)
source/blender/editors/include/ED_transform.h
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform_generics.c
source/blender/editors/transform/transform_ops.c

index d4d7f971b741940fd9b19da0b303e74981063307..00ae7dda2e3871c9782d4f1b80b63d16f04d19a9 100644 (file)
@@ -148,6 +148,7 @@ void BIF_selectOrientation(void);
 #define P_ALIGN_SNAP   (P_GEO_SNAP|(1 << 5))
 #define P_CONSTRAINT   (1 << 6)
 #define P_OPTIONS              (1 << 7)
+#define P_CORRECT_UV   (1 << 8)
 
 void Transform_Properties(struct wmOperatorType *ot, int flags);
 
index a6cde37913aa62e5f011f3083ce8291fd1c0a5d8..6e9b78011a6dea6507024150f75c21786b3dd620 100644 (file)
@@ -4609,6 +4609,12 @@ void projectSVData(TransInfo *t, int final)
        if (!em)
                return;
        
+       /* BMESH_TODO, (t->settings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT)
+        * currently all vertex data is interpolated which is nice mostly
+        * except for shape keys where you dont want to modify UVs for eg.
+        * current BMesh code doesnt make it easy to pick which data we interpolate
+        * - campbell */
+
        BLI_smallhash_init(&visit);
        
                for (i=0, tempsv=sld->sv; i<sld->totsv; i++, tempsv++) {
index 71d890daf0592ea7801c08dd5843354158958b73..9df00163302f2dee9ef7814e0f2c9e62d1250f76 100644 (file)
@@ -1015,6 +1015,22 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
                                t->options |= CTX_NO_PET;
                        }
                }
+
+               /* initialize UV transform from */
+               if (RNA_struct_find_property(op->ptr, "correct_uv")) {
+                       if(RNA_property_is_set(op->ptr, "correct_uv")) {
+                               if(RNA_boolean_get(op->ptr, "correct_uv")) {
+                                       t->settings->uvcalc_flag |= UVCALC_TRANSFORM_CORRECT;
+                               }
+                               else {
+                                       t->settings->uvcalc_flag &= ~UVCALC_TRANSFORM_CORRECT;
+                               }
+                       }
+                       else {
+                               RNA_boolean_set(op->ptr, "correct_uv", t->settings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT);
+                       }
+               }
+
        }
        else if(t->spacetype==SPACE_IMAGE)
        {
index fb40cee95fb4305a1ab7505597a9d159dd0eb429..54e0b31e201e75244b0bfa3b1a44da916095c926 100644 (file)
@@ -508,6 +508,11 @@ void Transform_Properties(struct wmOperatorType *ot, int flags)
                RNA_def_boolean(ot->srna, "texture_space", 0, "Edit Object data texture space", "");
        }
 
+       if (flags & P_CORRECT_UV)
+       {
+               RNA_def_boolean(ot->srna, "correct_uv", 0, "Correct UV coords when transforming", "");
+       }
+
        // Add confirm method all the time. At the end because it's not really that important and should be hidden only in log, not in keymap edit
        /*prop =*/ RNA_def_boolean(ot->srna, "release_confirm", 0, "Confirm on Release", "Always confirm operation when releasing button");
        //RNA_def_property_flag(prop, PROP_HIDDEN);
@@ -755,7 +760,7 @@ void TRANSFORM_OT_edge_slide(struct wmOperatorType *ot)
 
        RNA_def_float_factor(ot->srna, "value", 0, -1.0f, 1.0f, "Factor", "", -1.0f, 1.0f);
 
-       Transform_Properties(ot, P_MIRROR|P_SNAP);
+       Transform_Properties(ot, P_MIRROR|P_SNAP|P_CORRECT_UV);
 }
 
 void TRANSFORM_OT_edge_crease(struct wmOperatorType *ot)