== Sculpt ==

More icon work

* Added icon defines for all the brushes
* Load all the brush icons after loading regular Blender icons
* Added the brush icons to their respective tool enums in RNA
* Fixed a couple unused-variable warnings
This commit is contained in:
Nicholas Bishop
2010-07-25 22:23:40 +00:00
parent ba30ac1230
commit cc061d075f
5 changed files with 106 additions and 31 deletions

View File

@@ -862,7 +862,6 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, doubl
float startdistance, spacing, step, paintpos[2], dmousepos[2], finalpos[2];
float t, len, press;
const int radius= brush_size(brush);
const int diameter= 2*radius;
/* compute brush spacing adapted to brush radius, spacing may depend
on pressure, so update it */

View File

@@ -1326,7 +1326,6 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba
ModifierData *preTesselatePoint;
Curve *cu= ob->data;
ListBase *nurb= BKE_curve_nurbs(cu);
DispList *dl;
int required_mode = 0, totvert = 0;
int editmode = (!forRender && cu->editnurb);
DerivedMesh *dm= NULL, *ndm;

View File

@@ -27,8 +27,8 @@
*/
/* Note: this is included twice with different #defines for DEF_ICON
once from UI_resources.h for the internal icon enum and once fro interface_api.c for
definition of the RNA enum for he icons */
once from UI_resources.h for the internal icon enum and
once for interface_api.c for the definition of the RNA enum for the icons */
DEF_ICON(ICON_BLENDER)
DEF_ICON(ICON_QUESTION)
@@ -869,6 +869,37 @@ DEF_ICON(ICON_BLANK345)
DEF_ICON(ICON_BLANK346)
DEF_ICON(ICON_BLANK346b)
/* brush icons */
DEF_ICON(ICON_BRUSH_ADD)
DEF_ICON(ICON_BRUSH_BLOB)
DEF_ICON(ICON_BRUSH_BLUR)
DEF_ICON(ICON_BRUSH_CLAY)
DEF_ICON(ICON_BRUSH_CLONE)
DEF_ICON(ICON_BRUSH_CREASE)
DEF_ICON(ICON_BRUSH_DARKEN)
DEF_ICON(ICON_BRUSH_FILL)
DEF_ICON(ICON_BRUSH_FLATTEN)
DEF_ICON(ICON_BRUSH_GRAB)
DEF_ICON(ICON_BRUSH_INFLATE)
DEF_ICON(ICON_BRUSH_LAYER)
DEF_ICON(ICON_BRUSH_LIGHTEN)
DEF_ICON(ICON_BRUSH_MIX)
DEF_ICON(ICON_BRUSH_MULTIPLY)
DEF_ICON(ICON_BRUSH_NUDGE)
DEF_ICON(ICON_BRUSH_PINCH)
DEF_ICON(ICON_BRUSH_SCRAPE)
DEF_ICON(ICON_BRUSH_SCULPT_DRAW)
DEF_ICON(ICON_BRUSH_SMEAR)
DEF_ICON(ICON_BRUSH_SMOOTH)
DEF_ICON(ICON_BRUSH_SNAKE_HOOK)
DEF_ICON(ICON_BRUSH_SOFTEN)
DEF_ICON(ICON_BRUSH_SUBTRACT)
DEF_ICON(ICON_BRUSH_TEXDRAW)
DEF_ICON(ICON_BRUSH_THUMB)
DEF_ICON(ICON_BRUSH_ROTATE)
DEF_ICON(ICON_BRUSH_VERTEXDRAW)
/* vector icons */
DEF_ICON(VICO_VIEW3D_VEC)

View File

@@ -453,6 +453,51 @@ static void vicon_move_down_draw(int x, int y, int w, int h, float alpha)
glDisable(GL_LINE_SMOOTH);
}
static void init_brush_icons()
{
#define INIT_BRUSH_ICON(icon_id, name) \
bbuf = IMB_ibImageFromMemory((unsigned char*)datatoc_ ##name## _png, \
datatoc_ ##name## _png_size, IB_rect); \
def_internal_icon(bbuf, icon_id, 0, 0, w, ICON_TYPE_BUFFER); \
IMB_freeImBuf(bbuf);
// end INIT_BRUSH_ICON
ImBuf *bbuf;
const int w = 96;
INIT_BRUSH_ICON(ICON_BRUSH_ADD, add);
INIT_BRUSH_ICON(ICON_BRUSH_BLOB, blob);
INIT_BRUSH_ICON(ICON_BRUSH_BLUR, blur);
INIT_BRUSH_ICON(ICON_BRUSH_CLAY, clay);
INIT_BRUSH_ICON(ICON_BRUSH_CLONE, clone);
INIT_BRUSH_ICON(ICON_BRUSH_CREASE, crease);
INIT_BRUSH_ICON(ICON_BRUSH_DARKEN, darken);
INIT_BRUSH_ICON(ICON_BRUSH_SCULPT_DRAW, draw);
INIT_BRUSH_ICON(ICON_BRUSH_FILL, fill);
INIT_BRUSH_ICON(ICON_BRUSH_FLATTEN, flatten);
INIT_BRUSH_ICON(ICON_BRUSH_GRAB, grab);
INIT_BRUSH_ICON(ICON_BRUSH_INFLATE, inflate);
INIT_BRUSH_ICON(ICON_BRUSH_LAYER, layer);
INIT_BRUSH_ICON(ICON_BRUSH_LIGHTEN, lighten);
INIT_BRUSH_ICON(ICON_BRUSH_MIX, mix);
INIT_BRUSH_ICON(ICON_BRUSH_MULTIPLY, multiply);
INIT_BRUSH_ICON(ICON_BRUSH_NUDGE, nudge);
INIT_BRUSH_ICON(ICON_BRUSH_PINCH, pinch);
INIT_BRUSH_ICON(ICON_BRUSH_SCRAPE, scrape);
INIT_BRUSH_ICON(ICON_BRUSH_SMEAR, smear);
INIT_BRUSH_ICON(ICON_BRUSH_SMOOTH, smooth);
INIT_BRUSH_ICON(ICON_BRUSH_SNAKE_HOOK, snake_hook);
INIT_BRUSH_ICON(ICON_BRUSH_SOFTEN, soften);
INIT_BRUSH_ICON(ICON_BRUSH_SUBTRACT, subtract);
INIT_BRUSH_ICON(ICON_BRUSH_TEXDRAW, texdraw);
INIT_BRUSH_ICON(ICON_BRUSH_THUMB, thumb);
INIT_BRUSH_ICON(ICON_BRUSH_ROTATE, twist);
INIT_BRUSH_ICON(ICON_BRUSH_VERTEXDRAW, vertexdraw);
#undef INIT_BRUSH_ICON
}
static void init_internal_icons()
{
bTheme *btheme= U.themes.first;
@@ -740,6 +785,7 @@ void UI_icons_init(int first_dyn_id)
init_iconfile_list(&iconfilelist);
BKE_icons_init(first_dyn_id);
init_internal_icons();
init_brush_icons();
}
/* Render size for preview images at level miplevel */

View File

@@ -240,22 +240,22 @@ static void rna_def_brush(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem brush_sculpt_tool_items[] = {
{SCULPT_TOOL_BLOB, "BLOB", 0, "Blob", ""},
{SCULPT_TOOL_CLAY, "CLAY", 0, "Clay", ""},
{SCULPT_TOOL_CREASE, "CREASE", 0, "Crease", ""},
{SCULPT_TOOL_DRAW, "DRAW", 0, "Draw", ""},
{SCULPT_TOOL_FILL, "FILL", 0, "Fill", ""},
{SCULPT_TOOL_FLATTEN, "FLATTEN", 0, "Flatten", ""},
{SCULPT_TOOL_GRAB, "GRAB", 0, "Grab", ""},
{SCULPT_TOOL_INFLATE, "INFLATE", 0, "Inflate", ""},
{SCULPT_TOOL_LAYER, "LAYER", 0, "Layer", ""},
{SCULPT_TOOL_NUDGE, "NUDGE", 0, "Nudge", ""},
{SCULPT_TOOL_PINCH, "PINCH", 0, "Pinch", ""},
{SCULPT_TOOL_ROTATE, "ROTATE", 0, "Rotate", ""},
{SCULPT_TOOL_SCRAPE, "SCRAPE", 0, "Scrape", ""},
{SCULPT_TOOL_SMOOTH, "SMOOTH", 0, "Smooth", ""},
{SCULPT_TOOL_SNAKE_HOOK, "SNAKE_HOOK", 0, "Snake Hook", ""},
{SCULPT_TOOL_THUMB, "THUMB", 0, "Thumb", ""},
{SCULPT_TOOL_BLOB, "BLOB", ICON_BRUSH_BLOB, "Blob", ""},
{SCULPT_TOOL_CLAY, "CLAY", ICON_BRUSH_CLAY, "Clay", ""},
{SCULPT_TOOL_CREASE, "CREASE",ICON_BRUSH_CREASE, "Crease", ""},
{SCULPT_TOOL_DRAW, "DRAW", ICON_BRUSH_SCULPT_DRAW, "Draw", ""},
{SCULPT_TOOL_FILL, "FILL", ICON_BRUSH_FILL, "Fill", ""},
{SCULPT_TOOL_FLATTEN, "FLATTEN", ICON_BRUSH_FLATTEN, "Flatten", ""},
{SCULPT_TOOL_GRAB, "GRAB", ICON_BRUSH_GRAB, "Grab", ""},
{SCULPT_TOOL_INFLATE, "INFLATE", ICON_BRUSH_INFLATE, "Inflate", ""},
{SCULPT_TOOL_LAYER, "LAYER", ICON_BRUSH_LAYER, "Layer", ""},
{SCULPT_TOOL_NUDGE, "NUDGE", ICON_BRUSH_NUDGE, "Nudge", ""},
{SCULPT_TOOL_PINCH, "PINCH", ICON_BRUSH_PINCH, "Pinch", ""},
{SCULPT_TOOL_ROTATE, "ROTATE", ICON_BRUSH_ROTATE, "Rotate", ""},
{SCULPT_TOOL_SCRAPE, "SCRAPE", ICON_BRUSH_SCRAPE, "Scrape", ""},
{SCULPT_TOOL_SMOOTH, "SMOOTH", ICON_BRUSH_SMOOTH, "Smooth", ""},
{SCULPT_TOOL_SNAKE_HOOK, "SNAKE_HOOK", ICON_BRUSH_SNAKE_HOOK, "Snake Hook", ""},
{SCULPT_TOOL_THUMB, "THUMB", ICON_BRUSH_THUMB, "Thumb", ""},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem brush_stroke_method_items[] = {
@@ -278,20 +278,20 @@ static void rna_def_brush(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem brush_vertexpaint_tool_items[] = {
{0, "MIX", 0, "Mix", "Use mix blending mode while painting"},
{1, "ADD", 0, "Add", "Use add blending mode while painting"},
{2, "SUB", 0, "Subtract", "Use subtract blending mode while painting"},
{3, "MUL", 0, "Multiply", "Use multiply blending mode while painting"},
{4, "BLUR", 0, "Blur", "Blur the color with surrounding values"},
{5, "LIGHTEN", 0, "Lighten", "Use lighten blending mode while painting"},
{6, "DARKEN", 0, "Darken", "Use darken blending mode while painting"},
{0, "MIX", ICON_BRUSH_MIX, "Mix", "Use mix blending mode while painting"},
{1, "ADD", ICON_BRUSH_ADD, "Add", "Use add blending mode while painting"},
{2, "SUB", ICON_BRUSH_SUBTRACT, "Subtract", "Use subtract blending mode while painting"},
{3, "MUL", ICON_BRUSH_MULTIPLY, "Multiply", "Use multiply blending mode while painting"},
{4, "BLUR", ICON_BRUSH_BLUR, "Blur", "Blur the color with surrounding values"},
{5, "LIGHTEN", ICON_BRUSH_LIGHTEN, "Lighten", "Use lighten blending mode while painting"},
{6, "DARKEN", ICON_BRUSH_DARKEN, "Darken", "Use darken blending mode while painting"},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem brush_imagepaint_tool_items[] = {
{PAINT_TOOL_DRAW, "DRAW", 0, "Draw", ""},
{PAINT_TOOL_SOFTEN, "SOFTEN", 0, "Soften", ""},
{PAINT_TOOL_SMEAR, "SMEAR", 0, "Smear", ""},
{PAINT_TOOL_CLONE, "CLONE", 0, "Clone", ""},
{PAINT_TOOL_DRAW, "DRAW", ICON_BRUSH_TEXDRAW, "Draw", ""},
{PAINT_TOOL_SOFTEN, "SOFTEN", ICON_BRUSH_SOFTEN, "Soften", ""},
{PAINT_TOOL_SMEAR, "SMEAR", ICON_BRUSH_SMEAR, "Smear", ""},
{PAINT_TOOL_CLONE, "CLONE", ICON_BRUSH_CLONE, "Clone", ""},
{0, NULL, 0, NULL, NULL}};
static const EnumPropertyItem prop_flip_direction_items[]= {