Skip to content

Commit 64bb15b

Browse files
committed
handful of bug fixes and tweaks
1 parent ad4c58f commit 64bb15b

File tree

8 files changed

+48
-36
lines changed

8 files changed

+48
-36
lines changed

core/src/processing/core/PApplet.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5190,7 +5190,7 @@ public PShape createGeometry(String name, int type) {
51905190

51915191
// ???
51925192
// NODE I/O (XML, JSON, etc.)
5193-
public XML loadNode(String filename) {
5193+
public XML loadXML(String filename) {
51945194
return new XML(this, filename);
51955195
}
51965196

core/src/processing/core/PGraphicsJava2D.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,12 +1305,12 @@ public void scale(float sx, float sy, float sz) {
13051305
}
13061306

13071307

1308-
public void skewX(float angle) {
1308+
public void shearX(float angle) {
13091309
g2.shear(Math.tan(angle), 0);
13101310
}
13111311

13121312

1313-
public void skewY(float angle) {
1313+
public void shearY(float angle) {
13141314
g2.shear(0, Math.tan(angle));
13151315
}
13161316

core/src/processing/core/PImage.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3049,18 +3049,22 @@ protected boolean saveImageIO(String path) throws IOException {
30493049
public boolean save(String filename) { // ignore
30503050
boolean success = false;
30513051

3052-
// File file = new File(filename);
3053-
// if (!file.isAbsolute()) {
3054-
// always use savePath(), so that the intermediate directories are created
30553052
if (parent != null) {
3056-
//file = new File(parent.savePath(filename));
3053+
// use savePath(), so that the intermediate directories are created
30573054
filename = parent.savePath(filename);
3055+
30583056
} else {
3059-
String msg = "PImage.save() requires an absolute path. " +
3060-
"Use createImage(), or pass savePath() to save().";
3061-
PGraphics.showException(msg);
3057+
File file = new File(filename);
3058+
if (file.isAbsolute()) {
3059+
// make sure that the intermediate folders have been created
3060+
PApplet.createPath(file);
3061+
} else {
3062+
String msg =
3063+
"PImage.save() requires an absolute path. " +
3064+
"Use createImage(), or pass savePath() to save().";
3065+
PGraphics.showException(msg);
3066+
}
30623067
}
3063-
// }
30643068

30653069
// Make sure the pixel data is ready to go
30663070
loadPixels();

core/src/processing/core/PShapeSVG.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public class PShapeSVG extends PShape {
163163
public PShapeSVG(PApplet parent, String filename) {
164164
// this will grab the root document, starting <svg ...>
165165
// the xml version and initial comments are ignored
166-
this(parent.loadNode(filename));
166+
this(parent.loadXML(filename));
167167
}
168168

169169

core/todo.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
0200 core
22
X remove textMode(SCREEN)
33
X added expand(long) and expand(double) because of Table
4+
X PImage.save() with full path raises exception
5+
X http://code.google.com/p/processing/issues/detail?id=808
46

57
_ change how beginRecord() works.. passing around PApplet vs PGraphics is gross
68
_ have to pass PApplet just to make the rendering work to both renderers
@@ -11,12 +13,10 @@ _ for more options, just integrate the fs library?
1113
_ http://www.superduper.org/processing/fullscreen_api/
1214
_ https://github.com/kritzikratzi/jAppleMenuBar/blob/master/src/native/jAppleMenuBar.m
1315

14-
_ update wiki re: PNode... also include notes about the changes
16+
X update wiki re: PNode... also include notes about the changes
1517
_ add note about textMode(SCREEN) to the wiki
1618
SCREEN was a super fast/efficient way of rendering text with P2D and P3D, but since they're going bye-bye and it's actually slower in the remaining renderers, it's going away.
1719

18-
_ PImage.save() with full path raises exception
19-
_ http://code.google.com/p/processing/issues/detail?id=808
2020
_ if save() returns boolean, does saveFrame()?
2121
_ also need to copy this over to android
2222

java/libraries/opengl/src/processing/opengl/PGraphicsOpenGL.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1878,8 +1878,8 @@ protected void vertexTexture(float u, float v, int t) {
18781878
"using u and v coordinates with vertex()");
18791879
}
18801880
if (textureMode == IMAGE) {
1881-
u /= (float) img.width;
1882-
v /= (float) img.height;
1881+
u /= img.width;
1882+
v /= img.height;
18831883
}
18841884

18851885
texturesU[t] = u;

java/libraries/opengl/src/processing/opengl/PShape3D.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2111,7 +2111,7 @@ public void setColor(int idx, float[] c) {
21112111

21122112

21132113
protected void setColorImpl(float[] c) {
2114-
PShape3D p = (PShape3D)root;
2114+
PShape3D p = root;
21152115
p.loadColors();
21162116
for (int i = firstVertex; i <= lastVertex; i++) {
21172117
p.set(i, c);
@@ -2150,7 +2150,7 @@ public void setNormal(int idx, float[] n) {
21502150

21512151

21522152
protected void setNormalImpl(float[] n) {
2153-
PShape3D p = (PShape3D)root;
2153+
PShape3D p = root;
21542154
p.loadNormals();
21552155
for (int i = firstVertex; i <= lastVertex; i++) {
21562156
p.set(i, n);
@@ -2166,9 +2166,9 @@ protected void optimizeChildren(ArrayList<PShape3D> childList) {
21662166
// Expanding identical, contiguous shapes. Names are taken into account (two
21672167
// shapes with different names are considered to be different, even though the
21682168
// rest of their parameters are identical).
2169-
child0 = (PShape3D)childList.get(0);
2169+
child0 = childList.get(0);
21702170
for (int i = 1; i < childList.size(); i++) {
2171-
child1 = (PShape3D)childList.get(i);
2171+
child1 = childList.get(i);
21722172
if (child0.equalTo(child1, false)) {
21732173
child0.lastVertex = child1.lastVertex; // Extending child0.
21742174
child0.lastIndex = child1.lastIndex;
@@ -2184,16 +2184,16 @@ protected void optimizeChildren(ArrayList<PShape3D> childList) {
21842184

21852185
// Deleting superfluous shapes.
21862186
for (int i = childList.size() - 1; i >= 0; i--) {
2187-
if (((PShape3D)childList.get(i)).lastVertex == -1) {
2187+
if (childList.get(i).lastVertex == -1) {
21882188
childList.remove(i);
21892189
}
21902190
}
21912191

21922192
// Making sure the names are unique.
21932193
for (int i = 1; i < childList.size(); i++) {
2194-
child1 = (PShape3D)childList.get(i);
2194+
child1 = childList.get(i);
21952195
for (int j = i - 1; j >= 0; j--) {
2196-
child0 = (PShape3D)childList.get(j);
2196+
child0 = childList.get(j);
21972197
if (child1.name.equals(child0.name)) {
21982198
int pos = child0.name.indexOf(':');
21992199
if (-1 < pos) {
@@ -2288,7 +2288,7 @@ public void setVertices(ArrayList<PVector> vertexList) {
22882288
public void setVertices(ArrayList<PVector> vertexList, int offset) {
22892289
loadVertices();
22902290
for (int i = firstVertex; i <= lastVertex; i++) {
2291-
PVector v = (PVector)vertexList.get(i - firstVertex + offset);
2291+
PVector v = vertexList.get(i - firstVertex + offset);
22922292
set(i, v.x, v.y, v.z);
22932293
}
22942294
updateVertices();
@@ -2301,7 +2301,7 @@ public void setColors(ArrayList<float[]> colorList) {
23012301
public void setColors(ArrayList<float[]> colorList, int offset) {
23022302
loadColors();
23032303
for (int i = firstVertex; i <= lastVertex; i++) {
2304-
float[] c = (float[])colorList.get(i - firstVertex + offset);
2304+
float[] c = colorList.get(i - firstVertex + offset);
23052305
set(i, c);
23062306
}
23072307
updateColors();
@@ -2315,7 +2315,7 @@ public void setNormals(ArrayList<PVector> normalList) {
23152315
public void setNormals(ArrayList<PVector> normalList, int offset) {
23162316
loadNormals();
23172317
for (int i = firstVertex; i <= lastVertex; i++) {
2318-
PVector n = (PVector)normalList.get(i - firstVertex + offset);
2318+
PVector n = normalList.get(i - firstVertex + offset);
23192319
set(i, n.x, n.y, n.z);
23202320
}
23212321
updateNormals();
@@ -2337,7 +2337,7 @@ public void setTexcoords(int unit, ArrayList<PVector> tcoordList) {
23372337
public void setTexcoords(int unit, ArrayList<PVector> tcoordList, int offset) {
23382338
loadTexcoords(unit);
23392339
for (int i = firstVertex; i <= lastVertex; i++) {
2340-
PVector tc = (PVector)tcoordList.get(i - firstVertex + offset);
2340+
PVector tc = tcoordList.get(i - firstVertex + offset);
23412341
set(i, tc.x, tc.y);
23422342
}
23432343
updateTexcoords();
@@ -2349,7 +2349,7 @@ public void setChildren(ArrayList<PShape3D> who) {
23492349

23502350
childCount = 0;
23512351
for (int i = 0; i < who.size(); i++) {
2352-
PShape child = (PShape)who.get(i);
2352+
PShape child = who.get(i);
23532353
addChild(child);
23542354
}
23552355
}
@@ -2599,7 +2599,7 @@ public void setIndices(ArrayList<Integer> recordedIndices) {
25992599
indexBuffer = getGl().glMapBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, GL.GL_WRITE_ONLY).asIntBuffer();
26002600

26012601
for (int i = 0; i < indexCount; i++) {
2602-
indices[i] = (Integer)recordedIndices.get(i);
2602+
indices[i] = recordedIndices.get(i);
26032603
}
26042604
indexBuffer.put(indices);
26052605

@@ -3521,13 +3521,13 @@ protected void recordOBJ(ArrayList<PVector> vertices, ArrayList<PVector> normals
35213521

35223522
ogl.beginShapeRecorderImpl();
35233523
for (int i = 0; i < faces.size(); i++) {
3524-
OBJFace face = (OBJFace) faces.get(i);
3524+
OBJFace face = faces.get(i);
35253525

35263526
// Getting current material.
35273527
if (mtlIdxCur != face.matIdx) {
35283528
mtlIdxCur = PApplet.max(0, face.matIdx); // To make sure that at least we get the default material.
35293529

3530-
mtl = (OBJMaterial) materials.get(mtlIdxCur);
3530+
mtl = materials.get(mtlIdxCur);
35313531

35323532
// Setting colors.
35333533
ogl.specular(mtl.ks.x * 255.0f, mtl.ks.y * 255.0f, mtl.ks.z * 255.0f);
@@ -3561,12 +3561,12 @@ protected void recordOBJ(ArrayList<PVector> vertices, ArrayList<PVector> normals
35613561
vert = norms = null;
35623562

35633563
vertIdx = face.vertIdx.get(j).intValue() - 1;
3564-
vert = (PVector) vertices.get(vertIdx);
3564+
vert = vertices.get(vertIdx);
35653565

35663566
if (j < face.normIdx.size()) {
35673567
normIdx = face.normIdx.get(j).intValue() - 1;
35683568
if (-1 < normIdx) {
3569-
norms = (PVector) normals.get(normIdx);
3569+
norms = normals.get(normIdx);
35703570
}
35713571
}
35723572

@@ -3578,7 +3578,7 @@ protected void recordOBJ(ArrayList<PVector> vertices, ArrayList<PVector> normals
35783578
if (j < face.texIdx.size()) {
35793579
texIdx = face.texIdx.get(j).intValue() - 1;
35803580
if (-1 < texIdx) {
3581-
tex = (PVector) textures.get(texIdx);
3581+
tex = textures.get(texIdx);
35823582
}
35833583
}
35843584

todo.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,22 @@ X update to java 6u26
33
X re-upload with new version to include javac
44
X HTML escapes for < and > not working properly
55
X http://code.google.com/p/processing/issues/detail?id=771
6+
X code to quit if multiple instances are running from peter
7+
X another problem with missing shearX/Y() in JAVA2D
8+
X http://code.google.com/p/processing/issues/detail?id=784
9+
10+
11+
_ work on code to quit if multiple instances are running
12+
_ need to bring the other instance to front
13+
_ and/or open a new window
614

715
_ --bgcolor shouldn't be in main() unless 'present' is turned on
816
_ also add option for FSEM or not
917

1018
_ library imports failing for libs that define the same packages in 1.5.1
1119
_ http://code.google.com/p/processing/issues/detail?id=725
1220

13-
_ make application the correct one instead of applet
21+
_ make application the default instead of applet
1422

1523
_ renaming a normal tab to same name with ".java" fails with ".pde" version already exists
1624
_ http://code.google.com/p/processing/issues/detail?id=776

0 commit comments

Comments
 (0)