artofillusion.script
Class ScriptedObject

java.lang.Object
  extended by artofillusion.object.Object3D
      extended by artofillusion.object.ObjectCollection
          extended by artofillusion.script.ScriptedObject

public class ScriptedObject
extends ObjectCollection

This class represents an Object3D whose properties are defined by a script.


Nested Class Summary
static class ScriptedObject.ScriptedObjectKeyframe
          Inner class representing a pose for a scripted object.
 
Field Summary
 
Fields inherited from class artofillusion.object.Object3D
APPROXIMATELY, CANT_CONVERT, EXACTLY
 
Constructor Summary
ScriptedObject(java.io.DataInputStream in, Scene theScene)
          This constructor reconstructs a ScriptedObject from an input stream.
ScriptedObject(java.lang.String scriptText)
           
ScriptedObject(java.lang.String scriptText, java.lang.String language)
           
 
Method Summary
 void applyPoseKeyframe(Keyframe k)
          Modify this object based on a pose keyframe.
 void configurePoseTrack(PoseTrack track)
          This will be called whenever a new pose track is created for this object.
 void copyObject(Object3D obj)
          Copy all the properties of another object, to make this one identical to it.
 Object3D duplicate()
          Create a new object which is an exact duplicate of this one.
 void edit(EditingWindow parent, ObjectInfo info, java.lang.Runnable cb)
          Allow the user to edit the script.
 void editKeyframe(EditingWindow parent, Keyframe k, ObjectInfo info)
          Allow the user to edit a keyframe returned by getPoseKeyframe().
 double[] getDefaultPoseValues()
          Get the default list of graphable values for a keyframe returned by getPoseKeyframe().
 java.lang.String getLanguage()
          Get the language the script is written in.
 int getNumParameters()
          Get the number of parameters for this object.
 ObjectScript getObjectScript()
          Get the parsed form of the script.
 java.lang.String getParameterName(int i)
          Get the name of the i'th parameter.
 double getParameterValue(int i)
          Get the value of the i'th parameter.
 Keyframe getPoseKeyframe()
          Return a Keyframe which describes the current pose of this object.
 java.lang.String[] getPoseValueNames()
          Return an array containing the names of the graphable values for the keyframes returned by getPoseKeyframe().
 Property[] getProperties()
          Get a list of editable properties defined by this object.
 java.lang.Object getPropertyValue(int index)
          Get the value of one of this object's editable properties.
 java.lang.String getScript()
          Get the script which defines this object.
 boolean isEditable()
          If the object can be edited by the user, isEditable() should be overridden to return true.
 void setLanguage(java.lang.String language)
          Set the language the script is written in.
 void setParameterName(int i, java.lang.String name)
          Set the name of the i'th parameter.
 void setParameters(java.lang.String[] names, double[] values)
          Set a new list of parameters.
 void setParameterValue(int i, double value)
          Set the value of the i'th parameter.
 void setPropertyValue(int index, java.lang.Object value)
          Set the value of one of this object's editable properties.
 void setScript(java.lang.String scriptText)
          Set the script which defines this object.
 void setSize(double xsize, double ysize, double zsize)
          setSize() has no effect, since the geometry of the object is set by the script.
 void writeToFile(java.io.DataOutputStream out, Scene theScene)
          Write a serialized representation of this object to an output stream.
 
Methods inherited from class artofillusion.object.ObjectCollection
canConvertToTriangleMesh, canSetMaterial, convertToTriangleMesh, getBounds, getObjects, getRenderingMesh, getWireframeMesh, isClosed, renderObject, sceneChanged, setUsesCoords, setUsesTime
 
Methods inherited from class artofillusion.object.Object3D
canConvertToActor, canSetTexture, copyTextureAndMaterial, editGesture, getAverageParameterValues, getMaterial, getMaterialMapping, getParameters, getParameterValue, getParameterValues, getPosableObject, getSkeleton, getTexture, getTextureMapping, readParameterValue, setMaterial, setParameters, setParameterValue, setParameterValues, setTexture
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScriptedObject

public ScriptedObject(java.lang.String scriptText,
                      java.lang.String language)

ScriptedObject

public ScriptedObject(java.lang.String scriptText)

ScriptedObject

public ScriptedObject(java.io.DataInputStream in,
                      Scene theScene)
               throws java.io.IOException,
                      java.io.InvalidObjectException
This constructor reconstructs a ScriptedObject from an input stream.

Throws:
java.io.IOException
java.io.InvalidObjectException
Method Detail

getScript

public java.lang.String getScript()
Get the script which defines this object.


setScript

public void setScript(java.lang.String scriptText)
Set the script which defines this object.


getLanguage

public java.lang.String getLanguage()
Get the language the script is written in.


setLanguage

public void setLanguage(java.lang.String language)
Set the language the script is written in.


getObjectScript

public ObjectScript getObjectScript()
Get the parsed form of the script.


getNumParameters

public final int getNumParameters()
Get the number of parameters for this object.


getParameterName

public final java.lang.String getParameterName(int i)
Get the name of the i'th parameter.


getParameterValue

public final double getParameterValue(int i)
Get the value of the i'th parameter.


setParameterName

public void setParameterName(int i,
                             java.lang.String name)
Set the name of the i'th parameter.


setParameterValue

public void setParameterValue(int i,
                              double value)
Set the value of the i'th parameter.


setParameters

public void setParameters(java.lang.String[] names,
                          double[] values)
Set a new list of parameters.


duplicate

public Object3D duplicate()
Create a new object which is an exact duplicate of this one.

Specified by:
duplicate in class Object3D

copyObject

public void copyObject(Object3D obj)
Copy all the properties of another object, to make this one identical to it. If the two objects are of different classes, this will throw a ClassCastException.

Specified by:
copyObject in class Object3D

setSize

public void setSize(double xsize,
                    double ysize,
                    double zsize)
setSize() has no effect, since the geometry of the object is set by the script.

Specified by:
setSize in class Object3D

getProperties

public Property[] getProperties()
Get a list of editable properties defined by this object.

Overrides:
getProperties in class Object3D

getPropertyValue

public java.lang.Object getPropertyValue(int index)
Get the value of one of this object's editable properties.

Overrides:
getPropertyValue in class Object3D
Parameters:
index - the index of the property to get

setPropertyValue

public void setPropertyValue(int index,
                             java.lang.Object value)
Set the value of one of this object's editable properties.

Overrides:
setPropertyValue in class Object3D
Parameters:
index - the index of the property to set
value - the value to set for the property

getPoseKeyframe

public Keyframe getPoseKeyframe()
Return a Keyframe which describes the current pose of this object.

Specified by:
getPoseKeyframe in class Object3D

applyPoseKeyframe

public void applyPoseKeyframe(Keyframe k)
Modify this object based on a pose keyframe.

Specified by:
applyPoseKeyframe in class Object3D

getPoseValueNames

public java.lang.String[] getPoseValueNames()
Return an array containing the names of the graphable values for the keyframes returned by getPoseKeyframe().


getDefaultPoseValues

public double[] getDefaultPoseValues()
Get the default list of graphable values for a keyframe returned by getPoseKeyframe().


configurePoseTrack

public void configurePoseTrack(PoseTrack track)
This will be called whenever a new pose track is created for this object. It allows the object to configure the track by setting its graphable values, subtracks, etc.

Overrides:
configurePoseTrack in class Object3D

editKeyframe

public void editKeyframe(EditingWindow parent,
                         Keyframe k,
                         ObjectInfo info)
Allow the user to edit a keyframe returned by getPoseKeyframe().

Overrides:
editKeyframe in class Object3D

isEditable

public boolean isEditable()
Description copied from class: Object3D
If the object can be edited by the user, isEditable() should be overridden to return true. edit() should then create a window and allow the user to edit the object.

Overrides:
isEditable in class Object3D

edit

public void edit(EditingWindow parent,
                 ObjectInfo info,
                 java.lang.Runnable cb)
Allow the user to edit the script.

Overrides:
edit in class Object3D
Parameters:
parent - the window from which this command is being invoked
info - the ObjectInfo corresponding to this object
cb - a callback which will be executed when editing is complete. If the user cancels the operation, it will not be called.

writeToFile

public void writeToFile(java.io.DataOutputStream out,
                        Scene theScene)
                 throws java.io.IOException
Write a serialized representation of this object to an output stream.

Overrides:
writeToFile in class Object3D
Throws:
java.io.IOException


Copyright © 1999-2011 by Peter Eastman.