From 304550a0f4ff8424011af25c877d096d008bf459 Mon Sep 17 00:00:00 2001 From: NemesisMate Date: Wed, 7 Nov 2018 18:05:33 +0100 Subject: [PATCH] Fix #324. Blender importer now respects the lightNode pos in the graph The light is still being added, however, to the scene root node as this is the blender behavior and a wysiwyg is desired. --- .../com/jme3/scene/plugins/blender/BlenderLoader.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/jme3-blender/src/main/java/com/jme3/scene/plugins/blender/BlenderLoader.java b/jme3-blender/src/main/java/com/jme3/scene/plugins/blender/BlenderLoader.java index f519cb9b5..51df79d29 100644 --- a/jme3-blender/src/main/java/com/jme3/scene/plugins/blender/BlenderLoader.java +++ b/jme3-blender/src/main/java/com/jme3/scene/plugins/blender/BlenderLoader.java @@ -245,16 +245,18 @@ public class BlenderLoader implements AssetLoader { Structure objectStructure = pObject.fetchData().get(0); Object object = objectHelper.toObject(objectStructure, blenderContext); - if (object instanceof LightNode) { - result.addLight(((LightNode) object).getLight());// FIXME: check if this is needed !!! - result.attachChild((LightNode) object); - } else if (object instanceof Node) { + if (object instanceof Node) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "{0}: {1}--> {2}", new Object[] { ((Node) object).getName(), ((Node) object).getLocalTranslation().toString(), ((Node) object).getParent() == null ? "null" : ((Node) object).getParent().getName() }); } + if (((Node) object).getParent() == null) { result.attachChild((Spatial) object); } + + if(object instanceof LightNode) { + result.addLight(((LightNode) object).getLight()); + } } } }