[Bf-blender-cvs] [49052c6] master: Restoring all the whitespace!
Joshua Leung
noreply at git.blender.org
Sat Dec 27 15:06:31 CET 2014
Commit: 49052c61f8326c11bc733a040372481ea1d7438b
Author: Joshua Leung
Date: Sat Dec 27 12:09:29 2014 +1300
Branches: master
https://developer.blender.org/rB49052c61f8326c11bc733a040372481ea1d7438b
Restoring all the whitespace!
===================================================================
M source/blender/editors/gpencil/drawgpencil.c
M source/blender/editors/gpencil/editaction_gpencil.c
M source/blender/editors/gpencil/gpencil_edit.c
M source/blender/editors/gpencil/gpencil_ops.c
M source/blender/editors/gpencil/gpencil_paint.c
M source/blender/editors/gpencil/gpencil_select.c
M source/blender/editors/gpencil/gpencil_undo.c
===================================================================
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index 174e7b6..f7795a3 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -93,15 +93,15 @@ static void gp_draw_stroke_buffer(tGPspoint *points, int totpoints, short thickn
{
tGPspoint *pt;
int i;
-
+
/* error checking */
if ((points == NULL) || (totpoints <= 0))
return;
-
+
/* check if buffer can be drawn */
if (dflag & (GP_DRAWDATA_ONLY3D | GP_DRAWDATA_ONLYV2D))
return;
-
+
/* if drawing a single point, draw it larger */
if (totpoints == 1) {
/* draw point */
@@ -114,13 +114,13 @@ static void gp_draw_stroke_buffer(tGPspoint *points, int totpoints, short thickn
}
else {
float oldpressure = points[0].pressure;
-
+
/* draw stroke curve */
if (G.debug & G_DEBUG) setlinestyle(2);
-
+
glLineWidth(oldpressure * thickness);
glBegin(GL_LINE_STRIP);
-
+
for (i = 0, pt = points; i < totpoints && pt; i++, pt++) {
/* if there was a significant pressure change, stop the curve, change the thickness of the stroke,
* and continue drawing again (since line-width cannot change in middle of GL_LINE_STRIP)
@@ -129,20 +129,20 @@ static void gp_draw_stroke_buffer(tGPspoint *points, int totpoints, short thickn
glEnd();
glLineWidth(pt->pressure * thickness);
glBegin(GL_LINE_STRIP);
-
+
/* need to roll-back one point to ensure that there are no gaps in the stroke */
if (i != 0) glVertex2iv(&(pt - 1)->x);
-
+
/* now the point we want... */
glVertex2iv(&pt->x);
-
+
oldpressure = pt->pressure;
}
else
glVertex2iv(&pt->x);
}
glEnd();
-
+
/* reset for predictable OpenGL context */
glLineWidth(1.0f);
@@ -162,14 +162,14 @@ static void gp_calc_2d_stroke_xy(bGPDspoint *pt, short sflag, int offsx, int off
else if (sflag & GP_STROKE_2DIMAGE) {
const float x = (float)((pt->x * winx) + offsx);
const float y = (float)((pt->y * winy) + offsy);
-
+
r_co[0] = x;
r_co[1] = y;
}
else {
const float x = (float)(pt->x / 100 * winx) + offsx;
const float y = (float)(pt->y / 100 * winy) + offsy;
-
+
r_co[0] = x;
r_co[1] = y;
}
@@ -185,36 +185,36 @@ static void gp_draw_stroke_volumetric_buffer(tGPspoint *points, int totpoints, s
{
GLUquadricObj *qobj = gluNewQuadric();
float modelview[4][4];
-
+
tGPspoint *pt;
int i;
-
+
/* error checking */
if ((points == NULL) || (totpoints <= 0))
return;
-
+
/* check if buffer can be drawn */
if (dflag & (GP_DRAWDATA_ONLY3D | GP_DRAWDATA_ONLYV2D))
return;
-
+
/* get basic matrix - should be camera space (i.e "identity") */
glGetFloatv(GL_MODELVIEW_MATRIX, (float *)modelview);
-
+
/* draw points */
glPushMatrix();
-
+
for (i = 0, pt = points; i < totpoints; i++, pt++) {
/* set the transformed position */
// TODO: scale should change based on zoom level, which requires proper translation mult too!
modelview[3][0] = pt->x;
modelview[3][1] = pt->y;
-
+
glLoadMatrixf((float *)modelview);
-
+
/* draw the disk using the current state... */
gluDisk(qobj, 0.0, pt->pressure * thickness, 32, 1);
-
-
+
+
modelview[3][0] = modelview[3][1] = 0.0f;
}
@@ -231,10 +231,10 @@ static void gp_draw_stroke_volumetric_2d(bGPDspoint *points, int totpoints, shor
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
@@ -243,30 +243,30 @@ static void gp_draw_stroke_volumetric_2d(bGPDspoint *points, int totpoints, shor
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]);
-
+
/* draw points */
glPushMatrix();
-
+
for (i = 0, pt = points; i < totpoints; i++, pt++) {
/* set the transformed position */
float co[2];
-
+
gp_calc_2d_stroke_xy(pt, sflag, offsx, offsy, winx, winy, co);
translate_m4(modelview, co[0], co[1], 0.0f);
-
+
glLoadMatrixf((float *)modelview);
-
+
/* draw the disk using the current state... */
gluDisk(qobj, 0.0, pt->pressure * thickness * scalefac, 32, 1);
-
+
/* restore matrix */
copy_v3_v3(modelview[3], baseloc);
}
-
+
glPopMatrix();
gluDeleteQuadric(qobj);
}
@@ -276,18 +276,18 @@ static void gp_draw_stroke_volumetric_3d(bGPDspoint *points, int totpoints, shor
short UNUSED(dflag), short UNUSED(sflag))
{
GLUquadricObj *qobj = gluNewQuadric();
-
+
float base_modelview[4][4], modelview[4][4];
float base_loc[3];
-
+
bGPDspoint *pt;
int i;
-
+
/* Get the basic modelview matrix we use for performing calculations */
glGetFloatv(GL_MODELVIEW_MATRIX, (float *)base_modelview);
copy_v3_v3(base_loc, base_modelview[3]);
-
+
/* Create the basic view-aligned billboard matrix we're going to actually draw qobj with:
* - We need to knock out the rotation so that we are
* simply left with a camera-facing billboard
@@ -296,28 +296,28 @@ static void gp_draw_stroke_volumetric_3d(bGPDspoint *points, int totpoints, shor
* large!
*/
scale_m4_fl(modelview, 0.1f);
-
+
/* draw each point as a disk... */
glPushMatrix();
-
+
for (i = 0, pt = points; i < totpoints && pt; i++, pt++) {
/* apply translation to base_modelview, so that the translated point is put in the right place */
translate_m4(base_modelview, pt->x, pt->y, pt->z);
-
+
/* copy the translation component to the billboard matrix we're going to use,
* then reset the base matrix to the original values so that we can do the same
* for the next point without accumulation/pollution effects
*/
copy_v3_v3(modelview[3], base_modelview[3]); /* copy offset value */
copy_v3_v3(base_modelview[3], base_loc); /* restore */
-
+
/* apply our billboard matrix for drawing... */
glLoadMatrixf((float *)modelview);
-
+
/* draw the disk using the current state... */
gluDisk(qobj, 0.0, pt->pressure * thickness, 32, 1);
}
-
+
glPopMatrix();
gluDeleteQuadric(qobj);
}
@@ -332,28 +332,28 @@ static void gp_draw_stroke_fill(bGPDspoint *points, int totpoints, short UNUSED(
{
bGPDspoint *pt;
int i;
-
+
BLI_assert(totpoints >= 3);
-
+
/* As an initial implementation, we use the OpenGL filled polygon drawing
* here since it's the easiest option to implement for this case. It does
* come with limitations (notably for concave shapes), though it shouldn't
* be much of an issue in most cases.
*/
glBegin(GL_POLYGON);
-
+
for (i = 0, pt = points; i < totpoints; i++, pt++) {
if (sflag & GP_STROKE_3DSPACE) {
glVertex3fv(&pt->x);
}
else {
float co[2];
-
+
gp_calc_2d_stroke_xy(pt, sflag, offsx, offsy, winx, winy, co);
glVertex2fv(co);
}
}
-
+
glEnd();
}
@@ -371,10 +371,10 @@ static void gp_draw_stroke_point(bGPDspoint *points, short thickness, short dfla
}
else {
float co[2];
-
+
/* get coordinates of point */
gp_calc_2d_stroke_xy(points, sflag, offsx, offsy, winx, winy, co);
-
+
/* if thickness is less than GP_DRAWTHICKNESS_SPECIAL, simple dot looks ok
* - also mandatory in if Image Editor 'image-based' dot
*/
@@ -388,14 +388,14 @@ static void gp_draw_stroke_point(bGPDspoint *points, short thickness, short dfla
else {
/* draw filled circle as is done in circf (but without the matrix push/pops which screwed things up) */
GLUquadricObj *qobj = gluNewQuadric();
-
+
gluQuadricDrawStyle(qobj, GLU_FILL);
-
+
/* need to translate drawing position, but must reset after too! */
glTranslatef(co[0], co[1], 0.0);
gluDisk(qobj, 0.0, thickness, 32, 1);
glTranslatef(-co[0], -co[1], 0.0);
-
+
gluDeleteQuadric(qobj);
}
}
@@ -407,7 +407,7 @@ static void gp_draw_stroke_3d(bGPDspoint *points, int totpoints, short thickness
bGPDspoint *pt;
float curpressure = points[0].pressure;
int i;
-
+
/* draw stroke curve */
glLineWidth(curpressure * thickness);
glBegin(GL_LINE_STRIP);
@@ -421,10 +421,10 @@ static void gp_draw_stroke_3d(bGPDspoint *points, int totpoints, short thickness
curpressure = pt->pressure;
glLineWidth(curpressure * thickness);
glBegin(GL_LINE_STRIP);
-
+
/* need to roll-back one point to ensure that there are no gaps in the stroke */
if (i != 0) glVertex3fv(&(pt - 1)->x);
-
+
/* now the point we want... */
glVertex3fv(&pt->x);
}
@@ -452,13 +452,13 @@ static void gp_draw_stroke_2d(bGPDspoint *points, int totpoints, short thickness
{
/* otherwise thickness is twice that of the 3D view */
float thickness = (float)thickness_s * 0.5f;
-
+
/* strokes in Image Editor need a scale factor, since units there are not pixels! */
float scalefac = 1.0f;
if ((dflag & GP_DRAWDATA_IEDITHACK) && (dflag & GP_DRAWDATA_ONLYV2D)) {
scalefac = 0.001f;
}
-
+
/* tessellation code - draw stroke as series of connected quads with connection
* edges rotated to minimize shrinking artifacts, and rounded endcaps
*/
@@ -466,31 +466,31 @@ static void gp_draw_stroke_2d(bGPDspoint *points, int totpoints, short thickness
bGPDspoint *pt1, *pt2;
float pm[2];
int i;
-
+
glShadeModel(GL_FLAT);
glBegin(GL_QUADS);
-
+
for (i = 0, pt1 = points, pt2 = points + 1; i < (totpoints - 1); i++, pt1++, pt2++) {
float s0[2], s1[2]; /* segment 'center' points */
float t0[2], t1[2]; /* tessellated coordinates */
float m1[2], m2[2]; /* gradient and normal */
float mt[2], sc[2]; /* gradient for thickness, point for end-cap */
float pthick; /* thickness at segment point */
-
+
/* get x and y coordinates from points */
gp_calc_2d_stroke_xy(pt1, sflag, offsx, offsy, winx, winy, s0);
gp_calc_2d_stroke_xy(pt2, sflag, offsx, offsy, winx, winy, s1);
-
+
/* calculate gradient and normal - 'angle'=(ny/nx) */
m1[1] = s1[1] - s0[1];
m1[0] = s1[0] - s0[0];
n
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list