com.jme3.scene.plugins.blender.objects
Class ObjectHelper

java.lang.Object
  extended by com.jme3.scene.plugins.blender.AbstractBlenderHelper
      extended by com.jme3.scene.plugins.blender.objects.ObjectHelper

public class ObjectHelper
extends AbstractBlenderHelper

A class that is used in object calculations.


Field Summary
protected static int OBJECT_TYPE_ARMATURE
           
protected static int OBJECT_TYPE_CAMERA
           
protected static int OBJECT_TYPE_CURVE
           
protected static int OBJECT_TYPE_EMPTY
           
protected static int OBJECT_TYPE_LAMP
           
protected static int OBJECT_TYPE_LATTICE
           
protected static int OBJECT_TYPE_MESH
           
protected static int OBJECT_TYPE_METABALL
           
protected static int OBJECT_TYPE_SURF
           
protected static int OBJECT_TYPE_TEXT
           
protected static int OBJECT_TYPE_WAVE
           
 
Fields inherited from class com.jme3.scene.plugins.blender.AbstractBlenderHelper
blenderVersion, fixUpAxis, upAxisRotationQuaternion
 
Constructor Summary
ObjectHelper(java.lang.String blenderVersion, boolean fixUpAxis)
          This constructor parses the given blender version and stores the result.
 
Method Summary
 void clearState()
          This method clears the state of the helper so that it can be used for different calculations of another feature.
 Matrix4f getMatrix(Structure structure, java.lang.String matrixName)
          This method returns the matrix of a given name for the given structure.
 Matrix4f getMatrix(Structure structure, java.lang.String matrixName, boolean applyFixUpAxis)
          This method returns the matrix of a given name for the given structure.
 Vector3f getScale(Matrix4f matrix)
          This method returns the scale from the given matrix.
 Transform getTransformation(Structure objectStructure, BlenderContext blenderContext)
          This method calculates local transformation for the object.
 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.
 java.lang.Object toObject(Structure objectStructure, BlenderContext blenderContext)
          This method reads the given structure and createn an object that represents the data.
 
Methods inherited from class com.jme3.scene.plugins.blender.AbstractBlenderHelper
applyProperties, isBlank, loadProperties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OBJECT_TYPE_EMPTY

protected static final int OBJECT_TYPE_EMPTY
See Also:
Constant Field Values

OBJECT_TYPE_MESH

protected static final int OBJECT_TYPE_MESH
See Also:
Constant Field Values

OBJECT_TYPE_CURVE

protected static final int OBJECT_TYPE_CURVE
See Also:
Constant Field Values

OBJECT_TYPE_SURF

protected static final int OBJECT_TYPE_SURF
See Also:
Constant Field Values

OBJECT_TYPE_TEXT

protected static final int OBJECT_TYPE_TEXT
See Also:
Constant Field Values

OBJECT_TYPE_METABALL

protected static final int OBJECT_TYPE_METABALL
See Also:
Constant Field Values

OBJECT_TYPE_LAMP

protected static final int OBJECT_TYPE_LAMP
See Also:
Constant Field Values

OBJECT_TYPE_CAMERA

protected static final int OBJECT_TYPE_CAMERA
See Also:
Constant Field Values

OBJECT_TYPE_WAVE

protected static final int OBJECT_TYPE_WAVE
See Also:
Constant Field Values

OBJECT_TYPE_LATTICE

protected static final int OBJECT_TYPE_LATTICE
See Also:
Constant Field Values

OBJECT_TYPE_ARMATURE

protected static final int OBJECT_TYPE_ARMATURE
See Also:
Constant Field Values
Constructor Detail

ObjectHelper

public ObjectHelper(java.lang.String blenderVersion,
                    boolean fixUpAxis)
This 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

toObject

public java.lang.Object toObject(Structure objectStructure,
                                 BlenderContext blenderContext)
                          throws BlenderFileException
This method reads the given structure and createn an object that represents the data.

Parameters:
objectStructure - the object's structure
blenderContext - the blender context
Returns:
blener's object representation
Throws:
BlenderFileException - an exception is thrown when the given data is inapropriate

getTransformation

public Transform getTransformation(Structure objectStructure,
                                   BlenderContext blenderContext)
This method calculates local transformation for the object. Parentage is taken under consideration.

Parameters:
objectStructure - the object's structure
Returns:
objects transformation relative to its parent

getMatrix

public Matrix4f getMatrix(Structure structure,
                          java.lang.String matrixName)
This method returns the matrix of a given name for the given structure. The matrix is NOT transformed if Y axis is up - the raw data is loaded from the blender file.

Parameters:
structure - the structure with matrix data
matrixName - the name of the matrix
Returns:
the required matrix

getMatrix

public Matrix4f getMatrix(Structure structure,
                          java.lang.String matrixName,
                          boolean applyFixUpAxis)
This method returns the matrix of a given name for the given structure. It takes up axis into consideration.

Parameters:
structure - the structure with matrix data
matrixName - the name of the matrix
Returns:
the required matrix

getScale

public Vector3f getScale(Matrix4f matrix)
This method returns the scale from the given matrix.

Parameters:
matrix - the transformation matrix
Returns:
the scale from the given matrix

clearState

public void clearState()
Description copied from class: AbstractBlenderHelper
This method clears the state of the helper so that it can be used for different calculations of another feature.

Overrides:
clearState in class AbstractBlenderHelper

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