diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/curves/CurvesHelper.java b/engine/src/blender/com/jme3/scene/plugins/blender/curves/CurvesHelper.java index b11acb8e3..e3fd83226 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/curves/CurvesHelper.java +++ b/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); + } } } diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/objects/ObjectHelper.java b/engine/src/blender/com/jme3/scene/plugins/blender/objects/ObjectHelper.java index 782057547..a6c869fd7 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/objects/ObjectHelper.java +++ b/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); } } diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/textures/ImageUtils.java b/engine/src/blender/com/jme3/scene/plugins/blender/textures/ImageUtils.java index 40755f83e..66740769d 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/textures/ImageUtils.java +++ b/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; diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/textures/io/DDSPixelInputOutput.java b/engine/src/blender/com/jme3/scene/plugins/blender/textures/io/DDSPixelInputOutput.java index f83a062ab..d82f164a1 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/textures/io/DDSPixelInputOutput.java +++ b/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;