- account for flipped textures in material->j3m creation

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7192 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 14 years ago
parent 93308146ea
commit 5c21723435
  1. 17
      sdk/jme3-materialeditor/src/com/jme3/gde/materials/MaterialProperty.java

@ -4,6 +4,8 @@
*/
package com.jme3.gde.materials;
import com.jme3.asset.AssetKey;
import com.jme3.asset.TextureKey;
import com.jme3.material.MatParam;
import com.jme3.math.ColorRGBA;
import com.jme3.texture.Texture2D;
@ -33,13 +35,18 @@ public class MaterialProperty {
Object obj = param.getValue();
this.value = obj.toString();
//TODO: change to correct string
if(obj instanceof ColorRGBA){
if (obj instanceof ColorRGBA) {
value = value.replaceAll("Color\\[([^\\]]*)\\]", "$1");
value = value.replaceAll(",", "");
}
else if(obj instanceof Texture2D)
{
value = value.replaceAll("Texture2D\\[name=([^,]*)\\,([^\\]]*)]", "$1");
} else if (obj instanceof Texture2D) {
AssetKey key = ((Texture2D) obj).getKey();
String flip = "";
if (key instanceof TextureKey) {
if (((TextureKey) key).isFlipY()) {
flip = "Flip ";
}
}
value = value.replaceAll("Texture2D\\[name=([^,]*)\\,([^\\]]*)]", flip + "$1");
}
}

Loading…
Cancel
Save