Sfoglia il codice sorgente

Material name added.
Reading material's name from blender added.

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8945 75d07b2b-3a1a-0410-a2c5-0572b91ccdca

Kae..pl 14 anni fa
parent
commit
f232b11318

+ 1 - 0
engine/src/blender/com/jme3/scene/plugins/blender/materials/MaterialHelper.java

@@ -276,6 +276,7 @@ public class MaterialHelper extends AbstractBlenderHelper {
 			result.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
 			result.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
 		}
 		}
 		
 		
+		result.setName(materialContext.getName());
 		blenderContext.setMaterialContext(result, materialContext);
 		blenderContext.setMaterialContext(result, materialContext);
 		blenderContext.addLoadedFeatures(structure.getOldMemoryAddress(), structure.getName(), structure, result);
 		blenderContext.addLoadedFeatures(structure.getOldMemoryAddress(), structure.getName(), structure, result);
 		return result;
 		return result;

+ 18 - 0
engine/src/core/com/jme3/material/Material.java

@@ -85,6 +85,7 @@ public class Material implements Asset, Cloneable, Savable, Comparable<Material>
         additiveLight.setDepthWrite(false);
         additiveLight.setDepthWrite(false);
     }
     }
     private AssetKey key;
     private AssetKey key;
+    private String name;
     private MaterialDef def;
     private MaterialDef def;
     private ListMap<String, MatParam> paramValues = new ListMap<String, MatParam>();
     private ListMap<String, MatParam> paramValues = new ListMap<String, MatParam>();
     private Technique technique;
     private Technique technique;
@@ -132,6 +133,23 @@ public class Material implements Asset, Cloneable, Savable, Comparable<Material>
     public String getAssetName() {
     public String getAssetName() {
         return key != null ? key.getName() : null;
         return key != null ? key.getName() : null;
     }
     }
+    
+    /**
+     * @return the name of the material (not the same as the asset name), the returned value can be null
+     */
+    public String getName() {
+		return name;
+	}
+    
+    /**
+     * This method sets the name of the material.
+     * The name is not the same as the asset name.
+     * It can be null and there is no guarantee of its uniqness.
+     * @param name the name of the material
+     */
+    public void setName(String name) {
+		this.name = name;
+	}
 
 
     public void setKey(AssetKey key) {
     public void setKey(AssetKey key) {
         this.key = key;
         this.key = key;