|
@@ -52,7 +52,7 @@ public class NodePanel extends DraggablePanel implements Selectable, PropertyCha
|
|
private Color color;
|
|
private Color color;
|
|
private String name;
|
|
private String name;
|
|
private String techName;
|
|
private String techName;
|
|
- protected List<String> filePaths= new ArrayList<String>();
|
|
|
|
|
|
+ protected List<String> filePaths = new ArrayList<String>();
|
|
|
|
|
|
// private List listeners = Collections.synchronizedList(new LinkedList());
|
|
// private List listeners = Collections.synchronizedList(new LinkedList());
|
|
//
|
|
//
|
|
@@ -95,6 +95,7 @@ public class NodePanel extends DraggablePanel implements Selectable, PropertyCha
|
|
/**
|
|
/**
|
|
* Creates new form NodePanel
|
|
* Creates new form NodePanel
|
|
*/
|
|
*/
|
|
|
|
+ @SuppressWarnings("LeakingThisInConstructor")
|
|
public NodePanel(ShaderNodeBlock node, ShaderNodeDefinition def) {
|
|
public NodePanel(ShaderNodeBlock node, ShaderNodeDefinition def) {
|
|
super();
|
|
super();
|
|
if (def.getType() == Shader.ShaderType.Vertex) {
|
|
if (def.getType() == Shader.ShaderType.Vertex) {
|
|
@@ -109,13 +110,14 @@ public class NodePanel extends DraggablePanel implements Selectable, PropertyCha
|
|
refresh(node);
|
|
refresh(node);
|
|
addKeyListener(this);
|
|
addKeyListener(this);
|
|
this.filePaths.addAll(def.getShadersPath());
|
|
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);
|
|
this.filePaths.add(defPath);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* Creates new form NodePanel
|
|
* Creates new form NodePanel
|
|
*/
|
|
*/
|
|
|
|
+ @SuppressWarnings("LeakingThisInConstructor")
|
|
public NodePanel(ShaderNodeVariable singleOut, NodePanel.NodeType type) {
|
|
public NodePanel(ShaderNodeVariable singleOut, NodePanel.NodeType type) {
|
|
super();
|
|
super();
|
|
List<ShaderNodeVariable> outputs = new ArrayList<ShaderNodeVariable>();
|
|
List<ShaderNodeVariable> outputs = new ArrayList<ShaderNodeVariable>();
|
|
@@ -195,23 +197,24 @@ public class NodePanel extends DraggablePanel implements Selectable, PropertyCha
|
|
Graphics2D g = (Graphics2D) g1;
|
|
Graphics2D g = (Graphics2D) g1;
|
|
Color boderColor = Color.BLACK;
|
|
Color boderColor = Color.BLACK;
|
|
if (diagram.selectedItem == this) {
|
|
if (diagram.selectedItem == this) {
|
|
- boderColor = Color.WHITE;
|
|
|
|
|
|
+ boderColor = Color.WHITE;
|
|
}
|
|
}
|
|
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, // Anti-alias!
|
|
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, // Anti-alias!
|
|
RenderingHints.VALUE_ANTIALIAS_ON);
|
|
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) {
|
|
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.fillRoundRect(5, 1, getWidth() - 9, getHeight() - 6, 15, 15);
|
|
g.setColor(boderColor);
|
|
g.setColor(boderColor);
|
|
|
|
|
|
g.drawRoundRect(4, 0, getWidth() - 9, getHeight() - 6, 15, 15);
|
|
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.fillRect(4, 1, 10, 10);
|
|
g.setColor(boderColor);
|
|
g.setColor(boderColor);
|
|
g.drawLine(4, 0, 14, 0);
|
|
g.drawLine(4, 0, 14, 0);
|
|
@@ -261,7 +264,7 @@ public class NodePanel extends DraggablePanel implements Selectable, PropertyCha
|
|
diagram.fixSize();
|
|
diagram.fixSize();
|
|
if (svdx != getLocation().x) {
|
|
if (svdx != getLocation().x) {
|
|
firePropertyChange(ShaderNodeBlock.POSITION, 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
|
|
// <editor-fold defaultstate="collapsed" desc="Generated Code">
|
|
// <editor-fold defaultstate="collapsed" desc="Generated Code">
|
|
private void initComponents() {
|
|
private void initComponents() {
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
ImageIcon icon = Icons.vert;
|
|
ImageIcon icon = Icons.vert;
|
|
if (type == NodeType.Fragment) {
|
|
if (type == NodeType.Fragment) {
|
|
icon = Icons.frag;
|
|
icon = Icons.frag;
|
|
@@ -322,21 +323,19 @@ public class NodePanel extends DraggablePanel implements Selectable, PropertyCha
|
|
@Override
|
|
@Override
|
|
public void mouseClicked(MouseEvent e) {
|
|
public void mouseClicked(MouseEvent e) {
|
|
//if(e.getClickCount()==2){
|
|
//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 = new JPanel();
|
|
content.setOpaque(false);
|
|
content.setOpaque(false);
|
|
GroupLayout contentLayout = new GroupLayout(content);
|
|
GroupLayout contentLayout = new GroupLayout(content);
|
|
content.setLayout(contentLayout);
|
|
content.setLayout(contentLayout);
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
int txtLength = 100;
|
|
int txtLength = 100;
|
|
|
|
|
|
GroupLayout.ParallelGroup grpHoriz = contentLayout.createParallelGroup(GroupLayout.Alignment.LEADING);
|
|
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);
|
|
.addComponent(outputLabels.get(i))).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED);
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
grpVert.addGroup(GroupLayout.Alignment.TRAILING, grp);
|
|
grpVert.addGroup(GroupLayout.Alignment.TRAILING, grp);
|
|
|
|
|
|
contentLayout.setVerticalGroup(grpVert);
|
|
contentLayout.setVerticalGroup(grpVert);
|
|
@@ -381,17 +379,17 @@ public class NodePanel extends DraggablePanel implements Selectable, PropertyCha
|
|
layout.setHorizontalGroup(
|
|
layout.setHorizontalGroup(
|
|
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
|
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
|
.addGroup(GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
|
|
.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()
|
|
.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));
|
|
.addComponent(content, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
|
|
layout.setVerticalGroup(
|
|
layout.setVerticalGroup(
|
|
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
|
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
|
.addGroup(layout.createSequentialGroup()
|
|
.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));
|
|
.addGap(10, 10, 10));
|
|
}
|
|
}
|
|
|
|
|