From b8896f394856e51171598fb7bce1d77af34a560d Mon Sep 17 00:00:00 2001 From: "Kae..pl" Date: Tue, 24 Apr 2012 12:54:10 +0000 Subject: [PATCH] Added variable to BlenderKey that would allow to suspend object properties loading. git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9324 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../blender/com/jme3/asset/BlenderKey.java | 20 ++++++++++++++++++- .../plugins/blender/objects/ObjectHelper.java | 8 +++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/engine/src/blender/com/jme3/asset/BlenderKey.java b/engine/src/blender/com/jme3/asset/BlenderKey.java index a09868213..4e791656e 100644 --- a/engine/src/blender/com/jme3/asset/BlenderKey.java +++ b/engine/src/blender/com/jme3/asset/BlenderKey.java @@ -99,7 +99,9 @@ public class BlenderKey extends ModelKey { * If set to -1 then the current layer will be loaded. */ protected int layersToLoad = -1; - + /** A variable that toggles the object custom properties loading. */ + protected boolean loadObjectProperties = true; + /** * Constructor used by serialization mechanisms. */ @@ -216,6 +218,22 @@ public class BlenderKey extends ModelKey { return layersToLoad; } + /** + * This method sets the properies loading policy. + * By default the value is true. + * @param loadObjectProperties true to load properties and false to suspend their loading + */ + public void setLoadObjectProperties(boolean loadObjectProperties) { + this.loadObjectProperties = loadObjectProperties; + } + + /** + * @return the current properties loading properties + */ + public boolean isLoadObjectProperties() { + return loadObjectProperties; + } + /** * This method sets the asset root path. * @param assetRootPath 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 ed14a11af..f9ab647ef 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 @@ -274,9 +274,11 @@ public class ObjectHelper extends AbstractBlenderHelper { } //reading custom properties - Properties properties = this.loadProperties(objectStructure, blenderContext); - if(result instanceof Spatial && properties != null && properties.getValue() != null) { - ((Spatial)result).setUserData("properties", properties); + if(blenderContext.getBlenderKey().isLoadObjectProperties()) { + Properties properties = this.loadProperties(objectStructure, blenderContext); + if(result instanceof Spatial && properties != null && properties.getValue() != null) { + ((Spatial)result).setUserData("properties", properties); + } } } return result;