com.jme3.scene.plugins.blender.constraints
Class ConstraintHelper

java.lang.Object
  extended by com.jme3.scene.plugins.blender.AbstractBlenderHelper
      extended by com.jme3.scene.plugins.blender.constraints.ConstraintHelper

public class ConstraintHelper
extends AbstractBlenderHelper

This class should be used for constraint calculations.


Field Summary
 
Fields inherited from class com.jme3.scene.plugins.blender.AbstractBlenderHelper
blenderVersion, fixUpAxis, upAxisRotationQuaternion
 
Constructor Summary
ConstraintHelper(java.lang.String blenderVersion, BlenderContext blenderContext, boolean fixUpAxis)
          Helper constructor.
 
Method Summary
protected  Constraint createConstraint(Structure constraintStructure, java.lang.Long ownerOMA, Ipo influenceIpo, BlenderContext blenderContext)
          This method creates the constraint instance.
protected  java.lang.String getConstraintClassName(Structure constraintStructure, BlenderContext blenderContext)
           
 void loadConstraints(Structure objectStructure, BlenderContext blenderContext)
          This method reads constraints for for the given structure.
 boolean shouldBeLoaded(Structure structure, BlenderContext blenderContext)
          This method analyzes the given structure and the data contained within blender context and decides if the feature should be loaded.
 
Methods inherited from class com.jme3.scene.plugins.blender.AbstractBlenderHelper
applyProperties, clearState, isBlank, loadProperties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConstraintHelper

public ConstraintHelper(java.lang.String blenderVersion,
                        BlenderContext blenderContext,
                        boolean fixUpAxis)
Helper constructor. It's main task is to generate the affection functions. These functions are common to all ConstraintHelper instances. Unfortunately this constructor might grow large. If it becomes too large - I shall consider refactoring. The constructor parses the given blender version and stores the result. Some functionalities may differ in different blender versions.

Parameters:
blenderVersion - the version read from the blend file
fixUpAxis - a variable that indicates if the Y asxis is the UP axis or not
Method Detail

loadConstraints

public void loadConstraints(Structure objectStructure,
                            BlenderContext blenderContext)
                     throws BlenderFileException
This method reads constraints for for the given structure. The constraints are loaded only once for object/bone.

Parameters:
objectStructure - the structure we read constraint's for
blenderContext - the blender context
Throws:
BlenderFileException

createConstraint

protected Constraint createConstraint(Structure constraintStructure,
                                      java.lang.Long ownerOMA,
                                      Ipo influenceIpo,
                                      BlenderContext blenderContext)
                               throws BlenderFileException
This method creates the constraint instance.

Parameters:
constraintStructure - the constraint's structure (bConstraint clss in blender 2.49).
ownerOMA - the old memory address of the constraint's owner
influenceIpo - the ipo curve of the influence factor
blenderContext - the blender context
Throws:
BlenderFileException - this exception is thrown when the blender file is somehow corrupted

getConstraintClassName

protected java.lang.String getConstraintClassName(Structure constraintStructure,
                                                  BlenderContext blenderContext)
                                           throws BlenderFileException
Throws:
BlenderFileException

shouldBeLoaded

public boolean shouldBeLoaded(Structure structure,
                              BlenderContext blenderContext)
Description copied from class: AbstractBlenderHelper
This method analyzes the given structure and the data contained within blender context and decides if the feature should be loaded.

Specified by:
shouldBeLoaded in class AbstractBlenderHelper
Parameters:
structure - structure to be analyzed
blenderContext - the blender context
Returns:
true if the feature should be loaded and false otherwise