From 58480c092643decfc8faeb7035055bafb033b00c Mon Sep 17 00:00:00 2001 From: Nehon Date: Tue, 10 Feb 2015 00:06:53 +0100 Subject: [PATCH] New Colors for the node editor --- .../editor/ConnectionCurve.java | 31 +++++------ .../editor/MatDefEditorlElement.form | 2 +- .../editor/MatDefEditorlElement.java | 2 +- .../materialdefinition/editor/NodePanel.java | 54 +++++++++---------- .../editor/OutBusPanel.java | 4 +- 5 files changed, 43 insertions(+), 50 deletions(-) diff --git a/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/ConnectionCurve.java b/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/ConnectionCurve.java index 942dd6e70..e0bf6664b 100644 --- a/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/ConnectionCurve.java +++ b/sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/ConnectionCurve.java @@ -66,22 +66,7 @@ public class ConnectionCurve extends JPanel implements ComponentListener, MouseI } return me; } - - private enum Corner { - - RightBottom, - BottomRight, - BottomLeft, - LeftBottom, - RightTop, - TopRight, - LeftTop, - TopLeft, - Top, - Bottom, - None, - } - + @SuppressWarnings("LeakingThisInConstructor") public ConnectionCurve(Dot start, Dot end) { @@ -138,7 +123,12 @@ public class ConnectionCurve extends JPanel implements ComponentListener, MouseI g2.setStroke(new BasicStroke(4)); Path2D.Double path1 = new Path2D.Double(); - g.setColor(Color.DARK_GRAY); + if (getDiagram().selectedItem == this) { + g.setColor(SELECTED_COLOR); + } else { + g.setColor(VERY_DARK_GREY); + } + if (pointsSize < 4) { translate(points[0], p1); @@ -171,14 +161,19 @@ public class ConnectionCurve extends JPanel implements ComponentListener, MouseI ((Graphics2D) g).draw(path1); g2.setStroke(new BasicStroke(2)); + if (getDiagram().selectedItem == this) { g.setColor(Color.WHITE); } else { g.setColor(LIGHT_GREY); } + ((Graphics2D) g).draw(path1); } - private final static Color LIGHT_GREY = new Color(120, 120, 120); + private final static Color LIGHT_GREY = new Color(190, 190, 190); + private final static Color VERY_DARK_GREY = new Color(5, 5, 5); + private final static Color SELECTED_COLOR = new Color(0.8f, 0.8f, 1.0f, 1.0f); + public final static int MARGIN = 15; private int getOffset() { 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 2cca23230..d6b5481d5 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 @@ -64,7 +64,7 @@ - + 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 8835b32c3..e29bf9723 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 @@ -373,7 +373,7 @@ public final class MatDefEditorlElement extends JPanel implements MultiViewEleme jScrollPane1.setMinimumSize(new java.awt.Dimension(0, 0)); jScrollPane1.setName(""); // NOI18N - diagram1.setBackground(new java.awt.Color(153, 153, 153)); + diagram1.setBackground(new java.awt.Color(102, 102, 102)); javax.swing.GroupLayout diagram1Layout = new javax.swing.GroupLayout(diagram1); diagram1.setLayout(diagram1Layout); 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 723cbcd91..62b54428b 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 @@ -52,7 +52,7 @@ public class NodePanel extends DraggablePanel implements Selectable, PropertyCha private Color color; private String name; private String techName; - protected List filePaths= new ArrayList(); + protected List filePaths = new ArrayList(); // private List listeners = Collections.synchronizedList(new LinkedList()); // @@ -95,6 +95,7 @@ public class NodePanel extends DraggablePanel implements Selectable, PropertyCha /** * Creates new form NodePanel */ + @SuppressWarnings("LeakingThisInConstructor") public NodePanel(ShaderNodeBlock node, ShaderNodeDefinition def) { super(); if (def.getType() == Shader.ShaderType.Vertex) { @@ -109,13 +110,14 @@ public class NodePanel extends DraggablePanel implements Selectable, PropertyCha refresh(node); addKeyListener(this); this.filePaths.addAll(def.getShadersPath()); - String defPath = ((DefinitionBlock)node.getContents().get(0)).getPath(); + String defPath = ((DefinitionBlock) node.getContents().get(0)).getPath(); this.filePaths.add(defPath); } /** * Creates new form NodePanel */ + @SuppressWarnings("LeakingThisInConstructor") public NodePanel(ShaderNodeVariable singleOut, NodePanel.NodeType type) { super(); List outputs = new ArrayList(); @@ -195,23 +197,24 @@ public class NodePanel extends DraggablePanel implements Selectable, PropertyCha Graphics2D g = (Graphics2D) g1; Color boderColor = Color.BLACK; if (diagram.selectedItem == this) { - boderColor = Color.WHITE; + boderColor = Color.WHITE; } g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, // Anti-alias! RenderingHints.VALUE_ANTIALIAS_ON); - Color[] colors = {new Color(0, 0, 0, 0.7f), new Color(0, 0, 0, 0.15f)}; + // Color[] colors = {new Color(0, 0, 0, 0.7f), new Color(0, 0, 0, 0.15f)}; if (diagram.selectedItem == this) { - colors = new Color[]{new Color(0.6f, 0.6f, 1.0f, 0.9f), new Color(0.6f, 0.6f, 1.0f, 0.5f)}; - } - float[] factors = {0f, 1f}; - g.setPaint(new RadialGradientPaint(getWidth() / 2, getHeight() / 2, getWidth() / 2, factors, colors)); - g.fillRoundRect(8, 3, getWidth() - 10, getHeight() - 6, 15, 15); - g.setColor(new Color(170, 170, 170)); + Color[] colors = new Color[]{new Color(0.6f, 0.6f, 1.0f, 0.8f), new Color(0.6f, 0.6f, 1.0f, 0.5f)}; + float[] factors = {0f, 1f}; + g.setPaint(new RadialGradientPaint(getWidth() / 2, getHeight() / 2, getWidth() / 2, factors, colors)); + g.fillRoundRect(8, 3, getWidth() - 10, getHeight() - 6, 15, 15); + } + + g.setColor(new Color(170, 170, 170, 120)); g.fillRoundRect(5, 1, getWidth() - 9, getHeight() - 6, 15, 15); g.setColor(boderColor); g.drawRoundRect(4, 0, getWidth() - 9, getHeight() - 6, 15, 15); - g.setColor(new Color(170, 170, 170)); + g.setColor(new Color(170, 170, 170, 120)); g.fillRect(4, 1, 10, 10); g.setColor(boderColor); g.drawLine(4, 0, 14, 0); @@ -261,7 +264,7 @@ public class NodePanel extends DraggablePanel implements Selectable, PropertyCha diagram.fixSize(); if (svdx != getLocation().x) { firePropertyChange(ShaderNodeBlock.POSITION, svdx, getLocation().x); - getDiagram().getEditorParent().savePositionToMetaData(getKey(), getLocation().x, getLocation().y); + getDiagram().getEditorParent().savePositionToMetaData(getKey(), getLocation().x, getLocation().y); } } @@ -305,8 +308,6 @@ public class NodePanel extends DraggablePanel implements Selectable, PropertyCha // private void initComponents() { - - ImageIcon icon = Icons.vert; if (type == NodeType.Fragment) { icon = Icons.frag; @@ -322,21 +323,19 @@ public class NodePanel extends DraggablePanel implements Selectable, PropertyCha @Override public void mouseClicked(MouseEvent e) { //if(e.getClickCount()==2){ - if (type==NodeType.Fragment || type == NodeType.Vertex) { - diagram.showEdit(NodePanel.this); - } + if (type == NodeType.Fragment || type == NodeType.Vertex) { + diagram.showEdit(NodePanel.this); + } //} } - + }); - + content = new JPanel(); content.setOpaque(false); GroupLayout contentLayout = new GroupLayout(content); content.setLayout(contentLayout); - - int txtLength = 100; GroupLayout.ParallelGroup grpHoriz = contentLayout.createParallelGroup(GroupLayout.Alignment.LEADING); @@ -371,7 +370,6 @@ public class NodePanel extends DraggablePanel implements Selectable, PropertyCha .addComponent(outputLabels.get(i))).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED); } - grpVert.addGroup(GroupLayout.Alignment.TRAILING, grp); contentLayout.setVerticalGroup(grpVert); @@ -381,17 +379,17 @@ public class NodePanel extends DraggablePanel implements Selectable, PropertyCha layout.setHorizontalGroup( layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(GroupLayout.Alignment.LEADING, layout.createSequentialGroup() - .addGap(6, 6, 6) - .addComponent(header, 100, 100, 100)) + .addGap(6, 6, 6) + .addComponent(header, 100, 100, 100)) .addGroup(GroupLayout.Alignment.LEADING, layout.createSequentialGroup() - .addGap(6, 6, 6)) + .addGap(6, 6, 6)) .addComponent(content, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); layout.setVerticalGroup( layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() - .addComponent(header, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addGap(10, 10, 10) - .addComponent(content, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addComponent(header, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addGap(10, 10, 10) + .addComponent(content, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(10, 10, 10)); } 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 118285034..42354cfd7 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 @@ -118,8 +118,8 @@ public class OutBusPanel extends DraggablePanel implements ComponentListener, Se g.fillPolygon(p2); } - Color c1 = new Color(100, 100, 100, 255); - Color c2 = new Color(100, 100, 100, 100); + Color c1 = new Color(50, 50, 50, 255); + Color c2 = new Color(50, 50, 50, 80); g.setPaint(new GradientPaint(0, 0, c1, width, 0, c2)); g.fillPolygon(p); g.fillRect(0, 10, 3, getHeight() - 20);