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. 6
      sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/MatDefEditorlElement.java
  2. 7
      sdk/jme3-materialeditor/src/com/jme3/gde/materials/MaterialPreviewRenderer.java

@ -434,15 +434,13 @@ public final class MatDefEditorlElement extends JPanel implements MultiViewEleme
} }
public void notifyAddMapParam(String type, String name) { public void notifyAddMapParam(String type, String name) {
MatDefBlock matDef = obj.getLookup().lookup(MatDefBlock.class); 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); MatParamBlock param = new MatParamBlock(type, name, null, null);
matDef.addMatParam(param); matDef.addMatParam(param);
} }
public void notifyAddWorldParam(String name) { public void notifyAddWorldParam(String name) {
MatDefBlock matDef = obj.getLookup().lookup(MatDefBlock.class); MatDefBlock matDef = obj.getLookup().lookup(MatDefBlock.class);
//FIXME add a way to set fixed pipeline function and default value
WorldParamBlock param = new WorldParamBlock(name); WorldParamBlock param = new WorldParamBlock(name);
getTechnique(matDef).addWorldParam(param); getTechnique(matDef).addWorldParam(param);
} }

@ -112,7 +112,7 @@ public class MaterialPreviewRenderer implements SceneListener {
SceneApplication.getApplication().createPreview(request); SceneApplication.getApplication().createPreview(request);
} }
} catch (Exception e) { } 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) { public Material reloadMaterial(Material mat, DesktopAssetManager assetManager) {
MaterialKey key = new MaterialKey(mat.getMaterialDef().getAssetName()); //MaterialKey key = new MaterialKey(mat.getMaterialDef().getAssetName());
assetManager.deleteFromCache(key); ((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