Commit: 291d253326d12b258dcee38b22afc65328ae43b4
Author: Antonio Vazquez
Date: Thu Aug 31 17:33:14 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rB291d253326d12b258dcee38b22afc65328ae43b4
Fix drawing error when object has been scaled
If the object was scaled, the thickness of the stroke must be scaled while
drawing.
===================================================================
M source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
M source/blender/draw/engines/gpencil/gpencil_engine.c
M source/blender/draw/engines/gpencil/gpencil_engine.h
===================================================================
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
index e0d5b56c2c1..bf202b96f9e 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -778,11 +778,12 @@ static void gpencil_draw_strokes(GpencilBatchCache
*cache, GPENCIL_e_data *e_dat
}
/* draw stroke in drawing buffer */
-void DRW_gpencil_populate_buffer_strokes(void *vedata, ToolSettings *ts,
bGPdata *gpd)
+void DRW_gpencil_populate_buffer_strokes(void *vedata, ToolSettings *ts,
Object *ob)
{
GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
bGPDbrush *brush = BKE_gpencil_brush_getactive(ts);
-
+ bGPdata *gpd = ob->gpd;
+ float obscale = (ob->size[0] + ob->size[1] + ob->size[2]) / 3.0f;
/* drawing strokes */
/* Check if may need to draw the active stroke cache, only if this
layer is the active layer
* that is being edited. (Stroke buffer is currently stored in gp-data)
@@ -793,7 +794,7 @@ void DRW_gpencil_populate_buffer_strokes(void *vedata,
ToolSettings *ts, bGPdata
/* It should also be noted that sbuffer contains
temporary point types
* i.e. tGPspoints NOT bGPDspoints
*/
- short lthick = brush->thickness;
+ short lthick = brush->thickness * obscale;
/* if only one point, don't need to draw buffer because
the user has no time to see it */
if (gpd->sbuffer_size > 1) {
/* use unit matrix because the buffer is in
screen space and does not need conversion */
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c
b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 17fae17e9fb..75bf81a24f7 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -317,7 +317,7 @@ static void GPENCIL_cache_populate(void *vedata, Object *ob)
/* generate duplicated instances using array modifiers */
gpencil_array_modifiers(stl, ob);
/* draw current painting strokes */
- DRW_gpencil_populate_buffer_strokes(vedata, ts, ob->gpd);
+ DRW_gpencil_populate_buffer_strokes(vedata, ts, ob);
}
}
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h
b/source/blender/draw/engines/gpencil/gpencil_engine.h
index 3f60ba9f98c..b025e11ce56 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.h
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.h
@@ -242,7 +242,7 @@ struct DRWShadingGroup
*DRW_gpencil_shgroup_edit_volumetric_create(struct DRWPas
struct DRWShadingGroup *DRW_gpencil_shgroup_drawing_fill_create(struct DRWPass
*pass, struct GPUShader *shader);
void DRW_gpencil_populate_datablock(struct GPENCIL_e_data *e_data, void
*vedata, struct Scene *scene, struct Object *ob, struct ToolSettings *ts,
struct bGPdata *gpd);
-void DRW_gpencil_populate_buffer_strokes(void *vedata, struct ToolSettings
*ts, struct bGPdata *gpd);
+void DRW_gpencil_populate_buffer_strokes(void *vedata, struct ToolSettings
*ts, struct Object *ob);
void DRW_gpencil_populate_multiedit(struct GPENCIL_e_data *e_data, void
*vedata, struct Scene *scene, struct Object *ob, struct ToolSettings *ts,
struct bGPdata *gpd);
struct Gwn_Batch *DRW_gpencil_get_point_geom(struct bGPDstroke *gps, short
thickness, const float ink[4]);
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs