Added functionality that will ignore modifiers that cause no changes to the model due to incomplete (but not invalid) definition. This caused errors when object had for example two armature modifiers and only the second one had armature model attached.

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10087 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
Kae..pl 12 years ago
parent e84105307c
commit 3d38b634d5
  1. 2
      engine/src/blender/com/jme3/scene/plugins/blender/modifiers/ArmatureModifier.java
  2. 13
      engine/src/blender/com/jme3/scene/plugins/blender/modifiers/Modifier.java
  3. 10
      engine/src/blender/com/jme3/scene/plugins/blender/modifiers/ModifierHelper.java

@ -177,6 +177,8 @@ import com.jme3.util.BufferUtils;
blenderContext.setAnimData(boneOma, animData); blenderContext.setAnimData(boneOma, animData);
} }
} }
} else {
modifying = false;
} }
} }
} }

@ -23,6 +23,12 @@ public abstract class Modifier {
/** This variable indicates if the modifier is invalid (<b>true</b>) or not (<b>false</b>). */ /** This variable indicates if the modifier is invalid (<b>true</b>) or not (<b>false</b>). */
protected boolean invalid; protected boolean invalid;
/**
* A variable that tells if the modifier causes modification. Some modifiers like ArmatureModifier might have no
* Armature object attached and thus not really modifying the feature. In such cases it is good to know if it is
* sense to add the modifier to the list of object's modifiers.
*/
protected boolean modifying = true;
/** /**
* This method applies the modifier to the given node. * This method applies the modifier to the given node.
@ -62,4 +68,11 @@ public abstract class Modifier {
invalid = pError.isNotNull(); invalid = pError.isNotNull();
return !invalid; return !invalid;
} }
/**
* @return <b>true</b> if the modifier causes feature's modification or <b>false</b> if not
*/
public boolean isModifying() {
return modifying;
}
} }

@ -101,9 +101,13 @@ public class ModifierHelper extends AbstractBlenderHelper {
} }
if (modifier != null) { if (modifier != null) {
result.add(modifier); if(modifier.isModifying()) {
blenderContext.addModifier(objectStructure.getOldMemoryAddress(), modifier); result.add(modifier);
alreadyReadModifiers.add(modifierType); blenderContext.addModifier(objectStructure.getOldMemoryAddress(), modifier);
alreadyReadModifiers.add(modifierType);
} else {
LOGGER.log(Level.WARNING, "The modifier {0} will cause no changes in the model. It will be ignored!", modifierStructure.getName());
}
} else { } else {
LOGGER.log(Level.WARNING, "Unsupported modifier type: {0}", modifierStructure.getType()); LOGGER.log(Level.WARNING, "Unsupported modifier type: {0}", modifierStructure.getType());
} }

Loading…
Cancel
Save