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
This commit is contained in:
Kae..pl 2013-04-29 11:30:26 +00:00
parent 29dd973122
commit 3602d86c20

View File

@ -45,9 +45,17 @@ import com.jme3.scene.plugins.blender.file.Structure;
public boolean validate() { public boolean validate() {
if (targetOMA != null) { if (targetOMA != null) {
Spatial nodeTarget = (Spatial) blenderContext.getLoadedFeature(targetOMA, LoadedFeatureDataType.LOADED_FEATURE); 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 // the second part of the if expression verifies if the found node
// (if any) is an armature 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, // if the target is not an object node then it is an Armature,
// so make sure the bone is in the current skeleton // so make sure the bone is in the current skeleton
BoneContext boneContext = blenderContext.getBoneContext(ownerOMA); BoneContext boneContext = blenderContext.getBoneContext(ownerOMA);