|
@@ -31,8 +31,12 @@
|
|
|
*/
|
|
*/
|
|
|
package com.jme3.scene.plugins.blender.objects;
|
|
package com.jme3.scene.plugins.blender.objects;
|
|
|
|
|
|
|
|
|
|
+import java.util.Collection;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+import java.util.logging.Level;
|
|
|
|
|
+import java.util.logging.Logger;
|
|
|
|
|
+
|
|
|
import com.jme3.asset.BlenderKey.FeaturesToLoad;
|
|
import com.jme3.asset.BlenderKey.FeaturesToLoad;
|
|
|
-import com.jme3.export.Savable;
|
|
|
|
|
import com.jme3.light.DirectionalLight;
|
|
import com.jme3.light.DirectionalLight;
|
|
|
import com.jme3.light.Light;
|
|
import com.jme3.light.Light;
|
|
|
import com.jme3.light.PointLight;
|
|
import com.jme3.light.PointLight;
|
|
@@ -61,11 +65,6 @@ import com.jme3.scene.plugins.blender.lights.LightHelper;
|
|
|
import com.jme3.scene.plugins.blender.meshes.MeshHelper;
|
|
import com.jme3.scene.plugins.blender.meshes.MeshHelper;
|
|
|
import com.jme3.scene.plugins.blender.modifiers.Modifier;
|
|
import com.jme3.scene.plugins.blender.modifiers.Modifier;
|
|
|
import com.jme3.scene.plugins.blender.modifiers.ModifierHelper;
|
|
import com.jme3.scene.plugins.blender.modifiers.ModifierHelper;
|
|
|
-import java.util.Arrays;
|
|
|
|
|
-import java.util.Collection;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
-import java.util.logging.Level;
|
|
|
|
|
-import java.util.logging.Logger;
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* A class that is used in object calculations.
|
|
* A class that is used in object calculations.
|
|
@@ -279,24 +278,7 @@ public class ObjectHelper extends AbstractBlenderHelper {
|
|
|
Properties properties = this.loadProperties(objectStructure, blenderContext);
|
|
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
|
|
//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(result instanceof Spatial && properties != null && properties.getValue() != null) {
|
|
|
- List<String> propertyNames = properties.getSubPropertiesNames();
|
|
|
|
|
- if(propertyNames != null && propertyNames.size() > 0) {
|
|
|
|
|
- for(String propertyName : propertyNames) {
|
|
|
|
|
- Object value = properties.findValue(propertyName);
|
|
|
|
|
- if(value instanceof Savable || value instanceof Boolean || value instanceof String ||
|
|
|
|
|
- value instanceof Float || value instanceof Integer || value instanceof Long) {
|
|
|
|
|
- ((Spatial)result).setUserData(propertyName, value);
|
|
|
|
|
- } else if(value instanceof Double) {
|
|
|
|
|
- ((Spatial)result).setUserData(propertyName, ((Double) value).floatValue());
|
|
|
|
|
- } else if(value instanceof int[]) {
|
|
|
|
|
- ((Spatial)result).setUserData(propertyName, Arrays.toString((int[])value));
|
|
|
|
|
- } else if(value instanceof float[]) {
|
|
|
|
|
- ((Spatial)result).setUserData(propertyName, Arrays.toString((float[])value));
|
|
|
|
|
- } else if(value instanceof double[]) {
|
|
|
|
|
- ((Spatial)result).setUserData(propertyName, Arrays.toString((double[])value));
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ this.applyProperties((Spatial) result, properties);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -430,7 +412,7 @@ public class ObjectHelper extends AbstractBlenderHelper {
|
|
|
@Override
|
|
@Override
|
|
|
public boolean shouldBeLoaded(Structure structure, BlenderContext blenderContext) {
|
|
public boolean shouldBeLoaded(Structure structure, BlenderContext blenderContext) {
|
|
|
int lay = ((Number) structure.getFieldValue("lay")).intValue();
|
|
int lay = ((Number) structure.getFieldValue("lay")).intValue();
|
|
|
- return ((lay & blenderContext.getBlenderKey().getLayersToLoad()) != 0
|
|
|
|
|
- && (blenderContext.getBlenderKey().getFeaturesToLoad() & FeaturesToLoad.OBJECTS) != 0);
|
|
|
|
|
|
|
+ return (lay & blenderContext.getBlenderKey().getLayersToLoad()) != 0
|
|
|
|
|
+ && (blenderContext.getBlenderKey().getFeaturesToLoad() & FeaturesToLoad.OBJECTS) != 0;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|