More drastic approach to clear the cache when updating the material definition in the shaderNode editor so that changes in shader files are properly taken into account

experimental
Nehon 10 years ago
parent 5917d699d6
commit 1cb9edd07a
  1. 2
      sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/MatDefEditorlElement.java
  2. 7
      sdk/jme3-materialeditor/src/com/jme3/gde/materials/MaterialPreviewRenderer.java

@ -435,14 +435,12 @@ public final class MatDefEditorlElement extends JPanel implements MultiViewEleme
public void notifyAddMapParam(String type, String name) {
MatDefBlock matDef = obj.getLookup().lookup(MatDefBlock.class);
//FIXME add a way to set fixed pipeline function and default value
MatParamBlock param = new MatParamBlock(type, name, null, null);
matDef.addMatParam(param);
}
public void notifyAddWorldParam(String name) {
MatDefBlock matDef = obj.getLookup().lookup(MatDefBlock.class);
//FIXME add a way to set fixed pipeline function and default value
WorldParamBlock param = new WorldParamBlock(name);
getTechnique(matDef).addWorldParam(param);
}

@ -112,7 +112,7 @@ public class MaterialPreviewRenderer implements SceneListener {
SceneApplication.getApplication().createPreview(request);
}
} catch (Exception e) {
Logger.getLogger(MaterialPreviewRenderer.class.getName()).log(Level.SEVERE, "Error rendering material" + e.getMessage());
Logger.getLogger(MaterialPreviewRenderer.class.getName()).log(Level.SEVERE, "Error rendering material{0}", e.getMessage());
}
}
});
@ -126,8 +126,9 @@ public class MaterialPreviewRenderer implements SceneListener {
public Material reloadMaterial(Material mat, DesktopAssetManager assetManager) {
MaterialKey key = new MaterialKey(mat.getMaterialDef().getAssetName());
assetManager.deleteFromCache(key);
//MaterialKey key = new MaterialKey(mat.getMaterialDef().getAssetName());
((ProjectAssetManager)mat.getMaterialDef().getAssetManager()).clearCache();
//assetManager.clearCache();
//creating a dummy mat with the mat def of the mat to reload
Material dummy = new Material(mat.getMaterialDef());

Loading…
Cancel
Save