Pārlūkot izejas kodu

Bugfix: several minor bugfixes and improvements.

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10817 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
Kae..pl 12 gadi atpakaļ
vecāks
revīzija
04ed5d1467

+ 6 - 4
engine/src/blender/com/jme3/scene/plugins/blender/curves/CurvesHelper.java

@@ -238,11 +238,13 @@ public class CurvesHelper extends AbstractBlenderHelper {
         }
 
         // reading custom properties
-        if (blenderContext.getBlenderKey().isLoadObjectProperties()) {
+        if (blenderContext.getBlenderKey().isLoadObjectProperties() && result.size() > 0) {
             Properties properties = this.loadProperties(curveStructure, blenderContext);
-            // the loaded property is a group property, so we need to get each value and set it to Spatial
-            if (result instanceof Spatial && properties != null && properties.getValue() != null) {
-                this.applyProperties((Spatial) result, properties);
+            // the loaded property is a group property, so we need to get each value and set it to every geometry of the curve
+            if (properties != null && properties.getValue() != null) {
+                for(Geometry geom : result) {
+                    this.applyProperties(geom, properties);
+                }
             }
         }
 

+ 1 - 1
engine/src/blender/com/jme3/scene/plugins/blender/objects/ObjectHelper.java

@@ -214,7 +214,7 @@ public class ObjectHelper extends AbstractBlenderHelper {
                 Properties properties = this.loadProperties(objectStructure, blenderContext);
                 // the loaded property is a group property, so we need to get
                 // each value and set it to Spatial
-                if (result instanceof Spatial && properties != null && properties.getValue() != null) {
+                if (properties != null && properties.getValue() != null) {
                     this.applyProperties(result, properties);
                 }
             }

+ 2 - 1
engine/src/blender/com/jme3/scene/plugins/blender/textures/ImageUtils.java

@@ -336,7 +336,8 @@ public final class ImageUtils {
                             TexturePixel[] colors = new TexturePixel[] { new TexturePixel(), new TexturePixel(), new TexturePixel(), new TexturePixel() };
                             alphas[0] = data.get() * 255.0f;
                             alphas[1] = data.get() * 255.0f;
-                            long alphaIndices = data.get() | data.get() << 8 | data.get() << 16 | data.get() << 24 | data.get() << 32 | data.get() << 40;
+                            //the casts to long must be done here because otherwise 32-bit integers would be shifetd by 32 and 40 bits which would result in improper values
+                            long alphaIndices = (long)data.get() | (long)data.get() << 8 | (long)data.get() << 16 | (long)data.get() << 24 | (long)data.get() << 32 | (long)data.get() << 40;
                             if (alphas[0] > alphas[1]) {// 6 interpolated alpha values.
                                 alphas[2] = (6 * alphas[0] + alphas[1]) / 7;
                                 alphas[3] = (5 * alphas[0] + 2 * alphas[1]) / 7;

+ 2 - 1
engine/src/blender/com/jme3/scene/plugins/blender/textures/io/DDSPixelInputOutput.java

@@ -102,7 +102,8 @@ import jme3tools.converters.RGB565;
                 alphas = new float[8];
                 alphas[0] = data.get() * 255.0f;
                 alphas[1] = data.get() * 255.0f;
-                alphaIndexes = data.get() | data.get() << 8 | data.get() << 16 | data.get() << 24 | data.get() << 32 | data.get() << 40;
+                // the casts to long must be done here because otherwise 32-bit integers would be shifetd by 32 and 40 bits which would result in improper values
+                alphaIndexes = (long)data.get() | (long)data.get() << 8 | (long)data.get() << 16 | (long)data.get() << 24 | (long)data.get() << 32 | (long)data.get() << 40;
                 if (alphas[0] > alphas[1]) {// 6 interpolated alpha values.
                     alphas[2] = (6 * alphas[0] + alphas[1]) / 7;
                     alphas[3] = (5 * alphas[0] + 2 * alphas[1]) / 7;