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

public abstract class SubtreeControl extends SimpleControl
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
    Modifier
    Constructor
    Description
    protected
    Instantiate a disabled Control.
  • Method Summary

    Modifier and Type
    Method
    Description
    Create a shallow copy of this Control.
    void
    cloneFields(com.jme3.util.clone.Cloner cloner, Object original)
    Callback from Cloner to convert this shallow-cloned Control into a deep-cloned one, using the specified Cloner and original to resolve copied fields.
    com.jme3.scene.control.Control
    cloneForSpatial(com.jme3.scene.Spatial cloneNode)
    Clone this Control for a different Spatial.
    com.jme3.scene.Spatial
    Access this control's subtree.
    void
    read(com.jme3.export.JmeImporter importer)
    De-serialize this Control from the specified importer, for example when loading from a J3O file.
    void
    setEnabled(boolean newState)
    Enable or disable this Control.
    void
    setSpatial(com.jme3.scene.Spatial newSpatial)
    Alter which Node is controlled.
    protected final void
    setSubtree(com.jme3.scene.Spatial desiredSubtree)
    Initialize the subtree.
    void
    write(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, toggleEnabled

    Methods inherited from class com.jme3.scene.control.AbstractControl

    getSpatial, jmeClone, render, update

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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:
      clone in class Object
      Returns:
      a new Control, equivalent to this one
      Throws:
      CloneNotSupportedException - if superclass isn't cloneable
    • cloneFields

      public void cloneFields(com.jme3.util.clone.Cloner cloner, Object original)
      Callback from Cloner to convert this shallow-cloned Control into a deep-cloned one, using the specified Cloner and original to resolve copied fields.
      Specified by:
      cloneFields in interface com.jme3.util.clone.JmeCloneable
      Overrides:
      cloneFields in class com.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:
      cloneForSpatial in interface com.jme3.scene.control.Control
      Overrides:
      cloneForSpatial in class com.jme3.scene.control.AbstractControl
      Parameters:
      cloneNode - (unused)
      Returns:
      never
      Throws:
      UnsupportedOperationException - always
    • read

      public void read(com.jme3.export.JmeImporter importer) throws IOException
      De-serialize this Control from the specified importer, for example when loading from a J3O file.
      Specified by:
      read in interface com.jme3.export.Savable
      Overrides:
      read in class com.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:
      setEnabled in class com.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:
      setSpatial in interface com.jme3.scene.control.Control
      Overrides:
      setSpatial in class com.jme3.scene.control.AbstractControl
      Parameters:
      newSpatial - the Node to control, or null to remove
    • write

      public void write(com.jme3.export.JmeExporter exporter) throws IOException
      Serialize this Control to the specified exporter, for example when saving to a J3O file.
      Specified by:
      write in interface com.jme3.export.Savable
      Overrides:
      write in class com.jme3.scene.control.AbstractControl
      Parameters:
      exporter - (not null)
      Throws:
      IOException - from the exporter