artofillusion.animation
Class Actor

java.lang.Object
  extended by artofillusion.object.Object3D
      extended by artofillusion.object.ObjectWrapper
          extended by artofillusion.animation.Actor

public class Actor
extends ObjectWrapper

An Actor is an object with a set of predefined gestures. Gestures can be blended in arbitrary combinations to form poses.


Nested Class Summary
static class Actor.ActorKeyframe
          Inner class representing a pose for an Actor.
 
Field Summary
 
Fields inherited from class artofillusion.object.Object3D
APPROXIMATELY, CANT_CONVERT, EXACTLY
 
Constructor Summary
Actor(java.io.DataInputStream in, Scene theScene)
          Reconstruct this object from its serialized representation.
Actor(Object3D obj)
           
 
Method Summary
 void addGesture(Gesture p, java.lang.String name)
          Add a new gesture to this actor.
 void applyPoseKeyframe(Keyframe k)
          Modify this object based on a pose keyframe.
 boolean canSetMaterial()
          This method tells whether materials can be assigned to the object.
 boolean canSetTexture()
          All of the following methods call through to the corresponding methods on the object.
 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.
 void deleteGestureWithID(int id)
          Delete a gesture from this actor.
 Object3D duplicate()
          Create a new object which is an exact duplicate of this one.
 void edit(EditingWindow parent, ObjectInfo info, java.lang.Runnable cb)
          Display a window in which the user can edit this object.
 void editKeyframe(EditingWindow parent, Keyframe k, ObjectInfo info)
          Allow the user to edit a keyframe returned by getPoseKeyframe().
static Actor getActor(Object3D obj)
          This is a utility routine.
 Gesture getGesture(int i)
          Get the i'th gesture defined for this actor.
 int getGestureID(int i)
          Get the ID of the i'th gesture defined for this actor.
 int getGestureIndex(int id)
          Return the index of the gesture with a particular ID, or -1 if there is no gesture with that ID.
 java.lang.String getGestureName(int i)
          Get the name of the i'th gesture defined for this actor.
 Gesture getGestureWithID(int id)
          Get the gesture with a particular ID, or null if there is no gesture with that ID.
 int getNumGestures()
          Get the number of gestures defined for this actor.
 Keyframe getPoseKeyframe()
          Return a Keyframe which describes the current pose of this object.
 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.
 boolean isEditable()
          If the object can be edited by the user, isEditable() should be overridden to return true.
 void setGestureName(int i, java.lang.String name)
          Set the name of the i'th gesture defined for this actor.
 void setMaterial(Material mat, MaterialMapping map)
          Set the Material and MaterialMapping for this object.
 void setParameterValue(TextureParameter param, ParameterValue value)
          Set the values of a texture parameter in every gesture.
 void setParameterValues(ParameterValue[] val)
          Set the list of objects defining the values of texture parameters.
 void setPropertyValue(int index, java.lang.Object value)
          Set the value of one of this object's editable properties.
 void setSize(double xsize, double ysize, double zsize)
          The size of an Actor cannot be set directly, since that is determined by its Poses.
 void setTexture(Texture tex, TextureMapping map)
          Set the Texture and TextureMapping for this object.
 void shapeMeshFromGestures(Object3D obj)
          Given an object (either this Actor's object or a duplicate of it), reshape the object based on this Actor's getures.
 void writeToFile(java.io.DataOutputStream out, Scene theScene)
          Write a representation of this object to a file.
 
Methods inherited from class artofillusion.object.ObjectWrapper
canConvertToTriangleMesh, convertToTriangleMesh, editGesture, getAverageParameterValues, getBounds, getMaterial, getMaterialMapping, getParameters, getParameterValue, getParameterValues, getRenderingMesh, getSkeleton, getTexture, getTextureMapping, getWireframeMesh, getWrappedObject, isClosed, renderObject, sceneChanged, setParameters
 
Methods inherited from class artofillusion.object.Object3D
canConvertToActor, copyTextureAndMaterial, getPosableObject, readParameterValue
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Actor

public Actor(Object3D obj)

Actor

public Actor(java.io.DataInputStream in,
             Scene theScene)
      throws java.io.IOException,
             java.io.InvalidObjectException
Reconstruct this object from its serialized representation.

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

addGesture

public void addGesture(Gesture p,
                       java.lang.String name)
Add a new gesture to this actor.


deleteGestureWithID

public void deleteGestureWithID(int id)
Delete a gesture from this actor.


getNumGestures

public int getNumGestures()
Get the number of gestures defined for this actor.


getGesture

public Gesture getGesture(int i)
Get the i'th gesture defined for this actor.


getGestureWithID

public Gesture getGestureWithID(int id)
Get the gesture with a particular ID, or null if there is no gesture with that ID.


getGestureName

public java.lang.String getGestureName(int i)
Get the name of the i'th gesture defined for this actor.


setGestureName

public void setGestureName(int i,
                           java.lang.String name)
Set the name of the i'th gesture defined for this actor.


getGestureID

public int getGestureID(int i)
Get the ID of the i'th gesture defined for this actor.


getGestureIndex

public int getGestureIndex(int id)
Return the index of the gesture with a particular ID, or -1 if there is no gesture with that ID.


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)
The size of an Actor cannot be set directly, since that is determined by its Poses.

Specified by:
setSize in class Object3D

isEditable

public boolean isEditable()
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)
Description copied from class: Object3D
Display a window in which the user can edit this object.

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.

canSetTexture

public boolean canSetTexture()
All of the following methods call through to the corresponding methods on the object.

Overrides:
canSetTexture in class Object3D

canSetMaterial

public boolean canSetMaterial()
Description copied from class: Object3D
This method tells whether materials can be assigned to the object. The default implementation will give the correct result for most objects, but subclasses can override this if necessary.

Overrides:
canSetMaterial in class Object3D

setTexture

public void setTexture(Texture tex,
                       TextureMapping map)
Description copied from class: Object3D
Set the Texture and TextureMapping for this object.

Overrides:
setTexture in class Object3D

setMaterial

public void setMaterial(Material mat,
                        MaterialMapping map)
Description copied from class: Object3D
Set the Material and MaterialMapping for this object. Pass null for both arguments to specify that the object does not have a Material.

Overrides:
setMaterial in class Object3D

setParameterValues

public void setParameterValues(ParameterValue[] val)
Set the list of objects defining the values of texture parameters.

Overrides:
setParameterValues in class ObjectWrapper

setParameterValue

public void setParameterValue(TextureParameter param,
                              ParameterValue value)
Set the values of a texture parameter in every gesture.

Overrides:
setParameterValue in class ObjectWrapper

shapeMeshFromGestures

public void shapeMeshFromGestures(Object3D obj)
Given an object (either this Actor's object or a duplicate of it), reshape the object based on this Actor's getures. This function examines the object's skeleton, finds the combination of gestures that most nearly reproduce that skeleton shape, and then adjusts all of the vertex positions based on the gestures.


writeToFile

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

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

getProperties

public Property[] getProperties()
Description copied from class: Object3D
Get a list of editable properties defined by this object.

Overrides:
getProperties in class Object3D

getPropertyValue

public java.lang.Object getPropertyValue(int index)
Description copied from class: Object3D
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)
Description copied from class: Object3D
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.

Overrides:
getPoseKeyframe in class ObjectWrapper

applyPoseKeyframe

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

Overrides:
applyPoseKeyframe in class ObjectWrapper

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 ObjectWrapper

editKeyframe

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

Overrides:
editKeyframe in class ObjectWrapper

getActor

public static Actor getActor(Object3D obj)
This is a utility routine. It takes an Object3D as its argument. If the object is an Actor, it is simply returned. If the argument is an ObjectWrapper which contains an Actor, the inner Actor is returned. Otherwise, it returns null.



Copyright © 1999-2011 by Peter Eastman.