Browse Source

* Material.setParam() now calls setTextureParam() instead of messing up internal state if the type is a texture

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10209 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
sha..RD 12 years ago
parent
commit
84183ad154
1 changed files with 13 additions and 9 deletions
  1. 13 9
      engine/src/core/com/jme3/material/Material.java

+ 13 - 9
engine/src/core/com/jme3/material/Material.java

@@ -459,16 +459,20 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable {
     public void setParam(String name, VarType type, Object value) {
         checkSetParam(type, name);
         
-        MatParam val = getParam(name);
-        if (val == null) {
-            MatParam paramDef = def.getMaterialParam(name);
-            paramValues.put(name, new MatParam(type, name, value, paramDef.getFixedFuncBinding()));
+        if (type.isTextureType()) {
+            setTextureParam(name, type, (Texture)value);
         } else {
-            val.setValue(value);
-        }
-        
-        if (technique != null) {
-            technique.notifyParamChanged(name, type, value);
+            MatParam val = getParam(name);
+            if (val == null) {
+                MatParam paramDef = def.getMaterialParam(name);
+                paramValues.put(name, new MatParam(type, name, value, paramDef.getFixedFuncBinding()));
+            } else {
+                val.setValue(value);
+            }
+
+            if (technique != null) {
+                technique.notifyParamChanged(name, type, value);
+            }
         }
     }