Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoerg Mueller <nexyon@gmail.com>2011-08-03 16:44:52 +0400
committerJoerg Mueller <nexyon@gmail.com>2011-08-03 16:44:52 +0400
commiteb9d591898e93dbbe9e28865018175b9da730596 (patch)
tree3209caefe505273e834a936e54f6146a4185e83b /source/blender/editors/transform
parent6d7490632f13f9744c6b3e507c838a34f3481846 (diff)
parentf1fb54e126824ff38b8bf26fa80f3f46c886bd45 (diff)
* Merging trunk up to r38981.
* Fixing a minor issue in a previous commit.
Diffstat (limited to 'source/blender/editors/transform')
-rw-r--r--source/blender/editors/transform/transform.c14
-rw-r--r--source/blender/editors/transform/transform_generics.c16
-rw-r--r--source/blender/editors/transform/transform_ops.c13
3 files changed, 34 insertions, 9 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index cb3b72468fe..f43bcdde9b4 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -4264,7 +4264,7 @@ static int createSlideVerts(TransInfo *t)
/* UV correction vars */
GHash **uvarray= NULL;
SlideData *sld = MEM_callocN(sizeof(*sld), "sld");
- int uvlay_tot= CustomData_number_of_layers(&em->fdata, CD_MTFACE);
+ const int uvlay_tot= (t->settings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT) ? CustomData_number_of_layers(&em->fdata, CD_MTFACE) : 0;
int uvlay_idx;
TransDataSlideUv *slideuvs=NULL, *suv=NULL, *suv_last=NULL;
RegionView3D *v3d = t->ar ? t->ar->regiondata : NULL; /* background mode support */
@@ -4636,7 +4636,7 @@ static int createSlideVerts(TransInfo *t)
sld->end[0] = (int) end[0];
sld->end[1] = (int) end[1];
- if (uvlay_tot) { // XXX && (scene->toolsettings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT)) {
+ if (uvlay_tot) {
int maxnum = 0;
uvarray = MEM_callocN( uvlay_tot * sizeof(GHash *), "SlideUVs Array");
@@ -4826,8 +4826,6 @@ void initEdgeSlide(TransInfo *t)
int doEdgeSlide(TransInfo *t, float perc)
{
- Mesh *me= t->obedit->data;
- EditMesh *em = me->edit_mesh;
SlideData *sld = t->customData;
EditVert *ev, *nearest = sld->nearest;
EditVert *centerVert, *upVert, *downVert;
@@ -4838,7 +4836,7 @@ int doEdgeSlide(TransInfo *t, float perc)
int prop=1, flip=0;
/* UV correction vars */
GHash **uvarray= sld->uvhash;
- int uvlay_tot= CustomData_number_of_layers(&em->fdata, CD_MTFACE);
+ const int uvlay_tot= sld->uvlay_tot;
int uvlay_idx;
TransDataSlideUv *suv;
float uv_tmp[2];
@@ -4864,7 +4862,7 @@ int doEdgeSlide(TransInfo *t, float perc)
tempev = editedge_getOtherVert((perc>=0)?tempsv->up:tempsv->down, ev);
interp_v3_v3v3(ev->co, tempsv->origvert.co, tempev->co, fabs(perc));
- if (uvlay_tot) { // XXX scene->toolsettings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT) {
+ if (uvlay_tot) {
for (uvlay_idx=0; uvlay_idx<uvlay_tot; uvlay_idx++) {
suv = BLI_ghash_lookup( uvarray[uvlay_idx], ev );
if (suv && suv->fuv_list && suv->uv_up && suv->uv_down) {
@@ -4894,7 +4892,7 @@ int doEdgeSlide(TransInfo *t, float perc)
if(newlen < 0.0f) {newlen = 0.0;}
if(flip == 0) {
interp_v3_v3v3(ev->co, editedge_getOtherVert(tempsv->down,ev)->co, editedge_getOtherVert(tempsv->up,ev)->co, fabs(newlen));
- if (uvlay_tot) { // XXX scene->toolsettings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT) {
+ if (uvlay_tot) {
/* dont do anything if no UVs */
for (uvlay_idx=0; uvlay_idx<uvlay_tot; uvlay_idx++) {
suv = BLI_ghash_lookup( uvarray[uvlay_idx], ev );
@@ -4911,7 +4909,7 @@ int doEdgeSlide(TransInfo *t, float perc)
} else{
interp_v3_v3v3(ev->co, editedge_getOtherVert(tempsv->up,ev)->co, editedge_getOtherVert(tempsv->down,ev)->co, fabs(newlen));
- if (uvlay_tot) { // XXX scene->toolsettings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT) {
+ if (uvlay_tot) {
/* dont do anything if no UVs */
for (uvlay_idx=0; uvlay_idx<uvlay_tot; uvlay_idx++) {
suv = BLI_ghash_lookup( uvarray[uvlay_idx], ev );
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 09031839702..a43fc6a31e5 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -1037,6 +1037,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)
{
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index 4765bc77bf1..ead920321a4 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -360,11 +360,17 @@ static int transform_modal(bContext *C, wmOperator *op, wmEvent *event)
TransInfo *t = op->customdata;
+ #if 0
+ // stable 2D mouse coords map to different 3D coords while the 3D mouse is active
+ // in other words, 2D deltas are no longer good enough!
+ // disable until individual 'transformers' behave better
+
if (event->type == NDOF_MOTION)
{
/* puts("transform_modal: passing through NDOF_MOTION"); */
return OPERATOR_PASS_THROUGH;
}
+ #endif
/* XXX insert keys are called here, and require context */
t->context= C;
@@ -502,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);
@@ -749,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)