[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16877] branches/nurbs/blender/source/ blender: easy weight editing using Alt+W or via Curve/Surface Menu-> Transform -> Weight, there is a known issue in that when you cancel weight editing it doesn' t return to previous value
Hamed Zaghaghi
hamed.zaghaghi at gmail.com
Thu Oct 2 08:01:51 CEST 2008
Revision: 16877
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16877
Author: zaghaghi
Date: 2008-10-02 08:01:50 +0200 (Thu, 02 Oct 2008)
Log Message:
-----------
easy weight editing using Alt+W or via Curve/Surface Menu-> Transform -> Weight, there is a known issue in that when you cancel weight editing it doesn't return to previous value
Modified Paths:
--------------
branches/nurbs/blender/source/blender/include/BIF_transform.h
branches/nurbs/blender/source/blender/include/transform.h
branches/nurbs/blender/source/blender/src/header_view3d.c
branches/nurbs/blender/source/blender/src/space.c
branches/nurbs/blender/source/blender/src/transform.c
Modified: branches/nurbs/blender/source/blender/include/BIF_transform.h
===================================================================
--- branches/nurbs/blender/source/blender/include/BIF_transform.h 2008-10-02 01:38:12 UTC (rev 16876)
+++ branches/nurbs/blender/source/blender/include/BIF_transform.h 2008-10-02 06:01:50 UTC (rev 16877)
@@ -60,6 +60,7 @@
#define TFM_BEVEL 24
#define TFM_BWEIGHT 25
#define TFM_ALIGN 26
+#define TFM_CURVE_WEIGHT 27
/* TRANSFORM CONTEXTS */
#define CTX_NONE 0
Modified: branches/nurbs/blender/source/blender/include/transform.h
===================================================================
--- branches/nurbs/blender/source/blender/include/transform.h 2008-10-02 01:38:12 UTC (rev 16876)
+++ branches/nurbs/blender/source/blender/include/transform.h 2008-10-02 06:01:50 UTC (rev 16877)
@@ -343,6 +343,9 @@
void initRotation(TransInfo *t);
int Rotation(TransInfo *t, short mval[2]);
+void initWeight(TransInfo *t);
+int CurveWeight(TransInfo *t, short mval[2]);
+
void initShrinkFatten(TransInfo *t);
int ShrinkFatten(TransInfo *t, short mval[2]);
Modified: branches/nurbs/blender/source/blender/src/header_view3d.c
===================================================================
--- branches/nurbs/blender/source/blender/src/header_view3d.c 2008-10-02 01:38:12 UTC (rev 16876)
+++ branches/nurbs/blender/source/blender/src/header_view3d.c 2008-10-02 06:01:50 UTC (rev 16877)
@@ -1849,6 +1849,10 @@
case 21:
alignmenu();
break;
+ case 22: /* weight for nurbs*/
+ initTransform(TFM_CURVE_WEIGHT, CTX_NONE);
+ Transform();
+ break;
}
allqueue(REDRAWVIEW3D, 0);
}
@@ -1876,9 +1880,13 @@
if (G.obedit->type == OB_MESH)
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Shrink/Fatten Along Normals|Alt S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
else if (G.obedit->type == OB_CURVE) {
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Weight|Alt W", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 22, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Tilt|T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Shrink/Fatten Radius|Alt S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 14, "");
}
+ if(G.obedit->type == OB_SURF){
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Weight|Alt W", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 22, "");
+ }
}
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "To Sphere|Ctrl Shift S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
if (G.obedit) uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Shear|Ctrl S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
Modified: branches/nurbs/blender/source/blender/src/space.c
===================================================================
--- branches/nurbs/blender/source/blender/src/space.c 2008-10-02 01:38:12 UTC (rev 16876)
+++ branches/nurbs/blender/source/blender/src/space.c 2008-10-02 06:01:50 UTC (rev 16877)
@@ -2742,6 +2742,10 @@
else if (G.qual == 0)
special_editmenu();
}
+ else if(G.obedit && G.qual==LR_ALTKEY) {
+ initTransform(TFM_CURVE_WEIGHT, CTX_NONE);
+ Transform();
+ }
else if((G.qual==LR_SHIFTKEY)) {
initTransform(TFM_WARP, CTX_NONE);
Transform();
Modified: branches/nurbs/blender/source/blender/src/transform.c
===================================================================
--- branches/nurbs/blender/source/blender/src/transform.c 2008-10-02 01:38:12 UTC (rev 16876)
+++ branches/nurbs/blender/source/blender/src/transform.c 2008-10-02 06:01:50 UTC (rev 16877)
@@ -94,6 +94,8 @@
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
+#include "BDR_editcurve.h"
+
#include "PIL_time.h" /* sleep */
#include "blendef.h"
@@ -653,6 +655,8 @@
return "Key Time";
case TFM_MIRROR:
return "Mirror";
+ case TFM_CURVE_WEIGHT:
+ return "Curve Weight";
}
return "Transform";
}
@@ -1139,6 +1143,9 @@
case TFM_ALIGN:
initAlign(&Trans);
break;
+ case TFM_CURVE_WEIGHT:
+ initWeight(&Trans);
+ break;
}
}
@@ -3026,6 +3033,67 @@
return 1;
}
+/* ****************************** WEIGHT ****************************** */
+void initWeight(TransInfo *t)
+{
+ if (G.obedit!=NULL && ELEM(G.obedit->type, OB_CURVE, OB_SURF)) {
+ t->mode = TFM_CURVE_WEIGHT;
+ t->transform = CurveWeight;
+
+ t->idx_max = 0;
+ t->num.idx_max = 0;
+ t->snap[0] = 0.0f;
+ t->snap[1] = 1.0f;
+ t->snap[2] = t->snap[1] * 0.1f;
+ t->fac = 100.0f;
+ }
+}
+
+int CurveWeight(TransInfo *t, short mval[2])
+{
+ TransData *td = t->data;
+ float distance;
+ int i;
+ char str[50];
+
+ float dx= (float)(t->center2d[0] - mval[0]);
+ float dy= (float)(t->center2d[1] - mval[1]);
+ distance = (float)sqrt( dx*dx + dy*dy)/t->fac;
+
+
+ snapGrid(t, &distance);
+
+ applyNumInput(&t->num, &distance);
+
+ /* header print for NumInput */
+ if (hasNumInput(&t->num)) {
+ char c[20];
+
+ outputNumInput(&(t->num), c);
+ sprintf(str, "Weight: %s", c);
+ }
+ else {
+ sprintf(str, "Weight: %3f", distance);
+ }
+
+ for(i = 0 ; i < t->total; i++, td++) {
+ if (td->flag & TD_NOACTION)
+ break;
+
+ if (td->flag & TD_SKIP)
+ continue;
+
+ weightflagNurb(SELECT, distance, 0);
+ }
+ recalcData(t);
+
+ headerprint(str);
+
+ viewRedrawForce(t);
+
+ return 1;
+}
+
/* ************************** SHRINK/FATTEN *************************** */
void initShrinkFatten(TransInfo *t)
More information about the Bf-blender-cvs
mailing list