Package jme3utilities
Class SubtreeControl
java.lang.Object
com.jme3.scene.control.AbstractControl
jme3utilities.SimpleControl
jme3utilities.SubtreeControl
- All Implemented Interfaces:
com.jme3.export.Savable,com.jme3.scene.control.Control,com.jme3.util.clone.JmeCloneable,Cloneable
- Direct Known Subclasses:
AxesVisualizer,BoundsVisualizer,SkeletonVisualizer,VectorVisualizer
A SimpleControl to manage a subtree of the scene graph. Such controls can be
added only to nodes, not geometries.
Each instance is disabled at creation.
-
Field Summary
Fields inherited from class com.jme3.scene.control.AbstractControl
enabled, spatial -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()Create a shallow copy of this Control.voidcloneFields(com.jme3.util.clone.Cloner cloner, Object original) Callback fromClonerto convert this shallow-cloned Control into a deep-cloned one, using the specified Cloner and original to resolve copied fields.com.jme3.scene.control.ControlcloneForSpatial(com.jme3.scene.Spatial cloneNode) Clone this Control for a different Spatial.com.jme3.scene.SpatialAccess this control's subtree.voidread(com.jme3.export.JmeImporter importer) De-serialize this Control from the specified importer, for example when loading from a J3O file.voidsetEnabled(boolean newState) Enable or disable this Control.voidsetSpatial(com.jme3.scene.Spatial newSpatial) Alter which Node is controlled.protected final voidsetSubtree(com.jme3.scene.Spatial desiredSubtree) Initialize the subtree.voidwrite(com.jme3.export.JmeExporter exporter) Serialize this Control to the specified exporter, for example when saving to a J3O file.Methods inherited from class jme3utilities.SimpleControl
controlRender, controlUpdate, isEnabled, toggleEnabledMethods inherited from class com.jme3.scene.control.AbstractControl
getSpatial, jmeClone, render, update
-
Constructor Details
-
SubtreeControl
protected SubtreeControl()Instantiate a disabled Control.
-
-
Method Details
-
getSubtree
public com.jme3.scene.Spatial getSubtree()Access this control's subtree.- Returns:
- the pre-existing instance, or null if none
-
setSubtree
protected final void setSubtree(com.jme3.scene.Spatial desiredSubtree) Initialize the subtree.- Parameters:
desiredSubtree- the desired subtree (not null, not parented)
-
clone
Create a shallow copy of this Control.- Overrides:
clonein classObject- Returns:
- a new Control, equivalent to this one
- Throws:
CloneNotSupportedException- if superclass isn't cloneable
-
cloneFields
Callback fromClonerto convert this shallow-cloned Control into a deep-cloned one, using the specified Cloner and original to resolve copied fields.- Specified by:
cloneFieldsin interfacecom.jme3.util.clone.JmeCloneable- Overrides:
cloneFieldsin classcom.jme3.scene.control.AbstractControl- Parameters:
cloner- the Cloner that's cloning this Control (not null)original- the instance from which this Control was shallow-cloned (not null, unaffected)
-
cloneForSpatial
public com.jme3.scene.control.Control cloneForSpatial(com.jme3.scene.Spatial cloneNode) Clone this Control for a different Spatial. No longer used as of JME 3.1.- Specified by:
cloneForSpatialin interfacecom.jme3.scene.control.Control- Overrides:
cloneForSpatialin classcom.jme3.scene.control.AbstractControl- Parameters:
cloneNode- (unused)- Returns:
- never
- Throws:
UnsupportedOperationException- always
-
read
De-serialize this Control from the specified importer, for example when loading from a J3O file.- Specified by:
readin interfacecom.jme3.export.Savable- Overrides:
readin classcom.jme3.scene.control.AbstractControl- Parameters:
importer- (not null)- Throws:
IOException- from the importer
-
setEnabled
public void setEnabled(boolean newState) Enable or disable this Control.Disabling the Control immediately detaches the subtree (if any) from the controlled node (if any). Enabling the Control immediately attaches the subtree to the Node.
- Overrides:
setEnabledin classcom.jme3.scene.control.AbstractControl- Parameters:
newState- true→enable the control, false→disable it
-
setSpatial
public void setSpatial(com.jme3.scene.Spatial newSpatial) Alter which Node is controlled. Invoked when the Control is added to or removed from a Node. Should be invoked only by a subclass or from Spatial. Do not invoke directly from user code.- Specified by:
setSpatialin interfacecom.jme3.scene.control.Control- Overrides:
setSpatialin classcom.jme3.scene.control.AbstractControl- Parameters:
newSpatial- the Node to control, or null to remove
-
write
Serialize this Control to the specified exporter, for example when saving to a J3O file.- Specified by:
writein interfacecom.jme3.export.Savable- Overrides:
writein classcom.jme3.scene.control.AbstractControl- Parameters:
exporter- (not null)- Throws:
IOException- from the exporter
-