From 8ab7d72451a4d655b72ddbd8f64685da76acce2e Mon Sep 17 00:00:00 2001 From: normen667 Date: Tue, 5 Apr 2011 14:54:50 +0000 Subject: [PATCH] - account for flipped textures in material->j3m creation git-svn-id: http://jmonkeyengine.googlecode.com/svn/trunk@7192 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../src/com/jme3/gde/materials/MaterialProperty.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/sdk/jme3-materialeditor/src/com/jme3/gde/materials/MaterialProperty.java b/sdk/jme3-materialeditor/src/com/jme3/gde/materials/MaterialProperty.java index e5af20d59..0ac3459ae 100644 --- a/sdk/jme3-materialeditor/src/com/jme3/gde/materials/MaterialProperty.java +++ b/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"); } } -- 2.11.0