diff --git a/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/dialog/AddNodeDialog.java b/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/dialog/AddNodeDialog.java index cb9602553..ca185eb4a 100644 --- a/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/dialog/AddNodeDialog.java +++ b/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/dialog/AddNodeDialog.java @@ -28,7 +28,7 @@ import javax.swing.tree.TreeSelectionModel; /** * - * @author m327836 + * @author Nehon */ public class AddNodeDialog extends javax.swing.JDialog { diff --git a/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/Bundle.properties b/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/Bundle.properties new file mode 100644 index 000000000..64e6fb8b9 --- /dev/null +++ b/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/Bundle.properties @@ -0,0 +1,5 @@ +ShaderEditPanel.closeButton.text= +ShaderEditPanel.shaderEditorPane.text= +ShaderEditPanel.closeButton.toolTipText=Close this panel +ShaderEditPanel.jToggleButton1.text=jToggleButton1 +ShaderEditPanel.headerText.text=jLabel1 diff --git a/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/Diagram.java b/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/Diagram.java index 4befb01c6..fcd851ed6 100644 --- a/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/Diagram.java +++ b/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/Diagram.java @@ -134,7 +134,11 @@ public class Diagram extends JPanel implements MouseListener, MouseMotionListene } repaint(); } - + + protected void showEdit(NodePanel node) { + parent.showShaderEditor(node.getName(),node.getType(),node.filePaths); + } + public void notifyMappingCreation(Connection conn) { parent.makeMapping(conn); } diff --git a/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/DraggablePanel.java b/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/DraggablePanel.java index 73568963b..5ba949c9a 100644 --- a/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/DraggablePanel.java +++ b/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/DraggablePanel.java @@ -11,7 +11,7 @@ import javax.swing.JPanel; /** * - * @author m327836 + * @author Nehon */ public class DraggablePanel extends JPanel implements MouseListener, MouseMotionListener { @@ -44,7 +44,7 @@ public class DraggablePanel extends JPanel implements MouseListener, MouseMotion svdey = e.getYOnScreen(); e.consume(); } - + @Override public void mouseReleased(MouseEvent e) { } diff --git a/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/MatDefEditorlElement.form b/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/MatDefEditorlElement.form index 9c82d4931..2cca23230 100644 --- a/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/MatDefEditorlElement.form +++ b/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/MatDefEditorlElement.form @@ -1,6 +1,6 @@ -
+ @@ -16,39 +16,72 @@ - + - + - + + + + + - + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/MatDefEditorlElement.java b/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/MatDefEditorlElement.java index f6f6df0f1..fe2f9b605 100644 --- a/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/MatDefEditorlElement.java +++ b/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/MatDefEditorlElement.java @@ -56,6 +56,7 @@ import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.beans.PropertyVetoException; +import java.io.File; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -69,6 +70,8 @@ import org.netbeans.core.spi.multiview.CloseOperationState; import org.netbeans.core.spi.multiview.MultiViewElement; import org.netbeans.core.spi.multiview.MultiViewElementCallback; import org.openide.awt.UndoRedo; +import org.openide.filesystems.FileObject; +import org.openide.filesystems.FileUtil; import org.openide.nodes.Children; import org.openide.nodes.Node; import org.openide.util.Exceptions; @@ -103,13 +106,16 @@ public final class MatDefEditorlElement extends JPanel implements MultiViewEleme metaData = lkp.lookup(MatDefMetaData.class); assert obj != null; final EditableMatDefFile file = obj.getEditableFile(); - reload(file, lkp); + shaderEditPanel1.setVisible(false); + shaderEditPanel1.setParent(this); + reload(file, lkp); } private void initDiagram(Lookup lkp) throws NumberFormatException { + diagram1.clear(); diagram1.setParent(this); - + Material mat = lkp.lookup(Material.class); ProjectAssetManager manager = obj.getLookup().lookup(ProjectAssetManager.class); @@ -260,6 +266,45 @@ public final class MatDefEditorlElement extends JPanel implements MultiViewEleme Exceptions.printStackTrace(ex); } } + + public void refresh() { + + Lookup.Result resMat = obj.getLookup().lookupResult(Material.class); + Collection col = (Collection) resMat.allInstances(); + if (!col.isEmpty()) { + Material material = col.iterator().next(); + diagram1.refreshPreviews(material); + } + + } + + public void setModified(){ + obj.setModified(true); + } + + public ProjectAssetManager getAssetManager(){ + return obj.getLookup().lookup(ProjectAssetManager.class); + } + + public void showShaderEditor(String nodeName,NodePanel.NodeType type,ListpathList){ + + List fos = new ArrayList(); + for (String path : pathList) { + FileObject text = FileUtil.toFileObject(new File(getAssetManager().getAbsoluteAssetPath(path))); + fos.add(text); + } + shaderEditPanel1.setFiles(nodeName, type, fos); + shaderEditPanel1.revalidate(); + if(!shaderEditPanel1.isVisible() || jSplitPane.getDividerLocation() == jSplitPane.getMinimumDividerLocation()){ + shaderEditPanel1.setVisible(true); + jSplitPane.setDividerLocation(650); + } + + } + + public ShaderEditPanel getShaderEditor(){ + return shaderEditPanel1; + } private Node findNode(Node root, String key) { if (root instanceof Selectable) { @@ -289,38 +334,53 @@ public final class MatDefEditorlElement extends JPanel implements MultiViewEleme // //GEN-BEGIN:initComponents private void initComponents() { + jSplitPane = new javax.swing.JSplitPane(); + shaderEditPanel1 = new com.jme3.gde.materialdefinition.editor.ShaderEditPanel(); jScrollPane1 = new javax.swing.JScrollPane(); diagram1 = new com.jme3.gde.materialdefinition.editor.Diagram(); + jSplitPane.setDividerLocation(1); + jSplitPane.setDividerSize(6); + + shaderEditPanel1.setMinimumSize(new java.awt.Dimension(0, 0)); + jSplitPane.setLeftComponent(shaderEditPanel1); + + jScrollPane1.setMinimumSize(new java.awt.Dimension(0, 0)); + jScrollPane1.setName(""); // NOI18N + diagram1.setBackground(new java.awt.Color(153, 153, 153)); javax.swing.GroupLayout diagram1Layout = new javax.swing.GroupLayout(diagram1); diagram1.setLayout(diagram1Layout); diagram1Layout.setHorizontalGroup( diagram1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 398, Short.MAX_VALUE) + .addGap(0, 1591, Short.MAX_VALUE) ); diagram1Layout.setVerticalGroup( diagram1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 298, Short.MAX_VALUE) + .addGap(0, 782, Short.MAX_VALUE) ); jScrollPane1.setViewportView(diagram1); + jSplitPane.setRightComponent(jScrollPane1); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jScrollPane1) + .addComponent(jSplitPane, javax.swing.GroupLayout.DEFAULT_SIZE, 470, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jScrollPane1) + .addComponent(jSplitPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 333, Short.MAX_VALUE) ); }// //GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables private com.jme3.gde.materialdefinition.editor.Diagram diagram1; private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JSplitPane jSplitPane; + private com.jme3.gde.materialdefinition.editor.ShaderEditPanel shaderEditPanel1; // End of variables declaration//GEN-END:variables @Override @@ -572,6 +632,10 @@ public final class MatDefEditorlElement extends JPanel implements MultiViewEleme metaData.setProperty(diagram1.getCurrentTechniqueName() + "/" + key, x + "," + y); } + + public void reload(){ + reload(obj.getEditableFile(), obj.getLookup()); + } private void reload(final EditableMatDefFile file, final Lookup lkp) throws NumberFormatException { if (file.isLoaded()) { diff --git a/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/NodePanel.java b/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/NodePanel.java index 58e2a7b2d..49f94fe7d 100644 --- a/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/NodePanel.java +++ b/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/NodePanel.java @@ -5,6 +5,7 @@ package com.jme3.gde.materialdefinition.editor; import com.jme3.gde.materialdefinition.fileStructure.ShaderNodeBlock; +import com.jme3.gde.materialdefinition.fileStructure.leaves.DefinitionBlock; import com.jme3.gde.materialdefinition.fileStructure.leaves.InputMappingBlock; import com.jme3.gde.materialdefinition.fileStructure.leaves.OutputMappingBlock; import com.jme3.gde.materialdefinition.icons.Icons; @@ -51,6 +52,7 @@ public class NodePanel extends DraggablePanel implements Selectable, PropertyCha private Color color; private String name; private String techName; + protected List filePaths= new ArrayList(); // private List listeners = Collections.synchronizedList(new LinkedList()); // @@ -106,6 +108,9 @@ public class NodePanel extends DraggablePanel implements Selectable, PropertyCha this.addPropertyChangeListener(WeakListeners.propertyChange(node, this)); refresh(node); addKeyListener(this); + this.filePaths.addAll(def.getShadersPath()); + String defPath = ((DefinitionBlock)node.getContents().get(0)).getPath(); + this.filePaths.add(defPath); } /** @@ -311,6 +316,19 @@ public class NodePanel extends DraggablePanel implements Selectable, PropertyCha header.addMouseMotionListener(labelMouseMotionListener); header.setHorizontalAlignment(SwingConstants.LEFT); header.setFont(new Font("Tahoma", Font.BOLD, 11)); + header.addMouseListener(new MouseAdapter() { + + @Override + public void mouseClicked(MouseEvent e) { + //if(e.getClickCount()==2){ + if (type==NodeType.Fragment || type == NodeType.Vertex) { + diagram.showEdit(NodePanel.this); + } + //} + } + + }); + content = new JPanel(); content.setOpaque(false); GroupLayout contentLayout = new GroupLayout(content); diff --git a/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/OutBusPanel.java b/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/OutBusPanel.java index 2070f0d10..8863b9fd6 100644 --- a/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/OutBusPanel.java +++ b/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/OutBusPanel.java @@ -25,7 +25,7 @@ import javax.swing.SwingUtilities; /** * - * @author m327836 + * @author Nehon */ public class OutBusPanel extends DraggablePanel implements ComponentListener, Selectable, InOut { diff --git a/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/Selectable.java b/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/Selectable.java index 201e30d81..e00746546 100644 --- a/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/Selectable.java +++ b/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/Selectable.java @@ -6,7 +6,7 @@ package com.jme3.gde.materialdefinition.editor; /** * - * @author m327836 + * @author Nehon */ public interface Selectable { diff --git a/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/ShaderEditPanel.form b/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/ShaderEditPanel.form new file mode 100644 index 000000000..79d9bbe40 --- /dev/null +++ b/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/ShaderEditPanel.form @@ -0,0 +1,162 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/ShaderEditPanel.java b/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/ShaderEditPanel.java new file mode 100644 index 000000000..44b511583 --- /dev/null +++ b/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/ShaderEditPanel.java @@ -0,0 +1,244 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.jme3.gde.materialdefinition.editor; + +import com.jme3.gde.materialdefinition.icons.Icons; +import com.jme3.shader.Shader; +import java.awt.Component; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.util.List; +import javax.swing.JPanel; +import javax.swing.JToggleButton; +import javax.swing.text.EditorKit; +import org.openide.filesystems.FileObject; +import org.openide.loaders.DataObject; +import org.openide.loaders.DataObjectNotFoundException; +import org.openide.text.CloneableEditorSupport; +import org.openide.util.Exceptions; + +/** + * + * @author Nehon + */ +public class ShaderEditPanel extends JPanel { + + private DataObject currentDataObject = null; + private MatDefEditorlElement parent = null; + + /** + * Creates new form ShaderEditPanel + */ + public ShaderEditPanel() { + initComponents(); + String mime = "text/x-glsl"; + EditorKit ek = CloneableEditorSupport.getEditorKit(mime); + shaderEditorPane.setEditorKit(ek); + shaderEditorPane.setContentType(mime); + shaderEditorPane.addKeyListener(new KeyListener() { + + public void keyTyped(KeyEvent e) { + currentDataObject.setModified(true); + } + + public void keyPressed(KeyEvent e) { + if ((e.getKeyCode() == KeyEvent.VK_S) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { + saveCurrent(); + } + } + + public void keyReleased(KeyEvent e) { + } + }); + } + + public void setParent(MatDefEditorlElement parent) { + this.parent = parent; + } + + public void setFiles(String title, NodePanel.NodeType type, List fos) { + + headerText.setText(title); + headerText.setIcon(Icons.getIconForShaderType(type)); + boolean firstItem = true; + for (Component component : buttonPanel.getComponents()) { + buttonGroup1.remove((JToggleButton) component); + } + buttonPanel.removeAll(); + buttonPanel.repaint(); + + for (FileObject fo : fos) { + final Tab b = new Tab(); + b.setText(fo.getNameExt()); + buttonGroup1.add(b); + try { + b.dataObject = DataObject.find(fo); + b.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + saveCurrent(); + try { + shaderEditorPane.setText(b.dataObject.getPrimaryFile().asText()); + } catch (IOException ex) { + Exceptions.printStackTrace(ex); + } + currentDataObject = b.dataObject; + } + + }); + if (firstItem) { + shaderEditorPane.setText(fo.asText()); + currentDataObject = b.dataObject; + b.setSelected(true); + firstItem = false; + } + } catch (IOException ex) { + Exceptions.printStackTrace(ex); + } + + buttonPanel.add(b); + } + + } + + public void saveCurrent() { + if (currentDataObject != null && currentDataObject.isModified()) { + try { + OutputStreamWriter out = new OutputStreamWriter(currentDataObject.getPrimaryFile().getOutputStream()); + out.write(shaderEditorPane.getText(), 0, shaderEditorPane.getText().length()); + out.close(); + currentDataObject.setModified(false); + if(currentDataObject.getPrimaryFile().getExt().equalsIgnoreCase("j3sn")){ + parent.reload(); + } + parent.refresh(); + } catch (DataObjectNotFoundException ex) { + Exceptions.printStackTrace(ex); + } catch (IOException ex) { + Exceptions.printStackTrace(ex); + } + } + } + + private class Tab extends JToggleButton { + + DataObject dataObject; + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + buttonGroup1 = new javax.swing.ButtonGroup(); + jScrollPane1 = new javax.swing.JScrollPane(); + shaderEditorPane = new javax.swing.JEditorPane(); + header = new javax.swing.JPanel(); + headerText = new javax.swing.JLabel(); + closeButton = new javax.swing.JButton(); + buttonPanel = new javax.swing.JPanel(); + jToggleButton1 = new javax.swing.JToggleButton(); + + jScrollPane1.setMinimumSize(new java.awt.Dimension(0, 0)); + + shaderEditorPane.setBorder(null); + shaderEditorPane.setText(org.openide.util.NbBundle.getMessage(ShaderEditPanel.class, "ShaderEditPanel.shaderEditorPane.text")); // NOI18N + jScrollPane1.setViewportView(shaderEditorPane); + + header.setBackground(java.awt.SystemColor.activeCaption); + header.setBorder(javax.swing.BorderFactory.createEtchedBorder()); + + headerText.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + headerText.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); + headerText.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/jme3/gde/materialdefinition/icons/fragment.png"))); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(headerText, org.openide.util.NbBundle.getMessage(ShaderEditPanel.class, "ShaderEditPanel.headerText.text")); // NOI18N + + closeButton.setBackground(java.awt.SystemColor.activeCaption); + closeButton.setFont(new java.awt.Font("Tahoma", 1, 8)); // NOI18N + closeButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/jme3/gde/materialdefinition/icons/out.png"))); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(closeButton, org.openide.util.NbBundle.getMessage(ShaderEditPanel.class, "ShaderEditPanel.closeButton.text")); // NOI18N + closeButton.setToolTipText(org.openide.util.NbBundle.getMessage(ShaderEditPanel.class, "ShaderEditPanel.closeButton.toolTipText")); // NOI18N + closeButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); + closeButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + closeButtonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout headerLayout = new javax.swing.GroupLayout(header); + header.setLayout(headerLayout); + headerLayout.setHorizontalGroup( + headerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(headerLayout.createSequentialGroup() + .addComponent(headerText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(closeButton)) + ); + headerLayout.setVerticalGroup( + headerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(headerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(headerText, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(closeButton, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)) + ); + + buttonPanel.setAlignmentX(0.0F); + buttonPanel.setAlignmentY(0.0F); + buttonPanel.setPreferredSize(new java.awt.Dimension(73, 29)); + buttonPanel.setLayout(new javax.swing.BoxLayout(buttonPanel, javax.swing.BoxLayout.LINE_AXIS)); + + org.openide.awt.Mnemonics.setLocalizedText(jToggleButton1, org.openide.util.NbBundle.getMessage(ShaderEditPanel.class, "ShaderEditPanel.jToggleButton1.text")); // NOI18N + buttonPanel.add(jToggleButton1); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(header, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 645, Short.MAX_VALUE) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addComponent(buttonPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addComponent(header, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(buttonPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 492, Short.MAX_VALUE)) + ); + }// //GEN-END:initComponents + + private void closeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_closeButtonActionPerformed + setVisible(false); + + saveCurrent(); + + + }//GEN-LAST:event_closeButtonActionPerformed + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.ButtonGroup buttonGroup1; + private javax.swing.JPanel buttonPanel; + private javax.swing.JButton closeButton; + private javax.swing.JPanel header; + private javax.swing.JLabel headerText; + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JToggleButton jToggleButton1; + private javax.swing.JEditorPane shaderEditorPane; + // End of variables declaration//GEN-END:variables +} diff --git a/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/icons/Icons.java b/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/icons/Icons.java index 7e746346e..e06cb7546 100644 --- a/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/icons/Icons.java +++ b/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/icons/Icons.java @@ -4,6 +4,7 @@ */ package com.jme3.gde.materialdefinition.icons; +import com.jme3.gde.materialdefinition.editor.NodePanel; import javax.swing.ImageIcon; /** @@ -27,4 +28,13 @@ public class Icons { public final static ImageIcon tech = new ImageIcon(Icons.class.getResource("tech.png")); public final static ImageIcon in = new ImageIcon(Icons.class.getResource("in.png")); public final static ImageIcon out = new ImageIcon(Icons.class.getResource("out.png")); + public final static ImageIcon error = new ImageIcon(Icons.class.getResource("error.png")); + + public static ImageIcon getIconForShaderType(NodePanel.NodeType type) { + if (type == NodePanel.NodeType.Fragment) { + return frag; + } else { + return vert; + } + } } diff --git a/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/icons/error.png b/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/icons/error.png new file mode 100644 index 000000000..3e9047cea Binary files /dev/null and b/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/icons/error.png differ diff --git a/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/utils/DocFormatter.java b/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/utils/DocFormatter.java index aaa66fde3..f28778cb0 100644 --- a/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/utils/DocFormatter.java +++ b/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/utils/DocFormatter.java @@ -17,7 +17,7 @@ import javax.swing.text.StyledDocument; /** * - * @author m327836 + * @author Nehon */ public class DocFormatter { diff --git a/sdk/jme3-materialeditor/src/com/jme3/gde/materials/MaterialPreviewRenderer.java b/sdk/jme3-materialeditor/src/com/jme3/gde/materials/MaterialPreviewRenderer.java index 96d005577..e49409e69 100644 --- a/sdk/jme3-materialeditor/src/com/jme3/gde/materials/MaterialPreviewRenderer.java +++ b/sdk/jme3-materialeditor/src/com/jme3/gde/materials/MaterialPreviewRenderer.java @@ -11,6 +11,7 @@ import com.jme3.gde.core.scene.PreviewRequest; import com.jme3.gde.core.scene.SceneApplication; import com.jme3.gde.core.scene.SceneListener; import com.jme3.gde.core.scene.SceneRequest; +import com.jme3.gde.materialdefinition.icons.Icons; import com.jme3.material.MatParam; import com.jme3.material.Material; import com.jme3.math.FastMath; @@ -111,6 +112,11 @@ public class MaterialPreviewRenderer implements SceneListener { SceneApplication.getApplication().createPreview(request); } } catch (Exception e) { + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + label.setIcon(Icons.error); + } + }); Logger.getLogger(MaterialPreviewRenderer.class.getName()).log(Level.SEVERE, "Error rendering material{0}", e.getMessage()); } } @@ -148,6 +154,12 @@ public class MaterialPreviewRenderer implements SceneListener { //the following code will output the error //System.err.println(e.getMessage()); Logger.getLogger(MaterialDebugAppState.class.getName()).log(Level.SEVERE, e.getMessage()); + + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + label.setIcon(Icons.error); + } + }); return null; }