ソースを参照

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

Nehon 10 年 前
コミット
1cb9edd07a

+ 2 - 4
sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/MatDefEditorlElement.java

@@ -434,15 +434,13 @@ 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
+        MatDefBlock matDef = obj.getLookup().lookup(MatDefBlock.class);        
         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
+        MatDefBlock matDef = obj.getLookup().lookup(MatDefBlock.class);        
         WorldParamBlock param = new WorldParamBlock(name);
         getTechnique(matDef).addWorldParam(param);
     }

+ 4 - 3
sdk/jme3-materialeditor/src/com/jme3/gde/materials/MaterialPreviewRenderer.java

@@ -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());