static int brush_curve_preset_exec(bContext *C, wmOperator *op) { Brush *br = paint_brush(paint_get_active(CTX_data_scene(C))); brush_curve_preset(br, RNA_enum_get(op->ptr, "shape")); return OPERATOR_FINISHED; }
Brush *add_brush(const char *name) { Brush *brush; brush= alloc_libblock(&G.main->brush, ID_BR, name); /* enable fake user by default */ brush->id.flag |= LIB_FAKEUSER; brush_set_defaults(brush); brush->sculpt_tool = SCULPT_TOOL_DRAW; /* sculpting defaults to the draw tool for new brushes */ /* the default alpha falloff curve */ brush_curve_preset(brush, CURVE_PRESET_SMOOTH); return brush; }
void brush_reset_sculpt(Brush *br) { /* enable this to see any non-default settings used by a brush: brush_debug_print_state(br); */ brush_set_defaults(br); brush_curve_preset(br, CURVE_PRESET_SMOOTH); switch(br->sculpt_tool) { case SCULPT_TOOL_CLAY: br->flag |= BRUSH_FRONTFACE; break; case SCULPT_TOOL_CREASE: br->flag |= BRUSH_DIR_IN; br->alpha = 0.25; break; case SCULPT_TOOL_FILL: br->add_col[1] = 1; br->sub_col[0] = 0.25; br->sub_col[1] = 1; break; case SCULPT_TOOL_FLATTEN: br->add_col[1] = 1; br->sub_col[0] = 0.25; br->sub_col[1] = 1; break; case SCULPT_TOOL_INFLATE: br->add_col[0] = 0.750000; br->add_col[1] = 0.750000; br->add_col[2] = 0.750000; br->sub_col[0] = 0.250000; br->sub_col[1] = 0.250000; br->sub_col[2] = 0.250000; break; case SCULPT_TOOL_NUDGE: br->add_col[0] = 0.250000; br->add_col[1] = 1.000000; br->add_col[2] = 0.250000; break; case SCULPT_TOOL_PINCH: br->add_col[0] = 0.750000; br->add_col[1] = 0.750000; br->add_col[2] = 0.750000; br->sub_col[0] = 0.250000; br->sub_col[1] = 0.250000; br->sub_col[2] = 0.250000; break; case SCULPT_TOOL_SCRAPE: br->add_col[1] = 1.000000; br->sub_col[0] = 0.250000; br->sub_col[1] = 1.000000; break; case SCULPT_TOOL_ROTATE: br->alpha = 1.0; break; case SCULPT_TOOL_SMOOTH: br->flag &= ~BRUSH_SPACE_ATTEN; br->spacing = 5; br->add_col[0] = 0.750000; br->add_col[1] = 0.750000; br->add_col[2] = 0.750000; break; case SCULPT_TOOL_GRAB: case SCULPT_TOOL_SNAKE_HOOK: case SCULPT_TOOL_THUMB: br->size = 75; br->flag &= ~BRUSH_ALPHA_PRESSURE; br->flag &= ~BRUSH_SPACE; br->flag &= ~BRUSH_SPACE_ATTEN; br->add_col[0] = 0.250000; br->add_col[1] = 1.000000; br->add_col[2] = 0.250000; break; default: break; } }