Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/paint_vertex.c
| Show First 20 Lines • Show All 277 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| VPaint *vp = MEM_callocN(sizeof(VPaint), "VPaint"); | VPaint *vp = MEM_callocN(sizeof(VPaint), "VPaint"); | ||||
| vp->paint.flags |= PAINT_SHOW_BRUSH; | vp->paint.flags |= PAINT_SHOW_BRUSH; | ||||
| return vp; | return vp; | ||||
| } | } | ||||
| uint vpaint_get_current_col(Scene *scene, VPaint *vp) | uint vpaint_get_current_col(Scene *scene, VPaint *vp, bool secondary) | ||||
| { | { | ||||
| Brush *brush = BKE_paint_brush(&vp->paint); | Brush *brush = BKE_paint_brush(&vp->paint); | ||||
| uchar col[4]; | uchar col[4]; | ||||
| rgb_float_to_uchar(col, BKE_brush_color_get(scene, brush)); | rgb_float_to_uchar(col, secondary ? BKE_brush_secondary_color_get(scene, brush) : BKE_brush_color_get(scene, brush)); | ||||
| col[3] = 255; /* alpha isn't used, could even be removed to speedup paint a little */ | col[3] = 255; /* alpha isn't used, could even be removed to speedup paint a little */ | ||||
| return *(uint *)col; | return *(uint *)col; | ||||
| } | } | ||||
| /* wpaint has 'wpaint_blend' */ | /* wpaint has 'wpaint_blend' */ | ||||
| static uint vpaint_blend( | static uint vpaint_blend( | ||||
| const VPaint *vp, uint color_curr, uint color_orig, | const VPaint *vp, uint color_curr, uint color_orig, | ||||
| uint color_paint, const int alpha_i, | uint color_paint, const int alpha_i, | ||||
| ▲ Show 20 Lines • Show All 2,217 Lines • ▼ Show 20 Lines | static bool vpaint_stroke_test_start(bContext *C, struct wmOperator *op, const float mouse[2]) | ||||
| /* make mode data storage */ | /* make mode data storage */ | ||||
| vpd = MEM_callocN(sizeof(*vpd), "VPaintData"); | vpd = MEM_callocN(sizeof(*vpd), "VPaintData"); | ||||
| paint_stroke_set_mode_data(stroke, vpd); | paint_stroke_set_mode_data(stroke, vpd); | ||||
| ED_view3d_viewcontext_init(C, &vpd->vc); | ED_view3d_viewcontext_init(C, &vpd->vc); | ||||
| view_angle_limits_init( | view_angle_limits_init( | ||||
| &vpd->normal_angle_precalc, vp->paint.brush->falloff_angle, | &vpd->normal_angle_precalc, vp->paint.brush->falloff_angle, | ||||
| (vp->paint.brush->flag & BRUSH_FRONTFACE_FALLOFF) != 0); | (vp->paint.brush->flag & BRUSH_FRONTFACE_FALLOFF) != 0); | ||||
| vpd->paintcol = vpaint_get_current_col(scene, vp); | vpd->paintcol = vpaint_get_current_col(scene, vp, (RNA_enum_get(op->ptr, "mode") == BRUSH_STROKE_INVERT)); | ||||
| vpd->is_texbrush = !(brush->vertexpaint_tool == PAINT_BLEND_BLUR) && brush->mtex.tex; | vpd->is_texbrush = !(brush->vertexpaint_tool == PAINT_BLEND_BLUR) && brush->mtex.tex; | ||||
| /* are we painting onto a modified mesh?, | /* are we painting onto a modified mesh?, | ||||
| * if not we can skip face map trickiness */ | * if not we can skip face map trickiness */ | ||||
| if (vertex_paint_use_fast_update_check(ob)) { | if (vertex_paint_use_fast_update_check(ob)) { | ||||
| vpd->use_fast_update = true; | vpd->use_fast_update = true; | ||||
| /* printf("Fast update!\n");*/ | /* printf("Fast update!\n");*/ | ||||
| ▲ Show 20 Lines • Show All 737 Lines • Show Last 20 Lines | |||||