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:
authorJoshua Leung <aligorith@gmail.com>2014-12-01 15:03:10 +0300
committerJoshua Leung <aligorith@gmail.com>2014-12-01 15:19:48 +0300
commitdfc56f1776cc0fffbafb6515353194c5b56fc91f (patch)
tree1ab65d85994bc1770ede6c90d847f7775b423988 /source/blender/editors/gpencil/drawgpencil.c
parent965a49a3e693112bd812c27711e0de1d07a52e57 (diff)
Fix: Volumetric strokes now draw correctly in the Image Editor
This needed a correction factor (currently hardcoded to be 1 / 1000) as it seems that the image editor uses 1 unit as its MAXIMUM dimension whereas everything else uses 1 unit = 1 pixel.
Diffstat (limited to 'source/blender/editors/gpencil/drawgpencil.c')
-rw-r--r--source/blender/editors/gpencil/drawgpencil.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index 84d4cb8806e..199d8701b9a 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -223,17 +223,26 @@ static void gp_draw_stroke_volumetric_buffer(tGPspoint *points, int totpoints, s
/* draw a 2D strokes in "volumetric" style */
static void gp_draw_stroke_volumetric_2d(bGPDspoint *points, int totpoints, short thickness,
- short UNUSED(dflag), short sflag,
+ short dflag, short sflag,
int offsx, int offsy, int winx, int winy)
{
GLUquadricObj *qobj = gluNewQuadric();
float modelview[4][4];
float baseloc[3];
+ float scalefac = 1.0f;
bGPDspoint *pt;
int i;
+ /* HACK: We need a scale factor for the drawing in the image editor,
+ * which seems to use 1 unit as it's maximum size, whereas everything
+ * else assumes 1 unit = 1 pixel. Otherwise, we only get a massive blob.
+ */
+ if ((dflag & GP_DRAWDATA_IEDITHACK) && (dflag & GP_DRAWDATA_ONLYV2D)) {
+ scalefac = 0.001f;
+ }
+
/* get basic matrix */
glGetFloatv(GL_MODELVIEW_MATRIX, (float *)modelview);
copy_v3_v3(baseloc, modelview[3]);
@@ -251,7 +260,7 @@ static void gp_draw_stroke_volumetric_2d(bGPDspoint *points, int totpoints, shor
glLoadMatrixf((float *)modelview);
/* draw the disk using the current state... */
- gluDisk(qobj, 0.0, pt->pressure * thickness, 32, 1);
+ gluDisk(qobj, 0.0, pt->pressure * thickness * scalefac, 32, 1);
/* restore matrix */
copy_v3_v3(modelview[3], baseloc);