[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49894] branches/soc-2011-tomato/source/ blender/editors/interface/interface_templates.c: Mango request: display sliders for current point in curve mapping

Sergey Sharybin sergey.vfx at gmail.com
Tue Aug 14 16:45:27 CEST 2012


Revision: 49894
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49894
Author:   nazgul
Date:     2012-08-14 14:45:27 +0000 (Tue, 14 Aug 2012)
Log Message:
-----------
Mango request: display sliders for current point in curve mapping

Modified Paths:
--------------
    branches/soc-2011-tomato/source/blender/editors/interface/interface_templates.c

Modified: branches/soc-2011-tomato/source/blender/editors/interface/interface_templates.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/interface/interface_templates.c	2012-08-14 14:31:39 UTC (rev 49893)
+++ branches/soc-2011-tomato/source/blender/editors/interface/interface_templates.c	2012-08-14 14:45:27 UTC (rev 49894)
@@ -1743,6 +1743,13 @@
 	ED_region_tag_redraw(CTX_wm_region(C));
 }
 
+static void curvemap_buttons_update(bContext *UNUSED(C), void *UNUSED(arg1), void *cumap_v)
+{
+	CurveMapping *cumap = cumap_v;
+
+	curvemapping_changed(cumap, TRUE);
+}
+
 static void curvemap_buttons_reset(bContext *C, void *cb_v, void *cumap_v)
 {
 	CurveMapping *cumap = cumap_v;
@@ -1765,12 +1772,14 @@
 static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labeltype, int levels, int brush, RNAUpdateCb *cb)
 {
 	CurveMapping *cumap = ptr->data;
+	CurveMap *cm = &cumap->cm[cumap->cur];
+	CurveMapPoint *cmp = NULL;
 	uiLayout *row, *sub, *split;
 	uiBlock *block;
 	uiBut *bt;
 	float dx = UI_UNIT_X;
 	int icon, size;
-	int bg = -1;
+	int bg = -1, i;
 
 	block = uiLayoutGetBlock(layout);
 
@@ -1875,6 +1884,21 @@
 	row = uiLayoutRow(layout, FALSE);
 	uiDefBut(block, BUT_CURVE, 0, "", 0, 0, size, MIN2(size, 200), cumap, 0.0f, 1.0f, bg, 0, "");
 
+	/* sliders for selected point */
+	for (i = 0; i < cm->totpoint; i++) {
+		if (cm->curve[i].flag & CUMA_SELECT) {
+			cmp = &cm->curve[i];
+			break;
+		}
+	}
+
+	if (cmp) {
+		uiLayoutColumn(layout, TRUE);
+		uiBlockSetNFunc(block, curvemap_buttons_update, NULL, cumap);
+		uiDefButF(block, NUM, 0, "X", 0, 2 * UI_UNIT_Y, UI_UNIT_X * 10, UI_UNIT_Y, &cmp->x, 0.0f, 1.0f, 1, 5, "");
+		uiDefButF(block, NUM, 0, "Y", 0, 1 * UI_UNIT_Y, UI_UNIT_X * 10, UI_UNIT_Y, &cmp->y, 0.0f, 1.0f, 1, 5, "");
+	}
+
 	/* black/white levels */
 	if (levels) {
 		split = uiLayoutSplit(layout, 0.0f, FALSE);




More information about the Bf-blender-cvs mailing list