com.jme3.asset
Class BlenderKey

java.lang.Object
  extended by com.jme3.asset.AssetKey<Spatial>
      extended by com.jme3.asset.ModelKey
          extended by com.jme3.asset.BlenderKey
All Implemented Interfaces:
Savable, java.lang.Cloneable

public class BlenderKey
extends ModelKey

Blender key. Contains path of the blender file and its loading properties.


Nested Class Summary
static interface BlenderKey.FeaturesToLoad
          This interface describes the features of the scene that are to be loaded.
static class BlenderKey.LoadingResults
          This class holds the loading results according to the given loading flag.
static class BlenderKey.WorldData
          The WORLD file block contains various data that could be added to the scene.
 
Field Summary
protected  java.lang.String assetRootPath
          The root path for all the assets.
protected static int DEFAULT_FPS
           
protected  Material defaultMaterial
          User's default material that is set fo objects that have no material definition in blender.
protected  RenderState.FaceCullMode faceCullMode
          Face cull mode.
protected  int featuresToLoad
          This variable is a bitwise flag of FeatureToLoad interface values; By default everything is being loaded.
protected  boolean fixUpAxis
          This variable indicate if Y axis is UP axis.
protected  int fps
          FramesPerSecond parameter describe how many frames there are in each second.
protected  int generatedTexturePPU
          Generated textures resolution (PPU - Pixels Per Unit).
protected  int layersToLoad
          Variable describes which layers will be loaded.
protected  boolean loadObjectProperties
          A variable that toggles the object custom properties loading.
protected  boolean loadUnlinkedAssets
          This variable determines if assets that are not linked to the objects should be loaded.
protected  int maxTextureSize
          Maximum texture size.
protected  java.lang.String usedWorld
          The name of world settings that the importer will use.
 
Fields inherited from class com.jme3.asset.AssetKey
extension, folder, name
 
Constructor Summary
BlenderKey()
          Constructor used by serialization mechanisms.
BlenderKey(java.lang.String name)
          Constructor.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 void excludeFromLoading(int featuresNotToLoad)
          This method removes features from being loaded.
 java.lang.String getAssetRootPath()
          This method returns the asset root path.
 Material getDefaultMaterial()
          This method returns the default material.
 RenderState.FaceCullMode getFaceCullMode()
          This method returns the face cull mode.
 int getFeaturesToLoad()
          This method returns bitwise value of FeaturesToLoad interface value.
 int getFps()
          This method returns frames per second amount.
 int getGeneratedTexturePPU()
           
 int getLayersToLoad()
          This method returns layers to be loaded.
 int getMaxTextureSize()
           
 java.lang.String getUsedWorld()
          This mehtod returns the name of the WORLD data block taht should be used during file loading.
 int hashCode()
           
 void includeInLoading(int featuresToLoad)
          This method adds features to be loaded.
 boolean isFixUpAxis()
          This method returns the fix up axis state.
 boolean isLoadObjectProperties()
           
 boolean isLoadUnlinkedAssets()
          This method determines if unlinked assets should be loaded.
 BlenderKey.LoadingResults prepareLoadingResults()
          This method creates an object where loading results will be stores.
 void read(JmeImporter e)
           
 void setAssetRootPath(java.lang.String assetRootPath)
          This method sets the asset root path.
 void setDefaultMaterial(Material defaultMaterial)
          This method sets the default material for objects.
 void setFaceCullMode(RenderState.FaceCullMode faceCullMode)
          This method sets the face cull mode.
 void setFixUpAxis(boolean fixUpAxis)
          This method sets the fix up axis state.
 void setFps(int fps)
          This method sets frames per second amount.
 void setGeneratedTexturePPU(int generatedTexturePPU)
          This method sets the generated textures resolution.
 void setLayersToLoad(int layersToLoad)
          This method sets layers to be loaded.
 void setLoadObjectProperties(boolean loadObjectProperties)
          This method sets the properies loading policy.
 void setLoadUnlinkedAssets(boolean loadUnlinkedAssets)
          This method sets if unlinked assets should be loaded.
 void setMaxTextureSize(int maxTextureSize)
          This method sets the maximum texture size.
 void setUsedWorld(java.lang.String usedWorld)
          This mehtod sets the name of the WORLD data block taht should be used during file loading.
 void write(JmeExporter e)
           
 
Methods inherited from class com.jme3.asset.ModelKey
getCacheType, getProcessorType
 
Methods inherited from class com.jme3.asset.AssetKey
clone, getExtension, getExtension, getFolder, getFolder, getName, reducePath, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_FPS

protected static final int DEFAULT_FPS
See Also:
Constant Field Values

fps

protected int fps
FramesPerSecond parameter describe how many frames there are in each second. It allows to calculate the time between the frames.


featuresToLoad

protected int featuresToLoad
This variable is a bitwise flag of FeatureToLoad interface values; By default everything is being loaded.


loadUnlinkedAssets

protected boolean loadUnlinkedAssets
This variable determines if assets that are not linked to the objects should be loaded.


assetRootPath

protected java.lang.String assetRootPath
The root path for all the assets.


fixUpAxis

protected boolean fixUpAxis
This variable indicate if Y axis is UP axis. If not then Z is up. By default set to true.


generatedTexturePPU

protected int generatedTexturePPU
Generated textures resolution (PPU - Pixels Per Unit).


usedWorld

protected java.lang.String usedWorld
The name of world settings that the importer will use. If not set or specified name does not occur in the file then the first world settings in the file will be used.


defaultMaterial

protected Material defaultMaterial
User's default material that is set fo objects that have no material definition in blender. The default value is null. If the value is null the importer will use its own default material (gray color - like in blender).


faceCullMode

protected RenderState.FaceCullMode faceCullMode
Face cull mode. By default it is disabled.


layersToLoad

protected int layersToLoad
Variable describes which layers will be loaded. N-th bit set means N-th layer will be loaded. If set to -1 then the current layer will be loaded.


loadObjectProperties

protected boolean loadObjectProperties
A variable that toggles the object custom properties loading.


maxTextureSize

protected int maxTextureSize
Maximum texture size. Might be dependant on the graphic card.

Constructor Detail

BlenderKey

public BlenderKey()
Constructor used by serialization mechanisms.


BlenderKey

public BlenderKey(java.lang.String name)
Constructor. Creates a key for the given file name.

Parameters:
name - the name (path) of a file
Method Detail

getFps

public int getFps()
This method returns frames per second amount. The default value is BlenderKey.DEFAULT_FPS = 25.

Returns:
the frames per second amount

setFps

public void setFps(int fps)
This method sets frames per second amount.

Parameters:
fps - the frames per second amount

getFaceCullMode

public RenderState.FaceCullMode getFaceCullMode()
This method returns the face cull mode.

Returns:
the face cull mode

setFaceCullMode

public void setFaceCullMode(RenderState.FaceCullMode faceCullMode)
This method sets the face cull mode.

Parameters:
faceCullMode - the face cull mode

setLayersToLoad

public void setLayersToLoad(int layersToLoad)
This method sets layers to be loaded.

Parameters:
layersToLoad - layers to be loaded

getLayersToLoad

public int getLayersToLoad()
This method returns layers to be loaded.

Returns:
layers to be loaded

setLoadObjectProperties

public void setLoadObjectProperties(boolean loadObjectProperties)
This method sets the properies loading policy. By default the value is true.

Parameters:
loadObjectProperties - true to load properties and false to suspend their loading

isLoadObjectProperties

public boolean isLoadObjectProperties()
Returns:
the current properties loading properties

getMaxTextureSize

public int getMaxTextureSize()
Returns:
maximum texture size (width/height)

setMaxTextureSize

public void setMaxTextureSize(int maxTextureSize)
This method sets the maximum texture size.

Parameters:
maxTextureSize - the maximum texture size

setAssetRootPath

public void setAssetRootPath(java.lang.String assetRootPath)
This method sets the asset root path.

Parameters:
assetRootPath - the assets root path

getAssetRootPath

public java.lang.String getAssetRootPath()
This method returns the asset root path.

Returns:
the asset root path

includeInLoading

public void includeInLoading(int featuresToLoad)
This method adds features to be loaded.

Parameters:
featuresToLoad - bitwise flag of FeaturesToLoad interface values

excludeFromLoading

public void excludeFromLoading(int featuresNotToLoad)
This method removes features from being loaded.

Parameters:
featuresNotToLoad - bitwise flag of FeaturesToLoad interface values

getFeaturesToLoad

public int getFeaturesToLoad()
This method returns bitwise value of FeaturesToLoad interface value. It describes features that will be loaded by the blender file loader.

Returns:
features that will be loaded by the blender file loader

isLoadUnlinkedAssets

public boolean isLoadUnlinkedAssets()
This method determines if unlinked assets should be loaded. If not then only objects on selected layers will be loaded and their assets if required. If yes then all assets will be loaded even if they are on inactive layers or are not linked to anything.

Returns:
true if unlinked assets should be loaded and false otherwise

setLoadUnlinkedAssets

public void setLoadUnlinkedAssets(boolean loadUnlinkedAssets)
This method sets if unlinked assets should be loaded. If not then only objects on selected layers will be loaded and their assets if required. If yes then all assets will be loaded even if they are on inactive layers or are not linked to anything.

Parameters:
loadUnlinkedAssets - true if unlinked assets should be loaded and false otherwise

prepareLoadingResults

public BlenderKey.LoadingResults prepareLoadingResults()
This method creates an object where loading results will be stores. Only those features will be allowed to store that were specified by features-to-load flag.

Returns:
an object to store loading results

setFixUpAxis

public void setFixUpAxis(boolean fixUpAxis)
This method sets the fix up axis state. If set to true then Y is up axis. Otherwise the up i Z axis. By default Y is up axis.

Parameters:
fixUpAxis - the up axis state variable

isFixUpAxis

public boolean isFixUpAxis()
This method returns the fix up axis state. If set to true then Y is up axis. Otherwise the up i Z axis. By default Y is up axis.

Returns:
the up axis state variable

setGeneratedTexturePPU

public void setGeneratedTexturePPU(int generatedTexturePPU)
This method sets the generated textures resolution.

Parameters:
generatedTexturePPU - the generated textures resolution

getGeneratedTexturePPU

public int getGeneratedTexturePPU()
Returns:
the generated textures resolution

setUsedWorld

public void setUsedWorld(java.lang.String usedWorld)
This mehtod sets the name of the WORLD data block taht should be used during file loading. By default the name is not set. If no name is set or the given name does not occur in the file - the first WORLD data block will be used during loading (assumin any exists in the file).

Parameters:
usedWorld - the name of the WORLD block used during loading

getUsedWorld

public java.lang.String getUsedWorld()
This mehtod returns the name of the WORLD data block taht should be used during file loading.

Returns:
the name of the WORLD block used during loading

setDefaultMaterial

public void setDefaultMaterial(Material defaultMaterial)
This method sets the default material for objects.

Parameters:
defaultMaterial - the default material

getDefaultMaterial

public Material getDefaultMaterial()
This method returns the default material.

Returns:
the default material

write

public void write(JmeExporter e)
           throws java.io.IOException
Specified by:
write in interface Savable
Overrides:
write in class AssetKey<Spatial>
Throws:
java.io.IOException

read

public void read(JmeImporter e)
          throws java.io.IOException
Specified by:
read in interface Savable
Overrides:
read in class AssetKey<Spatial>
Throws:
java.io.IOException

hashCode

public int hashCode()
Overrides:
hashCode in class AssetKey<Spatial>

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class AssetKey<Spatial>