Some clean up in the ShaderNode editor

experimental
Nehon 10 years ago
parent 0167955e80
commit a047376d70
  1. 3
      sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/MatDefEditorlElement.java
  2. 7
      sdk/jme3-materialeditor/src/com/jme3/gde/materials/MaterialPreviewRenderer.java

@ -76,6 +76,7 @@ import org.openide.util.Lookup;
import org.openide.util.LookupEvent; import org.openide.util.LookupEvent;
import org.openide.util.LookupListener; import org.openide.util.LookupListener;
import org.openide.util.NbBundle.Messages; import org.openide.util.NbBundle.Messages;
import org.openide.util.WeakListeners;
import org.openide.util.lookup.InstanceContent; import org.openide.util.lookup.InstanceContent;
import org.openide.windows.TopComponent; import org.openide.windows.TopComponent;
@ -484,7 +485,7 @@ public final class MatDefEditorlElement extends JPanel implements MultiViewEleme
Dot leftDot = findConnectPoint(mapping.getLeftNameSpace(), mapping.getLeftVar(), true); Dot leftDot = findConnectPoint(mapping.getLeftNameSpace(), mapping.getLeftVar(), true);
Dot rightDot = findConnectPoint(mapping.getRightNameSpace(), mapping.getRightVar(), false); Dot rightDot = findConnectPoint(mapping.getRightNameSpace(), mapping.getRightVar(), false);
Connection conn = diagram1.connect(leftDot, rightDot); Connection conn = diagram1.connect(leftDot, rightDot);
mapping.addPropertyChangeListener(conn); mapping.addPropertyChangeListener(WeakListeners.propertyChange(conn, mapping));
conn.makeKey(mapping, diagram1.getCurrentTechniqueName()); conn.makeKey(mapping, diagram1.getCurrentTechniqueName());
} }

@ -94,11 +94,10 @@ public class MaterialPreviewRenderer implements SceneListener {
if (!init) { if (!init) {
init(); init();
} }
final DesktopAssetManager assetManager = (DesktopAssetManager) SceneApplication.getApplication().getAssetManager();
SceneApplication.getApplication().enqueue(new Callable<Material>() { SceneApplication.getApplication().enqueue(new Callable<Material>() {
public Material call() throws Exception { public Material call() throws Exception {
final Material mat = reloadMaterial(m, assetManager); final Material mat = reloadMaterial(m);
if (mat != null) { if (mat != null) {
java.awt.EventQueue.invokeLater(new Runnable() { java.awt.EventQueue.invokeLater(new Runnable() {
public void run() { public void run() {
@ -124,11 +123,9 @@ public class MaterialPreviewRenderer implements SceneListener {
} }
public Material reloadMaterial(Material mat, DesktopAssetManager assetManager) { public Material reloadMaterial(Material mat) {
//MaterialKey key = new MaterialKey(mat.getMaterialDef().getAssetName());
((ProjectAssetManager)mat.getMaterialDef().getAssetManager()).clearCache(); ((ProjectAssetManager)mat.getMaterialDef().getAssetManager()).clearCache();
//assetManager.clearCache();
//creating a dummy mat with the mat def of the mat to reload //creating a dummy mat with the mat def of the mat to reload
Material dummy = new Material(mat.getMaterialDef()); Material dummy = new Material(mat.getMaterialDef());

Loading…
Cancel
Save