Commit: 6e58098a9ff535519f0de4ace4cdc3f291bc0f4f Author: Antonio Vazquez Date: Fri Mar 6 17:41:52 2020 +0100 Branches: greasepencil-object https://developer.blender.org/rB6e58098a9ff535519f0de4ace4cdc3f291bc0f4f
Merge branch 'master' into greasepencil-object Conflicts: source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c source/blender/draw/engines/gpencil/gpencil_engine.c source/blender/editors/gpencil/drawgpencil.c source/blender/editors/gpencil/gpencil_fill.c source/blender/editors/gpencil/gpencil_interpolate.c source/blender/editors/gpencil/gpencil_paint.c source/blender/editors/gpencil/gpencil_sculpt_paint.c source/blender/editors/gpencil/gpencil_utils.c =================================================================== =================================================================== diff --cc source/blender/blenkernel/BKE_brush.h index 958642453b5,6644a3f0231..a97263a6523 --- a/source/blender/blenkernel/BKE_brush.h +++ b/source/blender/blenkernel/BKE_brush.h @@@ -45,30 -45,14 +45,23 @@@ void BKE_brush_system_init(void) void BKE_brush_system_exit(void); /* datablock functions */ - void BKE_brush_init(struct Brush *brush); struct Brush *BKE_brush_add(struct Main *bmain, const char *name, const eObjectMode ob_mode); -struct Brush *BKE_brush_add_gpencil(struct Main *bmain, struct ToolSettings *ts, const char *name); +struct Brush *BKE_brush_add_gpencil(struct Main *bmain, + struct ToolSettings *ts, + const char *name, + eObjectMode mode); +bool BKE_brush_delete(struct Main *bmain, struct Brush *brush); void BKE_brush_init_gpencil_settings(struct Brush *brush); struct Brush *BKE_brush_first_search(struct Main *bmain, const eObjectMode ob_mode); - void BKE_brush_copy_data(struct Main *bmain, - struct Brush *brush_dst, - const struct Brush *brush_src, - const int flag); struct Brush *BKE_brush_copy(struct Main *bmain, const struct Brush *brush); - void BKE_brush_make_local(struct Main *bmain, struct Brush *brush, const int flags); - void BKE_brush_free(struct Brush *brush); void BKE_brush_sculpt_reset(struct Brush *brush); -void BKE_brush_gpencil_presets(struct Main *bmain, struct ToolSettings *ts); + +void BKE_brush_gpencil_paint_presets(struct Main *bmain, struct ToolSettings *ts); +void BKE_brush_gpencil_vertex_presets(struct Main *bmain, struct ToolSettings *ts); +void BKE_brush_gpencil_sculpt_presets(struct Main *bmain, struct ToolSettings *ts); +void BKE_brush_gpencil_weight_presets(struct Main *bmain, struct ToolSettings *ts); +void BKE_gpencil_brush_preset_set(struct Main *bmain, struct Brush *brush, const short type); /* image icon function */ struct ImBuf *get_brush_icon(struct Brush *brush); diff --cc source/blender/editors/gpencil/gpencil_fill.c index 8aa186957fe,d76ab85ad31..a30c57e2ea9 --- a/source/blender/editors/gpencil/gpencil_fill.c +++ b/source/blender/editors/gpencil/gpencil_fill.c @@@ -1488,16 -1426,18 +1493,17 @@@ static int gpencil_fill_modal(bContext break; case LEFTMOUSE: tgpf->on_back = RNA_boolean_get(op->ptr, "on_back"); - /* first time the event is not enabled to show help lines */ + /* first time the event is not enabled to show help lines. */ if ((tgpf->oldkey != -1) || ((tgpf->flag & GP_BRUSH_FILL_SHOW_HELPLINES) == 0)) { - ARegion *ar = BKE_area_find_region_xy(CTX_wm_area(C), RGN_TYPE_ANY, event->x, event->y); - if (ar) { + ARegion *region = BKE_area_find_region_xy( + CTX_wm_area(C), RGN_TYPE_ANY, event->x, event->y); + if (region) { bool in_bounds = false; /* Perform bounds check */ - in_bounds = BLI_rcti_isect_pt(&ar->winrct, event->x, event->y); + in_bounds = BLI_rcti_isect_pt(®ion->winrct, event->x, event->y); - if ((in_bounds) && (region->regiontype == RGN_TYPE_WINDOW)) { - /* TODO GPXX: Verify the mouse click is right for any window size */ + if ((in_bounds) && (ar->regiontype == RGN_TYPE_WINDOW)) { tgpf->center[0] = event->mval[0]; tgpf->center[1] = event->mval[1]; @@@ -1538,15 -1473,6 +1544,15 @@@ BLI_stack_free(tgpf->stack); } + /* Free memory. */ + MEM_SAFE_FREE(tgpf->sbuffer); + MEM_SAFE_FREE(tgpf->depth_arr); + + /* restore size */ - tgpf->ar->winx = (short)tgpf->bwinx; - tgpf->ar->winy = (short)tgpf->bwiny; - tgpf->ar->winrct = tgpf->brect; ++ tgpf->region->winx = (short)tgpf->bwinx; ++ tgpf->region->winy = (short)tgpf->bwiny; ++ tgpf->region->winrct = tgpf->brect; + /* push undo data */ gpencil_undo_push(tgpf->gpd); diff --cc source/blender/editors/gpencil/gpencil_interpolate.c index d27fa3c95a9,940fb85f91a..bd00a492035 --- a/source/blender/editors/gpencil/gpencil_interpolate.c +++ b/source/blender/editors/gpencil/gpencil_interpolate.c @@@ -442,10 -455,9 +442,10 @@@ static bool gp_interpolate_set_init_val bGPdata *gpd = CTX_data_gpencil_data(C); /* set current scene and window */ + tgpi->depsgraph = CTX_data_ensure_evaluated_depsgraph(C); tgpi->scene = CTX_data_scene(C); tgpi->sa = CTX_wm_area(C); - tgpi->ar = CTX_wm_region(C); + tgpi->region = CTX_wm_region(C); tgpi->flag = ts->gp_interpolate.flag; /* set current frame number */ diff --cc source/blender/editors/gpencil/gpencil_paint.c index e4f2b4967d9,afc0e66a8a6..d1be33b973d --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@@ -819,10 -959,13 +820,10 @@@ static short gp_stroke_addpoint(tGPsdat ED_gp_project_point_to_plane(p->scene, obact, rv3d, origin, p->lock_axis - 1, &spt); /* reproject previous */ - ED_gpencil_tpoint_to_point(p->ar, origin, ptb, &spt2); + ED_gpencil_tpoint_to_point(p->region, origin, ptb, &spt2); ED_gp_project_point_to_plane(p->scene, obact, rv3d, origin, p->lock_axis - 1, &spt2); - p->totpixlen += len_v3v3(&spt.x, &spt2.x) / pixsize; + p->totpixlen += len_v3v3(&spt.x, &spt2.x); pt->uv_fac = p->totpixlen; - if ((gp_style) && (gp_style->sima)) { - pt->uv_fac /= gp_style->sima->gen_x; - } } else { p->totpixlen = 0.0f; @@@ -1248,9 -1540,9 +1249,9 @@@ static bool gp_stroke_eraser_is_occlude float diff_mat[4][4]; /* calculate difference matrix if parent object */ - ED_gpencil_parent_location(p->depsgraph, obact, p->gpd, gpl, diff_mat); + BKE_gpencil_parent_matrix_get(p->depsgraph, obact, gpl, diff_mat); - if (ED_view3d_autodist_simple(p->ar, mval_i, mval_3d, 0, NULL)) { + if (ED_view3d_autodist_simple(p->region, mval_i, mval_3d, 0, NULL)) { const float depth_mval = view3d_point_depth(rv3d, mval_3d); mul_v3_m4v3(fpt, diff_mat, &pt->x); diff --cc source/blender/editors/gpencil/gpencil_primitive.c index 414982560c8,3ec14ee43b9..a990faf8cfe --- a/source/blender/editors/gpencil/gpencil_primitive.c +++ b/source/blender/editors/gpencil/gpencil_primitive.c @@@ -953,19 -980,21 +953,19 @@@ static void gp_primitive_update_strokes /* get origin to reproject point */ float origin[3]; - ED_gp_get_drawing_reference(tgpi->scene, tgpi->ob, tgpi->gpl, ts->gpencil_v3d_align, origin); + ED_gpencil_drawing_reference_get( + tgpi->scene, tgpi->ob, tgpi->gpl, ts->gpencil_v3d_align, origin); /* reproject current */ - ED_gpencil_tpoint_to_point(tgpi->ar, origin, tpt, &spt); + ED_gpencil_tpoint_to_point(tgpi->region, origin, tpt, &spt); ED_gp_project_point_to_plane( tgpi->scene, tgpi->ob, tgpi->rv3d, origin, tgpi->lock_axis - 1, &spt); /* reproject previous */ - ED_gpencil_tpoint_to_point(tgpi->ar, origin, tptb, &spt2); + ED_gpencil_tpoint_to_point(tgpi->region, origin, tptb, &spt2); ED_gp_project_point_to_plane( tgpi->scene, tgpi->ob, tgpi->rv3d, origin, tgpi->lock_axis - 1, &spt2); - tgpi->totpixlen += len_v3v3(&spt.x, &spt2.x) / pixsize; + tgpi->totpixlen += len_v3v3(&spt.x, &spt2.x); tpt->uv_fac = tgpi->totpixlen; - if ((gp_style) && (gp_style->sima)) { - tpt->uv_fac /= gp_style->sima->gen_x; - } } else { tgpi->totpixlen = 0.0f; @@@ -1134,14 -1162,13 +1139,14 @@@ static void gpencil_primitive_init(bCon /* set current scene and window info */ tgpi->bmain = CTX_data_main(C); + tgpi->depsgraph = CTX_data_ensure_evaluated_depsgraph(C); tgpi->scene = scene; tgpi->ob = CTX_data_active_object(C); + tgpi->ob_eval = (Object *)DEG_get_evaluated_object(tgpi->depsgraph, tgpi->ob); tgpi->sa = CTX_wm_area(C); - tgpi->ar = CTX_wm_region(C); - tgpi->rv3d = tgpi->ar->regiondata; + tgpi->region = CTX_wm_region(C); + tgpi->rv3d = tgpi->region->regiondata; tgpi->v3d = tgpi->sa->spacedata.first; - tgpi->depsgraph = CTX_data_ensure_evaluated_depsgraph(C); tgpi->win = CTX_wm_window(C); /* save original type */ diff --cc source/blender/editors/gpencil/gpencil_sculpt_paint.c index a74c4eafe85,14354ff38f4..80ddeaf3f14 --- a/source/blender/editors/gpencil/gpencil_sculpt_paint.c +++ b/source/blender/editors/gpencil/gpencil_sculpt_paint.c @@@ -634,26 -658,35 +634,26 @@@ static bool gp_brush_push_apply(tGP_Bru /* Compute reference midpoint for the brush - this is what we'll be moving towards */ static void gp_brush_calc_midpoint(tGP_BrushEditData *gso) { - if (gso->sa->spacetype == SPACE_VIEW3D) { - /* Convert mouse position to 3D space - * See: gpencil_paint.c :: gp_stroke_convertcoords() - */ - RegionView3D *rv3d = gso->region->regiondata; - const float *rvec = gso->object->loc; - float zfac = ED_view3d_calc_zfac(rv3d, rvec, NULL); + /* Convert mouse position to 3D space + * See: gpencil_paint.c :: gp_stroke_convertcoords() + */ + RegionView3D *rv3d = gso->ar->regiondata; + const float *rvec = gso->object->loc; + float zfac = ED_view3d_calc_zfac(rv3d, rvec, NULL); - float mval_f[2]; - copy_v2_v2(mval_f, gso->mval); - float mval_prj[2]; - float dvec[3]; + float mval_f[2]; + copy_v2_v2(mval_f, gso->mval); + float mval_prj[2]; + float dvec[3]; - if (ED_view3d_project_float_global(gso->region, rvec, mval_prj, V3D_PROJ_TEST_NOP) == - V3D_PROJ_RET_OK) { - sub_v2_v2v2(mval_f, mval_prj, mval_f); - ED_view3d_win_to_delta(gso->region, mval_f, dvec, zfac); - sub_v3_v3v3(gso->dvec, rvec, dvec); - } - else { - zero_v3(gso->dvec); - } + if (ED_view3d_project_float_global(gso->ar, rvec, mval_prj, V3D_PROJ_TEST_NOP) == + V3D_PROJ_RET_OK) { + sub_v2_v2v2(mval_f, mval_prj, mval_f); @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs