From d2e6648eb36ee69fadc6fa39fe0970287248bfe9 Mon Sep 17 00:00:00 2001 From: "Kae..pl" Date: Fri, 14 Sep 2012 11:32:38 +0000 Subject: [PATCH] Bugfix: solved problem when one 2D texture was about to be cast on other 2D texture while they had exactly the same UV coordinates. git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9729 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../blender/textures/CombinedTexture.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/textures/CombinedTexture.java b/engine/src/blender/com/jme3/scene/plugins/blender/textures/CombinedTexture.java index 70dae5be0..0412126e0 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/textures/CombinedTexture.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/textures/CombinedTexture.java @@ -93,7 +93,7 @@ public class CombinedTexture { textureData.projectionType = UVProjectionType.valueOf(projectionType); textureData.textureStructure = textureStructure; - if (this.isWithoutAlpha(textureData, blenderContext)) { + if (textureDatas.size() > 0 && this.isWithoutAlpha(textureData, blenderContext)) { textureDatas.clear();// clear previous textures, they will be covered anyway } textureDatas.add(textureData); @@ -238,18 +238,18 @@ public class CombinedTexture { * the blender context */ public void castToUVS(CombinedTexture basicUVSOwner, BlenderContext blenderContext) { - if (!basicUVSOwner.wasTriangulated) { - throw new IllegalStateException("The given texture must be triangulated!"); - } - if (!this.wasTriangulated) { - resultTexture = new TriangulatedTexture((Texture2D) resultTexture, resultUVS, blenderContext); - resultUVS = ((TriangulatedTexture) resultTexture).getResultUVS(); - resultTexture = ((TriangulatedTexture) resultTexture).getResultTexture(); - } if (resultUVS.size() != basicUVSOwner.resultUVS.size()) { - throw new IllegalStateException("The amount of UV coordinates must be equal in order to cas one UV's onto another!"); + throw new IllegalStateException("The amount of UV coordinates must be equal in order to cast one UV's onto another!"); } if (!resultUVS.equals(basicUVSOwner.resultUVS)) { + if (!basicUVSOwner.wasTriangulated) { + throw new IllegalStateException("The given texture must be triangulated!"); + } + if (!this.wasTriangulated) { + resultTexture = new TriangulatedTexture((Texture2D) resultTexture, resultUVS, blenderContext); + resultUVS = ((TriangulatedTexture) resultTexture).getResultUVS(); + resultTexture = ((TriangulatedTexture) resultTexture).getResultTexture(); + } // casting algorithm TextureHelper textureHelper = blenderContext.getHelper(TextureHelper.class); ImageLoader imageLoader = new ImageLoader();