Fix #30980: edge slide Correct UVs option not working.

Was a bmesh todo, main issue was with shape keys, now disabled any changes to
the shape key data layer, and disabled the option altogether when editing
non-basis shape keys.
This commit is contained in:
Brecht Van Lommel
2012-04-17 14:24:04 +00:00
parent e4734d3d01
commit 3f9fce6542
3 changed files with 17 additions and 27 deletions

View File

@@ -4697,15 +4697,17 @@ void projectSVData(TransInfo *t, int final)
BMEditMesh *em = sld->em;
SmallHash visit;
int i;
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 don't want to modify UVs for eg.
* current BMesh code doesnt make it easy to pick which data we interpolate
* - campbell */
if(!(t->settings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT))
return;
/* don't do this at all for non-basis shape keys, too easy to
accidentally break uv maps or vertex colors then */
if(em->bm->shapenr > 1)
return;
BLI_smallhash_init(&visit);
@@ -4717,14 +4719,14 @@ void projectSVData(TransInfo *t, int final)
BMIter liter2;
BMFace *copyf, *copyf2;
BMLoop *l2;
int sel, hide /*, do_vdata */ /* UNUSED */;
int sel, hide;
if (BLI_smallhash_haskey(&visit, (uintptr_t)f))
continue;
BLI_smallhash_insert(&visit, (uintptr_t)f, NULL);
/*the face attributes of the copied face will get
/* the face attributes of the copied face will get
* copied over, so its necessary to save the selection
* and hidden state*/
sel = BM_elem_flag_test(f, BM_ELEM_SELECT);
@@ -4732,16 +4734,13 @@ void projectSVData(TransInfo *t, int final)
copyf2 = BLI_smallhash_lookup(&sld->origfaces, (uintptr_t)f);
/*project onto copied projection face*/
/* project onto copied projection face */
BM_ITER(l2, &liter2, em->bm, BM_LOOPS_OF_FACE, f) {
copyf = copyf2;
/* do_vdata = l2->v==tempsv->v; */ /* UNUSED */
if (BM_elem_flag_test(l2->e, BM_ELEM_SELECT) || BM_elem_flag_test(l2->prev->e, BM_ELEM_SELECT)) {
BMLoop *l3 = l2;
/* do_vdata = 1; */ /* UNUSED */
if (!BM_elem_flag_test(l2->e, BM_ELEM_SELECT))
l3 = l3->prev;
@@ -4755,10 +4754,9 @@ void projectSVData(TransInfo *t, int final)
continue; /* shouldn't happen, but protection */
}
/* do not run interpolation of all layers for now because it's not actually what you'll always expect
* and layers like shapekeys shouldn't be interpolated from here because oherwise they'll
* propagate to basis keys and will propagate twice to related keys (sergey) */
// BM_loop_interp_from_face(em->bm, l2, copyf, do_vdata, FALSE);
/* only loop data, no vertex data since that contains shape keys,
* and we do not want to mess up other shape keys */
BM_loop_interp_from_face(em->bm, l2, copyf, FALSE, FALSE);
if (final) {
BM_loop_interp_multires(em->bm, l2, copyf);
@@ -4893,10 +4891,7 @@ static int doEdgeSlide(TransInfo *t, float perc)
}
}
/* BMESH_TODO: simply not all layers should be interpolated from there
* but it's quite complicated to set this up with current API.
* details are in comments in projectSVData function */
// projectSVData(t, 0);
projectSVData(t, 0);
return 1;
}

View File

@@ -4892,10 +4892,6 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
}
EDBM_automerge(t->scene, t->obedit, 1);
}
#if 0
/* BMESH_TODO: simply nothing to cancel from here, but when interpolation of
* some custom layers would be added this code would eb needed
* some details are in comments in projectSVData (sergey) */
else {
if (t->mode == TFM_EDGE_SLIDE) {
SlideData *sld = t->customData;
@@ -4904,7 +4900,6 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
projectSVData(t, FALSE);
}
}
#endif
}
}

View File

@@ -500,12 +500,12 @@ void Transform_Properties(struct wmOperatorType *ot, int flags)
if (flags & P_OPTIONS)
{
RNA_def_boolean(ot->srna, "texture_space", 0, "Edit Object data texture space", "");
RNA_def_boolean(ot->srna, "texture_space", 0, "Edit Texture Space", "Edit Object data texture space");
}
if (flags & P_CORRECT_UV)
{
RNA_def_boolean(ot->srna, "correct_uv", 0, "Correct UV coords when transforming", "");
RNA_def_boolean(ot->srna, "correct_uv", 0, "Correct UVs", "Correct UV coordinates 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