FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix is3D/set3D mixup, add getVertexCount() warning · processing/processing@2726a60 · GitHub

Repository navigation

Commit 2726a60

Browse files
committed
fix is3D/set3D mixup, add getVertexCount() warning
1 parent e574a1e commit 2726a60

6 files changed

Lines changed: 30 additions & 9 deletions

File tree

‎build/shared/revisions.txt‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ and incorporating various pull requests.
66

77
[ changes ]
88

9-
+ Removed the sound library, it's now available as its own library
9+
+ Removed the sound library. It's now available as its own library
1010
from the Library Manager.
1111

1212
+ Change how languages are loaded, adding a local override.
1313

14-
+ Update to use JRE/JDK 7u72 .
14+
+ Update to use JRE/JDK 7u72
1515

1616
+ Implement the active() method for Serial and Server
1717
https://github.com/processing/processing/issues/2364
@@ -34,6 +34,10 @@ and incorporating various pull requests.
3434

3535
+ Support "header" option with ODS files
3636

37+
+ Show a warning when calling getVertexCount() on GROUP or PRIMITIVE shapes
38+
https://github.com/processing/processing/issues/2873
39+
https://github.com/processing/processing-docs/issues/167
40+
3741

3842
[ bug fixes ]
3943

@@ -152,6 +156,10 @@ and incorporating various pull requests.
152156
https://github.com/processing/processing/issues/2576
153157
https://github.com/processing/processing/pull/2922
154158

159+
+ 'return' keyword not treated as such when followed by a bracket
160+
https://github.com/processing/processing/issues/2099
161+
https://github.com/processing/processing/pull/2958
162+
155163

156164
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
157165

‎core/src/processing/core/PGraphicsJava2D.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ static protected PShape createShapeImpl(PGraphicsJava2D pg, int type) {
513513
} else if (type == PShape.GEOMETRY) {
514514
shape = new PShape(pg, PShape.GEOMETRY);
515515
}
516-
shape.is3D(false);
516+
shape.set3D(false);
517517
return shape;
518518
}
519519

@@ -584,7 +584,7 @@ static protected PShape createShapeImpl(PGraphicsJava2D pg,
584584
shape.setParams(p);
585585
}
586586

587-
shape.is3D(false);
587+
shape.set3D(false);
588588
return shape;
589589
}
590590

‎core/src/processing/core/PShape.java‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ public class PShape implements PConstants {
112112
public static final String NO_SUCH_VERTEX_ERROR =
113113
"%1$s vertex index does not exist";
114114

115+
static public final String NO_VERTICES_ERROR =
116+
"getVertexCount() only works with PATH or GEOMETRY shapes";
117+
115118
// boundary box of this shape
116119
//protected float x;
117120
//protected float y;
@@ -539,7 +542,7 @@ public boolean is3D() {
539542
}
540543

541544

542-
public void is3D(boolean val) {
545+
public void set3D(boolean val) {
543546
is3D = val;
544547
}
545548

@@ -2051,6 +2054,9 @@ protected void setPath(int vcount, float[][] verts, int ccount, int[] codes) {
20512054
* @see PShape#setVertex(int, float, float)
20522055
*/
20532056
public int getVertexCount() {
2057+
if (family == GROUP || family == PRIMITIVE) {
2058+
PGraphics.showWarning(NO_VERTICES_ERROR);
2059+
}
20542060
return vertexCount;
20552061
}
20562062

@@ -2100,6 +2106,7 @@ public float getVertexZ(int index) {
21002106
return vertices[index][Z];
21012107
}
21022108

2109+
21032110
/**
21042111
* @webref pshape:method
21052112
* @brief Sets the vertex at the index position
@@ -2119,6 +2126,7 @@ public void setVertex(int index, float x, float y) {
21192126
vertices[index][Y] = y;
21202127
}
21212128

2129+
21222130
/**
21232131
* @param z the z value for the vertex
21242132
*/
@@ -2133,6 +2141,7 @@ public void setVertex(int index, float x, float y, float z) {
21332141
vertices[index][Z] = z;
21342142
}
21352143

2144+
21362145
/**
21372146
* @param vec the PVector to define the x, y, z coordinates
21382147
*/

‎core/src/processing/opengl/PGraphics2D.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ static protected PShapeOpenGL createShapeImpl(PGraphicsOpenGL pg, int type) {
308308
} else if (type == PShape.GEOMETRY) {
309309
shape = new PShapeOpenGL(pg, PShape.GEOMETRY);
310310
}
311-
shape.is3D(false);
311+
shape.set3D(false);
312312
return shape;
313313
}
314314

@@ -379,7 +379,7 @@ static protected PShapeOpenGL createShapeImpl(PGraphicsOpenGL pg,
379379
shape.setParams(p);
380380
}
381381

382-
shape.is3D(false);
382+
shape.set3D(false);
383383
return shape;
384384
}
385385

‎core/src/processing/opengl/PGraphics3D.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ static protected PShapeOpenGL createShapeImpl(PGraphicsOpenGL pg, int type) {
191191
} else if (type == PShape.GEOMETRY) {
192192
shape = new PShapeOpenGL(pg, PShape.GEOMETRY);
193193
}
194-
shape.is3D(true);
194+
shape.set3D(true);
195195
return shape;
196196
}
197197

@@ -272,7 +272,7 @@ static protected PShapeOpenGL createShapeImpl(PGraphicsOpenGL pg,
272272
shape.setParams(p);
273273
}
274274

275-
shape.is3D(true);
275+
shape.set3D(true);
276276
return shape;
277277
}
278278
}

‎core/todo.txt‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
0232 core (3.0a5)
22
X detect CMYK JPEG images and return null
33
X https://community.oracle.com/thread/1272045?start=0&tstart=0
4+
X show a warning when calling getVertexCount() on GROUP or PRIMITIVE shapes
5+
X https://github.com/processing/processing/issues/2873
6+
X https://github.com/processing/processing-docs/issues/167
7+
X replace is3D(boolean) with set3D()
48

59
data
610
X fix XML.getString() with a default when no attrs are present at all

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL