From 515e69999e63aab7720e48b0c85233f61facce65 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 3 Oct 2017 18:43:18 +1100 Subject: Weight Paint: don't set weight w/ average brush Also use 'const' for brush. --- source/blender/blenkernel/BKE_brush.h | 2 +- source/blender/blenkernel/intern/brush.c | 4 +- source/blender/editors/sculpt_paint/paint_intern.h | 4 +- source/blender/editors/sculpt_paint/paint_utils.c | 4 +- source/blender/editors/sculpt_paint/paint_vertex.c | 34 +++++++------- source/blender/editors/sculpt_paint/sculpt.c | 52 +++++++++++----------- .../blender/editors/sculpt_paint/sculpt_intern.h | 6 +-- .../blender/render/extern/include/RE_render_ext.h | 2 +- .../blender/render/intern/source/render_texture.c | 8 ++-- 9 files changed, 59 insertions(+), 57 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_brush.h b/source/blender/blenkernel/BKE_brush.h index c1e107e101a..c6d4217780e 100644 --- a/source/blender/blenkernel/BKE_brush.h +++ b/source/blender/blenkernel/BKE_brush.h @@ -74,7 +74,7 @@ float BKE_brush_curve_strength(const struct Brush *br, float p, const float len) /* sampling */ float BKE_brush_sample_tex_3D( - const struct Scene *scene, struct Brush *br, const float point[3], + const struct Scene *scene, const struct Brush *br, const float point[3], float rgba[4], const int thread, struct ImagePool *pool); float BKE_brush_sample_masktex( const struct Scene *scene, struct Brush *br, const float point[2], diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 0300dfe5891..4a54ab26373 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -521,13 +521,13 @@ int BKE_brush_clone_image_delete(Brush *brush) * region space mouse coordinates, or 3d world coordinates for 3D mapping. * * rgba outputs straight alpha. */ -float BKE_brush_sample_tex_3D(const Scene *scene, Brush *br, +float BKE_brush_sample_tex_3D(const Scene *scene, const Brush *br, const float point[3], float rgba[4], const int thread, struct ImagePool *pool) { UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings; - MTex *mtex = &br->mtex; + const MTex *mtex = &br->mtex; float intensity = 1.0; bool hasrgb = false; diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h index bd35218bb64..f6fcbfdfbee 100644 --- a/source/blender/editors/sculpt_paint/paint_intern.h +++ b/source/blender/editors/sculpt_paint/paint_intern.h @@ -242,8 +242,8 @@ void paint_calc_redraw_planes(float planes[4][4], const struct rcti *screen_rect); float paint_calc_object_space_radius(struct ViewContext *vc, const float center[3], float pixel_radius); -float paint_get_tex_pixel(struct MTex *mtex, float u, float v, struct ImagePool *pool, int thread); -void paint_get_tex_pixel_col(struct MTex *mtex, float u, float v, float rgba[4], struct ImagePool *pool, int thread, bool convert, struct ColorSpace *colorspace); +float paint_get_tex_pixel(const struct MTex *mtex, float u, float v, struct ImagePool *pool, int thread); +void paint_get_tex_pixel_col(const struct MTex *mtex, float u, float v, float rgba[4], struct ImagePool *pool, int thread, bool convert, struct ColorSpace *colorspace); void paint_sample_color(struct bContext *C, struct ARegion *ar, int x, int y, bool texpaint_proj, bool palette); diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index 10628d8cccb..7668b8ebd99 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -171,7 +171,7 @@ float paint_calc_object_space_radius(ViewContext *vc, const float center[3], return len_v3(delta) / scale; } -float paint_get_tex_pixel(MTex *mtex, float u, float v, struct ImagePool *pool, int thread) +float paint_get_tex_pixel(const MTex *mtex, float u, float v, struct ImagePool *pool, int thread) { float intensity, rgba[4]; float co[3] = {u, v, 0.0f}; @@ -182,7 +182,7 @@ float paint_get_tex_pixel(MTex *mtex, float u, float v, struct ImagePool *pool, return intensity; } -void paint_get_tex_pixel_col(MTex *mtex, float u, float v, float rgba[4], struct ImagePool *pool, int thread, bool convert_to_linear, struct ColorSpace *colorspace) +void paint_get_tex_pixel_col(const MTex *mtex, float u, float v, float rgba[4], struct ImagePool *pool, int thread, bool convert_to_linear, struct ColorSpace *colorspace) { float co[3] = {u, v, 0.0f}; int hasrgb; diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 4dd218114f6..c61d250446c 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -262,12 +262,12 @@ uint vpaint_get_current_col(Scene *scene, VPaint *vp) /* wpaint has 'wpaint_blend' */ static uint vpaint_blend( - VPaint *vp, uint color_curr, uint color_orig, + const VPaint *vp, uint color_curr, uint color_orig, uint color_paint, const int alpha_i, /* pre scaled from [0-1] --> [0-255] */ const int brush_alpha_value_i) { - Brush *brush = BKE_paint_brush(&vp->paint); + const Brush *brush = vp->paint.brush; const int tool = brush->vertexpaint_tool; uint color_blend = ED_vpaint_blend_tool(tool, color_curr, color_paint, alpha_i); @@ -383,12 +383,12 @@ static float calc_vp_alpha_col_dl( /* vpaint has 'vpaint_blend' */ static float wpaint_blend( - VPaint *wp, float weight, + const VPaint *wp, float weight, const float alpha, float paintval, const float UNUSED(brush_alpha_value), const short do_flip) { - Brush *brush = BKE_paint_brush(&wp->paint); + const Brush *brush = wp->paint.brush; int tool = brush->vertexpaint_tool; if (do_flip) { @@ -698,7 +698,7 @@ typedef struct WeightPaintInfo { static void do_weight_paint_vertex_single( /* vars which remain the same for every vert */ - VPaint *wp, Object *ob, const WeightPaintInfo *wpi, + const VPaint *wp, Object *ob, const WeightPaintInfo *wpi, /* vars which change on each stroke */ const uint index, float alpha, float paintweight) { @@ -847,7 +847,7 @@ static void do_weight_paint_vertex_single( static void do_weight_paint_vertex_multi( /* vars which remain the same for every vert */ - VPaint *wp, Object *ob, const WeightPaintInfo *wpi, + const VPaint *wp, Object *ob, const WeightPaintInfo *wpi, /* vars which change on each stroke */ const uint index, float alpha, float paintweight) { @@ -945,7 +945,7 @@ static void do_weight_paint_vertex_multi( static void do_weight_paint_vertex( /* vars which remain the same for every vert */ - VPaint *wp, Object *ob, const WeightPaintInfo *wpi, + const VPaint *wp, Object *ob, const WeightPaintInfo *wpi, /* vars which change on each stroke */ const uint index, float alpha, float paintweight) { @@ -1199,12 +1199,12 @@ struct WPaintData { /* Initialize the stroke cache invariants from operator properties */ static void vwpaint_update_cache_invariants( - bContext *C, VPaint *vp, SculptSession *ss, wmOperator *op, const float mouse[2]) + bContext *C, const VPaint *vp, SculptSession *ss, wmOperator *op, const float mouse[2]) { StrokeCache *cache; Scene *scene = CTX_data_scene(C); UnifiedPaintSettings *ups = &CTX_data_tool_settings(C)->unified_paint_settings; - Brush *brush = BKE_paint_brush(&vp->paint); + const Brush *brush = vp->paint.brush; ViewContext *vc = paint_stroke_view_context(op->customdata); Object *ob = CTX_data_active_object(C); float mat[3][3]; @@ -1667,7 +1667,7 @@ static void do_wpaint_brush_smear_task_cb_ex( /* Apply weight to vertex */ if (do_color) { const float brush_fade = BKE_brush_curve_strength(brush, 0.0f, cache->radius); - float final_alpha = + const float final_alpha = brush_fade * brush_strength * grid_alpha * brush_alpha_pressure; do_weight_paint_vertex( @@ -1692,7 +1692,9 @@ static void do_wpaint_brush_draw_task_cb_ex( const Brush *brush = data->brush; const StrokeCache *cache = ss->cache; - const float paintweight = BKE_brush_weight_get(scene, brush); + /* note: normally `BKE_brush_weight_get(scene, brush)` is used, + * however in this case we calculate a new weight each time. */ + const float paintweight = data->strength; float brush_size_pressure, brush_alpha_value, brush_alpha_pressure; get_brush_alpha_data(scene, ss, brush, &brush_size_pressure, &brush_alpha_value, &brush_alpha_pressure); const bool use_normal = vwpaint_use_normal(data->vp); @@ -1820,10 +1822,7 @@ static void calculate_average_weight(SculptThreadedTaskData *data, PBVHNode **UN } if (accum_len != 0) { accum_weight /= accum_len; - if (ups->flag & UNIFIED_PAINT_WEIGHT) - ups->weight = (float)accum_weight; - else - data->brush->weight = (float)accum_weight; + data->strength = (float)accum_weight; } MEM_SAFE_FREE(data->custom_data); /* 'accum' */ @@ -1834,7 +1833,7 @@ static void wpaint_paint_leaves( bContext *C, Object *ob, Sculpt *sd, VPaint *vp, struct WPaintData *wpd, WeightPaintInfo *wpi, Mesh *me, PBVHNode **nodes, int totnode) { - Brush *brush = ob->sculpt->cache->brush; + const Brush *brush = ob->sculpt->cache->brush; /* threaded loop over nodes */ SculptThreadedTaskData data = { @@ -2733,6 +2732,7 @@ static void do_vpaint_brush_smear_task_cb_ex( const int p_index = gmap->vert_to_poly[v_index].indices[j]; const int l_index = gmap->vert_to_loop[v_index].indices[j]; BLI_assert(data->me->mloop[l_index].v == v_index); + UNUSED_VARS_NDEBUG(l_index); const MPoly *mp = &data->me->mpoly[p_index]; if (!use_face_sel || mp->flag & ME_FACE_SEL) { const MLoop *ml_other = &data->me->mloop[mp->loopstart]; @@ -2829,7 +2829,7 @@ static void vpaint_paint_leaves( bContext *C, Sculpt *sd, VPaint *vp, struct VPaintData *vpd, Object *ob, Mesh *me, PBVHNode **nodes, int totnode) { - Brush *brush = ob->sculpt->cache->brush; + const Brush *brush = ob->sculpt->cache->brush; SculptThreadedTaskData data = { .sd = sd, .ob = ob, .brush = brush, .nodes = nodes, .vp = vp, .vpd = vpd, diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 1698ab9e5c7..e8ea7f6709c 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -634,7 +634,7 @@ bool sculpt_brush_test_cube(SculptBrushTest *test, const float co[3], float loca } } -static float frontface(Brush *br, const float sculpt_normal[3], +static float frontface(const Brush *br, const float sculpt_normal[3], const short no[3], const float fno[3]) { if (br->flag & BRUSH_FRONTFACE) { @@ -1128,7 +1128,7 @@ static float brush_strength( } /* Return a multiplier for brush strength on a particular vertex. */ -float tex_strength(SculptSession *ss, Brush *br, +float tex_strength(SculptSession *ss, const Brush *br, const float brush_point[3], const float len, const short vno[3], @@ -1138,7 +1138,7 @@ float tex_strength(SculptSession *ss, Brush *br, { StrokeCache *cache = ss->cache; const Scene *scene = cache->vc->scene; - MTex *mtex = &br->mtex; + const MTex *mtex = &br->mtex; float avg = 1; float rgba[4]; float point[3]; @@ -1556,7 +1556,7 @@ static void do_smooth_brush_mesh_task_cb_ex( SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; Sculpt *sd = data->sd; - Brush *brush = data->brush; + const Brush *brush = data->brush; const bool smooth_mask = data->smooth_mask; float bstrength = data->strength; @@ -1604,7 +1604,7 @@ static void do_smooth_brush_bmesh_task_cb_ex( SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; Sculpt *sd = data->sd; - Brush *brush = data->brush; + const Brush *brush = data->brush; const bool smooth_mask = data->smooth_mask; float bstrength = data->strength; @@ -1652,7 +1652,7 @@ static void do_smooth_brush_multires_task_cb_ex( SculptDoBrushSmoothGridDataChunk *data_chunk = userdata_chunk; SculptSession *ss = data->ob->sculpt; Sculpt *sd = data->sd; - Brush *brush = data->brush; + const Brush *brush = data->brush; const bool smooth_mask = data->smooth_mask; float bstrength = data->strength; @@ -1866,7 +1866,7 @@ static void do_mask_brush_draw_task_cb_ex( { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; - Brush *brush = data->brush; + const Brush *brush = data->brush; const float bstrength = ss->cache->bstrength; PBVHVertexIter vd; @@ -1923,7 +1923,7 @@ static void do_draw_brush_task_cb_ex( { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; - Brush *brush = data->brush; + const Brush *brush = data->brush; const float *offset = data->offset; PBVHVertexIter vd; @@ -1978,7 +1978,7 @@ static void do_crease_brush_task_cb_ex( { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; - Brush *brush = data->brush; + const Brush *brush = data->brush; SculptProjectVector *spvc = data->spvc; const float flippedbstrength = data->flippedbstrength; const float *offset = data->offset; @@ -2066,7 +2066,7 @@ static void do_pinch_brush_task_cb_ex( { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; - Brush *brush = data->brush; + const Brush *brush = data->brush; PBVHVertexIter vd; SculptBrushTest test; @@ -2112,7 +2112,7 @@ static void do_grab_brush_task_cb_ex( { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; - Brush *brush = data->brush; + const Brush *brush = data->brush; const float *grab_delta = data->grab_delta; PBVHVertexIter vd; @@ -2172,7 +2172,7 @@ static void do_nudge_brush_task_cb_ex( { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; - Brush *brush = data->brush; + const Brush *brush = data->brush; const float *cono = data->cono; PBVHVertexIter vd; @@ -2226,7 +2226,7 @@ static void do_snake_hook_brush_task_cb_ex( { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; - Brush *brush = data->brush; + const Brush *brush = data->brush; SculptProjectVector *spvc = data->spvc; const float *grab_delta = data->grab_delta; @@ -2327,7 +2327,7 @@ static void do_thumb_brush_task_cb_ex( { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; - Brush *brush = data->brush; + const Brush *brush = data->brush; const float *cono = data->cono; PBVHVertexIter vd; @@ -2387,7 +2387,7 @@ static void do_rotate_brush_task_cb_ex( { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; - Brush *brush = data->brush; + const Brush *brush = data->brush; const float angle = data->angle; PBVHVertexIter vd; @@ -2449,7 +2449,7 @@ static void do_layer_brush_task_cb_ex( SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; Sculpt *sd = data->sd; - Brush *brush = data->brush; + const Brush *brush = data->brush; const float *offset = data->offset; PBVHVertexIter vd; @@ -2533,7 +2533,7 @@ static void do_inflate_brush_task_cb_ex( { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; - Brush *brush = data->brush; + const Brush *brush = data->brush; PBVHVertexIter vd; SculptBrushTest test; @@ -2691,7 +2691,7 @@ static void do_flatten_brush_task_cb_ex( { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; - Brush *brush = data->brush; + const Brush *brush = data->brush; const float *area_no = data->area_no; const float *area_co = data->area_co; @@ -2767,7 +2767,7 @@ static void do_clay_brush_task_cb_ex( { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; - Brush *brush = data->brush; + const Brush *brush = data->brush; const float *area_no = data->area_no; const float *area_co = data->area_co; @@ -2851,7 +2851,7 @@ static void do_clay_strips_brush_task_cb_ex( { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; - Brush *brush = data->brush; + const Brush *brush = data->brush; float (*mat)[4] = data->mat; const float *area_no_sp = data->area_no_sp; const float *area_co = data->area_co; @@ -2961,7 +2961,7 @@ static void do_fill_brush_task_cb_ex( { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; - Brush *brush = data->brush; + const Brush *brush = data->brush; const float *area_no = data->area_no; const float *area_co = data->area_co; @@ -3040,7 +3040,7 @@ static void do_scrape_brush_task_cb_ex( { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; - Brush *brush = data->brush; + const Brush *brush = data->brush; const float *area_no = data->area_no; const float *area_co = data->area_co; @@ -3119,7 +3119,7 @@ static void do_gravity_task_cb_ex( { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; - Brush *brush = data->brush; + const Brush *brush = data->brush; float *offset = data->offset; PBVHVertexIter vd; @@ -4654,6 +4654,7 @@ static void sculpt_stroke_done(const bContext *C, struct PaintStroke *UNUSED(str if (ss->cache) { UnifiedPaintSettings *ups = &CTX_data_tool_settings(C)->unified_paint_settings; Brush *brush = BKE_paint_brush(&sd->paint); + BLI_assert(brush == ss->cache->brush); /* const, so we shouldn't change. */ ups->draw_inverted = false; sculpt_stroke_modifiers_check(C, ob); @@ -4664,11 +4665,10 @@ static void sculpt_stroke_done(const bContext *C, struct PaintStroke *UNUSED(str brush->mask_tool = ss->cache->saved_mask_brush_tool; } else { - Paint *p = &sd->paint; - BKE_brush_size_set(scene, ss->cache->brush, ss->cache->saved_smooth_size); + BKE_brush_size_set(scene, brush, ss->cache->saved_smooth_size); brush = (Brush *)BKE_libblock_find_name(ID_BR, ss->cache->saved_active_brush_name); if (brush) { - BKE_paint_brush_set(p, brush); + BKE_paint_brush_set(&sd->paint, brush); } } } diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h index 425cecb0010..b9b662f4157 100644 --- a/source/blender/editors/sculpt_paint/sculpt_intern.h +++ b/source/blender/editors/sculpt_paint/sculpt_intern.h @@ -132,7 +132,7 @@ typedef struct SculptThreadedTaskData { struct bContext *C; struct Sculpt *sd; struct Object *ob; - struct Brush *brush; + const struct Brush *brush; struct PBVHNode **nodes; int totnode; @@ -214,7 +214,7 @@ bool sculpt_brush_test_circle_sq(SculptBrushTest *test, const float co[3]); bool sculpt_search_sphere_cb(PBVHNode *node, void *data_v); bool sculpt_search_circle_cb(PBVHNode *node, void *data_v); float tex_strength( - struct SculptSession *ss, struct Brush *br, + struct SculptSession *ss, const struct Brush *br, const float point[3], const float len, const short vno[3], @@ -268,7 +268,7 @@ typedef struct StrokeCache { /* Clean this up! */ struct ViewContext *vc; - struct Brush *brush; + const struct Brush *brush; float special_rotation; float grab_delta[3], grab_delta_symmetry[3]; diff --git a/source/blender/render/extern/include/RE_render_ext.h b/source/blender/render/extern/include/RE_render_ext.h index 2b5d0ca4e14..1779ccc5d19 100644 --- a/source/blender/render/extern/include/RE_render_ext.h +++ b/source/blender/render/extern/include/RE_render_ext.h @@ -45,7 +45,7 @@ struct Scene; /* render_texture.c */ /* used by particle.c, effect.c, editmesh_modes.c and brush.c, returns 1 if rgb, 0 otherwise */ int externtex( - struct MTex *mtex, const float vec[3], float *tin, float *tr, float *tg, float *tb, float *ta, + const struct MTex *mtex, const float vec[3], float *tin, float *tr, float *tg, float *tb, float *ta, const int thread, struct ImagePool *pool, const bool skip_load_image, const bool texnode_preview); void texture_rgb_blend(float in[3], const float tex[3], const float out[3], float fact, float facg, int blendtype); float texture_value_blend(float tex, float out, float fact, float facg, int blendtype); diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index 22dc2b28900..91d1f63a1be 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -781,7 +781,8 @@ static int cubemap_glob(const float n[3], float x, float y, float z, float *adr1 /* ------------------------------------------------------------------------- */ /* mtex argument only for projection switches */ -static int cubemap(MTex *mtex, VlakRen *vlr, const float n[3], float x, float y, float z, float *adr1, float *adr2) +static int cubemap( + const MTex *mtex, VlakRen *vlr, const float n[3], float x, float y, float z, float *adr1, float *adr2) { int proj[4]={0, ME_PROJXY, ME_PROJXZ, ME_PROJYZ}, ret= 0; @@ -873,7 +874,8 @@ static int cubemap_ob(Object *ob, const float n[3], float x, float y, float z, f /* ------------------------------------------------------------------------- */ -static void do_2d_mapping(MTex *mtex, float texvec[3], VlakRen *vlr, const float n[3], float dxt[3], float dyt[3]) +static void do_2d_mapping( + const MTex *mtex, float texvec[3], VlakRen *vlr, const float n[3], float dxt[3], float dyt[3]) { Tex *tex; Object *ob= NULL; @@ -3594,7 +3596,7 @@ void do_lamp_tex(LampRen *la, const float lavec[3], ShadeInput *shi, float col_r /* ------------------------------------------------------------------------- */ -int externtex(MTex *mtex, +int externtex(const MTex *mtex, const float vec[3], float *tin, float *tr, float *tg, float *tb, float *ta, const int thread, -- cgit v1.2.3 From f4b1f9b9255cda1af5e093f25cdde816bd94d8cd Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 3 Oct 2017 18:50:34 +1100 Subject: Vertex Paint: remove accumulate (soc-2017-vertex_paint) This secondary accumulation option accumulated brush falloff. The same option in image painting accumulates color as vertex paiht 'Spray' does. Giving this option different behavior for vertex paint seems strange. Also this is basically increasing falloff over time. Remove the new code, expose existing 'Spray' as 'Accumulate' to match other paint modes. --- source/blender/blenkernel/BKE_paint.h | 6 +- source/blender/blenkernel/intern/paint.c | 2 - source/blender/blenloader/intern/versioning_270.c | 2 +- source/blender/editors/sculpt_paint/paint_vertex.c | 76 +++++++--------------- source/blender/makesdna/DNA_scene_types.h | 1 - source/blender/makesrna/intern/rna_sculpt_paint.c | 6 -- 6 files changed, 24 insertions(+), 69 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h index 19f332f5f54..3a70819ec58 100644 --- a/source/blender/blenkernel/BKE_paint.h +++ b/source/blender/blenkernel/BKE_paint.h @@ -220,18 +220,14 @@ typedef struct SculptSession { /* For non-airbrush painting to re-apply from the original (MLoop aligned). */ unsigned int *previous_color; - float *previous_accum; } vpaint; struct { struct SculptVertexPaintGeomMap gmap; - - /* Vertex aligned arrays of weights. */ - float *previous_accum; /* Keep track of how much each vertex has been painted (non-airbrush only). */ float *alpha_weight; - /* Needed to continuously re-apply over the same weights (VP_FLAG_SPRAY disabled). + /* Needed to continuously re-apply over the same weights (BRUSH_ACCUMULATE disabled). * Lazy initialize as needed (flag is set to 1 to tag it as uninitialized). */ struct MDeformVert *dvert_prev; } wpaint; diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index c2f1d05dd89..62af61585c1 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -681,13 +681,11 @@ void BKE_sculptsession_free_vwpaint_data(struct SculptSession *ss) gmap = &ss->mode.vpaint.gmap; MEM_SAFE_FREE(ss->mode.vpaint.previous_color); - MEM_SAFE_FREE(ss->mode.vpaint.previous_accum); } else if (ss->mode_type == OB_MODE_WEIGHT_PAINT) { gmap = &ss->mode.wpaint.gmap; MEM_SAFE_FREE(ss->mode.wpaint.alpha_weight); - MEM_SAFE_FREE(ss->mode.wpaint.previous_accum); if (ss->mode.wpaint.dvert_prev) { BKE_defvert_array_free_elems(ss->mode.wpaint.dvert_prev, ss->totvert); MEM_freeN(ss->mode.wpaint.dvert_prev); diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c index d40dbd542dd..e1a4137d069 100644 --- a/source/blender/blenloader/intern/versioning_270.c +++ b/source/blender/blenloader/intern/versioning_270.c @@ -1690,7 +1690,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main) VPaint *vp = i ? ts->vpaint : ts->wpaint; if (vp != NULL) { /* remove all other flags */ - vp->flag &= (VP_FLAG_SPRAY | VP_FLAG_VGROUP_RESTRICT); + vp->flag &= (VP_FLAG_VGROUP_RESTRICT); vp->normal_angle = 80; } } diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index c61d250446c..ee8934422bc 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -241,11 +241,10 @@ int weight_paint_poll(bContext *C) return 0; } -static VPaint *new_vpaint(int wpaint) +static VPaint *new_vpaint(void) { VPaint *vp = MEM_callocN(sizeof(VPaint), "VPaint"); - vp->flag = (wpaint) ? 0 : VP_FLAG_SPRAY; vp->paint.flags |= PAINT_SHOW_BRUSH; return vp; @@ -272,8 +271,8 @@ static uint vpaint_blend( uint color_blend = ED_vpaint_blend_tool(tool, color_curr, color_paint, alpha_i); - /* if no spray, clip color adding with colorig & orig alpha */ - if ((vp->flag & VP_FLAG_SPRAY) == 0) { + /* if no accumulate, clip color adding with colorig & orig alpha */ + if ((brush->flag & BRUSH_ACCUMULATE) == 0) { uint color_test, a; char *cp, *ct, *co; @@ -730,7 +729,7 @@ static void do_weight_paint_vertex_single( index_mirr = vgroup_mirr = -1; } - if ((wp->flag & VP_FLAG_SPRAY) == 0) { + if ((wp->paint.brush->flag & BRUSH_ACCUMULATE) == 0) { struct MDeformVert *dvert_prev = ob->sculpt->mode.wpaint.dvert_prev; defweight_prev_restore_or_init(dvert_prev, me->dvert, index); if (index_mirr != -1) { @@ -874,7 +873,7 @@ static void do_weight_paint_vertex_multi( } } - if ((wp->flag & VP_FLAG_SPRAY) == 0) { + if ((wp->paint.brush->flag & BRUSH_ACCUMULATE) == 0) { struct MDeformVert *dvert_prev = ob->sculpt->mode.wpaint.dvert_prev; defweight_prev_restore_or_init(dvert_prev, me->dvert, index); if (index_mirr != -1) { @@ -1007,7 +1006,7 @@ static void vertex_paint_init_session_data(const ToolSettings *ts, Object *ob) /* Create average brush arrays */ if (ob->mode == OB_MODE_VERTEX_PAINT) { - if ((ts->vpaint->flag & VP_FLAG_SPRAY) == 0) { + if ((brush->flag & BRUSH_ACCUMULATE) == 0) { if (ob->sculpt->mode.vpaint.previous_color == NULL) { ob->sculpt->mode.vpaint.previous_color = MEM_callocN(me->totloop * sizeof(uint), __func__); @@ -1016,19 +1015,9 @@ static void vertex_paint_init_session_data(const ToolSettings *ts, Object *ob) else { MEM_SAFE_FREE(ob->sculpt->mode.vpaint.previous_color); } - - if (brush && brush->flag & BRUSH_ACCUMULATE) { - if (ob->sculpt->mode.vpaint.previous_accum == NULL) { - ob->sculpt->mode.vpaint.previous_accum = - MEM_callocN(me->totloop * sizeof(float), __func__); - } - } - else { - MEM_SAFE_FREE(ob->sculpt->mode.vpaint.previous_accum); - } } else if (ob->mode == OB_MODE_WEIGHT_PAINT) { - if ((ts->wpaint->flag & VP_FLAG_SPRAY) == 0) { + if ((brush->flag & BRUSH_ACCUMULATE) == 0) { if (ob->sculpt->mode.wpaint.alpha_weight == NULL) { ob->sculpt->mode.wpaint.alpha_weight = MEM_callocN(me->totvert * sizeof(float), __func__); @@ -1051,15 +1040,6 @@ static void vertex_paint_init_session_data(const ToolSettings *ts, Object *ob) ob->sculpt->mode.wpaint.dvert_prev = NULL; } } - if (brush && brush->flag & BRUSH_ACCUMULATE) { - if (ob->sculpt->mode.wpaint.previous_accum == NULL) { - ob->sculpt->mode.wpaint.previous_accum = - MEM_callocN(me->totvert * sizeof(float), __func__); - } - } - else { - MEM_SAFE_FREE(ob->sculpt->mode.wpaint.previous_accum); - } } } @@ -1114,7 +1094,7 @@ static int wpaint_mode_toggle_exec(bContext *C, wmOperator *op) ob->mode |= mode_flag; if (wp == NULL) - wp = scene->toolsettings->wpaint = new_vpaint(1); + wp = scene->toolsettings->wpaint = new_vpaint(); paint_cursor_start(C, weight_paint_poll); @@ -1557,14 +1537,17 @@ static void do_wpaint_brush_blur_task_cb_ex( view_angle_limits_apply_falloff(&data->wpd->normal_angle_precalc, angle_cos, &brush_strength))) { const float brush_fade = BKE_brush_curve_strength(brush, sqrtf(test.dist), cache->radius); - float final_alpha = + const float final_alpha = brush_fade * brush_strength * grid_alpha * brush_alpha_pressure; - if (brush->flag & BRUSH_ACCUMULATE) { - float mask_accum = ss->mode.wpaint.previous_accum[v_index]; - final_alpha = min_ff(final_alpha + mask_accum, brush_strength); - ss->mode.wpaint.previous_accum[v_index] = final_alpha; + if ((brush->flag & BRUSH_ACCUMULATE) == 0) { + if (ss->mode.wpaint.alpha_weight[v_index] < final_alpha) { + ss->mode.wpaint.alpha_weight[v_index] = final_alpha; + } + else { + continue; + } } weight_final /= total_hit_loops; @@ -1729,16 +1712,9 @@ static void do_wpaint_brush_draw_task_cb_ex( view_angle_limits_apply_falloff(&data->wpd->normal_angle_precalc, angle_cos, &brush_strength))) { const float brush_fade = BKE_brush_curve_strength(brush, sqrtf(test.dist), cache->radius); - float final_alpha = brush_fade * brush_strength * grid_alpha * brush_alpha_pressure; - if (brush->flag & BRUSH_ACCUMULATE) { - float mask_accum = ss->mode.wpaint.previous_accum[v_index]; - final_alpha = min_ff(final_alpha + mask_accum, brush_strength); - ss->mode.wpaint.previous_accum[v_index] = final_alpha; - } + const float final_alpha = brush_fade * brush_strength * grid_alpha * brush_alpha_pressure; - /* Non-spray logic. */ - if ((data->vp->flag & VP_FLAG_SPRAY) == 0) { - /* Only paint if we have greater alpha. */ + if ((brush->flag & BRUSH_ACCUMULATE) == 0) { if (ss->mode.wpaint.alpha_weight[v_index] < final_alpha) { ss->mode.wpaint.alpha_weight[v_index] = final_alpha; } @@ -1804,9 +1780,6 @@ static void do_wpaint_brush_calc_average_weight_cb_ex( static void calculate_average_weight(SculptThreadedTaskData *data, PBVHNode **UNUSED(nodes), int totnode) { - Scene *scene = CTX_data_scene(data->C); - UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings; - struct WPaintAverageAccum *accum = MEM_mallocN(sizeof(*accum) * totnode, __func__); data->custom_data = accum; @@ -2236,7 +2209,7 @@ static int vpaint_mode_toggle_exec(bContext *C, wmOperator *op) ED_mesh_color_ensure(me, NULL); if (vp == NULL) - vp = scene->toolsettings->vpaint = new_vpaint(0); + vp = scene->toolsettings->vpaint = new_vpaint(); paint_cursor_start(C, vertex_paint_poll); @@ -2538,14 +2511,9 @@ static void do_vpaint_brush_draw_task_cb_ex( } color_orig = ss->mode.vpaint.previous_color[l_index]; } - float final_alpha = + const float final_alpha = 255 * brush_fade * brush_strength * tex_alpha * brush_alpha_pressure * grid_alpha; - if (brush->flag & BRUSH_ACCUMULATE) { - float mask_accum = ss->mode.vpaint.previous_accum[l_index]; - final_alpha = min_ff(final_alpha + mask_accum, 255.0f * brush_strength); - ss->mode.vpaint.previous_accum[l_index] = final_alpha; - } /* Mix the new color with the original based on final_alpha. */ lcol[l_index] = vpaint_blend( @@ -2649,7 +2617,7 @@ static void do_vpaint_brush_blur_task_cb_ex( } color_orig = ss->mode.vpaint.previous_color[l_index]; } - float final_alpha = + const float final_alpha = 255 * brush_fade * brush_strength * brush_alpha_pressure * grid_alpha; /* Mix the new color with the original @@ -2777,7 +2745,7 @@ static void do_vpaint_brush_smear_task_cb_ex( } color_orig = ss->mode.vpaint.previous_color[l_index]; } - float final_alpha = + const float final_alpha = 255 * brush_fade * brush_strength * brush_alpha_pressure * grid_alpha; /* Mix the new color with the original diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index e9caf7ada1c..89a8a410f3e 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -1128,7 +1128,6 @@ enum { /* TODO */ // VP_FLAG_PROJECT_XRAY = (1 << 1), VP_FLAG_PROJECT_FLAT = (1 << 3), - VP_FLAG_SPRAY = (1 << 4), /* weight paint only */ VP_FLAG_VGROUP_RESTRICT = (1 << 7) }; diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index 6c89767ad29..6e493e2c865 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -692,12 +692,6 @@ static void rna_def_vertex_paint(BlenderRNA *brna) RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", VP_FLAG_PROJECT_FLAT); RNA_def_property_ui_text(prop, "Normals", "Paint most on faces pointing towards the view"); RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); - - - prop = RNA_def_property(srna, "use_spray", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_FLAG_SPRAY); - RNA_def_property_ui_text(prop, "Spray", "Keep applying paint effect while holding mouse"); - RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* weight paint only */ prop = RNA_def_property(srna, "use_group_restrict", PROP_BOOLEAN, PROP_NONE); -- cgit v1.2.3 From 7640d5e92aac588101719574c7d0ee36baac6416 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 3 Oct 2017 19:24:02 +1100 Subject: Error in last commit, weight must be set for non-accumulate --- source/blender/editors/sculpt_paint/paint_vertex.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source') diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index ee8934422bc..547cd9566e4 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -1806,6 +1806,7 @@ static void wpaint_paint_leaves( bContext *C, Object *ob, Sculpt *sd, VPaint *vp, struct WPaintData *wpd, WeightPaintInfo *wpi, Mesh *me, PBVHNode **nodes, int totnode) { + Scene *scene = CTX_data_scene(C); const Brush *brush = ob->sculpt->cache->brush; /* threaded loop over nodes */ @@ -1813,6 +1814,9 @@ static void wpaint_paint_leaves( .sd = sd, .ob = ob, .brush = brush, .nodes = nodes, .vp = vp, .wpd = wpd, .wpi = wpi, .me = me, .C = C, }; + /* Use this so average can modify its weight without touching the brush. */ + data.strength = BKE_brush_weight_get(scene, brush); + /* current mirroring code cannot be run in parallel */ bool use_threading = !(me->editflag & ME_EDIT_MIRROR_X); -- cgit v1.2.3 From 975ed05edbeee351661d05f3969af69dc7699b9c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 3 Oct 2017 20:19:59 +1100 Subject: Vertex Paint: smear got wrong last-location --- source/blender/editors/sculpt_paint/paint_vertex.c | 4 ++-- source/blender/editors/sculpt_paint/sculpt.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 547cd9566e4..9ab4e816010 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -1584,7 +1584,7 @@ static void do_wpaint_brush_smear_task_cb_ex( sub_v3_v3v3(brush_dir, cache->location, cache->last_location); project_plane_v3_v3v3(brush_dir, brush_dir, cache->view_normal); - if (normalize_v3(brush_dir) != 0.0f) { + if (cache->is_last_valid && (normalize_v3(brush_dir) != 0.0f)) { SculptBrushTest test; SculptBrushTestFn sculpt_brush_test_sq_fn = @@ -2661,7 +2661,7 @@ static void do_vpaint_brush_smear_task_cb_ex( sub_v3_v3v3(brush_dir, cache->location, cache->last_location); project_plane_v3_v3v3(brush_dir, brush_dir, cache->view_normal); - if (normalize_v3(brush_dir) != 0.0f) { + if (cache->is_last_valid && (normalize_v3(brush_dir) != 0.0f)) { SculptBrushTest test; SculptBrushTestFn sculpt_brush_test_sq_fn = diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index e8ea7f6709c..961fac287c1 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -3598,6 +3598,7 @@ void sculpt_cache_calc_brushdata_symm( const char axis, const float angle) { flip_v3_v3(cache->location, cache->true_location, symm); + flip_v3_v3(cache->last_location, cache->true_last_location, symm); flip_v3_v3(cache->grab_delta_symmetry, cache->grab_delta, symm); flip_v3_v3(cache->view_normal, cache->true_view_normal, symm); -- cgit v1.2.3 From 7c2d5eaacb70420b447107da29b114c9a62b294f Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Tue, 3 Oct 2017 12:28:07 +0300 Subject: Change weigth paint accumulate mechanics to fix problems with mirroring. Restoring weights is problematic when the stroke overlaps its mirror. It's better to simply compute the new weight based on the saved data rather than restoring things, and check that the change is monotonic. This way is also closer to how things worked before the merge. --- source/blender/editors/sculpt_paint/paint_vertex.c | 71 ++++++++++++++-------- 1 file changed, 47 insertions(+), 24 deletions(-) (limited to 'source') diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 9ab4e816010..98732e0bb9e 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -148,7 +148,7 @@ static bool vwpaint_use_normal(const VPaint *vp) } -static void defweight_prev_restore_or_init(MDeformVert *dvert_prev, MDeformVert *dvert_curr, int index) +static MDeformVert *defweight_prev_init(MDeformVert *dvert_prev, MDeformVert *dvert_curr, int index) { MDeformVert *dv_curr = &dvert_curr[index]; MDeformVert *dv_prev = &dvert_prev[index]; @@ -156,9 +156,7 @@ static void defweight_prev_restore_or_init(MDeformVert *dvert_prev, MDeformVert dv_prev->flag = 0; defvert_copy(dv_prev, dv_curr); } - else { - defvert_copy(dv_curr, dv_prev); - } + return dv_prev; } /* check if we can do partial updates and have them draw realtime @@ -412,6 +410,16 @@ static float wpaint_blend( return weight; } +static float wpaint_clamp_monotonic(float oldval, float curval, float newval) +{ + if (newval < oldval) + return MIN2(newval, curval); + else if (newval > oldval) + return MAX2(newval, curval); + else + return newval; +} + /* ----------------------------------------------------- */ static void do_weight_paint_normalize_all(MDeformVert *dvert, const int defbase_tot, const bool *vgroup_validmap) @@ -706,6 +714,7 @@ static void do_weight_paint_vertex_single( bool topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0; MDeformWeight *dw; + float weight_prev; /* mirror vars */ int index_mirr; @@ -729,14 +738,6 @@ static void do_weight_paint_vertex_single( index_mirr = vgroup_mirr = -1; } - if ((wp->paint.brush->flag & BRUSH_ACCUMULATE) == 0) { - struct MDeformVert *dvert_prev = ob->sculpt->mode.wpaint.dvert_prev; - defweight_prev_restore_or_init(dvert_prev, me->dvert, index); - if (index_mirr != -1) { - defweight_prev_restore_or_init(dvert_prev, me->dvert, index_mirr); - } - } - if (wp->flag & VP_FLAG_VGROUP_RESTRICT) { dw = defvert_find_index(dv, wpi->active.index); } @@ -781,14 +782,29 @@ static void do_weight_paint_vertex_single( dw_mirr = NULL; } + if ((wp->paint.brush->flag & BRUSH_ACCUMULATE) == 0) { + MDeformVert *dvert_prev = ob->sculpt->mode.wpaint.dvert_prev; + MDeformVert *dv_prev = defweight_prev_init(dvert_prev, me->dvert, index); + if (index_mirr != -1) { + defweight_prev_init(dvert_prev, me->dvert, index_mirr); + } + + weight_prev = defvert_find_weight(dv_prev, wpi->active.index); + } + else { + weight_prev = dw->weight; + } + /* If there are no normalize-locks or multipaint, * then there is no need to run the more complicated checks */ { - dw->weight = wpaint_blend( - wp, dw->weight, alpha, paintweight, + float new_weight = wpaint_blend( + wp, weight_prev, alpha, paintweight, wpi->brush_alpha_value, wpi->do_flip); + dw->weight = wpaint_clamp_monotonic(weight_prev, dw->weight, new_weight); + /* WATCH IT: take care of the ordering of applying mirror -> normalize, * can give wrong results [#26193], least confusing if normalize is done last */ @@ -859,7 +875,7 @@ static void do_weight_paint_vertex_multi( MDeformVert *dv_mirr = NULL; /* weights */ - float curw, neww, change, curw_mirr, change_mirr; + float curw, oldw, neww, change, curw_mirr, change_mirr; /* from now on we can check if mirrors enabled if this var is -1 and not bother with the flag */ if (me->editflag & ME_EDIT_MIRROR_X) { @@ -873,14 +889,6 @@ static void do_weight_paint_vertex_multi( } } - if ((wp->paint.brush->flag & BRUSH_ACCUMULATE) == 0) { - struct MDeformVert *dvert_prev = ob->sculpt->mode.wpaint.dvert_prev; - defweight_prev_restore_or_init(dvert_prev, me->dvert, index); - if (index_mirr != -1) { - defweight_prev_restore_or_init(dvert_prev, me->dvert, index_mirr); - } - } - /* compute weight change by applying the brush to average or sum of group weights */ curw = BKE_defvert_multipaint_collective_weight( dv, wpi->defbase_tot, wpi->defbase_sel, wpi->defbase_tot_sel, wpi->do_auto_normalize); @@ -890,7 +898,22 @@ static void do_weight_paint_vertex_multi( return; } - neww = wpaint_blend(wp, curw, alpha, paintweight, wpi->brush_alpha_value, wpi->do_flip); + if ((wp->paint.brush->flag & BRUSH_ACCUMULATE) == 0) { + MDeformVert *dvert_prev = ob->sculpt->mode.wpaint.dvert_prev; + MDeformVert *dv_prev = defweight_prev_init(dvert_prev, me->dvert, index); + if (index_mirr != -1) { + defweight_prev_init(dvert_prev, me->dvert, index_mirr); + } + + oldw = BKE_defvert_multipaint_collective_weight( + dv_prev, wpi->defbase_tot, wpi->defbase_sel, wpi->defbase_tot_sel, wpi->do_auto_normalize); + } + else { + oldw = curw; + } + + neww = wpaint_blend(wp, oldw, alpha, paintweight, wpi->brush_alpha_value, wpi->do_flip); + neww = wpaint_clamp_monotonic(oldw, curw, neww); change = neww / curw; -- cgit v1.2.3 From 314d93838e2766e02a6a272d397bf610aa3888fd Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 3 Oct 2017 12:31:36 +0200 Subject: Fix bplayer (c) --- source/blenderplayer/bad_level_call_stubs/stubs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index 6afb6c103e0..956f5d5f7ba 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -291,7 +291,7 @@ void RE_Database_Free(struct Render *re) RET_NONE void RE_FreeRender(struct Render *re) RET_NONE void RE_DataBase_GetView(struct Render *re, float mat[4][4]) RET_NONE int externtex( - struct MTex *mtex, const float vec[3], float *tin, float *tr, float *tg, float *tb, float *ta, + const struct MTex *mtex, const float vec[3], float *tin, float *tr, float *tg, float *tb, float *ta, const int thread, struct ImagePool *pool, const bool skip_load_image, const bool texnode_preview) RET_ZERO float texture_value_blend(float tex, float out, float fact, float facg, int blendtype) RET_ZERO void texture_rgb_blend(float in[3], const float tex[3], const float out[3], float fact, float facg, int blendtype) RET_NONE -- cgit v1.2.3 From 6a7dc3348ad9ad00d2827372bd4860dc36dc4163 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 3 Oct 2017 23:04:22 +1100 Subject: Vertex Paint: fix feedback loop w/ smear tool Was reading and writing from same array, this also makes smear thread-safe. --- source/blender/editors/sculpt_paint/paint_vertex.c | 64 +++++++++++++++++++++- 1 file changed, 61 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 98732e0bb9e..ce232030819 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -1198,6 +1198,12 @@ struct WPaintData { bool do_multipaint; /* true if multipaint enabled and multiple groups selected */ int defbase_tot; + + /* Special storage for smear brush, avoid feedback loop - update each step and swap. */ + struct { + float *weight_prev; + float *weight_curr; + } smear; }; /* Initialize the stroke cache invariants from operator properties */ @@ -1422,6 +1428,26 @@ static bool wpaint_stroke_test_start(bContext *C, wmOperator *op, const float mo wpd->mirror.lock = tmpflags; } + if (vp->paint.brush->vertexpaint_tool == PAINT_BLEND_SMEAR) { + wpd->smear.weight_prev = MEM_mallocN(sizeof(float) * me->totvert, __func__); + const MDeformVert *dv = me->dvert; + if (wpd->do_multipaint) { + const bool do_auto_normalize = ((ts->auto_normalize != 0) && (wpd->vgroup_validmap != NULL)); + for (int i = 0; i < me->totvert; i++, dv++) { + float weight = BKE_defvert_multipaint_collective_weight( + dv, wpd->defbase_tot, wpd->defbase_sel, wpd->defbase_tot_sel, do_auto_normalize); + CLAMP(weight, 0.0f, 1.0f); + wpd->smear.weight_prev[i] = weight; + } + } + else { + for (int i = 0; i < me->totvert; i++, dv++) { + wpd->smear.weight_prev[i] = defvert_find_weight(dv, wpd->active.index); + } + } + wpd->smear.weight_curr = MEM_dupallocN(wpd->smear.weight_prev); + } + /* painting on subsurfs should give correct points too, this returns me->totvert amount */ ob->sculpt->building_vp_handle = true; wpd->vp_handle = ED_vpaint_proj_handle_create(scene, ob, &wpd->vertexcosnos); @@ -1663,8 +1689,7 @@ static void do_wpaint_brush_smear_task_cb_ex( if (stroke_dot > stroke_dot_max) { stroke_dot_max = stroke_dot; - MDeformVert *dv = &data->me->dvert[v_other_index]; - weight_final = wpaint_get_active_weight(dv, data->wpi); + weight_final = data->wpd->smear.weight_prev[v_other_index]; do_color = true; } } @@ -1679,6 +1704,9 @@ static void do_wpaint_brush_smear_task_cb_ex( do_weight_paint_vertex( data->vp, data->ob, data->wpi, v_index, final_alpha, (float)weight_final); + /* Access the weight again because it might not have been applied completely. */ + data->wpd->smear.weight_curr[v_index] = + wpaint_get_active_weight(&data->me->dvert[v_index], data->wpi); } } } @@ -2044,6 +2072,10 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P swap_m4m4(vc->rv3d->persmat, mat); + if (wp->paint.brush->vertexpaint_tool == PAINT_BLEND_SMEAR) { + SWAP(float *, wpd->smear.weight_curr, wpd->smear.weight_prev); + } + /* calculate pivot for rotation around seletion if needed */ /* also needed for "View Selected" on last stroke */ paint_last_stroke_update(scene, vc->ar, mval); @@ -2093,6 +2125,10 @@ static void wpaint_stroke_done(const bContext *C, struct PaintStroke *stroke) MEM_freeN((void *)wpd->active.lock); if (wpd->mirror.lock) MEM_freeN((void *)wpd->mirror.lock); + if (wpd->smear.weight_prev) + MEM_freeN(wpd->smear.weight_prev); + if (wpd->smear.weight_curr) + MEM_freeN(wpd->smear.weight_curr); MEM_freeN(wpd); } @@ -2323,6 +2359,12 @@ struct VPaintData { bool *mlooptag; bool is_texbrush; + + /* Special storage for smear brush, avoid feedback loop - update each step and swap. */ + struct { + uint *color_prev; + uint *color_curr; + } smear; }; static bool vpaint_stroke_test_start(bContext *C, struct wmOperator *op, const float mouse[2]) @@ -2374,6 +2416,12 @@ static bool vpaint_stroke_test_start(bContext *C, struct wmOperator *op, const f vpd->mlooptag = MEM_mallocN(sizeof(bool) * me->totloop, "VPaintData mlooptag"); } + if (brush->vertexpaint_tool == PAINT_BLEND_SMEAR) { + vpd->smear.color_prev = MEM_mallocN(sizeof(uint) * me->totloop, __func__); + memcpy(vpd->smear.color_prev, me->mloopcol, sizeof(uint) * me->totloop); + vpd->smear.color_curr = MEM_dupallocN(vpd->smear.color_prev); + } + /* Create projection handle */ if (vpd->is_texbrush) { ob->sculpt->building_vp_handle = true; @@ -2747,7 +2795,7 @@ static void do_vpaint_brush_smear_task_cb_ex( if (stroke_dot > stroke_dot_max) { stroke_dot_max = stroke_dot; - color_final = lcol[mp->loopstart + k]; + color_final = data->vpd->smear.color_prev[mp->loopstart + k]; do_color = true; } } @@ -2780,6 +2828,8 @@ static void do_vpaint_brush_smear_task_cb_ex( lcol[l_index] = vpaint_blend( data->vp, lcol[l_index], color_orig, color_final, final_alpha, 255 * brush_strength); + + data->vpd->smear.color_curr[l_index] = lcol[l_index]; } } } @@ -2955,6 +3005,10 @@ static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P swap_m4m4(vc->rv3d->persmat, mat); + if (vp->paint.brush->vertexpaint_tool == PAINT_BLEND_SMEAR) { + SWAP(uint *, vpd->smear.color_curr, vpd->smear.color_prev); + } + /* calculate pivot for rotation around seletion if needed */ /* also needed for "View Selected" on last stroke */ paint_last_stroke_update(scene, vc->ar, mval); @@ -2980,6 +3034,10 @@ static void vpaint_stroke_done(const bContext *C, struct PaintStroke *stroke) if (vpd->mlooptag) MEM_freeN(vpd->mlooptag); + if (vpd->smear.color_prev) + MEM_freeN(vpd->smear.color_prev); + if (vpd->smear.color_curr) + MEM_freeN(vpd->smear.color_curr); WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); -- cgit v1.2.3 From a4721c05040fce606d6c6ccc4ea91bdf6c8846e8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 3 Oct 2017 23:35:30 +1100 Subject: Weight Paint: blend smear tool --- source/blender/editors/sculpt_paint/paint_vertex.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'source') diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index ce232030819..57fe8cab712 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -1697,7 +1697,7 @@ static void do_wpaint_brush_smear_task_cb_ex( } /* Apply weight to vertex */ if (do_color) { - const float brush_fade = BKE_brush_curve_strength(brush, 0.0f, cache->radius); + const float brush_fade = BKE_brush_curve_strength(brush, sqrtf(test.dist), cache->radius); const float final_alpha = brush_fade * brush_strength * grid_alpha * brush_alpha_pressure; @@ -2804,6 +2804,10 @@ static void do_vpaint_brush_smear_task_cb_ex( } if (do_color) { + const float final_alpha = + 255 * brush_fade * brush_strength * + brush_alpha_pressure * grid_alpha; + /* For each poly owning this vert, paint each loop belonging to this vert. */ for (int j = 0; j < gmap->vert_to_poly[v_index].count; j++) { const int p_index = gmap->vert_to_poly[v_index].indices[j]; @@ -2820,9 +2824,6 @@ static void do_vpaint_brush_smear_task_cb_ex( } color_orig = ss->mode.vpaint.previous_color[l_index]; } - const float final_alpha = - 255 * brush_fade * brush_strength * - brush_alpha_pressure * grid_alpha; /* Mix the new color with the original * based on the brush strength and the curve. */ lcol[l_index] = vpaint_blend( -- cgit v1.2.3 From 7ae02c2ddb2ce72fd1c33a2f8aeeb26b20efd375 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 3 Oct 2017 23:43:30 +1100 Subject: Cleanup: remove unused vpaint projection handle --- source/blender/editors/sculpt_paint/paint_vertex.c | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'source') diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 57fe8cab712..a6b41b51ca6 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -1183,9 +1183,6 @@ struct WPaintData { struct WeightPaintGroupData active, mirror; - void *vp_handle; - DMCoNo *vertexcosnos; - float wpimat[3][3]; /* variables for auto normalize */ @@ -1448,11 +1445,6 @@ static bool wpaint_stroke_test_start(bContext *C, wmOperator *op, const float mo wpd->smear.weight_curr = MEM_dupallocN(wpd->smear.weight_prev); } - /* painting on subsurfs should give correct points too, this returns me->totvert amount */ - ob->sculpt->building_vp_handle = true; - wpd->vp_handle = ED_vpaint_proj_handle_create(scene, ob, &wpd->vertexcosnos); - ob->sculpt->building_vp_handle = false; - /* imat for normals */ mul_m4_m4m4(mat, wpd->vc.rv3d->viewmat, ob->obmat); invert_m4_m4(imat, mat); @@ -2113,8 +2105,6 @@ static void wpaint_stroke_done(const bContext *C, struct PaintStroke *stroke) struct WPaintData *wpd = paint_stroke_mode_data(stroke); if (wpd) { - ED_vpaint_proj_handle_free(wpd->vp_handle); - if (wpd->defbase_sel) MEM_freeN((void *)wpd->defbase_sel); if (wpd->vgroup_validmap) -- cgit v1.2.3 From cbe07d980ccc860cb01549272fc95c08912581d7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 3 Oct 2017 23:50:34 +1100 Subject: Python: bump minimum version to 3.6 --- source/blender/python/intern/bpy_util.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/python/intern/bpy_util.h b/source/blender/python/intern/bpy_util.h index 63cb7920bd1..6000bf94aef 100644 --- a/source/blender/python/intern/bpy_util.h +++ b/source/blender/python/intern/bpy_util.h @@ -27,8 +27,8 @@ #ifndef __BPY_UTIL_H__ #define __BPY_UTIL_H__ -#if PY_VERSION_HEX < 0x03050000 -# error "Python 3.5 or greater is required, you'll need to update your python." +#if PY_VERSION_HEX < 0x03060000 +# error "Python 3.6 or greater is required, you'll need to update your python." #endif struct EnumPropertyItem; -- cgit v1.2.3 From ad22d29dac522923821faf553404c06b7cf208ad Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 3 Oct 2017 21:32:31 +0200 Subject: Some UI/messages fixes. --- source/blender/makesrna/intern/rna_space.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index ed28b0d399b..724eeccd108 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -2846,7 +2846,7 @@ static void rna_def_space_view3d(BlenderRNA *brna) prop = RNA_def_property(srna, "clip_planes", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "clip"); RNA_def_property_multi_array(prop, 2, (int[]){6, 4}); - RNA_def_property_ui_text(prop, "Clipe Planes", ""); + RNA_def_property_ui_text(prop, "Clip Planes", ""); prop = RNA_def_property(srna, "view_location", PROP_FLOAT, PROP_TRANSLATION); #if 0 -- cgit v1.2.3 From 728cffa9ce5f7e14ca474ae9fdcb654f0e01d2b4 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 4 Oct 2017 15:13:52 +1100 Subject: PyAPI: fast keyword parsing for bpy.props No functional changes. --- source/blender/python/intern/bpy_props.c | 224 ++++++++++++++++++------------- 1 file changed, 128 insertions(+), 96 deletions(-) (limited to 'source') diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index 9ef8f9aa046..a46fda7ea63 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -1995,8 +1995,6 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw) BPY_PROPDEF_HEAD(BoolProperty); if (srna) { - static const char *kwlist[] = {"attr", "name", "description", "default", - "options", "subtype", "update", "get", "set", NULL}; const char *id = NULL, *name = NULL, *description = ""; int id_len; bool def = false; @@ -2009,12 +2007,17 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw) PyObject *get_cb = NULL; PyObject *set_cb = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kw, - "s#|ssO&O!sOOO:BoolProperty", - (char **)kwlist, &id, &id_len, - &name, &description, PyC_ParseBool, &def, - &PySet_Type, &pyopts, &pysubtype, - &update_cb, &get_cb, &set_cb)) + static const char *_keywords[] = { + "attr", "name", "description", "default", + "options", "subtype", "update", "get", "set", NULL, + }; + static _PyArg_Parser _parser = {"s#|ssO&O!sOOO:BoolProperty", _keywords, 0}; + if (!_PyArg_ParseTupleAndKeywordsFast( + args, kw, &_parser, + &id, &id_len, + &name, &description, PyC_ParseBool, &def, + &PySet_Type, &pyopts, &pysubtype, + &update_cb, &get_cb, &set_cb)) { return NULL; } @@ -2077,8 +2080,6 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject BPY_PROPDEF_HEAD(BoolVectorProperty); if (srna) { - static const char *kwlist[] = {"attr", "name", "description", "default", - "options", "subtype", "size", "update", "get", "set", NULL}; const char *id = NULL, *name = NULL, *description = ""; int id_len; int def[PYRNA_STACK_ARRAY] = {0}; @@ -2093,12 +2094,17 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject PyObject *get_cb = NULL; PyObject *set_cb = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kw, - "s#|ssOO!siOOO:BoolVectorProperty", - (char **)kwlist, &id, &id_len, - &name, &description, &pydef, - &PySet_Type, &pyopts, &pysubtype, &size, - &update_cb, &get_cb, &set_cb)) + static const char *_keywords[] = { + "attr", "name", "description", "default", + "options", "subtype", "size", "update", "get", "set", NULL, + }; + static _PyArg_Parser _parser = {"s#|ssOO!siOOO:BoolVectorProperty", _keywords, 0}; + if (!_PyArg_ParseTupleAndKeywordsFast( + args, kw, &_parser, + &id, &id_len, + &name, &description, &pydef, + &PySet_Type, &pyopts, &pysubtype, &size, + &update_cb, &get_cb, &set_cb)) { return NULL; } @@ -2181,9 +2187,6 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw) BPY_PROPDEF_HEAD(IntProperty); if (srna) { - static const char *kwlist[] = {"attr", "name", "description", "default", - "min", "max", "soft_min", "soft_max", - "step", "options", "subtype", "update", "get", "set", NULL}; const char *id = NULL, *name = NULL, *description = ""; int id_len; int min = INT_MIN, max = INT_MAX, soft_min = INT_MIN, soft_max = INT_MAX, step = 1, def = 0; @@ -2196,13 +2199,19 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw) PyObject *get_cb = NULL; PyObject *set_cb = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kw, - "s#|ssiiiiiiO!sOOO:IntProperty", - (char **)kwlist, &id, &id_len, - &name, &description, &def, - &min, &max, &soft_min, &soft_max, - &step, &PySet_Type, &pyopts, &pysubtype, - &update_cb, &get_cb, &set_cb)) + static const char *_keywords[] = { + "attr", "name", "description", "default", + "min", "max", "soft_min", "soft_max", + "step", "options", "subtype", "update", "get", "set", NULL, + }; + static _PyArg_Parser _parser = {"s#|ssiiiiiiO!sOOO:IntProperty", _keywords, 0}; + if (!_PyArg_ParseTupleAndKeywordsFast( + args, kw, &_parser, + &id, &id_len, + &name, &description, &def, + &min, &max, &soft_min, &soft_max, + &step, &PySet_Type, &pyopts, &pysubtype, + &update_cb, &get_cb, &set_cb)) { return NULL; } @@ -2278,9 +2287,6 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject BPY_PROPDEF_HEAD(IntVectorProperty); if (srna) { - static const char *kwlist[] = {"attr", "name", "description", "default", - "min", "max", "soft_min", "soft_max", - "step", "options", "subtype", "size", "update", "get", "set", NULL}; const char *id = NULL, *name = NULL, *description = ""; int id_len; int min = INT_MIN, max = INT_MAX, soft_min = INT_MIN, soft_max = INT_MAX, step = 1; @@ -2296,14 +2302,20 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject PyObject *get_cb = NULL; PyObject *set_cb = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kw, - "s#|ssOiiiiiO!siOOO:IntVectorProperty", - (char **)kwlist, &id, &id_len, - &name, &description, &pydef, - &min, &max, &soft_min, &soft_max, - &step, &PySet_Type, &pyopts, - &pysubtype, &size, - &update_cb, &get_cb, &set_cb)) + static const char *_keywords[] = { + "attr", "name", "description", "default", + "min", "max", "soft_min", "soft_max", + "step", "options", "subtype", "size", "update", "get", "set", NULL, + }; + static _PyArg_Parser _parser = {"s#|ssOiiiiiO!siOOO:IntVectorProperty", _keywords, 0}; + if (!_PyArg_ParseTupleAndKeywordsFast( + args, kw, &_parser, + &id, &id_len, + &name, &description, &pydef, + &min, &max, &soft_min, &soft_max, + &step, &PySet_Type, &pyopts, + &pysubtype, &size, + &update_cb, &get_cb, &set_cb)) { return NULL; } @@ -2391,10 +2403,6 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw) BPY_PROPDEF_HEAD(FloatProperty); if (srna) { - static const char *kwlist[] = {"attr", "name", "description", "default", - "min", "max", "soft_min", "soft_max", - "step", "precision", "options", "subtype", - "unit", "update", "get", "set", NULL}; const char *id = NULL, *name = NULL, *description = ""; int id_len; float min = -FLT_MAX, max = FLT_MAX, soft_min = -FLT_MAX, soft_max = FLT_MAX, step = 3, def = 0.0f; @@ -2410,14 +2418,21 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw) PyObject *get_cb = NULL; PyObject *set_cb = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kw, - "s#|ssffffffiO!ssOOO:FloatProperty", - (char **)kwlist, &id, &id_len, - &name, &description, &def, - &min, &max, &soft_min, &soft_max, - &step, &precision, &PySet_Type, - &pyopts, &pysubtype, &pyunit, - &update_cb, &get_cb, &set_cb)) + static const char *_keywords[] = { + "attr", "name", "description", "default", + "min", "max", "soft_min", "soft_max", + "step", "precision", "options", "subtype", + "unit", "update", "get", "set", NULL, + }; + static _PyArg_Parser _parser = {"s#|ssffffffiO!ssOOO:FloatProperty", _keywords, 0}; + if (!_PyArg_ParseTupleAndKeywordsFast( + args, kw, &_parser, + &id, &id_len, + &name, &description, &def, + &min, &max, &soft_min, &soft_max, + &step, &precision, &PySet_Type, + &pyopts, &pysubtype, &pyunit, + &update_cb, &get_cb, &set_cb)) { return NULL; } @@ -2502,10 +2517,6 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec BPY_PROPDEF_HEAD(FloatVectorProperty); if (srna) { - static const char *kwlist[] = {"attr", "name", "description", "default", - "min", "max", "soft_min", "soft_max", - "step", "precision", "options", "subtype", - "unit", "size", "update", "get", "set", NULL}; const char *id = NULL, *name = NULL, *description = ""; int id_len; float min = -FLT_MAX, max = FLT_MAX, soft_min = -FLT_MAX, soft_max = FLT_MAX, step = 3; @@ -2523,14 +2534,21 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec PyObject *get_cb = NULL; PyObject *set_cb = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kw, - "s#|ssOfffffiO!ssiOOO:FloatVectorProperty", - (char **)kwlist, &id, &id_len, - &name, &description, &pydef, - &min, &max, &soft_min, &soft_max, - &step, &precision, &PySet_Type, - &pyopts, &pysubtype, &pyunit, &size, - &update_cb, &get_cb, &set_cb)) + static const char *_keywords[] = { + "attr", "name", "description", "default", + "min", "max", "soft_min", "soft_max", + "step", "precision", "options", "subtype", + "unit", "size", "update", "get", "set", NULL, + }; + static _PyArg_Parser _parser = {"s#|ssOfffffiO!ssiOOO:FloatVectorProperty", _keywords, 0}; + if (!_PyArg_ParseTupleAndKeywordsFast( + args, kw, &_parser, + &id, &id_len, + &name, &description, &pydef, + &min, &max, &soft_min, &soft_max, + &step, &precision, &PySet_Type, + &pyopts, &pysubtype, &pyunit, &size, + &update_cb, &get_cb, &set_cb)) { return NULL; } @@ -2611,8 +2629,6 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw BPY_PROPDEF_HEAD(StringProperty); if (srna) { - static const char *kwlist[] = {"attr", "name", "description", "default", - "maxlen", "options", "subtype", "update", "get", "set", NULL}; const char *id = NULL, *name = NULL, *description = "", *def = ""; int id_len; int maxlen = 0; @@ -2625,12 +2641,17 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw PyObject *get_cb = NULL; PyObject *set_cb = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kw, - "s#|sssiO!sOOO:StringProperty", - (char **)kwlist, &id, &id_len, - &name, &description, &def, - &maxlen, &PySet_Type, &pyopts, &pysubtype, - &update_cb, &get_cb, &set_cb)) + static const char *_keywords[] = { + "attr", "name", "description", "default", + "maxlen", "options", "subtype", "update", "get", "set", NULL, + }; + static _PyArg_Parser _parser = {"s#|sssiO!sOOO:StringProperty", _keywords, 0}; + if (!_PyArg_ParseTupleAndKeywordsFast( + args, kw, &_parser, + &id, &id_len, + &name, &description, &def, + &maxlen, &PySet_Type, &pyopts, &pysubtype, + &update_cb, &get_cb, &set_cb)) { return NULL; } @@ -2720,8 +2741,6 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw) BPY_PROPDEF_HEAD(EnumProperty); if (srna) { - static const char *kwlist[] = {"attr", "items", "name", "description", "default", - "options", "update", "get", "set", NULL}; const char *id = NULL, *name = NULL, *description = ""; PyObject *def = NULL; int id_len; @@ -2736,12 +2755,17 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw) PyObject *get_cb = NULL; PyObject *set_cb = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kw, - "s#O|ssOO!OOO:EnumProperty", - (char **)kwlist, &id, &id_len, - &items, &name, &description, - &def, &PySet_Type, &pyopts, - &update_cb, &get_cb, &set_cb)) + static const char *_keywords[] = { + "attr", "items", "name", "description", "default", + "options", "update", "get", "set", NULL, + }; + static _PyArg_Parser _parser = {"s#O|ssOO!OOO:EnumProperty", _keywords, 0}; + if (!_PyArg_ParseTupleAndKeywordsFast( + args, kw, &_parser, + &id, &id_len, + &items, &name, &description, + &def, &PySet_Type, &pyopts, + &update_cb, &get_cb, &set_cb)) { return NULL; } @@ -2869,7 +2893,6 @@ PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw) BPY_PROPDEF_HEAD(PointerProperty); if (srna) { - static const char *kwlist[] = {"attr", "type", "name", "description", "options", "poll", "update", NULL}; const char *id = NULL, *name = NULL, *description = ""; int id_len; PropertyRNA *prop; @@ -2879,12 +2902,16 @@ PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw) int opts = 0; PyObject *update_cb = NULL, *poll_cb = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kw, - "s#O|ssO!OO:PointerProperty", - (char **)kwlist, &id, &id_len, - &type, &name, &description, - &PySet_Type, &pyopts, - &poll_cb, &update_cb)) + static const char *_keywords[] = { + "attr", "type", "name", "description", "options", "poll", "update", NULL, + }; + static _PyArg_Parser _parser = {"s#O|ssO!OO:PointerProperty", _keywords, 0}; + if (!_PyArg_ParseTupleAndKeywordsFast( + args, kw, &_parser, + &id, &id_len, + &type, &name, &description, + &PySet_Type, &pyopts, + &poll_cb, &update_cb)) { return NULL; } @@ -2943,20 +2970,23 @@ PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject *kw) BPY_PROPDEF_HEAD(CollectionProperty); if (srna) { - static const char *kwlist[] = {"attr", "type", "name", "description", "options", NULL}; - const char *id = NULL, *name = NULL, *description = ""; int id_len; + const char *id = NULL, *name = NULL, *description = ""; PropertyRNA *prop; StructRNA *ptype; PyObject *type = Py_None; PyObject *pyopts = NULL; int opts = 0; - if (!PyArg_ParseTupleAndKeywords(args, kw, - "s#O|ssO!:CollectionProperty", - (char **)kwlist, &id, &id_len, - &type, &name, &description, - &PySet_Type, &pyopts)) + static const char *_keywords[] = { + "attr", "type", "name", "description", "options", NULL, + }; + static _PyArg_Parser _parser = {"s#O|ssO!:CollectionProperty", _keywords, 0}; + if (!_PyArg_ParseTupleAndKeywordsFast( + args, kw, &_parser, + &id, &id_len, + &type, &name, &description, + &PySet_Type, &pyopts)) { return NULL; } @@ -3028,13 +3058,15 @@ static PyObject *BPy_RemoveProperty(PyObject *self, PyObject *args, PyObject *kw return NULL; } else { - static const char *kwlist[] = {"attr", NULL}; - const char *id = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kw, - "s:RemoveProperty", - (char **)kwlist, &id)) + static const char *_keywords[] = { + "attr", NULL, + }; + static _PyArg_Parser _parser = {"s:RemoveProperty", _keywords, 0}; + if (!_PyArg_ParseTupleAndKeywordsFast( + args, kw, &_parser, + &id)) { return NULL; } -- cgit v1.2.3 From 92272f56e67e2fa0fa6c2ad764641cbb41c92507 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 4 Oct 2017 15:54:41 +1100 Subject: PyAPI: fast keyword parsing for __import__ No functional changes. --- source/blender/python/generic/bpy_internal_import.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source') diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c index 7ab6447d21a..582a0d22d2f 100644 --- a/source/blender/python/generic/bpy_internal_import.c +++ b/source/blender/python/generic/bpy_internal_import.c @@ -285,13 +285,13 @@ static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject int found = 0; PyObject *globals = NULL, *locals = NULL, *fromlist = NULL; int level = 0; /* relative imports */ - PyObject *newmodule; - //PyObject_Print(args, stderr, 0); - static const char *kwlist[] = {"name", "globals", "locals", "fromlist", "level", NULL}; - - if (!PyArg_ParseTupleAndKeywords(args, kw, "s|OOOi:bpy_import_meth", (char **)kwlist, - &name, &globals, &locals, &fromlist, &level)) + + static const char *_keywords[] = {"name", "globals", "locals", "fromlist", "level", NULL}; + static _PyArg_Parser _parser = {"s|OOOi:bpy_import_meth", _keywords, 0}; + if (!_PyArg_ParseTupleAndKeywordsFast( + args, kw, &_parser, + &name, &globals, &locals, &fromlist, &level)) { return NULL; } -- cgit v1.2.3 From 08f728a3e91a7c62946847e89632390c400d55ea Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 4 Oct 2017 16:44:45 +1100 Subject: Cleanup: redundant casts --- source/blender/editors/space_image/image_ops.c | 11 +++++++---- source/blender/editors/space_outliner/outliner_tree.c | 4 ++-- source/blender/python/generic/bpy_internal_import.c | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) (limited to 'source') diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 55fcf9213d6..b30c1d129d4 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -2385,8 +2385,8 @@ static int image_new_exec(bContext *C, wmOperator *op) Main *bmain; PointerRNA ptr, idptr; PropertyRNA *prop; - char _name[MAX_ID_NAME - 2]; - char *name = _name; + char name_buffer[MAX_ID_NAME - 2]; + const char *name; float color[4]; int width, height, floatbuf, gen_type, alpha; int gen_context; @@ -2399,10 +2399,13 @@ static int image_new_exec(bContext *C, wmOperator *op) bmain = CTX_data_main(C); prop = RNA_struct_find_property(op->ptr, "name"); - RNA_property_string_get(op->ptr, prop, name); + RNA_property_string_get(op->ptr, prop, name_buffer); if (!RNA_property_is_set(op->ptr, prop)) { /* Default value, we can translate! */ - name = (char *)DATA_(name); + name = DATA_(name_buffer); + } + else { + name = name_buffer; } width = RNA_int_get(op->ptr, "width"); height = RNA_int_get(op->ptr, "height"); diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index 4b0b0e2e0f0..41125478ec0 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -1327,7 +1327,7 @@ static void outliner_add_library_contents(Main *mainvar, SpaceOops *soops, TreeE ten = outliner_add_element(soops, &te->subtree, lbarray[a], NULL, TSE_ID_BASE, 0); ten->directdata = lbarray[a]; - ten->name = (char *)BKE_idcode_to_name_plural(GS(id->name)); + ten->name = BKE_idcode_to_name_plural(GS(id->name)); if (ten->name == NULL) ten->name = "UNKNOWN"; @@ -1367,7 +1367,7 @@ static void outliner_add_orphaned_datablocks(Main *mainvar, SpaceOops *soops) ten = outliner_add_element(soops, &soops->tree, lbarray[a], NULL, TSE_ID_BASE, 0); ten->directdata = lbarray[a]; - ten->name = (char *)BKE_idcode_to_name_plural(GS(id->name)); + ten->name = BKE_idcode_to_name_plural(GS(id->name)); if (ten->name == NULL) ten->name = "UNKNOWN"; diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c index 582a0d22d2f..ffac09efdde 100644 --- a/source/blender/python/generic/bpy_internal_import.c +++ b/source/blender/python/generic/bpy_internal_import.c @@ -253,7 +253,7 @@ PyObject *bpy_text_reimport(PyObject *module, int *found) if (module_file == NULL) { return NULL; } - filepath = (char *)_PyUnicode_AsString(module_file); + filepath = _PyUnicode_AsString(module_file); Py_DECREF(module_file); if (filepath == NULL) { return NULL; -- cgit v1.2.3 From d1dfed206b34b128bb0a972891bcc0a249176209 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 4 Oct 2017 18:01:53 +1100 Subject: Fix T52923: Circle diameter is in fact radius --- source/blender/bmesh/intern/bmesh_opdefines.c | 2 +- source/blender/bmesh/operators/bmo_primitive.c | 8 ++++---- source/blender/editors/mesh/editmesh_add.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'source') diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c index a55df234264..4f48dafd211 100644 --- a/source/blender/bmesh/intern/bmesh_opdefines.c +++ b/source/blender/bmesh/intern/bmesh_opdefines.c @@ -1684,7 +1684,7 @@ static BMOpDefine bmo_create_circle_def = { {{"cap_ends", BMO_OP_SLOT_BOOL}, /* whether or not to fill in the ends with faces */ {"cap_tris", BMO_OP_SLOT_BOOL}, /* fill ends with triangles instead of ngons */ {"segments", BMO_OP_SLOT_INT}, - {"diameter", BMO_OP_SLOT_FLT}, /* diameter of one end */ + {"radius", BMO_OP_SLOT_FLT}, /* Radius of the circle. */ {"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */ {"calc_uvs", BMO_OP_SLOT_BOOL}, /* calculate default UVs */ {{'\0'}}, diff --git a/source/blender/bmesh/operators/bmo_primitive.c b/source/blender/bmesh/operators/bmo_primitive.c index d8f83d786b4..95d61763902 100644 --- a/source/blender/bmesh/operators/bmo_primitive.c +++ b/source/blender/bmesh/operators/bmo_primitive.c @@ -1285,7 +1285,7 @@ void bmo_create_monkey_exec(BMesh *bm, BMOperator *op) void bmo_create_circle_exec(BMesh *bm, BMOperator *op) { - const float dia = BMO_slot_float_get(op->slots_in, "diameter"); + const float radius = BMO_slot_float_get(op->slots_in, "radius"); const int segs = BMO_slot_int_get(op->slots_in, "segments"); const bool cap_ends = BMO_slot_bool_get(op->slots_in, "cap_ends"); const bool cap_tris = BMO_slot_bool_get(op->slots_in, "cap_tris"); @@ -1315,8 +1315,8 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op) for (a = 0; a < segs; a++, phi += phid) { /* Going this way ends up with normal(s) upward */ - vec[0] = -dia * sinf(phi); - vec[1] = dia * cosf(phi); + vec[0] = -radius * sinf(phi); + vec[1] = radius * cosf(phi); vec[2] = 0.0f; mul_m4_v3(mat, vec); v1 = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP); @@ -1351,7 +1351,7 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op) BMO_face_flag_enable(bm, f, FACE_NEW); if (calc_uvs) { - BM_mesh_calc_uvs_circle(bm, mat, dia, FACE_NEW, cd_loop_uv_offset); + BM_mesh_calc_uvs_circle(bm, mat, radius, FACE_NEW, cd_loop_uv_offset); } } diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index 07fedffaf80..77772cfc8cc 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -233,7 +233,7 @@ static int add_primitive_circle_exec(bContext *C, wmOperator *op) if (!EDBM_op_call_and_selectf( em, op, "verts.out", false, - "create_circle segments=%i diameter=%f cap_ends=%b cap_tris=%b matrix=%m4 calc_uvs=%b", + "create_circle segments=%i radius=%f cap_ends=%b cap_tris=%b matrix=%m4 calc_uvs=%b", RNA_int_get(op->ptr, "vertices"), RNA_float_get(op->ptr, "radius"), cap_end, cap_tri, mat, calc_uvs)) { -- cgit v1.2.3 From b22b2c783daa22198b1268b0e4045c76877b5a35 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 4 Oct 2017 14:59:44 +0500 Subject: Fix T52982: Join operator with context override crashes Blender 2.79 --- source/blender/editors/mesh/meshtools.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'source') diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index ba57cda6916..c900373a59c 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -78,7 +78,7 @@ static void join_mesh_single( Main *bmain, Scene *scene, - Object *ob_dst, Base *base_src, float imat[4][4], + Object *ob_dst, Object *ob_src, float imat[4][4], MVert **mvert_pp, MEdge **medge_pp, MLoop **mloop_pp, MPoly **mpoly_pp, CustomData *vdata, CustomData *edata, CustomData *ldata, CustomData *pdata, int totvert, int totedge, int totloop, int totpoly, @@ -88,7 +88,7 @@ static void join_mesh_single( { int a, b; - Mesh *me = base_src->object->data; + Mesh *me = ob_src->data; MVert *mvert = *mvert_pp; MEdge *medge = *medge_pp; MLoop *mloop = *mloop_pp; @@ -112,10 +112,10 @@ static void join_mesh_single( /* Build src to merged mapping of vgroup indices. */ bDeformGroup *dg_src; - int *vgroup_index_map = alloca(sizeof(*vgroup_index_map) * BLI_listbase_count(&base_src->object->defbase)); + int *vgroup_index_map = alloca(sizeof(*vgroup_index_map) * BLI_listbase_count(&ob_src->defbase)); bool is_vgroup_remap_needed = false; - for (dg_src = base_src->object->defbase.first, b = 0; dg_src; dg_src = dg_src->next, b++) { + for (dg_src = ob_src->defbase.first, b = 0; dg_src; dg_src = dg_src->next, b++) { vgroup_index_map[b] = defgroup_name_index(ob_dst, dg_src->name); is_vgroup_remap_needed = is_vgroup_remap_needed || (vgroup_index_map[b] != b); } @@ -130,11 +130,11 @@ static void join_mesh_single( } /* if this is the object we're merging into, no need to do anything */ - if (base_src->object != ob_dst) { + if (ob_src != ob_dst) { float cmat[4][4]; /* watch this: switch matmul order really goes wrong */ - mul_m4_m4m4(cmat, imat, base_src->object->obmat); + mul_m4_m4m4(cmat, imat, ob_src->obmat); /* transform vertex coordinates into new space */ for (a = 0, mvert = *mvert_pp; a < me->totvert; a++, mvert++) { @@ -211,13 +211,13 @@ static void join_mesh_single( } if (me->totloop) { - if (base_src->object != ob_dst) { + if (ob_src != ob_dst) { MultiresModifierData *mmd; - multiresModifier_prepare_join(scene, base_src->object, ob_dst); + multiresModifier_prepare_join(scene, ob_src, ob_dst); - if ((mmd = get_multires_modifier(scene, base_src->object, true))) { - ED_object_iter_other(bmain, base_src->object, true, + if ((mmd = get_multires_modifier(scene, ob_src, true))) { + ED_object_iter_other(bmain, ob_src, true, ED_object_multires_update_totlevels_cb, &mmd->totlvl); } @@ -235,8 +235,8 @@ static void join_mesh_single( if (me->totpoly) { if (matmap) { /* make mapping for materials */ - for (a = 1; a <= base_src->object->totcol; a++) { - Material *ma = give_current_material(base_src->object, a); + for (a = 1; a <= ob_src->totcol; a++) { + Material *ma = give_current_material(ob_src, a); for (b = 0; b < totcol; b++) { if (ma == matar[b]) { @@ -271,8 +271,7 @@ int join_mesh_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); - Base *ob_base = CTX_data_active_base(C); - Object *ob = ob_base->object; + Object *ob = CTX_data_active_object(C); Material **matar = NULL, *ma; Mesh *me; MVert *mvert = NULL; @@ -495,7 +494,7 @@ int join_mesh_exec(bContext *C, wmOperator *op) */ join_mesh_single( bmain, scene, - ob, ob_base, imat, + ob, ob, imat, &mvert, &medge, &mloop, &mpoly, &vdata, &edata, &ldata, &pdata, totvert, totedge, totloop, totpoly, @@ -512,7 +511,7 @@ int join_mesh_exec(bContext *C, wmOperator *op) if (base->object->type == OB_MESH) { join_mesh_single( bmain, scene, - ob, base, imat, + ob, base->object, imat, &mvert, &medge, &mloop, &mpoly, &vdata, &edata, &ldata, &pdata, totvert, totedge, totloop, totpoly, -- cgit v1.2.3 From a22af1a84b3f15e300a1099cf4cc958d8abcc3dd Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 4 Oct 2017 12:38:40 +0200 Subject: Fix i18n messages extraction script, and a few more UI messages... --- source/blender/editors/sculpt_paint/paint_vertex_color_ops.c | 4 ++-- source/blender/makesrna/intern/rna_modifier.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'source') diff --git a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c index 4acd4ddbd8d..bfe6373d106 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c +++ b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c @@ -190,7 +190,7 @@ void PAINT_OT_vertex_color_from_weight(wmOperatorType *ot) /* identifiers */ ot->name = "Vertex Color from Weight"; ot->idname = "PAINT_OT_vertex_color_from_weight"; - ot->description = "Converts active weight into greyscale vertex colors"; + ot->description = "Convert active weight into grey scale vertex colors"; /* api callback */ ot->exec = vertex_paint_from_weight_exec; @@ -571,4 +571,4 @@ void PAINT_OT_vertex_color_levels(wmOperatorType *ot) RNA_def_float(ot->srna, "gain", 1.0f, 0.0f, FLT_MAX, "Gain", "Value to multiply colors by", 0.0f, 10.0f); } -/** \} */ \ No newline at end of file +/** \} */ diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 74aa3759d2d..a35d518b786 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -1997,8 +1997,8 @@ static void rna_def_modifier_boolean(BlenderRNA *brna) /* BMesh intersection options */ static EnumPropertyItem debug_items[] = { {eBooleanModifierBMeshFlag_BMesh_Separate, "SEPARATE", 0, "Separate", ""}, - {eBooleanModifierBMeshFlag_BMesh_NoDissolve, "NO_DISSOLVE", 0, "NoDissolve", ""}, - {eBooleanModifierBMeshFlag_BMesh_NoConnectRegions, "NO_CONNECT_REGIONS", 0, "NoConnectRegions", ""}, + {eBooleanModifierBMeshFlag_BMesh_NoDissolve, "NO_DISSOLVE", 0, "No Dissolve", ""}, + {eBooleanModifierBMeshFlag_BMesh_NoConnectRegions, "NO_CONNECT_REGIONS", 0, "No Connect Regions", ""}, {0, NULL, 0, NULL, NULL} }; -- cgit v1.2.3 From 9609828000e324ae97f94357ff1c189f7afed93c Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 4 Oct 2017 12:42:33 +0200 Subject: Tssst, we use USA english, not Oxford one... :P --- source/blender/editors/sculpt_paint/paint_vertex_color_ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c index bfe6373d106..b69ca32e5af 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c +++ b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c @@ -190,7 +190,7 @@ void PAINT_OT_vertex_color_from_weight(wmOperatorType *ot) /* identifiers */ ot->name = "Vertex Color from Weight"; ot->idname = "PAINT_OT_vertex_color_from_weight"; - ot->description = "Convert active weight into grey scale vertex colors"; + ot->description = "Convert active weight into gray scale vertex colors"; /* api callback */ ot->exec = vertex_paint_from_weight_exec; -- cgit v1.2.3 From 296757804cc2e97a3d95b4e44a6cc5d508e1c345 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 5 Oct 2017 02:44:02 +1100 Subject: Fix error copying smoke modifier uv layer --- source/blender/blenkernel/intern/smoke.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index adecea7080c..fcf4724bd1c 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -677,7 +677,7 @@ void smokeModifier_copy(struct SmokeModifierData *smd, struct SmokeModifierData tsmd->flow->texture_size = smd->flow->texture_size; tsmd->flow->texture_offset = smd->flow->texture_offset; - BLI_strncpy(tsmd->flow->uvlayer_name, tsmd->flow->uvlayer_name, sizeof(tsmd->flow->uvlayer_name)); + BLI_strncpy(tsmd->flow->uvlayer_name, smd->flow->uvlayer_name, sizeof(tsmd->flow->uvlayer_name)); tsmd->flow->vgroup_density = smd->flow->vgroup_density; tsmd->flow->type = smd->flow->type; -- cgit v1.2.3