2.5: UI, tweaks to curve mapping template to fit better

in 3d view panel, and resize properly.
This commit is contained in:
2009-08-10 20:48:38 +00:00
parent 0b2324f679
commit 24b7d90e95
4 changed files with 79 additions and 7 deletions

View File

@@ -945,6 +945,72 @@ void curvemap_buttons(uiBlock *block, CurveMapping *cumap, char labeltype, short
cumap, 0.0f, 1.0f, 0, 0, "");
}
/* still unsure how this call evolves... we use labeltype for defining what curve-channels to show */
void curvemap_layout(uiLayout *layout, CurveMapping *cumap, char labeltype, short event, short redraw, rctf *rect)
{
uiLayout *row;
uiBlock *block;
uiBut *bt;
float dx, fy= rect->ymax-18.0f;
int icon;
block= uiLayoutGetBlock(layout);
/* curve choice options + tools/settings, 8 icons + spacer */
dx= UI_UNIT_X;
row= uiLayoutRow(layout, 0);
uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_RIGHT);
if(labeltype=='v') { /* vector */
row= uiLayoutRow(layout, 1);
if(cumap->cm[0].curve)
uiDefButI(block, ROW, redraw, "X", 0, 0, dx, 16, &cumap->cur, 0.0, 0.0, 0.0, 0.0, "");
if(cumap->cm[1].curve)
uiDefButI(block, ROW, redraw, "Y", 0, 0, dx, 16, &cumap->cur, 0.0, 1.0, 0.0, 0.0, "");
if(cumap->cm[2].curve)
uiDefButI(block, ROW, redraw, "Z", 0, 0, dx, 16, &cumap->cur, 0.0, 2.0, 0.0, 0.0, "");
}
else if(labeltype=='c') { /* color */
row= uiLayoutRow(layout, 1);
if(cumap->cm[3].curve)
uiDefButI(block, ROW, redraw, "C", 0, 0, dx, 16, &cumap->cur, 0.0, 3.0, 0.0, 0.0, "");
if(cumap->cm[0].curve)
uiDefButI(block, ROW, redraw, "R", 0, 0, dx, 16, &cumap->cur, 0.0, 0.0, 0.0, 0.0, "");
if(cumap->cm[1].curve)
uiDefButI(block, ROW, redraw, "G", 0, 0, dx, 16, &cumap->cur, 0.0, 1.0, 0.0, 0.0, "");
if(cumap->cm[2].curve)
uiDefButI(block, ROW, redraw, "B", 0, 0, dx, 16, &cumap->cur, 0.0, 2.0, 0.0, 0.0, "");
}
row= uiLayoutRow(row, 1);
uiBlockSetEmboss(block, UI_EMBOSSN);
bt= uiDefIconBut(block, BUT, redraw, ICON_ZOOMIN, 0, 0, dx, 14, NULL, 0.0, 0.0, 0.0, 0.0, "Zoom in");
uiButSetFunc(bt, curvemap_buttons_zoom_in, cumap, NULL);
bt= uiDefIconBut(block, BUT, redraw, ICON_ZOOMOUT, 0, 0, dx, 14, NULL, 0.0, 0.0, 0.0, 0.0, "Zoom out");
uiButSetFunc(bt, curvemap_buttons_zoom_out, cumap, NULL);
bt= uiDefIconBlockBut(block, curvemap_tools_func, cumap, event, ICON_MODIFIER, 0, 0, dx, 18, "Tools");
if(cumap->flag & CUMA_DO_CLIP) icon= ICON_CLIPUV_HLT; else icon= ICON_CLIPUV_DEHLT;
bt= uiDefIconBlockBut(block, curvemap_clipping_func, cumap, event, icon, 0, 0, dx, 18, "Clipping Options");
bt= uiDefIconBut(block, BUT, event, ICON_X, 0, 0, dx, 18, NULL, 0.0, 0.0, 0.0, 0.0, "Delete points");
uiButSetFunc(bt, curvemap_buttons_delete, cumap, NULL);
uiBlockSetEmboss(block, UI_EMBOSS);
row= uiLayoutRow(layout, 0);
uiDefBut(block, BUT_CURVE, event, "",
rect->xmin, rect->ymin, rect->xmax-rect->xmin, fy-rect->ymin,
cumap, 0.0f, 1.0f, 0, 0, "");
}
#define B_BANDCOL 1
static int vergcband(const void *a1, const void *a2)