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:
authorMatt Ebb <matt@mke3.net>2006-01-26 20:35:26 +0300
committerMatt Ebb <matt@mke3.net>2006-01-26 20:35:26 +0300
commitfa54435615cc8129bf5ea4fea542386195f17dcf (patch)
tree02bf3eb9bf23ebedd6b97e0c21d35acf751fa86c
parent0ebc907a5107f7bf375d9668fc9443f847a85377 (diff)
== Interface/Nodes ==
Modification to allow adding a point in a curve button by LMB clicking/dragging directly on the curve, as in GIMP/Photoshop/etc.
-rw-r--r--source/blender/src/interface.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c
index d51859b34f8..5c02db94fd8 100644
--- a/source/blender/src/interface.c
+++ b/source/blender/src/interface.c
@@ -3400,6 +3400,39 @@ static int ui_do_but_CURVE(uiBut *but)
mindist= dist;
}
}
+
+ if (sel == -1) {
+ /* if the click didn't select anything, check if it's clicked on the
+ * curve itself, and if so, add a point */
+ fx= ((float)mval[0] - but->x1)/zoomx + offsx;
+ fy= ((float)mval[1] - but->y1)/zoomy + offsy;
+
+ cmp= cuma->table;
+
+ /* loop through the curve segment table and find what's near the mouse.
+ * 0.05 is kinda arbitrary, but seems to be what works nicely. */
+ for(a=0; a<=CM_TABLE; a++) {
+ if ( ( fabs(fx - cmp[a].x) < (0.05) ) && ( fabs(fy - cmp[a].y) < (0.05) ) ) {
+
+ curvemap_insert(cuma, fx, fy);
+ curvemapping_changed(cumap, 0);
+
+ ui_draw_but(but);
+ ui_block_flush_back(but->block);
+
+ /* reset cmp back to the curve points again, rather than drawing segments */
+ cmp= cuma->curve;
+
+ /* find newly added point and make it 'sel' */
+ for(a=0; a<cuma->totpoint; a++) {
+ if (cmp[a].x == fx) sel = a;
+ }
+
+ break;
+ }
+ }
+ }
+
/* ok, we move a point */
if(sel!= -1) {
int moved_point;