Commit: dfc56f1776cc0fffbafb6515353194c5b56fc91f
Author: Joshua Leung
Date:   Tue Dec 2 01:03:10 2014 +1300
Branches: master
https://developer.blender.org/rBdfc56f1776cc0fffbafb6515353194c5b56fc91f

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.

===================================================================

M       source/blender/editors/gpencil/drawgpencil.c

===================================================================

diff --git a/source/blender/editors/gpencil/drawgpencil.c 
b/source/blender/editors/gpencil/drawgpencil.c
index 84d4cb8..199d870 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);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to