2
0
Эх сурвалжийг харах

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
Kae..pl 12 жил өмнө
parent
commit
3602d86c20

+ 9 - 1
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);