From 3602d86c201fcd54ca8df742f6469bc823fcfa92 Mon Sep 17 00:00:00 2001 From: "Kae..pl" Date: Mon, 29 Apr 2013 11:30:26 +0000 Subject: [PATCH] Bugfix: fixed a bug that caused a bone constraint to be properly validated even though its bone target was not defined. git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10584 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../plugins/blender/constraints/BoneConstraint.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/constraints/BoneConstraint.java b/engine/src/blender/com/jme3/scene/plugins/blender/constraints/BoneConstraint.java index 6143f53d8..12229d68c 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/constraints/BoneConstraint.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/constraints/BoneConstraint.java @@ -45,9 +45,17 @@ import com.jme3.scene.plugins.blender.file.Structure; public boolean validate() { if (targetOMA != null) { Spatial nodeTarget = (Spatial) blenderContext.getLoadedFeature(targetOMA, LoadedFeatureDataType.LOADED_FEATURE); + if(nodeTarget == null) { + LOGGER.log(Level.WARNING, "Cannot find target for constraint: {0}.", name); + return false; + } // the second part of the if expression verifies if the found node // (if any) is an armature node - if (nodeTarget == null || nodeTarget.getUserData(ArmatureHelper.ARMETURE_NODE_MARKER) != null) { + if (nodeTarget.getUserData(ArmatureHelper.ARMATURE_NODE_MARKER) != null) { + if(subtargetName.trim().isEmpty()) { + LOGGER.log(Level.WARNING, "No bone target specified for constraint: {0}.", name); + return false; + } // if the target is not an object node then it is an Armature, // so make sure the bone is in the current skeleton BoneContext boneContext = blenderContext.getBoneContext(ownerOMA);