com.jme.scene
Class CloneCreator

java.lang.Object
  extended bycom.jme.scene.CloneCreator

public class CloneCreator
extends java.lang.Object

Started Date: Sep 16, 2004

This class controlls how a Spatial should be cloned. Users add properties to a CloneCreator object, along with the Spatial they want to clone. Then, calls to createCopy() return a spatial that is the clone of the spatial passed to this object's Constructor. Spatial objects must define Spatial.putClone() in order to be cloned.

Author:
Jack Lindamood

Field Summary
 java.util.HashMap originalToCopy
          Maps original Spatials to their Copy.
 
Constructor Summary
CloneCreator(Spatial toCopy)
          Creates a new CloneCreator that will make clones of the given spatial.
 
Method Summary
 void addProperty(java.lang.String property)
          Adds a Clone property that the method createCopy() should watch for when making copies of the original spatial and its children.
 boolean CloneIDExist(Geometry geometry)
          Returns true if a CloneID exist for the given geometry.
 void createCloneID(Geometry geometry)
          Creates a Clone ID for the given geometry object.
 Spatial createCopy()
          Creates a copy of the original and returns the copy.
 int getCloneID(Geometry geometry)
          Returns the Clone ID of a geometry original.
 boolean isSet(java.lang.String prop)
          Returns true if the given property is set.
 void queueJointController(JointController jc)
          Signals that a JointController needs to be processed after the clone happens.
 void queueKeyframeController(KeyframeController kc)
          Signals that a KeyframeController needs to be processed after the clone happens.
 void queueSpatialTransformer(SpatialTransformer st)
          Signals that a SpatialTransformer needs to be processed after the clone happens.
 void removeProperty(java.lang.String property)
          Removes a set Clone property for this CloneCreator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

originalToCopy

public java.util.HashMap originalToCopy
Maps original Spatials to their Copy. Usefull for reasigning copied Controllers.

Constructor Detail

CloneCreator

public CloneCreator(Spatial toCopy)
Creates a new CloneCreator that will make clones of the given spatial.

Parameters:
toCopy - The Spatial to copy.
Method Detail

addProperty

public void addProperty(java.lang.String property)
Adds a Clone property that the method createCopy() should watch for when making copies of the original spatial and its children.

Parameters:
property - The property to watch for.

removeProperty

public void removeProperty(java.lang.String property)
Removes a set Clone property for this CloneCreator.

Parameters:
property - The property to remove.

isSet

public boolean isSet(java.lang.String prop)
Returns true if the given property is set.

Parameters:
prop - The property to check for.
Returns:
True if it is set.

createCopy

public Spatial createCopy()
Creates a copy of the original and returns the copy.

Returns:

queueJointController

public void queueJointController(JointController jc)
Signals that a JointController needs to be processed after the clone happens. This should not be called by users directly. It is called by the cloned JointController automatically.

Parameters:
jc - The JointController that will later be processed.

queueSpatialTransformer

public void queueSpatialTransformer(SpatialTransformer st)
Signals that a SpatialTransformer needs to be processed after the clone happens. This should not be called by users directly. It is called by the cloned SpatialTransformer automatically.

Parameters:
st - The SpatialTransformer that will later be processed.

queueKeyframeController

public void queueKeyframeController(KeyframeController kc)
Signals that a KeyframeController needs to be processed after the clone happens. This should not be called by users directly. It is called by the cloned KeyframeController automatically.

Parameters:
kc - The KeyframeController that will later be processed.

createCloneID

public void createCloneID(Geometry geometry)
Creates a Clone ID for the given geometry object. This ID is applied to any Geometry that are clones of this geometry from this CloneCreator. Users should have little use for calling this directly. Instead, let it be called automatically by the Geometry object durring Clone calls.

Parameters:
geometry - The geometry object that needs to be cloned.

getCloneID

public int getCloneID(Geometry geometry)
Returns the Clone ID of a geometry original. Users should have little use for calling this directly. Instead, let it be called automatically by the Geometry object durring Clone calls.

Parameters:
geometry - The original.
Returns:
The original's ID.

CloneIDExist

public boolean CloneIDExist(Geometry geometry)
Returns true if a CloneID exist for the given geometry. Users should have little use for calling this directly. Instead, let it be called automatically by the Geometry object durring Clone calls.

Parameters:
geometry - The geometry original to check.
Returns:
True if a Clone ID exist for that geometry.