mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Merged with latest
This commit is contained in:
@@ -58,7 +58,7 @@ public class ContributionTab {
|
||||
JButton restartButton;
|
||||
JLabel categoryLabel;
|
||||
JLabel loaderLabel;
|
||||
|
||||
|
||||
JPanel errorPanel;
|
||||
JTextPane errorMessage;
|
||||
JButton tryAgainButton;
|
||||
@@ -68,7 +68,7 @@ public class ContributionTab {
|
||||
Editor editor;
|
||||
String category;
|
||||
ContributionListing contribListing;
|
||||
|
||||
|
||||
JProgressBar progressBar;
|
||||
|
||||
|
||||
@@ -123,8 +123,8 @@ public class ContributionTab {
|
||||
// panel.add(filler);
|
||||
// return panel;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void showFrame(final Editor editor, boolean activateErrorPanel,
|
||||
@@ -153,7 +153,7 @@ public class ContributionTab {
|
||||
filterLabel = new JLabel("Filter");
|
||||
filterLabel.setOpaque(false);
|
||||
}
|
||||
|
||||
|
||||
/*restartButton = new JButton(Language.text("contrib.restart"));
|
||||
restartButton.setVisible(false);
|
||||
restartButton.addActionListener(new ActionListener() {
|
||||
@@ -201,7 +201,7 @@ public class ContributionTab {
|
||||
|
||||
});*/
|
||||
|
||||
|
||||
|
||||
GroupLayout layout = new GroupLayout(panel);
|
||||
panel.setLayout(layout);
|
||||
// layout.setAutoCreateContainerGaps(true);
|
||||
@@ -242,7 +242,7 @@ public class ContributionTab {
|
||||
}
|
||||
|
||||
|
||||
/** Creates and arranges the Swing components in the dialog.
|
||||
/** Creates and arranges the Swing components in the dialog.
|
||||
*/
|
||||
private void createComponents() {
|
||||
|
||||
@@ -250,9 +250,9 @@ public class ContributionTab {
|
||||
|
||||
categoryChooser = new JComboBox<String>();
|
||||
categoryChooser.setMaximumRowCount(20);
|
||||
|
||||
|
||||
updateCategoryChooser();
|
||||
|
||||
|
||||
categoryChooser.addItemListener(new ItemListener() {
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
category = (String) categoryChooser.getSelectedItem();
|
||||
@@ -265,9 +265,9 @@ public class ContributionTab {
|
||||
});
|
||||
|
||||
filterField = new FilterField();
|
||||
|
||||
|
||||
buildErrorPanel();
|
||||
|
||||
|
||||
}
|
||||
private void buildErrorPanel(){
|
||||
errorPanel = new JPanel();
|
||||
@@ -282,17 +282,17 @@ public class ContributionTab {
|
||||
+ "Please verify your network connection again, then try connecting again.");
|
||||
errorMessage.setMaximumSize(new Dimension(450, 50));
|
||||
errorMessage.setOpaque(false);
|
||||
|
||||
|
||||
StyledDocument doc = errorMessage.getStyledDocument();
|
||||
SimpleAttributeSet center = new SimpleAttributeSet();
|
||||
StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
|
||||
doc.setParagraphAttributes(0, doc.getLength(), center, false);
|
||||
|
||||
|
||||
|
||||
|
||||
closeButton = new JButton("X");
|
||||
closeButton.setContentAreaFilled(false);
|
||||
closeButton.addActionListener(new ActionListener() {
|
||||
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
contributionManagerDialog.makeAndShowTab(false, false);
|
||||
@@ -302,7 +302,7 @@ public class ContributionTab {
|
||||
tryAgainButton.setContentAreaFilled(false);
|
||||
tryAgainButton.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.BLACK, 1),BorderFactory.createEmptyBorder(3, 0, 3, 0)));
|
||||
tryAgainButton.addActionListener(new ActionListener() {
|
||||
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
contributionManagerDialog.makeAndShowTab(false, true);
|
||||
@@ -342,11 +342,12 @@ public class ContributionTab {
|
||||
// }
|
||||
Collections.sort(categories);
|
||||
// categories.add(0, ContributionManagerDialog.ANY_CATEGORY);
|
||||
@SuppressWarnings("unused")
|
||||
boolean categoriesFound = false;
|
||||
categoryChooser.addItem(ContributionManagerDialog.ANY_CATEGORY);
|
||||
for (String s : categories) {
|
||||
categoryChooser.addItem(s);
|
||||
if (!s.equals("Unknown")) {
|
||||
if (!s.equals(Contribution.UNKNOWN_CATEGORY)) {
|
||||
categoriesFound = true;
|
||||
}
|
||||
}
|
||||
@@ -405,6 +406,15 @@ public class ContributionTab {
|
||||
}
|
||||
}
|
||||
|
||||
protected void setFilterText(String filter) {
|
||||
if (filter == null || filter.isEmpty()) {
|
||||
filterField.setText("");
|
||||
} else {
|
||||
filterField.setText(filter);
|
||||
}
|
||||
filterField.applyFilter();
|
||||
}
|
||||
|
||||
|
||||
// private JPanel getPlaceholder() {
|
||||
// return contributionListPanel.statusPlaceholder;
|
||||
|
||||
@@ -24,8 +24,12 @@ package processing.app.contrib;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import processing.app.Base;
|
||||
import processing.app.Mode;
|
||||
@@ -77,8 +81,7 @@ public class ModeContribution extends LocalContribution {
|
||||
private ModeContribution(Base base, File folder,
|
||||
String className) throws Exception {
|
||||
super(folder);
|
||||
|
||||
className = initLoader(className);
|
||||
className = initLoader(base, className);
|
||||
if (className != null) {
|
||||
Class<?> modeClass = loader.loadClass(className);
|
||||
Base.log("Got mode class " + modeClass);
|
||||
@@ -131,11 +134,11 @@ public class ModeContribution extends LocalContribution {
|
||||
try {
|
||||
contribModes.add(new ModeContribution(base, folder, null));
|
||||
} catch (NoSuchMethodError nsme) {
|
||||
System.err.println(folder.getName() + " contains an incompatible Mode");
|
||||
System.err.println(nsme.getMessage());
|
||||
System.err.println(folder.getName() + " is not compatible with this version of Processing");
|
||||
// System.err.println(nsme.getMessage());
|
||||
} catch (NoClassDefFoundError ncdfe) {
|
||||
System.err.println(folder.getName() + " contains an incompatible Mode");
|
||||
System.err.println(ncdfe.getMessage());
|
||||
System.err.println(folder.getName() + " is not compatible with this version of Processing");
|
||||
// System.err.println(ncdfe.getMessage());
|
||||
} catch (IgnorableException ig) {
|
||||
Base.log(ig.getMessage());
|
||||
} catch (Throwable e) {
|
||||
@@ -176,6 +179,88 @@ public class ModeContribution extends LocalContribution {
|
||||
return loader.equals(other.loader) && mode.equals(other.getMode());
|
||||
}
|
||||
|
||||
public String initLoader(Base base, String className) throws Exception {
|
||||
|
||||
File modeDirectory = new File(folder, getTypeName());
|
||||
if (modeDirectory.exists()) {
|
||||
Base.log("checking mode folder regarding " + className);
|
||||
// If no class name specified, search the main <modename>.jar for the
|
||||
// full name package and mode name.
|
||||
if (className == null) {
|
||||
String shortName = folder.getName();
|
||||
File mainJar = new File(modeDirectory, shortName + ".jar");
|
||||
if (mainJar.exists()) {
|
||||
className = findClassInZipFile(shortName, mainJar);
|
||||
} else {
|
||||
throw new IgnorableException(mainJar.getAbsolutePath() + " does not exist.");
|
||||
}
|
||||
|
||||
if (className == null) {
|
||||
throw new IgnorableException("Could not find " + shortName +
|
||||
" class inside " + mainJar.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
ArrayList<URL> extraUrls = new ArrayList<>();
|
||||
if (imports != null && imports.size() > 0) {
|
||||
// if the mode has any dependencies (defined as imports in mode.properties),
|
||||
// add the dependencies to the classloader
|
||||
|
||||
HashMap<String, Mode> installedModes = new HashMap<>();
|
||||
for(Mode m: base.getModeList()){
|
||||
// Base.log("Mode contrib: " + m.getClass().getName() + " : "+ m.getFolder());
|
||||
installedModes.put(m.getClass().getName(), m);
|
||||
}
|
||||
|
||||
for(String modeImport: imports){
|
||||
if (installedModes.containsKey(modeImport)) {
|
||||
Base.log("Found mode dependency " + modeImport);
|
||||
File[] archives = Base.listJarFiles(new File(installedModes.get(modeImport).
|
||||
getFolder().getAbsolutePath() + File.separator + "mode"));
|
||||
if (archives != null && archives.length > 0) {
|
||||
for (int i = 0; i < archives.length; i++) {
|
||||
// Base.log("Adding jar dependency: " + archives[i].getAbsolutePath());
|
||||
extraUrls.add(archives[i].toURI().toURL());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new IgnorableException("Dependency mode "+ modeImport + " could not be"
|
||||
+ " found. Can't load " + className);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add .jar and .zip files from the "mode" folder into the classpath
|
||||
File[] archives = Base.listJarFiles(modeDirectory);
|
||||
if (archives != null && archives.length > 0) {
|
||||
int arrLen = archives.length + extraUrls.size();
|
||||
URL[] urlList = new URL[arrLen];
|
||||
|
||||
int j = 0;
|
||||
for (; j < extraUrls.size(); j++) {
|
||||
//Base.log("Found archive " + archives[j] + " for " + getName());
|
||||
urlList[j] = extraUrls.get(j);
|
||||
}
|
||||
|
||||
for (int k = 0; k < archives.length; k++,j++) {
|
||||
Base.log("Found archive " + archives[k] + " for " + getName());
|
||||
urlList[j] = archives[k].toURI().toURL();
|
||||
}
|
||||
|
||||
loader = new URLClassLoader(urlList);
|
||||
Base.log("loading above JARs with loader " + loader);
|
||||
// System.out.println("listing classes for loader " + loader);
|
||||
// listClasses(loader);
|
||||
}
|
||||
}
|
||||
|
||||
// If no archives were found, just use the regular ClassLoader
|
||||
if (loader == null) {
|
||||
loader = Thread.currentThread().getContextClassLoader();
|
||||
}
|
||||
return className;
|
||||
}
|
||||
|
||||
|
||||
// static protected List<File> discover(File folder) {
|
||||
// File[] folders = listCandidates(folder, "mode");
|
||||
@@ -185,4 +270,4 @@ public class ModeContribution extends LocalContribution {
|
||||
// return Arrays.asList(folders);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
@@ -46,6 +46,11 @@ public class ToolContribution extends LocalContribution implements Tool {
|
||||
} catch (VerifyError ve) { // incompatible
|
||||
// avoid the excessive error spew that happens here
|
||||
|
||||
} catch (NoClassDefFoundError ncdfe) {
|
||||
if (ncdfe.getMessage().contains("processing/app/Editor")) {
|
||||
System.err.println("The Editor class has moved to the processing.app.ui package in Processing 3");
|
||||
}
|
||||
|
||||
} catch (Throwable e) { // unknown error
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -105,7 +110,7 @@ public class ToolContribution extends LocalContribution implements Tool {
|
||||
// }
|
||||
|
||||
|
||||
static public ArrayList<ToolContribution> loadAll(File toolsFolder) {
|
||||
static public List<ToolContribution> loadAll(File toolsFolder) {
|
||||
File[] list = ContributionType.TOOL.listCandidates(toolsFolder);
|
||||
ArrayList<ToolContribution> outgoing = new ArrayList<ToolContribution>();
|
||||
// If toolsFolder does not exist or is inaccessible (stranger things have
|
||||
|
||||
@@ -1288,6 +1288,11 @@ public abstract class Editor extends JFrame implements RunnerListener {
|
||||
System.err.println("The " + ncdfe.getMessage() + " class is no longer available.");
|
||||
Base.loge("Incompatible Tool found during tool.init()", ncdfe);
|
||||
|
||||
} catch (AbstractMethodError ame) {
|
||||
System.err.println("\"" + tool.getMenuTitle() + "\" is not " +
|
||||
"compatible with this version of Processing");
|
||||
// ame.printStackTrace();
|
||||
|
||||
} catch (Error err) {
|
||||
System.err.println("An error occurred inside \"" + tool.getMenuTitle() + "\"");
|
||||
err.printStackTrace();
|
||||
|
||||
+14
-2
@@ -99,7 +99,7 @@
|
||||
<include name="bin/klist.exe" />
|
||||
<include name="bin/ktab.exe" />
|
||||
|
||||
<!--<include name="bin/keytool" />--> <!-- needed for Android -->
|
||||
<include name="bin/keytool" /> <!-- needed for Android -->
|
||||
<include name="bin/orbd" />
|
||||
<include name="bin/policytool" />
|
||||
<include name="bin/rmid" />
|
||||
@@ -114,7 +114,7 @@
|
||||
</fileset>
|
||||
|
||||
<fileset dir="linux/work/java" id="jre-optional-linux">
|
||||
<!--<include name="bin/keytool" />--> <!-- needed for Android -->
|
||||
<include name="bin/keytool" /> <!-- needed for Android -->
|
||||
|
||||
<include name="lib/ext/dnsns.jar" />
|
||||
|
||||
@@ -547,6 +547,18 @@
|
||||
-->
|
||||
</bundleapp>
|
||||
|
||||
<!-- Temporary fix until new appbundler is included again after solving
|
||||
https://github.com/processing/processing/issues/3359
|
||||
https://github.com/processing/processing/issues/3360
|
||||
The 'keytool' file is deleted by our appbundler. Add it back so that
|
||||
Android signing works properly. (Not modifying our appbundler since
|
||||
most of the time that appbundler is used, keytool isn't needed).
|
||||
Also, because Ant's copy task does not retain file permissions on Unix systems,
|
||||
we need to use <exec executable="cp" ... > instead -->
|
||||
<exec executable="cp">
|
||||
<arg line="${jdk.path.macosx}/Contents/Home/bin/keytool macosx/work/Processing.app/Contents/PlugIns/jdk${jdk.esoteric}.jdk/Contents/Home/jre/bin"/>
|
||||
</exec>
|
||||
|
||||
<!-- Replace libjli.dylib symlink with actual file.
|
||||
Deals with code signing issues on OS X 10.9.5+ -->
|
||||
<property name="jli.path" value="macosx/work/Processing.app/Contents/PlugIns/jdk${jdk.esoteric}.jdk/Contents/MacOS/libjli.dylib" />
|
||||
|
||||
@@ -350,6 +350,7 @@ editor.status.missing.right_curly_bracket = Missing right curly bracket "}"
|
||||
editor.status.missing.add = Consider adding "%s"
|
||||
editor.status.reserved_words = "color" and "int" are reserved words & cannot be used as variable names
|
||||
editor.status.undefined_method = The function "%s(%s)" does not exist
|
||||
editor.status.undefined_constructor = The constructor "%s(%s)" does not exist
|
||||
editor.status.empty_param = The function "%s()" does not expect any parameters
|
||||
editor.status.wrong_param = The function "%s()" expects parameters like: "%s(%s)"
|
||||
editor.status.undef_global_var = The global variable "%s" does not exist
|
||||
|
||||
@@ -2903,6 +2903,9 @@ public class PGraphicsJava2D extends PGraphics {
|
||||
if ((sourceX == 0) && (sourceY == 0) &&
|
||||
(sourceWidth == sourceImage.width) &&
|
||||
(sourceHeight == sourceImage.height)) {
|
||||
// System.out.format("%d %d %dx%d %d%n", targetX, targetY,
|
||||
// sourceImage.width, sourceImage.height,
|
||||
// sourceImage.pixels.length);
|
||||
raster.setDataElements(targetX, targetY,
|
||||
sourceImage.width, sourceImage.height,
|
||||
sourceImage.pixels);
|
||||
|
||||
@@ -5294,7 +5294,8 @@ public class PApplet implements PConstants {
|
||||
}
|
||||
|
||||
// if it's a .gif image, test to see if it has transparency
|
||||
if (extension.equals("gif") || extension.equals("png")) {
|
||||
if (extension.equals("gif") || extension.equals("png") ||
|
||||
extension.equals("unknown")) {
|
||||
image.checkAlpha();
|
||||
}
|
||||
|
||||
@@ -10651,6 +10652,24 @@ public class PApplet implements PConstants {
|
||||
}
|
||||
|
||||
|
||||
public void attribPosition(String name, float x, float y, float z) {
|
||||
if (recorder != null) recorder.attribPosition(name, x, y, z);
|
||||
g.attribPosition(name, x, y, z);
|
||||
}
|
||||
|
||||
|
||||
public void attribNormal(String name, float nx, float ny, float nz) {
|
||||
if (recorder != null) recorder.attribNormal(name, nx, ny, nz);
|
||||
g.attribNormal(name, nx, ny, nz);
|
||||
}
|
||||
|
||||
|
||||
public void attribColor(String name, int color) {
|
||||
if (recorder != null) recorder.attribColor(name, color);
|
||||
g.attribColor(name, color);
|
||||
}
|
||||
|
||||
|
||||
public void attrib(String name, float... values) {
|
||||
if (recorder != null) recorder.attrib(name, values);
|
||||
g.attrib(name, values);
|
||||
|
||||
@@ -1239,6 +1239,21 @@ public class PGraphics extends PImage implements PConstants {
|
||||
}
|
||||
|
||||
|
||||
public void attribPosition(String name, float x, float y, float z) {
|
||||
showMissingWarning("attrib");
|
||||
}
|
||||
|
||||
|
||||
public void attribNormal(String name, float nx, float ny, float nz) {
|
||||
showMissingWarning("attrib");
|
||||
}
|
||||
|
||||
|
||||
public void attribColor(String name, int color) {
|
||||
showMissingWarning("attrib");
|
||||
}
|
||||
|
||||
|
||||
public void attrib(String name, float... values) {
|
||||
showMissingWarning("attrib");
|
||||
}
|
||||
|
||||
@@ -309,18 +309,31 @@ public class PImage implements PConstants, Cloneable {
|
||||
BufferedImage bi = (BufferedImage) img;
|
||||
width = bi.getWidth();
|
||||
height = bi.getHeight();
|
||||
pixels = new int[width * height];
|
||||
pixels = ((DataBufferInt) bi.getRaster().getDataBuffer()).getData();
|
||||
int type = bi.getType();
|
||||
if (type == BufferedImage.TYPE_INT_ARGB) {
|
||||
format = ARGB;
|
||||
} else if (type == BufferedImage.TYPE_INT_RGB) {
|
||||
for (int i = 0; i < pixels.length; i++) {
|
||||
pixels[i] = 0xFF000000 | pixels[i];
|
||||
if (type == BufferedImage.TYPE_3BYTE_BGR ||
|
||||
type == BufferedImage.TYPE_4BYTE_ABGR) {
|
||||
pixels = new int[width * height];
|
||||
bi.getRGB(0, 0, width, height, pixels, 0, width);
|
||||
if (type == BufferedImage.TYPE_4BYTE_ABGR) {
|
||||
format = ARGB;
|
||||
} else {
|
||||
opaque();
|
||||
}
|
||||
} else {
|
||||
DataBuffer db = bi.getRaster().getDataBuffer();
|
||||
if (db instanceof DataBufferInt) {
|
||||
pixels = ((DataBufferInt) db).getData();
|
||||
if (type == BufferedImage.TYPE_INT_ARGB) {
|
||||
format = ARGB;
|
||||
} else if (type == BufferedImage.TYPE_INT_RGB) {
|
||||
opaque();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else { // go the old school java 1.0 route
|
||||
}
|
||||
// Implements fall-through if not DataBufferInt above, or not a
|
||||
// known type, or not DataBufferInt for the data itself.
|
||||
if (pixels == null) { // go the old school Java 1.0 route
|
||||
width = img.getWidth(null);
|
||||
height = img.getHeight(null);
|
||||
pixels = new int[width * height];
|
||||
@@ -1263,6 +1276,14 @@ public class PImage implements PConstants, Cloneable {
|
||||
}
|
||||
|
||||
|
||||
/** Set the high bits of all pixels to opaque. */
|
||||
protected void opaque() {
|
||||
for (int i = 0; i < pixels.length; i++) {
|
||||
pixels[i] = 0xFF000000 | pixels[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Optimized code for building the blur kernel.
|
||||
* further optimized blur code (approx. 15% for radius=20)
|
||||
|
||||
@@ -716,6 +716,17 @@ public class PShape implements PConstants {
|
||||
}
|
||||
|
||||
|
||||
public void attribPosition(String name, float x, float y, float z) {
|
||||
}
|
||||
|
||||
public void attribNormal(String name, float nx, float ny, float nz) {
|
||||
}
|
||||
|
||||
|
||||
public void attribColor(String name, int color) {
|
||||
}
|
||||
|
||||
|
||||
public void attrib(String name, float... values) {
|
||||
}
|
||||
|
||||
|
||||
@@ -71,6 +71,7 @@ public class ThinkDifferent {
|
||||
}
|
||||
|
||||
|
||||
// Called via reflection from PSurfaceAWT and others
|
||||
static public void setIconImage(Image image) {
|
||||
// When already set, is a sun.awt.image.MultiResolutionCachedImage on OS X
|
||||
// Image current = application.getDockIconImage();
|
||||
|
||||
@@ -2625,39 +2625,73 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void attribPosition(String name, float x, float y, float z) {
|
||||
VertexAttribute attrib = attribImpl(name, VertexAttribute.POSITION,
|
||||
PGL.FLOAT, 3);
|
||||
if (attrib != null) attrib.set(x, y, z);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void attribNormal(String name, float nx, float ny, float nz) {
|
||||
VertexAttribute attrib = attribImpl(name, VertexAttribute.NORMAL,
|
||||
PGL.FLOAT, 3);
|
||||
if (attrib != null) attrib.set(nx, ny, nz);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void attribColor(String name, int color) {
|
||||
VertexAttribute attrib = attribImpl(name, VertexAttribute.COLOR, PGL.INT, 1);
|
||||
if (attrib != null) attrib.set(new int[] {color});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void attrib(String name, float... values) {
|
||||
VertexAttribute attrib = attribImpl(name, PGL.FLOAT, values.length);
|
||||
VertexAttribute attrib = attribImpl(name, VertexAttribute.OTHER,
|
||||
PGL.FLOAT, values.length);
|
||||
if (attrib != null) attrib.set(values);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void attrib(String name, int... values) {
|
||||
VertexAttribute attrib = attribImpl(name, PGL.INT, values.length);
|
||||
VertexAttribute attrib = attribImpl(name, VertexAttribute.OTHER,
|
||||
PGL.INT, values.length);
|
||||
if (attrib != null) attrib.set(values);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void attrib(String name, boolean... values) {
|
||||
VertexAttribute attrib = attribImpl(name, PGL.BOOL, values.length);
|
||||
VertexAttribute attrib = attribImpl(name, VertexAttribute.OTHER,
|
||||
PGL.BOOL, values.length);
|
||||
if (attrib != null) attrib.set(values);
|
||||
}
|
||||
|
||||
|
||||
protected VertexAttribute attribImpl(String name, int type, int size) {
|
||||
protected VertexAttribute attribImpl(String name, int kind, int type, int size) {
|
||||
if (4 < size) {
|
||||
PGraphics.showWarning("Vertex attributes cannot have more than 4 values");
|
||||
return null;
|
||||
}
|
||||
VertexAttribute attrib = polyAttribs.get(name);
|
||||
if (attrib == null) {
|
||||
attrib = new VertexAttribute(this, name, type, size);
|
||||
attrib = new VertexAttribute(this, name, kind, type, size);
|
||||
polyAttribs.put(name, attrib);
|
||||
inGeo.initAttrib(attrib);
|
||||
tessGeo.initAttrib(attrib);
|
||||
}
|
||||
if (attrib.kind != kind) {
|
||||
PGraphics.showWarning("The attribute kind cannot be changed after creation");
|
||||
return null;
|
||||
}
|
||||
if (attrib.type != type) {
|
||||
PGraphics.showWarning("The attribute type cannot be changed after creation");
|
||||
return null;
|
||||
}
|
||||
if (attrib.size != size) {
|
||||
PGraphics.showWarning("New value for vertex attribute has wrong number of values");
|
||||
return null;
|
||||
@@ -7398,23 +7432,17 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
int lastModified;
|
||||
boolean active;
|
||||
|
||||
VertexAttribute(PGraphicsOpenGL pg, String name, int type, int size) {
|
||||
VertexAttribute(PGraphicsOpenGL pg, String name, int kind, int type, int size) {
|
||||
this.pg = pg;
|
||||
this.name = name;
|
||||
this.kind = kind;
|
||||
this.type = type;
|
||||
this.size = size;
|
||||
|
||||
tessSize = size;
|
||||
|
||||
if (name.indexOf("pos") == 0 && type == PGL.FLOAT && size == 3) {
|
||||
kind = POSITION;
|
||||
tessSize = 4;
|
||||
} else if (name.indexOf("norm") == 0 && type == PGL.FLOAT && size == 3) {
|
||||
kind = NORMAL;
|
||||
} else if (name.indexOf("color") == 0 && type == PGL.INT && size == 1) {
|
||||
kind = COLOR;
|
||||
if (kind == POSITION) {
|
||||
tessSize = 4; // for w
|
||||
} else {
|
||||
kind = OTHER;
|
||||
tessSize = size;
|
||||
}
|
||||
|
||||
if (type == PGL.FLOAT) {
|
||||
@@ -7520,6 +7548,16 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
return length * tessSize * elementSize;
|
||||
}
|
||||
|
||||
void set(float x, float y, float z) {
|
||||
fvalues[0] = x;
|
||||
fvalues[1] = y;
|
||||
fvalues[2] = z;
|
||||
}
|
||||
|
||||
void set(int c) {
|
||||
ivalues[0] = c;
|
||||
}
|
||||
|
||||
void set(float[] values) {
|
||||
PApplet.arrayCopy(values, 0, fvalues, 0, size);
|
||||
}
|
||||
|
||||
@@ -1170,38 +1170,73 @@ public class PShapeOpenGL extends PShape {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void attribPosition(String name, float x, float y, float z) {
|
||||
VertexAttribute attrib = attribImpl(name, VertexAttribute.POSITION,
|
||||
PGL.FLOAT, 3);
|
||||
if (attrib != null) attrib.set(x, y, z);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void attribNormal(String name, float nx, float ny, float nz) {
|
||||
VertexAttribute attrib = attribImpl(name, VertexAttribute.NORMAL,
|
||||
PGL.FLOAT, 3);
|
||||
if (attrib != null) attrib.set(nx, ny, nz);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void attribColor(String name, int color) {
|
||||
VertexAttribute attrib = attribImpl(name, VertexAttribute.COLOR, PGL.INT, 1);
|
||||
if (attrib != null) attrib.set(new int[] {color});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void attrib(String name, float... values) {
|
||||
VertexAttribute attrib = attribImpl(name, PGL.FLOAT, values.length);
|
||||
VertexAttribute attrib = attribImpl(name, VertexAttribute.OTHER, PGL.FLOAT,
|
||||
values.length);
|
||||
if (attrib != null) attrib.set(values);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void attrib(String name, int... values) {
|
||||
VertexAttribute attrib = attribImpl(name, PGL.INT, values.length);
|
||||
VertexAttribute attrib = attribImpl(name, VertexAttribute.OTHER, PGL.INT,
|
||||
values.length);
|
||||
if (attrib != null) attrib.set(values);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void attrib(String name, boolean... values) {
|
||||
VertexAttribute attrib = attribImpl(name, PGL.BOOL, values.length);
|
||||
VertexAttribute attrib = attribImpl(name, VertexAttribute.OTHER, PGL.BOOL,
|
||||
values.length);
|
||||
if (attrib != null) attrib.set(values);
|
||||
}
|
||||
|
||||
|
||||
protected VertexAttribute attribImpl(String name, int type, int size) {
|
||||
protected VertexAttribute attribImpl(String name, int kind, int type, int size) {
|
||||
if (4 < size) {
|
||||
PGraphics.showWarning("Vertex attributes cannot have more than 4 values");
|
||||
return null;
|
||||
}
|
||||
VertexAttribute attrib = polyAttribs.get(name);
|
||||
if (attrib == null) {
|
||||
attrib = new VertexAttribute(pg, name, type, size);
|
||||
attrib = new VertexAttribute(pg, name, kind, type, size);
|
||||
polyAttribs.put(name, attrib);
|
||||
inGeo.initAttrib(attrib);
|
||||
}
|
||||
if (attrib.kind != kind) {
|
||||
PGraphics.showWarning("The attribute kind cannot be changed after creation");
|
||||
return null;
|
||||
}
|
||||
if (attrib.type != type) {
|
||||
PGraphics.showWarning("The attribute type cannot be changed after creation");
|
||||
return null;
|
||||
}
|
||||
if (attrib.size != size) {
|
||||
PGraphics.showWarning("New value for vertex attribute has wrong number of values");
|
||||
return null;
|
||||
|
||||
+9
-4
@@ -46,6 +46,9 @@ X https://github.com/processing/processing/issues/3413
|
||||
X SVG briefly broken for Java2D
|
||||
X https://github.com/processing/processing/issues/3417
|
||||
X change how font metrics are pulled to fix text width issues
|
||||
X check alpha when image extension is "unknown"
|
||||
X https://github.com/processing/processing/issues/3442
|
||||
X add support for more Image types (BGR) with PImage(java.awt.Image) constructor
|
||||
|
||||
threading headaches
|
||||
X sketch not always showing with empty draw()
|
||||
@@ -93,6 +96,10 @@ X errors with loading SVGs in P3D/P2D
|
||||
X https://github.com/processing/processing/issues/3379
|
||||
X sketch window briefly appears on top left corner when using OpenGL
|
||||
X https://github.com/processing/processing/issues/3308
|
||||
X add attrib() method
|
||||
X https://github.com/processing/processing/issues/2963
|
||||
X andres needs input on how the api works
|
||||
o assign this to DXF as well?
|
||||
|
||||
contribs
|
||||
X Fix NullPointerException in DepthSorter
|
||||
@@ -130,6 +137,8 @@ _ update wiki/docs to say "don't override sketchXxxx() methods"
|
||||
beta
|
||||
X move Java2D and JavaFX classes to their own packages
|
||||
_ make notes about this in the README
|
||||
_ move AWT image loading into PImageAWT
|
||||
_ look into how GL and FX will handle from there
|
||||
_ run only the necessary pieces on the EDT
|
||||
_ in part because FX doesn't even use the EDT
|
||||
_ re-check the Linux frame visibility stuff
|
||||
@@ -175,10 +184,6 @@ _ https://www.linkedin.com/pulse/oracle-just-removed-javafx-support-arm-jan-sn
|
||||
|
||||
opengl
|
||||
_ hard crash at 1920x1080, mirrored, Casey's GT 650M 1GB
|
||||
_ add attrib() method
|
||||
_ https://github.com/processing/processing/issues/2963
|
||||
_ andres needs input on how the api works
|
||||
_ assign this to DXF as well?
|
||||
_ window loses focus after maximizing
|
||||
_ https://github.com/processing/processing/issues/3339
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* than the screen. When PDF is used as the renderer
|
||||
* (the third parameter of size) the display window
|
||||
* does not open. The file is saved to the sketch folder.
|
||||
* You can open it by "Sketch->Show Sketch Folder."
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -164,6 +164,21 @@ public class ErrorMessageSimplifier {
|
||||
}
|
||||
break;
|
||||
|
||||
case IProblem.UndefinedConstructor:
|
||||
if (args.length == 2) {
|
||||
String constructorName = args[0];
|
||||
// For messages such as "contructor sketch_name.ClassXYZ() is undefined", change
|
||||
// constructor name to "ClassXYZ()". See #3434
|
||||
if (constructorName.contains(".")) {
|
||||
// arg[0] contains sketch name twice: sketch_150705a.sketch_150705a.Thing
|
||||
constructorName = constructorName.substring(constructorName.indexOf('.') + 1);
|
||||
constructorName = constructorName.substring(constructorName.indexOf('.') + 1);
|
||||
}
|
||||
String constructorArgs = removePackagePrefixes(args[args.length - 1]);
|
||||
result = Language.interpolate("editor.status.undefined_constructor", constructorName, constructorArgs);
|
||||
}
|
||||
break;
|
||||
|
||||
case IProblem.UndefinedMethod:
|
||||
if (args.length > 2) {
|
||||
String methodName = args[args.length - 2];
|
||||
|
||||
@@ -18,6 +18,12 @@ X https://github.com/processing/processing/issues/3394
|
||||
X Tweak mode broken (re: new settings() function)
|
||||
X https://github.com/processing/processing/issues/3435
|
||||
X looks like 'class' def from tweak needs to go below setup
|
||||
X change "PythonMode contains an incompatible Mode" message
|
||||
X to "PythonMode is not compatible with Processing 3"
|
||||
X another "incompatible tool" case
|
||||
X java.lang.AbstractMethodError
|
||||
X at processing.app.contrib.ToolContribution.init(ToolContribution.java:134)
|
||||
X unfortunately happens at a level where we can only println about it
|
||||
|
||||
manager
|
||||
X changed compatibleModesList to modes in examples.properties
|
||||
@@ -42,6 +48,8 @@ X https://github.com/processing/processing/issues/3111
|
||||
X Re-enable export to application with command line
|
||||
X https://github.com/processing/processing/pull/3451
|
||||
X https://github.com/processing/processing/issues/2760
|
||||
X change undefined constructor error message for clarity
|
||||
X https://github.com/processing/processing/issues/3434
|
||||
|
||||
gsoc
|
||||
X Mode problems window wasn't doing line breaks
|
||||
@@ -65,6 +73,10 @@ X https://github.com/processing/processing/issues/3429
|
||||
X https://github.com/processing/processing/pull/3438
|
||||
X CM with updated statusPanel and error popup
|
||||
X https://github.com/processing/processing/pull/3452
|
||||
X allow modes to import other modes
|
||||
X https://github.com/processing/processing/pull/3444
|
||||
X CM list converted into table
|
||||
X https://github.com/processing/processing/pull/3454
|
||||
|
||||
cleaning
|
||||
o libraries in java tabs (separate .java files) are reported missing
|
||||
@@ -77,6 +89,7 @@ contribs pending
|
||||
_ Ready to add contributed example packages?
|
||||
_ https://github.com/processing/processing/issues/2953
|
||||
|
||||
|
||||
beta
|
||||
_ make modes load their parent class
|
||||
_ https://github.com/processing/processing/issues/3443
|
||||
@@ -134,6 +147,7 @@ _ recent menu gets huge with other p5 versions on osx
|
||||
|
||||
|
||||
pde/build
|
||||
_ Cannot find "processing.core" library. Line 12 in tab sketch_150704a
|
||||
_ dim out the Run button if there are compile errors detected
|
||||
_ the AST checker has better error message handling for those cases
|
||||
_ and hitting Run replaces the useful error with something weird
|
||||
|
||||
Reference in New Issue
Block a user