Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/paint_vertex.c
| Show First 20 Lines • Show All 2,265 Lines • ▼ Show 20 Lines | static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, PointerRNA *itemptr) | ||||
| Object *ob = CTX_data_active_object(C); | Object *ob = CTX_data_active_object(C); | ||||
| SculptSession *ss = ob->sculpt; | SculptSession *ss = ob->sculpt; | ||||
| Sculpt *sd = CTX_data_tool_settings(C)->sculpt; | Sculpt *sd = CTX_data_tool_settings(C)->sculpt; | ||||
| vwpaint_update_cache_variants(C, wp, ob, itemptr); | vwpaint_update_cache_variants(C, wp, ob, itemptr); | ||||
| float mat[4][4]; | float mat[4][4]; | ||||
| float mval[2]; | |||||
| const float brush_alpha_value = BKE_brush_alpha_get(scene, brush); | const float brush_alpha_value = BKE_brush_alpha_get(scene, brush); | ||||
| /* intentionally don't initialize as NULL, make sure we initialize all members below */ | /* intentionally don't initialize as NULL, make sure we initialize all members below */ | ||||
| WeightPaintInfo wpi; | WeightPaintInfo wpi; | ||||
| /* cannot paint if there is no stroke data */ | /* cannot paint if there is no stroke data */ | ||||
| if (wpd == NULL) { | if (wpd == NULL) { | ||||
| Show All 33 Lines | static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, PointerRNA *itemptr) | ||||
| } | } | ||||
| wpaint_do_symmetrical_brush_actions(C, ob, wp, sd, wpd, &wpi); | wpaint_do_symmetrical_brush_actions(C, ob, wp, sd, wpd, &wpi); | ||||
| swap_m4m4(vc->rv3d->persmat, mat); | swap_m4m4(vc->rv3d->persmat, mat); | ||||
| /* calculate pivot for rotation around seletion if needed */ | /* calculate pivot for rotation around seletion if needed */ | ||||
| /* also needed for "View Selected" on last stroke */ | /* also needed for "View Selected" on last stroke */ | ||||
| paint_last_stroke_update(scene, vc->ar, mval); | paint_last_stroke_update(scene, vc->ar, ss->cache->mouse); | ||||
| BKE_mesh_batch_cache_dirty_tag(ob->data, BKE_MESH_BATCH_DIRTY_ALL); | BKE_mesh_batch_cache_dirty_tag(ob->data, BKE_MESH_BATCH_DIRTY_ALL); | ||||
| DEG_id_tag_update(ob->data, 0); | DEG_id_tag_update(ob->data, 0); | ||||
| WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); | WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); | ||||
| swap_m4m4(wpd->vc.rv3d->persmat, mat); | swap_m4m4(wpd->vc.rv3d->persmat, mat); | ||||
| rcti r; | rcti r; | ||||
| ▲ Show 20 Lines • Show All 935 Lines • ▼ Show 20 Lines | |||||
| static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, PointerRNA *itemptr) | static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, PointerRNA *itemptr) | ||||
| { | { | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| ToolSettings *ts = CTX_data_tool_settings(C); | ToolSettings *ts = CTX_data_tool_settings(C); | ||||
| struct VPaintData *vpd = paint_stroke_mode_data(stroke); | struct VPaintData *vpd = paint_stroke_mode_data(stroke); | ||||
| VPaint *vp = ts->vpaint; | VPaint *vp = ts->vpaint; | ||||
| ViewContext *vc = &vpd->vc; | ViewContext *vc = &vpd->vc; | ||||
| Object *ob = vc->obact; | Object *ob = vc->obact; | ||||
| SculptSession *ss = ob->sculpt; | |||||
| Sculpt *sd = CTX_data_tool_settings(C)->sculpt; | Sculpt *sd = CTX_data_tool_settings(C)->sculpt; | ||||
| vwpaint_update_cache_variants(C, vp, ob, itemptr); | vwpaint_update_cache_variants(C, vp, ob, itemptr); | ||||
| float mat[4][4]; | float mat[4][4]; | ||||
| float mval[2]; | |||||
| ED_view3d_init_mats_rv3d(ob, vc->rv3d); | ED_view3d_init_mats_rv3d(ob, vc->rv3d); | ||||
| /* load projection matrix */ | /* load projection matrix */ | ||||
| mul_m4_m4m4(mat, vc->rv3d->persmat, ob->obmat); | mul_m4_m4m4(mat, vc->rv3d->persmat, ob->obmat); | ||||
| swap_m4m4(vc->rv3d->persmat, mat); | swap_m4m4(vc->rv3d->persmat, mat); | ||||
| vpaint_do_symmetrical_brush_actions(C, sd, vp, vpd, ob); | vpaint_do_symmetrical_brush_actions(C, sd, vp, vpd, ob); | ||||
| swap_m4m4(vc->rv3d->persmat, mat); | swap_m4m4(vc->rv3d->persmat, mat); | ||||
| BKE_mesh_batch_cache_dirty_tag(ob->data, BKE_MESH_BATCH_DIRTY_ALL); | BKE_mesh_batch_cache_dirty_tag(ob->data, BKE_MESH_BATCH_DIRTY_ALL); | ||||
| if (vp->paint.brush->vertexpaint_tool == VPAINT_TOOL_SMEAR) { | if (vp->paint.brush->vertexpaint_tool == VPAINT_TOOL_SMEAR) { | ||||
| memcpy( | memcpy( | ||||
| vpd->smear.color_prev, vpd->smear.color_curr, sizeof(uint) * ((Mesh *)ob->data)->totloop); | vpd->smear.color_prev, vpd->smear.color_curr, sizeof(uint) * ((Mesh *)ob->data)->totloop); | ||||
| } | } | ||||
| /* calculate pivot for rotation around seletion if needed */ | /* calculate pivot for rotation around seletion if needed */ | ||||
| /* also needed for "View Selected" on last stroke */ | /* also needed for "View Selected" on last stroke */ | ||||
| paint_last_stroke_update(scene, vc->ar, mval); | paint_last_stroke_update(scene, vc->ar, ss->cache->mouse); | ||||
| ED_region_tag_redraw(vc->ar); | ED_region_tag_redraw(vc->ar); | ||||
| if (vpd->use_fast_update == false) { | if (vpd->use_fast_update == false) { | ||||
| /* recalculate modifier stack to get new colors, slow, | /* recalculate modifier stack to get new colors, slow, | ||||
| * avoid this if we can! */ | * avoid this if we can! */ | ||||
| DEG_id_tag_update(ob->data, 0); | DEG_id_tag_update(ob->data, 0); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 110 Lines • Show Last 20 Lines | |||||