Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonioya <blendergit@gmail.com>2018-12-19 19:07:12 +0300
committerAntonioya <blendergit@gmail.com>2018-12-19 19:09:30 +0300
commit1fc75dbbceead7316095089ef15551a1d4fdd11f (patch)
treeebbd0eaf900269eb0b161df52c04a0c581195071 /source/blender/editors/gpencil/gpencil_fill.c
parentd9ac4653e70cace968d5a2d3acca894e4168b056 (diff)
Fix T59595: Grease Pencil and CameraView
The perspective effect deformed the stroke. Now when you are in camera view and the lock axis is not enabled, the stroke is reprojected flat over the view to remove any deformation. Also fixed reproject operator to use the origin set in topbar and not cursor 3D always.
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_fill.c')
-rw-r--r--source/blender/editors/gpencil/gpencil_fill.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c
index d0b581abaf2..0e1a5e613b2 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -88,6 +88,7 @@
/* Temporary fill operation data (op->customdata) */
typedef struct tGPDfill {
+ bContext *C;
struct Main *bmain;
struct Depsgraph *depsgraph;
struct wmWindow *win; /* window where painting originated */
@@ -819,6 +820,7 @@ static void gpencil_stroke_from_buffer(tGPDfill *tgpf)
const int cfra_eval = (int)DEG_get_ctime(tgpf->depsgraph);
ToolSettings *ts = tgpf->scene->toolsettings;
+ const bool is_camera = (bool)(ts->gp_sculpt.lock_axis == 0) && (tgpf->rv3d->persp == RV3D_CAMOB);
Brush *brush = BKE_paint_brush(&ts->gp_paint->paint);
if (brush == NULL) {
return;
@@ -936,6 +938,11 @@ static void gpencil_stroke_from_buffer(tGPDfill *tgpf)
gp_apply_parent_point(tgpf->depsgraph, tgpf->ob, tgpf->gpd, tgpf->gpl, pt);
}
+ /* if camera view, reproject flat to view to avoid perspective effect */
+ if (is_camera) {
+ ED_gpencil_project_stroke_to_view(tgpf->C, tgpf->gpl, gps);
+ }
+
/* simplify stroke */
for (int b = 0; b < tgpf->fill_simplylvl; b++) {
BKE_gpencil_simplify_fixed(gps);
@@ -1004,6 +1011,7 @@ static tGPDfill *gp_session_init_fill(bContext *C, wmOperator *UNUSED(op))
Main *bmain = CTX_data_main(C);
/* set current scene and window info */
+ tgpf->C = C;
tgpf->bmain = CTX_data_main(C);
tgpf->scene = CTX_data_scene(C);
tgpf->ob = CTX_data_active_object(C);